mirror of https://github.com/zulip/zulip.git
billing: Add mock for cancel at period end subscriptions.
This commit is contained in:
parent
d89e07b8a7
commit
fa7b98030b
|
@ -31,6 +31,7 @@ class Subscription:
|
||||||
created: int
|
created: int
|
||||||
status: str
|
status: str
|
||||||
canceled_at: int
|
canceled_at: int
|
||||||
|
cancel_at_period_end: bool
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create(customer: str, billing: str, items: List[Dict[str, Any]],
|
def create(customer: str, billing: str, items: List[Dict[str, Any]],
|
||||||
|
|
|
@ -35,6 +35,12 @@ def mock_customer_with_canceled_subscription(*args: Any, **kwargs: Any) -> strip
|
||||||
customer.subscriptions.data[0].canceled_at = 1532602160
|
customer.subscriptions.data[0].canceled_at = 1532602160
|
||||||
return customer
|
return customer
|
||||||
|
|
||||||
|
def mock_customer_with_cancel_at_period_end_subscription(*args: Any, **kwargs: Any) -> stripe.Customer:
|
||||||
|
customer = mock_customer_with_active_subscription()
|
||||||
|
customer.subscriptions.data[0].canceled_at = 1532602243
|
||||||
|
customer.subscriptions.data[0].cancel_at_period_end = True
|
||||||
|
return customer
|
||||||
|
|
||||||
def mock_upcoming_invoice(*args: Any, **kwargs: Any) -> stripe.Invoice:
|
def mock_upcoming_invoice(*args: Any, **kwargs: Any) -> stripe.Invoice:
|
||||||
return stripe.util.convert_to_stripe_object(fixture_data["upcoming_invoice"])
|
return stripe.util.convert_to_stripe_object(fixture_data["upcoming_invoice"])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue