Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

billing: Apply a flat discount for self hosted plans.

Aman Agrawale192aef23d09
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index 65c17eed6bb..4cbb191e3d6 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -588,6 +588,8 @@ class UpgradePageParams(TypedDict):
seat_count: int
billing_base_url: str
tier: int
+ flat_discount: int
+ flat_discounted_months: int
class UpgradePageSessionTypeSpecificContext(TypedDict):
@@ -706,9 +708,11 @@ class BillingSession(ABC):
def get_data_for_stripe_payment_intent(
self,
+ customer: Customer,
price_per_license: int,
licenses: int,
plan_tier: int,
+ billing_schedule: int,
email: str,
) -> StripePaymentIntentData:
if hasattr(self, "support_session") and self.support_session: # nocoverage
@@ -721,6 +725,12 @@ class BillingSession(ABC):
plan_name = CustomerPlan.name_from_tier(plan_tier)
description = f"Upgrade to {plan_name}, ${price_per_license/100} x {licenses}"
+ if customer.flat_discounted_months > 0:
+ num_months = 12 if billing_schedule == CustomerPlan.BILLING_SCHEDULE_ANNUAL else 1
+ flat_discounted_months = min(customer.flat_discounted_months, num_months)
+ amount -= customer.flat_discount * flat_discounted_months
+ description += f" - ${customer.flat_discount/100} x {flat_discounted_months}"
+
return StripePaymentIntentData(
amount=amount,
description=description,
@@ -917,7 +927,12 @@ class BillingSession(ABC):
customer = self.get_customer()
assert customer is not None and customer.stripe_customer_id is not None
payment_intent_data = self.get_data_for_stripe_payment_intent(
- price_per_license, licenses, metadata["plan_tier"], self.get_email()
+ customer,
+ price_per_license,
+ licenses,
+ metadata["plan_tier"],
+ metadata["billing_schedule"],
+ self.get_email(),
)
# Ensure customers have a default payment method set.
stripe_customer = stripe_get_customer(customer.stripe_customer_id)
@@ -1021,14 +1036,18 @@ class BillingSession(ABC):
plan.save(update_fields=["discount", "price_per_license"])
def attach_discount_to_customer(self, new_discount: Decimal) -> str:
+ # Remove flat discount if giving customer a percentage discount.
customer = self.get_customer()
old_discount = None
if customer is not None:
old_discount = customer.default_discount
customer.default_discount = new_discount
- customer.save(update_fields=["default_discount"])
+ customer.flat_discounted_months = 0
+ customer.save(update_fields=["default_discount", "flat_discounted_months"])
else:
- customer = self.update_or_create_customer(defaults={"default_discount": new_discount})
+ customer = self.update_or_create_customer(
+ defaults={"default_discount": new_discount, "flat_discounted_months": 0}
+ )
plan = get_current_plan_by_customer(customer)
if plan is not None:
self.apply_discount_to_plan(plan, new_discount)
@@ -1305,6 +1324,21 @@ class BillingSession(ABC):
unit_amount=price_per_license,
)
+ if customer.flat_discounted_months > 0:
+ num_months = 12 if billing_schedule == CustomerPlan.BILLING_SCHEDULE_ANNUAL else 1
+ flat_discounted_months = min(customer.flat_discounted_months, num_months)
+ discount = customer.flat_discount * flat_discounted_months
+ customer.flat_discounted_months -= flat_discounted_months
+ customer.save(update_fields=["flat_discounted_months"])
+
+ stripe.InvoiceItem.create(
+ currency="usd",
+ customer=customer.stripe_customer_id,
+ description=f"${customer.flat_discount}/month new customer discount",
+ # Negative value to apply discount.
+ amount=(-1 * discount),
+ )
+
if charge_automatically:
collection_method = "charge_automatically"
days_until_due = None
@@ -1717,18 +1751,23 @@ class BillingSession(ABC):
billing_frequency = CustomerPlan.BILLING_SCHEDULES[plan.billing_schedule]
if switch_to_annual_at_end_of_cycle:
+ num_months_next_cycle = 12
annual_price_per_license = get_price_per_license(
plan.tier, CustomerPlan.BILLING_SCHEDULE_ANNUAL, customer.default_discount
)
renewal_cents = annual_price_per_license * licenses_at_next_renewal
price_per_license = format_money(annual_price_per_license / 12)
elif switch_to_monthly_at_end_of_cycle:
+ num_months_next_cycle = 1
monthly_price_per_license = get_price_per_license(
plan.tier, CustomerPlan.BILLING_SCHEDULE_MONTHLY, customer.default_discount
)
renewal_cents = monthly_price_per_license * licenses_at_next_renewal
price_per_license = format_money(monthly_price_per_license)
else:
+ num_months_next_cycle = (
+ 12 if plan.billing_schedule == CustomerPlan.BILLING_SCHEDULE_ANNUAL else 1
+ )
renewal_cents = self.get_customer_plan_renewal_amount(plan, now, last_ledger_entry)
if plan.price_per_license is None:
@@ -1738,6 +1777,14 @@ class BillingSession(ABC):
else:
price_per_license = format_money(plan.price_per_license)
+ # TODO: Do this calculation in `invoice_plan` too.
+ pre_discount_renewal_cents = renewal_cents
+ flat_discount, flat_discounted_months = self.get_flat_discount_info(plan.customer)
+ if flat_discounted_months > 0:
+ flat_discounted_months = min(flat_discounted_months, num_months_next_cycle)
+ discount = flat_discount * flat_discounted_months
+ renewal_cents = renewal_cents - discount
+
charge_automatically = plan.charge_automatically
assert customer.stripe_customer_id is not None # for mypy
stripe_customer = stripe_get_customer(customer.stripe_customer_id)
@@ -1786,6 +1833,9 @@ class BillingSession(ABC):
"legacy_remote_server_next_plan_name": legacy_remote_server_next_plan_name,
"using_min_licenses_for_plan": using_min_licenses_for_plan,
"min_licenses_for_plan": min_licenses_for_plan,
+ "pre_discount_renewal_cents": cents_to_dollar_string(pre_discount_renewal_cents),
+ "flat_discount": format_money(customer.flat_discount),
+ "discounted_months_left": customer.flat_discounted_months,
}
return context
@@ -1821,12 +1871,30 @@ class BillingSession(ABC):
"price_per_license",
"discount_percent",
"using_min_licenses_for_plan",
+ "min_licenses_for_plan",
+ "pre_discount_renewal_cents",
]
for key in keys:
context[key] = next_plan_context[key]
return context
+ def get_flat_discount_info(self, customer: Optional[Customer] = None) -> Tuple[int, int]:
+ is_self_hosted_billing = not isinstance(self, RealmBillingSession)
+ flat_discount = 0
+ flat_discounted_months = 0
+ if is_self_hosted_billing and (customer is None or customer.flat_discounted_months > 0):
+ if customer is None:
+ temp_customer = Customer()
+ flat_discount = temp_customer.flat_discount
+ flat_discounted_months = 12
+ else:
+ flat_discount = customer.flat_discount
+ flat_discounted_months = customer.flat_discounted_months
+ assert isinstance(flat_discount, int)
+ assert isinstance(flat_discounted_months, int)
+ return flat_discount, flat_discounted_months
+
def get_initial_upgrade_context(
self, initial_upgrade_request: InitialUpgradeRequest
) -> Tuple[Optional[str], Optional[UpgradePageContext]]:
@@ -1893,6 +1961,7 @@ class BillingSession(ABC):
f"{free_trial_end:%B} {free_trial_end.day}, {free_trial_end.year}"
)
+ flat_discount, flat_discounted_months = self.get_flat_discount_info(customer)
context: UpgradePageContext = {
"customer_name": customer_specific_context["customer_name"],
"default_invoice_days_until_due": DEFAULT_INVOICE_DAYS_UNTIL_DUE,
@@ -1917,6 +1986,8 @@ class BillingSession(ABC):
"seat_count": seat_count,
"billing_base_url": self.billing_base_url,
"tier": tier,
+ "flat_discount": flat_discount,
+ "flat_discounted_months": flat_discounted_months,
},
"using_min_licenses_for_plan": using_min_licenses_for_plan,
"min_licenses_for_plan": min_licenses_for_plan,
@@ -3245,12 +3316,16 @@ class RemoteRealmBillingSession(BillingSession):
remote_realm=self.remote_realm,
defaults={"stripe_customer_id": stripe_customer_id},
)
- return customer
else:
customer, created = Customer.objects.update_or_create(
remote_realm=self.remote_realm, defaults=defaults
)
- return customer
+
+ if created and not customer.default_discount:
+ customer.flat_discounted_months = 12
+ customer.save(update_fields=["flat_discounted_months"])
+
+ return customer
@override
@transaction.atomic
@@ -3634,12 +3709,16 @@ class RemoteServerBillingSession(BillingSession):
remote_server=self.remote_server,
defaults={"stripe_customer_id": stripe_customer_id},
)
- return customer
else:
customer, created = Customer.objects.update_or_create(
remote_server=self.remote_server, defaults=defaults
)
- return customer
+
+ if created and not customer.default_discount:
+ customer.flat_discounted_months = 12
+ customer.save(update_fields=["flat_discounted_months"])
+
+ return customer
@override
@transaction.atomic
diff --git a/corporate/migrations/0031_customer_flat_discount_and_more.py b/corporate/migrations/0031_customer_flat_discount_and_more.py
new file mode 100644
index 00000000000..719615a6227
--- /dev/null
+++ b/corporate/migrations/0031_customer_flat_discount_and_more.py
@@ -0,0 +1,22 @@
+# Generated by Django 4.2.8 on 2023-12-19 12:24
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("corporate", "0030_alter_zulipsponsorshiprequest_requested_plan"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="customer",
+ name="flat_discount",
+ field=models.IntegerField(default=2000),
+ ),
+ migrations.AddField(
+ model_name="customer",
+ name="flat_discounted_months",
+ field=models.IntegerField(default=0),
+ ),
+ ]
diff --git a/corporate/models.py b/corporate/models.py
index 0d9a57c0dc3..b0c13811904 100644
--- a/corporate/models.py
+++ b/corporate/models.py
@@ -34,6 +34,11 @@ class Customer(models.Model):
# they purchased.
exempt_from_license_number_check = models.BooleanField(default=False)
+ # In cents.
+ flat_discount = models.IntegerField(default=2000)
+ # Number of months left in the flat discount period.
+ flat_discounted_months = models.IntegerField(default=0)
+
class Meta:
# Enforce that at least one of these is set.
constraints = [
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.create.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.create.1.json
index 856442bd13b..3d6b9bc66c1 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.create.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.create.1.json
@@ -6,7 +6,7 @@
"default_currency": null,
"default_source": null,
"delinquent": false,
- "description": "zulip.testserver b46d7a23-a8e",
+ "description": "demo.example.com 6cde5f7a-1f7",
"discount": null,
"email": "[email protected]",
"id": "cus_NORMALIZED0001",
@@ -19,8 +19,8 @@
},
"livemode": false,
"metadata": {
- "remote_realm_host": "zulip.testserver",
- "remote_realm_uuid": "b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43"
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
},
"name": null,
"next_invoice_sequence": 1,
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.modify.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.modify.1.json
index 6c64e0b8593..828b03f680a 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.modify.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.modify.1.json
@@ -6,21 +6,21 @@
"default_currency": null,
"default_source": null,
"delinquent": false,
- "description": "zulip.testserver b46d7a23-a8e",
+ "description": "demo.example.com 6cde5f7a-1f7",
"discount": null,
"email": "[email protected]",
"id": "cus_NORMALIZED0001",
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
- "default_payment_method": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "default_payment_method": "pm_1OPIudDEQaroqDjsC28eJ38G",
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {
- "remote_realm_host": "zulip.testserver",
- "remote_realm_uuid": "b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43"
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
},
"name": null,
"next_invoice_sequence": 1,
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.1.json
index 50bf46243d0..33f1a5cc6ce 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.1.json
@@ -6,7 +6,7 @@
"default_currency": null,
"default_source": null,
"delinquent": false,
- "description": "zulip.testserver b46d7a23-a8e",
+ "description": "demo.example.com 6cde5f7a-1f7",
"discount": null,
"email": "[email protected]",
"id": "cus_NORMALIZED0001",
@@ -54,7 +54,7 @@
},
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
- "id": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "id": "pm_1OPIudDEQaroqDjsC28eJ38G",
"livemode": false,
"metadata": {},
"object": "payment_method",
@@ -65,8 +65,8 @@
},
"livemode": false,
"metadata": {
- "remote_realm_host": "zulip.testserver",
- "remote_realm_uuid": "b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43"
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
},
"name": null,
"next_invoice_sequence": 1,
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.2.json
index 50bf46243d0..33f1a5cc6ce 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.2.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.2.json
@@ -6,7 +6,7 @@
"default_currency": null,
"default_source": null,
"delinquent": false,
- "description": "zulip.testserver b46d7a23-a8e",
+ "description": "demo.example.com 6cde5f7a-1f7",
"discount": null,
"email": "[email protected]",
"id": "cus_NORMALIZED0001",
@@ -54,7 +54,7 @@
},
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
- "id": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "id": "pm_1OPIudDEQaroqDjsC28eJ38G",
"livemode": false,
"metadata": {},
"object": "payment_method",
@@ -65,8 +65,8 @@
},
"livemode": false,
"metadata": {
- "remote_realm_host": "zulip.testserver",
- "remote_realm_uuid": "b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43"
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
},
"name": null,
"next_invoice_sequence": 1,
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.3.json
index 50bf46243d0..33f1a5cc6ce 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.3.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.3.json
@@ -6,7 +6,7 @@
"default_currency": null,
"default_source": null,
"delinquent": false,
- "description": "zulip.testserver b46d7a23-a8e",
+ "description": "demo.example.com 6cde5f7a-1f7",
"discount": null,
"email": "[email protected]",
"id": "cus_NORMALIZED0001",
@@ -54,7 +54,7 @@
},
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
- "id": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "id": "pm_1OPIudDEQaroqDjsC28eJ38G",
"livemode": false,
"metadata": {},
"object": "payment_method",
@@ -65,8 +65,8 @@
},
"livemode": false,
"metadata": {
- "remote_realm_host": "zulip.testserver",
- "remote_realm_uuid": "b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43"
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
},
"name": null,
"next_invoice_sequence": 1,
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.4.json
index 50bf46243d0..33f1a5cc6ce 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.4.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.4.json
@@ -6,7 +6,7 @@
"default_currency": null,
"default_source": null,
"delinquent": false,
- "description": "zulip.testserver b46d7a23-a8e",
+ "description": "demo.example.com 6cde5f7a-1f7",
"discount": null,
"email": "[email protected]",
"id": "cus_NORMALIZED0001",
@@ -54,7 +54,7 @@
},
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
- "id": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "id": "pm_1OPIudDEQaroqDjsC28eJ38G",
"livemode": false,
"metadata": {},
"object": "payment_method",
@@ -65,8 +65,8 @@
},
"livemode": false,
"metadata": {
- "remote_realm_host": "zulip.testserver",
- "remote_realm_uuid": "b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43"
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
},
"name": null,
"next_invoice_sequence": 1,
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.5.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.5.json
index 81c544699c7..d2e9309f6a1 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.5.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Customer.retrieve.5.json
@@ -6,7 +6,7 @@
"default_currency": "usd",
"default_source": null,
"delinquent": false,
- "description": "zulip.testserver b46d7a23-a8e",
+ "description": "demo.example.com 6cde5f7a-1f7",
"discount": null,
"email": "[email protected]",
"id": "cus_NORMALIZED0001",
@@ -54,7 +54,7 @@
},
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
- "id": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "id": "pm_1OPIudDEQaroqDjsC28eJ38G",
"livemode": false,
"metadata": {},
"object": "payment_method",
@@ -65,8 +65,8 @@
},
"livemode": false,
"metadata": {
- "remote_realm_host": "zulip.testserver",
- "remote_realm_uuid": "b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43"
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
},
"name": null,
"next_invoice_sequence": 2,
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.1.json
index 24962490113..a78f73dbd78 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.1.json
@@ -12,21 +12,21 @@
"default_currency": null,
"default_source": null,
"delinquent": false,
- "description": "zulip.testserver b46d7a23-a8e",
+ "description": "demo.example.com 6cde5f7a-1f7",
"discount": null,
"email": "[email protected]",
"id": "cus_NORMALIZED0001",
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
- "default_payment_method": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "default_payment_method": "pm_1OPIudDEQaroqDjsC28eJ38G",
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {
- "remote_realm_host": "zulip.testserver",
- "remote_realm_uuid": "b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43"
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
},
"name": null,
"next_invoice_sequence": 1,
@@ -43,13 +43,13 @@
}
}
},
- "id": "evt_1OOgxpDEQaroqDjs3n8QnakE",
+ "id": "evt_1OPIufDEQaroqDjsmKubHBgv",
"livemode": false,
"object": "event",
"pending_webhooks": 0,
"request": {
"id": "req_NORMALIZED0001",
- "idempotency_key": "502c7e28-d74c-4116-9a60-49991481c7ce"
+ "idempotency_key": "b51d06ef-9028-434c-84b9-d381dd073d96"
},
"type": "customer.updated"
}
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.2.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.2.json
index 0358ea62c20..97a939c6245 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.2.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.2.json
@@ -5,12 +5,12 @@
"created": 1000000000,
"data": {
"object": {
- "amount": 80000,
+ "amount": 176000,
"amount_capturable": 0,
"amount_details": {
"tip": {}
},
- "amount_received": 80000,
+ "amount_received": 176000,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": null,
@@ -20,8 +20,8 @@
"charges": {
"data": [
{
- "amount": 80000,
- "amount_captured": 80000,
+ "amount": 176000,
+ "amount_captured": 176000,
"amount_refunded": 0,
"application": null,
"application_fee": null,
@@ -45,7 +45,7 @@
"created": 1000000000,
"currency": "usd",
"customer": "cus_NORMALIZED0001",
- "description": "Upgrade to Zulip Business, $80.0 x 10",
+ "description": "Upgrade to Zulip Business, $80.0 x 25 - $20.0 x 12",
"destination": null,
"dispute": null,
"disputed": false,
@@ -60,13 +60,13 @@
"billing_modality": "charge_automatically",
"billing_schedule": "1",
"license_management": "automatic",
- "licenses": "10",
- "plan_tier": "103",
+ "licenses": "25",
+ "plan_tier": "104",
"price_per_license": "8000",
- "remote_realm_host": "zulip.testserver",
- "remote_realm_user_email": "[email protected]",
- "remote_realm_user_id": "2",
- "seat_count": "10",
+ "remote_server_host": "demo.example.com",
+ "remote_server_user_email": "[email protected]",
+ "remote_server_user_id": "1",
+ "seat_count": "25",
"type": "upgrade"
},
"object": "charge",
@@ -82,10 +82,10 @@
},
"paid": true,
"payment_intent": "pi_NORMALIZED00000000000001",
- "payment_method": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "payment_method": "pm_1OPIudDEQaroqDjsC28eJ38G",
"payment_method_details": {
"card": {
- "amount_authorized": 80000,
+ "amount_authorized": 176000,
"brand": "visa",
"checks": {
"address_line1_check": null,
@@ -114,7 +114,7 @@
"used": false
},
"overcapture": {
- "maximum_amount_capturable": 80000,
+ "maximum_amount_capturable": 176000,
"status": "unavailable"
},
"three_d_secure": null,
@@ -122,9 +122,10 @@
},
"type": "card"
},
+ "radar_options": {},
"receipt_email": "[email protected]",
"receipt_number": null,
- "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKOyUgawGMgaTRcELw346LBalmRAGZQJNTnPFghYLFYEdk58qc5YojynNyLbZXivDKMO2YPWrF66-aqRr",
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKMCIiqwGMgYkMZ-O9146LBZnlesDtrpQEz8bsICAtIKI-9SMdQtIgYnHHJD3ppYFPTtlhfln7HJ5_IzG",
"refunded": false,
"refunds": {
"data": [],
@@ -149,12 +150,12 @@
"total_count": 1,
"url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"
},
- "client_secret": "pi_NORMALIZED00000000000001_secret_eCDtZomR9THUUNBv25qmdV7ff",
+ "client_secret": "pi_NORMALIZED00000000000001_secret_qlDeEAQkvumd5xvwrwoW24sN8",
"confirmation_method": "automatic",
"created": 1000000000,
"currency": "usd",
"customer": "cus_NORMALIZED0001",
- "description": "Upgrade to Zulip Business, $80.0 x 10",
+ "description": "Upgrade to Zulip Business, $80.0 x 25 - $20.0 x 12",
"id": "pi_NORMALIZED00000000000001",
"invoice": null,
"last_payment_error": null,
@@ -164,19 +165,19 @@
"billing_modality": "charge_automatically",
"billing_schedule": "1",
"license_management": "automatic",
- "licenses": "10",
- "plan_tier": "103",
+ "licenses": "25",
+ "plan_tier": "104",
"price_per_license": "8000",
- "remote_realm_host": "zulip.testserver",
- "remote_realm_user_email": "[email protected]",
- "remote_realm_user_id": "2",
- "seat_count": "10",
+ "remote_server_host": "demo.example.com",
+ "remote_server_user_email": "[email protected]",
+ "remote_server_user_id": "1",
+ "seat_count": "25",
"type": "upgrade"
},
"next_action": null,
"object": "payment_intent",
"on_behalf_of": null,
- "payment_method": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "payment_method": "pm_1OPIudDEQaroqDjsC28eJ38G",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
@@ -202,13 +203,13 @@
"transfer_group": null
}
},
- "id": "evt_3OOgxrDEQaroqDjs1aYrLdzh",
+ "id": "evt_3OPIuhDEQaroqDjs133IuPti",
"livemode": false,
"object": "event",
"pending_webhooks": 2,
"request": {
"id": "req_NORMALIZED0002",
- "idempotency_key": "b3683b72-6008-4be6-9ec4-e506a14fe19e"
+ "idempotency_key": "d7eb5d8a-4f28-40c7-8bf4-497b73cdaba9"
},
"type": "payment_intent.succeeded"
},
@@ -217,8 +218,8 @@
"created": 1000000000,
"data": {
"object": {
- "amount": 80000,
- "amount_captured": 80000,
+ "amount": 176000,
+ "amount_captured": 176000,
"amount_refunded": 0,
"application": null,
"application_fee": null,
@@ -242,7 +243,7 @@
"created": 1000000000,
"currency": "usd",
"customer": "cus_NORMALIZED0001",
- "description": "Upgrade to Zulip Business, $80.0 x 10",
+ "description": "Upgrade to Zulip Business, $80.0 x 25 - $20.0 x 12",
"destination": null,
"dispute": null,
"disputed": false,
@@ -257,13 +258,13 @@
"billing_modality": "charge_automatically",
"billing_schedule": "1",
"license_management": "automatic",
- "licenses": "10",
- "plan_tier": "103",
+ "licenses": "25",
+ "plan_tier": "104",
"price_per_license": "8000",
- "remote_realm_host": "zulip.testserver",
- "remote_realm_user_email": "[email protected]",
- "remote_realm_user_id": "2",
- "seat_count": "10",
+ "remote_server_host": "demo.example.com",
+ "remote_server_user_email": "[email protected]",
+ "remote_server_user_id": "1",
+ "seat_count": "25",
"type": "upgrade"
},
"object": "charge",
@@ -279,10 +280,10 @@
},
"paid": true,
"payment_intent": "pi_NORMALIZED00000000000001",
- "payment_method": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "payment_method": "pm_1OPIudDEQaroqDjsC28eJ38G",
"payment_method_details": {
"card": {
- "amount_authorized": 80000,
+ "amount_authorized": 176000,
"brand": "visa",
"checks": {
"address_line1_check": null,
@@ -311,7 +312,7 @@
"used": false
},
"overcapture": {
- "maximum_amount_capturable": 80000,
+ "maximum_amount_capturable": 176000,
"status": "unavailable"
},
"three_d_secure": null,
@@ -319,9 +320,10 @@
},
"type": "card"
},
+ "radar_options": {},
"receipt_email": "[email protected]",
"receipt_number": null,
- "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKOyUgawGMgaHvmbb_d06LBZ--m1w17rsK8UZNufVNvo0vfwhx7lZ6ZrdseqJu7dX9k5YkzrZRrRQfhNk",
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKMCIiqwGMgZwKg6dkhg6LBa2x5jF_ok1ahX2URDLlp4l1sCYbItcsHkhoY3Pl1RbG59rX8rCszZuncby",
"refunded": false,
"refunds": {
"data": [],
@@ -341,13 +343,13 @@
"transfer_group": null
}
},
- "id": "evt_3OOgxrDEQaroqDjs1Io2KdbH",
+ "id": "evt_3OPIuhDEQaroqDjs1caGbymn",
"livemode": false,
"object": "event",
"pending_webhooks": 0,
"request": {
"id": "req_NORMALIZED0002",
- "idempotency_key": "b3683b72-6008-4be6-9ec4-e506a14fe19e"
+ "idempotency_key": "d7eb5d8a-4f28-40c7-8bf4-497b73cdaba9"
},
"type": "charge.succeeded"
}
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.3.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.3.json
index cfe538d1fae..22039a294a3 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.3.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.3.json
@@ -46,18 +46,18 @@
"ending_balance": 0,
"footer": null,
"from_invoice": null,
- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRDdDV1F2QmFOWEpPbkdTQkRPZHJ3aHdmT0w4RE42LDkzNDQ3Mjc40200ujSWL3KE?s=ap",
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtQZ1Q3YmxXUnR1S0FITjFxMTQxQ1NLeGNFVW45LDkzNTkzMTU002006kKxgQ3P?s=ap",
"id": "in_NORMALIZED00000000000001",
- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRDdDV1F2QmFOWEpPbkdTQkRPZHJ3aHdmT0w4RE42LDkzNDQ3Mjc40200ujSWL3KE/pdf?s=ap",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtQZ1Q3YmxXUnR1S0FITjFxMTQxQ1NLeGNFVW45LDkzNTkzMTU002006kKxgQ3P/pdf?s=ap",
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
- "amount": 80000,
- "amount_excluding_tax": 80000,
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
"currency": "usd",
- "description": "Zulip Business",
+ "description": "Customer flat discount for 12 months",
"discount_amounts": [],
"discountable": false,
"discounts": [],
@@ -67,8 +67,8 @@
"metadata": {},
"object": "line_item",
"period": {
- "end": 1357095845,
- "start": 1325473445
+ "end": 1000000000,
+ "start": 1000000000
},
"plan": null,
"price": {
@@ -89,6 +89,56 @@
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
@@ -96,7 +146,7 @@
"proration_details": {
"credited_items": null
},
- "quantity": 10,
+ "quantity": 25,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
@@ -104,15 +154,15 @@
"unit_amount_excluding_tax": "8000"
},
{
- "amount": -80000,
- "amount_excluding_tax": -80000,
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
"currency": "usd",
"description": "Payment (Card ending in 4242)",
"discount_amounts": [],
"discountable": false,
"discounts": [],
- "id": "il_NORMALIZED00000000000002",
- "invoice_item": "ii_NORMALIZED00000000000002",
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
@@ -127,20 +177,20 @@
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
- "id": "price_NORMALIZED00000000000002",
+ "id": "price_NORMALIZED00000000000003",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
- "product": "prod_NORMALIZED0002",
+ "product": "prod_NORMALIZED0003",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
- "unit_amount": -80000,
- "unit_amount_decimal": "-80000"
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
},
"proration": false,
"proration_details": {
@@ -151,12 +201,12 @@
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
- "unit_amount_excluding_tax": "-80000"
+ "unit_amount_excluding_tax": "-176000"
}
],
"has_more": false,
"object": "list",
- "total_count": 2,
+ "total_count": 3,
"url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
},
"livemode": false,
@@ -234,13 +284,13 @@
}
}
},
- "id": "evt_1OOgxuDEQaroqDjsGVh1pnqK",
+ "id": "evt_1OPIulDEQaroqDjsjY284qM8",
"livemode": false,
"object": "event",
"pending_webhooks": 2,
"request": {
"id": "req_NORMALIZED0003",
- "idempotency_key": "d04cdb80-859a-4b2c-bcfd-5f38aa5bf906"
+ "idempotency_key": "f5ed44e0-1f01-4516-a7e0-2bac952044bc"
},
"type": "invoice.updated"
},
@@ -298,10 +348,10 @@
"lines": {
"data": [
{
- "amount": 80000,
- "amount_excluding_tax": 80000,
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
"currency": "usd",
- "description": "Zulip Business",
+ "description": "Customer flat discount for 12 months",
"discount_amounts": [],
"discountable": false,
"discounts": [],
@@ -311,8 +361,8 @@
"metadata": {},
"object": "line_item",
"period": {
- "end": 1357095845,
- "start": 1325473445
+ "end": 1000000000,
+ "start": 1000000000
},
"plan": null,
"price": {
@@ -333,6 +383,56 @@
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
@@ -340,7 +440,7 @@
"proration_details": {
"credited_items": null
},
- "quantity": 10,
+ "quantity": 25,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
@@ -348,15 +448,15 @@
"unit_amount_excluding_tax": "8000"
},
{
- "amount": -80000,
- "amount_excluding_tax": -80000,
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
"currency": "usd",
"description": "Payment (Card ending in 4242)",
"discount_amounts": [],
"discountable": false,
"discounts": [],
- "id": "il_NORMALIZED00000000000002",
- "invoice_item": "ii_NORMALIZED00000000000002",
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
@@ -371,20 +471,20 @@
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
- "id": "price_NORMALIZED00000000000002",
+ "id": "price_NORMALIZED00000000000003",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
- "product": "prod_NORMALIZED0002",
+ "product": "prod_NORMALIZED0003",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
- "unit_amount": -80000,
- "unit_amount_decimal": "-80000"
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
},
"proration": false,
"proration_details": {
@@ -395,12 +495,12 @@
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
- "unit_amount_excluding_tax": "-80000"
+ "unit_amount_excluding_tax": "-176000"
}
],
"has_more": false,
"object": "list",
- "total_count": 2,
+ "total_count": 3,
"url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
},
"livemode": false,
@@ -457,13 +557,13 @@
"webhooks_delivered_at": null
}
},
- "id": "evt_1OOgxuDEQaroqDjsTduA6Jpd",
+ "id": "evt_1OPIukDEQaroqDjs83H0sK3A",
"livemode": false,
"object": "event",
"pending_webhooks": 0,
"request": {
"id": "req_NORMALIZED0004",
- "idempotency_key": "44043e1c-4a57-419d-8ac0-0513959bfd76"
+ "idempotency_key": "bae6e9ce-9dd8-4180-b02a-a7a08ff31c74"
},
"type": "invoice.created"
},
@@ -472,11 +572,11 @@
"created": 1000000000,
"data": {
"object": {
- "amount": 80000,
+ "amount": -24000,
"currency": "usd",
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
- "description": "Zulip Business",
+ "description": "Customer flat discount for 12 months",
"discountable": false,
"discounts": [],
"id": "ii_NORMALIZED00000000000001",
@@ -485,8 +585,8 @@
"metadata": {},
"object": "invoiceitem",
"period": {
- "end": 1357095845,
- "start": 1325473445
+ "end": 1000000000,
+ "start": 1000000000
},
"plan": null,
"price": {
@@ -507,11 +607,73 @@
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ }
+ },
+ "id": "evt_1OPIujDEQaroqDjsSNj3LODC",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0005",
+ "idempotency_key": "ace20f6e-13cf-43af-9381-cbd3833a2b85"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 200000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Zulip Business",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000002",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
"proration": false,
- "quantity": 10,
+ "quantity": 25,
"subscription": null,
"tax_rates": [],
"test_clock": null,
@@ -519,13 +681,13 @@
"unit_amount_decimal": "8000"
}
},
- "id": "evt_1OOgxtDEQaroqDjsIvp91HWm",
+ "id": "evt_1OPIujDEQaroqDjsecqRhrL0",
"livemode": false,
"object": "event",
"pending_webhooks": 0,
"request": {
- "id": "req_NORMALIZED0005",
- "idempotency_key": "53619ce5-e6ef-4418-899d-557abfbea920"
+ "id": "req_NORMALIZED0006",
+ "idempotency_key": "05e21ece-2f92-4185-a104-d0f27deaa3b9"
},
"type": "invoiceitem.created"
},
@@ -534,14 +696,14 @@
"created": 1000000000,
"data": {
"object": {
- "amount": -80000,
+ "amount": -176000,
"currency": "usd",
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"description": "Payment (Card ending in 4242)",
"discountable": false,
"discounts": [],
- "id": "ii_NORMALIZED00000000000002",
+ "id": "ii_NORMALIZED00000000000003",
"invoice": null,
"livemode": false,
"metadata": {},
@@ -557,37 +719,37 @@
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
- "id": "price_NORMALIZED00000000000002",
+ "id": "price_NORMALIZED00000000000003",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
- "product": "prod_NORMALIZED0002",
+ "product": "prod_NORMALIZED0003",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
- "unit_amount": -80000,
- "unit_amount_decimal": "-80000"
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
},
"proration": false,
"quantity": 1,
"subscription": null,
"tax_rates": [],
"test_clock": null,
- "unit_amount": -80000,
- "unit_amount_decimal": "-80000"
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
}
},
- "id": "evt_1OOgxtDEQaroqDjsUBpDLcC3",
+ "id": "evt_1OPIujDEQaroqDjsyIVcITaW",
"livemode": false,
"object": "event",
"pending_webhooks": 0,
"request": {
- "id": "req_NORMALIZED0006",
- "idempotency_key": "dfa8bbca-0f9d-440e-a2eb-2b282cfb6f4b"
+ "id": "req_NORMALIZED0007",
+ "idempotency_key": "bc65a36a-9e65-4351-bb7d-8940a7a20432"
},
"type": "invoiceitem.created"
},
@@ -603,21 +765,21 @@
"default_currency": "usd",
"default_source": null,
"delinquent": false,
- "description": "zulip.testserver b46d7a23-a8e",
+ "description": "demo.example.com 6cde5f7a-1f7",
"discount": null,
"email": "[email protected]",
"id": "cus_NORMALIZED0001",
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
- "default_payment_method": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "default_payment_method": "pm_1OPIudDEQaroqDjsC28eJ38G",
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {
- "remote_realm_host": "zulip.testserver",
- "remote_realm_uuid": "b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43"
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
},
"name": null,
"next_invoice_sequence": 1,
@@ -633,13 +795,13 @@
"default_currency": null
}
},
- "id": "evt_1OOgxtDEQaroqDjs66I8R291",
+ "id": "evt_1OPIuiDEQaroqDjsJEu9mjRe",
"livemode": false,
"object": "event",
"pending_webhooks": 0,
"request": {
- "id": "req_NORMALIZED0006",
- "idempotency_key": "dfa8bbca-0f9d-440e-a2eb-2b282cfb6f4b"
+ "id": "req_NORMALIZED0007",
+ "idempotency_key": "bc65a36a-9e65-4351-bb7d-8940a7a20432"
},
"type": "customer.updated"
}
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.4.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.4.json
index cc6a646b8fb..b5c6ad8c817 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.4.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.4.json
@@ -46,18 +46,18 @@
"ending_balance": 0,
"footer": null,
"from_invoice": null,
- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRDdDV1F2QmFOWEpPbkdTQkRPZHJ3aHdmT0w4RE42LDkzNDQ3Mjc50200pHhEI2SJ?s=ap",
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtQZ1Q3YmxXUnR1S0FITjFxMTQxQ1NLeGNFVW45LDkzNTkzMTU10200HQjFSW8u?s=ap",
"id": "in_NORMALIZED00000000000001",
- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRDdDV1F2QmFOWEpPbkdTQkRPZHJ3aHdmT0w4RE42LDkzNDQ3Mjc50200pHhEI2SJ/pdf?s=ap",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtQZ1Q3YmxXUnR1S0FITjFxMTQxQ1NLeGNFVW45LDkzNTkzMTU10200HQjFSW8u/pdf?s=ap",
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
- "amount": 80000,
- "amount_excluding_tax": 80000,
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
"currency": "usd",
- "description": "Zulip Business",
+ "description": "Customer flat discount for 12 months",
"discount_amounts": [],
"discountable": false,
"discounts": [],
@@ -67,8 +67,8 @@
"metadata": {},
"object": "line_item",
"period": {
- "end": 1357095845,
- "start": 1325473445
+ "end": 1000000000,
+ "start": 1000000000
},
"plan": null,
"price": {
@@ -89,6 +89,56 @@
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
@@ -96,7 +146,7 @@
"proration_details": {
"credited_items": null
},
- "quantity": 10,
+ "quantity": 25,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
@@ -104,15 +154,15 @@
"unit_amount_excluding_tax": "8000"
},
{
- "amount": -80000,
- "amount_excluding_tax": -80000,
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
"currency": "usd",
"description": "Payment (Card ending in 4242)",
"discount_amounts": [],
"discountable": false,
"discounts": [],
- "id": "il_NORMALIZED00000000000002",
- "invoice_item": "ii_NORMALIZED00000000000002",
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
@@ -127,20 +177,20 @@
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
- "id": "price_NORMALIZED00000000000002",
+ "id": "price_NORMALIZED00000000000003",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
- "product": "prod_NORMALIZED0002",
+ "product": "prod_NORMALIZED0003",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
- "unit_amount": -80000,
- "unit_amount_decimal": "-80000"
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
},
"proration": false,
"proration_details": {
@@ -151,12 +201,12 @@
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
- "unit_amount_excluding_tax": "-80000"
+ "unit_amount_excluding_tax": "-176000"
}
],
"has_more": false,
"object": "list",
- "total_count": 2,
+ "total_count": 3,
"url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
},
"livemode": false,
@@ -213,13 +263,13 @@
"webhooks_delivered_at": null
}
},
- "id": "evt_1OOgxvDEQaroqDjsoPIw8593",
+ "id": "evt_1OPIulDEQaroqDjsT7wP2kDF",
"livemode": false,
"object": "event",
"pending_webhooks": 2,
"request": {
"id": "req_NORMALIZED0003",
- "idempotency_key": "d04cdb80-859a-4b2c-bcfd-5f38aa5bf906"
+ "idempotency_key": "f5ed44e0-1f01-4516-a7e0-2bac952044bc"
},
"type": "invoice.paid"
},
@@ -269,18 +319,18 @@
"ending_balance": 0,
"footer": null,
"from_invoice": null,
- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRDdDV1F2QmFOWEpPbkdTQkRPZHJ3aHdmT0w4RE42LDkzNDQ3Mjc40200ujSWL3KE?s=ap",
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtQZ1Q3YmxXUnR1S0FITjFxMTQxQ1NLeGNFVW45LDkzNTkzMTU10200HQjFSW8u?s=ap",
"id": "in_NORMALIZED00000000000001",
- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRDdDV1F2QmFOWEpPbkdTQkRPZHJ3aHdmT0w4RE42LDkzNDQ3Mjc40200ujSWL3KE/pdf?s=ap",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtQZ1Q3YmxXUnR1S0FITjFxMTQxQ1NLeGNFVW45LDkzNTkzMTU10200HQjFSW8u/pdf?s=ap",
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
- "amount": 80000,
- "amount_excluding_tax": 80000,
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
"currency": "usd",
- "description": "Zulip Business",
+ "description": "Customer flat discount for 12 months",
"discount_amounts": [],
"discountable": false,
"discounts": [],
@@ -290,8 +340,8 @@
"metadata": {},
"object": "line_item",
"period": {
- "end": 1357095845,
- "start": 1325473445
+ "end": 1000000000,
+ "start": 1000000000
},
"plan": null,
"price": {
@@ -312,6 +362,56 @@
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
@@ -319,7 +419,7 @@
"proration_details": {
"credited_items": null
},
- "quantity": 10,
+ "quantity": 25,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
@@ -327,15 +427,15 @@
"unit_amount_excluding_tax": "8000"
},
{
- "amount": -80000,
- "amount_excluding_tax": -80000,
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
"currency": "usd",
"description": "Payment (Card ending in 4242)",
"discount_amounts": [],
"discountable": false,
"discounts": [],
- "id": "il_NORMALIZED00000000000002",
- "invoice_item": "ii_NORMALIZED00000000000002",
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
@@ -350,20 +450,20 @@
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
- "id": "price_NORMALIZED00000000000002",
+ "id": "price_NORMALIZED00000000000003",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
- "product": "prod_NORMALIZED0002",
+ "product": "prod_NORMALIZED0003",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
- "unit_amount": -80000,
- "unit_amount_decimal": "-80000"
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
},
"proration": false,
"proration_details": {
@@ -374,12 +474,12 @@
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
- "unit_amount_excluding_tax": "-80000"
+ "unit_amount_excluding_tax": "-176000"
}
],
"has_more": false,
"object": "list",
- "total_count": 2,
+ "total_count": 3,
"url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
},
"livemode": false,
@@ -436,13 +536,13 @@
"webhooks_delivered_at": null
}
},
- "id": "evt_1OOgxvDEQaroqDjsAGXOAvFg",
+ "id": "evt_1OPIulDEQaroqDjsg0HefwKP",
"livemode": false,
"object": "event",
"pending_webhooks": 0,
"request": {
"id": "req_NORMALIZED0003",
- "idempotency_key": "d04cdb80-859a-4b2c-bcfd-5f38aa5bf906"
+ "idempotency_key": "f5ed44e0-1f01-4516-a7e0-2bac952044bc"
},
"type": "invoice.finalized"
}
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.5.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.5.json
index 8c9bb73ac76..3696578a0e4 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.5.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Event.list.5.json
@@ -46,18 +46,18 @@
"ending_balance": 0,
"footer": null,
"from_invoice": null,
- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRDdDV1F2QmFOWEpPbkdTQkRPZHJ3aHdmT0w4RE42LDkzNDQ3Mjc50200pHhEI2SJ?s=ap",
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtQZ1Q3YmxXUnR1S0FITjFxMTQxQ1NLeGNFVW45LDkzNTkzMTU10200HQjFSW8u?s=ap",
"id": "in_NORMALIZED00000000000001",
- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRDdDV1F2QmFOWEpPbkdTQkRPZHJ3aHdmT0w4RE42LDkzNDQ3Mjc50200pHhEI2SJ/pdf?s=ap",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtQZ1Q3YmxXUnR1S0FITjFxMTQxQ1NLeGNFVW45LDkzNTkzMTU10200HQjFSW8u/pdf?s=ap",
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
- "amount": 80000,
- "amount_excluding_tax": 80000,
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
"currency": "usd",
- "description": "Zulip Business",
+ "description": "Customer flat discount for 12 months",
"discount_amounts": [],
"discountable": false,
"discounts": [],
@@ -67,8 +67,8 @@
"metadata": {},
"object": "line_item",
"period": {
- "end": 1357095845,
- "start": 1325473445
+ "end": 1000000000,
+ "start": 1000000000
},
"plan": null,
"price": {
@@ -89,6 +89,56 @@
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
@@ -96,7 +146,7 @@
"proration_details": {
"credited_items": null
},
- "quantity": 10,
+ "quantity": 25,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
@@ -104,15 +154,15 @@
"unit_amount_excluding_tax": "8000"
},
{
- "amount": -80000,
- "amount_excluding_tax": -80000,
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
"currency": "usd",
"description": "Payment (Card ending in 4242)",
"discount_amounts": [],
"discountable": false,
"discounts": [],
- "id": "il_NORMALIZED00000000000002",
- "invoice_item": "ii_NORMALIZED00000000000002",
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
@@ -127,20 +177,20 @@
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
- "id": "price_NORMALIZED00000000000002",
+ "id": "price_NORMALIZED00000000000003",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
- "product": "prod_NORMALIZED0002",
+ "product": "prod_NORMALIZED0003",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
- "unit_amount": -80000,
- "unit_amount_decimal": "-80000"
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
},
"proration": false,
"proration_details": {
@@ -151,12 +201,12 @@
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
- "unit_amount_excluding_tax": "-80000"
+ "unit_amount_excluding_tax": "-176000"
}
],
"has_more": false,
"object": "list",
- "total_count": 2,
+ "total_count": 3,
"url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
},
"livemode": false,
@@ -213,13 +263,13 @@
"webhooks_delivered_at": null
}
},
- "id": "evt_1OOgxvDEQaroqDjsdkp7VA2o",
+ "id": "evt_1OPIulDEQaroqDjsdJhvMX4P",
"livemode": false,
"object": "event",
"pending_webhooks": 0,
"request": {
"id": "req_NORMALIZED0003",
- "idempotency_key": "d04cdb80-859a-4b2c-bcfd-5f38aa5bf906"
+ "idempotency_key": "f5ed44e0-1f01-4516-a7e0-2bac952044bc"
},
"type": "invoice.payment_succeeded"
}
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Invoice.create.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Invoice.create.1.json
index dee6dd2852d..5d072c4ee58 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Invoice.create.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Invoice.create.1.json
@@ -48,10 +48,10 @@
"lines": {
"data": [
{
- "amount": 80000,
- "amount_excluding_tax": 80000,
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
"currency": "usd",
- "description": "Zulip Business",
+ "description": "Customer flat discount for 12 months",
"discount_amounts": [],
"discountable": false,
"discounts": [],
@@ -61,8 +61,8 @@
"metadata": {},
"object": "line_item",
"period": {
- "end": 1357095845,
- "start": 1325473445
+ "end": 1000000000,
+ "start": 1000000000
},
"plan": null,
"price": {
@@ -83,6 +83,56 @@
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
@@ -90,7 +140,7 @@
"proration_details": {
"credited_items": null
},
- "quantity": 10,
+ "quantity": 25,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
@@ -98,15 +148,15 @@
"unit_amount_excluding_tax": "8000"
},
{
- "amount": -80000,
- "amount_excluding_tax": -80000,
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
"currency": "usd",
"description": "Payment (Card ending in 4242)",
"discount_amounts": [],
"discountable": false,
"discounts": [],
- "id": "il_NORMALIZED00000000000002",
- "invoice_item": "ii_NORMALIZED00000000000002",
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
@@ -121,20 +171,20 @@
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
- "id": "price_NORMALIZED00000000000002",
+ "id": "price_NORMALIZED00000000000003",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
- "product": "prod_NORMALIZED0002",
+ "product": "prod_NORMALIZED0003",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
- "unit_amount": -80000,
- "unit_amount_decimal": "-80000"
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
},
"proration": false,
"proration_details": {
@@ -145,12 +195,12 @@
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
- "unit_amount_excluding_tax": "-80000"
+ "unit_amount_excluding_tax": "-176000"
}
],
"has_more": false,
"object": "list",
- "total_count": 2,
+ "total_count": 3,
"url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
},
"livemode": false,
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Invoice.finalize_invoice.1.json
index 2c146c2ff21..6774868ae22 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--Invoice.finalize_invoice.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--Invoice.finalize_invoice.1.json
@@ -40,18 +40,18 @@
"ending_balance": 0,
"footer": null,
"from_invoice": null,
- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRDdDV1F2QmFOWEpPbkdTQkRPZHJ3aHdmT0w4RE42LDkzNDQ3Mjc40200ujSWL3KE?s=ap",
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtQZ1Q3YmxXUnR1S0FITjFxMTQxQ1NLeGNFVW45LDkzNTkzMTU002006kKxgQ3P?s=ap",
"id": "in_NORMALIZED00000000000001",
- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRDdDV1F2QmFOWEpPbkdTQkRPZHJ3aHdmT0w4RE42LDkzNDQ3Mjc40200ujSWL3KE/pdf?s=ap",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtQZ1Q3YmxXUnR1S0FITjFxMTQxQ1NLeGNFVW45LDkzNTkzMTU002006kKxgQ3P/pdf?s=ap",
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"data": [
{
- "amount": 80000,
- "amount_excluding_tax": 80000,
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
"currency": "usd",
- "description": "Zulip Business",
+ "description": "Customer flat discount for 12 months",
"discount_amounts": [],
"discountable": false,
"discounts": [],
@@ -61,8 +61,8 @@
"metadata": {},
"object": "line_item",
"period": {
- "end": 1357095845,
- "start": 1325473445
+ "end": 1000000000,
+ "start": 1000000000
},
"plan": null,
"price": {
@@ -83,6 +83,56 @@
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
"unit_amount": 8000,
"unit_amount_decimal": "8000"
},
@@ -90,7 +140,7 @@
"proration_details": {
"credited_items": null
},
- "quantity": 10,
+ "quantity": 25,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
@@ -98,15 +148,15 @@
"unit_amount_excluding_tax": "8000"
},
{
- "amount": -80000,
- "amount_excluding_tax": -80000,
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
"currency": "usd",
"description": "Payment (Card ending in 4242)",
"discount_amounts": [],
"discountable": false,
"discounts": [],
- "id": "il_NORMALIZED00000000000002",
- "invoice_item": "ii_NORMALIZED00000000000002",
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
@@ -121,20 +171,20 @@
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
- "id": "price_NORMALIZED00000000000002",
+ "id": "price_NORMALIZED00000000000003",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
- "product": "prod_NORMALIZED0002",
+ "product": "prod_NORMALIZED0003",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
- "unit_amount": -80000,
- "unit_amount_decimal": "-80000"
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
},
"proration": false,
"proration_details": {
@@ -145,12 +195,12 @@
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
- "unit_amount_excluding_tax": "-80000"
+ "unit_amount_excluding_tax": "-176000"
}
],
"has_more": false,
"object": "list",
- "total_count": 2,
+ "total_count": 3,
"url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
},
"livemode": false,
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--InvoiceItem.create.1.json
index 76bc062d9c7..c351f1fdd5a 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--InvoiceItem.create.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--InvoiceItem.create.1.json
@@ -1,12 +1,12 @@
{
- "amount": -80000,
+ "amount": -176000,
"currency": "usd",
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"description": "Payment (Card ending in 4242)",
"discountable": false,
"discounts": [],
- "id": "ii_NORMALIZED00000000000002",
+ "id": "ii_NORMALIZED00000000000003",
"invoice": null,
"livemode": false,
"metadata": {},
@@ -22,26 +22,26 @@
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
- "id": "price_NORMALIZED00000000000002",
+ "id": "price_NORMALIZED00000000000003",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
- "product": "prod_NORMALIZED0002",
+ "product": "prod_NORMALIZED0003",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
- "unit_amount": -80000,
- "unit_amount_decimal": "-80000"
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
},
"proration": false,
"quantity": 1,
"subscription": null,
"tax_rates": [],
"test_clock": null,
- "unit_amount": -80000,
- "unit_amount_decimal": "-80000"
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
}
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--InvoiceItem.create.2.json
index ac377732152..f6b553cfa62 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--InvoiceItem.create.2.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--InvoiceItem.create.2.json
@@ -1,12 +1,12 @@
{
- "amount": 80000,
+ "amount": 200000,
"currency": "usd",
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"description": "Zulip Business",
"discountable": false,
"discounts": [],
- "id": "ii_NORMALIZED00000000000001",
+ "id": "ii_NORMALIZED00000000000002",
"invoice": null,
"livemode": false,
"metadata": {},
@@ -22,13 +22,13 @@
"created": 1000000000,
"currency": "usd",
"custom_unit_amount": null,
- "id": "price_NORMALIZED00000000000001",
+ "id": "price_NORMALIZED00000000000002",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
- "product": "prod_NORMALIZED0001",
+ "product": "prod_NORMALIZED0002",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
@@ -38,7 +38,7 @@
"unit_amount_decimal": "8000"
},
"proration": false,
- "quantity": 10,
+ "quantity": 25,
"subscription": null,
"tax_rates": [],
"test_clock": null,
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--InvoiceItem.create.3.json
new file mode 100644
index 00000000000..e23b26f397b
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--InvoiceItem.create.3.json
@@ -0,0 +1,47 @@
+{
+ "amount": -24000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Customer flat discount for 12 months",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+}
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--PaymentIntent.create.1.json
index 1b346aa07bf..797a278c886 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--PaymentIntent.create.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--PaymentIntent.create.1.json
@@ -1,10 +1,10 @@
{
- "amount": 80000,
+ "amount": 176000,
"amount_capturable": 0,
"amount_details": {
"tip": {}
},
- "amount_received": 80000,
+ "amount_received": 176000,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": null,
@@ -14,8 +14,8 @@
"charges": {
"data": [
{
- "amount": 80000,
- "amount_captured": 80000,
+ "amount": 176000,
+ "amount_captured": 176000,
"amount_refunded": 0,
"application": null,
"application_fee": null,
@@ -39,7 +39,7 @@
"created": 1000000000,
"currency": "usd",
"customer": "cus_NORMALIZED0001",
- "description": "Upgrade to Zulip Business, $80.0 x 10",
+ "description": "Upgrade to Zulip Business, $80.0 x 25 - $20.0 x 12",
"destination": null,
"dispute": null,
"disputed": false,
@@ -54,13 +54,13 @@
"billing_modality": "charge_automatically",
"billing_schedule": "1",
"license_management": "automatic",
- "licenses": "10",
- "plan_tier": "103",
+ "licenses": "25",
+ "plan_tier": "104",
"price_per_license": "8000",
- "remote_realm_host": "zulip.testserver",
- "remote_realm_user_email": "[email protected]",
- "remote_realm_user_id": "2",
- "seat_count": "10",
+ "remote_server_host": "demo.example.com",
+ "remote_server_user_email": "[email protected]",
+ "remote_server_user_id": "1",
+ "seat_count": "25",
"type": "upgrade"
},
"object": "charge",
@@ -76,10 +76,10 @@
},
"paid": true,
"payment_intent": "pi_NORMALIZED00000000000001",
- "payment_method": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "payment_method": "pm_1OPIudDEQaroqDjsC28eJ38G",
"payment_method_details": {
"card": {
- "amount_authorized": 80000,
+ "amount_authorized": 176000,
"brand": "visa",
"checks": {
"address_line1_check": null,
@@ -108,7 +108,7 @@
"used": false
},
"overcapture": {
- "maximum_amount_capturable": 80000,
+ "maximum_amount_capturable": 176000,
"status": "unavailable"
},
"three_d_secure": null,
@@ -116,9 +116,10 @@
},
"type": "card"
},
+ "radar_options": {},
"receipt_email": "[email protected]",
"receipt_number": null,
- "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKOyUgawGMgYxJ8fXEnE6LBY5f_v9NH3vOpVWDXZdxZV42LAme86u4U65P_BUkwTxZbdj-_fQ8X80AsJH",
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKMCIiqwGMgYrG-X16cI6LBYCR2Khw8ainqrMKAqE6ev6CnZbDd9fTa65tJzPhBJPxNVxr_Z1UEtzWub3",
"refunded": false,
"refunds": {
"data": [],
@@ -143,12 +144,12 @@
"total_count": 1,
"url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"
},
- "client_secret": "pi_NORMALIZED00000000000001_secret_eCDtZomR9THUUNBv25qmdV7ff",
+ "client_secret": "pi_NORMALIZED00000000000001_secret_qlDeEAQkvumd5xvwrwoW24sN8",
"confirmation_method": "automatic",
"created": 1000000000,
"currency": "usd",
"customer": "cus_NORMALIZED0001",
- "description": "Upgrade to Zulip Business, $80.0 x 10",
+ "description": "Upgrade to Zulip Business, $80.0 x 25 - $20.0 x 12",
"id": "pi_NORMALIZED00000000000001",
"invoice": null,
"last_payment_error": null,
@@ -158,19 +159,19 @@
"billing_modality": "charge_automatically",
"billing_schedule": "1",
"license_management": "automatic",
- "licenses": "10",
- "plan_tier": "103",
+ "licenses": "25",
+ "plan_tier": "104",
"price_per_license": "8000",
- "remote_realm_host": "zulip.testserver",
- "remote_realm_user_email": "[email protected]",
- "remote_realm_user_id": "2",
- "seat_count": "10",
+ "remote_server_host": "demo.example.com",
+ "remote_server_user_email": "[email protected]",
+ "remote_server_user_id": "1",
+ "seat_count": "25",
"type": "upgrade"
},
"next_action": null,
"object": "payment_intent",
"on_behalf_of": null,
- "payment_method": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "payment_method": "pm_1OPIudDEQaroqDjsC28eJ38G",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--SetupIntent.create.1.json
index 07472c7cde9..cac481c8601 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--SetupIntent.create.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--SetupIntent.create.1.json
@@ -2,21 +2,21 @@
"application": null,
"automatic_payment_methods": null,
"cancellation_reason": null,
- "client_secret": "seti_1OOgxnDEQaroqDjsi7FO3jFP_secret_PD7CyXbHPI3difL0bMs0mVjfeIpe0EK",
+ "client_secret": "seti_1OPIudDEQaroqDjsLOkuBXvM_secret_PDkPRHXBZXwIMOpEzViywm7pZOmYi54",
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
"description": null,
"flow_directions": null,
- "id": "seti_1OOgxnDEQaroqDjsi7FO3jFP",
+ "id": "seti_1OPIudDEQaroqDjsLOkuBXvM",
"last_setup_error": null,
- "latest_attempt": "setatt_1OOgxnDEQaroqDjsV0aPfyRE",
+ "latest_attempt": "setatt_1OPIudDEQaroqDjsiw4u8241",
"livemode": false,
"mandate": null,
"metadata": {},
"next_action": null,
"object": "setup_intent",
"on_behalf_of": null,
- "payment_method": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "payment_method": "pm_1OPIudDEQaroqDjsC28eJ38G",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--SetupIntent.list.1.json
index 85762d7b116..86512779df6 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--SetupIntent.list.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--SetupIntent.list.1.json
@@ -4,12 +4,12 @@
"application": null,
"automatic_payment_methods": null,
"cancellation_reason": null,
- "client_secret": "seti_1OOgxmDEQaroqDjs5K0moUnP_secret_PD7COmAJk8EAvINs5zd0uVCgoJoh6DP",
+ "client_secret": "seti_1OPIucDEQaroqDjsqGJPEzZx_secret_PDkPgrwAF7E0Ur9VQQVkoRZDyb1i1z0",
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
"description": null,
"flow_directions": null,
- "id": "seti_1OOgxmDEQaroqDjs5K0moUnP",
+ "id": "seti_1OPIucDEQaroqDjsqGJPEzZx",
"last_setup_error": null,
"latest_attempt": null,
"livemode": false,
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--SetupIntent.retrieve.1.json
index 07472c7cde9..cac481c8601 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--SetupIntent.retrieve.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--SetupIntent.retrieve.1.json
@@ -2,21 +2,21 @@
"application": null,
"automatic_payment_methods": null,
"cancellation_reason": null,
- "client_secret": "seti_1OOgxnDEQaroqDjsi7FO3jFP_secret_PD7CyXbHPI3difL0bMs0mVjfeIpe0EK",
+ "client_secret": "seti_1OPIudDEQaroqDjsLOkuBXvM_secret_PDkPRHXBZXwIMOpEzViywm7pZOmYi54",
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
"description": null,
"flow_directions": null,
- "id": "seti_1OOgxnDEQaroqDjsi7FO3jFP",
+ "id": "seti_1OPIudDEQaroqDjsLOkuBXvM",
"last_setup_error": null,
- "latest_attempt": "setatt_1OOgxnDEQaroqDjsV0aPfyRE",
+ "latest_attempt": "setatt_1OPIudDEQaroqDjsiw4u8241",
"livemode": false,
"mandate": null,
"metadata": {},
"next_action": null,
"object": "setup_intent",
"on_behalf_of": null,
- "payment_method": "pm_1OOgxnDEQaroqDjsVKBHx8El",
+ "payment_method": "pm_1OPIudDEQaroqDjsC28eJ38G",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--checkout.Session.create.1.json
index 952a0d9ad2b..a2510cf57ed 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--checkout.Session.create.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--checkout.Session.create.1.json
@@ -8,7 +8,7 @@
"status": null
},
"billing_address_collection": null,
- "cancel_url": "http://selfhosting.testserver/realm/b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43/upgrade/?manual_license_management=false&tier=1",
+ "cancel_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/upgrade/?manual_license_management=false&tier=1",
"client_reference_id": null,
"client_secret": null,
"consent": null,
@@ -35,13 +35,13 @@
},
"customer_email": null,
"expires_at": 1000000000,
- "id": "cs_test_NORMALIZED02ASCJWVwKKpPzmPcoJSfXMfWdD5pNYIJGn2icFi5Cd3Rync",
+ "id": "cs_test_NORMALIZED02Xfig0qpqukBZRI6L6cCZqOWDTZ1FXGp4CVDpscVkhPPokd",
"invoice": null,
"invoice_creation": null,
"livemode": false,
"locale": null,
"metadata": {
- "remote_realm_user_id": "2",
+ "remote_server_user_id": "1",
"type": "card_update"
},
"mode": "setup",
@@ -59,7 +59,7 @@
"enabled": false
},
"recovered_from": null,
- "setup_intent": "seti_1OOgxmDEQaroqDjs5K0moUnP",
+ "setup_intent": "seti_1OPIucDEQaroqDjsqGJPEzZx",
"shipping": null,
"shipping_address_collection": null,
"shipping_options": [],
@@ -67,8 +67,8 @@
"status": "open",
"submit_type": null,
"subscription": null,
- "success_url": "http://selfhosting.testserver/realm/b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "success_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
"total_details": null,
"ui_mode": "hosted",
- "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED02ASCJWVwKKpPzmPcoJSfXMfWdD5pNYIJGn2icFi5Cd3Rync#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED02Xfig0qpqukBZRI6L6cCZqOWDTZ1FXGp4CVDpscVkhPPokd#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
}
diff --git a/corporate/tests/stripe_fixtures/non_sponsorship_billing--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/non_sponsorship_billing--checkout.Session.list.1.json
index c27d5b40f95..0fbad52a651 100644
--- a/corporate/tests/stripe_fixtures/non_sponsorship_billing--checkout.Session.list.1.json
+++ b/corporate/tests/stripe_fixtures/non_sponsorship_billing--checkout.Session.list.1.json
@@ -10,7 +10,7 @@
"status": null
},
"billing_address_collection": null,
- "cancel_url": "http://selfhosting.testserver/realm/b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43/upgrade/?manual_license_management=false&tier=1",
+ "cancel_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/upgrade/?manual_license_management=false&tier=1",
"client_reference_id": null,
"client_secret": null,
"consent": null,
@@ -37,13 +37,13 @@
},
"customer_email": null,
"expires_at": 1000000000,
- "id": "cs_test_NORMALIZED02ASCJWVwKKpPzmPcoJSfXMfWdD5pNYIJGn2icFi5Cd3Rync",
+ "id": "cs_test_NORMALIZED02Xfig0qpqukBZRI6L6cCZqOWDTZ1FXGp4CVDpscVkhPPokd",
"invoice": null,
"invoice_creation": null,
"livemode": false,
"locale": null,
"metadata": {
- "remote_realm_user_id": "2",
+ "remote_server_user_id": "1",
"type": "card_update"
},
"mode": "setup",
@@ -61,7 +61,7 @@
"enabled": false
},
"recovered_from": null,
- "setup_intent": "seti_1OOgxmDEQaroqDjs5K0moUnP",
+ "setup_intent": "seti_1OPIucDEQaroqDjsqGJPEzZx",
"shipping": null,
"shipping_address_collection": null,
"shipping_options": [],
@@ -69,10 +69,10 @@
"status": "open",
"submit_type": null,
"subscription": null,
- "success_url": "http://selfhosting.testserver/realm/b46d7a23-a8ef-4fe3-9650-b7b85e2a9b43/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "success_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
"total_details": null,
"ui_mode": "hosted",
- "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED02ASCJWVwKKpPzmPcoJSfXMfWdD5pNYIJGn2icFi5Cd3Rync#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED02Xfig0qpqukBZRI6L6cCZqOWDTZ1FXGp4CVDpscVkhPPokd#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
}
],
"has_more": true,
diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.modify.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.modify.1.json
index 8eb8ed75216..937476bea29 100644
--- a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.modify.1.json
+++ b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.modify.1.json
@@ -13,7 +13,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
- "default_payment_method": "pm_1OOxuEDEQaroqDjsiM1weVRN",
+ "default_payment_method": "pm_1OPIusDEQaroqDjsUXyj1OSk",
"footer": null,
"rendering_options": null
},
diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.1.json
index 627cebb8792..1b2fa2b4e54 100644
--- a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.1.json
+++ b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.1.json
@@ -54,7 +54,7 @@
},
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
- "id": "pm_1OOxuEDEQaroqDjsiM1weVRN",
+ "id": "pm_1OPIusDEQaroqDjsUXyj1OSk",
"livemode": false,
"metadata": {},
"object": "payment_method",
diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.2.json
index 627cebb8792..1b2fa2b4e54 100644
--- a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.2.json
+++ b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.2.json
@@ -54,7 +54,7 @@
},
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
- "id": "pm_1OOxuEDEQaroqDjsiM1weVRN",
+ "id": "pm_1OPIusDEQaroqDjsUXyj1OSk",
"livemode": false,
"metadata": {},
"object": "payment_method",
diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.3.json
index 627cebb8792..1b2fa2b4e54 100644
--- a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.3.json
+++ b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.3.json
@@ -54,7 +54,7 @@
},
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
- "id": "pm_1OOxuEDEQaroqDjsiM1weVRN",
+ "id": "pm_1OPIusDEQaroqDjsUXyj1OSk",
"livemode": false,
"metadata": {},
"object": "payment_method",
diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.4.json
index 627cebb8792..1b2fa2b4e54 100644
--- a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.4.json
+++ b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.4.json
@@ -54,7 +54,7 @@
},
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
- "id": "pm_1OOxuEDEQaroqDjsiM1weVRN",
+ "id": "pm_1OPIusDEQaroqDjsUXyj1OSk",
"livemode": false,
"metadata": {},
"object": "payment_method",
diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.5.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.5.json
index 627cebb8792..1b2fa2b4e54 100644
--- a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.5.json
+++ b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.5.json
@@ -54,7 +54,7 @@
},
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
- "id": "pm_1OOxuEDEQaroqDjsiM1weVRN",
+ "id": "pm_1OPIusDEQaroqDjsUXyj1OSk",
"livemode": false,
"metadata": {},
"object": "payment_method",
diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.6.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.6.json
index 627cebb8792..1b2fa2b4e54 100644
--- a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.6.json
+++ b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.6.json
@@ -54,7 +54,7 @@
},
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
- "id": "pm_1OOxuEDEQaroqDjsiM1weVRN",
+ "id": "pm_1OPIusDEQaroqDjsUXyj1OSk",
"livemode": false,
"metadata": {},
"object": "payment_method",
diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.create.1.json
index c00c853dd81..ee193c85086 100644
--- a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.create.1.json
+++ b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.create.1.json
@@ -2,21 +2,21 @@
"application": null,
"automatic_payment_methods": null,
"cancellation_reason": null,
- "client_secret": "seti_1OOxuEDEQaroqDjsaNjxVE5k_secret_PDOhQTS9UrXmI0rDzcSybLFWhAkSdEs",
+ "client_secret": "seti_1OPIusDEQaroqDjsv7q8GGCp_secret_PDkPxGoypMtKwC2b4c8d6KJ1WShNKcJ",
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
"description": null,
"flow_directions": null,
- "id": "seti_1OOxuEDEQaroqDjsaNjxVE5k",
+ "id": "seti_1OPIusDEQaroqDjsv7q8GGCp",
"last_setup_error": null,
- "latest_attempt": "setatt_1OOxuEDEQaroqDjsRh4dnzh2",
+ "latest_attempt": "setatt_1OPIusDEQaroqDjs05EcpJDl",
"livemode": false,
"mandate": null,
"metadata": {},
"next_action": null,
"object": "setup_intent",
"on_behalf_of": null,
- "payment_method": "pm_1OOxuEDEQaroqDjsiM1weVRN",
+ "payment_method": "pm_1OPIusDEQaroqDjsUXyj1OSk",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.list.1.json
index 07261c6f3a0..0e8cdc74dce 100644
--- a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.list.1.json
+++ b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.list.1.json
@@ -4,12 +4,12 @@
"application": null,
"automatic_payment_methods": null,
"cancellation_reason": null,
- "client_secret": "seti_1OOxuDDEQaroqDjs0GCV0FMz_secret_PDOhYgMKe0e07H7AXifPFX8xAMCNSgT",
+ "client_secret": "seti_1OPIurDEQaroqDjsxCM7inLD_secret_PDkPoQt9PtPOjoZ442M6EMJ9n2girUe",
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
"description": null,
"flow_directions": null,
- "id": "seti_1OOxuDDEQaroqDjs0GCV0FMz",
+ "id": "seti_1OPIurDEQaroqDjsxCM7inLD",
"last_setup_error": null,
"latest_attempt": null,
"livemode": false,
diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.retrieve.1.json
index c00c853dd81..ee193c85086 100644
--- a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.retrieve.1.json
+++ b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.retrieve.1.json
@@ -2,21 +2,21 @@
"application": null,
"automatic_payment_methods": null,
"cancellation_reason": null,
- "client_secret": "seti_1OOxuEDEQaroqDjsaNjxVE5k_secret_PDOhQTS9UrXmI0rDzcSybLFWhAkSdEs",
+ "client_secret": "seti_1OPIusDEQaroqDjsv7q8GGCp_secret_PDkPxGoypMtKwC2b4c8d6KJ1WShNKcJ",
"created": 1000000000,
"customer": "cus_NORMALIZED0001",
"description": null,
"flow_directions": null,
- "id": "seti_1OOxuEDEQaroqDjsaNjxVE5k",
+ "id": "seti_1OPIusDEQaroqDjsv7q8GGCp",
"last_setup_error": null,
- "latest_attempt": "setatt_1OOxuEDEQaroqDjsRh4dnzh2",
+ "latest_attempt": "setatt_1OPIusDEQaroqDjs05EcpJDl",
"livemode": false,
"mandate": null,
"metadata": {},
"next_action": null,
"object": "setup_intent",
"on_behalf_of": null,
- "payment_method": "pm_1OOxuEDEQaroqDjsiM1weVRN",
+ "payment_method": "pm_1OPIusDEQaroqDjsUXyj1OSk",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--checkout.Session.create.1.json
index f151a7d554b..3ade166d1a0 100644
--- a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--checkout.Session.create.1.json
+++ b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--checkout.Session.create.1.json
@@ -35,13 +35,13 @@
},
"customer_email": null,
"expires_at": 1000000000,
- "id": "cs_test_NORMALIZED01ipLasegPD8WTJGg8RcngQyOSZ17ANCEalfCK5L2lkZXaA8",
+ "id": "cs_test_NORMALIZED01C7ASuXI6dDsPgZcEW6COwPewf8W1hO8hHYsKh7SRJhjtaT",
"invoice": null,
"invoice_creation": null,
"livemode": false,
"locale": null,
"metadata": {
- "remote_server_user_id": "1",
+ "remote_server_user_id": "3",
"type": "card_update"
},
"mode": "setup",
@@ -59,7 +59,7 @@
"enabled": false
},
"recovered_from": null,
- "setup_intent": "seti_1OOxuDDEQaroqDjs0GCV0FMz",
+ "setup_intent": "seti_1OPIurDEQaroqDjsxCM7inLD",
"shipping": null,
"shipping_address_collection": null,
"shipping_options": [],
@@ -70,5 +70,5 @@
"success_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
"total_details": null,
"ui_mode": "hosted",
- "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED01ipLasegPD8WTJGg8RcngQyOSZ17ANCEalfCK5L2lkZXaA8#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED01C7ASuXI6dDsPgZcEW6COwPewf8W1hO8hHYsKh7SRJhjtaT#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
}
diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--checkout.Session.list.1.json
index 8bc8cb038e6..b9a56f54706 100644
--- a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--checkout.Session.list.1.json
+++ b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--checkout.Session.list.1.json
@@ -37,13 +37,13 @@
},
"customer_email": null,
"expires_at": 1000000000,
- "id": "cs_test_NORMALIZED01ipLasegPD8WTJGg8RcngQyOSZ17ANCEalfCK5L2lkZXaA8",
+ "id": "cs_test_NORMALIZED01C7ASuXI6dDsPgZcEW6COwPewf8W1hO8hHYsKh7SRJhjtaT",
"invoice": null,
"invoice_creation": null,
"livemode": false,
"locale": null,
"metadata": {
- "remote_server_user_id": "1",
+ "remote_server_user_id": "3",
"type": "card_update"
},
"mode": "setup",
@@ -61,7 +61,7 @@
"enabled": false
},
"recovered_from": null,
- "setup_intent": "seti_1OOxuDDEQaroqDjs0GCV0FMz",
+ "setup_intent": "seti_1OPIurDEQaroqDjsxCM7inLD",
"shipping": null,
"shipping_address_collection": null,
"shipping_options": [],
@@ -72,7 +72,7 @@
"success_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
"total_details": null,
"ui_mode": "hosted",
- "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED01ipLasegPD8WTJGg8RcngQyOSZ17ANCEalfCK5L2lkZXaA8#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED01C7ASuXI6dDsPgZcEW6COwPewf8W1hO8hHYsKh7SRJhjtaT#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
}
],
"has_more": true,
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.create.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.create.1.json
new file mode 100644
index 00000000000..a5a64c5447c
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.create.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": null,
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.modify.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.modify.1.json
new file mode 100644
index 00000000000..768598b5136
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.modify.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.1.json
new file mode 100644
index 00000000000..2deed286cd0
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.1.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.2.json
new file mode 100644
index 00000000000..2deed286cd0
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.2.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.3.json
new file mode 100644
index 00000000000..2deed286cd0
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.3.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.4.json
new file mode 100644
index 00000000000..2deed286cd0
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.4.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.5.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.5.json
new file mode 100644
index 00000000000..daa0843dc24
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.5.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 2,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.6.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.6.json
new file mode 100644
index 00000000000..daa0843dc24
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Customer.retrieve.6.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 2,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.1.json
new file mode 100644
index 00000000000..50f0bb123ab
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.1.json
@@ -0,0 +1,60 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "invoice_settings": {
+ "default_payment_method": null
+ }
+ }
+ },
+ "id": "evt_1OPIxbDEQaroqDjs0UTQaQZr",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0001",
+ "idempotency_key": "890f6ec5-faec-447b-be6d-e831284d061c"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.2.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.2.json
new file mode 100644
index 00000000000..7610e06a816
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.2.json
@@ -0,0 +1,360 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 176000,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 176000,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [
+ {
+ "amount": 176000,
+ "amount_captured": 176000,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_NORMALIZED00000000000001",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BUSINESS",
+ "captured": true,
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Upgrade to Zulip Business, $80.0 x 25 - $20.0 x 12",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "1",
+ "license_management": "automatic",
+ "licenses": "25",
+ "plan_tier": "104",
+ "price_per_license": "8000",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "2",
+ "seat_count": "25",
+ "type": "upgrade"
+ },
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 0,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "payment_method": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 176000,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 176000,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKPaJiqwGMgZVHckUlOc6LBY__nDgL3TjwrWrruIBkt-nCCD2wbJAQtNvHAfNXZgnKHzR66tw7MiyR59W",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Business",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"
+ },
+ "client_secret": "pi_NORMALIZED00000000000001_secret_VVgYFth270SLjGOI6cJS19Ilx",
+ "confirmation_method": "automatic",
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Upgrade to Zulip Business, $80.0 x 25 - $20.0 x 12",
+ "id": "pi_NORMALIZED00000000000001",
+ "invoice": null,
+ "last_payment_error": null,
+ "latest_charge": "ch_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "1",
+ "license_management": "automatic",
+ "licenses": "25",
+ "plan_tier": "104",
+ "price_per_license": "8000",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "2",
+ "seat_count": "25",
+ "type": "upgrade"
+ },
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Business",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OPIxdDEQaroqDjs1YbopnC2",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 2,
+ "request": {
+ "id": "req_NORMALIZED0002",
+ "idempotency_key": "96e48ff6-1376-4bce-9983-d81acf958de5"
+ },
+ "type": "payment_intent.succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 176000,
+ "amount_captured": 176000,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_NORMALIZED00000000000001",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BUSINESS",
+ "captured": true,
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Upgrade to Zulip Business, $80.0 x 25 - $20.0 x 12",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "1",
+ "license_management": "automatic",
+ "licenses": "25",
+ "plan_tier": "104",
+ "price_per_license": "8000",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "2",
+ "seat_count": "25",
+ "type": "upgrade"
+ },
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 0,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "payment_method": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 176000,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 176000,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKPaJiqwGMgYY2tR8Fb46LBYxpugUG9sF-Sd5Pk-fG7obOkc9Ovo6HH6f0rL3ts3GMu7dZwujc-twyTAQ",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Business",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OPIxdDEQaroqDjs1PKXevmN",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0002",
+ "idempotency_key": "96e48ff6-1376-4bce-9983-d81acf958de5"
+ },
+ "type": "charge.succeeded"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.3.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.3.json
new file mode 100644
index 00000000000..512968a3df2
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.3.json
@@ -0,0 +1,812 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTdTJBbXFCbHFUS211NDZiZ1dpVUlmTFB4dmp3LDkzNTkzMzM30200zfHp0tuy?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTdTJBbXFCbHFUS211NDZiZ1dpVUlmTFB4dmp3LDkzNTkzMzM30200zfHp0tuy/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
+ "currency": "usd",
+ "description": "Customer flat discount for 12 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 8000,
+ "unit_amount_decimal": "8000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 25,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "8000"
+ },
+ {
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-176000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "NORMALI-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Business",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ },
+ "previous_attributes": {
+ "attempted": false,
+ "auto_advance": true,
+ "effective_at": null,
+ "ending_balance": null,
+ "hosted_invoice_url": null,
+ "invoice_pdf": null,
+ "next_payment_attempt": 1000000000,
+ "number": null,
+ "paid": false,
+ "rendering": {
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "paid_at": null
+ }
+ }
+ },
+ "id": "evt_1OPIxhDEQaroqDjsYMMjTTQ5",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 2,
+ "request": {
+ "id": "req_NORMALIZED0003",
+ "idempotency_key": "d650392e-acd3-46c9-8be3-21b6d7ff4f37"
+ },
+ "type": "invoice.updated"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": null,
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
+ "currency": "usd",
+ "description": "Customer flat discount for 12 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 8000,
+ "unit_amount_decimal": "8000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 25,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "8000"
+ },
+ {
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-176000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1000000000,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Business",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OPIxgDEQaroqDjsBctPCwfX",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0004",
+ "idempotency_key": "3262b82d-59f2-421a-b816-8310784f5da8"
+ },
+ "type": "invoice.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": -24000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Customer flat discount for 12 months",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ }
+ },
+ "id": "evt_1OPIxfDEQaroqDjsSU97Ai7L",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0005",
+ "idempotency_key": "2f8fbcd7-8dc3-46a3-a73d-d9c6f081b513"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 200000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Zulip Business",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000002",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 8000,
+ "unit_amount_decimal": "8000"
+ },
+ "proration": false,
+ "quantity": 25,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 8000,
+ "unit_amount_decimal": "8000"
+ }
+ },
+ "id": "evt_1OPIxfDEQaroqDjsJeV7n5M5",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0006",
+ "idempotency_key": "a5d6ce4d-6671-4be0-b4bc-3de070415612"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": -176000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Payment (Card ending in 4242)",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000003",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
+ }
+ },
+ "id": "evt_1OPIxfDEQaroqDjswmlmGD4p",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0007",
+ "idempotency_key": "664fa1ff-59c6-49fd-8e1a-691f91e7cc75"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "currency": null,
+ "default_currency": null
+ }
+ },
+ "id": "evt_1OPIxfDEQaroqDjsnWLFp1sD",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0007",
+ "idempotency_key": "664fa1ff-59c6-49fd-8e1a-691f91e7cc75"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.4.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.4.json
new file mode 100644
index 00000000000..a509e3f7195
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.4.json
@@ -0,0 +1,553 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTdTJBbXFCbHFUS211NDZiZ1dpVUlmTFB4dmp3LDkzNTkzMzM30200zfHp0tuy?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTdTJBbXFCbHFUS211NDZiZ1dpVUlmTFB4dmp3LDkzNTkzMzM30200zfHp0tuy/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
+ "currency": "usd",
+ "description": "Customer flat discount for 12 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 8000,
+ "unit_amount_decimal": "8000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 25,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "8000"
+ },
+ {
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-176000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "NORMALI-0002",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Business",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OPIxhDEQaroqDjsLVQDUNJ5",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 2,
+ "request": {
+ "id": "req_NORMALIZED0003",
+ "idempotency_key": "d650392e-acd3-46c9-8be3-21b6d7ff4f37"
+ },
+ "type": "invoice.paid"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTdTJBbXFCbHFUS211NDZiZ1dpVUlmTFB4dmp3LDkzNTkzMzM30200zfHp0tuy?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTdTJBbXFCbHFUS211NDZiZ1dpVUlmTFB4dmp3LDkzNTkzMzM30200zfHp0tuy/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
+ "currency": "usd",
+ "description": "Customer flat discount for 12 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 8000,
+ "unit_amount_decimal": "8000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 25,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "8000"
+ },
+ {
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-176000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "NORMALI-0002",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Business",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OPIxhDEQaroqDjs7ZW0pPFd",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0003",
+ "idempotency_key": "d650392e-acd3-46c9-8be3-21b6d7ff4f37"
+ },
+ "type": "invoice.finalized"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.5.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.5.json
new file mode 100644
index 00000000000..abd0df7af8c
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.5.json
@@ -0,0 +1,280 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTdTJBbXFCbHFUS211NDZiZ1dpVUlmTFB4dmp3LDkzNTkzMzM30200zfHp0tuy?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTdTJBbXFCbHFUS211NDZiZ1dpVUlmTFB4dmp3LDkzNTkzMzM30200zfHp0tuy/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
+ "currency": "usd",
+ "description": "Customer flat discount for 12 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 8000,
+ "unit_amount_decimal": "8000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 25,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "8000"
+ },
+ {
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-176000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "NORMALI-0002",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Business",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OPIxhDEQaroqDjsN5DFbwyW",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0003",
+ "idempotency_key": "d650392e-acd3-46c9-8be3-21b6d7ff4f37"
+ },
+ "type": "invoice.payment_succeeded"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.6.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.6.json
new file mode 100644
index 00000000000..6d922067afe
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Event.list.6.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Invoice.create.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Invoice.create.1.json
new file mode 100644
index 00000000000..5d072c4ee58
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Invoice.create.1.json
@@ -0,0 +1,258 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": null,
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
+ "currency": "usd",
+ "description": "Customer flat discount for 12 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 8000,
+ "unit_amount_decimal": "8000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 25,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "8000"
+ },
+ {
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-176000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1000000000,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Business",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Invoice.finalize_invoice.1.json
new file mode 100644
index 00000000000..84b5302fda3
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Invoice.finalize_invoice.1.json
@@ -0,0 +1,258 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTdTJBbXFCbHFUS211NDZiZ1dpVUlmTFB4dmp3LDkzNTkzMzM20200cqeHqny5?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTdTJBbXFCbHFUS211NDZiZ1dpVUlmTFB4dmp3LDkzNTkzMzM20200cqeHqny5/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -24000,
+ "amount_excluding_tax": -24000,
+ "currency": "usd",
+ "description": "Customer flat discount for 12 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-24000"
+ },
+ {
+ "amount": 200000,
+ "amount_excluding_tax": 200000,
+ "currency": "usd",
+ "description": "Zulip Business",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 8000,
+ "unit_amount_decimal": "8000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 25,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "8000"
+ },
+ {
+ "amount": -176000,
+ "amount_excluding_tax": -176000,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-176000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "NORMALI-0002",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Business",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Invoice.list.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Invoice.list.1.json
new file mode 100644
index 00000000000..e39960ab725
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--Invoice.list.1.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/invoices"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--InvoiceItem.create.1.json
new file mode 100644
index 00000000000..c351f1fdd5a
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--InvoiceItem.create.1.json
@@ -0,0 +1,47 @@
+{
+ "amount": -176000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Payment (Card ending in 4242)",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000003",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -176000,
+ "unit_amount_decimal": "-176000"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--InvoiceItem.create.2.json
new file mode 100644
index 00000000000..f6b553cfa62
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--InvoiceItem.create.2.json
@@ -0,0 +1,47 @@
+{
+ "amount": 200000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Zulip Business",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000002",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 8000,
+ "unit_amount_decimal": "8000"
+ },
+ "proration": false,
+ "quantity": 25,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 8000,
+ "unit_amount_decimal": "8000"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--InvoiceItem.create.3.json
new file mode 100644
index 00000000000..e23b26f397b
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--InvoiceItem.create.3.json
@@ -0,0 +1,47 @@
+{
+ "amount": -24000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Customer flat discount for 12 months",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -24000,
+ "unit_amount_decimal": "-24000"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--PaymentIntent.create.1.json
new file mode 100644
index 00000000000..5b6cc460857
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--PaymentIntent.create.1.json
@@ -0,0 +1,198 @@
+{
+ "amount": 176000,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 176000,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [
+ {
+ "amount": 176000,
+ "amount_captured": 176000,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_NORMALIZED00000000000001",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BUSINESS",
+ "captured": true,
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Upgrade to Zulip Business, $80.0 x 25 - $20.0 x 12",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "1",
+ "license_management": "automatic",
+ "licenses": "25",
+ "plan_tier": "104",
+ "price_per_license": "8000",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "2",
+ "seat_count": "25",
+ "type": "upgrade"
+ },
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 0,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "payment_method": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 176000,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 176000,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKPaJiqwGMgYZg-2IVis6LBajyFeaokL44yVzbriyJxC7wEsETr8XI68Ipe42WdUMlFg87fW7qFQJ2sDi",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Business",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"
+ },
+ "client_secret": "pi_NORMALIZED00000000000001_secret_VVgYFth270SLjGOI6cJS19Ilx",
+ "confirmation_method": "automatic",
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Upgrade to Zulip Business, $80.0 x 25 - $20.0 x 12",
+ "id": "pi_NORMALIZED00000000000001",
+ "invoice": null,
+ "last_payment_error": null,
+ "latest_charge": "ch_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "1",
+ "license_management": "automatic",
+ "licenses": "25",
+ "plan_tier": "104",
+ "price_per_license": "8000",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "2",
+ "seat_count": "25",
+ "type": "upgrade"
+ },
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Business",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--SetupIntent.create.1.json
new file mode 100644
index 00000000000..a67bd95a005
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--SetupIntent.create.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OPIxZDEQaroqDjsJyO0Urcv_secret_PDkSJDPGVzdWZXigegmR0gJvM7nciDL",
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OPIxZDEQaroqDjsJyO0Urcv",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1OPIxZDEQaroqDjsVGVVrItU",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "succeeded",
+ "usage": "off_session"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--SetupIntent.list.1.json
new file mode 100644
index 00000000000..5933eba6edf
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--SetupIntent.list.1.json
@@ -0,0 +1,41 @@
+{
+ "data": [
+ {
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OPIxYDEQaroqDjsuX8oXqC0_secret_PDkSgoT60X4osk6q8LzdNLiatNLh8hN",
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OPIxYDEQaroqDjsuX8oXqC0",
+ "last_setup_error": null,
+ "latest_attempt": null,
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": null,
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "requires_payment_method",
+ "usage": "off_session"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/setup_intents"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--SetupIntent.retrieve.1.json
new file mode 100644
index 00000000000..a67bd95a005
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--SetupIntent.retrieve.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OPIxZDEQaroqDjsJyO0Urcv_secret_PDkSJDPGVzdWZXigegmR0gJvM7nciDL",
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OPIxZDEQaroqDjsJyO0Urcv",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1OPIxZDEQaroqDjsVGVVrItU",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OPIxZDEQaroqDjsyio2YXF5",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "succeeded",
+ "usage": "off_session"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--checkout.Session.create.1.json
new file mode 100644
index 00000000000..22f3d590e95
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--checkout.Session.create.1.json
@@ -0,0 +1,74 @@
+{
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_address_collection": null,
+ "cancel_url": "http://selfhosting.testserver/realm/bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 1000000000,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_NORMALIZED0001",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "email": "[email protected]",
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "expires_at": 1000000000,
+ "id": "cs_test_NORMALIZED028rdW2h5lfmpBWDmvkGn6UC8jY2yQtvZahKAfQMrt89Q2KP",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "remote_realm_user_id": "2",
+ "type": "card_update"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {},
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "setup_intent": "seti_1OPIxYDEQaroqDjsuX8oXqC0",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/realm/bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED028rdW2h5lfmpBWDmvkGn6UC8jY2yQtvZahKAfQMrt89Q2KP#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--checkout.Session.list.1.json
new file mode 100644
index 00000000000..3f8069fcfb3
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_business_plan--checkout.Session.list.1.json
@@ -0,0 +1,81 @@
+{
+ "data": [
+ {
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_address_collection": null,
+ "cancel_url": "http://selfhosting.testserver/realm/bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 1000000000,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_NORMALIZED0001",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "email": "[email protected]",
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "expires_at": 1000000000,
+ "id": "cs_test_NORMALIZED028rdW2h5lfmpBWDmvkGn6UC8jY2yQtvZahKAfQMrt89Q2KP",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "remote_realm_user_id": "2",
+ "type": "card_update"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {},
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "setup_intent": "seti_1OPIxYDEQaroqDjsuX8oXqC0",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/realm/bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED028rdW2h5lfmpBWDmvkGn6UC8jY2yQtvZahKAfQMrt89Q2KP#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/checkout/sessions"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.create.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.create.1.json
new file mode 100644
index 00000000000..a5a64c5447c
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.create.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": null,
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.modify.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.modify.1.json
new file mode 100644
index 00000000000..b2ee3ebb2a3
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.modify.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.1.json
new file mode 100644
index 00000000000..4396554c441
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.1.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.2.json
new file mode 100644
index 00000000000..4396554c441
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.2.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.3.json
new file mode 100644
index 00000000000..4396554c441
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.3.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.4.json
new file mode 100644
index 00000000000..4396554c441
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.4.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.5.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.5.json
new file mode 100644
index 00000000000..b4d2618befd
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.5.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 2,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.6.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.6.json
new file mode 100644
index 00000000000..b4d2618befd
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Customer.retrieve.6.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 2,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.1.json
new file mode 100644
index 00000000000..bc0bb766df3
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.1.json
@@ -0,0 +1,60 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "invoice_settings": {
+ "default_payment_method": null
+ }
+ }
+ },
+ "id": "evt_1OPIxqDEQaroqDjs9lsLkhIi",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0001",
+ "idempotency_key": "a55c1d82-def1-474c-9bfe-9dfdef33d07e"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.2.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.2.json
new file mode 100644
index 00000000000..7e5d2927005
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.2.json
@@ -0,0 +1,360 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 1850,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 1850,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [
+ {
+ "amount": 1850,
+ "amount_captured": 1850,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_NORMALIZED00000000000001",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BASIC",
+ "captured": true,
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Upgrade to Zulip Basic, $3.5 x 11 - $20.0 x 1",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "3",
+ "seat_count": "11",
+ "type": "upgrade"
+ },
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 0,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "payment_method": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 1850,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 1850,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKIaKiqwGMgYJYCChiM86LBaJDNdCvvquHj4-bf6gOZJs_4yp25m9AoKm6C9FVKHyuxwJZTrX-cRDIA-V",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"
+ },
+ "client_secret": "pi_NORMALIZED00000000000001_secret_t3CYD2mYepH9IMtAHzwDmuqi8",
+ "confirmation_method": "automatic",
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Upgrade to Zulip Basic, $3.5 x 11 - $20.0 x 1",
+ "id": "pi_NORMALIZED00000000000001",
+ "invoice": null,
+ "last_payment_error": null,
+ "latest_charge": "ch_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "3",
+ "seat_count": "11",
+ "type": "upgrade"
+ },
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OPIxsDEQaroqDjs1bItuDcf",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 2,
+ "request": {
+ "id": "req_NORMALIZED0002",
+ "idempotency_key": "876ad202-75b3-44b3-b955-050a90d741da"
+ },
+ "type": "payment_intent.succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 1850,
+ "amount_captured": 1850,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_NORMALIZED00000000000001",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BASIC",
+ "captured": true,
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Upgrade to Zulip Basic, $3.5 x 11 - $20.0 x 1",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "3",
+ "seat_count": "11",
+ "type": "upgrade"
+ },
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 0,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "payment_method": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 1850,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 1850,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKIaKiqwGMgbzCOHl-_Y6LBYUZWYCir8PG3-mpev20OJpujJl1gejWiBcErd8eEk5lIJfu5osO7t5xmRR",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OPIxsDEQaroqDjs1HUMhDHS",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0002",
+ "idempotency_key": "876ad202-75b3-44b3-b955-050a90d741da"
+ },
+ "type": "charge.succeeded"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.3.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.3.json
new file mode 100644
index 00000000000..b83e5557ec2
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.3.json
@@ -0,0 +1,518 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": null,
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "Customer flat discount for 1 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1000000000,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OPIxwDEQaroqDjsgKBF2NDh",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0003",
+ "idempotency_key": "5dfa0fa2-7a26-4e3f-9491-a806d8b77e8f"
+ },
+ "type": "invoice.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": -2000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Customer flat discount for 1 months",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ }
+ },
+ "id": "evt_1OPIxvDEQaroqDjsSt382A2u",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0004",
+ "idempotency_key": "ea56ccb3-01a7-4d3b-bff0-adc356842c47"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 3850,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Zulip Basic",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000002",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "quantity": 11,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ }
+ },
+ "id": "evt_1OPIxvDEQaroqDjsfjj3eYw3",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0005",
+ "idempotency_key": "71bf6246-397e-42cb-9b16-47b241e09c43"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": -1850,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Payment (Card ending in 4242)",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000003",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ }
+ },
+ "id": "evt_1OPIxuDEQaroqDjsgnwEAbHp",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0006",
+ "idempotency_key": "135356af-18e9-40a2-ac1d-a1729c277208"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver bb6ee6b4-a71",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "currency": null,
+ "default_currency": null
+ }
+ },
+ "id": "evt_1OPIxuDEQaroqDjsKcvdwW3a",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0006",
+ "idempotency_key": "135356af-18e9-40a2-ac1d-a1729c277208"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.4.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.4.json
new file mode 100644
index 00000000000..2818c9da6e2
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.4.json
@@ -0,0 +1,574 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTcmpGY1BzeDM0bFc1MDVvRGdUbk1zQlRzUE9RLDkzNTkzMzUz0200OiBMu8Td?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTcmpGY1BzeDM0bFc1MDVvRGdUbk1zQlRzUE9RLDkzNTkzMzUz0200OiBMu8Td/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "Customer flat discount for 1 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "NORMALI-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OPIxxDEQaroqDjsdRfVWV95",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0007",
+ "idempotency_key": "21e93778-75f1-4c70-83c4-93a04ed4d9b0"
+ },
+ "type": "invoice.finalized"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTcmpGY1BzeDM0bFc1MDVvRGdUbk1zQlRzUE9RLDkzNTkzMzUy0200AeXNXe17?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTcmpGY1BzeDM0bFc1MDVvRGdUbk1zQlRzUE9RLDkzNTkzMzUy0200AeXNXe17/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "Customer flat discount for 1 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "NORMALI-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ },
+ "previous_attributes": {
+ "attempted": false,
+ "auto_advance": true,
+ "effective_at": null,
+ "ending_balance": null,
+ "hosted_invoice_url": null,
+ "invoice_pdf": null,
+ "next_payment_attempt": 1000000000,
+ "number": null,
+ "paid": false,
+ "rendering": {
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "paid_at": null
+ }
+ }
+ },
+ "id": "evt_1OPIxxDEQaroqDjsZt2zjRrK",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0007",
+ "idempotency_key": "21e93778-75f1-4c70-83c4-93a04ed4d9b0"
+ },
+ "type": "invoice.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.5.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.5.json
new file mode 100644
index 00000000000..0e2d5d68adf
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.5.json
@@ -0,0 +1,553 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTcmpGY1BzeDM0bFc1MDVvRGdUbk1zQlRzUE9RLDkzNTkzMzUz0200OiBMu8Td?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTcmpGY1BzeDM0bFc1MDVvRGdUbk1zQlRzUE9RLDkzNTkzMzUz0200OiBMu8Td/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "Customer flat discount for 1 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "NORMALI-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OPIxxDEQaroqDjsEQ6ZofKv",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0007",
+ "idempotency_key": "21e93778-75f1-4c70-83c4-93a04ed4d9b0"
+ },
+ "type": "invoice.payment_succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTcmpGY1BzeDM0bFc1MDVvRGdUbk1zQlRzUE9RLDkzNTkzMzUz0200OiBMu8Td?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTcmpGY1BzeDM0bFc1MDVvRGdUbk1zQlRzUE9RLDkzNTkzMzUz0200OiBMu8Td/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "Customer flat discount for 1 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "NORMALI-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OPIxxDEQaroqDjsID2fw4LF",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0007",
+ "idempotency_key": "21e93778-75f1-4c70-83c4-93a04ed4d9b0"
+ },
+ "type": "invoice.paid"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.6.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.6.json
new file mode 100644
index 00000000000..6d922067afe
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Event.list.6.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Invoice.create.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Invoice.create.1.json
new file mode 100644
index 00000000000..2b0ad2bb0e3
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Invoice.create.1.json
@@ -0,0 +1,258 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": null,
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "Customer flat discount for 1 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1000000000,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Invoice.finalize_invoice.1.json
new file mode 100644
index 00000000000..288a25a1249
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Invoice.finalize_invoice.1.json
@@ -0,0 +1,258 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTcmpGY1BzeDM0bFc1MDVvRGdUbk1zQlRzUE9RLDkzNTkzMzUy0200AeXNXe17?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QRGtTcmpGY1BzeDM0bFc1MDVvRGdUbk1zQlRzUE9RLDkzNTkzMzUy0200AeXNXe17/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "Customer flat discount for 1 months",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000003",
+ "invoice_item": "ii_NORMALIZED00000000000003",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "NORMALI-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Invoice.list.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Invoice.list.1.json
new file mode 100644
index 00000000000..e39960ab725
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--Invoice.list.1.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/invoices"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--InvoiceItem.create.1.json
new file mode 100644
index 00000000000..041633b56c0
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--InvoiceItem.create.1.json
@@ -0,0 +1,47 @@
+{
+ "amount": -1850,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Payment (Card ending in 4242)",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000003",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000003",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0003",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--InvoiceItem.create.2.json
new file mode 100644
index 00000000000..82e3bb8ef91
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--InvoiceItem.create.2.json
@@ -0,0 +1,47 @@
+{
+ "amount": 3850,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Zulip Basic",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000002",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "quantity": 11,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--InvoiceItem.create.3.json
new file mode 100644
index 00000000000..a29feb75ef9
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--InvoiceItem.create.3.json
@@ -0,0 +1,47 @@
+{
+ "amount": -2000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Customer flat discount for 1 months",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--PaymentIntent.create.1.json
new file mode 100644
index 00000000000..eb09be48adc
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--PaymentIntent.create.1.json
@@ -0,0 +1,198 @@
+{
+ "amount": 1850,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 1850,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [
+ {
+ "amount": 1850,
+ "amount_captured": 1850,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_NORMALIZED00000000000001",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BASIC",
+ "captured": true,
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Upgrade to Zulip Basic, $3.5 x 11 - $20.0 x 1",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "3",
+ "seat_count": "11",
+ "type": "upgrade"
+ },
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 0,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "payment_method": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 1850,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 12,
+ "exp_year": 2024,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 1850,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKIWKiqwGMgY2UNMpVHM6LBaUsp_bCbAX_VSPzvRzrvYusYHRrvYUQZyhuNIrgSAssYOsUNIiSlf_sFMg",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"
+ },
+ "client_secret": "pi_NORMALIZED00000000000001_secret_t3CYD2mYepH9IMtAHzwDmuqi8",
+ "confirmation_method": "automatic",
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Upgrade to Zulip Basic, $3.5 x 11 - $20.0 x 1",
+ "id": "pi_NORMALIZED00000000000001",
+ "invoice": null,
+ "last_payment_error": null,
+ "latest_charge": "ch_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "3",
+ "seat_count": "11",
+ "type": "upgrade"
+ },
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--SetupIntent.create.1.json
new file mode 100644
index 00000000000..7854fd6e2d1
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--SetupIntent.create.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OPIxpDEQaroqDjsuh07JRe0_secret_PDkSMVaocRVyGtmyXwRQoEF3XWJtPoK",
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OPIxpDEQaroqDjsuh07JRe0",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1OPIxpDEQaroqDjs6cerpPYB",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "succeeded",
+ "usage": "off_session"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--SetupIntent.list.1.json
new file mode 100644
index 00000000000..42b19479221
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--SetupIntent.list.1.json
@@ -0,0 +1,41 @@
+{
+ "data": [
+ {
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OPIxoDEQaroqDjstULh7JPB_secret_PDkSxq55Hpo6uq7ZwKGFO8KRtBtD3OS",
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OPIxoDEQaroqDjstULh7JPB",
+ "last_setup_error": null,
+ "latest_attempt": null,
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": null,
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "requires_payment_method",
+ "usage": "off_session"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/setup_intents"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--SetupIntent.retrieve.1.json
new file mode 100644
index 00000000000..7854fd6e2d1
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--SetupIntent.retrieve.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OPIxpDEQaroqDjsuh07JRe0_secret_PDkSMVaocRVyGtmyXwRQoEF3XWJtPoK",
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OPIxpDEQaroqDjsuh07JRe0",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1OPIxpDEQaroqDjs6cerpPYB",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OPIxoDEQaroqDjsIEtENx2f",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "succeeded",
+ "usage": "off_session"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--checkout.Session.create.1.json
new file mode 100644
index 00000000000..8960c5ec4b0
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--checkout.Session.create.1.json
@@ -0,0 +1,74 @@
+{
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_address_collection": null,
+ "cancel_url": "http://selfhosting.testserver/realm/bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 1000000000,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_NORMALIZED0001",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "email": "[email protected]",
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "expires_at": 1000000000,
+ "id": "cs_test_NORMALIZED02vGEDEFbuAVu9a60TSmRdg53Zjt2udXYB3nh2fuPjsjDQz1",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "remote_realm_user_id": "3",
+ "type": "card_update"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {},
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "setup_intent": "seti_1OPIxoDEQaroqDjstULh7JPB",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/realm/bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED02vGEDEFbuAVu9a60TSmRdg53Zjt2udXYB3nh2fuPjsjDQz1#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+}
diff --git a/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--checkout.Session.list.1.json
new file mode 100644
index 00000000000..2e6736d9cea
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/upgrade_user_to_monthly_basic_plan--checkout.Session.list.1.json
@@ -0,0 +1,81 @@
+{
+ "data": [
+ {
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_address_collection": null,
+ "cancel_url": "http://selfhosting.testserver/realm/bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 1000000000,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_NORMALIZED0001",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "email": "[email protected]",
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "expires_at": 1000000000,
+ "id": "cs_test_NORMALIZED02vGEDEFbuAVu9a60TSmRdg53Zjt2udXYB3nh2fuPjsjDQz1",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "remote_realm_user_id": "3",
+ "type": "card_update"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {},
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "setup_intent": "seti_1OPIxoDEQaroqDjstULh7JPB",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/realm/bb6ee6b4-a719-4ed9-a5e2-6421d9843ef6/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED02vGEDEFbuAVu9a60TSmRdg53Zjt2udXYB3nh2fuPjsjDQz1#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/checkout/sessions"
+}
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index bc0b0eaf446..310ec9eac4e 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -579,14 +579,14 @@ class StripeTestCase(ZulipTestCase):
**kwargs: Any,
) -> "TestHttpResponse":
if upgrade_page_response is None:
+ tier = kwargs.get("tier")
+ upgrade_url = f"{self.billing_session.billing_base_url}/upgrade/"
+ if tier:
+ upgrade_url += f"?tier={tier}"
if self.billing_session.billing_base_url:
- upgrade_page_response = self.client_get(
- f"{self.billing_session.billing_base_url}/upgrade/", {}, subdomain="selfhosting"
- )
+ upgrade_page_response = self.client_get(upgrade_url, {}, subdomain="selfhosting")
else:
- upgrade_page_response = self.client_get(
- f"{self.billing_session.billing_base_url}/upgrade/", {}
- )
+ upgrade_page_response = self.client_get(upgrade_url, {})
params: Dict[str, Any] = {
"schedule": "annual",
"signed_seat_count": self.get_signed_seat_count_from_response(upgrade_page_response),
@@ -5651,7 +5651,7 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):
@responses.activate
@mock_stripe()
- def test_non_sponsorship_billing(self, *mocks: Mock) -> None:
+ def test_upgrade_user_to_business_plan(self, *mocks: Mock) -> None:
self.login("hamlet")
hamlet = self.example_user("hamlet")
@@ -5659,6 +5659,7 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):
realm_user_count = UserProfile.objects.filter(
realm=hamlet.realm, is_bot=False, is_active=True
).count()
+ self.assertEqual(realm_user_count, 11)
with time_machine.travel(self.now, tick=False):
send_server_data_to_push_bouncer(consider_usage_statistics=False)
@@ -5673,7 +5674,24 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):
f"{self.billing_session.billing_base_url}/upgrade/", subdomain="selfhosting"
)
self.assertEqual(result.status_code, 200)
- self.assert_in_success_response(["Add card", "Purchase Zulip Business"], result)
+
+ # Min licenses used since org has less users.
+ min_licenses = self.billing_session.min_licenses_for_plan(
+ CustomerPlan.TIER_SELF_HOSTED_BUSINESS
+ )
+ self.assertEqual(min_licenses, 25)
+ flat_discount, flat_discounted_months = self.billing_session.get_flat_discount_info()
+ self.assertEqual(flat_discounted_months, 12)
+
+ self.assert_in_success_response(
+ [
+ "Minimum purchase for",
+ f"{min_licenses} licenses",
+ "Add card",
+ "Purchase Zulip Business",
+ ],
+ result,
+ )
self.assertFalse(Customer.objects.exists())
self.assertFalse(CustomerPlan.objects.exists())
@@ -5693,10 +5711,10 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):
for substring in [
"Zulip Business",
"Number of licenses",
- f"{realm_user_count} (managed automatically)",
+ f"{min_licenses} (managed automatically)",
"January 2, 2013",
"Your plan will automatically renew on",
- f"${80 * realm_user_count:,.2f}",
+ f"${80 * min_licenses:,.2f}",
"Visa ending in 4242",
"Update card",
]:
@@ -5707,7 +5725,7 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):
self.assertEqual(LicenseLedger.objects.count(), 1)
with time_machine.travel(self.now + timedelta(days=2), tick=False):
- for count in range(4, 14):
+ for count in range(realm_user_count, min_licenses + 10):
do_create_user(
f"email {count}",
f"password {count}",
@@ -5722,11 +5740,140 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):
self.assertEqual(
RemoteRealmAuditLog.objects.count(),
- audit_log_count + 10,
+ min_licenses + 10 - realm_user_count + audit_log_count,
)
latest_ledger = LicenseLedger.objects.last()
assert latest_ledger is not None
- self.assertEqual(latest_ledger.licenses, realm_user_count + 10)
+ self.assertEqual(latest_ledger.licenses, min_licenses + 10)
+
+ with time_machine.travel(self.now + timedelta(days=1), tick=False):
+ response = self.client_get(
+ f"{self.billing_session.billing_base_url}/billing/", subdomain="selfhosting"
+ )
+
+ self.assertEqual(latest_ledger.licenses, 35)
+ for substring in [
+ "Zulip Business",
+ "Number of licenses",
+ f"{latest_ledger.licenses} (managed automatically)",
+ "January 2, 2013",
+ "Your plan will automatically renew on",
+ f"${80 * latest_ledger.licenses:,.2f}",
+ "Visa ending in 4242",
+ "Update card",
+ ]:
+ self.assert_in_response(substring, response)
+
+ @responses.activate
+ @mock_stripe()
+ def test_upgrade_user_to_monthly_basic_plan(self, *mocks: Mock) -> None:
+ self.login("hamlet")
+ hamlet = self.example_user("hamlet")
+
+ self.add_mock_response()
+ realm_user_count = UserProfile.objects.filter(
+ realm=hamlet.realm, is_bot=False, is_active=True
+ ).count()
+ self.assertEqual(realm_user_count, 11)
+
+ with time_machine.travel(self.now, tick=False):
+ send_server_data_to_push_bouncer(consider_usage_statistics=False)
+
+ result = self.execute_remote_billing_authentication_flow(hamlet)
+ self.assertEqual(result.status_code, 302)
+ self.assertEqual(result["Location"], f"{self.billing_session.billing_base_url}/plans/")
+
+ # upgrade to basic plan
+ with time_machine.travel(self.now, tick=False):
+ result = self.client_get(
+ f"{self.billing_session.billing_base_url}/upgrade/?tier={CustomerPlan.TIER_SELF_HOSTED_BASIC}",
+ subdomain="selfhosting",
+ )
+ self.assertEqual(result.status_code, 200)
+
+ min_licenses = self.billing_session.min_licenses_for_plan(
+ CustomerPlan.TIER_SELF_HOSTED_BASIC
+ )
+ self.assertEqual(min_licenses, 10)
+ flat_discount, flat_discounted_months = self.billing_session.get_flat_discount_info()
+ self.assertEqual(flat_discounted_months, 12)
+
+ self.assert_in_success_response(
+ [f"{realm_user_count}", "Add card", "Purchase Zulip Basic"], result
+ )
+
+ self.assertFalse(Customer.objects.exists())
+ self.assertFalse(CustomerPlan.objects.exists())
+ self.assertFalse(LicenseLedger.objects.exists())
+
+ with time_machine.travel(self.now, tick=False):
+ stripe_customer = self.add_card_and_upgrade(
+ tier=CustomerPlan.TIER_SELF_HOSTED_BASIC, schedule="monthly"
+ )
+
+ customer = Customer.objects.get(stripe_customer_id=stripe_customer.id)
+ plan = CustomerPlan.objects.get(customer=customer)
+ LicenseLedger.objects.get(plan=plan)
+
+ with time_machine.travel(self.now + timedelta(days=1), tick=False):
+ response = self.client_get(
+ f"{self.billing_session.billing_base_url}/billing/", subdomain="selfhosting"
+ )
+ for substring in [
+ "Zulip Basic",
+ "Number of licenses",
+ f"{realm_user_count} (managed automatically)",
+ "February 2, 2012",
+ "Your plan will automatically renew on",
+ f"${3.5 * realm_user_count - flat_discount // 100 * 1:,.2f}",
+ "Visa ending in 4242",
+ "Update card",
+ ]:
+ self.assert_in_response(substring, response)
+
+ # Verify that change in user count updates LicenseLedger.
+ audit_log_count = RemoteRealmAuditLog.objects.count()
+ self.assertEqual(LicenseLedger.objects.count(), 1)
+
+ with time_machine.travel(self.now + timedelta(days=2), tick=False):
+ for count in range(realm_user_count, min_licenses + 10):
+ do_create_user(
+ f"email {count}",
+ f"password {count}",
+ hamlet.realm,
+ "name",
+ role=UserProfile.ROLE_MEMBER,
+ acting_user=None,
+ )
+
+ with time_machine.travel(self.now + timedelta(days=3), tick=False):
+ send_server_data_to_push_bouncer(consider_usage_statistics=False)
+
+ self.assertEqual(
+ RemoteRealmAuditLog.objects.count(),
+ min_licenses + 10 - realm_user_count + audit_log_count,
+ )
+ latest_ledger = LicenseLedger.objects.last()
+ assert latest_ledger is not None
+ self.assertEqual(latest_ledger.licenses, min_licenses + 10)
+
+ with time_machine.travel(self.now + timedelta(days=1), tick=False):
+ response = self.client_get(
+ f"{self.billing_session.billing_base_url}/billing/", subdomain="selfhosting"
+ )
+
+ self.assertEqual(latest_ledger.licenses, 20)
+ for substring in [
+ "Zulip Basic",
+ "Number of licenses",
+ f"{latest_ledger.licenses} (managed automatically)",
+ "February 2, 2012",
+ "Your plan will automatically renew on",
+ f"${3.5 * latest_ledger.licenses - flat_discount // 100 * 1:,.2f}",
+ "Visa ending in 4242",
+ "Update card",
+ ]:
+ self.assert_in_response(substring, response)
@responses.activate
def test_request_sponsorship(self) -> None:
@@ -5918,10 +6065,10 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):
for substring in [
"Zulip Business",
"Number of licenses",
- f"{server_user_count} (managed automatically)",
+ f"{25} (managed automatically)",
"Your plan will automatically renew on",
"January 2, 2013",
- f"${80 * server_user_count:,.2f}",
+ f"${80 * 25:,.2f}",
"Visa ending in 4242",
"Update card",
]:
@@ -6151,8 +6298,6 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):
self.assertEqual(new_customer_plan.tier, CustomerPlan.TIER_SELF_HOSTED_BUSINESS)
self.assertEqual(new_customer_plan.billing_cycle_anchor, end_date)
- server_user_count = UserProfile.objects.filter(is_bot=False, is_active=True).count()
-
# Visit billing page
with time_machine.travel(self.now, tick=False):
response = self.client_get(f"{billing_base_url}/billing/", subdomain="selfhosting")
@@ -6160,7 +6305,8 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):
"(legacy plan)",
f"This is a legacy plan that ends on {end_date.strftime('%B %d, %Y')}",
f"Your plan will automatically upgrade to Zulip Business on {end_date.strftime('%B %d, %Y')}",
- f"Expected charge: <strong>${80 * server_user_count:,.2f}</strong>",
+ "Expected next charge",
+ f"${80 * 25 - 20 * 12:,.2f}",
"Visa ending in 4242",
"Update card",
]:
@@ -6189,3 +6335,114 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):
m.output[1],
f"INFO:corporate.stripe:Change plan status: Customer.id: {customer.id}, CustomerPlan.id: {customer_plan.id}, status: {CustomerPlan.ACTIVE}",
)
+
+ @responses.activate
+ @mock_stripe()
+ def test_upgrade_user_to_monthly_basic_plan(self, *mocks: Mock) -> None:
+ self.login("hamlet")
+ hamlet = self.example_user("hamlet")
+
+ self.add_mock_response()
+ realm_user_count = UserProfile.objects.filter(is_bot=False, is_active=True).count()
+ self.assertEqual(realm_user_count, 18)
+
+ with time_machine.travel(self.now, tick=False):
+ send_server_data_to_push_bouncer(consider_usage_statistics=False)
+
+ result = self.execute_remote_billing_authentication_flow(
+ hamlet.delivery_email, hamlet.full_name
+ )
+ self.assertEqual(result.status_code, 302)
+ self.assertEqual(result["Location"], f"{self.billing_session.billing_base_url}/plans/")
+
+ # upgrade to basic plan
+ with time_machine.travel(self.now, tick=False):
+ result = self.client_get(
+ f"{self.billing_session.billing_base_url}/upgrade/?tier={CustomerPlan.TIER_SELF_HOSTED_BASIC}",
+ subdomain="selfhosting",
+ )
+ self.assertEqual(result.status_code, 200)
+
+ min_licenses = self.billing_session.min_licenses_for_plan(
+ CustomerPlan.TIER_SELF_HOSTED_BASIC
+ )
+ self.assertEqual(min_licenses, 10)
+ flat_discount, flat_discounted_months = self.billing_session.get_flat_discount_info()
+ self.assertEqual(flat_discounted_months, 12)
+
+ self.assert_in_success_response(
+ [f"{min_licenses}", "Add card", "Purchase Zulip Basic"], result
+ )
+
+ self.assertFalse(Customer.objects.exists())
+ self.assertFalse(CustomerPlan.objects.exists())
+ self.assertFalse(LicenseLedger.objects.exists())
+
+ with time_machine.travel(self.now, tick=False):
+ stripe_customer = self.add_card_and_upgrade(
+ tier=CustomerPlan.TIER_SELF_HOSTED_BASIC, schedule="monthly"
+ )
+
+ customer = Customer.objects.get(stripe_customer_id=stripe_customer.id)
+ plan = CustomerPlan.objects.get(customer=customer)
+ LicenseLedger.objects.get(plan=plan)
+
+ with time_machine.travel(self.now + timedelta(days=1), tick=False):
+ response = self.client_get(
+ f"{self.billing_session.billing_base_url}/billing/", subdomain="selfhosting"
+ )
+ for substring in [
+ "Zulip Basic",
+ "Number of licenses",
+ f"{realm_user_count} (managed automatically)",
+ "February 2, 2012",
+ "Your plan will automatically renew on",
+ f"${3.5 * realm_user_count - flat_discount // 100 * 1:,.2f}",
+ "Visa ending in 4242",
+ "Update card",
+ ]:
+ self.assert_in_response(substring, response)
+
+ # Verify that change in user count updates LicenseLedger.
+ audit_log_count = RemoteRealmAuditLog.objects.count()
+ self.assertEqual(LicenseLedger.objects.count(), 1)
+
+ with time_machine.travel(self.now + timedelta(days=2), tick=False):
+ for count in range(realm_user_count, min_licenses + 10):
+ do_create_user(
+ f"email {count}",
+ f"password {count}",
+ hamlet.realm,
+ "name",
+ role=UserProfile.ROLE_MEMBER,
+ acting_user=None,
+ )
+
+ with time_machine.travel(self.now + timedelta(days=3), tick=False):
+ send_server_data_to_push_bouncer(consider_usage_statistics=False)
+
+ self.assertEqual(
+ RemoteRealmAuditLog.objects.count(),
+ min_licenses + 10 - realm_user_count + audit_log_count,
+ )
+ latest_ledger = LicenseLedger.objects.last()
+ assert latest_ledger is not None
+ self.assertEqual(latest_ledger.licenses, min_licenses + 10)
+
+ with time_machine.travel(self.now + timedelta(days=1), tick=False):
+ response = self.client_get(
+ f"{self.billing_session.billing_base_url}/billing/", subdomain="selfhosting"
+ )
+
+ self.assertEqual(latest_ledger.licenses, 20)
+ for substring in [
+ "Zulip Basic",
+ "Number of licenses",
+ f"{latest_ledger.licenses} (managed automatically)",
+ "February 2, 2012",
+ "Your plan will automatically renew on",
+ f"${3.5 * latest_ledger.licenses - flat_discount // 100 * 1:,.2f}",
+ "Visa ending in 4242",
+ "Update card",
+ ]:
+ self.assert_in_response(substring, response)
diff --git a/templates/corporate/billing.html b/templates/corporate/billing.html
index bb6a70af6e8..f384af98266 100644
--- a/templates/corporate/billing.html
+++ b/templates/corporate/billing.html
@@ -237,25 +237,34 @@
Your next invoice is due on <strong>{{ renewal_date }}</strong>.
{% endif %}
<br />
- Expected charge: <strong>${{ renewal_amount }}</strong>
- {% if not fixed_price %}
- (${{ price_per_license }} x {{ licenses_at_next_renewal }} {{ 'user' if licenses_at_next_renewal == 1 else 'users' }} x
- {% if switch_to_annual_at_end_of_cycle %}
- 12 months
- {%- elif switch_to_monthly_at_end_of_cycle %}
- 1 month
- {%- else %}
- {{ "1 month" if billing_frequency == "Monthly" else "12 months" }}
- {%- endif -%})
- {% if discount_percent %}
- <br />
- <i class="billing-page-discount">Includes: {{ discount_percent }}% discount</i>
- {% endif %}
- {% if using_min_licenses_for_plan %}
- <br />
- <i>Minimum purchase for this plan: {{ min_licenses_for_plan }} licenses</i>
+ <div class="input-box billing-page-field">
+ <label for="expected-charge">Expected next charge</label>
+ {% if not fixed_price %}
+ <div class="not-editable-realm-field">
+ {% if using_min_licenses_for_plan %}
+ <i>Minimum purchase for this plan: {{ min_licenses_for_plan }} licenses</i>
+ <br />
+ {% endif %}
+ ${{ pre_discount_renewal_cents }} (${{ price_per_license }} x {{ licenses_at_next_renewal }} {{ 'user' if licenses_at_next_renewal == 1 else 'users' }} x
+ {% if switch_to_annual_at_end_of_cycle %}
+ 12 months
+ {%- elif switch_to_monthly_at_end_of_cycle %}
+ 1 month
+ {%- else %}
+ {{ "1 month" if billing_frequency == "Monthly" else "12 months" }}
+ {%- endif -%})
+ {% if discounted_months_left != 0 %}
+ <br />
+ Discount: ${{ flat_discount }}/month off <i class="billing-page-discount">({{ discounted_months_left }} {{ "month" if discounted_months_left == 1 else "months" }} remaining)</i>
+ {% endif %}
+ {% if discount_percent %}
+ <br />
+ <i class="billing-page-discount">Includes: {{ discount_percent }}% discount</i>
+ {% endif %}
+ </div>
{% endif %}
- {% endif %}
+ </div>
+ <h1>${{ renewal_amount }}</h1>
{% endif %}
{% else %}
Your plan ends on <strong>{{ renewal_date }}</strong>, and does not renew.
@@ -498,12 +507,12 @@
</header>
<main class="modal__content">
<p>
- Your organization will be not be upgraded to <strong>Zulip Business</strong>
+ Your organization will be not be upgraded to <strong>{{ legacy_remote_server_next_plan_name }}</strong>
on {{ remote_server_legacy_plan_end_date }}. If your organization has more than
10 users at that time, you will lose access to the
<a href="https://zulip.readthedocs.io/en/stable/production/mobile-push-notifications.html">Mobile Push Notification Service</a>.
You will also not receive the <a href="{{ billing_base_url }}/plans/#self-hosted-plan-comparison">other benefits</a>
- of the Zulip Business plan. Are you sure you want to continue?
+ of the {{ legacy_remote_server_next_plan_name }} plan. Are you sure you want to continue?
</p>
</main>
<footer class="modal__footer">
diff --git a/templates/corporate/upgrade.html b/templates/corporate/upgrade.html
index 59f80f0a1f2..cd838e0affb 100644
--- a/templates/corporate/upgrade.html
+++ b/templates/corporate/upgrade.html
@@ -125,7 +125,12 @@
</span>
</label>
<div id="due-today" class="not-editable-realm-field">
- $<span class="due-today-unit-price"></span> x
+ {% if not manual_license_management and using_min_licenses_for_plan %}
+ <i>Minimum purchase for this plan: {{ min_licenses_for_plan }} licenses</i>
+ <br />
+ {% endif %}
+ $<span id="pre-discount-renewal-cents"></span>
+ ($<span class="due-today-unit-price"></span> x
{% if not manual_license_management %}
{{ seat_count }}
{% else %}
@@ -134,14 +139,14 @@
<span class="due-today-license-count-user-plural">
{{ 'user' if seat_count == 1 else 'users' }}
</span> x
- <span class="due-today-duration"></span>
+ <span class="due-today-duration"></span>)
{% if discount_percent %}
<br/>
<i class="billing-page-discount">Includes: {{ discount_percent }}% discount</i>
{% endif %}
- {% if not manual_license_management and using_min_licenses_for_plan %}
- <br />
- <i>Minimum purchase for this plan: {{ min_licenses_for_plan }} licenses</i>
+ {% if page_params.flat_discounted_months > 0 %}
+ <br/>
+ Discount: $<span class="flat-discounted-price"></span>/month off <i class="billing-page-discount">({{ page_params.flat_discounted_months }} {{ "month" if discounted_months_left == 1 else "months" }} remaining)</i>
{% endif %}
<h1>$<span class="due-today-price"></span></h1>
{% if free_trial_days %}
@@ -157,7 +162,7 @@
<p class="not-editable-realm-field">
Your subscription will renew automatically. Your bill will vary based on the number
of active users in your organization. You can also
- <a href="{{ page_params.billing_base_url }}/upgrade/?manual_license_management=true&tier%3D{{ page_params.tier }}">purchase a fixed number of licenses</a> instead. See
+ <a href="{{ page_params.billing_base_url }}/upgrade/?manual_license_management=true&tier={{ page_params.tier }}">purchase a fixed number of licenses</a> instead. See
<a target="_blank" href="https://zulip.com/help/zulip-cloud-billing">here</a> for details.
</p>
<input type="hidden" name="licenses" id="automatic_license_count" value="{{ seat_count }}" />
@@ -167,7 +172,7 @@
<p class="not-editable-realm-field">
Your subscription will renew automatically. You will be able to manage the number of licenses on
your organization's billing page. You can also
- <a href="{{ page_params.billing_base_url }}/upgrade/?tier%3D{{ page_params.tier }}">choose automatic license management</a> instead. See
+ <a href="{{ page_params.billing_base_url }}/upgrade/?tier={{ page_params.tier }}">choose automatic license management</a> instead. See
<a href="https://zulip.com/help/zulip-cloud-billing">here</a> for details.
</p>
</div>
diff --git a/web/src/billing/page_params.ts b/web/src/billing/page_params.ts
index b5c5434bdc5..984c620d4dd 100644
--- a/web/src/billing/page_params.ts
+++ b/web/src/billing/page_params.ts
@@ -9,6 +9,8 @@ export const page_params: {
seat_count: number;
billing_base_url: string;
tier: number;
+ flat_discount: number;
+ flat_discounted_months: number;
} = $("#page-params").data("params");
if (!page_params) {
diff --git a/web/src/billing/upgrade.ts b/web/src/billing/upgrade.ts
index 24f647a105a..9813dbb01ca 100644
--- a/web/src/billing/upgrade.ts
+++ b/web/src/billing/upgrade.ts
@@ -39,9 +39,14 @@ function update_due_today(schedule: string): void {
}
$("#due-today .due-today-duration").text(num_months === 1 ? "1 month" : "12 months");
const schedule_typed = helpers.schedule_schema.parse(schedule);
- $(".due-today-price").text(
- helpers.format_money(current_license_count * prices[schedule_typed]),
- );
+ const pre_flat_discount_price = prices[schedule_typed] * current_license_count;
+ $("#pre-discount-renewal-cents").text(helpers.format_money(pre_flat_discount_price));
+ const flat_discounted_months = Math.min(num_months, page_params.flat_discounted_months);
+ const total_flat_discount = page_params.flat_discount * flat_discounted_months;
+ const due_today = Math.max(0, pre_flat_discount_price - total_flat_discount);
+ $(".flat-discounted-price").text(helpers.format_money(page_params.flat_discount));
+ $(".due-today-price").text(helpers.format_money(due_today));
+
const unit_price = prices[schedule_typed] / num_months;
$("#due-today .due-today-unit-price").text(helpers.format_money(unit_price));
}