Skip to content

Commit

Permalink
Fix transaction_text in USSD
Browse files Browse the repository at this point in the history
  • Loading branch information
PSNAppz committed Sep 18, 2024
1 parent 6e08b99 commit a2bf365
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from fastapi.responses import PlainTextResponse
from openg2p_fastapi_common.context import dbengine
from openg2p_fastapi_common.controller import BaseController
from openg2p_g2p_bridge_example_bank_models.models import Account, AccountingLog
from openg2p_g2p_bridge_example_bank_models.models import Account, AccountingLog, DebitCreditTypes
from sqlalchemy import desc
from sqlalchemy.ext.asyncio import async_sessionmaker
from sqlalchemy.future import select
Expand Down Expand Up @@ -111,7 +111,7 @@ async def get_recent_transactions(self, phone_number: str) -> str:
"%d/%b"
).upper() # Format and convert to uppercase
credit_debit_type = (
"CR" if accounting_log.debit_credit == "CREDIT" else "DR"
"CR" if accounting_log.debit_credit == DebitCreditTypes.CREDIT else "DR"
)
transaction_text += f"{credit_debit_type} - ₹{accounting_log.transaction_amount:,.2f} - {date_formatted} - {accounting_log.narrative_1} \n"
transaction_text += f"{credit_debit_type} - ₹{accounting_log.transaction_amount:,.2f} - {date_formatted} - {accounting_log.narrative_2} \n"
return f"END {transaction_text}"

0 comments on commit a2bf365

Please sign in to comment.