-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
123 additions
and
109 deletions.
There are no files selected for viewing
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,4 +1,4 @@ | ||
EXAMPLE_BANK_HOST=0.0.0.0 | ||
EXAMPLE_BANK_PORT=8003 | ||
EXAMPLE_BANK_PROCESS_PAYMENT_FREQUENCY=3600 | ||
EXAMPLE_BANK_PAYMENT_INITIATE_ATTEMPTS=3 | ||
EXAMPLE_BANK_PAYMENT_INITIATE_ATTEMPTS=3 |
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
4 changes: 4 additions & 0 deletions
4
...-bridge-example-bank-models/src/openg2p_g2p_bridge_example_bank_models/models/__init__.py
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
45 changes: 45 additions & 0 deletions
45
...xample-bank-models/src/openg2p_g2p_bridge_example_bank_models/models/account_statement.py
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,45 @@ | ||
from datetime import datetime | ||
from enum import Enum | ||
|
||
from openg2p_fastapi_common.models import BaseORMModelWithTimes | ||
from sqlalchemy import DateTime, Float, String, Text | ||
from sqlalchemy import Enum as SqlEnum | ||
from sqlalchemy.orm import Mapped, mapped_column | ||
|
||
|
||
class DebitCreditTypes(Enum): | ||
DEBIT = "debit" | ||
CREDIT = "credit" | ||
|
||
|
||
class AccountStatement(BaseORMModelWithTimes): | ||
__tablename__ = "account_statements" | ||
account_number: Mapped[str] = mapped_column(String, index=True) | ||
account_statement_lob: Mapped[str] = mapped_column(Text, nullable=True) | ||
account_statement_date: Mapped[datetime.date] = mapped_column( | ||
DateTime, default=datetime.date(datetime.utcnow()) | ||
) | ||
|
||
|
||
class AccountingLog(BaseORMModelWithTimes): | ||
__tablename__ = "accounting_logs" | ||
reference_no: Mapped[str] = mapped_column(String, index=True, unique=True) | ||
corresponding_block_reference_no: Mapped[str] = mapped_column(String, nullable=True) | ||
customer_reference_no: Mapped[str] = mapped_column(String, index=True) | ||
debit_credit: Mapped[DebitCreditTypes] = mapped_column(SqlEnum(DebitCreditTypes)) | ||
account_number: Mapped[str] = mapped_column(String, index=True) | ||
transaction_amount: Mapped[float] = mapped_column(Float) | ||
transaction_date: Mapped[datetime] = mapped_column(DateTime) | ||
transaction_currency: Mapped[str] = mapped_column(String) | ||
transaction_code: Mapped[str] = mapped_column(String, nullable=True) | ||
|
||
narrative_1: Mapped[str] = mapped_column(String, nullable=True) # disbursement id | ||
narrative_2: Mapped[str] = mapped_column(String, nullable=True) # beneficiary id | ||
narrative_3: Mapped[str] = mapped_column(String, nullable=True) # program pneumonic | ||
narrative_4: Mapped[str] = mapped_column( | ||
String, nullable=True | ||
) # cycle code pneumonic | ||
narrative_5: Mapped[str] = mapped_column(String, nullable=True) # beneficiary email | ||
narrative_6: Mapped[str] = mapped_column( | ||
String, nullable=True | ||
) # beneficiary phone number |
71 changes: 71 additions & 0 deletions
71
...-example-bank-models/src/openg2p_g2p_bridge_example_bank_models/models/payment_request.py
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,71 @@ | ||
from enum import Enum | ||
|
||
from openg2p_fastapi_common.models import BaseORMModelWithTimes | ||
from sqlalchemy import Enum as SqlEnum | ||
from sqlalchemy import Float, Integer, String | ||
from sqlalchemy.orm import Mapped, mapped_column | ||
|
||
|
||
class PaymentStatus(Enum): | ||
PENDING = "PENDING" | ||
SUCCESS = "SUCCESS" | ||
FAILED = "FAILED" | ||
|
||
|
||
class FundBlock(BaseORMModelWithTimes): | ||
__tablename__ = "fund_blocks" | ||
block_reference_no: Mapped[str] = mapped_column(String, index=True, unique=True) | ||
account_number: Mapped[str] = mapped_column(String) | ||
currency: Mapped[str] = mapped_column(String) | ||
amount: Mapped[float] = mapped_column(Float) | ||
amount_released: Mapped[float] = mapped_column(Float, default=0) | ||
|
||
|
||
class InitiatePaymentBatchRequest(BaseORMModelWithTimes): | ||
__tablename__ = "initiate_payment_batch_requests" | ||
batch_id: Mapped[str] = mapped_column(String, index=True, unique=True) | ||
payment_initiate_attempts: Mapped[int] = mapped_column(Integer, default=0) | ||
payment_status: Mapped[PaymentStatus] = mapped_column( | ||
SqlEnum(PaymentStatus), default=PaymentStatus.PENDING | ||
) | ||
|
||
|
||
class InitiatePaymentRequest(BaseORMModelWithTimes): | ||
__tablename__ = "initiate_payment_requests" | ||
batch_id: Mapped[str] = mapped_column(String, index=True, unique=False) | ||
payment_reference_number = mapped_column( | ||
String, index=True, unique=True | ||
) # disbursement id | ||
remitting_account: Mapped[str] = mapped_column(String, nullable=False) | ||
remitting_account_currency: Mapped[str] = mapped_column(String, nullable=False) | ||
payment_amount: Mapped[float] = mapped_column(Float, nullable=False) | ||
payment_date: Mapped[str] = mapped_column(String, nullable=False) | ||
funds_blocked_reference_number: Mapped[str] = mapped_column(String, nullable=False) | ||
|
||
beneficiary_name: Mapped[str] = mapped_column(String) | ||
beneficiary_account: Mapped[str] = mapped_column(String) | ||
beneficiary_account_currency: Mapped[str] = mapped_column(String) | ||
beneficiary_account_type: Mapped[str] = mapped_column(String) | ||
beneficiary_bank_code: Mapped[str] = mapped_column(String) | ||
beneficiary_branch_code: Mapped[str] = mapped_column(String) | ||
|
||
beneficiary_mobile_wallet_provider: Mapped[str] = mapped_column( | ||
String, nullable=True | ||
) | ||
beneficiary_phone_no: Mapped[str] = mapped_column(String, nullable=True) | ||
|
||
beneficiary_email: Mapped[str] = mapped_column(String, nullable=True) | ||
beneficiary_email_wallet_provider: Mapped[str] = mapped_column( | ||
String, nullable=True | ||
) | ||
|
||
narrative_1: Mapped[str] = mapped_column( | ||
String, nullable=True | ||
) # disbursement narrative | ||
narrative_2: Mapped[str] = mapped_column(String, nullable=True) # program pneumonic | ||
narrative_3: Mapped[str] = mapped_column( | ||
String, nullable=True | ||
) # cycle code pneumonic | ||
narrative_4: Mapped[str] = mapped_column(String, nullable=True) # beneficiary id | ||
narrative_5: Mapped[str] = mapped_column(String, nullable=True) | ||
narrative_6: Mapped[str] = mapped_column(String, nullable=True) |