This canvas describes the Banking Service, which is part of the Flexifin applications.

Description

This service exposes an API to manage bank accounts. The APIs on the Banking service allows user to create and modify two types of bank accounts, namely Savings Accounts and Current Accounts.

Each type of bank account is created from pre-configured banking products. Banking products are managed from the APIs.

Payments and transfers are initiated via APIs by the account holder. Money transfers can be made from Current accounts to Savings accounts. Current accounts can receive money from and send money to internal or external bank accounts.

The APIs provide functionality to manage beneficiaries. Bank account customers can have a list of beneficiaries, beneficiaries can optionally be classified.

The Banking service integrates with the Payment-Hub service via events on the message bus. Events flow bi-directionally between the Payment-Hub service and the Banking service. The Banking service emits payment made events destined to the Payment-Hub service, which in turn passes the payment instructions on to a Third Party Payment Provider (TPPP). The Payment-Hub service on the other hand, emits payment received events, originating from a TPPP, destined to the Banking service.

The Banking service APIs provides functionality to manage mappings. Mappings tell the Banking service where to put interest and fees collected from customer accounts and from where to get money to pay for interest earned on bank accounts.

The baning service implements a pure domain design. Where accounts are represented as buckets with balances. All accounting entries (debits and credits) are made in the Product Ledger service, based on events emitted from the Banking service.

The Banking service has a notion of day end. The Scheduler service must call the DayEnd API every day, just before midnight to kick off day end. On day end the following will happen:

  • Interest will be charged on accounts with a negative balance (ie accounts in overdraft)

  • periodic fees will be calculated and capitalized

  • interest will be calculated and paid to customers with positive balances

Transactional fees are capitalized immediately when the transaction happens.

Fees and interest collected from customer accounts are moved to a house account. Similarly, interest paid to customer accounts are collected from the same or a different house account. The specific house account is mapped to a product, which in turn is linked to a customer account.

Capabilities

  • Managing banking products (customer and house)

  • Managing customer & house accounts

  • Managing mappings to house accounts and event descriptions

  • Managing customer beneficiaries

  • Initiating payments and transfers from customer accounts

  • Managing balances on bank accounts

  • Collecting fees and interest and paying interest

  • Receiving events (money) from the outside world via Payment-Hub

  • Enforcing access restrictions to bank accounts (for customers and back office users)

Handles External Events

External Events

Results in

Note

ReasonCodeAppliedEvent

BankAccountReasonCodeLiftedEvent

reason-code

ReasonCodeAppliedEvent

BankAccountReasonCodeAppliedEvent

reason-code

PaymentMadeInternalInstructionSentEvent

ReceivePaymentCommand

Payment-Hub

PaymentReceivedInstructionSentEvent

ReceivePaymentCommand

Payment-Hub

TransferMadeInstructionSentEvent

ReceiveTransferCommand

Payment-Hub

DebitPullInstructionSentEvent

ProcessDebitOrderCommand

Payment-Hub

ClientKycStatusUpdatedEvent

UpdateClientKycStatusCommand

masterdata

DayEndInitiatedEvent

ProcessAccountDayEndCommand

internal

PurchaseInstructionSentEvent

ProcessPurchaseCommand

internal

BusinessPropertyUpdatedEvent

RelatedBusinessProperties

internal

BusinessPropertyCreatedEvent

RelatedBusinessProperties

internal

JournalAdjustmentRequestedEvent

RequestJournalCommand, ApplyJournalCommand

File-Transfer

Services listening to banking Events

Events

Service

PaymentReceivedEvent

ftl-api-service (1*)

PaymentReceivedEvent

rcp-command (1*)

Transactional banking Events

product-ledger

DebitOrderPaymentMadeEvent

payment-hub

TransferReceivedEvent

payment-hub

PaymentMadeEvent

payment-hub

TransferMadeEvent

payment-hub

PurchaseMadeEvent

payment-hub

JournalEntryCreatedEvent

banking-command

CommandProcessingFailed

File-Transfer

JournalAppliedEvent

File-Transfer

(1*) - this does not look right, FTL & RCP should listen to payment-hub events, like PaymentReceivedInstructionSentEvent not banking events

Commands

Command

Invoked By

Source Service

Manage Banking Products

CreateProductCommand

POST - /api/v1/products

UI

UpdateProductCommand

PUT - /api/v1/products/{productId}

UI

Managing customer & house accounts

CreateBankAccountCommand

POST - /api/v1/customers/{customerId}/accounts

UI

UpdateBankAccountCommand

PUT - /api/v1/customers/{customerId}/accounts/{accountId}

UI

UpdateOverdraftCommand

PUT - /api/v1/customers/{customerId}/accounts/{accountId}/updateOverdraft

UI

Managing mappings to house accounts and event descriptions

CreateHouseAccountMappingsCommand

POST - /api/v1/houseAccounts/mappings

UI

DeleteHouseAccountMappingCommand

DELETE - /api/v1/houseAccounts/mappings/{id}

UI

UpdateHouseAccountMappingCommand

PUT - /api/v1/houseAccounts/mappings/{id}

UI

CreateEventDescriptionMappingsCommand

POST - /api/v1/eventDescriptionMappings

UI

DeleteEventDescriptionMappingCommand

DELETE - /api/v1//eventDescriptionMappings/{id}

UI

UpdateEventDescriptionMappingCommand

PUT - /api/v1/eventDescriptionMappings/{id}

