mirror of https://github.com/zulip/zulip.git
billing: Rename get_upcoming_invoice.
This commit is contained in:
parent
89ca1d0d97
commit
2cdcf4b88f
|
@ -101,7 +101,7 @@ def stripe_get_customer(stripe_customer_id: str) -> stripe.Customer:
|
||||||
return stripe_customer
|
return stripe_customer
|
||||||
|
|
||||||
@catch_stripe_errors
|
@catch_stripe_errors
|
||||||
def get_upcoming_invoice(stripe_customer_id: str) -> stripe.Invoice:
|
def stripe_get_upcoming_invoice(stripe_customer_id: str) -> stripe.Invoice:
|
||||||
stripe_invoice = stripe.Invoice.upcoming(customer=stripe_customer_id)
|
stripe_invoice = stripe.Invoice.upcoming(customer=stripe_customer_id)
|
||||||
if PRINT_STRIPE_FIXTURE_DATA:
|
if PRINT_STRIPE_FIXTURE_DATA:
|
||||||
print(''.join(['"upcoming_invoice": ', str(stripe_invoice), ','])) # nocoverage
|
print(''.join(['"upcoming_invoice": ', str(stripe_invoice), ','])) # nocoverage
|
||||||
|
|
|
@ -26,7 +26,7 @@ from zerver.lib.timestamp import timestamp_to_datetime
|
||||||
from zerver.models import UserProfile, Realm
|
from zerver.models import UserProfile, Realm
|
||||||
from zerver.views.push_notifications import validate_token
|
from zerver.views.push_notifications import validate_token
|
||||||
from zilencer.lib.stripe import STRIPE_PUBLISHABLE_KEY, \
|
from zilencer.lib.stripe import STRIPE_PUBLISHABLE_KEY, \
|
||||||
stripe_get_customer, get_upcoming_invoice, get_seat_count, \
|
stripe_get_customer, stripe_get_upcoming_invoice, get_seat_count, \
|
||||||
extract_current_subscription, process_initial_upgrade, sign_string, \
|
extract_current_subscription, process_initial_upgrade, sign_string, \
|
||||||
unsign_string, BillingError
|
unsign_string, BillingError
|
||||||
from zilencer.models import RemotePushDeviceToken, RemoteZulipServer, \
|
from zilencer.models import RemotePushDeviceToken, RemoteZulipServer, \
|
||||||
|
@ -244,7 +244,7 @@ def billing_home(request: HttpRequest) -> HttpResponse:
|
||||||
# Need user's timezone to do this properly
|
# Need user's timezone to do this properly
|
||||||
renewal_date = '{dt:%B} {dt.day}, {dt.year}'.format(
|
renewal_date = '{dt:%B} {dt.day}, {dt.year}'.format(
|
||||||
dt=timestamp_to_datetime(subscription.current_period_end))
|
dt=timestamp_to_datetime(subscription.current_period_end))
|
||||||
upcoming_invoice = get_upcoming_invoice(customer.stripe_customer_id)
|
upcoming_invoice = stripe_get_upcoming_invoice(customer.stripe_customer_id)
|
||||||
renewal_amount = subscription.plan.amount * subscription.quantity / 100.
|
renewal_amount = subscription.plan.amount * subscription.quantity / 100.
|
||||||
prorated_credits = 0
|
prorated_credits = 0
|
||||||
prorated_charges = upcoming_invoice.amount_due / 100. - renewal_amount
|
prorated_charges = upcoming_invoice.amount_due / 100. - renewal_amount
|
||||||
|
|
Loading…
Reference in New Issue