mirror of
https://github.com/zulip/zulip.git
synced 2026-06-21 21:32:29 +08:00
stripe: Upgrade stripe API to 2020-08-27 version.
This upgrades the Stripe API to the most recent version. Going through the Git history, it looks like our current API version is at 2019-03-14. The API version should be manually changed in Stripe dashboard at the same time as the commit is deployed in production. Backward incompatible changes that are relevant to our codebase between (2019-03-14, 2020-08-27]. * 2020-08-27 - The `sources` property on Customers is no longer included by default. * 2020-03-02 - Nothing applicable * 2019-12-03 - The `id` field of all invoice line items have changed and are now prefixed with `il_`. We only rely on this while we normalize the fixtures. * 2019-11-05 - Nothing applicable * 2019-10-17 - The `billing` attribute on invoices, subscriptions, and subscription schedules is renamed to`collection_method`. The invoice change is the one that is relevant to us. * The customer object’s `account_balance` value has been renamed to `balance`. Only used for the stubs at the moment. * 2019-10-08 - Nothing applicable * 2019-09-09 - Nothing applicable * 2019-08-14 - Nothing applicable * 2019-05-16 - Nothing applicable https://stripe.com/docs/upgrades Also normalize the following IDs in stripe fixtures * price_[A-Za-z0-9]{24} * prod_[A-Za-z0-9]{14} * pi_[A-Za-z0-9]{24} * il_[A-Za-z0-9]{24}
This commit is contained in:
parent
4b6e2c4e4d
commit
158cec84ec
@ -277,7 +277,7 @@ def catch_stripe_errors(func: CallableT) -> CallableT:
|
||||
|
||||
@catch_stripe_errors
|
||||
def stripe_get_customer(stripe_customer_id: str) -> stripe.Customer:
|
||||
return stripe.Customer.retrieve(stripe_customer_id, expand=["default_source"])
|
||||
return stripe.Customer.retrieve(stripe_customer_id, expand=["default_source", "sources"])
|
||||
|
||||
|
||||
@catch_stripe_errors
|
||||
@ -337,7 +337,7 @@ def do_replace_payment_source(
|
||||
)
|
||||
if pay_invoices:
|
||||
for stripe_invoice in stripe.Invoice.list(
|
||||
billing="charge_automatically", customer=stripe_customer.id, status="open"
|
||||
collection_method="charge_automatically", customer=stripe_customer.id, status="open"
|
||||
):
|
||||
# The user will get either a receipt or a "failed payment" email, but the in-app
|
||||
# messaging could be clearer here (e.g. it could explicitly tell the user that there
|
||||
@ -642,15 +642,15 @@ def process_initial_upgrade(
|
||||
)
|
||||
|
||||
if charge_automatically:
|
||||
billing_method = "charge_automatically"
|
||||
collection_method = "charge_automatically"
|
||||
days_until_due = None
|
||||
else:
|
||||
billing_method = "send_invoice"
|
||||
collection_method = "send_invoice"
|
||||
days_until_due = DEFAULT_INVOICE_DAYS_UNTIL_DUE
|
||||
|
||||
stripe_invoice = stripe.Invoice.create(
|
||||
auto_advance=True,
|
||||
billing=billing_method,
|
||||
collection_method=collection_method,
|
||||
customer=customer.stripe_customer_id,
|
||||
days_until_due=days_until_due,
|
||||
statement_descriptor="Zulip Standard",
|
||||
@ -795,14 +795,14 @@ def invoice_plan(plan: CustomerPlan, event_time: datetime) -> None:
|
||||
|
||||
if invoice_item_created:
|
||||
if plan.charge_automatically:
|
||||
billing_method = "charge_automatically"
|
||||
collection_method = "charge_automatically"
|
||||
days_until_due = None
|
||||
else:
|
||||
billing_method = "send_invoice"
|
||||
collection_method = "send_invoice"
|
||||
days_until_due = DEFAULT_INVOICE_DAYS_UNTIL_DUE
|
||||
stripe_invoice = stripe.Invoice.create(
|
||||
auto_advance=True,
|
||||
billing=billing_method,
|
||||
collection_method=collection_method,
|
||||
customer=plan.customer.stripe_customer_id,
|
||||
days_until_due=days_until_due,
|
||||
statement_descriptor="Zulip Standard",
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user