example-bank-api
openg2p-g2p-bridge-example-bank-api
This a FastAPI based microservice and provides the following REST APIs
check_funds
This API checks account.available_balance against the amount provided for the account and returns the status - whether FUNDS_AVAILABLE or FUNDS_NOT_AVAILABLE
block_funds
This API checks account.available_balance against the amount provided for the account If funds are available, it creates a record in fund_blocks - with a block_reference_number
It also updates the account.blocked_amount and accordingly adjusts account.available_balance (book_balance - blocked_amount)
Returns - block_reference_numberi
initiate_payment
This API accepts a List<InitiatePaymentRequests>
All "initiate_payment_requests" within a single request - are grouped under a single batch_id
Creates a new record (single record) in initiate_payment_batch (for the batch_id)
Creates new records (one record for every initiate_payment_request)
Returns an acknowledgement - that the request has been received and registered
generate_account_statement
This API accepts an Account Number (the funding account for the benefit program)
It creates a record in account_statement - generates a new ID for this record
It does not generate the account statement synchronously - but delegates this ID to a celery task
Returns this ID as response
The celery worker - picks up this ID and generates an MT940 and persists this MT940 in account_statement.statement_lob
The first 3 APIs, viz. check_funds, block_funds and initiate_payment - will be invoked by the g2p-bridge subsystem, through the example_bank_connector (BankInterface).
The last API - generate_account_statement is to be invoked manually - whenever we need to generate the account statement for the benefit_program account. In a real life scenario, the sponsor bank will generate this MT940 at the end of every business day and dispatch it to the account holder (in our case - the government department that administers the benefit program)
Last updated