Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting for USSD responses #24

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}"
)
Loading