From 8d6da2216d0811189568d8d56488c05c21059c5a Mon Sep 17 00:00:00 2001 From: Puneet Joshi Date: Wed, 27 Dec 2023 12:43:37 +0530 Subject: [PATCH] Cash transfer bridge added. --- platform/modules/g2p-cash-transfer-bridge.md | 96 ++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/platform/modules/g2p-cash-transfer-bridge.md b/platform/modules/g2p-cash-transfer-bridge.md index 1d602e88..e0d6b1bf 100644 --- a/platform/modules/g2p-cash-transfer-bridge.md +++ b/platform/modules/g2p-cash-transfer-bridge.md @@ -1,2 +1,98 @@ # G2P Cash Transfer Bridge +## Introduction + +The G2P Cash Transfer Bridge (GPB) fits in the payment chain as shown below. + +
+ +The module is envisaged to exist as an independent module in bridging the gap between a G2P system and a bank to initiate large-scale G2P cash transfers. Being specific to G2P transfers, (and not P2G, P2P, P2M etc), the module promises to be low cost, simple in design, easy to install and highly performant as real-time fast transfers are not a requirement in most social benefit transfer scenarios. However, the volume of transfers is expected to be large. + +The module will support the following functionalities at a high level + +1. Upstream interface layer compliant with G2P Connect or any other standard +2. Downstream interface layer to connect to bank with specific/proprietary interfaces +3. Query ID Account Mapper to fetch individual bank account information (optional) +4. History of past transactions +5. Reporting + +## Architecture + +

GPB Architecture

+ +## Concepts + +### Disbursement API Controller + +This functional block receives cash transfer requests from upstream systems like OpenG2P via the G2P Connect Disbursement APIs. The block parses the incoming request and writes in the DB. The Disbursement API is assumed to be Synchronous such that after DB write, 200 OK is returned to the caller. The disbursement request is expected to be split into batches by the upstream system depending on the system's optimum performance in terms of CPU and Memory. + +When a Status API is called by the upstream system, this block reads the data from DB and returns the status of requested transactions. The output may need to be 'paginated' depending on the volume of data returned. + +### Requests DB + +All the requests are persisted in a DB like Postgres along with the status of each transfer request. The DB has the following tables: + +#### 1. Payment Instructions + +
ColumnDescription
batch_idID of the requested batch
request_idID of the request (this may be assigned by the Disbursement Controller in case not available in the Disbursement request)
request_timestamp
from_faFinanal Address of the sender. If there is only one sender, then this may be not be populated here, but configured in the system
to_faThis may be an ID or contain account details (TBD)
amount
currency
statusStatus of the request. This will be updated by multiple entities. The status enumeration may be NEW, FILED, PAID/FAILED
fileThe file name in which the instruction has been written
error_codeAny error code if the status is FAILED. This will be used by the upsteam system to take necessary action like retry or giveup.
error_msgText error message
+ +The table is expected to contain millions of records and a history of past transactions. Indexing of columns will be critical for performance. Besides, the previous records may be 'archived'. This could be achieved via horizontal partitioning. The management of DB in this regard needs to be worked out during implementation. + +### Payment Backends. (Describe what is payment backend and what it does) + +* What are the available payment backends right now: + * Simple Mpesa Payment Backend + * Mojaloop Payment Backend + * [File-based Payment Backend](g2p-payments-bridge.md) + +## Installation Guide + +### Installation on Kubernetes + +* Refer to Deployment guide for deployment instructions. + * Pre Installation Configuration + * Installation Steps + * Post Installation + +### Installation Locally + +* TBD + +## Usage Guide + +* Call Disburse api. Note down Txn id +* Call Disburse Status API with Txn id + +## Detailed Description + +* Each Concept from the above Concepts Sections, if it has any technical concepts defined here. +* ID Translation Service: + * It can talk to G2P Connect ID Account Mapper. +* Multiplexer: + * has some n things. TBD. +* Backend: + * TBD + +## API Docs + +### REST API + +Use Stoplight Integration for API docs. + +### Status codes + +Mapping of status codes returned by the bank and as expected by upstream G2P systems need to be worked out. At this point of time, the following codes are defined by G2P Connect: + +``` +rjct.reference_id.invalid +rjct.reference_id.duplicate +rjct.timestamp.invalid +rjct.payer_fa.invalid +rjct.payee_fa.invalid +rjct.amount.invalid +rjct.schedule_ts.invalid +rjct.currency_code.invalid +``` + +## Available Payment Backends +