├── demo-web-service ├── src │ └── main │ │ ├── resources │ │ ├── OB_HOME │ │ │ └── data │ │ │ │ ├── general.json │ │ │ │ ├── billingsystem.json │ │ │ │ ├── billercategory.json │ │ │ │ ├── products.json │ │ │ │ ├── atm.json │ │ │ │ ├── Investment.json │ │ │ │ ├── limit.json │ │ │ │ ├── billpaymentitem.json │ │ │ │ ├── biller.json │ │ │ │ ├── card.json │ │ │ │ ├── branch.json │ │ │ │ ├── cardlimit.json │ │ │ │ ├── customer.json │ │ │ │ ├── charges.json │ │ │ │ ├── statement.json │ │ │ │ ├── agency.json │ │ │ │ ├── accounttype.json │ │ │ │ ├── bank_meta.json │ │ │ │ ├── account.json │ │ │ │ └── directdebit.json │ │ └── application-demo.properties │ │ └── java │ │ └── ng │ │ └── openbanking │ │ └── api │ │ └── demo │ │ └── service │ │ ├── DemoInvestmentInfoService.java │ │ ├── DemoGeneralInfoService.java │ │ ├── DemoCustomerInfoService.java │ │ ├── DemoBillerInfoService.java │ │ ├── DemoBankCardService.java │ │ ├── DataService.java │ │ ├── DemoTransactionService.java │ │ ├── DemoInfoService.java │ │ └── DemoAccountService.java └── pom.xml ├── bank-service ├── src │ └── main │ │ └── java │ │ └── ng │ │ └── openbanking │ │ └── api │ │ └── payload │ │ ├── definition │ │ ├── ChannelType.java │ │ ├── VersionServices.java │ │ ├── BlockType.java │ │ ├── AccountType.java │ │ ├── CustomerStatus.java │ │ ├── CardType.java │ │ ├── ProcessState.java │ │ ├── AccountNumberFormat.java │ │ ├── InvestmentBookingType.java │ │ ├── AgencyType.java │ │ ├── BillingSystem.java │ │ ├── CardPickupType.java │ │ ├── CustomerType.java │ │ ├── BranchType.java │ │ ├── PeriodType.java │ │ ├── CardBrand.java │ │ ├── BankCategory.java │ │ ├── ErrorCode.java │ │ ├── DirectDebitCancelReason.java │ │ ├── AgencyServiceType.java │ │ ├── OperationStatus.java │ │ └── TransactionType.java │ │ ├── bank │ │ ├── exception │ │ │ ├── BankResourceNotFoundException.java │ │ │ └── ServiceOperationNotSupported.java │ │ └── service │ │ │ ├── GeneralInfoService.java │ │ │ ├── InvestmentInfoService.java │ │ │ ├── BillerInfoService.java │ │ │ ├── CustomerInfoService.java │ │ │ ├── BankCardService.java │ │ │ ├── BankInfoService.java │ │ │ ├── BankTransactionService.java │ │ │ └── BankAccountService.java │ │ ├── billpayment │ │ ├── BillingSystem.java │ │ ├── BillerCategory.java │ │ ├── BillPaymentItem.java │ │ └── Biller.java │ │ ├── account │ │ ├── AccountCreationResponse.java │ │ ├── AccountBlock.java │ │ ├── AccountType.java │ │ ├── AccountBalance.java │ │ ├── AccountCreationRequest.java │ │ └── Account.java │ │ ├── transaction │ │ ├── GetStatement.java │ │ ├── PlaceHoldOutput.java │ │ ├── MultipleTransfer.java │ │ ├── RemoveHoldOutput.java │ │ ├── SingleTransferBank.java │ │ ├── MultipleTransferBank.java │ │ ├── PlacePnd.java │ │ ├── SingleTransferBankOutput.java │ │ ├── MultipleTransferBankOutput.java │ │ ├── PlaceHold.java │ │ ├── GetHoldOutput.java │ │ ├── GetStatementOutput.java │ │ └── SingleTransfer.java │ │ ├── access │ │ └── Access.java │ │ ├── GenericServiceResponse.java │ │ ├── ErrorResponse.java │ │ ├── atm │ │ └── ATM.java │ │ ├── directdebit │ │ ├── DirectDebitSetupOutput.java │ │ ├── DirectDebitCancelRequest.java │ │ ├── DirectDebitSetup.java │ │ └── DirectDebit.java │ │ ├── general │ │ ├── GeneralInterfaceVersion.java │ │ ├── GeneralGetProduct.java │ │ ├── GeneralCharges.java │ │ └── BankMeta.java │ │ ├── investment │ │ ├── InvestmentProduct.java │ │ ├── InvestmentBook.java │ │ └── Investment.java │ │ ├── customer │ │ ├── PocessingOperationResponse.java │ │ ├── CustomerUpdateRequest.java │ │ └── Customer.java │ │ ├── limit │ │ ├── Limit.java │ │ └── LimitCustomer.java │ │ ├── card │ │ ├── SetCardLimit.java │ │ ├── CardRequest.java │ │ ├── Card.java │ │ ├── CardLimit.java │ │ └── CardType.java │ │ ├── branch │ │ └── Branch.java │ │ ├── agency │ │ └── Agency.java │ │ ├── pos │ │ └── POS.java │ │ └── GenericServiceResponseBuilder.java └── pom.xml ├── web-service ├── src │ ├── main │ │ ├── java │ │ │ └── ng │ │ │ │ └── openbanking │ │ │ │ └── api │ │ │ │ ├── controller │ │ │ │ ├── BaseApiController.java │ │ │ │ ├── advice │ │ │ │ │ └── ExceptionHandlerControllerAdvice.java │ │ │ │ ├── AccessController.java │ │ │ │ ├── LimitController.java │ │ │ │ ├── InvestmentController.java │ │ │ │ ├── GeneralController.java │ │ │ │ ├── DirectDebitController.java │ │ │ │ ├── AgencyController.java │ │ │ │ ├── BranchController.java │ │ │ │ ├── BillPaymentController.java │ │ │ │ ├── CardController.java │ │ │ │ ├── ATMController.java │ │ │ │ ├── POSController.java │ │ │ │ ├── CustomerController.java │ │ │ │ ├── AccountController.java │ │ │ │ └── TransactionController.java │ │ │ │ ├── config │ │ │ │ ├── DemoConfig.java │ │ │ │ ├── AccessScope.java │ │ │ │ └── SwaggerConfig.java │ │ │ │ ├── service │ │ │ │ └── UserService.java │ │ │ │ └── ApiNgApplication.java │ │ └── resources │ │ │ └── application.properties │ └── test │ │ └── java │ │ └── ng │ │ └── openbanking │ │ └── api │ │ └── ApiNgApplicationTests.java └── pom.xml ├── .gitignore ├── README.md ├── CODE_OF_CONDUCT.md ├── pom.xml └── LICENSE /demo-web-service/src/main/resources/OB_HOME/data/general.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "versionSupported": null, 4 | "versionService": null 5 | } 6 | ] -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/billingsystem.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "billingSystemId": "1", 4 | "billingSystemName": "BANK" 5 | } 6 | ] -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/ChannelType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum ChannelType { 4 | } 5 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/VersionServices.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum VersionServices { 4 | } 5 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/BaseApiController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | public abstract class BaseApiController { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | .idea 3 | /.settings/ 4 | /.classpath 5 | /.project 6 | **/.springBeans 7 | **/target/ 8 | **/*.iml 9 | target 10 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/BlockType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum BlockType{ 4 | PND, FRAUD 5 | 6 | } 7 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/AccountType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum AccountType { 4 | SAVING, CURRENT 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/CustomerStatus.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum CustomerStatus { 4 | 5 | ACTIVE 6 | } 7 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/CardType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum CardType { 4 | CREDIT,DEBIT,PRE_PAID, VIRTUAL 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/ProcessState.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum ProcessState { 4 | SUCESS, FAILED,SUBMITTED 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/AccountNumberFormat.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum AccountNumberFormat { 4 | NUBAN,OTHER 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/InvestmentBookingType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum InvestmentBookingType { 4 | DISCOUNTED 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/AgencyType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum AgencyType { 4 | FULL_AGENCY, MINI_AGENCY 5 | } 6 | 7 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/BillingSystem.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum BillingSystem { 4 | QUICK_TELLER, REMITA, ETRANZACT 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/CardPickupType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum CardPickupType { 4 | HOME_DELIVERY , SERVICE_OUTLET 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/CustomerType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum CustomerType { 4 | 5 | RETAIL, 6 | CORPORATE 7 | } 8 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/billercategory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "billingSystemId": "1", 4 | "categoryName": "Electricity", 5 | "categoryDescription": "Electricity" 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/BranchType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum BranchType { 4 | FULL_BRANCH, MINI_BRANCH, SERVICE_OUTLET 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/PeriodType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum PeriodType { 4 | DAY, WEEK, MONTH, QUATERLY, BI_ANNUAL, ANNUAL 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/CardBrand.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum CardBrand { 4 | AMEX, GENERIC, GENESIS, MASTER_CARD, UNION_PAY, VERVE, VISA 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/bank/exception/BankResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.bank.exception; 2 | 3 | public class BankResourceNotFoundException extends Exception { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/bank/exception/ServiceOperationNotSupported.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.bank.exception; 2 | 3 | public class ServiceOperationNotSupported extends Exception { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/BankCategory.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum BankCategory { 4 | COMMERCIAL, MERCHANT, MICRO_FINANCE, MOBILE_MONEY, OTHERS 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/ErrorCode.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum ErrorCode { 4 | 5 | UNAUTHORIZED, 6 | SERVER_ERROR, 7 | VALIDATION_ERROR 8 | } 9 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/products.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "productId": "1", 4 | "description": "Macbook Pro", 5 | "eligibility": null, 6 | "currency": "EURO", 7 | "name": "Laptop" 8 | } 9 | ] -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/DirectDebitCancelReason.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum DirectDebitCancelReason { 4 | 5 | CUSTOMER_INITIATED, INSUFFICIENT_FUNDS 6 | } 7 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/AgencyServiceType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum AgencyServiceType { 4 | CASH_IN, CASH_OUT, TRANSFER, BILL_PAYMENT , REMITTANCE, ACCOUNT_OPENING 5 | } 6 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/atm.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "atmId": "atm0001", 4 | "terminalId": "t100001", 5 | "atmName": "AIgbosere ATM", 6 | "longitude": 32, 7 | "latitude": 67, 8 | "baseCurrency": "NGN" 9 | } 10 | ] -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/Investment.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "productId": "1", 4 | "productName": "Mutual Fund", 5 | "productType": "FULL_BRANCH", 6 | "bookingType": "DISCOUNTED", 7 | "interestDiscountRate":"100.00" 8 | } 9 | 10 | ] -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/limit.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "transactionType": "DEPOSIT", 4 | "periodType": "DAY", 5 | "maxTransaction": "10000000", 6 | "maxAmountPerTransaction": "1000000000", 7 | "maxCumulativeAmount":"1000000000" 8 | } 9 | ] -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/OperationStatus.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum OperationStatus { 4 | 5 | SUCCESSFUL, 6 | SUBMITTED, 7 | PENDING_CUSTOMER_AUTH, 8 | FAILED, 9 | ERROR 10 | } 11 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/definition/TransactionType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.definition; 2 | 3 | public enum TransactionType { 4 | INTRA_BANK, INTER_BANK, BILL_PAYMENT, AIRTIME, DIRECT_DEBIT, PURCHASE, CASH_WITHDRAWAL, DEPOSIT, LINKED_ACCOUNT_TRANSFER 5 | } 6 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/billpayment/BillingSystem.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.billpayment; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class BillingSystem { 7 | private String billingSystemId; 8 | private String billingSystemName; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/billpaymentitem.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "billingSystemId": "1", 4 | "categoryId": "1", 5 | "billerId": "1", 6 | "billPaymentProductId": "1", 7 | "billPaymentProductName":"Electricity", 8 | "fixedOrVariableAmount":"1000" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/biller.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "categoryId": "1", 4 | "billerCategory": "Electricity", 5 | "categoryDescription": "Electricity Token", 6 | "billerId": "1", 7 | "nameOfBiller":"EKDEC", 8 | "customerId":"1", 9 | "currency":"NGN" 10 | } 11 | ] -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/card.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "accountNumber": "0123456789", 4 | "maskedPan": "012****78901", 5 | "token": "ABCED!@DCFVBBDDDD", 6 | "expiry": "10/12", 7 | "issuerNumber":"1", 8 | "cardName":"Sodiq Fagbola", 9 | "cardType": "CREDIT" 10 | } 11 | ] -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/account/AccountCreationResponse.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.account; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class AccountCreationResponse { 7 | private String accountNumber = "0123456789"; 8 | private String customerId = "1"; 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/GetStatement.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class GetStatement { 7 | private String accountNumber = "0123456789"; 8 | private String startDateAndendDate_Or_lastNumberOfRecords; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/billpayment/BillerCategory.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.billpayment; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class BillerCategory { 7 | private String billingSystemId; 8 | private String categoryName; 9 | private String categoryDescription; 10 | 11 | 12 | } 13 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/access/Access.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.access; 2 | import java.util.Timer; 3 | 4 | import lombok.Data; 5 | 6 | @Data 7 | public class Access { 8 | private String accessToken; 9 | private Timer expirationTime; 10 | private String tokenType = "Soft Token"; 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/PlaceHoldOutput.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class PlaceHoldOutput { 7 | private String holdReferenceId = "1"; 8 | private String responseCode = "00"; 9 | private String responseDescription = "Successful"; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/account/AccountBlock.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.account; 2 | 3 | import ng.openbanking.api.payload.definition.BlockType; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class AccountBlock { 9 | private String accountNumber; 10 | private BlockType blockType; 11 | private String blockMessage; 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/branch.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "atmbranchIdId": "b0001", 4 | "branchName": "Ikoyi Branch", 5 | "branchtype": "FULL_BRANCH", 6 | "street": "Adegbola Street", 7 | "city":"Ikoyi", 8 | "state": "Lagos", 9 | "longitude":65, 10 | "latitude":98, 11 | "phoneNumber":"phoneNumber", 12 | "numberOfATMs":34 13 | } 14 | ] -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/cardlimit.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Channel": "", 4 | "cardType": {}, 5 | "transactionType": "", 6 | "periodType": "", 7 | "maximumTransaction":"100", 8 | "maxAmountPerTransaction":"100", 9 | "maxCumulativeAmount":"100000", 10 | "outstandingTransaction":"100000", 11 | "outstandingCumulativeAmount":"100000" 12 | } 13 | ] -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/MultipleTransfer.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import java.util.List; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class MultipleTransfer { 9 | private String batchId = "1"; 10 | 11 | private String numberOfTransaction = "1"; 12 | 13 | List singleTransfer; 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/GenericServiceResponse.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload; 2 | 3 | import ng.openbanking.api.payload.definition.OperationStatus; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class GenericServiceResponse { 9 | 10 | private OperationStatus status; 11 | 12 | private String message; 13 | 14 | private T data; 15 | 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/ErrorResponse.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload; 2 | 3 | import ng.openbanking.api.payload.definition.OperationStatus; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class ErrorResponse { 9 | 10 | private OperationStatus status= OperationStatus.ERROR; 11 | 12 | private String message; 13 | 14 | private String code; 15 | 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/atm/ATM.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.atm; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class ATM { 7 | 8 | private String atmId; 9 | 10 | private String terminalId; 11 | 12 | private String atmName; 13 | 14 | private double longitude; 15 | 16 | private double latitude; 17 | 18 | private String baseCurrency; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/RemoveHoldOutput.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import ng.openbanking.api.payload.definition.OperationStatus; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class RemoveHoldOutput { 9 | 10 | private OperationStatus responseCode = OperationStatus.SUCCESSFUL; 11 | private String repsonseMessage = "Successful"; 12 | } 13 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/SingleTransferBank.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class SingleTransferBank extends SingleTransfer { 7 | private String destinationAccount = "0123456789"; 8 | private String destinationAccountName = "Sodiq Fagbola"; 9 | private String destinationBankCode = "012"; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/directdebit/DirectDebitSetupOutput.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.directdebit; 2 | 3 | import ng.openbanking.api.payload.definition.OperationStatus; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class DirectDebitSetupOutput { 9 | private OperationStatus responseCode; 10 | private String message; 11 | private String transactionReferenceId; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/MultipleTransferBank.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import java.util.List; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class MultipleTransferBank { 9 | 10 | private String batchId = "1"; 11 | 12 | private String numberOfTransaction = "1"; 13 | 14 | List singleTransferBanks; 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/general/GeneralInterfaceVersion.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.general; 2 | 3 | import java.util.List; 4 | 5 | import ng.openbanking.api.payload.definition.VersionServices; 6 | 7 | import lombok.Data; 8 | 9 | @Data 10 | public class GeneralInterfaceVersion { 11 | private String versionSupported; 12 | private List versionService; 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/application-demo.properties: -------------------------------------------------------------------------------- 1 | ob.name=Open Banking 2 | ob.url=http://openbanking.ng 3 | ob.email=contact@openbanking.ng 4 | ob.licence=Apache 2.0 5 | ob.licence.url=https://www.apache.org/licenses/LICENSE-2.0 6 | ob.version=1 7 | ob.api.name=Open Banking API (Demo) 8 | ob.api.description= A collection of API for the Open Banking Project 9 | 10 | #spring.resources.static-locations=classpath:/dist/ 11 | 12 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/config/DemoConfig.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.config; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Profile; 6 | 7 | @Configuration 8 | @Profile("demo") 9 | @ComponentScan(basePackages = "ng.openbanking.api.demo.service") 10 | public class DemoConfig { 11 | } 12 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/customer.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "customerID": "c0001", 4 | "firstName": "Sodiq", 5 | "lastName": "Fagbola", 6 | "otherNames": "ADamilare", 7 | "bvn":"123123123123123", 8 | "email": "sodiq@openbanking.com", 9 | "numberOfAccounts":"1", 10 | "type":"CORPORATE", 11 | "startDateOfRelationship":"03/11/2018 06:12:14", 12 | "address":"Lagos, Nigeria" 13 | } 14 | ] -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/PlacePnd.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import ng.openbanking.api.payload.definition.OperationStatus; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class PlacePnd { 9 | private String pndReferenceId = "1"; 10 | private OperationStatus responseCode = OperationStatus.SUCCESSFUL; 11 | private String responseMessage = "Successful"; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/charges.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "productName": "Laptop", 4 | "productId": "1", 5 | "transactionType": "DEPOSIT", 6 | "standardType": null, 7 | "standardChargeType": null, 8 | "minimumChargeType": null, 9 | "minimumCharge": null, 10 | "maximumCharge": null, 11 | "taxRate": null, 12 | "currency": "EURO", 13 | "maximumChargeType": null 14 | } 15 | ] -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/statement.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "accountNumber": "0123456789", 4 | "transactionType": "", 5 | "currency": "NGN", 6 | "narration": "Support fees", 7 | "amount": "1000.00", 8 | "channel": "", 9 | "debitOrCredit": "Debit", 10 | "referenceId": "1", 11 | "transactionTime": "01/10/2018 08:10:10", 12 | "valueDate": "01/10/2018 08:11:10", 13 | "bookDate": "01/10/2018 08:11:10" 14 | } 15 | ] -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/general/GeneralGetProduct.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.general; 2 | 3 | import javax.money.CurrencyUnit; 4 | import javax.money.Monetary; 5 | 6 | import lombok.Data; 7 | 8 | @Data 9 | public class GeneralGetProduct { 10 | private String productId; 11 | private String name; 12 | private String description; 13 | private String eligibility; 14 | private String currency; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/agency.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "agencyID": "10010123456789", 4 | "agencyType": "FULL_AGENCY", 5 | "agencyName": "Agen 01 (FULL)", 6 | "street": "Lekk 1", 7 | "city": "Ikoyi", 8 | "state": "Lagos", 9 | "latitude": "35", 10 | "longitude": "76", 11 | "phoneNumber": "090000000", 12 | "agencyServices": ["CASH_IN","CASH_OUT", "TRANSFER", "BILL_PAYMENT" , "REMITTANCE", "ACCOUNT_OPENING"] 13 | } 14 | ] -------------------------------------------------------------------------------- /web-service/src/test/java/ng/openbanking/api/ApiNgApplicationTests.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ApiNgApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/accounttype.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "accountTypeId": "0123456789", 4 | "accountTypeName": "Savings", 5 | "minimumBalance": "1000", 6 | "maximumBalance": "1000000", 7 | "maximumTransactionLimit": "10000", 8 | "maximumInFlow": "2500000", 9 | "currency": "NGN", 10 | "kycLevel": "1", 11 | "documentation": "Drivers License", 12 | "cardProduct": "Master Card", 13 | "digitalProduct": "Fast Cash" 14 | }] -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/directdebit/DirectDebitCancelRequest.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.directdebit; 2 | 3 | import ng.openbanking.api.payload.definition.DirectDebitCancelReason; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class DirectDebitCancelRequest { 9 | 10 | private String accountNumber; 11 | 12 | private String referenceNumber; 13 | 14 | private DirectDebitCancelReason directDebitCancelReason; 15 | } 16 | -------------------------------------------------------------------------------- /web-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=@spring.profiles.active@ 2 | ob.name=Open Banking 3 | ob.url=http://openbanking.ng 4 | ob.email=contact@openbanking.ng 5 | ob.licence=Apache 2.0 6 | ob.licence.url=https://www.apache.org/licenses/LICENSE-2.0 7 | ob.version=1 8 | ob.api.name=Open Banking API 9 | ob.api.description= A collection of API for the Open Banking Project 10 | 11 | 12 | #spring.resources.static-locations=classpath:/dist/ 13 | 14 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/SingleTransferBankOutput.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import ng.openbanking.api.payload.definition.OperationStatus; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class SingleTransferBankOutput { 9 | private OperationStatus responseCode = OperationStatus.SUCCESSFUL; 10 | private String responseMessage = "Successful"; 11 | private String transactionReferenceId = "1"; 12 | } 13 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/investment/InvestmentProduct.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.investment; 2 | import ng.openbanking.api.payload.definition.InvestmentBookingType; 3 | 4 | import lombok.Data; 5 | 6 | @Data 7 | public class InvestmentProduct { 8 | private String productId ; 9 | private String productName ; 10 | private String productType; 11 | private InvestmentBookingType bookingType; 12 | private String interestDiscountRate; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/customer/PocessingOperationResponse.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.customer; 2 | 3 | import ng.openbanking.api.payload.definition.OperationStatus; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class PocessingOperationResponse { 9 | 10 | private OperationStatus responseCode = OperationStatus.SUCCESSFUL; 11 | private String message = "Successful"; 12 | private String transactionReferenceId; 13 | 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/billpayment/BillPaymentItem.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.billpayment; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class BillPaymentItem { 7 | private String billingSystemId = "1"; 8 | private String categoryId = "1"; 9 | private String billerId = "1"; 10 | private String billPaymentProductId = "1"; 11 | private String billPaymentProductName = "Electricity"; 12 | private String fixedOrVariableAmount = "1000"; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/customer/CustomerUpdateRequest.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.customer; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class CustomerUpdateRequest { 7 | 8 | private String customerId = "1"; 9 | 10 | private String customerName = "Sodiq Fagbola"; 11 | 12 | private String email = "sodiq@openbanking.com"; 13 | 14 | private String phoneNumber = "0900000000"; 15 | 16 | private String address = "Lagos, Nigeria"; 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/billpayment/Biller.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.billpayment; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Biller { 7 | private String categoryId = "1"; 8 | private String billerCategory = "Electricity"; 9 | private String categoryDescription = "Electricity Token"; 10 | private String billerId = "1"; 11 | private String nameOfBiller = "EKDEC"; 12 | private String customerId = "1"; 13 | private String currency = "NGN"; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/limit/Limit.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.limit; 2 | 3 | import ng.openbanking.api.payload.definition.PeriodType; 4 | import ng.openbanking.api.payload.definition.TransactionType; 5 | 6 | import lombok.Data; 7 | 8 | @Data 9 | public class Limit { 10 | private TransactionType transactionType; 11 | private PeriodType periodType; 12 | private int maxTransaction ; 13 | private String maxAmountPerTransaction ; 14 | private String maxCumulativeAmount; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/card/SetCardLimit.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.card; 2 | import java.util.List; 3 | 4 | import ng.openbanking.api.payload.definition.ChannelType; 5 | import ng.openbanking.api.payload.definition.PeriodType; 6 | 7 | import lombok.Data; 8 | 9 | @Data 10 | public class SetCardLimit { 11 | private List channelType; 12 | private String channel; 13 | private String transactionType = "Payment"; 14 | private PeriodType periodType = PeriodType.DAY; 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/MultipleTransferBankOutput.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import ng.openbanking.api.payload.definition.OperationStatus; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class MultipleTransferBankOutput { 9 | private String batchId = "1"; 10 | private OperationStatus responseCode = OperationStatus.SUCCESSFUL; 11 | private String responseMessage = "Transfer Successful"; 12 | private String numberOfTransaction = "1"; 13 | private String transactionId = "1"; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/card/CardRequest.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.card; 2 | import ng.openbanking.api.payload.definition.CardPickupType; 3 | 4 | import lombok.Data; 5 | 6 | @Data 7 | public class CardRequest { 8 | private String accountNumber = "0123456789"; 9 | private String productId = "1"; 10 | private CardPickupType cardPickupType = CardPickupType.HOME_DELIVERY; 11 | private CardType cardType = new CardType(); 12 | private String branchId = "1"; 13 | private String deliveryAddress = "Obalende, Lagos"; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/bank_meta.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "bankName": "ABC Bank", 4 | "headOfficeAddress": "No 32, ACB Street", 5 | "swiftCode": "011", 6 | "nibssCode": "012", 7 | "cbnBankCode": "013", 8 | "numberOfBranches": "300", 9 | "numberOfCountryCode": null, 10 | "incorporationDate": null, 11 | "customerSupportPhone": "090000000000", 12 | "customerSupportEmail": "info@abc.ng", 13 | "website": "www.abc.ng", 14 | "bankCategory": "COMMERCIAL", 15 | "socialMediaTypeAndAddress": null, 16 | "rc": null 17 | } 18 | ] -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/branch/Branch.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.branch; 2 | import ng.openbanking.api.payload.definition.BranchType; 3 | 4 | import lombok.Data; 5 | @Data 6 | public class Branch { 7 | 8 | private String branchId ; 9 | private String branchName ; 10 | private BranchType branchtype ; 11 | private String street ; 12 | private String city ; 13 | private String state ; 14 | private double longitude; 15 | private double latitude ; 16 | private String phoneNumber; 17 | private int numberOfATMs; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/account.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "accountNumber": "0123456789", 4 | "customerId": null, 5 | "bvn": "", 6 | "fullName": "Sodiq Fagbola", 7 | "shortName": "Sodiq", 8 | "currency": "NGN", 9 | "accountOpeningDate": "03/11/2018 06:12:14", 10 | "lastTransactionDate": "03/11/2018 06:12:14", 11 | "status": "Successful", 12 | "bankSortCode": "012", 13 | "accountBalance": "0123456789", 14 | "phoneNumber": "090000000", 15 | "accountType": "CURRENT", 16 | "accountManagerName": "Mujib Ishola", 17 | "accountManagerPhone": "08000000000" 18 | } 19 | ] -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/card/Card.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.card; 2 | import java.util.Date; 3 | 4 | import com.fasterxml.jackson.annotation.JsonFormat; 5 | import ng.openbanking.api.payload.definition.CardType; 6 | 7 | import lombok.Data; 8 | 9 | @Data 10 | public class Card { 11 | private String accountNumber; 12 | private String maskedPan; 13 | private String token; 14 | @JsonFormat 15 | (shape = JsonFormat.Shape.STRING, pattern = "MM/yyyy") 16 | private Date expiry ; 17 | private String issuerNumber ; 18 | private String cardName; 19 | private CardType cardType; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/card/CardLimit.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.card; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class CardLimit { 7 | private String cardToken; 8 | private String Channel; 9 | private CardType cardType = new CardType(); 10 | private String transactionType = ""; 11 | private String periodType; 12 | private int maximumTransaction = 1; 13 | private String maxAmountPerTransaction = "100000"; 14 | private String maxCumulativeAmount = "1000000"; 15 | private String outstandingTransaction = "1000000"; 16 | private String outstandingCumulativeAmount = "10000"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/limit/LimitCustomer.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.limit; 2 | 3 | import ng.openbanking.api.payload.definition.PeriodType; 4 | import ng.openbanking.api.payload.definition.TransactionType; 5 | 6 | import lombok.Data; 7 | 8 | @Data 9 | public class LimitCustomer { 10 | private String channel; 11 | private TransactionType transactionType; 12 | private PeriodType periodType; 13 | private int maxTransaction; 14 | private String maxAmountPerTransaction; 15 | private String maxCumulativeAmount; 16 | private String outstandingTransaction; 17 | private String outstandingCumulativeAmount; 18 | } 19 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/general/GeneralCharges.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.general; 2 | 3 | import ng.openbanking.api.payload.definition.TransactionType; 4 | import lombok.Data; 5 | 6 | @Data 7 | public class GeneralCharges { 8 | private String productName; 9 | private String productId; 10 | private TransactionType transactionType; 11 | private String standardType; 12 | private String standardChargeType; 13 | private String minimumChargeType; 14 | private String minimumCharge; 15 | private String maximumCharge; 16 | private String MaximumChargeType; 17 | private String taxRate; 18 | private String currency; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/agency/Agency.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.agency; 2 | import java.util.List; 3 | 4 | import ng.openbanking.api.payload.definition.AgencyServiceType; 5 | import ng.openbanking.api.payload.definition.AgencyType; 6 | 7 | import lombok.Data; 8 | @Data 9 | public class Agency { 10 | private String agencyID; 11 | private String agencyName; 12 | private AgencyType agencyType; 13 | private String street; 14 | private String city ; 15 | private String State ; 16 | private double latitude ; 17 | private double longitude ; 18 | private String phoneNumber; 19 | private List agencyServices; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/investment/InvestmentBook.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.investment; 2 | 3 | import java.util.Date; 4 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | 7 | import lombok.Data; 8 | 9 | @Data 10 | public class InvestmentBook { 11 | private String productId; 12 | private String accountNumber; 13 | private String amount; 14 | private String currency ; 15 | 16 | @JsonFormat 17 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 18 | private Date dateBooked; 19 | @JsonFormat 20 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 21 | private Date maturityDate; 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/PlaceHold.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import java.util.Date; 4 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | 7 | import lombok.Data; 8 | 9 | @Data 10 | public class PlaceHold { 11 | 12 | 13 | private String accountNumber = "0123456789"; 14 | private String holdReferenceId; 15 | private String amount = "10000"; 16 | private String reason; 17 | @JsonFormat 18 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 19 | private Date startdate; 20 | @JsonFormat 21 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 22 | private Date enddate; 23 | } 24 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/card/CardType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.card; 2 | 3 | import javax.money.CurrencyUnit; 4 | import javax.money.Monetary; 5 | 6 | import ng.openbanking.api.payload.definition.CardBrand; 7 | 8 | import lombok.Data; 9 | 10 | @Data 11 | public class CardType { 12 | private CardBrand cardBrand = CardBrand.MASTER_CARD; 13 | private String productId = "1"; 14 | private ng.openbanking.api.payload.definition.CardType cardType = ng.openbanking.api.payload.definition.CardType.CREDIT; 15 | private String productName; 16 | private CurrencyUnit currency = Monetary.getCurrency("NGN"); 17 | private String purchasePrice = "10000"; 18 | private int validityPeriod = 1; 19 | } 20 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/account/AccountType.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.account; 2 | 3 | import javax.money.CurrencyUnit; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class AccountType { 9 | private String accountTypeId = "1"; 10 | private String accountTypeName = "Savings"; 11 | private String minimumBalance = "1000"; 12 | private String maximumBalance = "1000000"; 13 | private String maximumTransactionLimit = "10000"; 14 | private String maximumInFlow; 15 | private CurrencyUnit currency; 16 | private String kycLevel; 17 | private String documentation; 18 | private String cardProduct = "Master Card"; 19 | private String digitalProduct; 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/customer/Customer.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.customer; 2 | 3 | import java.util.Date; 4 | 5 | import ng.openbanking.api.payload.definition.CustomerStatus; 6 | import ng.openbanking.api.payload.definition.CustomerType; 7 | 8 | import lombok.Data; 9 | 10 | @Data 11 | public class Customer { 12 | 13 | private String customerID; 14 | 15 | private String firstName; 16 | 17 | private String lastName ; 18 | 19 | private String otherNames; 20 | 21 | private String bvn; 22 | 23 | private String email; 24 | 25 | private int numberOfAccounts; 26 | 27 | private CustomerType type; 28 | 29 | private Date startDateOfRelationship; 30 | 31 | private CustomerStatus status; 32 | 33 | private String address; 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/general/BankMeta.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.general; 2 | import ng.openbanking.api.payload.definition.BankCategory; 3 | 4 | import lombok.Data; 5 | 6 | @Data 7 | public class BankMeta { 8 | private String bankName; 9 | private String headOfficeAddress; 10 | private String swiftCode; 11 | private String nibssCode; 12 | private String cbnBankCode; 13 | private String numberOfBranches; 14 | private String numberOfCountryCode; 15 | private String rc; 16 | private String incorporationDate; 17 | private String customerSupportPhone; 18 | private String customerSupportEmail; 19 | private String website; 20 | private BankCategory bankCategory = BankCategory.COMMERCIAL; 21 | 22 | private String socialMediaTypeAndAddress; 23 | } 24 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/account/AccountBalance.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.account; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Date; 5 | 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | 8 | import lombok.Data; 9 | 10 | @Data 11 | public class AccountBalance { 12 | private String accountNumber = "0123456789";; 13 | private String accountName = "Adamu Alliu"; 14 | private BigDecimal availableBalance = new BigDecimal(1000000); 15 | private BigDecimal clearedBalance = new BigDecimal(1000000); 16 | private BigDecimal unClearedBalance = new BigDecimal(1000000); 17 | private BigDecimal lienBalance = new BigDecimal(1000000); 18 | 19 | @JsonFormat 20 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 21 | private Date date = new Date(); 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/pos/POS.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.pos; 2 | 3 | import java.util.Date; 4 | 5 | import javax.money.CurrencyUnit; 6 | import javax.money.Monetary; 7 | 8 | import com.fasterxml.jackson.annotation.JsonFormat; 9 | 10 | import lombok.Data; 11 | 12 | @Data 13 | public class POS { 14 | private String terminalId; 15 | private String merchantId; 16 | private String merchantName ; 17 | private String email ; 18 | private String phone; 19 | @JsonFormat 20 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 21 | private Date dateDeployed; 22 | private String currency ; 23 | private String terminalType; 24 | private String ptsa; 25 | private String ptsp; 26 | private String status; 27 | private double latitude; 28 | private double longitude; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/investment/Investment.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.investment; 2 | 3 | import java.util.Date; 4 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import ng.openbanking.api.payload.definition.InvestmentBookingType; 7 | 8 | import lombok.Data; 9 | @Data 10 | public class Investment { 11 | private String investmentId; 12 | private String productId ; 13 | private String accountNumber; 14 | private String amount ; 15 | private String currency; 16 | @JsonFormat 17 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 18 | private Date dateBooked; 19 | @JsonFormat 20 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 21 | private Date maturityDate; 22 | private InvestmentBookingType bookingType; 23 | private String interestDiscountRate; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/bank/service/GeneralInfoService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.bank.service; 2 | 3 | import java.util.List; 4 | 5 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 6 | import ng.openbanking.api.payload.general.BankMeta; 7 | import ng.openbanking.api.payload.general.GeneralCharges; 8 | import ng.openbanking.api.payload.general.GeneralGetProduct; 9 | import ng.openbanking.api.payload.general.GeneralInterfaceVersion; 10 | 11 | public interface GeneralInfoService { 12 | 13 | GeneralInterfaceVersion getInterfaceVersion() throws ServiceOperationNotSupported ; 14 | 15 | BankMeta getBankMeta() throws ServiceOperationNotSupported ; 16 | 17 | List getCharges() throws ServiceOperationNotSupported ; 18 | 19 | List getProducts() throws ServiceOperationNotSupported ; 20 | 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/GetHoldOutput.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import java.util.Date; 4 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import ng.openbanking.api.payload.definition.OperationStatus; 7 | 8 | import lombok.Data; 9 | 10 | @Data 11 | public class GetHoldOutput { 12 | 13 | private String accountNumber = "0123456789"; 14 | private String holdReferenceId = "1"; 15 | private OperationStatus responseCode = OperationStatus.SUCCESSFUL; 16 | private String respondeDescription = "Operation Successful"; 17 | private String amount = "10000"; 18 | private String reason; 19 | @JsonFormat 20 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 21 | private Date startdate; 22 | @JsonFormat 23 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 24 | private Date enddate; 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/advice/ExceptionHandlerControllerAdvice.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller.advice; 2 | 3 | 4 | import ng.openbanking.api.payload.ErrorResponse; 5 | import ng.openbanking.api.payload.definition.ErrorCode; 6 | import org.springframework.http.HttpStatus; 7 | import org.springframework.http.ResponseEntity; 8 | import org.springframework.web.bind.annotation.ControllerAdvice; 9 | import org.springframework.web.bind.annotation.ExceptionHandler; 10 | 11 | @ControllerAdvice 12 | public class ExceptionHandlerControllerAdvice { 13 | 14 | @ExceptionHandler 15 | public ResponseEntity handle(Throwable throwable) { 16 | ErrorResponse errorResponse = new ErrorResponse(); 17 | errorResponse.setMessage(throwable.getMessage()); 18 | errorResponse.setCode(ErrorCode.SERVER_ERROR.name()); 19 | return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/bank/service/InvestmentInfoService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.bank.service; 2 | 3 | import java.util.List; 4 | 5 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 6 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 7 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 8 | import ng.openbanking.api.payload.investment.InvestmentBook; 9 | import ng.openbanking.api.payload.investment.InvestmentProduct; 10 | 11 | public interface InvestmentInfoService { 12 | 13 | List getInvestmentProduct() throws BankResourceNotFoundException,ServiceOperationNotSupported ; 14 | 15 | List getInvestmentByAccountId(String accountId) throws BankResourceNotFoundException,ServiceOperationNotSupported ; 16 | 17 | PocessingOperationResponse bookInvestment(InvestmentBook investmentBook) throws ServiceOperationNotSupported ; 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/GetStatementOutput.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import java.sql.Time; 4 | import java.util.Date; 5 | 6 | import javax.money.CurrencyUnit; 7 | import javax.money.Monetary; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | 11 | import lombok.Data; 12 | 13 | 14 | @Data 15 | public class GetStatementOutput { 16 | 17 | 18 | private String accountNumber; 19 | private String transactionType; 20 | private String currency; 21 | private String narration; 22 | private String amount; 23 | private String channel; 24 | private String debitOrCredit; 25 | private String referenceId ; 26 | private Time transactionTime; 27 | 28 | @JsonFormat 29 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 30 | private Date valueDate; 31 | 32 | @JsonFormat 33 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 34 | private Date bookDate; 35 | } 36 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/config/AccessScope.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.config; 2 | 3 | public enum AccessScope { 4 | 5 | READ_ACCOUNT("read_account", "Permission to read Account Information"), 6 | READ_ACCOUNT_BALANCE("read_account_balance", "Permission to read Account Balance"), 7 | WRITE_ACCOUNT("write_account", "Permission to create an Account"); 8 | 9 | 10 | public static final String READ_ACCOUNT_VALUE = "read_account"; 11 | 12 | 13 | private String name; 14 | private String description; 15 | 16 | AccessScope(String name, String description) { 17 | this.name = name; 18 | this.description = description; 19 | } 20 | 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | public void setName(String name) { 26 | this.name = name; 27 | } 28 | 29 | public String getDescription() { 30 | return description; 31 | } 32 | 33 | public void setDescription(String description) { 34 | this.description = description; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/bank/service/BillerInfoService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.bank.service; 2 | 3 | import java.util.List; 4 | 5 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 6 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 7 | import ng.openbanking.api.payload.billpayment.BillPaymentItem; 8 | import ng.openbanking.api.payload.billpayment.Biller; 9 | import ng.openbanking.api.payload.billpayment.BillerCategory; 10 | import ng.openbanking.api.payload.billpayment.BillingSystem; 11 | 12 | public interface BillerInfoService { 13 | 14 | List getBillerCategories() throws ServiceOperationNotSupported; 15 | 16 | List getBillingSystems() throws ServiceOperationNotSupported; 17 | 18 | List getBillersByCategoryId(String categoryId)throws BankResourceNotFoundException,ServiceOperationNotSupported; 19 | 20 | List getBillPaymentItemByBillerId(String billerId) throws BankResourceNotFoundException,ServiceOperationNotSupported; 21 | } 22 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/bank/service/CustomerInfoService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.bank.service; 2 | 3 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 4 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 5 | import ng.openbanking.api.payload.customer.Customer; 6 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 7 | 8 | public interface CustomerInfoService { 9 | 10 | Customer getByCustomerId(String customerId) throws BankResourceNotFoundException,ServiceOperationNotSupported; 11 | 12 | Customer getByPhoneNumber(String phoneNumber) throws BankResourceNotFoundException,ServiceOperationNotSupported; 13 | 14 | Customer getByEmail(String email) throws BankResourceNotFoundException,ServiceOperationNotSupported; 15 | 16 | Customer getByBVN(String bvn) throws BankResourceNotFoundException,ServiceOperationNotSupported; 17 | 18 | PocessingOperationResponse block(String customerId) throws BankResourceNotFoundException,ServiceOperationNotSupported; 19 | 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/AccessController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.Api; 5 | import io.swagger.annotations.ApiParam; 6 | import ng.openbanking.api.payload.access.Access; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | @RestController 15 | @RequestMapping("/access") 16 | @Api(value = "/access", description = "Access related operations", consumes = "application/json", tags = {"access"}) 17 | public class AccessController extends BaseApiController{ 18 | 19 | 20 | @RequestMapping(value = "/getAuthorizationToken", method = RequestMethod.GET) 21 | public List getAuthorizationToken(@ApiParam(value = "Requires Client Identifier, Secret and Grant Type") String clientId, String clientSecret, String grantType ){ 22 | return Collections.singletonList(new Access()); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /demo-web-service/src/main/resources/OB_HOME/data/directdebit.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "status":"Successful", 4 | "referenceId":"1", 5 | "sourceAccount":"0123456789", 6 | "sourceAccountName":"Sodiq Fagbola", 7 | "sourceEmail":"sodiq@openbanking.com", 8 | "sourcePhone":"09000000000", 9 | "sourceBvn":"0000000000", 10 | "sourceAmount":"100000", 11 | "sourceCurrency":"NGN", 12 | "sourceNation":"Nigeria", 13 | "sourceNarration":"Payment", 14 | "destinationBankCode":"012", 15 | "merchantId":"1", 16 | "productName":"Laptop", 17 | "merchantAccount":"0123456789", 18 | "merchantAccountName":"Seun Ogunjimi", 19 | "merchantEmail":"seun@openbanking.com", 20 | "merchantPhone":"09000000000", 21 | "merchantBvn":"9817281762", 22 | "amount":"1000", 23 | "currency":"NGN", 24 | "minimumAmount":"1000", 25 | "maximumAmount":"200000", 26 | "numberOfTransactions":"1", 27 | "startDate":"10/01/2017", 28 | "endDate":"10/01/2019", 29 | "recurringDate":"", 30 | "recurringPeriod":"", 31 | "transactionFee":"100", 32 | "channel":"", 33 | "latitude":"92", 34 | "longitude":"61" 35 | } 36 | ] 37 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/bank/service/BankCardService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.bank.service; 2 | 3 | import java.util.List; 4 | 5 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 6 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 7 | import ng.openbanking.api.payload.card.Card; 8 | import ng.openbanking.api.payload.card.CardLimit; 9 | import ng.openbanking.api.payload.card.CardRequest; 10 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 11 | 12 | public interface BankCardService { 13 | 14 | 15 | List getCardsByAccountNumber(String accountNumber) throws BankResourceNotFoundException,ServiceOperationNotSupported ; 16 | 17 | PocessingOperationResponse requestCard(CardRequest cardRequest) throws BankResourceNotFoundException,ServiceOperationNotSupported ; 18 | 19 | List getCardLimit(String accountNumber) throws BankResourceNotFoundException,ServiceOperationNotSupported ; 20 | 21 | PocessingOperationResponse setCardLimit(CardLimit cardLimit) throws BankResourceNotFoundException,ServiceOperationNotSupported ; 22 | 23 | 24 | 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /bank-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | api-parent 7 | ng.openbanking 8 | 0.0.5-SNAPSHOT 9 | ../pom.xml 10 | 11 | bank-service 12 | 13 | jar 14 | 15 | bank-service 16 | Service definition for API for Openbanking (Nigeria) 17 | 18 | https://openbanking.ng/ 19 | 20 | Open Banking Nigeria 21 | https://openbanking.ng/ 22 | 23 | 24 | 25 | 1.8 26 | UTF-8 27 | UTF-8 28 | 29 | 30 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/GenericServiceResponseBuilder.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload; 2 | 3 | import ng.openbanking.api.payload.definition.OperationStatus; 4 | 5 | public final class GenericServiceResponseBuilder { 6 | private OperationStatus status; 7 | private String message; 8 | private T data; 9 | 10 | private GenericServiceResponseBuilder() { 11 | } 12 | 13 | public static GenericServiceResponseBuilder aGenericServiceResponse() { 14 | return new GenericServiceResponseBuilder(); 15 | } 16 | 17 | public GenericServiceResponseBuilder withStatus(OperationStatus status) { 18 | this.status = status; 19 | return this; 20 | } 21 | 22 | public GenericServiceResponseBuilder withMessage(String message) { 23 | this.message = message; 24 | return this; 25 | } 26 | 27 | public GenericServiceResponseBuilder withData(T data) { 28 | this.data = data; 29 | return this; 30 | } 31 | 32 | public GenericServiceResponse build() { 33 | GenericServiceResponse genericServiceResponse = new GenericServiceResponse(); 34 | genericServiceResponse.setStatus(status); 35 | genericServiceResponse.setMessage(message); 36 | genericServiceResponse.setData(data); 37 | return genericServiceResponse; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/account/AccountCreationRequest.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.account; 2 | 3 | import java.util.Date; 4 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | 7 | import lombok.Data; 8 | 9 | @Data 10 | public class AccountCreationRequest { 11 | private String customerId = "1"; 12 | private String accountName = "Sodiq Fagbola"; 13 | private String firstName = "Sodiq"; 14 | private String surName = "Fagbola"; 15 | private String otherName = "Damilare"; 16 | @JsonFormat 17 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy") 18 | private Date dateOfBirth = new Date(); 19 | private String bvn = "0123456789"; 20 | private String phone = "0900000000"; 21 | private String email = "sodiq@openbanking.com"; 22 | private String address = "Lagos, Nigeria"; 23 | private String city = "Lagos"; 24 | private String localGovernment = "Ikoyi"; 25 | private String country = "Nigeria"; 26 | private String nationality = "Nigerian"; 27 | private String accountTypeId = "1"; 28 | private String nextOfKinName = "Ajoke Fagbola"; 29 | private String nextOfKinPhone = "0900000000"; 30 | private String nextOfKinEmail = "ajoke@openbanking.com"; 31 | private String nextOfKinAddress = "Lagos, Nigeria"; 32 | private String nextOfKinRelationship = "Wife"; 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/account/Account.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.account; 2 | 3 | import java.util.Date; 4 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import ng.openbanking.api.payload.definition.AccountType; 7 | 8 | import io.swagger.annotations.ApiModelProperty; 9 | import lombok.Data; 10 | 11 | @Data 12 | public class Account { 13 | @ApiModelProperty(value = "10 digit NUBAN") 14 | private String accountNumber; 15 | 16 | @ApiModelProperty(value = "The Customer ID as defined by the Bank") 17 | private String customerId; 18 | 19 | @ApiModelProperty(value = "The BVN tied to the Account") 20 | private String bvn; 21 | 22 | @ApiModelProperty(value = "The full Name registered with the Account") 23 | private String fullName ; 24 | private String shortName ; 25 | 26 | private String currency = "NGN"; 27 | 28 | @JsonFormat 29 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 30 | private Date accountOpeningDate; 31 | @JsonFormat 32 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 33 | private Date lastTransactionDate; 34 | private String status ; 35 | private String bankSortCode; 36 | private String accountBalance; 37 | private String phoneNumber; 38 | private AccountType accountType; 39 | private String accountManagerName; 40 | private String accountManagerPhone; 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/transaction/SingleTransfer.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.transaction; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Date; 5 | 6 | import javax.money.CurrencyUnit; 7 | import javax.money.Monetary; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import ng.openbanking.api.payload.definition.PeriodType; 11 | 12 | import lombok.Data; 13 | 14 | @Data 15 | public class SingleTransfer { 16 | private String referenceId = "1"; 17 | private String sourceAccount = "0123456789"; 18 | private String sourceAccountName = "Sodiq Fagbola"; 19 | private String sourceAmount = "100000"; // TODO use MonetaryAmount 20 | private CurrencyUnit sourceCurrency = Monetary.getCurrency("NGN"); 21 | private String sourceNarration = "Single Transfer"; 22 | private BigDecimal amount = new BigDecimal(1000000); // TODO use MonetaryAmount 23 | private CurrencyUnit currency = Monetary.getCurrency("NGN"); 24 | private String destinationNarration; 25 | private String transactionFee = "100"; 26 | private String channel; 27 | private double latitude = 100; 28 | private double longitude = 101; 29 | private Date transactionDate; 30 | private PeriodType interval; 31 | @JsonFormat 32 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 33 | private Date startDate; 34 | @JsonFormat 35 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy hh:mm:ss") 36 | private Date endDate; 37 | private int numberOfTime = 1; 38 | } 39 | -------------------------------------------------------------------------------- /demo-web-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | api-parent 7 | ng.openbanking 8 | 0.0.5-SNAPSHOT 9 | ../pom.xml 10 | 11 | 12 | demo-web-service 13 | 14 | jar 15 | 16 | demo-web-service 17 | Demo implementation of bank-service for API for Openbanking (Nigeria) 18 | 19 | https://openbanking.ng/ 20 | 21 | Open Banking Nigeria 22 | https://openbanking.ng/ 23 | 24 | 25 | 26 | 1.8 27 | UTF-8 28 | UTF-8 29 | 30 | 31 | 32 | 33 | ng.openbanking 34 | bank-service 35 | ${project.parent.version} 36 | 37 | 38 | org.projectlombok 39 | lombok 40 | true 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/directdebit/DirectDebitSetup.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.directdebit; 2 | 3 | import java.util.Date; 4 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import ng.openbanking.api.payload.definition.ChannelType; 7 | 8 | import lombok.Data; 9 | 10 | @Data 11 | public class DirectDebitSetup { 12 | private String referenceId; 13 | private String sourceAccount; 14 | private String sourceAccountName; 15 | private String sourceEmail; 16 | private String sourcePhone; 17 | private String sourceBvn; 18 | private String sourceAmount; 19 | private String sourceCurrency; 20 | private String sourceNation; 21 | private String sourceNarration; 22 | private String destinationBankCode; 23 | private String merchantId ; 24 | private String productName ; 25 | private String merchantAccount; 26 | private String merchantAccountName; 27 | private String merchantEmail; 28 | private String merchantPhone; 29 | private String merchantBvn; 30 | private String amount; 31 | private String currency; 32 | private String minimumAmount; 33 | private String maximumAmount; 34 | private int numberOfTransactions; 35 | @JsonFormat 36 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy") 37 | private Date startDate; 38 | @JsonFormat 39 | (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy") 40 | private Date endDate; 41 | private Date recurringDate; 42 | private String recurringPeriod; 43 | private String transactionFee; 44 | private ChannelType channel; 45 | private double latitude = 12; 46 | private double longitude = 82; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /demo-web-service/src/main/java/ng/openbanking/api/demo/service/DemoInvestmentInfoService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.demo.service; 2 | 3 | 4 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 5 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 6 | import ng.openbanking.api.payload.bank.service.InvestmentInfoService; 7 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 8 | import ng.openbanking.api.payload.definition.OperationStatus; 9 | import ng.openbanking.api.payload.investment.InvestmentBook; 10 | import ng.openbanking.api.payload.investment.InvestmentProduct; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.List; 15 | 16 | @Service 17 | public class DemoInvestmentInfoService implements InvestmentInfoService { 18 | 19 | private static final String INVESTMENT_MODEL_FILE_NAME="Investment"; 20 | 21 | 22 | @Autowired 23 | private DataService dataService; 24 | 25 | @Override 26 | public List getInvestmentProduct() 27 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 28 | return dataService.getModelList(INVESTMENT_MODEL_FILE_NAME); 29 | } 30 | 31 | @Override 32 | public List getInvestmentByAccountId(String accountId) 33 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 34 | return dataService.getModelList(INVESTMENT_MODEL_FILE_NAME); 35 | } 36 | 37 | @Override 38 | public PocessingOperationResponse bookInvestment(InvestmentBook investmentBook) 39 | throws ServiceOperationNotSupported { 40 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/directdebit/DirectDebit.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.directdebit; 2 | 3 | import java.util.Date; 4 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import ng.openbanking.api.payload.definition.ChannelType; 7 | 8 | import lombok.Data; 9 | 10 | @Data 11 | public class DirectDebit { 12 | private String status; 13 | private String referenceId ; 14 | private String sourceAccount; 15 | private String sourceAccountName; 16 | private String sourceEmail; 17 | private String sourcePhone; 18 | private String sourceBvn; 19 | private String sourceAmount; 20 | private String sourceCurrency ; 21 | private String sourceNation; 22 | private String sourceNarration; 23 | private String destinationBankCode; 24 | private String merchantId; 25 | private String productName; 26 | private String merchantAccount; 27 | private String merchantAccountName; 28 | private String merchantEmail; 29 | private String merchantPhone ; 30 | private String merchantBvn; 31 | private String amount; 32 | private String currency; 33 | private String minimumAmount; 34 | private String maximumAmount; 35 | private int numberOfTransactions; 36 | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy") 37 | private Date startDate; 38 | @JsonFormat (shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy") 39 | private Date endDate; 40 | 41 | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy") 42 | private Date recurringDate; 43 | private String recurringPeriod; 44 | private String transactionFee; 45 | private ChannelType channel; 46 | private double latitude; 47 | private double longitude; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /demo-web-service/src/main/java/ng/openbanking/api/demo/service/DemoGeneralInfoService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.demo.service; 2 | 3 | 4 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 5 | import ng.openbanking.api.payload.bank.service.GeneralInfoService; 6 | import ng.openbanking.api.payload.general.BankMeta; 7 | import ng.openbanking.api.payload.general.GeneralCharges; 8 | import ng.openbanking.api.payload.general.GeneralGetProduct; 9 | import ng.openbanking.api.payload.general.GeneralInterfaceVersion; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.List; 14 | 15 | @Service 16 | public class DemoGeneralInfoService implements GeneralInfoService { 17 | 18 | @Autowired 19 | private DataService dataService; 20 | 21 | private static final String BANK_META_MODEL_FILE_NAME = "bank_meta"; 22 | 23 | private static final String CHARGES_MODEL_FILE_NAME = "charges"; 24 | 25 | private static final String PRODUCTS_MODEL_FILE_NAME = "products"; 26 | 27 | private static final String GENERAL_INFO_MODEL_FILE_NAME = "general"; 28 | 29 | @Override 30 | public GeneralInterfaceVersion getInterfaceVersion() throws ServiceOperationNotSupported { 31 | return dataService.getSingleFromList(GENERAL_INFO_MODEL_FILE_NAME); 32 | } 33 | 34 | 35 | 36 | @Override 37 | public BankMeta getBankMeta() throws ServiceOperationNotSupported { 38 | return dataService.getSingleFromList(BANK_META_MODEL_FILE_NAME); 39 | } 40 | 41 | 42 | 43 | @Override 44 | public List getCharges() throws ServiceOperationNotSupported { 45 | return dataService.getModelList(CHARGES_MODEL_FILE_NAME); 46 | } 47 | 48 | 49 | 50 | @Override 51 | public List getProducts() throws ServiceOperationNotSupported { 52 | return dataService.getModelList(PRODUCTS_MODEL_FILE_NAME); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /demo-web-service/src/main/java/ng/openbanking/api/demo/service/DemoCustomerInfoService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.demo.service; 2 | 3 | 4 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 5 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 6 | import ng.openbanking.api.payload.bank.service.CustomerInfoService; 7 | import ng.openbanking.api.payload.customer.Customer; 8 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 9 | import ng.openbanking.api.payload.definition.OperationStatus; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | @Service 14 | public class DemoCustomerInfoService implements CustomerInfoService { 15 | 16 | private static final String CUSTOMER_MODEL_FILE_NAME = "Customer"; 17 | 18 | 19 | @Autowired 20 | private DataService dataService; 21 | 22 | @Override 23 | public Customer getByCustomerId(String customerId) 24 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 25 | return dataService.getSingleFromList(CUSTOMER_MODEL_FILE_NAME); 26 | } 27 | 28 | @Override 29 | public Customer getByPhoneNumber(String phoneNumber) 30 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 31 | return dataService.getSingleFromList(CUSTOMER_MODEL_FILE_NAME); 32 | } 33 | 34 | @Override 35 | public Customer getByEmail(String email) throws BankResourceNotFoundException, ServiceOperationNotSupported { 36 | return dataService.getSingleFromList(CUSTOMER_MODEL_FILE_NAME); 37 | } 38 | 39 | @Override 40 | public Customer getByBVN(String bvn) throws BankResourceNotFoundException, ServiceOperationNotSupported { 41 | return dataService.getSingleFromList(CUSTOMER_MODEL_FILE_NAME); 42 | } 43 | 44 | @Override 45 | public PocessingOperationResponse block(String customerId) 46 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 47 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 48 | } 49 | 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/service/UserService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.service; 2 | 3 | import org.springframework.security.core.GrantedAuthority; 4 | import org.springframework.security.core.userdetails.UserDetails; 5 | import org.springframework.security.core.userdetails.UserDetailsService; 6 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.ArrayList; 10 | import java.util.Collection; 11 | 12 | @Service("userDetailsService") 13 | public class UserService implements UserDetailsService { 14 | 15 | 16 | private final static String TEST_USER = "demo"; 17 | 18 | private final static String TEST_PASSWORD = "$2a$10$D4OLKI6yy68crm.3imC9X.P2xqKHs5TloWUcr6z5XdOqnTrAK84ri"; 19 | 20 | 21 | @Override 22 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 23 | if (!TEST_USER.equalsIgnoreCase(username)) 24 | throw new UsernameNotFoundException("Invalid user " + username); 25 | return new UserDetails() { 26 | @Override 27 | public Collection getAuthorities() { 28 | return new ArrayList<>(); 29 | } 30 | 31 | @Override 32 | public String getPassword() { 33 | return TEST_PASSWORD; 34 | } 35 | 36 | @Override 37 | public String getUsername() { 38 | return TEST_USER; 39 | } 40 | 41 | @Override 42 | public boolean isAccountNonExpired() { 43 | return true; 44 | } 45 | 46 | @Override 47 | public boolean isAccountNonLocked() { 48 | return true; 49 | } 50 | 51 | @Override 52 | public boolean isCredentialsNonExpired() { 53 | return true; 54 | } 55 | 56 | @Override 57 | public boolean isEnabled() { 58 | return true; 59 | } 60 | }; 61 | } 62 | } -------------------------------------------------------------------------------- /demo-web-service/src/main/java/ng/openbanking/api/demo/service/DemoBillerInfoService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.demo.service; 2 | 3 | 4 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 5 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 6 | import ng.openbanking.api.payload.bank.service.BillerInfoService; 7 | import ng.openbanking.api.payload.billpayment.BillPaymentItem; 8 | import ng.openbanking.api.payload.billpayment.Biller; 9 | import ng.openbanking.api.payload.billpayment.BillerCategory; 10 | import ng.openbanking.api.payload.billpayment.BillingSystem; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.List; 15 | 16 | @Service 17 | public class DemoBillerInfoService implements BillerInfoService { 18 | 19 | private static final String BILLER_CAT_MODEL_FILE_NAME="BillerCategory"; 20 | 21 | private static final String BILLER_SYS_MODEL_FILE_NAME="BillingSystem"; 22 | 23 | private static final String BILLER_MODEL_FILE_NAME="Biller"; 24 | 25 | private static final String BILL_ITEM_MODEL_FILE_NAME="BillPaymentItem"; 26 | 27 | @Autowired 28 | private DataService dataService; 29 | 30 | 31 | @Override 32 | public List getBillerCategories() throws ServiceOperationNotSupported { 33 | return dataService.getModelList(BILLER_CAT_MODEL_FILE_NAME); 34 | } 35 | 36 | 37 | @Override 38 | public List getBillingSystems() throws ServiceOperationNotSupported { 39 | return dataService.getModelList(BILLER_SYS_MODEL_FILE_NAME); 40 | } 41 | 42 | 43 | @Override 44 | public List getBillersByCategoryId(String categoryId) 45 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 46 | return dataService.getModelList(BILLER_MODEL_FILE_NAME); 47 | } 48 | 49 | 50 | @Override 51 | public List getBillPaymentItemByBillerId(String billerId) 52 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 53 | return dataService.getModelList(BILL_ITEM_MODEL_FILE_NAME); 54 | } 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /demo-web-service/src/main/java/ng/openbanking/api/demo/service/DemoBankCardService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.demo.service; 2 | 3 | 4 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 5 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 6 | import ng.openbanking.api.payload.bank.service.BankCardService; 7 | import ng.openbanking.api.payload.card.Card; 8 | import ng.openbanking.api.payload.card.CardLimit; 9 | import ng.openbanking.api.payload.card.CardRequest; 10 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 11 | import ng.openbanking.api.payload.definition.OperationStatus; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Service; 14 | 15 | import java.util.List; 16 | 17 | @Service 18 | public class DemoBankCardService implements BankCardService { 19 | 20 | private static final String CARDLIMIT_MODEL_FILE_NAME = "cardLimit"; 21 | 22 | private static final String CARD_MODEL_FILE_NAME = "card"; 23 | 24 | 25 | 26 | @Autowired 27 | private DataService dataService; 28 | 29 | 30 | 31 | @Override 32 | public List getCardsByAccountNumber(String accountNumber) 33 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 34 | return dataService.getModelList(CARD_MODEL_FILE_NAME); 35 | } 36 | 37 | 38 | 39 | @Override 40 | public PocessingOperationResponse requestCard(CardRequest cardRequest) 41 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 42 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 43 | } 44 | 45 | 46 | 47 | @Override 48 | public List getCardLimit(String accountNumber) 49 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 50 | return dataService.getModelList(CARDLIMIT_MODEL_FILE_NAME); 51 | } 52 | 53 | 54 | 55 | @Override 56 | public PocessingOperationResponse setCardLimit(CardLimit cardLimit) 57 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 58 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 59 | } 60 | 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/bank/service/BankInfoService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.bank.service; 2 | 3 | import java.util.List; 4 | 5 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 6 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 7 | import ng.openbanking.api.payload.agency.Agency; 8 | import ng.openbanking.api.payload.atm.ATM; 9 | import ng.openbanking.api.payload.branch.Branch; 10 | import ng.openbanking.api.payload.pos.POS; 11 | 12 | public interface BankInfoService { 13 | 14 | Agency getAgencyById(String agencyId) throws BankResourceNotFoundException,ServiceOperationNotSupported; 15 | 16 | List getAgencies() throws ServiceOperationNotSupported; 17 | 18 | List getAgencyByLongAndLat(double longitude, double latitude) throws BankResourceNotFoundException,ServiceOperationNotSupported; 19 | 20 | ATM getAtmById(String terminalId) throws BankResourceNotFoundException,ServiceOperationNotSupported; 21 | 22 | List getAtms() throws ServiceOperationNotSupported; 23 | 24 | ATM getAtmByBranchCode(String branchCode) throws BankResourceNotFoundException,ServiceOperationNotSupported; 25 | 26 | List getAtmByLongAndLat(double longitude, double latitude) throws ServiceOperationNotSupported; 27 | 28 | Branch getBanchByBranchId(String branchId)throws BankResourceNotFoundException,ServiceOperationNotSupported; 29 | 30 | List getBranches() throws ServiceOperationNotSupported; 31 | 32 | List getBranchesByLongAndLat(double longitude, double latitude) throws ServiceOperationNotSupported; 33 | 34 | List getPosByTerminalId(String terminalId) throws BankResourceNotFoundException,ServiceOperationNotSupported; 35 | 36 | List getPosByMerchantId(String merchantId) throws BankResourceNotFoundException,ServiceOperationNotSupported; 37 | 38 | List getPosByBranchId(String branchId) throws BankResourceNotFoundException,ServiceOperationNotSupported; 39 | 40 | List getPosByEmail(String email) throws BankResourceNotFoundException,ServiceOperationNotSupported; 41 | 42 | List getPosNearLocation(double longitude, double latitude) throws ServiceOperationNotSupported; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) 2 | 3 | The project is to create an open source standard APIs for which banks can publish their integration APIs. 4 | 5 | ### What is this repository for? ### 6 | 7 | * Quick summary 8 | Although Banks generally have APIs (many are not at that level of technology maturity yet), these APIs do not cover the complete gamut of requirements of Fintechs or the need of their customers. The **Open Banking API** is a way to bring a standard to the market, for which any bank can follow, then it would make life easier for all players in the ecosystem. 9 | * Version 10 | 1.0 11 | * [Open Banking Nigeria](https://openbanking.ng) 12 | 13 | ### How do I get set up? ### 14 | 15 | * Summary of set up 16 | Get this repository by running the command below on your terminal 17 | 18 | ``` 19 | $ git clone https://github.com/openbankingnigeria/api.git 20 | ``` 21 | 22 | The project can be set up easily by implementing the endpoints as fully documented [here](https://api.openbanking.ng/). 23 | 24 | * How to run tests 25 | You can run tests right [here](https://api.openbanking.ng/). These tests show a sample request and response payload as defined in the specification. 26 | 27 | ### Contribution guidelines ### 28 | **Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github) 29 | 30 | * Writing tests 31 | All new and modified endpoints **MUST** have an equivalent unit test. 32 | The unit test should ensure the defined payload request and verb is obeyed and the corresponding response is a type of the expected response. 33 | You can follow the unit test that is already available in the project. 34 | * Code review 35 | Once you complete a task, submit a pull request. 36 | Your code would be merge as soon as it's been reviewed. 37 | 38 | ### Who do I talk to? ### 39 | 40 | * The Open Banking Nigeria team 41 | send a mail to [contribute@openbanking.ng](mailto:contribute@openbanking.ng) or fill out the contact form at [Open Banking Nigeria](http://openbanking.ng) and we would contact you. 42 | -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/bank/service/BankTransactionService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.bank.service; 2 | 3 | import java.util.List; 4 | 5 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 6 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 7 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 8 | import ng.openbanking.api.payload.transaction.GetStatement; 9 | import ng.openbanking.api.payload.transaction.GetStatementOutput; 10 | import ng.openbanking.api.payload.transaction.MultipleTransfer; 11 | import ng.openbanking.api.payload.transaction.MultipleTransferBank; 12 | import ng.openbanking.api.payload.transaction.PlaceHold; 13 | import ng.openbanking.api.payload.transaction.SingleTransfer; 14 | import ng.openbanking.api.payload.transaction.SingleTransferBank; 15 | 16 | public interface BankTransactionService { 17 | 18 | PocessingOperationResponse singleTransferWithinBank(SingleTransferBank singleTransferBank) throws BankResourceNotFoundException,ServiceOperationNotSupported; 19 | 20 | PocessingOperationResponse singleTransferOtherBank(SingleTransferBank singleTransferBank) throws BankResourceNotFoundException,ServiceOperationNotSupported; 21 | 22 | PocessingOperationResponse singleTransferToEmail(String email, SingleTransfer singleTransfer); 23 | 24 | PocessingOperationResponse singleTransferToPhone(String phone, SingleTransfer singleTransfer); 25 | 26 | PocessingOperationResponse multipleTransferWithinBank(MultipleTransferBank multipleTransferBank); 27 | 28 | PocessingOperationResponse multipleTransferOtherBank(MultipleTransferBank multipleTransferBank); 29 | 30 | PocessingOperationResponse multipleTransferToPhone(MultipleTransfer multipleTransfer); 31 | 32 | PocessingOperationResponse multipleTransferToEmail(MultipleTransfer multipleTransfer); 33 | 34 | PocessingOperationResponse placeHold(PlaceHold placeHold); 35 | 36 | PocessingOperationResponse getHold(String accountNumber, String holdReferenceId); 37 | 38 | PocessingOperationResponse removeHold(String accountNumber, String holdReferenceId); 39 | 40 | PocessingOperationResponse placePnd(String accountNumber, String pndReferenceId, String amount, String reason); 41 | 42 | List getStatement(GetStatement getStatement); 43 | } -------------------------------------------------------------------------------- /bank-service/src/main/java/ng/openbanking/api/payload/bank/service/BankAccountService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.payload.bank.service; 2 | 3 | import java.util.List; 4 | 5 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 6 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 7 | import ng.openbanking.api.payload.account.Account; 8 | import ng.openbanking.api.payload.account.AccountBlock; 9 | import ng.openbanking.api.payload.account.AccountType; 10 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 11 | import ng.openbanking.api.payload.directdebit.DirectDebit; 12 | import ng.openbanking.api.payload.directdebit.DirectDebitCancelRequest; 13 | import ng.openbanking.api.payload.directdebit.DirectDebitSetup; 14 | import ng.openbanking.api.payload.limit.Limit; 15 | import ng.openbanking.api.payload.limit.LimitCustomer; 16 | 17 | public interface BankAccountService { 18 | 19 | Account getAccountByAccountNumber(String accountNumber) throws BankResourceNotFoundException,ServiceOperationNotSupported; 20 | 21 | Account getAccountByCustomerId(String customerId) throws BankResourceNotFoundException,ServiceOperationNotSupported; 22 | 23 | Account getAccountByBvn(String bvn) throws BankResourceNotFoundException,ServiceOperationNotSupported; 24 | 25 | Account getAccountByPhoneNumber(String phoneNumber) throws BankResourceNotFoundException,ServiceOperationNotSupported; 26 | 27 | Account getAccountByEmail(String emailAddress) throws BankResourceNotFoundException,ServiceOperationNotSupported; 28 | 29 | PocessingOperationResponse blockAccount(AccountBlock accountBlock) throws BankResourceNotFoundException,ServiceOperationNotSupported; 30 | 31 | List getAccountTypes() throws ServiceOperationNotSupported ; 32 | 33 | LimitCustomer getCustomerTransactionLimit(String accountNumber) throws BankResourceNotFoundException,ServiceOperationNotSupported ; 34 | 35 | Limit getGlobalTransactionLimit() throws ServiceOperationNotSupported ; 36 | 37 | PocessingOperationResponse setupDirectDebit(DirectDebitSetup directDebitSetup)throws BankResourceNotFoundException,ServiceOperationNotSupported ; 38 | 39 | PocessingOperationResponse cancelDirectDebit(DirectDebitCancelRequest directDebitCancelRequest) throws BankResourceNotFoundException,ServiceOperationNotSupported ; 40 | 41 | DirectDebit getDirectDebit(String accountNumber, String referenceNumber) throws BankResourceNotFoundException,ServiceOperationNotSupported ; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/ApiNgApplication.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api; 2 | 3 | import io.github.benas.randombeans.EnhancedRandomBuilder; 4 | import io.github.benas.randombeans.api.EnhancedRandom; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.web.servlet.config.annotation.*; 10 | 11 | import java.time.LocalDate; 12 | import java.time.LocalDateTime; 13 | import java.time.LocalTime; 14 | 15 | import static java.nio.charset.Charset.forName; 16 | 17 | @SpringBootApplication(exclude = SecurityAutoConfiguration.class) 18 | public class ApiNgApplication { 19 | 20 | public static void main(String[] args) { 21 | SpringApplication.run(ApiNgApplication.class, args); 22 | } 23 | 24 | 25 | @Bean 26 | public EnhancedRandom enhancedRandom() { 27 | LocalDateTime now = LocalDateTime.now(); 28 | LocalDate minDate = now.minusDays(5).toLocalDate(); 29 | LocalDate maxDate = now.plusDays(5).toLocalDate(); 30 | LocalTime minTime = minDate.atStartOfDay().toLocalTime(); 31 | LocalTime maxTime = maxDate.atStartOfDay().toLocalTime(); 32 | return EnhancedRandomBuilder.aNewEnhancedRandomBuilder() 33 | .seed(123L) 34 | .objectPoolSize(100) 35 | .randomizationDepth(3) 36 | .charset(forName("UTF-8")) 37 | .timeRange(minTime, maxTime) 38 | .dateRange(minDate, maxDate) 39 | .stringLengthRange(5, 50) 40 | .collectionSizeRange(1, 10) 41 | .scanClasspathForConcreteTypes(true) 42 | .overrideDefaultInitialization(false) 43 | .build(); 44 | } 45 | 46 | @Bean 47 | public WebMvcConfigurer corsConfigurer() { 48 | return new WebMvcConfigurerAdapter() { 49 | @Override 50 | public void addCorsMappings(CorsRegistry registry) { 51 | registry.addMapping("/**"); 52 | } 53 | 54 | @Override 55 | public void configurePathMatch(PathMatchConfigurer configurer) { 56 | configurer.setUseTrailingSlashMatch(true); 57 | } 58 | 59 | @Override 60 | public void addViewControllers(ViewControllerRegistry registry) { 61 | registry.addRedirectViewController("/", "swagger-ui.html"); 62 | } 63 | }; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/LimitController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.Api; 5 | import io.swagger.annotations.ApiParam; 6 | import ng.openbanking.api.payload.GenericServiceResponse; 7 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 8 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 9 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 10 | import ng.openbanking.api.payload.bank.service.BankAccountService; 11 | import ng.openbanking.api.payload.definition.OperationStatus; 12 | import ng.openbanking.api.payload.limit.Limit; 13 | import ng.openbanking.api.payload.limit.LimitCustomer; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.http.ResponseEntity; 16 | import org.springframework.web.bind.annotation.PathVariable; 17 | import org.springframework.web.bind.annotation.RequestMapping; 18 | import org.springframework.web.bind.annotation.RequestMethod; 19 | import org.springframework.web.bind.annotation.RestController; 20 | 21 | import java.util.Collections; 22 | 23 | @RestController 24 | @RequestMapping("/limit") 25 | @Api(value = "/limit", description = "Limit related operations", consumes = "application/json", tags = {"limit"}) 26 | public class LimitController extends BaseApiController{ 27 | 28 | @Autowired 29 | BankAccountService bankAccountService; 30 | 31 | @RequestMapping(value = "", method = RequestMethod.GET) 32 | public ResponseEntity getGlobalTransactionLimit() throws ServiceOperationNotSupported { 33 | Limit limit=bankAccountService.getGlobalTransactionLimit(); 34 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 35 | .withData(Collections.singletonList(limit)) 36 | .withStatus(OperationStatus.SUCCESSFUL) 37 | .withMessage(OperationStatus.SUCCESSFUL.name()) 38 | .build()); 39 | } 40 | 41 | @RequestMapping(value = "/customer/{accountNumber}", method = RequestMethod.GET) 42 | public ResponseEntity getCustomerTransactionLimit(@PathVariable @ApiParam(value = "The Customer's Account Number") String accountNumber) throws BankResourceNotFoundException,ServiceOperationNotSupported { 43 | LimitCustomer limit=bankAccountService.getCustomerTransactionLimit(accountNumber); 44 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 45 | .withData(Collections.singletonList(limit)) 46 | .withStatus(OperationStatus.SUCCESSFUL) 47 | .withMessage(OperationStatus.SUCCESSFUL.name()) 48 | .build()); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /web-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | api-parent 7 | ng.openbanking 8 | 0.0.5-SNAPSHOT 9 | ../pom.xml 10 | 11 | 12 | web-service 13 | jar 14 | 15 | web-service 16 | API for Openbanking (Nigeria) 17 | 18 | 19 | 1.8 20 | UTF-8 21 | UTF-8 22 | 23 | 24 | 25 | io.springfox 26 | springfox-swagger-ui 27 | 2.6.1 28 | 29 | 30 | ng.openbanking 31 | bank-service 32 | ${project.parent.version} 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-starter-web 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-starter-security 41 | 42 | 43 | 44 | 45 | 46 | true 47 | src/main/resources 48 | 49 | 50 | 51 | 52 | org.springframework.boot 53 | spring-boot-maven-plugin 54 | 55 | 56 | 57 | 58 | 59 | demo-bank-service 60 | 61 | true 62 | 63 | 64 | demo 65 | 66 | 67 | 68 | ng.openbanking 69 | demo-web-service 70 | ${project.parent.version} 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at contact@openbanking.ng. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/InvestmentController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | import java.util.List; 4 | 5 | import ng.openbanking.api.payload.GenericServiceResponse; 6 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 7 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 8 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 9 | import ng.openbanking.api.payload.bank.service.InvestmentInfoService; 10 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 11 | import ng.openbanking.api.payload.definition.OperationStatus; 12 | import ng.openbanking.api.payload.investment.InvestmentBook; 13 | import ng.openbanking.api.payload.investment.InvestmentProduct; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.http.ResponseEntity; 16 | import org.springframework.web.bind.annotation.PathVariable; 17 | import org.springframework.web.bind.annotation.RequestBody; 18 | import org.springframework.web.bind.annotation.RequestMapping; 19 | import org.springframework.web.bind.annotation.RequestMethod; 20 | import org.springframework.web.bind.annotation.RestController; 21 | 22 | import io.swagger.annotations.Api; 23 | import io.swagger.annotations.ApiParam; 24 | 25 | @RestController 26 | @RequestMapping("/investment") 27 | @Api(value = "/investment", description = "investment related operations", consumes = "application/json", tags = {"investment"}) 28 | 29 | public class InvestmentController extends BaseApiController{ 30 | 31 | @Autowired 32 | private InvestmentInfoService investmentInfoService; 33 | 34 | @RequestMapping(value = "/product", method = RequestMethod.GET) 35 | public ResponseEntity getInvestmentProduct() throws BankResourceNotFoundException, ServiceOperationNotSupported { 36 | List data=investmentInfoService.getInvestmentProduct(); 37 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 38 | .withData(data) 39 | .withStatus(OperationStatus.SUCCESSFUL) 40 | .withMessage(OperationStatus.SUCCESSFUL.name()) 41 | .build()); 42 | } 43 | 44 | @RequestMapping(value = "/{accountId}", method = RequestMethod.GET) 45 | public ResponseEntity getInvestment(@PathVariable @ApiParam(value = "The Customer's Unique Identifier or Account Number") String accountId) throws BankResourceNotFoundException, ServiceOperationNotSupported { 46 | List data=investmentInfoService.getInvestmentByAccountId(accountId); 47 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 48 | .withData(data) 49 | .withStatus(OperationStatus.SUCCESSFUL) 50 | .withMessage(OperationStatus.SUCCESSFUL.name()) 51 | .build()); 52 | } 53 | 54 | @RequestMapping(value = "", method = RequestMethod.POST) 55 | public ResponseEntity bookInvestment(@RequestBody InvestmentBook investmentBook) throws ServiceOperationNotSupported { 56 | PocessingOperationResponse data=investmentInfoService.bookInvestment(investmentBook); 57 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 58 | .withStatus(OperationStatus.SUCCESSFUL) 59 | .withMessage("Investment booked successfully") 60 | .build()); 61 | } 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /demo-web-service/src/main/java/ng/openbanking/api/demo/service/DataService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.demo.service; 2 | 3 | 4 | import com.fasterxml.jackson.databind.DeserializationFeature; 5 | import com.fasterxml.jackson.databind.ObjectMapper; 6 | import com.fasterxml.jackson.databind.SerializationFeature; 7 | import lombok.extern.slf4j.Slf4j; 8 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 9 | import ng.openbanking.api.payload.definition.OperationStatus; 10 | import org.apache.commons.io.FileUtils; 11 | import org.javamoney.moneta.Money; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.beans.factory.annotation.Value; 14 | import org.springframework.context.ApplicationEventPublisher; 15 | import org.springframework.core.io.ClassPathResource; 16 | import org.springframework.stereotype.Service; 17 | import org.springframework.util.CollectionUtils; 18 | import org.springframework.util.StringUtils; 19 | import org.zalando.jackson.datatype.money.MoneyModule; 20 | 21 | import javax.annotation.PostConstruct; 22 | import java.io.File; 23 | import java.util.List; 24 | 25 | @Service 26 | @Slf4j 27 | public class DataService { 28 | 29 | @Value("${OB_HOME:}") 30 | private String OB_HOME; 31 | 32 | @Autowired 33 | protected ApplicationEventPublisher eventPublisher; 34 | 35 | private ObjectMapper objectMapper; 36 | 37 | public T getSingleFromList(String dataName) { 38 | T data=null; 39 | List dataList=getModelList(dataName); 40 | if(CollectionUtils.isEmpty(dataList)) { 41 | data=dataList.get(0); 42 | } 43 | return data; 44 | } 45 | 46 | public List getModelList(String dataName) { 47 | return getData(dataName, List.class) ; 48 | } 49 | 50 | 51 | private File getOBNDataFile(String modelName) throws Exception { 52 | if (StringUtils.isEmpty(OB_HOME)) { 53 | OB_HOME="/OB_HOME"; 54 | } 55 | ClassPathResource classPathResource = new ClassPathResource(String.format("%s/data/%s.json", OB_HOME,modelName.toLowerCase())); 56 | return classPathResource.getFile(); 57 | } 58 | 59 | protected T getData(String modelName, Class type) { 60 | try { 61 | File dataFile=getOBNDataFile(modelName); 62 | String data= FileUtils.readFileToString(dataFile,"UTF-8"); 63 | log.info("loaded data for {} {}",modelName,data); 64 | return this.objectMapper.readValue(dataFile, type); 65 | } catch (Exception e) { 66 | log.warn("Cannot convert json data for {} using file {}.json", type, modelName); 67 | log.error(null, e); 68 | } 69 | return null; 70 | } 71 | 72 | @PostConstruct 73 | protected void init() { 74 | this.objectMapper = new ObjectMapper(); 75 | this.objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); 76 | this.objectMapper.disable(SerializationFeature.INDENT_OUTPUT); 77 | this.objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); 78 | this.objectMapper .registerModule(new MoneyModule().withMonetaryAmount(Money::of)); 79 | 80 | 81 | } 82 | 83 | public PocessingOperationResponse generateProcessingResponse(OperationStatus requiredStatus) { 84 | PocessingOperationResponse response=new PocessingOperationResponse(); 85 | response.setResponseCode(requiredStatus); 86 | response.setTransactionReferenceId(System.currentTimeMillis()+""); 87 | response.setMessage(requiredStatus.name()); 88 | return response; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/GeneralController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.Api; 5 | import ng.openbanking.api.payload.GenericServiceResponse; 6 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 7 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 8 | import ng.openbanking.api.payload.bank.service.GeneralInfoService; 9 | import ng.openbanking.api.payload.definition.OperationStatus; 10 | import ng.openbanking.api.payload.general.BankMeta; 11 | import ng.openbanking.api.payload.general.GeneralCharges; 12 | import ng.openbanking.api.payload.general.GeneralGetProduct; 13 | import ng.openbanking.api.payload.general.GeneralInterfaceVersion; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.http.ResponseEntity; 16 | import org.springframework.web.bind.annotation.RequestMapping; 17 | import org.springframework.web.bind.annotation.RequestMethod; 18 | import org.springframework.web.bind.annotation.RestController; 19 | 20 | import java.util.List; 21 | 22 | @RestController 23 | @RequestMapping("/general") 24 | @Api(value = "/general", description = "General related operations", consumes = "application/json", tags = {"general"}) 25 | public class GeneralController extends BaseApiController{ 26 | 27 | @Autowired 28 | private GeneralInfoService generalInfoService; 29 | 30 | @RequestMapping(value = "/information/version", method = RequestMethod.GET) 31 | public ResponseEntity getInterfaceVersion() throws ServiceOperationNotSupported { 32 | GeneralInterfaceVersion data=generalInfoService.getInterfaceVersion(); 33 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 34 | .withData(data) 35 | .withStatus(OperationStatus.SUCCESSFUL) 36 | .withMessage(OperationStatus.SUCCESSFUL.name()) 37 | .build()); 38 | } 39 | 40 | @RequestMapping(value = "/information", method = RequestMethod.GET) 41 | public ResponseEntity getBankMeta() throws ServiceOperationNotSupported { 42 | BankMeta data=generalInfoService.getBankMeta(); 43 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 44 | .withData(data) 45 | .withStatus(OperationStatus.SUCCESSFUL) 46 | .withMessage(OperationStatus.SUCCESSFUL.name()) 47 | .build()); 48 | } 49 | 50 | @RequestMapping(value = "/transaction/charges", method = RequestMethod.GET) 51 | public ResponseEntity getCharges() throws ServiceOperationNotSupported { 52 | List data=generalInfoService.getCharges(); 53 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 54 | .withData(data) 55 | .withStatus(OperationStatus.SUCCESSFUL) 56 | .withMessage(OperationStatus.SUCCESSFUL.name()) 57 | .build()); 58 | } 59 | 60 | @RequestMapping(value = "/products", method = RequestMethod.GET) 61 | public ResponseEntity getProducts() throws ServiceOperationNotSupported { 62 | List data=generalInfoService.getProducts(); 63 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 64 | .withData(data) 65 | .withStatus(OperationStatus.SUCCESSFUL) 66 | .withMessage(OperationStatus.SUCCESSFUL.name()) 67 | .build()); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/DirectDebitController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.Api; 5 | import io.swagger.annotations.ApiParam; 6 | import ng.openbanking.api.payload.GenericServiceResponse; 7 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 8 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 9 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 10 | import ng.openbanking.api.payload.bank.service.BankAccountService; 11 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 12 | import ng.openbanking.api.payload.definition.OperationStatus; 13 | import ng.openbanking.api.payload.directdebit.DirectDebit; 14 | import ng.openbanking.api.payload.directdebit.DirectDebitCancelRequest; 15 | import ng.openbanking.api.payload.directdebit.DirectDebitSetup; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.http.ResponseEntity; 18 | import org.springframework.web.bind.annotation.*; 19 | 20 | import java.util.Collections; 21 | 22 | @RestController 23 | @RequestMapping("/dd") 24 | @Api(value = "Direct Debit", description = "Direct Debit related operations", consumes = "application/json", tags = {"direct_debit"}) 25 | 26 | public class DirectDebitController extends BaseApiController{ 27 | 28 | @Autowired 29 | private BankAccountService bankAccountService; 30 | 31 | 32 | @RequestMapping(value = "/", method = RequestMethod.POST) 33 | public ResponseEntity setupDirectDebit(@RequestBody DirectDebitSetup directDebitSetup) throws BankResourceNotFoundException, ServiceOperationNotSupported { 34 | PocessingOperationResponse pResponse=bankAccountService.setupDirectDebit(directDebitSetup); 35 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 36 | .withData(Collections.singletonList(pResponse)) 37 | .withStatus(OperationStatus.SUCCESSFUL) 38 | .withMessage(OperationStatus.SUCCESSFUL.name()) 39 | .build()); 40 | } 41 | 42 | @RequestMapping(value = "/accountNumber/{accountNumber}/referenceNumber/{referenceNumber}", method = RequestMethod.GET) 43 | public ResponseEntity getDirectDebit(@PathVariable @ApiParam(value = "Reference Number") String referenceNumber, 44 | @PathVariable @ApiParam(value = "Account Number") String accountNumber) throws BankResourceNotFoundException, ServiceOperationNotSupported { 45 | DirectDebit pResponse=bankAccountService.getDirectDebit(accountNumber,referenceNumber); 46 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 47 | .withData(new DirectDebit()) 48 | .withStatus(OperationStatus.SUCCESSFUL) 49 | .withMessage(OperationStatus.SUCCESSFUL.name()) 50 | .build()); 51 | } 52 | 53 | @RequestMapping(value = "/cancel", method = RequestMethod.GET) 54 | public ResponseEntity cancelDirectDebit(@RequestBody DirectDebitCancelRequest directDebitCancelRequest) throws BankResourceNotFoundException, ServiceOperationNotSupported { 55 | PocessingOperationResponse pResponse=bankAccountService.cancelDirectDebit(directDebitCancelRequest); 56 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 57 | .withData(pResponse) 58 | .withStatus(OperationStatus.SUCCESSFUL) 59 | .withMessage("Direct Debit cancelled successfully") 60 | .build()); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /demo-web-service/src/main/java/ng/openbanking/api/demo/service/DemoTransactionService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.demo.service; 2 | 3 | import java.util.List; 4 | 5 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 6 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 7 | import ng.openbanking.api.payload.bank.service.BankTransactionService; 8 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 9 | import ng.openbanking.api.payload.definition.OperationStatus; 10 | import ng.openbanking.api.payload.transaction.*; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | 14 | 15 | @Service 16 | public class DemoTransactionService implements BankTransactionService { 17 | 18 | @Autowired 19 | private DataService dataService; 20 | 21 | private static final String STATEMENT_MODEL_FILE_NAME = "statement"; 22 | 23 | @Override 24 | public PocessingOperationResponse singleTransferWithinBank(SingleTransferBank singleTransferBank) 25 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 26 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 27 | } 28 | 29 | @Override 30 | public PocessingOperationResponse singleTransferOtherBank(SingleTransferBank singleTransferBank) 31 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 32 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 33 | } 34 | 35 | @Override 36 | public PocessingOperationResponse singleTransferToEmail(String email, SingleTransfer singleTransfer) { 37 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 38 | 39 | } 40 | 41 | @Override 42 | public PocessingOperationResponse singleTransferToPhone(String phone, SingleTransfer singleTransfer) { 43 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 44 | } 45 | 46 | @Override 47 | public PocessingOperationResponse multipleTransferWithinBank(MultipleTransferBank multipleTransferBank) { 48 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 49 | } 50 | 51 | @Override 52 | public PocessingOperationResponse multipleTransferOtherBank(MultipleTransferBank multipleTransferBank) { 53 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 54 | } 55 | 56 | @Override 57 | public PocessingOperationResponse multipleTransferToPhone(MultipleTransfer multipleTransfer) { 58 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 59 | } 60 | 61 | @Override 62 | public PocessingOperationResponse multipleTransferToEmail(MultipleTransfer multipleTransfer) { 63 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 64 | } 65 | 66 | @Override 67 | public PocessingOperationResponse placeHold(PlaceHold placeHold) { 68 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 69 | } 70 | 71 | @Override 72 | public PocessingOperationResponse getHold(String accountNumber, String holdReferenceId) { 73 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 74 | } 75 | 76 | @Override 77 | public PocessingOperationResponse removeHold(String accountNumber, String holdReferenceId) { 78 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 79 | } 80 | 81 | @Override 82 | public PocessingOperationResponse placePnd(String accountNumber, String pndReferenceId, String amount, 83 | String reason) { 84 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 85 | } 86 | 87 | @Override 88 | public List getStatement(GetStatement getStatement) { 89 | return dataService.getModelList(STATEMENT_MODEL_FILE_NAME); 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/AgencyController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.*; 5 | import ng.openbanking.api.payload.GenericServiceResponse; 6 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 7 | import ng.openbanking.api.payload.agency.Agency; 8 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 9 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 10 | import ng.openbanking.api.payload.bank.service.BankInfoService; 11 | import ng.openbanking.api.payload.definition.OperationStatus; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.http.ResponseEntity; 14 | import org.springframework.web.bind.annotation.PathVariable; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.RequestMethod; 17 | import org.springframework.web.bind.annotation.RestController; 18 | 19 | import java.util.List; 20 | 21 | @RestController 22 | @RequestMapping("/agencies") 23 | @Api(value = "/agencies", description = "Agency related operations", consumes = "application/json", tags = {"agency"}) 24 | public class AgencyController extends BaseApiController{ 25 | 26 | @Autowired 27 | private BankInfoService bankInfoService; 28 | 29 | @ApiOperation(value = "Finds an Agency by Agency Code", 30 | notes = "The Agency Code is the unique identifier for an Agency as defined by a Bank or Agency Network", 31 | response = Agency.class) 32 | @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid Agency Code supplied"), 33 | @ApiResponse(code = 404, message = "Agency not found")}) 34 | 35 | @RequestMapping(value = "/{agencyId}", method = RequestMethod.GET) 36 | public ResponseEntity getAgency(@PathVariable @ApiParam(value = "The Agency's unique identifier") String agencyId) throws BankResourceNotFoundException, ServiceOperationNotSupported 37 | { 38 | Agency agency=bankInfoService.getAgencyById(agencyId); 39 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 40 | .withData(agency) 41 | .withStatus(OperationStatus.SUCCESSFUL) 42 | .withMessage(OperationStatus.SUCCESSFUL.name()) 43 | .build()); 44 | } 45 | 46 | 47 | @RequestMapping(value = "/", method = RequestMethod.GET) 48 | public ResponseEntity getAgencies() throws ServiceOperationNotSupported{ 49 | List agencyList=bankInfoService.getAgencies(); 50 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 51 | .withData(agencyList) 52 | .withStatus(OperationStatus.SUCCESSFUL) 53 | .withMessage(OperationStatus.SUCCESSFUL.name()) 54 | .build()); 55 | } 56 | 57 | @RequestMapping(value = "/latitude/{latitude}/longitude/{longitude}", method = RequestMethod.GET) 58 | public ResponseEntity getAgenciesAtLocation(@PathVariable @ApiParam(value = "The location's latitude") double latitude, 59 | @PathVariable @ApiParam(value = "The location's longitude") double longitude) throws BankResourceNotFoundException,ServiceOperationNotSupported 60 | { 61 | List agency=bankInfoService.getAgencyByLongAndLat(longitude,latitude); 62 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 63 | .withData(agency) 64 | .withStatus(OperationStatus.SUCCESSFUL) 65 | .withMessage(OperationStatus.SUCCESSFUL.name()) 66 | .build()); 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/BranchController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.*; 5 | import ng.openbanking.api.payload.GenericServiceResponse; 6 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 7 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 8 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 9 | import ng.openbanking.api.payload.bank.service.BankInfoService; 10 | import ng.openbanking.api.payload.branch.Branch; 11 | import ng.openbanking.api.payload.definition.OperationStatus; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.http.ResponseEntity; 14 | import org.springframework.web.bind.annotation.PathVariable; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.RequestMethod; 17 | import org.springframework.web.bind.annotation.RestController; 18 | 19 | import java.util.List; 20 | 21 | @RestController 22 | @RequestMapping("/branch") 23 | @Api(value = "/branch", description = "Branch related operations", consumes = "application/json", tags = {"branch"}) 24 | public class BranchController extends BaseApiController{ 25 | 26 | @Autowired 27 | private BankInfoService bankInfoService; 28 | 29 | @ApiOperation(value = "Finds a Bank Branch by Branch Code", 30 | notes = "The Branch Code is the unique identifier for a bank as defined by a Bank", 31 | response = Branch.class) 32 | @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid Branch Code supplied"), 33 | @ApiResponse(code = 404, message = "Branch not found")}) 34 | @RequestMapping(value = "/{branchId}", method = RequestMethod.GET) 35 | public ResponseEntity getBranch(@PathVariable @ApiParam(value = "The Branch's unique identifier") String branchId) throws BankResourceNotFoundException, ServiceOperationNotSupported { 36 | Branch branch=bankInfoService.getBanchByBranchId(branchId); 37 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 38 | .withData(branch) 39 | .withStatus(OperationStatus.SUCCESSFUL) 40 | .withMessage(OperationStatus.SUCCESSFUL.name()) 41 | .build()); 42 | } 43 | 44 | @ApiOperation(value = "Get all Branches of a Bank", 45 | response = Branch.class, responseContainer = "List") 46 | @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid Branch Code supplied"), 47 | @ApiResponse(code = 404, message = "Branch not found")}) 48 | @RequestMapping(value = "/all", method = RequestMethod.GET) 49 | public ResponseEntity getBranches() throws ServiceOperationNotSupported{ 50 | List branches=bankInfoService.getBranches(); 51 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 52 | .withData(branches) 53 | .withStatus(OperationStatus.SUCCESSFUL) 54 | .withMessage(OperationStatus.SUCCESSFUL.name()) 55 | .build()); 56 | } 57 | 58 | @RequestMapping(value = "/latitude/{latitude}/longitude/{longitude}", method = RequestMethod.GET) 59 | public ResponseEntity getBranchesAtLocation(@PathVariable @ApiParam(value = "The location's latitude") double latitude, 60 | @PathVariable @ApiParam(value = "The location's longitude") double longitude)throws BankResourceNotFoundException,ServiceOperationNotSupported { 61 | List branches=bankInfoService.getBranchesByLongAndLat(longitude,latitude); 62 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 63 | .withData(branches) 64 | .withStatus(OperationStatus.SUCCESSFUL) 65 | .withMessage(OperationStatus.SUCCESSFUL.name()) 66 | .build()); 67 | } 68 | 69 | 70 | } 71 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/BillPaymentController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.Api; 5 | import io.swagger.annotations.ApiParam; 6 | import ng.openbanking.api.payload.GenericServiceResponse; 7 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 8 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 9 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 10 | import ng.openbanking.api.payload.bank.service.BillerInfoService; 11 | import ng.openbanking.api.payload.billpayment.BillPaymentItem; 12 | import ng.openbanking.api.payload.billpayment.Biller; 13 | import ng.openbanking.api.payload.billpayment.BillerCategory; 14 | import ng.openbanking.api.payload.billpayment.BillingSystem; 15 | import ng.openbanking.api.payload.definition.OperationStatus; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.http.ResponseEntity; 18 | import org.springframework.web.bind.annotation.PathVariable; 19 | import org.springframework.web.bind.annotation.RequestMapping; 20 | import org.springframework.web.bind.annotation.RequestMethod; 21 | import org.springframework.web.bind.annotation.RestController; 22 | 23 | import java.util.List; 24 | 25 | @RestController 26 | @RequestMapping("/billpayment") 27 | @Api(value = "/billpayment", description = "billpayment", consumes = "application/json", tags = {"billpayment"}) 28 | 29 | public class BillPaymentController extends BaseApiController{ 30 | 31 | @Autowired 32 | private BillerInfoService billerInfoService; 33 | 34 | 35 | @RequestMapping(value = "/systems", method = RequestMethod.GET) 36 | public ResponseEntity getBillingSystem() throws ServiceOperationNotSupported { 37 | List systems=billerInfoService.getBillingSystems(); 38 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 39 | .withData(systems) 40 | .withStatus(OperationStatus.SUCCESSFUL) 41 | .withMessage(OperationStatus.SUCCESSFUL.name()) 42 | .build()); 43 | } 44 | 45 | @RequestMapping(value = "/billers/categories", method = RequestMethod.GET) 46 | public ResponseEntity getBillerCategories() throws ServiceOperationNotSupported{ 47 | List categories=billerInfoService.getBillerCategories(); 48 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 49 | .withData(categories) 50 | .withStatus(OperationStatus.SUCCESSFUL) 51 | .withMessage(OperationStatus.SUCCESSFUL.name()) 52 | .build()); 53 | } 54 | 55 | @RequestMapping(value = "/billers/category/{categoryId}", method = RequestMethod.GET) 56 | public ResponseEntity getBillers(@PathVariable @ApiParam(value = "Category ID") String categoryId) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 57 | List billers=billerInfoService.getBillersByCategoryId(categoryId); 58 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 59 | .withData(billers) 60 | .withStatus(OperationStatus.SUCCESSFUL) 61 | .withMessage(OperationStatus.SUCCESSFUL.name()) 62 | .build()); 63 | } 64 | 65 | @RequestMapping(value = "/biller/{billerId}/items", method = RequestMethod.GET) 66 | public ResponseEntity getBillPaymentItem(@PathVariable @ApiParam(value = "Biller ID") String billerId) 67 | throws BankResourceNotFoundException,ServiceOperationNotSupported{ 68 | List bills=billerInfoService.getBillPaymentItemByBillerId(billerId); 69 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 70 | .withData(bills) 71 | .withStatus(OperationStatus.SUCCESSFUL) 72 | .withMessage(OperationStatus.SUCCESSFUL.name()) 73 | .build()); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.config; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.core.env.Environment; 7 | import org.springframework.web.bind.annotation.RestController; 8 | import springfox.documentation.builders.ApiInfoBuilder; 9 | import springfox.documentation.builders.AuthorizationScopeBuilder; 10 | import springfox.documentation.builders.PathSelectors; 11 | import springfox.documentation.builders.RequestHandlerSelectors; 12 | import springfox.documentation.service.*; 13 | import springfox.documentation.spi.DocumentationType; 14 | import springfox.documentation.spi.service.contexts.SecurityContext; 15 | import springfox.documentation.spring.web.plugins.Docket; 16 | import springfox.documentation.swagger.web.ApiKeyVehicle; 17 | import springfox.documentation.swagger.web.SecurityConfiguration; 18 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 19 | 20 | import java.util.ArrayList; 21 | import java.util.Arrays; 22 | import java.util.List; 23 | 24 | @Configuration 25 | @EnableSwagger2 26 | public class SwaggerConfig { 27 | 28 | @Autowired 29 | private Environment environment; 30 | 31 | 32 | @Bean 33 | public Docket api(ApiInfo apiInfo) { 34 | return new Docket(DocumentationType.SWAGGER_2) 35 | //.securitySchemes(securitySchema()).securityContexts(Arrays.asList(securityContext())) 36 | .select() 37 | .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) 38 | .paths(PathSelectors.any()) 39 | .build() 40 | .apiInfo(apiInfo); 41 | } 42 | 43 | @Bean 44 | public ApiInfo apiInfo(Contact contact) { 45 | return new ApiInfoBuilder() 46 | .title(environment.getProperty("ob.api.name")) 47 | .description(environment.getProperty("ob.api.description")) 48 | .version(environment.getProperty("ob.version")) 49 | .termsOfServiceUrl(environment.getProperty("ob.url")) 50 | .license(environment.getProperty("ob.licence")) 51 | .licenseUrl(environment.getProperty("ob.licence.url")) 52 | .contact(contact).build(); 53 | } 54 | 55 | @Bean 56 | public Contact contact() { 57 | return new Contact(environment.getProperty("ob.name"), environment.getProperty("ob.url"), environment.getProperty("ob.email")); 58 | } 59 | 60 | private List securitySchema() { 61 | LoginEndpoint loginEndpoint = new LoginEndpoint("http://localhost:8080/oauth/token"); 62 | GrantType grantType = new ResourceOwnerPasswordCredentialsGrant("http://localhost:8080/oauth/token"); 63 | List schemeList = new ArrayList<>(); 64 | List gTypes = new ArrayList<>(); 65 | gTypes.add(grantType); 66 | List authorizationScopes = new ArrayList<>(); 67 | /* 68 | 69 | Arrays.stream(AccessScope.values()).forEach(field -> { 70 | authorizationScopes.add(new AuthorizationScopeBuilder().scope(field.getName()).description(field.getDescription()).build()); 71 | }); 72 | */ 73 | 74 | authorizationScopes.add(new AuthorizationScopeBuilder().scope("read").build()); 75 | authorizationScopes.add(new AuthorizationScopeBuilder().scope("write").build()); 76 | 77 | 78 | schemeList.add(new OAuth("oauth2", authorizationScopes, gTypes)); 79 | return schemeList; 80 | } 81 | 82 | @Bean 83 | public SecurityConfiguration securityInfo() { 84 | return new SecurityConfiguration("gigy", "secret", "", "", "", ApiKeyVehicle.HEADER, "", " "); 85 | } 86 | 87 | private SecurityContext securityContext() { 88 | return SecurityContext.builder().securityReferences(defaultAuth()).forPaths(PathSelectors.any()).build(); 89 | } 90 | 91 | private List defaultAuth() { 92 | final AuthorizationScope[] authorizationScopes = new AuthorizationScope[0]; 93 | return Arrays.asList(new SecurityReference("oauth2", authorizationScopes)); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /demo-web-service/src/main/java/ng/openbanking/api/demo/service/DemoInfoService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.demo.service; 2 | 3 | 4 | import ng.openbanking.api.payload.agency.Agency; 5 | import ng.openbanking.api.payload.atm.ATM; 6 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 7 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 8 | import ng.openbanking.api.payload.bank.service.BankInfoService; 9 | import ng.openbanking.api.payload.branch.Branch; 10 | import ng.openbanking.api.payload.pos.POS; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.List; 15 | 16 | @Service 17 | public class DemoInfoService implements BankInfoService { 18 | 19 | @Autowired 20 | private DataService dataService; 21 | 22 | private static final String AGENCY_MODEL_FILE_NAME = "Agency"; 23 | 24 | private static final String ATM_MODEL_FILE_NAME = "Atm"; 25 | 26 | private static final String BRANCH_MODEL_FILE_NAME = "Branch"; 27 | 28 | private static final String POS_MODEL_FILE_NAME="Pos"; 29 | 30 | @Override 31 | public Agency getAgencyById(String agencyId) throws BankResourceNotFoundException, ServiceOperationNotSupported { 32 | return dataService.getSingleFromList(AGENCY_MODEL_FILE_NAME); 33 | 34 | } 35 | 36 | @Override 37 | public List getAgencies() throws ServiceOperationNotSupported { 38 | return dataService.getModelList(AGENCY_MODEL_FILE_NAME); 39 | } 40 | 41 | @Override 42 | public List getAgencyByLongAndLat(double longitude, double latitude) throws BankResourceNotFoundException, ServiceOperationNotSupported { 43 | return dataService.getModelList(AGENCY_MODEL_FILE_NAME); 44 | } 45 | 46 | @Override 47 | public ATM getAtmById(String terminalId) throws BankResourceNotFoundException, ServiceOperationNotSupported { 48 | return dataService.getSingleFromList(AGENCY_MODEL_FILE_NAME); 49 | } 50 | 51 | @Override 52 | public List getAtms() throws ServiceOperationNotSupported { 53 | return dataService.getModelList(ATM_MODEL_FILE_NAME); 54 | } 55 | 56 | @Override 57 | public ATM getAtmByBranchCode(String branchCode) 58 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 59 | return dataService.getSingleFromList(ATM_MODEL_FILE_NAME); 60 | } 61 | 62 | @Override 63 | public List getAtmByLongAndLat(double longitude, double latitude) throws ServiceOperationNotSupported { 64 | return dataService.getModelList(ATM_MODEL_FILE_NAME); 65 | } 66 | 67 | @Override 68 | public Branch getBanchByBranchId(String branchId) 69 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 70 | return dataService.getSingleFromList(BRANCH_MODEL_FILE_NAME); 71 | } 72 | 73 | @Override 74 | public List getBranches() throws ServiceOperationNotSupported { 75 | return dataService.getModelList(BRANCH_MODEL_FILE_NAME); 76 | } 77 | 78 | @Override 79 | public List getBranchesByLongAndLat(double longitude, double latitude) throws ServiceOperationNotSupported { 80 | return dataService.getModelList(BRANCH_MODEL_FILE_NAME); 81 | } 82 | 83 | @Override 84 | public List getPosByTerminalId(String terminalId) 85 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 86 | return dataService.getModelList(POS_MODEL_FILE_NAME); 87 | } 88 | 89 | @Override 90 | public List getPosByMerchantId(String merchantId) 91 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 92 | return dataService.getModelList(POS_MODEL_FILE_NAME); 93 | } 94 | 95 | @Override 96 | public List getPosByBranchId(String branchId) throws BankResourceNotFoundException, ServiceOperationNotSupported { 97 | return dataService.getModelList(POS_MODEL_FILE_NAME); 98 | } 99 | 100 | @Override 101 | public List getPosByEmail(String email) throws BankResourceNotFoundException, ServiceOperationNotSupported { 102 | return dataService.getModelList(POS_MODEL_FILE_NAME); 103 | } 104 | 105 | @Override 106 | public List getPosNearLocation(double longitude, double latitude) throws ServiceOperationNotSupported { 107 | return dataService.getModelList(POS_MODEL_FILE_NAME); 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/CardController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.Api; 5 | import io.swagger.annotations.ApiParam; 6 | import ng.openbanking.api.payload.GenericServiceResponse; 7 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 8 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 9 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 10 | import ng.openbanking.api.payload.bank.service.BankCardService; 11 | import ng.openbanking.api.payload.card.Card; 12 | import ng.openbanking.api.payload.card.CardLimit; 13 | import ng.openbanking.api.payload.card.CardRequest; 14 | import ng.openbanking.api.payload.card.CardType; 15 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 16 | import ng.openbanking.api.payload.definition.OperationStatus; 17 | import org.springframework.beans.factory.annotation.Autowired; 18 | import org.springframework.http.ResponseEntity; 19 | import org.springframework.web.bind.annotation.*; 20 | 21 | import java.util.Collections; 22 | import java.util.List; 23 | 24 | @RestController 25 | @RequestMapping("/card") 26 | @Api(value = "/card", description = "CardType related operations", consumes = "application/json", tags = {"card"}) 27 | 28 | public class CardController extends BaseApiController{ 29 | 30 | @Autowired 31 | private BankCardService bankCardService; 32 | 33 | @RequestMapping(value = "/types", method = RequestMethod.GET) 34 | public List getCardTypes() { 35 | return Collections.singletonList(new CardType()); 36 | } 37 | 38 | @RequestMapping(value = "/{accountNumber}", method = RequestMethod.GET) 39 | public ResponseEntity getCards(@PathVariable @ApiParam(value = "The Account Number tied to the Card") String accountNumber) throws BankResourceNotFoundException, ServiceOperationNotSupported { 40 | List cards=bankCardService.getCardsByAccountNumber(accountNumber); 41 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 42 | .withData(cards) 43 | .withStatus(OperationStatus.SUCCESSFUL) 44 | .withMessage(OperationStatus.SUCCESSFUL.name()) 45 | .build()); 46 | } 47 | 48 | @RequestMapping(value = "/", method = RequestMethod.POST) 49 | public ResponseEntity requestCard(@RequestBody CardRequest cardRequest) throws BankResourceNotFoundException,ServiceOperationNotSupported { 50 | PocessingOperationResponse processResponse=bankCardService.requestCard(cardRequest); 51 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 52 | .withStatus(OperationStatus.SUCCESSFUL) 53 | .withMessage("Card requested successfully") 54 | .build()); 55 | } 56 | 57 | @RequestMapping(value = "/limit/{accountNumber}", method = RequestMethod.GET) 58 | public ResponseEntity getCardLimit(@PathVariable @ApiParam(value = "The Account Number tied to the Card") String accountNumber) throws BankResourceNotFoundException,ServiceOperationNotSupported { 59 | List cardLimits=bankCardService.getCardLimit(accountNumber); 60 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 61 | .withData(cardLimits) 62 | .withStatus(OperationStatus.SUCCESSFUL) 63 | .withMessage(OperationStatus.SUCCESSFUL.name()) 64 | .build()); 65 | } 66 | 67 | @RequestMapping(value = "/limit/{accountNumber}", method = RequestMethod.POST) 68 | public ResponseEntity setCardLimit(@PathVariable @ApiParam(value = "The Account Number tied to the Card") String accountNumber, 69 | @RequestBody CardLimit cardLimit) throws BankResourceNotFoundException,ServiceOperationNotSupported { 70 | PocessingOperationResponse processResponse=bankCardService.setCardLimit(cardLimit); 71 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 72 | .withStatus(OperationStatus.SUCCESSFUL) 73 | .withMessage("Limit updated successfully") 74 | .build()); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/ATMController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.*; 5 | import ng.openbanking.api.payload.GenericServiceResponse; 6 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 7 | import ng.openbanking.api.payload.atm.ATM; 8 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 9 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 10 | import ng.openbanking.api.payload.bank.service.BankInfoService; 11 | import ng.openbanking.api.payload.definition.OperationStatus; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.http.ResponseEntity; 14 | import org.springframework.web.bind.annotation.PathVariable; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.RequestMethod; 17 | import org.springframework.web.bind.annotation.RestController; 18 | 19 | import java.util.Collections; 20 | import java.util.List; 21 | 22 | @RestController 23 | @RequestMapping(value = "/atms") 24 | @Api(value = "/atms", description = "ATM related operations", produces = "application/json", consumes = "application/json", tags = {"atm"}) 25 | public class ATMController extends BaseApiController { 26 | 27 | @Autowired 28 | private BankInfoService bankInfoService; 29 | 30 | @ApiOperation(value = "Finds an ATM by Terminal ID", 31 | notes = "The ....", 32 | response = ATM.class) 33 | @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid Terminal ID supplied"), 34 | @ApiResponse(code = 404, message = "ATM not found")}) 35 | @RequestMapping(value = "/{terminalId}", method = RequestMethod.GET) 36 | public ResponseEntity getAtm(@PathVariable @ApiParam(value = "The Atm unique identifier") String terminalId) throws BankResourceNotFoundException, ServiceOperationNotSupported { 37 | ATM atm=bankInfoService.getAtmById(terminalId); 38 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 39 | .withData(atm) 40 | .withStatus(OperationStatus.SUCCESSFUL) 41 | .withMessage(OperationStatus.SUCCESSFUL.name()) 42 | .build()); 43 | } 44 | 45 | @ApiOperation(value = "Get all ATMs in a Bank", notes = "") 46 | @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid Terminal ID supplied"), 47 | @ApiResponse(code = 404, message = "ATM not found")}) 48 | @RequestMapping(value = "", method = RequestMethod.GET, produces = "application/json") 49 | public ResponseEntity getAtms() throws ServiceOperationNotSupported{ 50 | List atms=bankInfoService.getAtms(); 51 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 52 | .withData(Collections.singletonList(atms)) 53 | .withStatus(OperationStatus.SUCCESSFUL) 54 | .withMessage(OperationStatus.SUCCESSFUL.name()) 55 | .build()); 56 | } 57 | 58 | @RequestMapping(value = "/branch/{branchCode}", method = RequestMethod.GET) 59 | public ResponseEntity getAtmsByBranch(@PathVariable @ApiParam(value = "The Bank's Branch code") String branchCode) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 60 | ATM atm=bankInfoService.getAtmByBranchCode(branchCode); 61 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 62 | .withData(Collections.singletonList(atm)) 63 | .withStatus(OperationStatus.SUCCESSFUL) 64 | .withMessage(OperationStatus.SUCCESSFUL.name()) 65 | .build()); 66 | } 67 | 68 | @RequestMapping(value = "/latitude/{latitude}/longitude/{longitude}", method = RequestMethod.GET) 69 | public ResponseEntity getAtmsAtLocation(@PathVariable @ApiParam(value = "The location's latitude") double latitude, 70 | @PathVariable @ApiParam(value = "The location's longitude") double longitude) throws ServiceOperationNotSupported{ 71 | List atms=bankInfoService.getAtmByLongAndLat(longitude,latitude); 72 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 73 | .withData(Collections.singletonList(atms)) 74 | .withStatus(OperationStatus.SUCCESSFUL) 75 | .withMessage(OperationStatus.SUCCESSFUL.name()) 76 | .build()); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /demo-web-service/src/main/java/ng/openbanking/api/demo/service/DemoAccountService.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.demo.service; 2 | 3 | 4 | import ng.openbanking.api.payload.account.Account; 5 | import ng.openbanking.api.payload.account.AccountBlock; 6 | import ng.openbanking.api.payload.account.AccountType; 7 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 8 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 9 | import ng.openbanking.api.payload.bank.service.BankAccountService; 10 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 11 | import ng.openbanking.api.payload.definition.OperationStatus; 12 | import ng.openbanking.api.payload.directdebit.DirectDebit; 13 | import ng.openbanking.api.payload.directdebit.DirectDebitCancelRequest; 14 | import ng.openbanking.api.payload.directdebit.DirectDebitSetup; 15 | import ng.openbanking.api.payload.limit.Limit; 16 | import ng.openbanking.api.payload.limit.LimitCustomer; 17 | import org.springframework.beans.factory.annotation.Autowired; 18 | import org.springframework.stereotype.Service; 19 | 20 | import java.util.List; 21 | 22 | @Service 23 | public class DemoAccountService implements BankAccountService { 24 | 25 | private static final String ACCOUNT_MODEL_FILE_NAME = "Account"; 26 | 27 | private static final String ACCOUNT_TYPE_MODEL_FILE_NAME = "AccountType"; 28 | 29 | private static final String LIMIT_MODEL_FILE_NAME = "Limit"; 30 | 31 | private static final String DD_MODEL_FILE_NAME = "DiectDebit"; 32 | 33 | 34 | @Autowired 35 | private DataService dataService; 36 | 37 | public Account getAccountByAccountNumber(String accountNumber) throws BankResourceNotFoundException, ServiceOperationNotSupported { 38 | return dataService.getSingleFromList(ACCOUNT_MODEL_FILE_NAME); 39 | } 40 | 41 | @Override 42 | public Account getAccountByCustomerId(String customerId) 43 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 44 | return dataService.getSingleFromList(ACCOUNT_MODEL_FILE_NAME); 45 | } 46 | 47 | @Override 48 | public Account getAccountByBvn(String bvn) throws BankResourceNotFoundException, ServiceOperationNotSupported { 49 | return dataService.getSingleFromList(ACCOUNT_MODEL_FILE_NAME); 50 | } 51 | 52 | @Override 53 | public Account getAccountByPhoneNumber(String phoneNumber) 54 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 55 | return dataService.getSingleFromList(ACCOUNT_MODEL_FILE_NAME); 56 | } 57 | 58 | @Override 59 | public Account getAccountByEmail(String emailAddress) 60 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 61 | return dataService.getSingleFromList(ACCOUNT_MODEL_FILE_NAME); 62 | } 63 | 64 | @Override 65 | public PocessingOperationResponse blockAccount(AccountBlock accountBlock) 66 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 67 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 68 | 69 | } 70 | 71 | @Override 72 | public List getAccountTypes() { 73 | return dataService.getModelList(ACCOUNT_TYPE_MODEL_FILE_NAME); 74 | } 75 | 76 | @Override 77 | public LimitCustomer getCustomerTransactionLimit(String accountNumber) 78 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 79 | return dataService.getSingleFromList(LIMIT_MODEL_FILE_NAME); 80 | } 81 | 82 | @Override 83 | public Limit getGlobalTransactionLimit() throws ServiceOperationNotSupported { 84 | return dataService.getSingleFromList(LIMIT_MODEL_FILE_NAME); 85 | } 86 | 87 | 88 | @Override 89 | public PocessingOperationResponse setupDirectDebit(DirectDebitSetup directDebitSetup) 90 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 91 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 92 | } 93 | 94 | 95 | @Override 96 | public PocessingOperationResponse cancelDirectDebit(DirectDebitCancelRequest directDebitCancelRequest) 97 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 98 | return dataService.generateProcessingResponse(OperationStatus.SUCCESSFUL); 99 | } 100 | 101 | 102 | @Override 103 | public DirectDebit getDirectDebit(String accountNumber, String referenceNumber) 104 | throws BankResourceNotFoundException, ServiceOperationNotSupported { 105 | return dataService.getSingleFromList(DD_MODEL_FILE_NAME); 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/POSController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.*; 5 | import ng.openbanking.api.payload.GenericServiceResponse; 6 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 7 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 8 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 9 | import ng.openbanking.api.payload.bank.service.BankInfoService; 10 | import ng.openbanking.api.payload.definition.OperationStatus; 11 | import ng.openbanking.api.payload.pos.POS; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.http.ResponseEntity; 14 | import org.springframework.web.bind.annotation.PathVariable; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.RequestMethod; 17 | import org.springframework.web.bind.annotation.RestController; 18 | 19 | import java.util.Collections; 20 | import java.util.List; 21 | 22 | @RestController 23 | @RequestMapping("/pos") 24 | @Api(value = "/pos", description = "pos", consumes = "application/json", tags = {"pos"}) 25 | 26 | public class POSController extends BaseApiController{ 27 | 28 | @Autowired 29 | private BankInfoService bankInfoService; 30 | 31 | @ApiOperation(value = "Finds a POS by Terminal ID", 32 | notes = "The Terminal ID is the unique identifier for a POS", 33 | response = POS.class) 34 | @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid Terminal ID supplied"), 35 | @ApiResponse(code = 404, message = "POS not found")}) 36 | @RequestMapping(value = "/{terminalId}", method = RequestMethod.GET) 37 | public ResponseEntity getPosByTerminalId(@PathVariable @ApiParam(value = "The Terminal ID") String terminalId) throws BankResourceNotFoundException, ServiceOperationNotSupported { 38 | List posList=bankInfoService.getPosByTerminalId(terminalId); 39 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 40 | .withData(posList) 41 | .withStatus(OperationStatus.SUCCESSFUL) 42 | .withMessage(OperationStatus.SUCCESSFUL.name()) 43 | .build()); 44 | } 45 | 46 | @RequestMapping(value = "/merchant/{merchantId}", method = RequestMethod.GET) 47 | public ResponseEntity getPosByMerchantId(@PathVariable @ApiParam(value = "Merchant ID") String merchantId) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 48 | List posList=bankInfoService.getPosByMerchantId(merchantId); 49 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 50 | .withData(Collections.singletonList(posList)) 51 | .withStatus(OperationStatus.SUCCESSFUL) 52 | .withMessage(OperationStatus.SUCCESSFUL.name()) 53 | .build()); 54 | } 55 | 56 | @RequestMapping(value = "/branch/{branchId}", method = RequestMethod.GET) 57 | public ResponseEntity getPosByBranchId(@PathVariable @ApiParam(value = "Branch ID") String branchId) throws BankResourceNotFoundException,ServiceOperationNotSupported { 58 | List posList=bankInfoService.getPosByBranchId(branchId); 59 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 60 | .withData(posList) 61 | .withStatus(OperationStatus.SUCCESSFUL) 62 | .withMessage(OperationStatus.SUCCESSFUL.name()) 63 | .build()); 64 | } 65 | 66 | @RequestMapping(value = "/email/{email}", method = RequestMethod.GET) 67 | public ResponseEntity getPosByEmail(@PathVariable @ApiParam(value = "Email Address") String email) throws BankResourceNotFoundException,ServiceOperationNotSupported { 68 | List posList=bankInfoService.getPosByEmail(email); 69 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 70 | .withData(posList) 71 | .withStatus(OperationStatus.SUCCESSFUL) 72 | .withMessage(OperationStatus.SUCCESSFUL.name()) 73 | .build()); 74 | } 75 | 76 | @RequestMapping(value = "/latitude/{latitude}/longitude/{longitude}", method = RequestMethod.GET) 77 | public ResponseEntity getPosNearLocation(@PathVariable @ApiParam(value = "The location's latitude") double latitude, 78 | @PathVariable @ApiParam(value = "The location's longitude") double longitude) throws BankResourceNotFoundException,ServiceOperationNotSupported { 79 | List posList=bankInfoService.getPosNearLocation(longitude,latitude); 80 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 81 | .withData(posList) 82 | .withStatus(OperationStatus.SUCCESSFUL) 83 | .withMessage(OperationStatus.SUCCESSFUL.name()) 84 | .build()); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/CustomerController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.*; 5 | import ng.openbanking.api.payload.GenericServiceResponse; 6 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 7 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 8 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 9 | import ng.openbanking.api.payload.bank.service.CustomerInfoService; 10 | import ng.openbanking.api.payload.customer.Customer; 11 | import ng.openbanking.api.payload.customer.CustomerUpdateRequest; 12 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 13 | import ng.openbanking.api.payload.definition.OperationStatus; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.http.ResponseEntity; 16 | import org.springframework.web.bind.annotation.*; 17 | 18 | @RestController 19 | @RequestMapping("/customer") 20 | @Api(value = "/customer", description = "Customer related operations", consumes = "application/json", tags = {"customer"}) 21 | public class CustomerController extends BaseApiController { 22 | 23 | @Autowired 24 | private CustomerInfoService customerInfoService; 25 | 26 | @ApiOperation(value = "Finds a Customer by Customer ID", 27 | notes = "The Customer ID is the unique identifier for a customer as defined by a Bank", 28 | response = Customer.class) 29 | @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid Customer ID supplied"), 30 | @ApiResponse(code = 404, message = "Customer not found")}) 31 | @RequestMapping(value = "/{customerId}", method = RequestMethod.GET) 32 | public ResponseEntity getByCustomerId(@PathVariable @ApiParam(value = "The Customer's unique identifier", name = "customerId") String customerId) throws BankResourceNotFoundException, ServiceOperationNotSupported { 33 | Customer data=customerInfoService.getByCustomerId(customerId); 34 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 35 | .withData(data) 36 | .withStatus(OperationStatus.SUCCESSFUL) 37 | .withMessage(OperationStatus.SUCCESSFUL.name()) 38 | .build()); 39 | } 40 | 41 | @RequestMapping(value = "/phone/{phoneNumber}", method = RequestMethod.GET) 42 | public ResponseEntity getByPhoneNumber(@PathVariable @ApiParam(value = "The Customer's Phone Number ex: +234") String phoneNumber) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 43 | Customer data=customerInfoService.getByPhoneNumber(phoneNumber); 44 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 45 | .withData(data) 46 | .withStatus(OperationStatus.SUCCESSFUL) 47 | .withMessage(OperationStatus.SUCCESSFUL.name()) 48 | .build()); 49 | } 50 | 51 | @RequestMapping(value = "/email/{email}", method = RequestMethod.GET) 52 | public ResponseEntity getByEmail(@PathVariable @ApiParam(value = "The Customer's Email Address") String email) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 53 | Customer data=customerInfoService.getByEmail(email); 54 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 55 | .withData(data) 56 | .withStatus(OperationStatus.SUCCESSFUL) 57 | .withMessage(OperationStatus.SUCCESSFUL.name()) 58 | .build()); 59 | } 60 | 61 | @RequestMapping(value = "/bvn/{bvn}", method = RequestMethod.GET) 62 | public ResponseEntity getByBVN(@PathVariable @ApiParam(value = "The Customer's Bank Verification Number") String bvn) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 63 | Customer data=customerInfoService.getByBVN(bvn); 64 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 65 | .withData(data) 66 | .withStatus(OperationStatus.SUCCESSFUL) 67 | .withMessage(OperationStatus.SUCCESSFUL.name()) 68 | .build()); 69 | } 70 | 71 | @RequestMapping(value = "/", method = RequestMethod.POST) 72 | public ResponseEntity updateCustomerInformation(@PathVariable @RequestBody CustomerUpdateRequest customerUpdateRequest) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 73 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 74 | .withStatus(OperationStatus.SUCCESSFUL) 75 | .withMessage("Information updated successfully") 76 | .build()); 77 | } 78 | 79 | @RequestMapping(value = "/block/{customerId}", method = RequestMethod.POST) 80 | public ResponseEntity block(@PathVariable @ApiParam(value = "The Customer's unique identifier", name = "customerId") String customerId) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 81 | PocessingOperationResponse data=customerInfoService.block(customerId); 82 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 83 | .withData(data) 84 | .withStatus(OperationStatus.SUCCESSFUL) 85 | .withMessage(OperationStatus.SUCCESSFUL.name()) 86 | .build()); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | spring-boot-starter-parent 7 | org.springframework.boot 8 | 2.1.0.RELEASE 9 | 10 | 11 | 12 | ng.openbanking 13 | api-parent 14 | 0.0.5-SNAPSHOT 15 | pom 16 | 17 | api-parent 18 | Parent Pom for API for Open Banking (Nigeria) 19 | 20 | https://openbanking.ng/ 21 | 22 | 23 | damilolasodiq 24 | Sodiq Fagbola 25 | damilolasodiq@gmail.com 26 | Open Banking Nigeria 27 | https://openbanking.ng 28 | 29 | 30 | mujibishola 31 | Mujib Ishola 32 | mujib.ishola@gmail.com 33 | Open Banking Nigeria 34 | https://openbanking.ng 35 | 36 | 37 | 38 | bank-service 39 | demo-web-service 40 | web-service 41 | 42 | 43 | scm:git:https://github.com/openbankingnigeria/api.git 44 | scm:git:https://github.com/openbankingnigeria/api.git 45 | api-ng-parent-0.0.1 46 | https://github.com/openbankingnigeria/api 47 | 48 | 49 | 50 | sonatype-nexus-staging 51 | https://oss.sonatype.org/service/local/staging/deploy/maven2/ 52 | 53 | 54 | sonatype-nexus-snapshots 55 | https://oss.sonatype.org/content/repositories/snapshots/ 56 | 57 | 58 | 59 | 60 | 1.1.0 61 | 1.8 62 | UTF-8 63 | UTF-8 64 | 65 | 66 | 67 | org.springframework.boot 68 | spring-boot-starter 69 | 70 | 71 | io.github.benas 72 | random-beans 73 | 3.6.0 74 | 75 | 76 | io.springfox 77 | springfox-swagger2 78 | 2.6.1 79 | 80 | 81 | org.javamoney 82 | moneta 83 | 1.2.1 84 | pom 85 | 86 | 87 | org.zalando 88 | jackson-datatype-money 89 | ${jackson-datatype-money.version} 90 | 91 | 92 | commons-io 93 | commons-io 94 | 2.6 95 | 96 | 97 | 98 | org.projectlombok 99 | lombok 100 | true 101 | 102 | 103 | 104 | org.springframework.boot 105 | spring-boot-starter-test 106 | test 107 | 108 | 109 | 110 | 111 | 112 | 113 | org.apache.maven.plugins 114 | maven-release-plugin 115 | 2.5 116 | 117 | false 118 | release 119 | deploy 120 | 121 | 122 | 123 | 124 | 125 | 126 | org.apache.maven.plugins 127 | maven-compiler-plugin 128 | 2.5.1 129 | 130 | ${java.version} 131 | ${java.version} 132 | 133 | 134 | 135 | com.github.ekryd.sortpom 136 | sortpom-maven-plugin 137 | 2.4.0 138 | 139 | 140 | verify 141 | 142 | sort 143 | 144 | 145 | 146 | 147 | \n 148 | true 149 | true 150 | scope 151 | 4 152 | false 153 | 154 | 155 | 156 | 157 | 158 | 159 | doclint-java8-disable 160 | 161 | [1.8,) 162 | 163 | 164 | -Xdoclint:none 165 | 166 | 167 | 168 | release 169 | 170 | 171 | 172 | org.apache.maven.plugins 173 | maven-gpg-plugin 174 | 1.5 175 | 176 | 177 | sign-artifacts 178 | verify 179 | 180 | sign 181 | 182 | 183 | 184 | 185 | 186 | org.sonatype.plugins 187 | nexus-staging-maven-plugin 188 | 1.6.3 189 | true 190 | 191 | sonatype-nexus-staging 192 | https://oss.sonatype.org/ 193 | true 194 | 195 | 196 | 197 | org.apache.maven.plugins 198 | maven-source-plugin 199 | 2.2.1 200 | 201 | 202 | attach-sources 203 | 204 | jar-no-fork 205 | 206 | 207 | 208 | 209 | 210 | org.apache.maven.plugins 211 | maven-javadoc-plugin 212 | 2.9.1 213 | 214 | 215 | attach-javadocs 216 | 217 | jar 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/AccountController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.*; 5 | import ng.openbanking.api.payload.GenericServiceResponse; 6 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 7 | import ng.openbanking.api.payload.account.*; 8 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 9 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 10 | import ng.openbanking.api.payload.bank.service.BankAccountService; 11 | import ng.openbanking.api.payload.definition.OperationStatus; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.http.ResponseEntity; 14 | import org.springframework.web.bind.annotation.*; 15 | 16 | import java.util.List; 17 | 18 | @RestController 19 | @RequestMapping(value = "/account") 20 | @Api(value = "Account", description = "Account related operations", consumes = "application/json", produces = "application/json", tags = {"account"}) 21 | public class AccountController extends BaseApiController{ 22 | 23 | @Autowired 24 | private BankAccountService bankAccountService; 25 | 26 | @ApiOperation(value = "Finds an Account by Account Number", 27 | notes = "Gives general Information about an Account Number", 28 | response = Account.class, nickname = "Get a single Account") 29 | @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid Account Number supplied"), 30 | @ApiResponse(code = 404, message = "Account Not Found"), @ApiResponse(code = 200, response = Account.class, message = "Account Information")}) 31 | @RequestMapping(value = "/{accountNumber}", method = RequestMethod.GET, produces = "application/json") 32 | public ResponseEntity getAccount(@PathVariable @ApiParam(value = "The Account Number", required = true) String accountNumber) throws BankResourceNotFoundException, ServiceOperationNotSupported { 33 | Account account=bankAccountService.getAccountByAccountNumber(accountNumber); 34 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse().withData(account) 35 | .withStatus(OperationStatus.SUCCESSFUL) 36 | .withMessage(OperationStatus.SUCCESSFUL.name()) 37 | .build()); 38 | } 39 | 40 | @ApiOperation(value = "Get the balance on the account as at the specified date", 41 | notes = "Get the balance on the account as at the specified date", 42 | response = AccountBalance.class, nickname = "Get account balance") 43 | @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid Account Number supplied"), 44 | @ApiResponse(code = 404, message = "Account Not Found"), @ApiResponse(code = 200, response = AccountBalance.class, message = "Account Balance Information")}) 45 | @RequestMapping(value = "/balance/{accountNumber}", method = RequestMethod.GET, produces = "application/json") 46 | public ResponseEntity getAccountBalance(@PathVariable @ApiParam(value = "The Account Number", required = true) String accountNumber, @RequestParam @ApiParam(value = "Date in format (yyyy-mm-dd)") String date) { 47 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse().withData(new AccountBalance()) 48 | .withStatus(OperationStatus.SUCCESSFUL) 49 | .withMessage(OperationStatus.SUCCESSFUL.name()) 50 | .build()); 51 | } 52 | 53 | @ApiOperation(value = "Get Accounts by Customer ID", 54 | notes = "This endpoint allows you to get all the accounts associated with a Customer ID. It takes a Customer ID as an input and returns a list of all the accounts matching that Customer ID", 55 | response = Account.class, responseContainer = "List", nickname = "Get Accounts By Customer ID") 56 | @ApiResponses(value = {@ApiResponse(code = 404, message = "No account found with matching the Customer ID provided"), 57 | @ApiResponse(code = 200, response = Account.class, responseContainer = "List", message = "List of Accounts")}) 58 | @RequestMapping(value = "/customer/{customerId}", method = RequestMethod.GET, produces = "application/json") 59 | public ResponseEntity getAccountByCustomerId(@PathVariable @ApiParam(value = "The Customer ID as defined by Bank", required = true) String customerId) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 60 | Account account=bankAccountService.getAccountByCustomerId(customerId); 61 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse().withData(account) 62 | .withStatus(OperationStatus.SUCCESSFUL) 63 | .withMessage(OperationStatus.SUCCESSFUL.name()) 64 | .build()); 65 | } 66 | 67 | @ApiOperation(value = "Get Accounts by BVN", 68 | notes = "This endpoint allows you to get all the accounts associated with a BVN. It takes a BVN as an input and returns a list of all the accounts matching that BVN", 69 | response = Account.class, responseContainer = "List", nickname = "Get Accounts By BVN"/*, authorizations = @Authorization(value = "oAuth2", scopes = @AuthorizationScope(scope = AccessScope.READ_ACCOUNT_VALUE, description = ""))*/) 70 | @ApiResponses(value = {@ApiResponse(code = 404, message = "No account found with matching the BVN provided"), 71 | @ApiResponse(code = 200, response = Account.class, responseContainer = "List", message = "List of Accounts")}) 72 | @RequestMapping(value = "/bvn/{bvn}", method = RequestMethod.GET) 73 | public ResponseEntity getAccountByCustomerBvn(@PathVariable @ApiParam(value = "The Customer's BVN", required = true) String bvn) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 74 | Account account=bankAccountService.getAccountByBvn(bvn); 75 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse().withData(account) 76 | .withStatus(OperationStatus.SUCCESSFUL) 77 | .withMessage(OperationStatus.SUCCESSFUL.name()) 78 | .build()); 79 | } 80 | 81 | @RequestMapping(value = "/phone/{phoneNumber}", method = RequestMethod.GET) 82 | public ResponseEntity getAccountsByPhone(@PathVariable @ApiParam(value = "The Customer's Phone Number Ex: +234 ...") String phoneNumber) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 83 | Account account=bankAccountService.getAccountByPhoneNumber(phoneNumber); 84 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse().withData(account) 85 | .withStatus(OperationStatus.SUCCESSFUL) 86 | .withMessage(OperationStatus.SUCCESSFUL.name()) 87 | .build()); 88 | } 89 | 90 | @RequestMapping(value = "/email/{emailAddress}", method = RequestMethod.GET) 91 | public ResponseEntity getAccountsByEmail(@PathVariable @ApiParam(value = "The Customer's Email Address") String emailAddress) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 92 | Account account=bankAccountService.getAccountByEmail(emailAddress); 93 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse().withData(account) 94 | .withStatus(OperationStatus.SUCCESSFUL) 95 | .withMessage(OperationStatus.SUCCESSFUL.name()) 96 | .build()); 97 | } 98 | 99 | @RequestMapping(value = "/{accountNumber}", method = RequestMethod.POST) 100 | public ResponseEntity updateAccount(@PathVariable @ApiParam(value = "The Customer's Phone Number Ex: +234 ...") String accountNumber) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 101 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 102 | .withStatus(OperationStatus.SUCCESSFUL) 103 | .withMessage("Account updated successfully") 104 | .build()); 105 | } 106 | 107 | @RequestMapping(value = "/block", method = RequestMethod.POST) 108 | public ResponseEntity blockAccount(@RequestBody AccountBlock accountBlock) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 109 | bankAccountService.blockAccount(accountBlock); 110 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 111 | .withStatus(OperationStatus.SUCCESSFUL) 112 | .withMessage(OperationStatus.SUCCESSFUL.name()) 113 | .build()); 114 | 115 | } 116 | 117 | @RequestMapping(value = "/types", method = RequestMethod.GET) 118 | public ResponseEntity getAccountType() throws ServiceOperationNotSupported{ 119 | List accountTypes=bankAccountService.getAccountTypes(); 120 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse().withData(accountTypes) 121 | .withStatus(OperationStatus.SUCCESSFUL) 122 | .withMessage(OperationStatus.SUCCESSFUL.name()) 123 | .build()); 124 | 125 | } 126 | 127 | @RequestMapping(value = "/open", method = RequestMethod.PUT, produces = "application/json") 128 | public ResponseEntity openAccount(@RequestBody AccountCreationRequest accountCreationRequest) throws ServiceOperationNotSupported{ 129 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse().withData(new AccountCreationResponse()) 130 | .withStatus(OperationStatus.SUCCESSFUL) 131 | .withMessage("Account opened successfully") 132 | .build()); 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /web-service/src/main/java/ng/openbanking/api/controller/TransactionController.java: -------------------------------------------------------------------------------- 1 | package ng.openbanking.api.controller; 2 | 3 | 4 | import io.swagger.annotations.Api; 5 | import io.swagger.annotations.ApiParam; 6 | import ng.openbanking.api.payload.GenericServiceResponse; 7 | import ng.openbanking.api.payload.GenericServiceResponseBuilder; 8 | import ng.openbanking.api.payload.bank.exception.BankResourceNotFoundException; 9 | import ng.openbanking.api.payload.bank.exception.ServiceOperationNotSupported; 10 | import ng.openbanking.api.payload.bank.service.BankTransactionService; 11 | import ng.openbanking.api.payload.customer.PocessingOperationResponse; 12 | import ng.openbanking.api.payload.definition.OperationStatus; 13 | import ng.openbanking.api.payload.transaction.*; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.http.ResponseEntity; 16 | import org.springframework.web.bind.annotation.*; 17 | 18 | import java.util.Collections; 19 | import java.util.List; 20 | 21 | @RestController 22 | @RequestMapping("/transaction") 23 | @Api(value = "/transaction", description = "Transaction related operations", consumes = "application/json", tags = {"transaction"}) 24 | public class TransactionController extends BaseApiController{ 25 | 26 | @Autowired 27 | private BankTransactionService bankTransactionService; 28 | 29 | 30 | @RequestMapping(value = "/transfer/intra-bank", method = RequestMethod.POST) 31 | public ResponseEntity singleTransferWithinBank(@RequestBody SingleTransferBank singleTransferBank) throws BankResourceNotFoundException, ServiceOperationNotSupported { 32 | PocessingOperationResponse processResponse=bankTransactionService.singleTransferWithinBank(singleTransferBank); 33 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 34 | .withData(processResponse) 35 | .withStatus(OperationStatus.SUCCESSFUL) 36 | .withMessage(OperationStatus.SUCCESSFUL.name()) 37 | .build()); 38 | } 39 | 40 | @RequestMapping(value = "/transfer/inter-bank", method = RequestMethod.POST) 41 | public ResponseEntity singleTransferOtherBank(@RequestBody SingleTransferBank singleTransferBank) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 42 | PocessingOperationResponse processResponse=bankTransactionService.singleTransferOtherBank(singleTransferBank); 43 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 44 | .withData(processResponse) 45 | .withStatus(OperationStatus.SUCCESSFUL) 46 | .withMessage(OperationStatus.SUCCESSFUL.name()) 47 | .build()); 48 | } 49 | 50 | @RequestMapping(value = "/transfer/email/{email}", method = RequestMethod.POST) 51 | public ResponseEntity singleTransferToEmail(@PathVariable String email, @RequestBody SingleTransfer singleTransfer) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 52 | PocessingOperationResponse processResponse=bankTransactionService.singleTransferToEmail(email,singleTransfer); 53 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 54 | .withData(processResponse) 55 | .withStatus(OperationStatus.SUCCESSFUL) 56 | .withMessage(OperationStatus.SUCCESSFUL.name()) 57 | .build()); 58 | } 59 | 60 | @RequestMapping(value = "/transfer/phone/{phone}", method = RequestMethod.POST) 61 | public ResponseEntity singleTransferToPhone(@PathVariable String phone, @RequestBody SingleTransfer singleTransfer) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 62 | PocessingOperationResponse processResponse=bankTransactionService.singleTransferToPhone(phone,singleTransfer); 63 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 64 | .withData(processResponse) 65 | .withStatus(OperationStatus.SUCCESSFUL) 66 | .withMessage(OperationStatus.SUCCESSFUL.name()) 67 | .build()); 68 | } 69 | 70 | @RequestMapping(value = "/transfers/inter-bank", method = RequestMethod.POST) 71 | public ResponseEntity multipleTransferWithinBank(@RequestBody MultipleTransferBank multipleTransferBank) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 72 | PocessingOperationResponse processResponse=bankTransactionService.multipleTransferWithinBank(multipleTransferBank); 73 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 74 | .withData(Collections.singletonList(new MultipleTransferBankOutput())) 75 | .withStatus(OperationStatus.SUCCESSFUL) 76 | .withMessage(OperationStatus.SUCCESSFUL.name()) 77 | .build()); 78 | } 79 | 80 | @RequestMapping(value = "/transfers/intra-bank", method = RequestMethod.POST) 81 | public ResponseEntity multipleTransferOtherBank(@RequestBody MultipleTransferBank multipleTransferBank) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 82 | PocessingOperationResponse processResponse=bankTransactionService.multipleTransferOtherBank(multipleTransferBank); 83 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 84 | .withData(Collections.singletonList(new MultipleTransferBankOutput())) 85 | .withStatus(OperationStatus.SUCCESSFUL) 86 | .withMessage(OperationStatus.SUCCESSFUL.name()) 87 | .build()); 88 | } 89 | 90 | @RequestMapping(value = "/transfer/emails", method = RequestMethod.POST) 91 | public ResponseEntity multipleTransferToPhone(@RequestBody MultipleTransfer multipleTransfer) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 92 | PocessingOperationResponse processResponse=bankTransactionService.multipleTransferToPhone(multipleTransfer); 93 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 94 | .withData(Collections.singletonList(new MultipleTransferBankOutput())) 95 | .withStatus(OperationStatus.SUCCESSFUL) 96 | .withMessage(OperationStatus.SUCCESSFUL.name()) 97 | .build()); 98 | } 99 | 100 | @RequestMapping(value = "/multipleTransferToEmail", method = RequestMethod.GET) 101 | public ResponseEntity multipleTransferToEmail(@RequestBody MultipleTransfer multipleTransfer) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 102 | PocessingOperationResponse processResponse=bankTransactionService.multipleTransferToEmail(multipleTransfer); 103 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 104 | .withData(Collections.singletonList(new MultipleTransferBankOutput())) 105 | .withStatus(OperationStatus.SUCCESSFUL) 106 | .withMessage(OperationStatus.SUCCESSFUL.name()) 107 | .build()); 108 | } 109 | 110 | @RequestMapping(value = "/hold/place", method = RequestMethod.POST) 111 | public ResponseEntity placeHold(@RequestBody PlaceHold placeHold) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 112 | PocessingOperationResponse processResponse=bankTransactionService.placeHold(placeHold); 113 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 114 | .withData(processResponse) 115 | .withStatus(OperationStatus.SUCCESSFUL) 116 | .withMessage(OperationStatus.SUCCESSFUL.name()) 117 | .build()); 118 | } 119 | 120 | @RequestMapping(value = "/hold", method = RequestMethod.GET) 121 | public ResponseEntity getHold(@ApiParam(value = "Account Number and Hold Reference ID") String accountNumber, String holdReferenceId) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 122 | PocessingOperationResponse processResponse=bankTransactionService.getHold(accountNumber,holdReferenceId); 123 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 124 | .withData(processResponse) 125 | .withStatus(OperationStatus.SUCCESSFUL) 126 | .withMessage(OperationStatus.SUCCESSFUL.name()) 127 | .build()); 128 | } 129 | 130 | @RequestMapping(value = "/hold", method = RequestMethod.POST) 131 | public ResponseEntity removeHold(@ApiParam(value = "Account Number and Reference ID") String accountNumber, String holdReferenceId) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 132 | PocessingOperationResponse processResponse=bankTransactionService.removeHold(accountNumber,holdReferenceId); 133 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 134 | .withData(processResponse) 135 | .withStatus(OperationStatus.SUCCESSFUL) 136 | .withMessage(OperationStatus.SUCCESSFUL.name()) 137 | .build()); 138 | } 139 | 140 | @RequestMapping(value = "/pnd/place", method = RequestMethod.POST) 141 | public ResponseEntity placePnd(@ApiParam(value = "Account Number, Reference ID, Amount and Reason") String accountNumber, String pndReferenceId, String amount, String reason) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 142 | PocessingOperationResponse processResponse=bankTransactionService.placePnd(accountNumber,pndReferenceId,amount,reason); 143 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 144 | .withData(processResponse) 145 | .withStatus(OperationStatus.SUCCESSFUL) 146 | .withMessage(OperationStatus.SUCCESSFUL.name()) 147 | .build()); 148 | } 149 | 150 | @RequestMapping(value = "/statement", method = RequestMethod.GET) 151 | public ResponseEntity getStatement(@RequestBody GetStatement getStatement) throws BankResourceNotFoundException,ServiceOperationNotSupported{ 152 | List statement=bankTransactionService.getStatement(getStatement); 153 | return ResponseEntity.ok(GenericServiceResponseBuilder.aGenericServiceResponse() 154 | .withData(statement) 155 | .withStatus(OperationStatus.SUCCESSFUL) 156 | .withMessage(OperationStatus.SUCCESSFUL.name()) 157 | .build()); 158 | } 159 | 160 | } 161 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------