diff --git a/stubs/stripe/__init__.pyi b/stubs/stripe/__init__.pyi index 4601ef2474..4d733ed76a 100644 --- a/stubs/stripe/__init__.pyi +++ b/stubs/stripe/__init__.pyi @@ -31,6 +31,7 @@ class Subscription: created: int status: str canceled_at: int + cancel_at_period_end: bool @staticmethod def create(customer: str, billing: str, items: List[Dict[str, Any]], diff --git a/zilencer/tests/test_stripe.py b/zilencer/tests/test_stripe.py index 097717808d..58bd9f4da0 100644 --- a/zilencer/tests/test_stripe.py +++ b/zilencer/tests/test_stripe.py @@ -35,6 +35,12 @@ def mock_customer_with_canceled_subscription(*args: Any, **kwargs: Any) -> strip customer.subscriptions.data[0].canceled_at = 1532602160 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: return stripe.util.convert_to_stripe_object(fixture_data["upcoming_invoice"])