mirror of https://github.com/zulip/zulip.git
billing: Use Subscription.save() instead of calling save on instances.
Continuation of 03d77bc
.
This commit is contained in:
parent
8470affb5b
commit
61e0c2693d
|
@ -311,7 +311,7 @@ def do_set_subscription_quantity(
|
||||||
stripe_subscription = extract_current_subscription(stripe_customer)
|
stripe_subscription = extract_current_subscription(stripe_customer)
|
||||||
stripe_subscription.quantity = quantity
|
stripe_subscription.quantity = quantity
|
||||||
stripe_subscription.proration_date = timestamp
|
stripe_subscription.proration_date = timestamp
|
||||||
stripe_subscription.save(idempotency_key=idempotency_key)
|
stripe.Subscription.save(stripe_subscription, idempotency_key=idempotency_key)
|
||||||
|
|
||||||
def do_adjust_subscription_quantity(
|
def do_adjust_subscription_quantity(
|
||||||
customer: Customer, timestamp: int, idempotency_key: str, delta: int) -> None:
|
customer: Customer, timestamp: int, idempotency_key: str, delta: int) -> None:
|
||||||
|
@ -319,7 +319,7 @@ def do_adjust_subscription_quantity(
|
||||||
stripe_subscription = extract_current_subscription(stripe_customer)
|
stripe_subscription = extract_current_subscription(stripe_customer)
|
||||||
stripe_subscription.quantity = stripe_subscription.quantity + delta
|
stripe_subscription.quantity = stripe_subscription.quantity + delta
|
||||||
stripe_subscription.proration_date = timestamp
|
stripe_subscription.proration_date = timestamp
|
||||||
stripe_subscription.save(idempotency_key=idempotency_key)
|
stripe.Subscription.save(stripe_subscription, idempotency_key=idempotency_key)
|
||||||
|
|
||||||
def increment_subscription_quantity(
|
def increment_subscription_quantity(
|
||||||
customer: Customer, timestamp: int, idempotency_key: str) -> None:
|
customer: Customer, timestamp: int, idempotency_key: str) -> None:
|
||||||
|
|
|
@ -64,6 +64,10 @@ class Subscription:
|
||||||
prorate: bool=..., tax_percent: float=...) -> Subscription:
|
prorate: bool=..., tax_percent: float=...) -> Subscription:
|
||||||
...
|
...
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def save(subscription: Subscription, idempotency_key: str=...) -> Subscription:
|
||||||
|
...
|
||||||
|
|
||||||
class Card:
|
class Card:
|
||||||
id: str
|
id: str
|
||||||
last4: str
|
last4: str
|
||||||
|
|
Loading…
Reference in New Issue