Skip to content

Commit

Permalink
Merge pull request #24 from PSNAppz/1.0.0
Browse files Browse the repository at this point in the history
Fix formatting for USSD responses
  • Loading branch information
venky-ganapathy authored Sep 18, 2024
2 parents 72a7042 + 906f353 commit 084e65e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ async def ussd(
response: str = ""
_logger.info(f"Your input is {text}")
if text == "":
response = "CON What do you want to do \n"
response = "CON Welcome to Example Bank. What do you want to do? \n"
response += "1. Get account balance \n"
response += "2. Initiate transfer"
response += "3. Request account statement"
elif text == "1":
response = await self.get_account_balance(phoneNumber)
elif text == "2":
Expand Down Expand Up @@ -70,4 +71,7 @@ async def get_account_balance(self, phone_number: str) -> str:
_logger.error("Account not found")
return f"END Account not found for this phone number: {phone_number}"

return f"END Available balance is {account.available_balance}"
return (
f"END Available balance in account ending with {account.account_number[-4:]} is"
f" ₹{account.available_balance:,.2f}"
)

0 comments on commit 084e65e

Please sign in to comment.