-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GITBOOK-1154: Developer Zone & Developer Install
- Loading branch information
1 parent
3e86b49
commit 82f3826
Showing
9 changed files
with
533 additions
and
6 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
description: >- | ||
This guide provides details on implementing the BankConnectorInterface for | ||
integration with sponsor banks to support various benefit programs in the G2P | ||
Bridge application. | ||
--- | ||
|
||
# Bank Connector Interface Guide | ||
|
||
#### Overview | ||
|
||
The `BankConnectorInterface` is designed to provide a unified approach for interacting with different sponsor banks. Custom implementations of this interface allow partners to integrate specific banking APIs without modifying the core G2P Bridge application. An example implementation, `openg2p-g2p-bridge-example-bank-connector`, connects to a simulated bank for testing purposes. | ||
|
||
* **Interface Code**: [BankConnectorInterface on GitHub](https://github.com/OpenG2P/openg2p-g2p-bridge/blob/develop/openg2p-g2p-bridge-bank-connectors/src/openg2p\_g2p\_bridge\_bank\_connectors/bank\_interface/bank\_connector\_interface.py) | ||
* **Example Implementation**: [Example Bank Connector Repository](https://github.com/OpenG2P/openg2p-g2p-bridge/blob/develop/openg2p-g2p-bridge-bank-connectors/src/openg2p\_g2p\_bridge\_bank\_connectors/bank\_connectors/example\_bank\_connector.py) | ||
|
||
*** | ||
|
||
#### Key Components of BankConnectorInterface | ||
|
||
The `BankConnectorInterface` requires the following methods: | ||
|
||
1. **`check_funds`** | ||
* **Purpose**: Verifies whether sufficient funds are available in a specific account. | ||
* **Arguments**: | ||
* `account_number` (str): The bank account number to check. | ||
* `currency` (str): Currency type of the account. | ||
* `amount` (float): Amount to verify for availability. | ||
* **Returns**: An instance of `CheckFundsResponse`: | ||
* `status` (FundsAvailableWithBankEnum): Indicates if funds are available (`FUNDS_AVAILABLE`) or not (`FUNDS_NOT_AVAILABLE`). | ||
* `error_code` (str): Error code if the check fails. | ||
2. **`block_funds`** | ||
* **Purpose**: Blocks a specified amount in the account for a disbursement cycle. | ||
* **Arguments**: | ||
* `account_number` (str): The bank account to block funds in. | ||
* `currency` (str): Currency of the account. | ||
* `amount` (float): Amount to block. | ||
* **Returns**: An instance of `BlockFundsResponse`: | ||
* `status` (FundsBlockedWithBankEnum): Block status, either `SUCCESS` or `FAILURE`. | ||
* `block_reference_no` (str): Reference number of the block if successful. | ||
* `error_code` (str): Error code if blocking fails. | ||
3. **`initiate_payment`** | ||
* **Purpose**: Sends payment instructions to the bank. This API acknowledges the payment instruction, but the bank processes it asynchronously. | ||
* **Arguments**: A list of `DisbursementPaymentPayload`, where each payload includes: | ||
* `disbursement_id` (str): Unique identifier for the disbursement. | ||
* `remitting_account` (str): Sponsor bank account for the disbursement. | ||
* `payment_amount` (float): Amount to be paid. | ||
* `beneficiary_id` (str): Unique ID for the beneficiary. | ||
* Additional fields include `beneficiary_account`, `beneficiary_name`, and `disbursement_narrative`. | ||
* **Returns**: An instance of `PaymentResponse`: | ||
* `status` (PaymentStatus): Payment status, either `SUCCESS` or `ERROR`. | ||
* `error_code` (str): Error code if the payment fails. | ||
4. **`retrieve_disbursement_id`** | ||
* **Purpose**: Extracts the disbursement ID from bank transaction records. | ||
* **Arguments**: | ||
* `bank_reference` (str): Reference from the bank statement. | ||
* `customer_reference` (str): Unique disbursement ID in G2P Bridge. | ||
* `narratives` (str): Transaction narratives from the bank statement. | ||
* **Returns**: `disbursement_id` (str): Extracted disbursement ID. | ||
5. **`retrieve_beneficiary_name`** | ||
* **Purpose**: Extracts the beneficiary’s name from bank statement narratives. | ||
* **Arguments**: | ||
* `narratives` (str): Narrative fields in the bank statement. | ||
* **Returns**: `beneficiary_name` (str): Name of the beneficiary. | ||
6. **`retrieve_reversal_reason`** | ||
* **Purpose**: Identifies the reason for reversal transactions in bank statements. | ||
* **Arguments**: | ||
* `narratives` (str): Narrative fields from the bank statement. | ||
* **Returns**: `reversal_reason` (str): Reason for reversal. | ||
|
||
*** | ||
|
||
#### Data Models and Enums | ||
|
||
To implement this interface, several data models and enums are used, imported from the G2P Bridge libraries. | ||
|
||
* **`CheckFundsResponse`**: Defines the response structure for fund checks. | ||
* **`BlockFundsResponse`**: Defines the response structure for fund blocking. | ||
* **`DisbursementPaymentPayload`**: Represents the payload for payment initiation. | ||
* **Enums**: | ||
* `FundsAvailableWithBankEnum`: Represents fund availability statuses. | ||
* `FundsBlockedWithBankEnum`: Represents fund blocking statuses. | ||
* `PaymentStatus`: Defines payment outcomes, either `SUCCESS` or `ERROR`. | ||
|
||
*** | ||
|
||
#### Example Implementation Workflow | ||
|
||
1. **Define a Custom Connector**: Implement the `BankConnectorInterface` with the sponsor bank’s API details. Use methods like `check_funds`, `block_funds`, and `initiate_payment` to communicate with the bank. | ||
2. **Configure Bank Connector Factory**: Implement `get_bank_connector(sponsor_bank_code: str)` to return an instance of the custom bank connector based on `sponsor_bank_code`. | ||
3. **Testing**: Use the [Example Bank Connector ](https://github.com/OpenG2P/openg2p-g2p-bridge/blob/develop/openg2p-g2p-bridge-bank-connectors/src/openg2p\_g2p\_bridge\_bank\_connectors/bank\_connectors/example\_bank\_connector.py)and the[ bank simulator](https://github.com/OpenG2P/openg2p-g2p-bridge-example-bank) for validating your implementation. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,88 @@ | ||
--- | ||
description: >- | ||
This document provides an overview of all necessary artifacts to deploy the | ||
G2P Bridge application, stored in designated repositories to ensure controlled | ||
access and ease of deployment. | ||
--- | ||
|
||
# Deployment Artefacts | ||
|
||
**1. Helm Chart for G2P Bridge** | ||
|
||
* **Purpose**: Deploys the complete G2P Bridge suite on Kubernetes, including the API, Celery Beat (for scheduled tasks), and Celery Workers (for background processing). | ||
* **Repository**: [G2P Bridge Deployment on GitHub](https://github.com/OpenG2P/openg2p-g2p-bridge-deployment) | ||
* **Access and Installation**: | ||
* Add the GitHub Helm chart repository and install the `openg2p-g2p-bridge` chart, which includes all G2P Bridge components: | ||
|
||
{% code overflow="wrap" %} | ||
```bash | ||
helm repo add openg2p https://github.com/OpenG2P/openg2p-g2p-bridge-deployment | ||
helm repo update | ||
helm install openg2p-g2p-bridge openg2p/openg2p-g2p-bridge --namespace your-namespace | ||
``` | ||
{% endcode %} | ||
* **Environment Configuration**: Ensure the required environment variables are configured before installation. Refer to[ G2P Bridge Developer](https://docs.openg2p.org/g2p-bridge/development/developer-install/installing-openg2p-bridge-on-linux#docs-internal-guid-f8d8e15e-7fff-3872-8a9f-bfbb05735977) section to know more about environment configuration. | ||
|
||
*** | ||
|
||
**2. Docker Images** | ||
|
||
* **Purpose**: Provides containerized versions of each G2P Bridge component for consistent and repeatable deployments. | ||
* **Repository**: Docker Hub | ||
* **Available Images**: | ||
* **API**: [openg2p-g2p-bridge-api](https://hub.docker.com/r/openg2p/openg2p-g2p-bridge-api) | ||
* **Celery Workers**: [openg2p-g2p-bridge-celery-workers](https://hub.docker.com/r/openg2p/openg2p-g2p-bridge-celery-workers) | ||
* **Celery Beat Producers**: [openg2p-g2p-bridge-celery-beat-producers](https://hub.docker.com/r/openg2p/openg2p-g2p-bridge-celery-beat-producers) | ||
* **Usage**: | ||
* Each image can be pulled directly from Docker Hub: | ||
|
||
```bash | ||
bashCopy codedocker pull openg2p/openg2p-g2p-bridge-api:<version> | ||
docker pull openg2p/openg2p-g2p-bridge-celery-workers:<version> | ||
docker pull openg2p/openg2p-g2p-bridge-celery-beat-producers:<version> | ||
``` | ||
* Replace `<version>` with the specific tag or `latest` for the latest stable release. | ||
|
||
*** | ||
|
||
**2. Python Libraries** | ||
|
||
* **Purpose**: Provides essential libraries and dependencies for G2P Bridge services. These are available on PyPI and should be installed where necessary. | ||
* **Repository**: [PyPI (Python Package Index)](https://pypi.org/) | ||
* **Available Libraries**: | ||
* `openg2p-fastapi-common`: Common FastAPI components. | ||
* `openg2p-fastapi-auth`: Authentication modules. | ||
* `openg2p-g2pconnect-common-lib`: Core library for G2P Connect. | ||
* `openg2p-g2p-bridge-models`: Database models. | ||
* `openg2p-g2p-bridge-api`: API components. | ||
* `openg2p-g2p-bridge-bank-connectors`: Bank connectors for financial integration. | ||
* `openg2p-g2p-bridge-celery-beat-producers`: Schedulers for Celery tasks. | ||
* `openg2p-g2p-bridge-celery-workers`: Workers for background processing. | ||
* **Installation**: | ||
* Install each required package using `pip`: | ||
|
||
```bash | ||
pip install openg2p-fastapi-common | ||
pip install openg2p-fastapi-auth | ||
pip install openg2p-g2pconnect-common-lib | ||
pip install openg2p-g2p-bridge-models | ||
pip install openg2p-g2p-bridge-api | ||
pip install openg2p-g2p-bridge-bank-connectors | ||
pip install openg2p-g2p-bridge-celery-beat-producers | ||
pip install openg2p-g2p-bridge-celery-workers | ||
``` | ||
|
||
*** | ||
|
||
**3. Post-Installation Configuration** | ||
|
||
After deploying the G2P Bridge, the following database table must be configured to enable the benefit program features: | ||
|
||
* **Table**: `benefit_program_configurations` | ||
* **Purpose**: Stores configuration details for each benefit program, which are essential for the operation of the G2P Bridge. | ||
|
||
Populate this table with required rows for each benefit program. Below is an example configuration (replace with your own details): | ||
|
||
<table><thead><tr><th width="262">benefit_program_mnemonic</th><th width="221">benefit_program_name</th><th>funding_org_code</th><th>funding_org_name</th><th>sponsor_bank_code</th><th>sponsor_bank_account_number</th><th>sponsor_bank_branch_code</th><th>sponsor_bank_account_currency</th><th>id_mapper_resolution_required</th><th>active</th></tr></thead><tbody><tr><td>EXAMPLE_PROGRAM</td><td>Example Benefit Program</td><td>EXB</td><td>Example_Org </td><td>EXAMPLE</td><td>EXAMPLE_ACC_1</td><td>EX001</td><td>USD</td><td>true</td><td>true</td></tr></tbody></table> | ||
|
||
Populate this table with the relevant program information to enable program-specific configurations within the G2P Bridge. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,78 @@ | ||
--- | ||
description: Helm Chart Deployment of OpenG2P Example Bank Simulator | ||
--- | ||
|
||
# Deployment of Example Bank | ||
|
||
### Prerequisites | ||
|
||
Before deploying the Helm charts, ensure that the following prerequisites are met: | ||
|
||
1. **Kubernetes Cluster**: A Kubernetes cluster is up and running. You can use any Kubernetes provider. | ||
2. **Helm CLI**: Helm CLI installed. Version 3.x or higher is recommended. You can install Helm using the official Helm installation guide. | ||
3. **Access to Docker Hub**: Ensure that Docker Hub can be accessed to pull the required container images. | ||
4. **Configured Values**: Update the `values.yaml` file with any custom settings needed for your deployment, including image versions, credentials, hostnames, etc. | ||
|
||
### Deployment Steps | ||
|
||
#### 1. Clone the GitHub Repository | ||
|
||
``` | ||
# Clone the GitHub repository containing the Helm charts | ||
$ git clone https://github.com/OpenG2P/openg2p-g2p-bridge-example-bank-deployment | ||
$ cd openg2p-g2p-bridge-example-bank-deployment/charts | ||
``` | ||
|
||
#### 2. Install Helm Dependencies | ||
|
||
``` | ||
# Install the dependencies for the Helm chart | ||
$ helm dependency update | ||
``` | ||
|
||
#### 3. Install the Helm Chart | ||
|
||
``` | ||
# Install the openg2p-g2p-bridge-example-bank chart using Helm | ||
$ helm install openg2p-g2p-example-bank ./openg2p-g2p-bridge-example-bank -f values.yaml -n <namespace> | ||
``` | ||
|
||
* Replace `openg2p-g2p-example-bank` with the desired release name. | ||
* Replace `namespace` with your kubernetes namespace. | ||
* Use the `-f` flag to provide custom configurations through a `values.yaml` file. | ||
|
||
#### 4. Update Values File (Optional) | ||
|
||
To customize the configuration, update the `values.yaml` file. Here's a sample of what you might want to configure: | ||
|
||
* Set the hostname, Docker image tags, and various other configurations to match your environment. | ||
|
||
#### 5. Check the Deployment | ||
|
||
After running the install command, ensure that all pods and services are running correctly. | ||
|
||
``` | ||
# Check the status of the Helm release | ||
$ helm status openg2p-g2p-example-bank | ||
# View the Kubernetes pods and services | ||
$ kubectl get pods,svc | ||
``` | ||
|
||
#### 6. Updating the Helm Release | ||
|
||
If changes are made to the `values.yaml` or any part of the Helm chart, use the following command to upgrade the release: | ||
|
||
``` | ||
$ helm upgrade openg2p-g2p-example-bank . -f ./values.yaml -n <namespace> | ||
``` | ||
|
||
#### 7. Uninstalling the Chart | ||
|
||
To remove the deployment, run the following: | ||
|
||
``` | ||
$ helm uninstall openg2p-g2p-example-bank -n <namespace> | ||
``` | ||
|
||
This will delete all Kubernetes resources associated with the release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,78 @@ | ||
--- | ||
description: Helm Chart Deployment of OpenG2P G2P Bridge | ||
--- | ||
|
||
# Deployment of G2P Bridge | ||
|
||
### Prerequisites | ||
|
||
Before deploying the Helm charts, ensure that the following prerequisites are met: | ||
|
||
1. **Kubernetes Cluster**: A Kubernetes cluster is up and running. You can use any Kubernetes provider. | ||
2. **Helm CLI**: Helm CLI installed. Version 3.x or higher is recommended. You can install Helm using the official Helm installation guide. | ||
3. **Access to Docker Hub**: Ensure that Docker Hub can be accessed to pull the required container images. | ||
4. **Configured Values**: Update the `values.yaml` file with any custom settings needed for your deployment, including image versions, credentials, hostnames, etc. | ||
|
||
### Deployment Steps | ||
|
||
#### 1. Clone the GitHub Repository | ||
|
||
``` | ||
# Clone the GitHub repository containing the Helm charts | ||
$ git clone https://github.com/OpenG2P/openg2p-g2p-bridge-deployment.git | ||
$ cd openg2p-g2p-bridge-deployment/charts | ||
``` | ||
|
||
#### 2. Install Helm Dependencies | ||
|
||
``` | ||
# Install the dependencies for the Helm chart | ||
$ helm dependency update | ||
``` | ||
|
||
#### 3. Install the Helm Chart | ||
|
||
``` | ||
# Install the openg2p-g2p-bridge chart using Helm | ||
$ helm install openg2p-g2p-bridge ./openg2p-g2p-bridge -f values.yaml -n <namespace> | ||
``` | ||
|
||
* Replace `openg2p-g2p-bridge` with the desired release name. | ||
* Replace `namespace` with your kubernetes namespace. | ||
* Use the `-f` flag to provide custom configurations through a `values.yaml` file. | ||
|
||
#### 4. Update Values File (Optional) | ||
|
||
To customize the configuration, update the `values.yaml` file. Here's a sample of what you might want to configure: | ||
|
||
* Set the hostname, Docker image tags, and various other configurations to match your environment. | ||
|
||
#### 5. Check the Deployment | ||
|
||
After running the install command, ensure that all pods and services are running correctly. | ||
|
||
``` | ||
# Check the status of the Helm release | ||
$ helm status openg2p-g2p-bridge | ||
# View the Kubernetes pods and services | ||
$ kubectl get pods,svc | ||
``` | ||
|
||
#### 6. Updating the Helm Release | ||
|
||
If changes are made to the `values.yaml` or any part of the Helm chart, use the following command to upgrade the release: | ||
|
||
``` | ||
$ helm upgrade openg2p-g2p-bridge . -f ./values.yaml -n <namespace> | ||
``` | ||
|
||
#### 7. Uninstalling the Chart | ||
|
||
To remove the deployment, run the following: | ||
|
||
``` | ||
$ helm uninstall openg2p-g2p-bridge -n <namespace> | ||
``` | ||
|
||
This will delete all Kubernetes resources associated with the release. |
Oops, something went wrong.