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.
This commit is contained in:
Fringg
2026-03-07 15:50:42 +03:00
parent fc65e2de4c
commit f4ab174d32
+9 -2
View File
@@ -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),
)