From aab8c848b6bbe8df4e74ddfe41ca3d17ac48dc5b Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Tue, 9 Jun 2026 13:43:56 +0530 Subject: [PATCH] fix(billing): preserve fallback row currency in topup options --- .../services/enterprise/billing/topup_checkout_service.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/enterprise/app/services/enterprise/billing/topup_checkout_service.rb b/enterprise/app/services/enterprise/billing/topup_checkout_service.rb index c845a15e6..5588c0c71 100644 --- a/enterprise/app/services/enterprise/billing/topup_checkout_service.rb +++ b/enterprise/app/services/enterprise/billing/topup_checkout_service.rb @@ -104,8 +104,10 @@ class Enterprise::Billing::TopupCheckoutService end def topup_options - currency = account.billing_currency - rows = configured_options[currency].presence || configured_options[Enterprise::Billing::Currencies::DEFAULT].presence || [] + # Label rows with the currency they were configured under, so a DEFAULT fallback can't relabel USD amounts and undercharge. + options = configured_options + currency = options[account.billing_currency].present? ? account.billing_currency : Enterprise::Billing::Currencies::DEFAULT + rows = options[currency].presence || [] rows.map { |opt| { credits: opt['credits'].to_i, amount: opt['amount'].to_f, currency: currency } } end