UI

Managing customer beneficiaries

ActivateBeneficiaryCommand

PUT - /api/v1/customers/{customerId}/beneficiaries/{beneficiaryId}/activate

UI

CreateBeneficiaryCommand

POST - /api/v1/customers/{customerId}/beneficiaries

UI

DeactivateBeneficiaryCommand

PUT - /api/v1/customers/{customerId}/beneficiaries/{beneficiaryId}/deactivate

UI

UpdateBeneficiaryCommand

PUT - /api/v1/customers/{customerId}/beneficiaries/{beneficiaryId}

UI

Manage Customer KYC status

UpdateClientKycStatusCommand

ClientKycStatusUpdatedEvent event handler

Masterdata

Initiating transactions from customer accounts

MakePaymentCommand

POST - /api/v1/accounts/{accountId}/payments

UI

MakeTransferCommand

POST - /api/v1/accounts/{accountId}/transfers

UI

ReceivePaymentCommand

PaymentMadeInternalInstructionSentEvent event handler and PaymentReceivedInstructionSentEvent event handler

Payment-Hub

ProcessDebitOrderCommand

DebitPullInstructionSent event handler

Payment-Hub

ReceiveTransferCommand

TransferMadeInstructionSent event handler

Payment-Hub

ProcessPurchaseCommand

POST - /api/v1/accounts/processPurchase

test

Day end processes

InitiateAccountDayEndCommand

/api/v1/accountDayEnd

Test

InitiateDayEndCommand

GET - /api/v1/dayEnd

Scheduler

ProcessAccountDayEndCommand

DayEndInitiatedEvent event handler

internal

Other Events Created by Commands

Command/Method

Creates Event

Note

Command

MakePaymentCommand

BeneficiaryCreatedEvent

for new beneficiary

MakePaymentCommand

ScheduledPaymentCreatedEvents

for future dated payment

MakePaymentCommand

PaymentMadeEvent

non future dated payment

MakePaymentCommand

TransactionFeeEarnedEvent

Fees

MakePaymentCommand

TransactionFeeChargedEvent

Fees

InitiateDayEndCommand

DayEndInitiatedEvent

day end

InitiateAccountDayEndCommand

DayEndInitiatedEvent

day end

ProcessAccountDayEndCommand

PeriodicFeeChargedEvent

Fees

ProcessAccountDayEndCommand

PeriodicFeeEarnedEvent

Fees

ProcessAccountDayEndCommand

InterestChargedEvent

Interest

ProcessAccountDayEndCommand

InterestEarnedEvent

Interest

ProcessAccountDayEndCommand

InterestPaidEvent

Interest

ProcessAccountDayEndCommand

InterestExpenseEvent

Interest

ReceiveTransferCommand

TransactionFeeEarnedEvent

Fees

ReceivePaymentCommand

TransactionFeeEarnedEvent

Fees

MakeTransferCommand

TransactionFeeEarnedEvent

Fees

ReceiveTransferCommand

TransactionFeeChargedEvent

Fees

ReceivePaymentCommand

TransactionFeeChargedEvent

Fees

MakeTransferCommand

TransactionFeeChargedEvent

Fees

RequestJournalCommand

JournalEntryCreatedEvent

Fees

ApplyJournalCommand

JournalAppliedEvent

Fees

CreateScheduledPaymentCommand

ScheduledPaymentCreatedEvents

for recurring payments

CreateScheduledPaymentCommand

ScheduledPaymentExecutedEvents

when scheduled payments were due and were executed

DeleteScheduledPaymentCommand

ScheduledPaymentDeletedEvent

Fees

UpdateScheduledPaymentCommand

ScheduledPaymentUpdatedEvent

Fees

Internal actions resulting in events

autoEnableProducts

ProductUpdatedEvent

Products

autoDisableExpiredProducts

ProductUpdatedEvent

Products

publishActionsOnStartup

BankReasonCodeActionDefinitionLoadedEvent

Reason codes

Command failure

CommandProcessingFailedEvent

general

Dependencies

REST - Web Services Invokes

* AccountNumberFactoryImpl

/account-number/api/v1/generation/{poolName}

* RCPQueryClient

/rcp-query/api/v1/accounts/{accountNumber}

* DocumentGeneratorClient

/document-generator/api/v1/templates?templateName={templateName}&templateLocale={templateLocale}

/document-generator/api/v1/documents

* MasterDataClient

/masterdata/api/v1/naturalCustomers/{naturalCustomerId}

* RelatedBusinessProperties

/api/v1/businessProperties?application={applicationName}&keys={propertyName}

REST - Web Services Invoked By

* flexifin.rcp.command

/banking-query/api/v1/accounts/{accountNumber}

* flexifin.payment.hub

/banking-query/api/v1/accounts/{accountNumber}

Rule book properties

Property Name

Notes

apply.kyc.status.to.opening.bank.account

true to restrict account creation based on regulatory limits

auto.apply.journal.entries

true to immediately apply journal entries to accounts

flexifin.banking.pop.account.mask

true to mask account numbers

flexifin.banking.pop.account.unmasked.digits

number of visible/un-masked digits

libraries

  • flexifin-banking-event-registry

  • flexifin-exception-handler

  • flexifin-security-adapter

  • flexifin-rcp-event-registry

  • flexifin-properties-client

  • flexifin-documents-client

  • flexifin-rule-engine

  • flexifin-event-registry