Standardize YooMoney wallet display across payment handlers and localization

- Updated the display logic for YooMoney wallet in payment and subscription handlers to ensure consistent naming and avoid leaking sensitive account information.
- Introduced a new localization string for wallet display, enhancing clarity in user-facing messages.
- Refactored relevant sections to improve overall code maintainability and user experience.
This commit is contained in:
machka-pasla
2025-09-04 18:26:15 +03:00
parent cb464059d9
commit ba8be7c3f9
4 changed files with 32 additions and 9 deletions
+4 -2
View File
@@ -151,7 +151,8 @@ async def process_successful_payment(session: AsyncSession, bot: Bot,
display_network = card.get("card_type") or title or "Card"
display_last4 = card.get("last4")
elif (pm_type or "").lower() in {"yoo_money", "yoomoney", "yoo-money", "wallet"}:
display_network = title or "YooMoney"
# Normalize wallet display name to avoid leaking full account from title
display_network = "YooMoney"
if isinstance(account_number, str) and len(account_number) >= 4:
display_last4 = account_number[-4:]
else:
@@ -500,7 +501,8 @@ async def yookassa_webhook_route(request: web.Request):
display_network = card.get("card_type") or title or "Card"
display_last4 = card.get("last4")
elif (pm_type or "").lower() in {"yoo_money", "yoomoney", "yoo-money", "wallet"}:
display_network = title or "YooMoney"
# Normalize wallet display name to avoid leaking full account from title
display_network = "YooMoney"
if isinstance(account_number, str) and len(account_number) >= 4:
display_last4 = account_number[-4:]
else: