Skip to content

Commit

Permalink
Use currency formatting for VPN display prices (Fixes mozilla#13476)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgibson committed Aug 18, 2023
1 parent 9cc2b15 commit 0ce0722
Show file tree
Hide file tree
Showing 3 changed files with 562 additions and 195 deletions.
10 changes: 8 additions & 2 deletions bedrock/products/templatetags/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ def vpn_monthly_price(ctx, plan=VPN_12_MONTH_PLAN, country_code=None, lang=None,

available_plans = _vpn_get_available_plans(country_code, lang, bundle_relay)
selected_plan = available_plans.get(plan, VPN_12_MONTH_PLAN)
amount = selected_plan.get("price")
price = float(selected_plan.get("price"))
currency = selected_plan.get("currency")
currency_locale = lang.replace("-", "_")
amount = format_currency(price, currency, locale=currency_locale)

if country_code in TAX_NOT_INCLUDED:
price = ftl("vpn-shared-pricing-monthly-plus-tax", fallback="vpn-shared-pricing-monthly", amount=amount, ftl_files=FTL_FILES)
Expand Down Expand Up @@ -193,7 +196,10 @@ def vpn_total_price(ctx, country_code=None, lang=None, bundle_relay=False):

available_plans = _vpn_get_available_plans(country_code, lang, bundle_relay)
selected_plan = available_plans.get(VPN_12_MONTH_PLAN)
amount = selected_plan.get("total")
price = float(selected_plan.get("total"))
currency = selected_plan.get("currency")
currency_locale = lang.replace("-", "_")
amount = format_currency(price, currency, locale=currency_locale)

if country_code in TAX_NOT_INCLUDED:
price = ftl("vpn-shared-pricing-total-plus-tax", fallback="vpn-shared-pricing-total", amount=amount, ftl_files=FTL_FILES)
Expand Down
Loading

0 comments on commit 0ce0722

Please sign in to comment.