From f4ab174d32be8b48470320c27c92e75fdabd6d58 Mon Sep 17 00:00:00 2001 From: Fringg Date: Sat, 7 Mar 2026 15:50:42 +0300 Subject: [PATCH] fix: support {total_amount} placeholder in cart notification templates Add total_amount as an alias for cart_total in format() calls so custom locale overrides using {total_amount} are properly substituted instead of appearing as literal text in user messages. --- app/services/payment/common.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/services/payment/common.py b/app/services/payment/common.py index b5d30573..3f00ad4c 100644 --- a/app/services/payment/common.py +++ b/app/services/payment/common.py @@ -342,16 +342,23 @@ async def send_cart_notification_after_topup( # Build message based on whether balance is sufficient fmt = settings.format_price + cart_total_formatted = fmt(cart_total) if balance >= cart_total: template = texts.get('BALANCE_TOPPED_UP_CART_SUFFICIENT', '') - message_text = template.format(amount=fmt(amount_kopeks), balance=fmt(balance), cart_total=fmt(cart_total)) + message_text = template.format( + amount=fmt(amount_kopeks), + balance=fmt(balance), + cart_total=cart_total_formatted, + total_amount=cart_total_formatted, + ) else: missing = cart_total - balance template = texts.get('BALANCE_TOPPED_UP_CART_INSUFFICIENT', '') message_text = template.format( amount=fmt(amount_kopeks), balance=fmt(balance), - cart_total=fmt(cart_total), + cart_total=cart_total_formatted, + total_amount=cart_total_formatted, missing=fmt(missing), )