mirror of https://github.com/zulip/zulip.git
billing: Create cents_to_dollar_string helper function.
This commit is contained in:
parent
876af17dd8
commit
203ddfc546
|
@ -190,6 +190,10 @@ def get_idempotency_key(ledger_entry: LicenseLedger) -> Optional[str]:
|
|||
return f"ledger_entry:{ledger_entry.id}" # nocoverage
|
||||
|
||||
|
||||
def cents_to_dollar_string(cents: int) -> str:
|
||||
return f"{cents / 100.:,.2f}"
|
||||
|
||||
|
||||
class BillingError(Exception):
|
||||
# error messages
|
||||
CONTACT_SUPPORT = gettext_lazy("Something went wrong. Please contact {email}.")
|
||||
|
|
|
@ -17,6 +17,7 @@ from corporate.lib.stripe import (
|
|||
MIN_INVOICED_LICENSES,
|
||||
STRIPE_PUBLISHABLE_KEY,
|
||||
BillingError,
|
||||
cents_to_dollar_string,
|
||||
do_change_plan_status,
|
||||
do_replace_payment_source,
|
||||
downgrade_at_the_end_of_billing_cycle,
|
||||
|
@ -332,7 +333,7 @@ def billing_home(request: HttpRequest) -> HttpResponse:
|
|||
licenses_at_next_renewal=licenses_at_next_renewal,
|
||||
seat_count=seat_count,
|
||||
renewal_date=renewal_date,
|
||||
renewal_amount=f"{renewal_cents / 100.:,.2f}",
|
||||
renewal_amount=cents_to_dollar_string(renewal_cents),
|
||||
payment_method=payment_method,
|
||||
charge_automatically=charge_automatically,
|
||||
publishable_key=STRIPE_PUBLISHABLE_KEY,
|
||||
|
|
Loading…
Reference in New Issue