Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
billing: Migrate to Stripe hosted checkout page.
Vishnu KS6c06858e0266
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.pyindex 3402ac5a46f..10732b8dff1 100644--- a/corporate/lib/stripe.py+++ b/corporate/lib/stripe.py@@ -34,7 +34,6 @@ from zerver.lib.utils import assert_is_not_nonefrom zerver.models import Realm, RealmAuditLog, UserProfile, get_system_botfrom zproject.config import get_secret-STRIPE_PUBLISHABLE_KEY = get_secret("stripe_publishable_key")stripe.api_key = get_secret("stripe_secret_key")BILLING_LOG_PATH = os.path.join(@@ -223,6 +222,14 @@ class StripeConnectionError(BillingError):pass+class UpgradeWithExistingPlanError(BillingError):+ def __init__(self) -> None:+ super().__init__(+ "subscribing with existing subscription",+ "The organization is already subscribed to a plan. Please reload the billing page.",+ )++class InvalidBillingSchedule(Exception):def __init__(self, billing_schedule: int) -> None:self.message = f"Unknown billing_schedule: {billing_schedule}"@@ -238,13 +245,6 @@ class InvalidTier(Exception):def catch_stripe_errors(func: CallableT) -> CallableT:@wraps(func)def wrapped(*args: object, **kwargs: object) -> object:- if settings.DEVELOPMENT and not settings.TEST_SUITE: # nocoverage- if STRIPE_PUBLISHABLE_KEY is None:- raise BillingError(- "missing stripe config",- "Missing Stripe config. "- "See https://zulip.readthedocs.io/en/latest/subsystems/billing.html.",- )try:return func(*args, **kwargs)# See https://stripe.com/docs/api/python#error_handling, though@@ -283,11 +283,13 @@ def catch_stripe_errors(func: CallableT) -> CallableT:@catch_stripe_errorsdef stripe_get_customer(stripe_customer_id: str) -> stripe.Customer:- return stripe.Customer.retrieve(stripe_customer_id, expand=["default_source", "sources"])+ return stripe.Customer.retrieve(+ stripe_customer_id, expand=["invoice_settings", "invoice_settings.default_payment_method"]+ )@catch_stripe_errors-def do_create_stripe_customer(user: UserProfile, stripe_token: Optional[str] = None) -> Customer:+def do_create_stripe_customer(user: UserProfile, payment_method: Optional[str] = None) -> Customer:realm = user.realm# We could do a better job of handling race conditions here, but if two# people from a realm try to upgrade at exactly the same time, the main@@ -297,7 +299,10 @@ def do_create_stripe_customer(user: UserProfile, stripe_token: Optional[str] = Ndescription=f"{realm.string_id} ({realm.name})",email=user.delivery_email,metadata={"realm_id": realm.id, "realm_str": realm.string_id},- source=stripe_token,+ payment_method=payment_method,+ )+ stripe.Customer.modify(+ stripe_customer.id, invoice_settings={"default_payment_method": payment_method})event_time = timestamp_to_datetime(stripe_customer.created)with transaction.atomic():@@ -307,7 +312,7 @@ def do_create_stripe_customer(user: UserProfile, stripe_token: Optional[str] = Nevent_type=RealmAuditLog.STRIPE_CUSTOMER_CREATED,event_time=event_time,)- if stripe_token is not None:+ if payment_method is not None:RealmAuditLog.objects.create(realm=user.realm,acting_user=user,@@ -324,17 +329,17 @@ def do_create_stripe_customer(user: UserProfile, stripe_token: Optional[str] = N@catch_stripe_errors-def do_replace_payment_source(- user: UserProfile, stripe_token: str, pay_invoices: bool = False-) -> stripe.Customer:+def do_replace_payment_method(+ user: UserProfile, payment_method: str, pay_invoices: bool = False+) -> None:customer = get_customer_by_realm(user.realm)assert customer is not None # for mypyassert customer.stripe_customer_id is not None # for mypy- stripe_customer = stripe_get_customer(customer.stripe_customer_id)- stripe_customer.source = stripe_token- # Deletes existing card: https://stripe.com/docs/api#update_customer-source- updated_stripe_customer = stripe.Customer.save(stripe_customer)+ stripe.Customer.modify(+ customer.stripe_customer_id, invoice_settings={"default_payment_method": payment_method}+ )+RealmAuditLog.objects.create(realm=user.realm,acting_user=user,@@ -343,27 +348,30 @@ def do_replace_payment_source()if pay_invoices:for stripe_invoice in stripe.Invoice.list(- collection_method="charge_automatically", customer=stripe_customer.id, status="open"+ collection_method="charge_automatically",+ customer=customer.stripe_customer_id,+ status="open",):# The user will get either a receipt or a "failed payment" email, but the in-app# messaging could be clearer here (e.g. it could explicitly tell the user that there# were payment(s) and that they succeeded or failed).# Worth fixing if we notice that a lot of cards end up failing at this step.stripe.Invoice.pay(stripe_invoice)- return updated_stripe_customer-def stripe_customer_has_credit_card_as_default_source(stripe_customer: stripe.Customer) -> bool:- if not stripe_customer.default_source:+def stripe_customer_has_credit_card_as_default_payment_method(+ stripe_customer: stripe.Customer,+) -> bool:+ if not stripe_customer.invoice_settings.default_payment_method:return False- return stripe_customer.default_source.object == "card"+ return stripe_customer.invoice_settings.default_payment_method.type == "card"-def customer_has_credit_card_as_default_source(customer: Customer) -> bool:+def customer_has_credit_card_as_default_payment_method(customer: Customer) -> bool:if not customer.stripe_customer_id:return Falsestripe_customer = stripe_get_customer(customer.stripe_customer_id)- return stripe_customer_has_credit_card_as_default_source(stripe_customer)+ return stripe_customer_has_credit_card_as_default_payment_method(stripe_customer)# event_time should roughly be timezone_now(). Not designed to handle@@ -508,15 +516,16 @@ def make_end_of_cycle_updates_if_needed(# Returns Customer instead of stripe_customer so that we don't make a Stripe# API call if there's nothing to update+@catch_stripe_errorsdef update_or_create_stripe_customer(- user: UserProfile, stripe_token: Optional[str] = None+ user: UserProfile, payment_method: Optional[str] = None) -> Customer:realm = user.realmcustomer = get_customer_by_realm(realm)if customer is None or customer.stripe_customer_id is None:- return do_create_stripe_customer(user, stripe_token=stripe_token)- if stripe_token is not None:- do_replace_payment_source(user, stripe_token)+ return do_create_stripe_customer(user, payment_method=payment_method)+ if payment_method is not None:+ do_replace_payment_method(user, payment_method, True)return customer@@ -595,6 +604,18 @@ def is_free_trial_offer_enabled() -> bool:return settings.FREE_TRIAL_DAYS not in (None, 0)+def ensure_realm_does_not_have_active_plan(realm: Customer) -> None:+ if get_current_plan_by_realm(realm) is not None:+ # Unlikely race condition from two people upgrading (clicking "Make payment")+ # at exactly the same time. Doesn't fully resolve the race condition, but having+ # a check here reduces the likelihood.+ billing_logger.warning(+ "Upgrade of %s failed because of existing active plan.",+ realm.string_id,+ )+ raise UpgradeWithExistingPlanError()++# Only used for cloud signups@catch_stripe_errorsdef process_initial_upgrade(@@ -602,27 +623,13 @@ def process_initial_upgrade(licenses: int,automanage_licenses: bool,billing_schedule: int,- stripe_token: Optional[str],+ charge_automatically: bool,+ free_trial: bool,) -> None:realm = user.realm- customer = update_or_create_stripe_customer(user, stripe_token=stripe_token)+ customer = update_or_create_stripe_customer(user)assert customer.stripe_customer_id is not None # for mypy-- charge_automatically = stripe_token is not None- free_trial = is_free_trial_offer_enabled()-- if get_current_plan_by_customer(customer) is not None:- # Unlikely race condition from two people upgrading (clicking "Make payment")- # at exactly the same time. Doesn't fully resolve the race condition, but having- # a check here reduces the likelihood.- billing_logger.warning(- "Customer %s trying to upgrade, but has an active subscription",- customer,- )- raise BillingError(- "subscribing with existing subscription", str(BillingError.TRY_RELOADING)- )-+ ensure_realm_does_not_have_active_plan(customer.realm)(billing_cycle_anchor,next_invoice_date,@@ -635,32 +642,6 @@ def process_initial_upgrade(customer.default_discount,free_trial,)- # The main design constraint in this function is that if you upgrade with a credit card, and the- # charge fails, everything should be rolled back as if nothing had happened. This is because we- # expect frequent card failures on initial signup.- # Hence, if we're going to charge a card, do it at the beginning, even if we later may have to- # adjust the number of licenses.- if charge_automatically:- if not free_trial:- stripe_charge = stripe.Charge.create(- amount=price_per_license * licenses,- currency="usd",- customer=customer.stripe_customer_id,- description=f"Upgrade to Zulip Standard, ${price_per_license/100} x {licenses}",- receipt_email=user.delivery_email,- statement_descriptor="Zulip Standard",- )- # Not setting a period start and end, but maybe we should? Unclear what will make things- # most similar to the renewal case from an accounting perspective.- assert isinstance(stripe_charge.source, stripe.Card)- description = f"Payment (Card ending in {stripe_charge.source.last4})"- stripe.InvoiceItem.create(- amount=price_per_license * licenses * -1,- currency="usd",- customer=customer.stripe_customer_id,- description=description,- discountable=False,- )# TODO: The correctness of this relies on user creation, deactivation, etc being# in a transaction.atomic() with the relevant RealmAuditLog entriesdiff --git a/corporate/lib/stripe_event_handler.py b/corporate/lib/stripe_event_handler.pynew file mode 100644index 00000000000..d9e5668afc6--- /dev/null+++ b/corporate/lib/stripe_event_handler.py@@ -0,0 +1,176 @@+import logging+from typing import Any, Callable, Union++import stripe+from django.conf import settings++from corporate.lib.stripe import (+ BillingError,+ UpgradeWithExistingPlanError,+ ensure_realm_does_not_have_active_plan,+ process_initial_upgrade,+ update_or_create_stripe_customer,+)+from corporate.models import Event, PaymentIntent, Session+from zerver.models import get_user_by_delivery_email++billing_logger = logging.getLogger("corporate.stripe")+++def error_handler(+ func: Callable[[Any, Any], None],+) -> Callable[[Union[stripe.checkout.Session, stripe.PaymentIntent], Event], None]:+ def wrapper(+ stripe_object: Union[stripe.checkout.Session, stripe.PaymentIntent], event: Event+ ) -> None:+ event.status = Event.EVENT_HANDLER_STARTED+ event.save(update_fields=["status"])++ try:+ func(stripe_object, event.content_object)+ except BillingError as e:+ billing_logger.warning(+ "BillingError in %s event handler: %s. stripe_object_id=%s, customer_id=%s metadata=%s",+ event.type,+ e.error_description,+ stripe_object.id,+ stripe_object.customer,+ stripe_object.metadata,+ )+ event.status = Event.EVENT_HANDLER_FAILED+ event.handler_error = {+ "message": e.msg,+ "description": e.error_description,+ }+ event.save(update_fields=["status", "handler_error"])+ except Exception:+ billing_logger.exception(+ "Uncaught exception in %s event handler:",+ event.type,+ stack_info=True,+ )+ event.status = Event.EVENT_HANDLER_FAILED+ event.handler_error = {+ "description": f"uncaught exception in {event.type} event handler",+ "message": BillingError.CONTACT_SUPPORT.format(email=settings.ZULIP_ADMINISTRATOR),+ }+ event.save(update_fields=["status", "handler_error"])+ else:+ event.status = Event.EVENT_HANDLER_SUCCEEDED+ event.save()++ return wrapper+++@error_handler+def handle_checkout_session_completed_event(+ stripe_session: stripe.checkout.Session, session: Session+) -> None:+ session.status = Session.COMPLETED+ session.save()++ stripe_setup_intent = stripe.SetupIntent.retrieve(stripe_session.setup_intent)+ stripe_customer = stripe.Customer.retrieve(stripe_setup_intent.customer)+ user = get_user_by_delivery_email(stripe_customer.email, session.customer.realm)+ payment_method = stripe_setup_intent.payment_method++ if session.type in [+ Session.UPGRADE_FROM_BILLING_PAGE,+ Session.RETRY_UPGRADE_WITH_ANOTHER_PAYMENT_METHOD,+ ]:+ ensure_realm_does_not_have_active_plan(user.realm)+ update_or_create_stripe_customer(user, payment_method)+ session.payment_intent.status = PaymentIntent.PROCESSING+ session.payment_intent.last_payment_error = ()+ session.payment_intent.save(update_fields=["status", "last_payment_error"])+ try:+ stripe.PaymentIntent.confirm(+ session.payment_intent.stripe_payment_intent_id,+ payment_method=payment_method,+ off_session=True,+ )+ except stripe.error.CardError:+ pass+ elif session.type in [+ Session.FREE_TRIAL_UPGRADE_FROM_BILLING_PAGE,+ Session.FREE_TRIAL_UPGRADE_FROM_ONBOARDING_PAGE,+ ]:+ ensure_realm_does_not_have_active_plan(user.realm)+ update_or_create_stripe_customer(user, payment_method)+ process_initial_upgrade(+ user,+ int(stripe_setup_intent.metadata["licenses"]),+ stripe_setup_intent.metadata["license_management"] == "automatic",+ int(stripe_setup_intent.metadata["billing_schedule"]),+ charge_automatically=True,+ free_trial=True,+ )+ elif session.type in [Session.CARD_UPDATE_FROM_BILLING_PAGE]:+ update_or_create_stripe_customer(user, payment_method)+++@error_handler+def handle_payment_intent_succeeded_event(+ stripe_payment_intent: stripe.PaymentIntent, payment_intent: PaymentIntent+) -> None:+ payment_intent.status = PaymentIntent.SUCCEEDED+ payment_intent.save()+ metadata = stripe_payment_intent.metadata+ user = get_user_by_delivery_email(metadata["user_email"], payment_intent.customer.realm)++ description = ""+ for charge in stripe_payment_intent.charges:+ description = f"Payment (Card ending in {charge.payment_method_details.card.last4})"+ break++ stripe.InvoiceItem.create(+ amount=stripe_payment_intent.amount * -1,+ currency="usd",+ customer=stripe_payment_intent.customer,+ description=description,+ discountable=False,+ )+ try:+ ensure_realm_does_not_have_active_plan(user.realm)+ except UpgradeWithExistingPlanError as e:+ stripe_invoice = stripe.Invoice.create(+ auto_advance=True,+ collection_method="charge_automatically",+ customer=stripe_payment_intent.customer,+ days_until_due=None,+ statement_descriptor="Zulip Standard Credit",+ )+ stripe.Invoice.finalize_invoice(stripe_invoice)+ raise e++ process_initial_upgrade(+ user,+ int(metadata["licenses"]),+ metadata["license_management"] == "automatic",+ int(metadata["billing_schedule"]),+ True,+ False,+ )+++@error_handler+def handle_payment_intent_payment_failed_event(+ stripe_payment_intent: stripe.PaymentIntent, payment_intent: Event+) -> None:+ payment_intent.status = PaymentIntent.get_status_integer_from_status_text(+ stripe_payment_intent.status+ )+ billing_logger.info(+ "Stripe payment intent failed: %s %s %s %s",+ payment_intent.customer.realm.string_id,+ stripe_payment_intent.last_payment_error.get("type"),+ stripe_payment_intent.last_payment_error.get("code"),+ stripe_payment_intent.last_payment_error.get("param"),+ )+ payment_intent.last_payment_error = {+ "description": stripe_payment_intent.last_payment_error.get("type"),+ }+ payment_intent.last_payment_error["message"] = stripe_payment_intent.last_payment_error.get(+ "message"+ )+ payment_intent.save(update_fields=["status", "last_payment_error"])diff --git a/corporate/migrations/0015_event_paymentintent_session.py b/corporate/migrations/0015_event_paymentintent_session.pynew file mode 100644index 00000000000..ba0404eba51--- /dev/null+++ b/corporate/migrations/0015_event_paymentintent_session.py@@ -0,0 +1,85 @@+# Generated by Django 3.2.9 on 2021-11-04 16:23++import django.db.models.deletion+from django.db import migrations, models+++class Migration(migrations.Migration):++ dependencies = [+ ("contenttypes", "0002_remove_content_type_name"),+ ("corporate", "0014_customerplan_end_date"),+ ]++ operations = [+ migrations.CreateModel(+ name="PaymentIntent",+ fields=[+ (+ "id",+ models.AutoField(+ auto_created=True, primary_key=True, serialize=False, verbose_name="ID"+ ),+ ),+ ("stripe_payment_intent_id", models.CharField(max_length=255, unique=True)),+ ("status", models.SmallIntegerField()),+ ("last_payment_error", models.JSONField(default=None, null=True)),+ (+ "customer",+ models.ForeignKey(+ on_delete=django.db.models.deletion.CASCADE, to="corporate.customer"+ ),+ ),+ ],+ ),+ migrations.CreateModel(+ name="Session",+ fields=[+ (+ "id",+ models.AutoField(+ auto_created=True, primary_key=True, serialize=False, verbose_name="ID"+ ),+ ),+ ("stripe_session_id", models.CharField(max_length=255, unique=True)),+ ("type", models.SmallIntegerField()),+ ("status", models.SmallIntegerField(default=1)),+ (+ "customer",+ models.ForeignKey(+ on_delete=django.db.models.deletion.CASCADE, to="corporate.customer"+ ),+ ),+ (+ "payment_intent",+ models.ForeignKey(+ null=True,+ on_delete=django.db.models.deletion.CASCADE,+ to="corporate.paymentintent",+ ),+ ),+ ],+ ),+ migrations.CreateModel(+ name="Event",+ fields=[+ (+ "id",+ models.AutoField(+ auto_created=True, primary_key=True, serialize=False, verbose_name="ID"+ ),+ ),+ ("stripe_event_id", models.CharField(max_length=255)),+ ("type", models.CharField(max_length=255)),+ ("status", models.SmallIntegerField(default=1)),+ ("object_id", models.PositiveIntegerField(db_index=True)),+ ("handler_error", models.JSONField(default=None, null=True)),+ (+ "content_type",+ models.ForeignKey(+ on_delete=django.db.models.deletion.CASCADE, to="contenttypes.contenttype"+ ),+ ),+ ],+ ),+ ]diff --git a/corporate/models.py b/corporate/models.pyindex 06dd0b003d9..fa0c20ece43 100644--- a/corporate/models.py+++ b/corporate/models.py@@ -1,7 +1,9 @@import datetimefrom decimal import Decimal-from typing import Optional+from typing import Any, Dict, Optional, Union+from django.contrib.contenttypes.fields import GenericForeignKey+from django.contrib.contenttypes.models import ContentTypefrom django.db import modelsfrom django.db.models import CASCADE@@ -36,6 +38,141 @@ def get_customer_by_realm(realm: Realm) -> Optional[Customer]:return Customer.objects.filter(realm=realm).first()+class Event(models.Model):+ stripe_event_id = models.CharField(max_length=255)++ type = models.CharField(max_length=255)++ RECEIVED = 1+ EVENT_HANDLER_STARTED = 30+ EVENT_HANDLER_FAILED = 40+ EVENT_HANDLER_SUCCEEDED = 50+ status = models.SmallIntegerField(default=RECEIVED)++ content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)+ object_id = models.PositiveIntegerField(db_index=True)+ content_object = GenericForeignKey("content_type", "object_id")++ handler_error = models.JSONField(default=None, null=True)++ def get_event_handler_details_as_dict(self) -> Dict[str, Any]:+ details_dict = {}+ details_dict["status"] = {+ Event.RECEIVED: "not_started",+ Event.EVENT_HANDLER_STARTED: "started",+ Event.EVENT_HANDLER_FAILED: "failed",+ Event.EVENT_HANDLER_SUCCEEDED: "succeeded",+ }[self.status]+ if self.handler_error:+ details_dict["error"] = self.handler_error+ return details_dict+++def get_last_associated_event_by_type(+ content_object: Union["PaymentIntent", "Session"], event_type: str+) -> Optional[Event]:+ content_type = ContentType.objects.get_for_model(type(content_object))+ return Event.objects.filter(+ content_type=content_type, object_id=content_object.id, type=event_type+ ).last()+++class Session(models.Model):+ customer: Customer = models.ForeignKey(Customer, on_delete=CASCADE)+ stripe_session_id: str = models.CharField(max_length=255, unique=True)+ payment_intent = models.ForeignKey("PaymentIntent", null=True, on_delete=CASCADE)++ UPGRADE_FROM_BILLING_PAGE = 1+ RETRY_UPGRADE_WITH_ANOTHER_PAYMENT_METHOD = 10+ FREE_TRIAL_UPGRADE_FROM_BILLING_PAGE = 20+ FREE_TRIAL_UPGRADE_FROM_ONBOARDING_PAGE = 30+ CARD_UPDATE_FROM_BILLING_PAGE = 40+ type: int = models.SmallIntegerField()++ CREATED = 1+ COMPLETED = 10+ status: int = models.SmallIntegerField(default=CREATED)++ def get_status_as_string(self) -> str:+ return {Session.CREATED: "created", Session.COMPLETED: "completed"}[self.status]++ def get_type_as_string(self) -> str:+ return {+ Session.UPGRADE_FROM_BILLING_PAGE: "upgrade_from_billing_page",+ Session.RETRY_UPGRADE_WITH_ANOTHER_PAYMENT_METHOD: "retry_upgrade_with_another_payment_method",+ Session.FREE_TRIAL_UPGRADE_FROM_BILLING_PAGE: "free_trial_upgrade_from_billing_page",+ Session.FREE_TRIAL_UPGRADE_FROM_ONBOARDING_PAGE: "free_trial_upgrade_from_onboarding_page",+ Session.CARD_UPDATE_FROM_BILLING_PAGE: "card_update_from_billing_page",+ }[self.type]++ def to_dict(self) -> Dict[str, Any]:+ session_dict: Dict[str, Any] = {}++ session_dict["status"] = self.get_status_as_string()+ session_dict["type"] = self.get_type_as_string()+ if self.payment_intent:+ session_dict["stripe_payment_intent_id"] = self.payment_intent.stripe_payment_intent_id+ event = self.get_last_associated_event()+ if event is not None:+ session_dict["event_handler"] = event.get_event_handler_details_as_dict()+ return session_dict++ def get_last_associated_event(self) -> Optional[Event]:+ if self.status == Session.CREATED:+ return None+ return get_last_associated_event_by_type(self, "checkout.session.completed")+++class PaymentIntent(models.Model):+ customer: Customer = models.ForeignKey(Customer, on_delete=CASCADE)+ stripe_payment_intent_id: str = models.CharField(max_length=255, unique=True)++ REQUIRES_PAYMENT_METHOD = 1+ REQUIRES_CONFIRMATION = 20+ REQUIRES_ACTION = 30+ PROCESSING = 40+ REQUIRES_CAPTURE = 50+ CANCELLED = 60+ SUCCEEDED = 70++ status: int = models.SmallIntegerField()+ last_payment_error = models.JSONField(default=None, null=True)++ @classmethod+ def get_status_integer_from_status_text(cls, status_text: str) -> int:+ return getattr(cls, status_text.upper())++ def get_status_as_string(self) -> str:+ return {+ PaymentIntent.REQUIRES_PAYMENT_METHOD: "requires_payment_method",+ PaymentIntent.REQUIRES_CONFIRMATION: "requires_confirmation",+ PaymentIntent.REQUIRES_ACTION: "requires_action",+ PaymentIntent.PROCESSING: "processing",+ PaymentIntent.REQUIRES_CAPTURE: "requires_capture",+ PaymentIntent.CANCELLED: "cancelled",+ PaymentIntent.SUCCEEDED: "succeeded",+ }[self.status]++ def get_last_associated_event(self) -> Optional[Event]:+ if self.status == PaymentIntent.SUCCEEDED:+ event_type = "payment_intent.succeeded"+ elif self.status == PaymentIntent.REQUIRES_PAYMENT_METHOD:+ event_type = "payment_intent.payment_failed"+ else:+ return None+ return get_last_associated_event_by_type(self, event_type)++ def to_dict(self) -> Dict[str, Any]:+ payment_intent_dict: Dict[str, Any] = {}+ payment_intent_dict["status"] = self.get_status_as_string()+ event = self.get_last_associated_event()+ if self.last_payment_error:+ payment_intent_dict["last_payment_error"] = self.last_payment_error+ if event is not None:+ payment_intent_dict["event_handler"] = event.get_event_handler_details_as_dict()+ return payment_intent_dict++class CustomerPlan(models.Model):"""This is for storing most of the fiddly detailsdiff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.create.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.create.1.jsondeleted file mode 100644index 51636e7b376..00000000000--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.create.1.json+++ /dev/null@@ -1,117 +0,0 @@-{- "amount": 7200,- "amount_captured": 7200,- "amount_refunded": 0,- "application": null,- "application_fee": null,- "application_fee_amount": null,- "balance_transaction": "txn_NORMALIZED00000000000001",- "billing_details": {- "address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",- "line2": null,- "postal_code": "33333",- "state": null- },- "email": null,- "name": "Ada Starr",- "phone": null- },- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",- "captured": true,- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "description": "Upgrade to Zulip Standard, $12.0 x 6",- "destination": null,- "dispute": null,- "disputed": false,- "failure_code": null,- "failure_message": null,- "fraud_details": {},- "id": "ch_NORMALIZED00000000000001",- "invoice": null,- "livemode": false,- "metadata": {},- "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": null,- "payment_method": "card_NORMALIZED00000000000001",- "payment_method_details": {- "card": {- "brand": "visa",- "checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",- "cvc_check": "pass"- },- "country": "US",- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "installments": null,- "last4": "4242",- "network": "visa",- "three_d_secure": null,- "wallet": null- },- "type": "card"- },- "receipt_email": "[email protected]",- "receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",- "refunded": false,- "refunds": {- "data": [],- "has_more": false,- "object": "list",- "total_count": 0,- "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"- },- "review": null,- "shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "source_transfer": null,- "statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",- "status": "succeeded",- "transfer_data": null,- "transfer_group": null-}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.create.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.create.2.jsondeleted file mode 100644index 9e78c209154..00000000000--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.create.2.json+++ /dev/null@@ -1,117 +0,0 @@-{- "amount": 36000,- "amount_captured": 36000,- "amount_refunded": 0,- "application": null,- "application_fee": null,- "application_fee_amount": null,- "balance_transaction": "txn_NORMALIZED00000000000002",- "billing_details": {- "address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",- "line2": null,- "postal_code": "33333",- "state": null- },- "email": null,- "name": "Ada Starr",- "phone": null- },- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",- "captured": true,- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "description": "Upgrade to Zulip Standard, $60.0 x 6",- "destination": null,- "dispute": null,- "disputed": false,- "failure_code": null,- "failure_message": null,- "fraud_details": {},- "id": "ch_NORMALIZED00000000000002",- "invoice": null,- "livemode": false,- "metadata": {},- "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": null,- "payment_method": "card_NORMALIZED00000000000002",- "payment_method_details": {- "card": {- "brand": "visa",- "checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",- "cvc_check": "pass"- },- "country": "US",- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "installments": null,- "last4": "4242",- "network": "visa",- "three_d_secure": null,- "wallet": null- },- "type": "card"- },- "receipt_email": "[email protected]",- "receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000002",- "refunded": false,- "refunds": {- "data": [],- "has_more": false,- "object": "list",- "total_count": 0,- "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"- },- "review": null,- "shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "source_transfer": null,- "statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",- "status": "succeeded",- "transfer_data": null,- "transfer_group": null-}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.list.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.list.1.jsonindex c72832c6406..2c9d66c14fd 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.list.1.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.list.1.json@@ -10,18 +10,18 @@"balance_transaction": "txn_NORMALIZED00000000000001","billing_details": {"address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",+ "city": null,+ "country": null,+ "line1": null,"line2": null,- "postal_code": "33333",+ "postal_code": null,"state": null},"email": null,- "name": "Ada Starr",+ "name": null,"phone": null},- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",+ "calculated_statement_descriptor": "ZULIP STANDARD","captured": true,"created": 1000000000,"currency": "usd",@@ -36,7 +36,17 @@"id": "ch_NORMALIZED00000000000001","invoice": null,"livemode": false,- "metadata": {},+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },"object": "charge","on_behalf_of": null,"order": null,@@ -49,14 +59,14 @@"type": "authorized"},"paid": true,- "payment_intent": null,- "payment_method": "card_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo","payment_method_details": {"card": {"brand": "visa","checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",+ "address_line1_check": null,+ "address_postal_code_check": null,"cvc_check": "pass"},"country": "US",@@ -85,34 +95,10 @@},"review": null,"shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "source": null,"source_transfer": null,"statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",+ "statement_descriptor_suffix": null,"status": "succeeded","transfer_data": null,"transfer_group": nulldiff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.list.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.list.2.jsonindex 33d35851aa3..3ea322215a7 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.list.2.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Charge.list.2.json@@ -10,18 +10,18 @@"balance_transaction": "txn_NORMALIZED00000000000002","billing_details": {"address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",+ "city": null,+ "country": null,+ "line1": null,"line2": null,- "postal_code": "33333",+ "postal_code": null,"state": null},"email": null,- "name": "Ada Starr",+ "name": null,"phone": null},- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",+ "calculated_statement_descriptor": "ZULIP STANDARD","captured": true,"created": 1000000000,"currency": "usd",@@ -36,7 +36,17 @@"id": "ch_NORMALIZED00000000000002","invoice": null,"livemode": false,- "metadata": {},+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },"object": "charge","on_behalf_of": null,"order": null,@@ -49,14 +59,14 @@"type": "authorized"},"paid": true,- "payment_intent": null,- "payment_method": "card_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq7FA4KHR4JzRvD3uADAGe","payment_method_details": {"card": {"brand": "visa","checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",+ "address_line1_check": null,+ "address_postal_code_check": null,"cvc_check": "pass"},"country": "US",@@ -85,34 +95,10 @@},"review": null,"shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "source": null,"source_transfer": null,"statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",+ "statement_descriptor_suffix": null,"status": "succeeded","transfer_data": null,"transfer_group": null@@ -127,18 +113,18 @@"balance_transaction": "txn_NORMALIZED00000000000001","billing_details": {"address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",+ "city": null,+ "country": null,+ "line1": null,"line2": null,- "postal_code": "33333",+ "postal_code": null,"state": null},"email": null,- "name": "Ada Starr",+ "name": null,"phone": null},- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",+ "calculated_statement_descriptor": "ZULIP STANDARD","captured": true,"created": 1000000000,"currency": "usd",@@ -153,7 +139,17 @@"id": "ch_NORMALIZED00000000000001","invoice": null,"livemode": false,- "metadata": {},+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },"object": "charge","on_behalf_of": null,"order": null,@@ -166,14 +162,14 @@"type": "authorized"},"paid": true,- "payment_intent": null,- "payment_method": "card_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo","payment_method_details": {"card": {"brand": "visa","checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",+ "address_line1_check": null,+ "address_postal_code_check": null,"cvc_check": "pass"},"country": "US",@@ -202,34 +198,10 @@},"review": null,"shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "source": null,"source_transfer": null,"statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",+ "statement_descriptor_suffix": null,"status": "succeeded","transfer_data": null,"transfer_group": nulldiff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.create.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.create.1.jsonindex 88d5c69190f..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.create.1.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.create.1.json@@ -3,7 +3,7 @@"balance": 0,"created": 1000000000,"currency": null,- "default_source": "card_NORMALIZED00000000000001",+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Customer.save.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.modify.1.jsonsimilarity index 92%rename from corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Customer.save.1.jsonrename to corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.modify.1.jsonindex 88d5c69190f..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Customer.save.1.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.modify.1.json@@ -3,7 +3,7 @@"balance": 0,"created": 1000000000,"currency": null,- "default_source": "card_NORMALIZED00000000000001",+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.modify.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.modify.2.jsonnew file mode 100644index 00000000000..73f96cddf63--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.save.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.modify.3.jsonsimilarity index 86%rename from corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.save.1.jsonrename to corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.modify.3.jsonindex cface3d923f..ad7a1fd113f 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.save.1.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.modify.3.json@@ -3,7 +3,7 @@"balance": 0,"created": 1000000000,"currency": "usd",- "default_source": "card_NORMALIZED00000000000002",+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -12,7 +12,7 @@"invoice_prefix": "NORMA01","invoice_settings": {"custom_fields": null,- "default_payment_method": null,+ "default_payment_method": "pm_1JTq7FA4KHR4JzRvD3uADAGe","footer": null},"livemode": false,diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.retrieve.1.jsonindex 3d384443cbd..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.retrieve.1.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.retrieve.1.json@@ -2,32 +2,8 @@"address": null,"balance": 0,"created": 1000000000,- "currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "currency": null,+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -45,43 +21,10 @@"realm_str": "zulip"},"name": null,- "next_invoice_sequence": 2,+ "next_invoice_sequence": 1,"object": "customer","phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.retrieve.2.jsonnew file mode 100644index 00000000000..8b331807f37--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Customer.retrieve.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 2,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.1.jsonnew file mode 100644index 00000000000..f1c70df92a5--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.1.json@@ -0,0 +1,196 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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_NORMALIZED0002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000180j7F",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000180j7F/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq6uA4KHR4JzRvHrJlx11S",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "ec9c13e3-3653-4487-9495-bfb3f037ab7f"+ },+ "type": "invoice.payment_succeeded"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.2.jsonnew file mode 100644index 00000000000..177b1ed6b3b--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.2.json@@ -0,0 +1,702 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 7200,+ "amount_capturable": 0,+ "amount_received": 7200,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 7200,+ "amount_captured": 7200,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $12.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq70A4KHR4JzRvJD7AOnGo",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_9VY1UxiA1u2E4iwWriDWdKWb2",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $12.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq6zA4KHR4JzRv050KO5J6",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "8e523cb2-1aac-4161-a7bb-aaae35a948a9"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 7200,+ "amount_captured": 7200,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $12.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq70A4KHR4JzRvJD7AOnGo",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq6zA4KHR4JzRv0wGvTlkQ",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "8e523cb2-1aac-4161-a7bb-aaae35a948a9"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTq74A4KHR4JzRvm93ZKSdv",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "0dd55235-9a02-4ebe-bc91-edbbd3e1681a"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq71A4KHR4JzRvGNPaENVK_secret_K86JwqacIutOEOSjrEfAOZWcYc7BcSI",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq71A4KHR4JzRvGNPaENVK",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq71A4KHR4JzRvCn2k1wNg",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq72A4KHR4JzRvNe7mNYyB",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "ab1469b0-b668-4ecc-bde9-bd50661b02c6"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "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_1JTq70A4KHR4JzRvJD7AOnGo",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq72A4KHR4JzRv7kD6MOJr",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "ab1469b0-b668-4ecc-bde9-bd50661b02c6"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq71A4KHR4JzRvGNPaENVK_secret_K86JwqacIutOEOSjrEfAOZWcYc7BcSI",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq71A4KHR4JzRvGNPaENVK",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq71A4KHR4JzRvCn2k1wNg",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq72A4KHR4JzRvAGYaiiBM",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "ab1469b0-b668-4ecc-bde9-bd50661b02c6"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6zA4KHR4JzRv5oPqvFXV_secret_K86JgWJKzWddYfQ09PLQRh8OEFpsiRe",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6zA4KHR4JzRv5oPqvFXV",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq70A4KHR4JzRvTwfHByZw",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "f8a3352d-0e9a-4d56-b7cc-14b3e8599413"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 7200,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_9VY1UxiA1u2E4iwWriDWdKWb2",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $12.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq6zA4KHR4JzRv01AviF4k",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "50112eb4-9dca-4a47-8f51-a0585edf8f37"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTq6yA4KHR4JzRv4oSDpYVk",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "8c153a11-8f3b-4612-8f31-525678a20fb1"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.3.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.3.jsonnew file mode 100644index 00000000000..9a85a53020d--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.3.json@@ -0,0 +1,1261 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 7200,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 1200,+ "unit_amount_decimal": "1200"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -7200,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -7200,+ "unit_amount_decimal": "-7200"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq7BA4KHR4JzRvNqxiA1Mo",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "7166c4bd-ba4f-4bc3-b397-f69459033432"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 7200,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 1200,+ "unit_amount_decimal": "1200"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -7200,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -7200,+ "unit_amount_decimal": "-7200"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq7AA4KHR4JzRv6mdC8T0H",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "7166c4bd-ba4f-4bc3-b397-f69459033432"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 7200,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 1200,+ "unit_amount_decimal": "1200"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -7200,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -7200,+ "unit_amount_decimal": "-7200"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq7AA4KHR4JzRvVjrzfXxn",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "7166c4bd-ba4f-4bc3-b397-f69459033432"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 7200,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 1200,+ "unit_amount_decimal": "1200"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -7200,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -7200,+ "unit_amount_decimal": "-7200"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1JTq7AA4KHR4JzRvao4umxNz",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "7166c4bd-ba4f-4bc3-b397-f69459033432"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 7200,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 1200,+ "unit_amount_decimal": "1200"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -7200,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -7200,+ "unit_amount_decimal": "-7200"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq79A4KHR4JzRve1lcUOLy",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "030b1343-2bb5-471a-b56c-9773571c90dd"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -7200,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000004",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -7200,+ "unit_amount_decimal": "-7200"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -7200,+ "unit_amount_decimal": "-7200"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq79A4KHR4JzRvSAdO30ED",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "030b1343-2bb5-471a-b56c-9773571c90dd"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 7200,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000003",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 1200,+ "unit_amount_decimal": "1200"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 1200,+ "unit_amount_decimal": "1200"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq79A4KHR4JzRvMnAy98FR",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "030b1343-2bb5-471a-b56c-9773571c90dd"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 7200,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "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",+ "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": 1200,+ "unit_amount_decimal": "1200"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 1200,+ "unit_amount_decimal": "1200"+ }+ },+ "id": "evt_1JTq78A4KHR4JzRv5brnyufc",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "9d7a707a-aa76-44b8-a58a-e7553578ef65"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -7200,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000004",+ "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",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -7200,+ "unit_amount_decimal": "-7200"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -7200,+ "unit_amount_decimal": "-7200"+ }+ },+ "id": "evt_1JTq78A4KHR4JzRvHPWJF1xt",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "933fd8b5-4678-4856-aa3c-51ade8513b73"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JTq78A4KHR4JzRvn2lSpmKn",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "933fd8b5-4678-4856-aa3c-51ade8513b73"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.4.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.4.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.4.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.5.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.5.jsonnew file mode 100644index 00000000000..5ee9b7f2e11--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.5.json@@ -0,0 +1,196 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 7200,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 1200,+ "unit_amount_decimal": "1200"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -7200,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -7200,+ "unit_amount_decimal": "-7200"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq7BA4KHR4JzRvNqxiA1Mo",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "7166c4bd-ba4f-4bc3-b397-f69459033432"+ },+ "type": "invoice.payment_succeeded"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.6.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.6.jsonnew file mode 100644index 00000000000..9ad371e8c09--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.6.json@@ -0,0 +1,657 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 36000,+ "amount_capturable": 0,+ "amount_received": 36000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 36000,+ "amount_captured": 36000,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": "txn_NORMALIZED00000000000002",+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $60.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq7FA4KHR4JzRvD3uADAGe",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000002",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_4AXq7WiHGUXFdtcaeAHpf3UVs",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $60.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7FA4KHR4JzRvD3uADAGe",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq7EA4KHR4JzRv0N1QkUG3",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0012",+ "idempotency_key": "5b361be1-7a7d-4795-a37a-e9a208672371"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 36000,+ "amount_captured": 36000,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": "txn_NORMALIZED00000000000002",+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $60.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq7FA4KHR4JzRvD3uADAGe",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000002",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq7EA4KHR4JzRv0IC9Qe9t",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0012",+ "idempotency_key": "5b361be1-7a7d-4795-a37a-e9a208672371"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq7FA4KHR4JzRvD3uADAGe",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 2,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo"+ }+ }+ },+ "id": "evt_1JTq7JA4KHR4JzRvXhpFcEbo",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0013",+ "idempotency_key": "f410ad9b-4dde-4f6d-9bcd-1a03198f7b78"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7GA4KHR4JzRv01GUDkwn_secret_K86JHEXUhIQjgeL6YUOYbu78g7K1wgz",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7GA4KHR4JzRv01GUDkwn",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7GA4KHR4JzRvIxxtRvFQ",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7FA4KHR4JzRvD3uADAGe",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq7HA4KHR4JzRvKiXTFVzJ",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0014",+ "idempotency_key": "13cbf013-3957-408b-8a63-d745f64794f5"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "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_1JTq7FA4KHR4JzRvD3uADAGe",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq7HA4KHR4JzRvZLUMooxc",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0014",+ "idempotency_key": "13cbf013-3957-408b-8a63-d745f64794f5"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7GA4KHR4JzRv01GUDkwn_secret_K86JHEXUhIQjgeL6YUOYbu78g7K1wgz",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7GA4KHR4JzRv01GUDkwn",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7GA4KHR4JzRvIxxtRvFQ",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7FA4KHR4JzRvD3uADAGe",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq7HA4KHR4JzRvVIjEE36V",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0014",+ "idempotency_key": "13cbf013-3957-408b-8a63-d745f64794f5"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7EA4KHR4JzRvnIlHU7L0_secret_K86JTEZqWx10YlEVyd9XMsLPbmFm2Qf",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7EA4KHR4JzRvnIlHU7L0",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq7FA4KHR4JzRvhIWraTUX",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0015",+ "idempotency_key": "e88981a2-e582-4a10-946b-9b7b6b71e10f"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 36000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_4AXq7WiHGUXFdtcaeAHpf3UVs",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $60.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq7EA4KHR4JzRv0ptaVTHc",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0016",+ "idempotency_key": "ff8644c4-4950-4486-b9a0-e686371e72b6"+ },+ "type": "payment_intent.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.7.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.7.jsonnew file mode 100644index 00000000000..743dca0a45d--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.7.json@@ -0,0 +1,1213 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 36000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 6000,+ "unit_amount_decimal": "6000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -36000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000006",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0006",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -36000,+ "unit_amount_decimal": "-36000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0004",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1JTq7PA4KHR4JzRvmuu76W2d",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0017",+ "idempotency_key": "b50e2646-086a-4424-9223-193ea8f33db4"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 36000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 6000,+ "unit_amount_decimal": "6000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -36000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000006",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0006",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -36000,+ "unit_amount_decimal": "-36000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0004",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1JTq7PA4KHR4JzRv8d3fL9GY",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0017",+ "idempotency_key": "b50e2646-086a-4424-9223-193ea8f33db4"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 36000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 6000,+ "unit_amount_decimal": "6000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -36000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000006",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0006",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -36000,+ "unit_amount_decimal": "-36000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0004",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1JTq7PA4KHR4JzRvAfsplsBm",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0017",+ "idempotency_key": "b50e2646-086a-4424-9223-193ea8f33db4"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 36000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 6000,+ "unit_amount_decimal": "6000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -36000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000006",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0006",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -36000,+ "unit_amount_decimal": "-36000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0004",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1JTq7PA4KHR4JzRvWXvxIz8A",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0017",+ "idempotency_key": "b50e2646-086a-4424-9223-193ea8f33db4"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 36000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 6000,+ "unit_amount_decimal": "6000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -36000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000006",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0006",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -36000,+ "unit_amount_decimal": "-36000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq7PA4KHR4JzRvKB7DAFrB",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0018",+ "idempotency_key": "1a588f07-94c2-47c8-9f39-e46263468b56"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -36000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000006",+ "invoice": "in_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000006",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0006",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -36000,+ "unit_amount_decimal": "-36000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -36000,+ "unit_amount_decimal": "-36000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq7PA4KHR4JzRvgX5HjHU0",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0018",+ "idempotency_key": "1a588f07-94c2-47c8-9f39-e46263468b56"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 36000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000005",+ "invoice": "in_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 6000,+ "unit_amount_decimal": "6000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 6000,+ "unit_amount_decimal": "6000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq7PA4KHR4JzRvuFtzVvXn",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0018",+ "idempotency_key": "1a588f07-94c2-47c8-9f39-e46263468b56"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 36000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000005",+ "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",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 6000,+ "unit_amount_decimal": "6000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 6000,+ "unit_amount_decimal": "6000"+ }+ },+ "id": "evt_1JTq7OA4KHR4JzRvhgroYRb9",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0019",+ "idempotency_key": "93d6b173-255b-471c-93ea-6f5f82a41887"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -36000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000006",+ "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",+ "id": "price_NORMALIZED00000000000006",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0006",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -36000,+ "unit_amount_decimal": "-36000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -36000,+ "unit_amount_decimal": "-36000"+ }+ },+ "id": "evt_1JTq7NA4KHR4JzRvIacqbQ7n",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0020",+ "idempotency_key": "d25594d8-16cf-4b18-9415-574897eb028b"+ },+ "type": "invoiceitem.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.8.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.8.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Event.list.8.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.create.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.create.1.jsonindex d6bc3d9008a..785dd7b2007 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000001",+ "id": "in_NORMALIZED00000000000002","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000002",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0002",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,7 +134,7 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.create.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.create.2.jsonindex 16494f1f453..cccdb6e274c 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.create.2.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.create.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000002",+ "id": "in_NORMALIZED00000000000003","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000006","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,7 +134,7 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.create.3.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.create.3.jsonindex f559909bc00..7b7dc3be3d8 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.create.3.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.create.3.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 24000,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000003",+ "id": "in_NORMALIZED00000000000004","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000005",- "invoice_item": "ii_NORMALIZED00000000000005",+ "id": "il_NORMALIZED00000000000007",+ "invoice_item": "ii_NORMALIZED00000000000007","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000005",+ "id": "price_NORMALIZED00000000000007","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0005",+ "product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,7 +90,7 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"},"livemode": false,"metadata": {},@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.finalize_invoice.1.jsonindex 22bbcb021a6..f0b8ff43af3 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001WK1Jr",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001WK1Jr/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000002",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0002",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,12 +134,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": true,@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.finalize_invoice.2.jsonindex d3ab38b2a50..b94ba940dd8 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.finalize_invoice.2.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.finalize_invoice.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002690Fc",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002690Fc/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000006","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,12 +134,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0002",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": true,diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.finalize_invoice.3.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.finalize_invoice.3.jsonindex 181f0ab4778..300a90d1e8a 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.finalize_invoice.3.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.finalize_invoice.3.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 24000,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003Nv3oI",- "id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003Nv3oI/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004A1tY0",+ "id": "in_NORMALIZED00000000000004",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004A1tY0/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000005",- "invoice_item": "ii_NORMALIZED00000000000005",+ "id": "il_NORMALIZED00000000000007",+ "invoice_item": "ii_NORMALIZED00000000000007","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000005",+ "id": "price_NORMALIZED00000000000007","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0005",+ "product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,16 +90,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0003",+ "number": "NORMALI-0005","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.1.jsonindex 70e650aca9d..e39960ab725 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.1.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.1.json@@ -1,178 +1,5 @@{- "data": [- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 0,- "amount_paid": 0,- "amount_remaining": 0,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001WK1Jr",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001WK1Jr/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 7200,- "currency": "usd",- "description": "Zulip Standard",- "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",- "id": "price_NORMALIZED00000000000001",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0001",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 1200,- "unit_amount_decimal": "1200"- },- "proration": false,- "quantity": 6,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- },- {- "amount": -7200,- "currency": "usd",- "description": "Payment (Card ending in 4242)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1000000000,- "start": 1000000000- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000002",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0002",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": -7200,- "unit_amount_decimal": "-7200"- },- "proration": false,- "quantity": 1,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": null,- "number": "NORMALI-0001",- "object": "invoice",- "on_behalf_of": null,- "paid": true,- "payment_intent": null,- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "paid",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": 1000000000,- "voided_at": null- },- "subscription": null,- "subtotal": 0,- "tax": null,- "total": 0,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- }- ],+ "data": [],"has_more": false,"object": "list","url": "/v1/invoices"diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.2.jsonindex 7606155a4c5..716b41acdde 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.2.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.2.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -38,14 +38,14 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002690Fc",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002690Fc/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i/pdf","last_finalization_error": null,"lines": {"data": [{- "amount": 36000,+ "amount": 7200,"currency": "usd","description": "Zulip Standard","discount_amounts": [],@@ -57,8 +57,8 @@"metadata": {},"object": "line_item","period": {- "end": 1357095845,- "start": 1325473445+ "end": 1000000000,+ "start": 1000000000},"plan": null,"price": {@@ -74,11 +74,12 @@"object": "price","product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",- "unit_amount": 6000,- "unit_amount_decimal": "6000"+ "unit_amount": 1200,+ "unit_amount_decimal": "1200"},"proration": false,"quantity": 6,@@ -88,7 +89,7 @@"type": "invoiceitem"},{- "amount": -36000,+ "amount": -7200,"currency": "usd","description": "Payment (Card ending in 4242)","discount_amounts": [],@@ -117,178 +118,7 @@"object": "price","product": "prod_NORMALIZED0004","recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": -36000,- "unit_amount_decimal": "-36000"- },- "proration": false,- "quantity": 1,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": null,- "number": "NORMALI-0002",- "object": "invoice",- "on_behalf_of": null,- "paid": true,- "payment_intent": null,- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "paid",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": 1000000000,- "voided_at": null- },- "subscription": null,- "subtotal": 0,- "tax": null,- "total": 0,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- },- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 0,- "amount_paid": 0,- "amount_remaining": 0,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001WK1Jr",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001WK1Jr/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 7200,- "currency": "usd",- "description": "Zulip Standard",- "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",- "id": "price_NORMALIZED00000000000001",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0001",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 1200,- "unit_amount_decimal": "1200"- },- "proration": false,- "quantity": 6,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- },- {- "amount": -7200,- "currency": "usd",- "description": "Payment (Card ending in 4242)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1000000000,- "start": 1000000000- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "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",@@ -306,12 +136,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": true,diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.3.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.3.jsonindex fc65f55b001..e39960ab725 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.3.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.3.json@@ -1,479 +1,5 @@{- "data": [- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 24000,- "amount_paid": 0,- "amount_remaining": 24000,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003Nv3oI",- "id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003Nv3oI/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 24000,- "currency": "usd",- "description": "Zulip Standard - renewal",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000005",- "invoice_item": "ii_NORMALIZED00000000000005",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1388631845,- "start": 1357095845- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000005",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0005",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 4000,- "unit_amount_decimal": "4000"- },- "proration": false,- "quantity": 6,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": 1000000000,- "number": "NORMALI-0003",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 24000,- "tax": null,- "total": 24000,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- },- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 0,- "amount_paid": 0,- "amount_remaining": 0,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002690Fc",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002690Fc/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 36000,- "currency": "usd",- "description": "Zulip Standard",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1357095845,- "start": 1325473445- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000003",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0003",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 6000,- "unit_amount_decimal": "6000"- },- "proration": false,- "quantity": 6,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- },- {- "amount": -36000,- "currency": "usd",- "description": "Payment (Card ending in 4242)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1000000000,- "start": 1000000000- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000004",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0004",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": -36000,- "unit_amount_decimal": "-36000"- },- "proration": false,- "quantity": 1,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": null,- "number": "NORMALI-0002",- "object": "invoice",- "on_behalf_of": null,- "paid": true,- "payment_intent": null,- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "paid",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": 1000000000,- "voided_at": null- },- "subscription": null,- "subtotal": 0,- "tax": null,- "total": 0,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- },- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 0,- "amount_paid": 0,- "amount_remaining": 0,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001WK1Jr",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001WK1Jr/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 7200,- "currency": "usd",- "description": "Zulip Standard",- "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",- "id": "price_NORMALIZED00000000000001",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0001",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 1200,- "unit_amount_decimal": "1200"- },- "proration": false,- "quantity": 6,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- },- {- "amount": -7200,- "currency": "usd",- "description": "Payment (Card ending in 4242)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1000000000,- "start": 1000000000- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000002",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0002",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": -7200,- "unit_amount_decimal": "-7200"- },- "proration": false,- "quantity": 1,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": null,- "number": "NORMALI-0001",- "object": "invoice",- "on_behalf_of": null,- "paid": true,- "payment_intent": null,- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "paid",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": 1000000000,- "voided_at": null- },- "subscription": null,- "subtotal": 0,- "tax": null,- "total": 0,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- }- ],+ "data": [],"has_more": false,"object": "list","url": "/v1/invoices"diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.4.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.4.jsonnew file mode 100644index 00000000000..4db31b2b0ed--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.4.json@@ -0,0 +1,355 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 36000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 6000,+ "unit_amount_decimal": "6000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -36000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000006",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0006",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -36000,+ "unit_amount_decimal": "-36000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0004",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 7200,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 1200,+ "unit_amount_decimal": "1200"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -7200,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -7200,+ "unit_amount_decimal": "-7200"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.5.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.5.jsonnew file mode 100644index 00000000000..9012bb49e67--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Invoice.list.5.json@@ -0,0 +1,485 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 24000,+ "amount_paid": 0,+ "amount_remaining": 24000,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004A1tY0",+ "id": "in_NORMALIZED00000000000004",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004A1tY0/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 24000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000007",+ "invoice_item": "ii_NORMALIZED00000000000007",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1388631845,+ "start": 1357095845+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000007",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0007",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 4000,+ "unit_amount_decimal": "4000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0005",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000003",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 24000,+ "tax": null,+ "total": 24000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003rB7PI/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 36000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 6000,+ "unit_amount_decimal": "6000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -36000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000006",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0006",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -36000,+ "unit_amount_decimal": "-36000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0004",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000022BN9i/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 7200,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 1200,+ "unit_amount_decimal": "1200"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -7200,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -7200,+ "unit_amount_decimal": "-7200"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.1.jsonindex e9ac575f0d4..0489936237d 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.1.json@@ -6,7 +6,7 @@"description": "Payment (Card ending in 4242)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000002",+ "id": "ii_NORMALIZED00000000000004","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000002",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0002",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.2.jsonindex 2d5bb1c054c..dc436e3386c 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.2.json@@ -6,7 +6,7 @@"description": "Zulip Standard","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000001",+ "id": "ii_NORMALIZED00000000000003","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.3.jsonindex 82f73b1ae62..95fbf836b4a 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.3.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.3.json@@ -6,7 +6,7 @@"description": "Payment (Card ending in 4242)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000004",+ "id": "ii_NORMALIZED00000000000006","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000006","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.4.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.4.jsonindex 15f0a8edc53..51bc64de46b 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.4.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.4.json@@ -6,7 +6,7 @@"description": "Zulip Standard","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000003",+ "id": "ii_NORMALIZED00000000000005","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.5.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.5.jsonindex 77dc7d535d0..f827e48c4e3 100644--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.5.json+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--InvoiceItem.create.5.json@@ -6,7 +6,7 @@"description": "Zulip Standard - renewal","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000005",+ "id": "ii_NORMALIZED00000000000007","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000005",+ "id": "price_NORMALIZED00000000000007","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0005",+ "product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..12e01a0567a--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentIntent.confirm.1.json@@ -0,0 +1,166 @@+{+ "amount": 7200,+ "amount_capturable": 0,+ "amount_received": 7200,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 7200,+ "amount_captured": 7200,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $12.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq70A4KHR4JzRvJD7AOnGo",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_9VY1UxiA1u2E4iwWriDWdKWb2",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $12.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentIntent.confirm.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentIntent.confirm.2.jsonnew file mode 100644index 00000000000..adc63264862--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentIntent.confirm.2.json@@ -0,0 +1,166 @@+{+ "amount": 36000,+ "amount_capturable": 0,+ "amount_received": 36000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 36000,+ "amount_captured": 36000,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": "txn_NORMALIZED00000000000002",+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $60.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq7FA4KHR4JzRvD3uADAGe",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000002",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_4AXq7WiHGUXFdtcaeAHpf3UVs",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $60.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7FA4KHR4JzRvD3uADAGe",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..80df52fe645--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 7200,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_9VY1UxiA1u2E4iwWriDWdKWb2",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $12.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentIntent.create.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentIntent.create.2.jsonnew file mode 100644index 00000000000..b43a4e06d9f--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentIntent.create.2.json@@ -0,0 +1,62 @@+{+ "amount": 36000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_4AXq7WiHGUXFdtcaeAHpf3UVs",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $60.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..9f073ef568f--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "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": null,+ "id": "pm_1JTq70A4KHR4JzRvJD7AOnGo",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentMethod.create.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentMethod.create.2.jsonnew file mode 100644index 00000000000..cb04cf60f6b--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--PaymentMethod.create.2.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "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": null,+ "id": "pm_1JTq7FA4KHR4JzRvD3uADAGe",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..7d55cff5dbd--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq71A4KHR4JzRvGNPaENVK_secret_K86JwqacIutOEOSjrEfAOZWcYc7BcSI",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq71A4KHR4JzRvGNPaENVK",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq71A4KHR4JzRvCn2k1wNg",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo",+ "payment_method_options": {+ "card": {+ "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/attach_discount_to_realm--SetupIntent.create.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.create.2.jsonnew file mode 100644index 00000000000..8199d516ab6--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.create.2.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7GA4KHR4JzRv01GUDkwn_secret_K86JHEXUhIQjgeL6YUOYbu78g7K1wgz",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7GA4KHR4JzRv01GUDkwn",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7GA4KHR4JzRvIxxtRvFQ",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7FA4KHR4JzRvD3uADAGe",+ "payment_method_options": {+ "card": {+ "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/attach_discount_to_realm--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..eaccbc4cd0a--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6zA4KHR4JzRv5oPqvFXV_secret_K86JgWJKzWddYfQ09PLQRh8OEFpsiRe",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6zA4KHR4JzRv5oPqvFXV",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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/attach_discount_to_realm--SetupIntent.list.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.list.2.jsonnew file mode 100644index 00000000000..70167a9125f--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.list.2.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7EA4KHR4JzRvnIlHU7L0_secret_K86JTEZqWx10YlEVyd9XMsLPbmFm2Qf",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7EA4KHR4JzRvnIlHU7L0",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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/attach_discount_to_realm--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..7d55cff5dbd--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq71A4KHR4JzRvGNPaENVK_secret_K86JwqacIutOEOSjrEfAOZWcYc7BcSI",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq71A4KHR4JzRvGNPaENVK",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq71A4KHR4JzRvCn2k1wNg",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq70A4KHR4JzRvJD7AOnGo",+ "payment_method_options": {+ "card": {+ "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/attach_discount_to_realm--SetupIntent.retrieve.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.retrieve.2.jsonnew file mode 100644index 00000000000..8199d516ab6--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--SetupIntent.retrieve.2.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7GA4KHR4JzRv01GUDkwn_secret_K86JHEXUhIQjgeL6YUOYbu78g7K1wgz",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7GA4KHR4JzRv01GUDkwn",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7GA4KHR4JzRvIxxtRvFQ",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7FA4KHR4JzRvD3uADAGe",+ "payment_method_options": {+ "card": {+ "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/attach_discount_to_realm--Token.create.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Token.create.1.jsondeleted file mode 100644index 60d47536e7c..00000000000--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Token.create.1.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1000000000,- "id": "tok_NORMALIZED00000000000001",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Token.create.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--Token.create.2.jsondeleted file mode 100644index bc7b308cf4c..00000000000--- a/corporate/tests/stripe_fixtures/attach_discount_to_realm--Token.create.2.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1000000000,- "id": "tok_NORMALIZED00000000000002",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..8c10457bee3--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01zoLVbq58FwDo05HkLqVDxh05uvFf4JyQbzhy7EsO6UjEnY",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq6zA4KHR4JzRv5oPqvFXV",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01zoLVbq58FwDo05HkLqVDxh05uvFf4JyQbzhy7EsO6UjEnY#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--checkout.Session.create.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--checkout.Session.create.2.jsonnew file mode 100644index 00000000000..fa46e9913c9--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--checkout.Session.create.2.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED02LW3lsSGGgkk9iQ4xg6bU2NH4WRGG5IaIhvrxKIhwvQAWP0",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq7EA4KHR4JzRvnIlHU7L0",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED02LW3lsSGGgkk9iQ4xg6bU2NH4WRGG5IaIhvrxKIhwvQAWP0#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..f355ece7930--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01zoLVbq58FwDo05HkLqVDxh05uvFf4JyQbzhy7EsO6UjEnY",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "1200",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq6zA4KHR4JzRv5oPqvFXV",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01zoLVbq58FwDo05HkLqVDxh05uvFf4JyQbzhy7EsO6UjEnY#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/attach_discount_to_realm--checkout.Session.list.2.json b/corporate/tests/stripe_fixtures/attach_discount_to_realm--checkout.Session.list.2.jsonnew file mode 100644index 00000000000..38026b06a6c--- /dev/null+++ b/corporate/tests/stripe_fixtures/attach_discount_to_realm--checkout.Session.list.2.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED02LW3lsSGGgkk9iQ4xg6bU2NH4WRGG5IaIhvrxKIhwvQAWP0",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "6000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq7EA4KHR4JzRvnIlHU7L0",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED02LW3lsSGGgkk9iQ4xg6bU2NH4WRGG5IaIhvrxKIhwvQAWP0#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--Charge.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Charge.create.1.jsondeleted file mode 100644index 3114f2b6137..00000000000--- a/corporate/tests/stripe_fixtures/billing_page_permissions--Charge.create.1.json+++ /dev/null@@ -1,117 +0,0 @@-{- "amount": 48000,- "amount_captured": 48000,- "amount_refunded": 0,- "application": null,- "application_fee": null,- "application_fee_amount": null,- "balance_transaction": "txn_NORMALIZED00000000000001",- "billing_details": {- "address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",- "line2": null,- "postal_code": "33333",- "state": null- },- "email": null,- "name": "Ada Starr",- "phone": null- },- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",- "captured": true,- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "description": "Upgrade to Zulip Standard, $80.0 x 6",- "destination": null,- "dispute": null,- "disputed": false,- "failure_code": null,- "failure_message": null,- "fraud_details": {},- "id": "ch_NORMALIZED00000000000001",- "invoice": null,- "livemode": false,- "metadata": {},- "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": null,- "payment_method": "card_NORMALIZED00000000000001",- "payment_method_details": {- "card": {- "brand": "visa",- "checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",- "cvc_check": "pass"- },- "country": "US",- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "installments": null,- "last4": "4242",- "network": "visa",- "three_d_secure": null,- "wallet": null- },- "type": "card"- },- "receipt_email": "[email protected]",- "receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",- "refunded": false,- "refunds": {- "data": [],- "has_more": false,- "object": "list",- "total_count": 0,- "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"- },- "review": null,- "shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "source_transfer": null,- "statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",- "status": "succeeded",- "transfer_data": null,- "transfer_group": null-}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.create.1.jsonindex 88d5c69190f..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.create.1.json+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.create.1.json@@ -3,7 +3,7 @@"balance": 0,"created": 1000000000,"currency": null,- "default_source": "card_NORMALIZED00000000000001",+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Customer.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.modify.1.jsonsimilarity index 92%rename from corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Customer.create.1.jsonrename to corporate/tests/stripe_fixtures/billing_page_permissions--Customer.modify.1.jsonindex 08de472be26..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Customer.create.1.json+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.modify.1.json@@ -3,7 +3,7 @@"balance": 0,"created": 1000000000,"currency": null,- "default_source": "card_NORMALIZED00000000000002",+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.modify.2.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.modify.2.jsonnew file mode 100644index 00000000000..f719fa6a9dc--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.retrieve.1.jsonindex 3d384443cbd..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.retrieve.1.json+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.retrieve.1.json@@ -2,32 +2,8 @@"address": null,"balance": 0,"created": 1000000000,- "currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "currency": null,+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -45,43 +21,10 @@"realm_str": "zulip"},"name": null,- "next_invoice_sequence": 2,+ "next_invoice_sequence": 1,"object": "customer","phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.retrieve.2.jsonindex 3d384443cbd..c440e51db26 100644--- a/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.retrieve.2.json+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.retrieve.2.json@@ -3,31 +3,7 @@"balance": 0,"created": 1000000000,"currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -36,7 +12,53 @@"invoice_prefix": "NORMA01","invoice_settings": {"custom_fields": null,- "default_payment_method": 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": 3,+ "exp_year": 2033,+ "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_1JTq6lA4KHR4JzRvP3jwXaxq",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },"footer": null},"livemode": false,@@ -50,38 +72,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.retrieve.3.jsonnew file mode 100644index 00000000000..c440e51db26--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--Customer.retrieve.3.json@@ -0,0 +1,76 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "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": 3,+ "exp_year": 2033,+ "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_1JTq6lA4KHR4JzRvP3jwXaxq",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 2,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--Event.list.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Event.list.1.jsonnew file mode 100644index 00000000000..b833bd470eb--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--Event.list.1.json@@ -0,0 +1,240 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 80697,+ "amount_paid": 0,+ "amount_remaining": 80697,+ "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_NORMALIZED0002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000016lvg5",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000016lvg5/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 7255,+ "currency": "usd",+ "description": "Additional license (Feb 5, 2013 - Jan 2, 2014)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1388631845,+ "start": 1360033445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 7255,+ "unit_amount_decimal": "7255"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": 56000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1388631845,+ "start": 1357095845+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 7,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": 17442,+ "currency": "usd",+ "description": "Additional license (Apr 11, 2012 - Jan 2, 2013)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1334113445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 5814,+ "unit_amount_decimal": "5814"+ },+ "proration": false,+ "quantity": 3,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 80697,+ "tax": null,+ "total": 80697,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq6hA4KHR4JzRvk0KY7bxM",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "4947a2ae-0c39-4c4d-b33b-56d18236fc9e"+ },+ "type": "invoice.finalized"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--Event.list.2.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Event.list.2.jsonnew file mode 100644index 00000000000..99d754822fb--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--Event.list.2.json@@ -0,0 +1,702 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_uEB0xxEN8swDrWnrBArdaWcxS",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq6jA4KHR4JzRv0KbCb1du",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "4d8e1a93-7832-4c86-9da5-3f8fc3415bde"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq6jA4KHR4JzRv0AFbJ5E3",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "4d8e1a93-7832-4c86-9da5-3f8fc3415bde"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTq6pA4KHR4JzRvbB6ucSWy",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "7076808f-b366-4769-a49e-6cc47bf245c8"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6mA4KHR4JzRvrvHpvikn_secret_K86JW3ygqxVHUvvPKcQli5exoUIfsPn",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6mA4KHR4JzRvrvHpvikn",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq6mA4KHR4JzRvSi3YRAAH",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq6nA4KHR4JzRvoQsMaTEs",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "90edbd03-5700-4972-9d55-c6241aa94461"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "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_1JTq6lA4KHR4JzRvP3jwXaxq",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq6mA4KHR4JzRvmWhTJ0Bk",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "90edbd03-5700-4972-9d55-c6241aa94461"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6mA4KHR4JzRvrvHpvikn_secret_K86JW3ygqxVHUvvPKcQli5exoUIfsPn",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6mA4KHR4JzRvrvHpvikn",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq6mA4KHR4JzRvSi3YRAAH",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq6mA4KHR4JzRvq9W8RJ9T",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "90edbd03-5700-4972-9d55-c6241aa94461"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6kA4KHR4JzRvwNeR6z0V_secret_K86JasH6AR9TILn78XCCnxhzoxyMIEO",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6kA4KHR4JzRvwNeR6z0V",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq6kA4KHR4JzRvkSlZUGEX",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "844785a2-316d-4ed5-9f19-f3e3f47b4088"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_uEB0xxEN8swDrWnrBArdaWcxS",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq6jA4KHR4JzRv0Aj4ums0",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "dd8d0f96-f2e5-4d0e-8859-447ea4cf25e0"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTq6jA4KHR4JzRvIJ0Jpblr",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "bdffcc3b-39f6-4430-8806-a84943f85d6d"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--Event.list.3.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Event.list.3.jsonnew file mode 100644index 00000000000..76b358d58c4--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--Event.list.3.json@@ -0,0 +1,1261 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000280j7F",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000280j7F/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq6uA4KHR4JzRvHrJlx11S",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "ec9c13e3-3653-4487-9495-bfb3f037ab7f"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000280j7F",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000280j7F/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq6uA4KHR4JzRvHfr9Oy3n",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "ec9c13e3-3653-4487-9495-bfb3f037ab7f"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000280j7F",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000280j7F/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq6uA4KHR4JzRvKxcgdsml",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "ec9c13e3-3653-4487-9495-bfb3f037ab7f"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000280j7F",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000280j7F/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1JTq6uA4KHR4JzRvdWDGmK0a",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "ec9c13e3-3653-4487-9495-bfb3f037ab7f"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq6tA4KHR4JzRvbinJ2EaZ",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "1be3abf2-cf88-426e-acec-02f6a46e64b2"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000005",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq6tA4KHR4JzRvnG5J2fme",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "1be3abf2-cf88-426e-acec-02f6a46e64b2"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000004",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq6tA4KHR4JzRvZDs7Ee7V",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "1be3abf2-cf88-426e-acec-02f6a46e64b2"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000004",+ "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",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ }+ },+ "id": "evt_1JTq6sA4KHR4JzRvRVXf9J8u",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "d42b9682-fd6f-4aa5-8ce1-7ab05f84afb6"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000005",+ "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",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ }+ },+ "id": "evt_1JTq6sA4KHR4JzRv0QX4TTVE",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "3d738cd9-2aec-4196-8818-b64ef20756b2"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JTq6sA4KHR4JzRv7xJJuf9D",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "3d738cd9-2aec-4196-8818-b64ef20756b2"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--Event.list.4.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Event.list.4.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--Event.list.4.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--Invoice.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Invoice.create.1.jsonindex 85ba0a34b97..5aa842d28d3 100644--- a/corporate/tests/stripe_fixtures/billing_page_permissions--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000001",+ "id": "in_NORMALIZED00000000000002","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000002",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0002",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,7 +134,7 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Invoice.finalize_invoice.1.jsonindex ccbab49cdf2..d0819634680 100644--- a/corporate/tests/stripe_fixtures/billing_page_permissions--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000015sJxq",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000015sJxq/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000280j7F",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000280j7F/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000002",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0002",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,12 +134,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": true,@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Invoice.list.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Invoice.list.1.jsonsimilarity index 100%rename from corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Invoice.list.1.jsonrename to corporate/tests/stripe_fixtures/billing_page_permissions--Invoice.list.1.jsondiff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--InvoiceItem.create.1.jsonindex f722b040756..2f190ee360e 100644--- a/corporate/tests/stripe_fixtures/billing_page_permissions--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--InvoiceItem.create.1.json@@ -6,7 +6,7 @@"description": "Payment (Card ending in 4242)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000002",+ "id": "ii_NORMALIZED00000000000005","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000002",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0002",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/billing_page_permissions--InvoiceItem.create.2.jsonindex 3f346515e5e..5216e893839 100644--- a/corporate/tests/stripe_fixtures/billing_page_permissions--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--InvoiceItem.create.2.json@@ -6,7 +6,7 @@"description": "Zulip Standard","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000001",+ "id": "ii_NORMALIZED00000000000004","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..937da92f77e--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--PaymentIntent.confirm.1.json@@ -0,0 +1,166 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_uEB0xxEN8swDrWnrBArdaWcxS",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..d9a70de3530--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_uEB0xxEN8swDrWnrBArdaWcxS",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..b896033a0d3--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "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": null,+ "id": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..c5f8f4bc6ba--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6mA4KHR4JzRvrvHpvikn_secret_K86JW3ygqxVHUvvPKcQli5exoUIfsPn",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6mA4KHR4JzRvrvHpvikn",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq6mA4KHR4JzRvSi3YRAAH",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "payment_method_options": {+ "card": {+ "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/billing_page_permissions--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..059cf61869d--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6kA4KHR4JzRvwNeR6z0V_secret_K86JasH6AR9TILn78XCCnxhzoxyMIEO",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6kA4KHR4JzRvwNeR6z0V",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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/billing_page_permissions--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..c5f8f4bc6ba--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6mA4KHR4JzRvrvHpvikn_secret_K86JW3ygqxVHUvvPKcQli5exoUIfsPn",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6mA4KHR4JzRvrvHpvikn",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq6mA4KHR4JzRvSi3YRAAH",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq6lA4KHR4JzRvP3jwXaxq",+ "payment_method_options": {+ "card": {+ "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/billing_page_permissions--Token.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--Token.create.1.jsondeleted file mode 100644index 60d47536e7c..00000000000--- a/corporate/tests/stripe_fixtures/billing_page_permissions--Token.create.1.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1000000000,- "id": "tok_NORMALIZED00000000000001",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..d14034aa685--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01cHilg8ji41h2QbrPhiScuswiAlPkEsUR4RJqK7AuLOfikn",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq6kA4KHR4JzRvwNeR6z0V",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01cHilg8ji41h2QbrPhiScuswiAlPkEsUR4RJqK7AuLOfikn#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..b4fe76a396c--- /dev/null+++ b/corporate/tests/stripe_fixtures/billing_page_permissions--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01cHilg8ji41h2QbrPhiScuswiAlPkEsUR4RJqK7AuLOfikn",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq6kA4KHR4JzRvwNeR6z0V",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01cHilg8ji41h2QbrPhiScuswiAlPkEsUR4RJqK7AuLOfikn#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Customer.create.1.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Customer.create.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Customer.create.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Customer.modify.1.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Customer.retrieve.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Customer.retrieve.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Event.list.1.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Event.list.1.jsonnew file mode 100644index 00000000000..73baa76565e--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Event.list.1.json@@ -0,0 +1,152 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 24000,+ "amount_paid": 0,+ "amount_remaining": 24000,+ "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_NORMALIZED0002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001A1tY0",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001A1tY0/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 24000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1388631845,+ "start": 1357095845+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 4000,+ "unit_amount_decimal": "4000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 24000,+ "tax": null,+ "total": 24000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq7UA4KHR4JzRvIV7w7Gm7",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "e614fe00-2fb2-4711-8d1c-bfe76fb67902"+ },+ "type": "invoice.finalized"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Event.list.2.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Event.list.2.jsonnew file mode 100644index 00000000000..32d8b5aeebe--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Event.list.2.json@@ -0,0 +1,353 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7ZA4KHR4JzRvKoHGUZ4R_secret_K86KqPKeVoLQcDacIc6WefFx7JiiLNU",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7ZA4KHR4JzRvKoHGUZ4R",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7ZA4KHR4JzRvGClaMCcE",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7YA4KHR4JzRvxrCAGzvl",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq7aA4KHR4JzRvND5z29VH",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "619d91e8-b79f-4adc-886f-8cc41092f329"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "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_1JTq7YA4KHR4JzRvxrCAGzvl",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq7aA4KHR4JzRv1u2aVxfO",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "619d91e8-b79f-4adc-886f-8cc41092f329"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7ZA4KHR4JzRvKoHGUZ4R_secret_K86KqPKeVoLQcDacIc6WefFx7JiiLNU",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7ZA4KHR4JzRvKoHGUZ4R",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7ZA4KHR4JzRvGClaMCcE",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7YA4KHR4JzRvxrCAGzvl",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq7aA4KHR4JzRvZ39jaKwm",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "619d91e8-b79f-4adc-886f-8cc41092f329"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7XA4KHR4JzRvEqDBiz9a_secret_K86KhiSu3gN9pL3q2zcSNHxyV2tkgIr",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7XA4KHR4JzRvEqDBiz9a",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq7YA4KHR4JzRvO5wUjZrb",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "e9b0e410-779c-4cbd-b58b-15d9db65de2a"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_n57BTvra91BWVZvEHM2WVXFGy",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq7XA4KHR4JzRv1OPD4jZj",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "f72078f6-e698-45b4-8735-4e5cc1f29413"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTq7WA4KHR4JzRvpDvduAF5",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "febec2f5-61e7-4f28-9344-05f11484e803"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Event.list.3.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Event.list.3.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--Event.list.3.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..ea1d968b514--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_n57BTvra91BWVZvEHM2WVXFGy",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..74fc6d196a8--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "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": null,+ "id": "pm_1JTq7YA4KHR4JzRvxrCAGzvl",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..87bff9179dc--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7ZA4KHR4JzRvKoHGUZ4R_secret_K86KqPKeVoLQcDacIc6WefFx7JiiLNU",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7ZA4KHR4JzRvKoHGUZ4R",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7ZA4KHR4JzRvGClaMCcE",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7YA4KHR4JzRvxrCAGzvl",+ "payment_method_options": {+ "card": {+ "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/checkout_session_completed_with_uncaught_exception--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..86e4f1eea19--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7XA4KHR4JzRvEqDBiz9a_secret_K86KhiSu3gN9pL3q2zcSNHxyV2tkgIr",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7XA4KHR4JzRvEqDBiz9a",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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/checkout_session_completed_with_uncaught_exception--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..87bff9179dc--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7ZA4KHR4JzRvKoHGUZ4R_secret_K86KqPKeVoLQcDacIc6WefFx7JiiLNU",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7ZA4KHR4JzRvKoHGUZ4R",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7ZA4KHR4JzRvGClaMCcE",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7YA4KHR4JzRvxrCAGzvl",+ "payment_method_options": {+ "card": {+ "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/checkout_session_completed_with_uncaught_exception--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..9222b55b169--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01SeDXTXQq7DK7QsX0tHNYKz3hA41pDiw0GVEX6carKtyyzN",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq7XA4KHR4JzRvEqDBiz9a",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01SeDXTXQq7DK7QsX0tHNYKz3hA41pDiw0GVEX6carKtyyzN#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..ad09f5c111a--- /dev/null+++ b/corporate/tests/stripe_fixtures/checkout_session_completed_with_uncaught_exception--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01SeDXTXQq7DK7QsX0tHNYKz3hA41pDiw0GVEX6carKtyyzN",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq7XA4KHR4JzRvEqDBiz9a",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01SeDXTXQq7DK7QsX0tHNYKz3hA41pDiw0GVEX6carKtyyzN#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.create.1.json b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.create.1.jsonnew file mode 100644index 00000000000..276fd1f723d--- /dev/null+++ b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.create.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.create.2.json b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.create.2.jsonnew file mode 100644index 00000000000..7012aaf5c49--- /dev/null+++ b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.create.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0002",+ "invoice_prefix": "NORMA02",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.modify.1.json b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.modify.1.jsonnew file mode 100644index 00000000000..276fd1f723d--- /dev/null+++ b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.modify.2.json b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.modify.2.jsonnew file mode 100644index 00000000000..bf7e9bc779d--- /dev/null+++ b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0002",+ "invoice_prefix": "NORMA02",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JPM8CA4KHR4JzRvJB86Fwmq",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.retrieve.1.jsonnew file mode 100644index 00000000000..276fd1f723d--- /dev/null+++ b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.retrieve.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.retrieve.2.jsonnew file mode 100644index 00000000000..33c14cad90c--- /dev/null+++ b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--Customer.retrieve.2.json@@ -0,0 +1,76 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0002",+ "invoice_prefix": "NORMA02",+ "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": 3,+ "exp_year": 2033,+ "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_NORMALIZED0002",+ "id": "pm_1JPM8CA4KHR4JzRvJB86Fwmq",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..6047abb07ec--- /dev/null+++ b/corporate/tests/stripe_fixtures/customer_has_credit_card_as_default_payment_method--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "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": null,+ "id": "pm_1JPM8CA4KHR4JzRvJB86Fwmq",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.1.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.1.jsonindex f63271c60e8..d7e1b014823 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.1.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.1.json@@ -5,9 +5,9 @@"currency": null,"default_source": null,"delinquent": false,- "description": "realm_341283 (None)",+ "description": "realm_399409 (None)","discount": null,- "email": "[email protected]",+ "email": "[email protected]","id": "cus_NORMALIZED0001","invoice_prefix": "NORMA01","invoice_settings": {@@ -18,7 +18,7 @@"livemode": false,"metadata": {"realm_id": "1",- "realm_str": "realm_341283"+ "realm_str": "realm_399409"},"name": null,"next_invoice_sequence": 1,diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.2.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.2.jsonindex 6ca54b638a5..57e941561f7 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.2.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.2.json@@ -5,9 +5,9 @@"currency": null,"default_source": null,"delinquent": false,- "description": "realm_747106 (None)",+ "description": "realm_572697 (None)","discount": null,- "email": "[email protected]",+ "email": "[email protected]","id": "cus_NORMALIZED0002","invoice_prefix": "NORMA02","invoice_settings": {@@ -18,7 +18,7 @@"livemode": false,"metadata": {"realm_id": "2",- "realm_str": "realm_747106"+ "realm_str": "realm_572697"},"name": null,"next_invoice_sequence": 1,diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.3.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.3.jsonindex 0c1332d0ea7..9fd57b6c8b5 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.3.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.3.json@@ -5,9 +5,9 @@"currency": null,"default_source": null,"delinquent": false,- "description": "realm_384957 (None)",+ "description": "realm_662230 (None)","discount": null,- "email": "[email protected]",+ "email": "[email protected]","id": "cus_NORMALIZED0003","invoice_prefix": "NORMA03","invoice_settings": {@@ -18,7 +18,7 @@"livemode": false,"metadata": {"realm_id": "3",- "realm_str": "realm_384957"+ "realm_str": "realm_662230"},"name": null,"next_invoice_sequence": 1,diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.4.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.4.jsonindex 1051e7c089f..0423c43d3d1 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.4.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.4.json@@ -5,9 +5,9 @@"currency": null,"default_source": null,"delinquent": false,- "description": "realm_765764 (None)",+ "description": "realm_71132 (None)","discount": null,- "email": "[email protected]",+ "email": "[email protected]","id": "cus_NORMALIZED0004","invoice_prefix": "NORMA04","invoice_settings": {@@ -18,7 +18,7 @@"livemode": false,"metadata": {"realm_id": "4",- "realm_str": "realm_765764"+ "realm_str": "realm_71132"},"name": null,"next_invoice_sequence": 1,diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.5.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.5.jsonindex 3f1ae85c506..3aa541f146f 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.5.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.5.json@@ -5,9 +5,9 @@"currency": null,"default_source": null,"delinquent": false,- "description": "realm_810625 (None)",+ "description": "realm_191086 (None)","discount": null,- "email": "[email protected]",+ "email": "[email protected]","id": "cus_NORMALIZED0005","invoice_prefix": "NORMA05","invoice_settings": {@@ -18,7 +18,7 @@"livemode": false,"metadata": {"realm_id": "5",- "realm_str": "realm_810625"+ "realm_str": "realm_191086"},"name": null,"next_invoice_sequence": 1,diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.6.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.6.jsonindex acfd679ee60..cfe5d918734 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.6.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.6.json@@ -5,9 +5,9 @@"currency": null,"default_source": null,"delinquent": false,- "description": "realm_404452 (None)",+ "description": "realm_971149 (None)","discount": null,- "email": "[email protected]",+ "email": "[email protected]","id": "cus_NORMALIZED0006","invoice_prefix": "NORMA06","invoice_settings": {@@ -18,7 +18,7 @@"livemode": false,"metadata": {"realm_id": "6",- "realm_str": "realm_404452"+ "realm_str": "realm_971149"},"name": null,"next_invoice_sequence": 1,diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.7.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.7.jsonindex 38fae9994b3..80338a38fac 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.7.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.create.7.json@@ -5,9 +5,9 @@"currency": null,"default_source": null,"delinquent": false,- "description": "realm_752184 (None)",+ "description": "realm_204386 (None)","discount": null,- "email": "[email protected]",+ "email": "[email protected]","id": "cus_NORMALIZED0007","invoice_prefix": "NORMA07","invoice_settings": {@@ -18,7 +18,7 @@"livemode": false,"metadata": {"realm_id": "7",- "realm_str": "realm_752184"+ "realm_str": "realm_204386"},"name": null,"next_invoice_sequence": 1,diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.1.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.1.jsonnew file mode 100644index 00000000000..d7e1b014823--- /dev/null+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "realm_399409 (None)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "realm_399409"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.2.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.2.jsonnew file mode 100644index 00000000000..57e941561f7--- /dev/null+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "realm_572697 (None)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0002",+ "invoice_prefix": "NORMA02",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "2",+ "realm_str": "realm_572697"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.3.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.3.jsonnew file mode 100644index 00000000000..9fd57b6c8b5--- /dev/null+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.3.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "realm_662230 (None)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0003",+ "invoice_prefix": "NORMA03",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "3",+ "realm_str": "realm_662230"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.4.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.4.jsonnew file mode 100644index 00000000000..0423c43d3d1--- /dev/null+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.4.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "realm_71132 (None)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0004",+ "invoice_prefix": "NORMA04",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "4",+ "realm_str": "realm_71132"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.5.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.5.jsonnew file mode 100644index 00000000000..3aa541f146f--- /dev/null+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.5.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "realm_191086 (None)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0005",+ "invoice_prefix": "NORMA05",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "5",+ "realm_str": "realm_191086"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.6.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.6.jsonnew file mode 100644index 00000000000..cfe5d918734--- /dev/null+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.6.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "realm_971149 (None)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0006",+ "invoice_prefix": "NORMA06",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "6",+ "realm_str": "realm_971149"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.7.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.7.jsonnew file mode 100644index 00000000000..80338a38fac--- /dev/null+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Customer.modify.7.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "realm_204386 (None)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0007",+ "invoice_prefix": "NORMA07",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "7",+ "realm_str": "realm_204386"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.1.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.1.jsonindex ae1ec0d48c9..deb259d0f4b 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0002","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.2.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.2.jsonindex 501d74354aa..966b564ad72 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.2.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0004","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.3.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.3.jsonindex b84bed282fe..a0aadaff91f 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.3.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.3.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0005","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.4.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.4.jsonindex c04d682b1c6..12ad79c1dec 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.4.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.4.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0005","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.5.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.5.jsonindex eb462ce9db7..559ce340bee 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.5.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.5.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0006","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.6.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.6.jsonindex 29639e13c9a..df88ba7b349 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.6.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.6.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0006","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.7.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.7.jsonindex d258cf50b19..dc865c8c79a 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.7.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.7.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0007","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.8.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.8.jsonindex a10b430768d..3a1c96c5169 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.8.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.create.8.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0007","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0008","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.1.jsonindex fb22c30cfed..06da33bad58 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0002","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001FnfOy",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001LGFI5","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001FnfOy/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001LGFI5/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.2.jsonindex d8d7d3d95ce..cc23cec2def 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.2.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0004","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002fYsO7",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002umHHd","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002fYsO7/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002umHHd/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.3.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.3.jsonindex 5b8b7b041ff..f8c6a760665 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.3.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.3.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0005","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003Bhq0y",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003WyPjd","id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003Bhq0y/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003WyPjd/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.4.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.4.jsonindex e6ab3fec6a7..403196d3bf0 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.4.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.4.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0005","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004J6xR5",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004OHkqr","id": "in_NORMALIZED00000000000004",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004J6xR5/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004OHkqr/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.5.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.5.jsonindex 487a759fe6c..a0ed79b75d0 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.5.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.5.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0006","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005ncBbj",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005ML0me","id": "in_NORMALIZED00000000000005",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005ncBbj/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005ML0me/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.6.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.6.jsonindex db680e9c6b1..6ba3bd41b3a 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.6.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.6.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0006","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000006nZ4k4",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000062S6Lr","id": "in_NORMALIZED00000000000006",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000006nZ4k4/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000062S6Lr/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.7.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.7.jsonindex db334ba810a..ba44642c569 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.7.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.7.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0007","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000079nVn3",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000007hgg8k","id": "in_NORMALIZED00000000000007",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000079nVn3/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000007hgg8k/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.8.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.8.jsonindex 93014d80dae..dcf86528483 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.8.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.finalize_invoice.8.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0007","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000008qCFwv",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000008V4GB8","id": "in_NORMALIZED00000000000008",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000008qCFwv/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000008V4GB8/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0008","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.2.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.2.jsonindex 921882725e9..be95f07c8c8 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.2.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.2.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -23,7 +23,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0002","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001FnfOy",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001LGFI5","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001FnfOy/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001LGFI5/pdf","last_finalization_error": null,"lines": {"data": [@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.4.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.4.jsonindex dd3f830d77b..92baa3ea01a 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.4.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.4.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -23,7 +23,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0004","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002fYsO7",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002umHHd","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002fYsO7/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002umHHd/pdf","last_finalization_error": null,"lines": {"data": [@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.5.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.5.jsonindex 1d1d5443b14..d80c13fbeea 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.5.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.5.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -23,7 +23,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0005","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004J6xR5",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004OHkqr","id": "in_NORMALIZED00000000000004",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004J6xR5/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004OHkqr/pdf","last_finalization_error": null,"lines": {"data": [@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -131,7 +132,7 @@},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -152,7 +153,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0005","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -167,9 +168,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003Bhq0y",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003WyPjd","id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003Bhq0y/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003WyPjd/pdf","last_finalization_error": null,"lines": {"data": [@@ -203,6 +204,7 @@"object": "price","product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.6.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.6.jsonindex 5acf97e8cc2..eb457eafe6d 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.6.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.list.6.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -23,7 +23,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0006","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000006nZ4k4",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000062S6Lr","id": "in_NORMALIZED00000000000006",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000006nZ4k4/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000062S6Lr/pdf","last_finalization_error": null,"lines": {"data": [@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -131,7 +132,7 @@},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -152,7 +153,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0006","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -167,9 +168,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005ncBbj",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005ML0me","id": "in_NORMALIZED00000000000005",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005ncBbj/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005ML0me/pdf","last_finalization_error": null,"lines": {"data": [@@ -203,6 +204,7 @@"object": "price","product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.pay.1.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.pay.1.jsonindex 85369738aae..5f7d8235c2c 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.pay.1.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.pay.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0006","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005ncBbj",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005ML0me","id": "in_NORMALIZED00000000000005",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005ncBbj/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005ML0me/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.pay.2.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.pay.2.jsonindex ed53f260f91..3a8c0a9006f 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.pay.2.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--Invoice.pay.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 10000,"amount_paid": 0,@@ -21,7 +21,7 @@"custom_fields": null,"customer": "cus_NORMALIZED0006","customer_address": null,- "customer_email": "[email protected]",+ "customer_email": "[email protected]","customer_name": null,"customer_phone": null,"customer_shipping": null,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000006nZ4k4",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000062S6Lr","id": "in_NORMALIZED00000000000006",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000006nZ4k4/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000062S6Lr/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.1.jsonindex ff63b3bfc09..d3c8790ad88 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.1.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.2.jsonindex b8e465e2899..9fa167b85e6 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.2.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.3.jsonindex 55df81f3db9..3390812d4ee 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.3.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.3.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.4.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.4.jsonindex 9d82becfe2b..1a446dc59b6 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.4.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.4.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.5.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.5.jsonindex 9542efa345c..1a28d8fdb51 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.5.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.5.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.6.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.6.jsonindex a7b8d4c32b5..86fae43b57e 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.6.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.6.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.7.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.7.jsonindex 77122d33f7a..aeedf287a28 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.7.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.7.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.8.json b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.8.jsonindex d37c9bcea0b..25b729e93e2 100644--- a/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.8.json+++ b/corporate/tests/stripe_fixtures/downgrade_small_realms_behind_on_payments_as_needed--InvoiceItem.create.8.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0008","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/fixed_price_plans--Customer.modify.1.json b/corporate/tests/stripe_fixtures/fixed_price_plans--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/fixed_price_plans--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/fixed_price_plans--Event.list.1.json b/corporate/tests/stripe_fixtures/fixed_price_plans--Event.list.1.jsonnew file mode 100644index 00000000000..cd2719e4a5f--- /dev/null+++ b/corporate/tests/stripe_fixtures/fixed_price_plans--Event.list.1.json@@ -0,0 +1,66 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "ach_credit_transfer": {+ "account_number": "test_NORMALIZED01",+ "bank_name": "TEST BANK",+ "fingerprint": "NORMALIZED000001",+ "refund_account_holder_name": null,+ "refund_account_holder_type": null,+ "refund_routing_number": null,+ "routing_number": "110000000",+ "swift_code": "TSTEZ122"+ },+ "amount": null,+ "client_secret": "src_client_secret_NORMALIZED00000000000001",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0002",+ "flow": "receiver",+ "id": "src_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "source",+ "owner": {+ "address": null,+ "email": "[email protected]",+ "name": null,+ "phone": null,+ "verified_address": null,+ "verified_email": null,+ "verified_name": null,+ "verified_phone": null+ },+ "receiver": {+ "address": "000000000-test_NORMALIZED01",+ "amount_charged": 0,+ "amount_received": 0,+ "amount_returned": 0,+ "refund_attributes_method": "email",+ "refund_attributes_status": "missing"+ },+ "statement_descriptor": null,+ "status": "pending",+ "type": "ach_credit_transfer",+ "usage": "reusable"+ }+ },+ "id": "evt_1JTksiA4KHR4JzRvGXn3efLA",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": null,+ "idempotency_key": null+ },+ "type": "customer.source.created"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.create.1.json b/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.create.1.jsonindex 6cf3eb01e25..e89fe74bef0 100644--- a/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.create.2.json b/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.create.2.jsonindex 2c7d1773a56..69427515f82 100644--- a/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.create.2.json+++ b/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.create.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 100,"amount_paid": 0,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.finalize_invoice.1.jsonindex 330d8fb2413..f1e661c7a44 100644--- a/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001SGgJs",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001wB0Gj","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001SGgJs/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001wB0Gj/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.finalize_invoice.2.jsonindex c93e2e5e606..6b79b1c132a 100644--- a/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.finalize_invoice.2.json+++ b/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.finalize_invoice.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 100,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000248qeQ",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AWJqo","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000248qeQ/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AWJqo/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.list.1.json b/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.list.1.jsonindex 2d609e9ebc1..b5926dbfe0e 100644--- a/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.list.1.json+++ b/corporate/tests/stripe_fixtures/fixed_price_plans--Invoice.list.1.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 100,"amount_paid": 0,@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000248qeQ",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AWJqo","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000248qeQ/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AWJqo/pdf","last_finalization_error": null,"lines": {"data": [@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -131,7 +132,7 @@},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -167,9 +168,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001SGgJs",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001wB0Gj","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001SGgJs/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001wB0Gj/pdf","last_finalization_error": null,"lines": {"data": [@@ -203,6 +204,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/fixed_price_plans--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/fixed_price_plans--InvoiceItem.create.1.jsonindex 9f60bb15ae0..d540294d68f 100644--- a/corporate/tests/stripe_fixtures/fixed_price_plans--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/fixed_price_plans--InvoiceItem.create.1.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/fixed_price_plans--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/fixed_price_plans--InvoiceItem.create.2.jsonindex 47eac324e8d..0750a8f1239 100644--- a/corporate/tests/stripe_fixtures/fixed_price_plans--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/fixed_price_plans--InvoiceItem.create.2.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.create.1.jsonindex c039b422a4d..51ee3ff9762 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.create.1.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.create.1.json@@ -3,7 +3,7 @@"balance": 0,"created": 1010000001,"currency": null,- "default_source": "card_NORMALIZED00000000000001",+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.modify.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.modify.1.jsonnew file mode 100644index 00000000000..51ee3ff9762--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.modify.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.modify.2.jsonnew file mode 100644index 00000000000..e52387a94e2--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq7gA4KHR4JzRvBR2wjpRg",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.1.jsonindex 3c8c2ea0a06..51ee3ff9762 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.1.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.1.json@@ -3,31 +3,7 @@"balance": 0,"created": 1010000001,"currency": null,- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -50,38 +26,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.2.jsonindex 3c8c2ea0a06..44d17b8a33e 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.2.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.2.json@@ -3,31 +3,7 @@"balance": 0,"created": 1010000001,"currency": null,- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -36,7 +12,53 @@"invoice_prefix": "NORMA01","invoice_settings": {"custom_fields": null,- "default_payment_method": 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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000002,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq7gA4KHR4JzRvBR2wjpRg",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },"footer": null},"livemode": false,@@ -50,38 +72,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.3.jsonindex 3c8c2ea0a06..44d17b8a33e 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.3.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.3.json@@ -3,31 +3,7 @@"balance": 0,"created": 1010000001,"currency": null,- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -36,7 +12,53 @@"invoice_prefix": "NORMA01","invoice_settings": {"custom_fields": null,- "default_payment_method": 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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000002,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq7gA4KHR4JzRvBR2wjpRg",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },"footer": null},"livemode": false,@@ -50,38 +72,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.4.jsonnew file mode 100644index 00000000000..44d17b8a33e--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Customer.retrieve.4.json@@ -0,0 +1,76 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000002,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq7gA4KHR4JzRvBR2wjpRg",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Event.list.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Event.list.1.jsonnew file mode 100644index 00000000000..00c48d87c97--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Event.list.1.json@@ -0,0 +1,61 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1010000003,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7ZA4KHR4JzRvKoHGUZ4R_secret_K86KqPKeVoLQcDacIc6WefFx7JiiLNU",+ "created": 1010000004,+ "customer": "cus_NORMALIZED0002",+ "description": null,+ "id": "seti_1JTq7ZA4KHR4JzRvKoHGUZ4R",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7ZA4KHR4JzRvGClaMCcE",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7YA4KHR4JzRvxrCAGzvl",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq7aA4KHR4JzRvND5z29VH",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "619d91e8-b79f-4adc-886f-8cc41092f329"+ },+ "type": "setup_intent.succeeded"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Event.list.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Event.list.2.jsonnew file mode 100644index 00000000000..72bf397f8f8--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Event.list.2.json@@ -0,0 +1,326 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1010000005,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq7gA4KHR4JzRvBR2wjpRg",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTq7kA4KHR4JzRvg3kcPeh7",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "bad0c4ee-058d-4614-ae09-d8e3e708bd1f"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000006,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7hA4KHR4JzRv02EYBK4G_secret_K86KOpSwG3eOtZxvUSTcWWmttnEArJH",+ "created": 1010000007,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7hA4KHR4JzRv02EYBK4G",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7hA4KHR4JzRvwDDLURxh",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7gA4KHR4JzRvBR2wjpRg",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq7iA4KHR4JzRvljbmDKUr",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "1dde6602-dac8-4361-9513-461f6d6ffc22"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000006,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000002,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq7gA4KHR4JzRvBR2wjpRg",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq7iA4KHR4JzRvvso6P4v3",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "1dde6602-dac8-4361-9513-461f6d6ffc22"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000007,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7hA4KHR4JzRv02EYBK4G_secret_K86KOpSwG3eOtZxvUSTcWWmttnEArJH",+ "created": 1010000007,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7hA4KHR4JzRv02EYBK4G",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7hA4KHR4JzRvwDDLURxh",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7gA4KHR4JzRvBR2wjpRg",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq7iA4KHR4JzRvZRSLlwqV",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "1dde6602-dac8-4361-9513-461f6d6ffc22"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000008,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7fA4KHR4JzRvUMlBwgqI_secret_K86KUw7g97GR7KyeBr0JoCFux9CljZy",+ "created": 1010000008,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7fA4KHR4JzRvUMlBwgqI",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq7fA4KHR4JzRvJ884tquR",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "e53f2aaa-9047-44b6-82c9-6873e3b11412"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000001,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTq7eA4KHR4JzRvp16gXCgi",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "f57db8c6-97e8-4861-bb0e-972440c53ac2"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Event.list.3.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Event.list.3.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Event.list.3.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.create.1.jsonindex af437c2a5f1..5e8bb14e771 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 120000,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000002,+ "created": 1010000009,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -62,7 +62,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000002,+ "created": 1010000010,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.create.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.create.2.jsonindex 373239ea1ce..3fc50f211ff 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.create.2.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.create.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 5172,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000003,+ "created": 1010000011,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -62,7 +62,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000012,"currency": "usd","id": "price_NORMALIZED00000000000002","livemode": false,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.create.3.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.create.3.jsonindex 77c8cd4b55a..f98b2de5198 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.create.3.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.create.3.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 152000,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000005,+ "created": 1010000013,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -62,7 +62,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000006,+ "created": 1010000014,"currency": "usd","id": "price_NORMALIZED00000000000003","livemode": false,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.finalize_invoice.1.jsonindex 92f0358037b..c87fbfe6994 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 120000,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000002,+ "created": 1010000009,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001kJlNF",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001fbJZV","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001kJlNF/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001fbJZV/pdf","last_finalization_error": null,"lines": {"data": [@@ -62,7 +62,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000002,+ "created": 1010000010,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.finalize_invoice.2.jsonindex e04a6bd8fdc..e79825b5ee6 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.finalize_invoice.2.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.finalize_invoice.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 5172,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000003,+ "created": 1010000011,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nlvXf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002d6T46","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nlvXf/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002d6T46/pdf","last_finalization_error": null,"lines": {"data": [@@ -62,7 +62,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000012,"currency": "usd","id": "price_NORMALIZED00000000000002","livemode": false,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.finalize_invoice.3.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.finalize_invoice.3.jsonindex 5770e26e917..90996bf11fb 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.finalize_invoice.3.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.finalize_invoice.3.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 152000,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000005,+ "created": 1010000013,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003tSAyS",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003OQw56","id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003tSAyS/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003OQw56/pdf","last_finalization_error": null,"lines": {"data": [@@ -62,7 +62,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000006,+ "created": 1010000014,"currency": "usd","id": "price_NORMALIZED00000000000003","livemode": false,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.3.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.3.jsonindex b94a420468e..e39960ab725 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.3.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.3.json@@ -1,135 +1,5 @@{- "data": [- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 120000,- "amount_paid": 0,- "amount_remaining": 120000,- "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": 1010000002,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001kJlNF",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001kJlNF/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 120000,- "currency": "usd",- "description": "Zulip Standard - renewal",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1362193445,- "start": 1330657445- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1010000002,- "currency": "usd",- "id": "price_NORMALIZED00000000000001",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0001",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 8000,- "unit_amount_decimal": "8000"- },- "proration": false,- "quantity": 15,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": 1000000000,- "number": "NORMALI-0001",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 120000,- "tax": null,- "total": 120000,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- }- ],+ "data": [],"has_more": false,"object": "list","url": "/v1/invoices"diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.4.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.4.jsonindex b94a420468e..8e54d71c2bd 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.4.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.4.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 120000,"amount_paid": 0,@@ -18,7 +18,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000002,+ "created": 1010000009,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -38,9 +38,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001kJlNF",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001fbJZV","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001kJlNF/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001fbJZV/pdf","last_finalization_error": null,"lines": {"data": [@@ -64,7 +64,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000002,+ "created": 1010000010,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -127,7 +128,7 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}],"has_more": false,diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.5.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.5.jsonindex ee24773fedd..8e54d71c2bd 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.5.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.5.json@@ -2,136 +2,7 @@"data": [{"account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 5172,- "amount_paid": 0,- "amount_remaining": 5172,- "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": 1010000003,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nlvXf",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nlvXf/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 5172,- "currency": "usd",- "description": "Additional license (Jan 2, 2013 - Mar 2, 2013)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1362193445,- "start": 1357095845- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1010000004,- "currency": "usd",- "id": "price_NORMALIZED00000000000002",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0002",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 1293,- "unit_amount_decimal": "1293"- },- "proration": false,- "quantity": 4,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": 1000000000,- "number": "NORMALI-0002",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000002",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 5172,- "tax": null,- "total": 5172,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- },- {- "account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 120000,"amount_paid": 0,@@ -147,7 +18,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000002,+ "created": 1010000009,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -167,9 +38,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001kJlNF",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001fbJZV","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001kJlNF/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001fbJZV/pdf","last_finalization_error": null,"lines": {"data": [@@ -193,7 +64,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000002,+ "created": 1010000010,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -203,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -256,7 +128,7 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}],"has_more": false,diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.6.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.6.jsonindex ee545e2f4be..f9aaed9fe9f 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.6.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.6.json@@ -2,136 +2,7 @@"data": [{"account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 152000,- "amount_paid": 0,- "amount_remaining": 152000,- "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": 1010000005,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003tSAyS",- "id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003tSAyS/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 152000,- "currency": "usd",- "description": "Zulip Standard - renewal",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1393729445,- "start": 1362193445- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1010000006,- "currency": "usd",- "id": "price_NORMALIZED00000000000003",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0003",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 8000,- "unit_amount_decimal": "8000"- },- "proration": false,- "quantity": 19,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": 1000000000,- "number": "NORMALI-0003",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000003",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 152000,- "tax": null,- "total": 152000,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- },- {- "account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 5172,"amount_paid": 0,@@ -147,7 +18,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000003,+ "created": 1010000011,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -167,9 +38,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nlvXf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002d6T46","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nlvXf/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002d6T46/pdf","last_finalization_error": null,"lines": {"data": [@@ -193,7 +64,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000012,"currency": "usd","id": "price_NORMALIZED00000000000002","livemode": false,@@ -203,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -256,11 +128,11 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 120000,"amount_paid": 0,@@ -276,7 +148,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000002,+ "created": 1010000009,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -296,9 +168,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001kJlNF",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001fbJZV","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001kJlNF/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001fbJZV/pdf","last_finalization_error": null,"lines": {"data": [@@ -322,7 +194,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000002,+ "created": 1010000010,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -332,6 +204,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.7.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.7.jsonnew file mode 100644index 00000000000..479fc3995dd--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Invoice.list.7.json@@ -0,0 +1,397 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 152000,+ "amount_paid": 0,+ "amount_remaining": 152000,+ "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": 1010000013,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003OQw56",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003OQw56/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 152000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1393729445,+ "start": 1362193445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000014,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 19,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000003",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 152000,+ "tax": null,+ "total": 152000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 5172,+ "amount_paid": 0,+ "amount_remaining": 5172,+ "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": 1010000011,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002d6T46",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002d6T46/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 5172,+ "currency": "usd",+ "description": "Additional license (Jan 2, 2013 - Mar 2, 2013)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1362193445,+ "start": 1357095845+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000012,+ "currency": "usd",+ "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": 1293,+ "unit_amount_decimal": "1293"+ },+ "proration": false,+ "quantity": 4,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 5172,+ "tax": null,+ "total": 5172,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 120000,+ "amount_paid": 0,+ "amount_remaining": 120000,+ "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": 1010000009,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001fbJZV",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001fbJZV/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 120000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1362193445,+ "start": 1330657445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000010,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 15,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 120000,+ "tax": null,+ "total": 120000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--InvoiceItem.create.1.jsonindex 4bcd7ddb1e4..849efbbe5ea 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--InvoiceItem.create.1.json@@ -19,7 +19,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000002,+ "created": 1010000010,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--InvoiceItem.create.2.jsonindex bf335063955..dae1f3d951f 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--InvoiceItem.create.2.json@@ -19,7 +19,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000012,"currency": "usd","id": "price_NORMALIZED00000000000002","livemode": false,@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--InvoiceItem.create.3.jsonindex 451eb3a7187..5925b55f2ce 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--InvoiceItem.create.3.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--InvoiceItem.create.3.json@@ -19,7 +19,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000006,+ "created": 1010000014,"currency": "usd","id": "price_NORMALIZED00000000000003","livemode": false,@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..8ef3a9ca9ed--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000002,+ "customer": null,+ "id": "pm_1JTq7gA4KHR4JzRvBR2wjpRg",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..cb1464e7f1e--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7hA4KHR4JzRv02EYBK4G_secret_K86KOpSwG3eOtZxvUSTcWWmttnEArJH",+ "created": 1010000007,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7hA4KHR4JzRv02EYBK4G",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7hA4KHR4JzRvwDDLURxh",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7gA4KHR4JzRvBR2wjpRg",+ "payment_method_options": {+ "card": {+ "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/free_trial_upgrade_by_card--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..344e290fe07--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7fA4KHR4JzRvUMlBwgqI_secret_K86KUw7g97GR7KyeBr0JoCFux9CljZy",+ "created": 1010000008,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7fA4KHR4JzRvUMlBwgqI",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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/free_trial_upgrade_by_card--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..cb1464e7f1e--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq7hA4KHR4JzRv02EYBK4G_secret_K86KOpSwG3eOtZxvUSTcWWmttnEArJH",+ "created": 1010000007,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq7hA4KHR4JzRv02EYBK4G",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq7hA4KHR4JzRvwDDLURxh",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq7gA4KHR4JzRvBR2wjpRg",+ "payment_method_options": {+ "card": {+ "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/free_trial_upgrade_by_card--Token.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Token.create.1.jsondeleted file mode 100644index 1d208a83a96..00000000000--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--Token.create.1.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1010000007,- "id": "tok_NORMALIZED00000000000001",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..c9b77c7d5df--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01v9vL5fxb98RRvO0SlLYd9HIVwPD8czZ560vWO8LY66S9jl",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq7fA4KHR4JzRvUMlBwgqI",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01v9vL5fxb98RRvO0SlLYd9HIVwPD8czZ560vWO8LY66S9jl#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..e0086a60928--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01v9vL5fxb98RRvO0SlLYd9HIVwPD8czZ560vWO8LY66S9jl",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq7fA4KHR4JzRvUMlBwgqI",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01v9vL5fxb98RRvO0SlLYd9HIVwPD8czZ560vWO8LY66S9jl#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Charge.list.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Charge.list.1.jsonnew file mode 100644index 00000000000..75910611cf3--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Charge.list.1.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/charges"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.create.1.jsonnew file mode 100644index 00000000000..51ee3ff9762--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.create.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.modify.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.modify.1.jsonnew file mode 100644index 00000000000..51ee3ff9762--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.modify.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.modify.2.jsonnew file mode 100644index 00000000000..b6433c01a21--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq83A4KHR4JzRvxZurlFUp",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.retrieve.1.jsonnew file mode 100644index 00000000000..51ee3ff9762--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.retrieve.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.retrieve.2.jsonnew file mode 100644index 00000000000..56a8dbabf1e--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Customer.retrieve.2.json@@ -0,0 +1,76 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000002,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq83A4KHR4JzRvxZurlFUp",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Event.list.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Event.list.1.jsonnew file mode 100644index 00000000000..37db4f3c534--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Event.list.1.json@@ -0,0 +1,152 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1010000003,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 152000,+ "amount_paid": 0,+ "amount_remaining": 152000,+ "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": 1010000004,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001OQw56",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001OQw56/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 152000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1393729445,+ "start": 1362193445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000005,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 19,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 152000,+ "tax": null,+ "total": 152000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq7zA4KHR4JzRvHyRQ43Ai",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "b5111419-dc10-4354-bc59-9fab2090b2f6"+ },+ "type": "invoice.finalized"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Event.list.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Event.list.2.jsonnew file mode 100644index 00000000000..c5e2ce5b96c--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Event.list.2.json@@ -0,0 +1,326 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1010000006,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq83A4KHR4JzRvxZurlFUp",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTq87A4KHR4JzRvFDevaVGA",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "ab11848e-d930-47d3-9de4-b196fa17c2de"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000007,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq84A4KHR4JzRvJ9Ip3AzB_secret_K86KcR1kRUBTcdsi9opHybjCceyOOYy",+ "created": 1010000008,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq84A4KHR4JzRvJ9Ip3AzB",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq84A4KHR4JzRvKK0EXIlH",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq83A4KHR4JzRvxZurlFUp",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq85A4KHR4JzRvBYbTGVkj",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "5af94a7e-2c74-431e-be73-8e8db23c4026"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000007,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000002,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq83A4KHR4JzRvxZurlFUp",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq85A4KHR4JzRvalpv9WDK",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "5af94a7e-2c74-431e-be73-8e8db23c4026"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000008,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq84A4KHR4JzRvJ9Ip3AzB_secret_K86KcR1kRUBTcdsi9opHybjCceyOOYy",+ "created": 1010000008,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq84A4KHR4JzRvJ9Ip3AzB",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq84A4KHR4JzRvKK0EXIlH",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq83A4KHR4JzRvxZurlFUp",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq85A4KHR4JzRvHBDJLdQP",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "5af94a7e-2c74-431e-be73-8e8db23c4026"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000009,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq82A4KHR4JzRvNZqEnPCt_secret_K86KHu3ARsUzpI4S0MqZ5wkhfKXiGcB",+ "created": 1010000009,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq82A4KHR4JzRvNZqEnPCt",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq83A4KHR4JzRvEy61kLZo",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "0c9c1379-b895-4104-a236-79d479aa33a2"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000001,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTq81A4KHR4JzRvQkiZN52S",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "ceb523e9-9eb3-4964-a86d-4321af0872de"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Event.list.3.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Event.list.3.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Event.list.3.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Invoice.list.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Invoice.list.1.jsonnew file mode 100644index 00000000000..e39960ab725--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Invoice.list.1.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Invoice.list.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Invoice.list.2.jsonnew file mode 100644index 00000000000..e39960ab725--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--Invoice.list.2.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..c20ae2f6412--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000002,+ "customer": null,+ "id": "pm_1JTq83A4KHR4JzRvxZurlFUp",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..9c55dc0d3ba--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq84A4KHR4JzRvJ9Ip3AzB_secret_K86KcR1kRUBTcdsi9opHybjCceyOOYy",+ "created": 1010000008,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq84A4KHR4JzRvJ9Ip3AzB",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq84A4KHR4JzRvKK0EXIlH",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq83A4KHR4JzRvxZurlFUp",+ "payment_method_options": {+ "card": {+ "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/free_trial_upgrade_by_card_from_onboarding_page--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..0af8ab0afe9--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq82A4KHR4JzRvNZqEnPCt_secret_K86KHu3ARsUzpI4S0MqZ5wkhfKXiGcB",+ "created": 1010000009,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq82A4KHR4JzRvNZqEnPCt",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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/free_trial_upgrade_by_card_from_onboarding_page--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..9c55dc0d3ba--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq84A4KHR4JzRvJ9Ip3AzB_secret_K86KcR1kRUBTcdsi9opHybjCceyOOYy",+ "created": 1010000008,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq84A4KHR4JzRvJ9Ip3AzB",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq84A4KHR4JzRvKK0EXIlH",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq83A4KHR4JzRvxZurlFUp",+ "payment_method_options": {+ "card": {+ "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/free_trial_upgrade_by_card_from_onboarding_page--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..c924b79b307--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01vKcdTdwFTKsAGwStax4jbLfc6zN3v25Z5LMNomm6VpyQAX",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq82A4KHR4JzRvNZqEnPCt",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01vKcdTdwFTKsAGwStax4jbLfc6zN3v25Z5LMNomm6VpyQAX#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..249dbc7cba7--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_card_from_onboarding_page--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01vKcdTdwFTKsAGwStax4jbLfc6zN3v25Z5LMNomm6VpyQAX",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq82A4KHR4JzRvNZqEnPCt",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01vKcdTdwFTKsAGwStax4jbLfc6zN3v25Z5LMNomm6VpyQAX#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Customer.modify.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Customer.modify.1.jsonnew file mode 100644index 00000000000..51ee3ff9762--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Customer.retrieve.1.jsonindex 30370206ffe..51ee3ff9762 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Customer.retrieve.1.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Customer.retrieve.1.json@@ -26,12 +26,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [],- "has_more": false,- "object": "list",- "total_count": 0,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Customer.retrieve.2.jsonindex 30370206ffe..51ee3ff9762 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Customer.retrieve.2.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Customer.retrieve.2.json@@ -26,12 +26,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [],- "has_more": false,- "object": "list",- "total_count": 0,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Event.list.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Event.list.1.jsonnew file mode 100644index 00000000000..9f32954a45b--- /dev/null+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Event.list.1.json@@ -0,0 +1,57 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1010000002,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1010000003,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0002",+ "invoice_prefix": "NORMA02",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JPM9CA4KHR4JzRv4KuI30k9",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JPM9FA4KHR4JzRvk63PYn7e",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "5074f0fc-33ba-4485-ae97-ae0df6653350"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.create.1.jsonindex 4535a89e76b..98e254cac41 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "send_invoice",- "created": 1010000002,+ "created": 1010000004,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -62,7 +62,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000003,+ "created": 1010000005,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.create.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.create.2.jsonindex 9ccd8e54955..ecb89408350 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.create.2.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.create.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "send_invoice",- "created": 1010000004,+ "created": 1010000006,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -62,7 +62,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000005,+ "created": 1010000007,"currency": "usd","id": "price_NORMALIZED00000000000002","livemode": false,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.finalize_invoice.1.jsonindex c45c92e79b3..ec241a9fcc4 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "send_invoice",- "created": 1010000002,+ "created": 1010000004,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001tmvZS",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001PYikB","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001tmvZS/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001PYikB/pdf","last_finalization_error": null,"lines": {"data": [@@ -62,7 +62,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000003,+ "created": 1010000005,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.finalize_invoice.2.jsonindex bd56f48ae25..54c0fd43927 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.finalize_invoice.2.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.finalize_invoice.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "send_invoice",- "created": 1010000004,+ "created": 1010000006,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002MbjN2",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002debTS","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002MbjN2/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002debTS/pdf","last_finalization_error": null,"lines": {"data": [@@ -62,7 +62,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000005,+ "created": 1010000007,"currency": "usd","id": "price_NORMALIZED00000000000002","livemode": false,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.2.jsonindex 3813de7d75f..9209ebd4907 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.2.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.2.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -18,7 +18,7 @@"billing_reason": "manual","charge": null,"collection_method": "send_invoice",- "created": 1010000002,+ "created": 1010000004,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001tmvZS",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001PYikB","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001tmvZS/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001PYikB/pdf","last_finalization_error": null,"lines": {"data": [@@ -64,7 +64,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000003,+ "created": 1010000005,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.3.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.3.jsonindex 3813de7d75f..9209ebd4907 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.3.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.3.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -18,7 +18,7 @@"billing_reason": "manual","charge": null,"collection_method": "send_invoice",- "created": 1010000002,+ "created": 1010000004,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001tmvZS",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001PYikB","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001tmvZS/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001PYikB/pdf","last_finalization_error": null,"lines": {"data": [@@ -64,7 +64,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000003,+ "created": 1010000005,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.4.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.4.jsonindex 3813de7d75f..9209ebd4907 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.4.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.4.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -18,7 +18,7 @@"billing_reason": "manual","charge": null,"collection_method": "send_invoice",- "created": 1010000002,+ "created": 1010000004,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001tmvZS",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001PYikB","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001tmvZS/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001PYikB/pdf","last_finalization_error": null,"lines": {"data": [@@ -64,7 +64,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000003,+ "created": 1010000005,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.5.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.5.jsonindex f2f15dab0f5..d37717e2caa 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.5.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--Invoice.list.5.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -18,7 +18,7 @@"billing_reason": "manual","charge": null,"collection_method": "send_invoice",- "created": 1010000004,+ "created": 1010000006,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002MbjN2",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002debTS","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002MbjN2/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002debTS/pdf","last_finalization_error": null,"lines": {"data": [@@ -64,7 +64,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000005,+ "created": 1010000007,"currency": "usd","id": "price_NORMALIZED00000000000002","livemode": false,@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -131,7 +132,7 @@},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -147,7 +148,7 @@"billing_reason": "manual","charge": null,"collection_method": "send_invoice",- "created": 1010000002,+ "created": 1010000004,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -167,9 +168,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001tmvZS",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001PYikB","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001tmvZS/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001PYikB/pdf","last_finalization_error": null,"lines": {"data": [@@ -193,7 +194,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000003,+ "created": 1010000005,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -203,6 +204,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--InvoiceItem.create.1.jsonindex 2c6207a72d0..e5cec67ec49 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--InvoiceItem.create.1.json@@ -19,7 +19,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000003,+ "created": 1010000005,"currency": "usd","id": "price_NORMALIZED00000000000001","livemode": false,@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--InvoiceItem.create.2.jsonindex fcd766ca2e8..03f42671652 100644--- a/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/free_trial_upgrade_by_invoice--InvoiceItem.create.2.json@@ -19,7 +19,7 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000005,+ "created": 1010000007,"currency": "usd","id": "price_NORMALIZED00000000000002","livemode": false,@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Charge.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Charge.create.1.jsondeleted file mode 100644index 3114f2b6137..00000000000--- a/corporate/tests/stripe_fixtures/invoice_plan--Charge.create.1.json+++ /dev/null@@ -1,117 +0,0 @@-{- "amount": 48000,- "amount_captured": 48000,- "amount_refunded": 0,- "application": null,- "application_fee": null,- "application_fee_amount": null,- "balance_transaction": "txn_NORMALIZED00000000000001",- "billing_details": {- "address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",- "line2": null,- "postal_code": "33333",- "state": null- },- "email": null,- "name": "Ada Starr",- "phone": null- },- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",- "captured": true,- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "description": "Upgrade to Zulip Standard, $80.0 x 6",- "destination": null,- "dispute": null,- "disputed": false,- "failure_code": null,- "failure_message": null,- "fraud_details": {},- "id": "ch_NORMALIZED00000000000001",- "invoice": null,- "livemode": false,- "metadata": {},- "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": null,- "payment_method": "card_NORMALIZED00000000000001",- "payment_method_details": {- "card": {- "brand": "visa",- "checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",- "cvc_check": "pass"- },- "country": "US",- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "installments": null,- "last4": "4242",- "network": "visa",- "three_d_secure": null,- "wallet": null- },- "type": "card"- },- "receipt_email": "[email protected]",- "receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",- "refunded": false,- "refunds": {- "data": [],- "has_more": false,- "object": "list",- "total_count": 0,- "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"- },- "review": null,- "shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "source_transfer": null,- "statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",- "status": "succeeded",- "transfer_data": null,- "transfer_group": null-}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Customer.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Customer.create.1.jsonindex 88d5c69190f..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/invoice_plan--Customer.create.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plan--Customer.create.1.json@@ -3,7 +3,7 @@"balance": 0,"created": 1000000000,"currency": null,- "default_source": "card_NORMALIZED00000000000001",+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Customer.modify.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Customer.modify.2.json b/corporate/tests/stripe_fixtures/invoice_plan--Customer.modify.2.jsonnew file mode 100644index 00000000000..d80b8ec0747--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq6RA4KHR4JzRvdXEzoYlE",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Customer.retrieve.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--Customer.retrieve.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Event.list.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.1.jsonnew file mode 100644index 00000000000..8233fbbba3f--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.1.json@@ -0,0 +1,196 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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_NORMALIZED0002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 184000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -184000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -184000,+ "unit_amount_decimal": "-184000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq2xA4KHR4JzRvO3ETmYHw",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "2fd351b7-11e2-42f5-98a7-94de6887c731"+ },+ "type": "invoice.payment_succeeded"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Event.list.2.json b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.2.jsonnew file mode 100644index 00000000000..2e18a39be0c--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.2.json@@ -0,0 +1,702 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq6RA4KHR4JzRvdXEzoYlE",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_un6xCROZ30zl6GBCbxffPDX47",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq6RA4KHR4JzRvdXEzoYlE",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq6PA4KHR4JzRv0YSCFoal",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "a55ab8a2-9d3d-4716-a533-8d947527dea5"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq6RA4KHR4JzRvdXEzoYlE",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq6PA4KHR4JzRv04KmQRyX",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "a55ab8a2-9d3d-4716-a533-8d947527dea5"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq6RA4KHR4JzRvdXEzoYlE",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTq6VA4KHR4JzRvCSBJ4U43",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "29bff82d-2538-48c8-bdd7-f589aa802f5a"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6SA4KHR4JzRvNzAqTD3c_secret_K86Jf76WwxFTspBr2xL68ZwxrRowJzd",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6SA4KHR4JzRvNzAqTD3c",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq6TA4KHR4JzRvMK73QFkx",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq6RA4KHR4JzRvdXEzoYlE",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq6TA4KHR4JzRvbcd0j1lu",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "8eecb6fa-8366-4891-8ac3-6c8d45b5e6ee"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "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_1JTq6RA4KHR4JzRvdXEzoYlE",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq6TA4KHR4JzRv30R45tUB",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "8eecb6fa-8366-4891-8ac3-6c8d45b5e6ee"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6SA4KHR4JzRvNzAqTD3c_secret_K86Jf76WwxFTspBr2xL68ZwxrRowJzd",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6SA4KHR4JzRvNzAqTD3c",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq6TA4KHR4JzRvMK73QFkx",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq6RA4KHR4JzRvdXEzoYlE",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq6TA4KHR4JzRv7PPIfd43",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "8eecb6fa-8366-4891-8ac3-6c8d45b5e6ee"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6PA4KHR4JzRvTYLELLgl_secret_K86JQpqjgZ0znxnw94IgRxWZLtEwBiU",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6PA4KHR4JzRvTYLELLgl",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq6QA4KHR4JzRvbIuQKbvw",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "0377ec1f-4b84-4a5e-acfb-6aa4529498ed"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_un6xCROZ30zl6GBCbxffPDX47",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq6PA4KHR4JzRv0W3JReT8",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "b3d6c9a7-998b-415e-a069-e19391a6742e"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTq6OA4KHR4JzRvbPx1T9XS",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "934abcf2-e034-4e56-b1d5-10b16736dd14"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Event.list.3.json b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.3.jsonnew file mode 100644index 00000000000..8cb9fbab742--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.3.json@@ -0,0 +1,1261 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002WcDZF",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002WcDZF/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq6cA4KHR4JzRvRtVBx4En",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "6592bfe7-2652-4b10-b037-5227b94f66cd"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002WcDZF",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002WcDZF/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq6cA4KHR4JzRvi3aLAOm6",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "6592bfe7-2652-4b10-b037-5227b94f66cd"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002WcDZF",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002WcDZF/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq6cA4KHR4JzRvrxnQg98e",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "6592bfe7-2652-4b10-b037-5227b94f66cd"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002WcDZF",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002WcDZF/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1JTq6cA4KHR4JzRvwYvmpy2A",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "6592bfe7-2652-4b10-b037-5227b94f66cd"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq6bA4KHR4JzRvUVfLNeK0",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "409c8cb2-15f5-4da9-a2a8-256077764230"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000004",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq6bA4KHR4JzRvZY1gmiLa",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "409c8cb2-15f5-4da9-a2a8-256077764230"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000003",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq6bA4KHR4JzRvsdh4NmcL",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "409c8cb2-15f5-4da9-a2a8-256077764230"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000003",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ }+ },+ "id": "evt_1JTq6aA4KHR4JzRvR2P3pWw8",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "8a032b8b-e553-4b4a-b51a-dfcbecefd793"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000004",+ "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",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ }+ },+ "id": "evt_1JTq6ZA4KHR4JzRvXIN696Ta",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "a4d9e8d5-5d41-4660-95ee-f6b75c4d7b5a"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq6RA4KHR4JzRvdXEzoYlE",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JTq6ZA4KHR4JzRvhwHMHIzD",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "a4d9e8d5-5d41-4660-95ee-f6b75c4d7b5a"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Event.list.4.json b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.4.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.4.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.1.jsonindex 46ffedbaae8..c4b16585fef 100644--- a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000001",+ "id": "in_NORMALIZED00000000000002","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000002",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0002",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,7 +134,7 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.2.json b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.2.jsonindex 21fa5ade81a..138e6b4625f 100644--- a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.2.json+++ b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 80697,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000002",+ "id": "in_NORMALIZED00000000000003","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000006","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -135,8 +137,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000005",- "invoice_item": "ii_NORMALIZED00000000000005",+ "id": "il_NORMALIZED00000000000007",+ "invoice_item": "ii_NORMALIZED00000000000007","livemode": false,"metadata": {},"object": "line_item",@@ -150,14 +152,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000005",+ "id": "price_NORMALIZED00000000000007","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0005",+ "product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -175,7 +178,7 @@"has_more": false,"object": "list","total_count": 3,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},@@ -211,5 +214,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.1.jsonindex 9ddaf8d9b21..2c7c2da5194 100644--- a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001GKuTy",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001GKuTy/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002WcDZF",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002WcDZF/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000002",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0002",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,12 +134,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": true,@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.2.jsonindex 448311ac243..f0a66f5f504 100644--- a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.2.json+++ b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 80697,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002cca5R",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002cca5R/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000036lvg5",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000036lvg5/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000006","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -135,8 +137,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000005",- "invoice_item": "ii_NORMALIZED00000000000005",+ "id": "il_NORMALIZED00000000000007",+ "invoice_item": "ii_NORMALIZED00000000000007","livemode": false,"metadata": {},"object": "line_item",@@ -150,14 +152,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000005",+ "id": "price_NORMALIZED00000000000007","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0005",+ "product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -175,16 +178,16 @@"has_more": false,"object": "list","total_count": 3,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0002",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000002","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -211,5 +214,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.list.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.list.1.jsonindex c3c27415e8a..e39960ab725 100644--- a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.list.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.list.1.json@@ -1,393 +1,5 @@{- "data": [- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 80697,- "amount_paid": 0,- "amount_remaining": 80697,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002cca5R",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002cca5R/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 7255,- "currency": "usd",- "description": "Additional license (Feb 5, 2013 - Jan 2, 2014)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1388631845,- "start": 1360033445- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000003",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0003",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 7255,- "unit_amount_decimal": "7255"- },- "proration": false,- "quantity": 1,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- },- {- "amount": 56000,- "currency": "usd",- "description": "Zulip Standard - renewal",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1388631845,- "start": 1357095845- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000004",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0004",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 8000,- "unit_amount_decimal": "8000"- },- "proration": false,- "quantity": 7,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- },- {- "amount": 17442,- "currency": "usd",- "description": "Additional license (Apr 11, 2012 - Jan 2, 2013)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000005",- "invoice_item": "ii_NORMALIZED00000000000005",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1357095845,- "start": 1334113445- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000005",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0005",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 5814,- "unit_amount_decimal": "5814"- },- "proration": false,- "quantity": 3,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 3,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": 1000000000,- "number": "NORMALI-0002",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 80697,- "tax": null,- "total": 80697,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- },- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 0,- "amount_paid": 0,- "amount_remaining": 0,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001GKuTy",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001GKuTy/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 48000,- "currency": "usd",- "description": "Zulip Standard",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1357095845,- "start": 1325473445- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000001",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0001",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 8000,- "unit_amount_decimal": "8000"- },- "proration": false,- "quantity": 6,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- },- {- "amount": -48000,- "currency": "usd",- "description": "Payment (Card ending in 4242)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1000000000,- "start": 1000000000- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000002",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0002",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": -48000,- "unit_amount_decimal": "-48000"- },- "proration": false,- "quantity": 1,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": null,- "number": "NORMALI-0001",- "object": "invoice",- "on_behalf_of": null,- "paid": true,- "payment_intent": null,- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "paid",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": 1000000000,- "voided_at": null- },- "subscription": null,- "subtotal": 0,- "tax": null,- "total": 0,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- }- ],+ "data": [],"has_more": false,"object": "list","url": "/v1/invoices"diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.list.2.json b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.list.2.jsonnew file mode 100644index 00000000000..ffb0b877b53--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.list.2.json@@ -0,0 +1,399 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 80697,+ "amount_paid": 0,+ "amount_remaining": 80697,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000036lvg5",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000036lvg5/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 7255,+ "currency": "usd",+ "description": "Additional license (Feb 5, 2013 - Jan 2, 2014)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1388631845,+ "start": 1360033445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 7255,+ "unit_amount_decimal": "7255"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": 56000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1388631845,+ "start": 1357095845+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000006",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0006",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 7,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": 17442,+ "currency": "usd",+ "description": "Additional license (Apr 11, 2012 - Jan 2, 2013)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000007",+ "invoice_item": "ii_NORMALIZED00000000000007",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1334113445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000007",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0007",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 5814,+ "unit_amount_decimal": "5814"+ },+ "proration": false,+ "quantity": 3,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0004",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 80697,+ "tax": null,+ "total": 80697,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002WcDZF",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002WcDZF/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.1.jsonindex f722b040756..799c067780d 100644--- a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.1.json@@ -6,7 +6,7 @@"description": "Payment (Card ending in 4242)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000002",+ "id": "ii_NORMALIZED00000000000004","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000002",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0002",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.2.jsonindex 9ed190192f5..8bdd309a064 100644--- a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.2.json@@ -6,7 +6,7 @@"description": "Zulip Standard","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000001",+ "id": "ii_NORMALIZED00000000000003","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.3.jsonindex 3658be4b0bd..fbe3749ee40 100644--- a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.3.json+++ b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.3.json@@ -6,7 +6,7 @@"description": "Additional license (Apr 11, 2012 - Jan 2, 2013)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000005",+ "id": "ii_NORMALIZED00000000000007","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000005",+ "id": "price_NORMALIZED00000000000007","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0005",+ "product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.4.json b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.4.jsonindex 56f0e3dffd8..2233e6ea270 100644--- a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.4.json+++ b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.4.json@@ -6,7 +6,7 @@"description": "Zulip Standard - renewal","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000004",+ "id": "ii_NORMALIZED00000000000006","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000006","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.5.json b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.5.jsonindex 63d5c133335..c409bb5b0fc 100644--- a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.5.json+++ b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.5.json@@ -6,7 +6,7 @@"description": "Additional license (Feb 5, 2013 - Jan 2, 2014)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000003",+ "id": "ii_NORMALIZED00000000000005","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/invoice_plan--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/invoice_plan--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..d0228560e09--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--PaymentIntent.confirm.1.json@@ -0,0 +1,166 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq6RA4KHR4JzRvdXEzoYlE",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_un6xCROZ30zl6GBCbxffPDX47",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq6RA4KHR4JzRvdXEzoYlE",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..696686fba91--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_un6xCROZ30zl6GBCbxffPDX47",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..25855fb428e--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "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": null,+ "id": "pm_1JTq6RA4KHR4JzRvdXEzoYlE",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..8ac15e73882--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6SA4KHR4JzRvNzAqTD3c_secret_K86Jf76WwxFTspBr2xL68ZwxrRowJzd",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6SA4KHR4JzRvNzAqTD3c",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq6TA4KHR4JzRvMK73QFkx",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq6RA4KHR4JzRvdXEzoYlE",+ "payment_method_options": {+ "card": {+ "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/invoice_plan--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/invoice_plan--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..2a482888c15--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6PA4KHR4JzRvTYLELLgl_secret_K86JQpqjgZ0znxnw94IgRxWZLtEwBiU",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6PA4KHR4JzRvTYLELLgl",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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/invoice_plan--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/invoice_plan--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..8ac15e73882--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq6SA4KHR4JzRvNzAqTD3c_secret_K86Jf76WwxFTspBr2xL68ZwxrRowJzd",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq6SA4KHR4JzRvNzAqTD3c",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq6TA4KHR4JzRvMK73QFkx",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq6RA4KHR4JzRvdXEzoYlE",+ "payment_method_options": {+ "card": {+ "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/invoice_plan--Token.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Token.create.1.jsondeleted file mode 100644index 60d47536e7c..00000000000--- a/corporate/tests/stripe_fixtures/invoice_plan--Token.create.1.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1000000000,- "id": "tok_NORMALIZED00000000000001",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..3d53d0d7f71--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01CE1CJmDbcwUHJx71bXicTd6oRnlwGRJzoUHgXKJvQqaD7A",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq6PA4KHR4JzRvTYLELLgl",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01CE1CJmDbcwUHJx71bXicTd6oRnlwGRJzoUHgXKJvQqaD7A#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..bf521bd2630--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01CE1CJmDbcwUHJx71bXicTd6oRnlwGRJzoUHgXKJvQqaD7A",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq6PA4KHR4JzRvTYLELLgl",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01CE1CJmDbcwUHJx71bXicTd6oRnlwGRJzoUHgXKJvQqaD7A#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Customer.create.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Customer.create.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Customer.create.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Customer.modify.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Customer.modify.2.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Customer.modify.2.jsonnew file mode 100644index 00000000000..fa7faf791f0--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Customer.retrieve.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Customer.retrieve.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Event.list.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Event.list.1.jsonnew file mode 100644index 00000000000..e047faa70a0--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Event.list.1.json@@ -0,0 +1,57 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0002",+ "invoice_prefix": "NORMA02",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq83A4KHR4JzRvxZurlFUp",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTq87A4KHR4JzRvFDevaVGA",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "ab11848e-d930-47d3-9de4-b196fa17c2de"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Event.list.2.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Event.list.2.jsonnew file mode 100644index 00000000000..27616dfc5a9--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Event.list.2.json@@ -0,0 +1,702 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_1OOXeQTEcrsuD7SV3hJ0o6Wma",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq8DA4KHR4JzRv1ZdIve0r",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "646330c4-73e6-4e8c-bedd-ce984fe681fb"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq8DA4KHR4JzRv1VLWveOM",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "646330c4-73e6-4e8c-bedd-ce984fe681fb"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTq8IA4KHR4JzRvl7o61FSE",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "03fdb684-989d-4751-b819-4804de28c8d7"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8FA4KHR4JzRvhhZKDLtU_secret_K86KGPUd3c82tOqsHiySKxBjYknXkIE",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8FA4KHR4JzRvhhZKDLtU",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq8FA4KHR4JzRvvJfoMjkz",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq8GA4KHR4JzRv2hs7vohT",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "a92fa037-cb41-4afc-b3bf-c79b78852845"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "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_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq8GA4KHR4JzRvjB7TJMAz",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "a92fa037-cb41-4afc-b3bf-c79b78852845"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8FA4KHR4JzRvhhZKDLtU_secret_K86KGPUd3c82tOqsHiySKxBjYknXkIE",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8FA4KHR4JzRvhhZKDLtU",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq8FA4KHR4JzRvvJfoMjkz",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq8GA4KHR4JzRv5AxbabWA",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "a92fa037-cb41-4afc-b3bf-c79b78852845"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8DA4KHR4JzRvlqNYzOw3_secret_K86KrCShpY15vRzz2uUtXdgF8PLSrSX",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8DA4KHR4JzRvlqNYzOw3",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq8DA4KHR4JzRvAW36i2X6",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "988fc708-25fb-49b1-b81f-2a7b8bb61a84"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_1OOXeQTEcrsuD7SV3hJ0o6Wma",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq8DA4KHR4JzRv1gwIJPyC",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "57798c93-6028-405c-a075-2a6582fe9ce6"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTq8CA4KHR4JzRvhkVCYCWW",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "a661cd93-1312-41ad-a70c-6215bf380424"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Event.list.3.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Event.list.3.jsonnew file mode 100644index 00000000000..e63ce667f3a--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Event.list.3.json@@ -0,0 +1,115 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ }+ },+ "id": "evt_1JTq8MA4KHR4JzRvocq2zO4V",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "a1f05100-8dda-4aa0-b408-69b3af3268fc"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JTq8LA4KHR4JzRvj0eFGKWF",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "a1f05100-8dda-4aa0-b408-69b3af3268fc"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Event.list.4.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Event.list.4.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Event.list.4.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Invoice.list.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Invoice.list.1.jsonnew file mode 100644index 00000000000..e39960ab725--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--Invoice.list.1.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--InvoiceItem.create.1.jsonnew file mode 100644index 00000000000..46db7c3adf5--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--InvoiceItem.create.1.json@@ -0,0 +1,45 @@+{+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..71b92d5eda0--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--PaymentIntent.confirm.1.json@@ -0,0 +1,166 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_1OOXeQTEcrsuD7SV3hJ0o6Wma",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..cdbd0ffbc6c--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_1OOXeQTEcrsuD7SV3hJ0o6Wma",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..f98b80c2472--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "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": null,+ "id": "pm_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..eba3d1771b1--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8FA4KHR4JzRvhhZKDLtU_secret_K86KGPUd3c82tOqsHiySKxBjYknXkIE",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8FA4KHR4JzRvhhZKDLtU",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq8FA4KHR4JzRvvJfoMjkz",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "payment_method_options": {+ "card": {+ "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/payment_intent_succeeded_event_with_uncaught_exception--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..cc8dc0ecc0a--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8DA4KHR4JzRvlqNYzOw3_secret_K86KrCShpY15vRzz2uUtXdgF8PLSrSX",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8DA4KHR4JzRvlqNYzOw3",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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/payment_intent_succeeded_event_with_uncaught_exception--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..eba3d1771b1--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8FA4KHR4JzRvhhZKDLtU_secret_K86KGPUd3c82tOqsHiySKxBjYknXkIE",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8FA4KHR4JzRvhhZKDLtU",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq8FA4KHR4JzRvvJfoMjkz",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8EA4KHR4JzRvxKmoXvNQ",+ "payment_method_options": {+ "card": {+ "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/payment_intent_succeeded_event_with_uncaught_exception--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..052d0579470--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED019U5VX4xlXJ1VL1BCoGBhjiINwVuQUTqFRUPEKjVMYFLDYD",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq8DA4KHR4JzRvlqNYzOw3",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED019U5VX4xlXJ1VL1BCoGBhjiINwVuQUTqFRUPEKjVMYFLDYD#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..9839553b2ba--- /dev/null+++ b/corporate/tests/stripe_fixtures/payment_intent_succeeded_event_with_uncaught_exception--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED019U5VX4xlXJ1VL1BCoGBhjiINwVuQUTqFRUPEKjVMYFLDYD",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq8DA4KHR4JzRvlqNYzOw3",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED019U5VX4xlXJ1VL1BCoGBhjiINwVuQUTqFRUPEKjVMYFLDYD#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Customer.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.create.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.create.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Customer.modify.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Customer.modify.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.modify.2.jsonnew file mode 100644index 00000000000..61faac9cbcf--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq8RA4KHR4JzRvAizme7g0",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Customer.modify.3.json b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.modify.3.jsonnew file mode 100644index 00000000000..d2af8c0a9c1--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.modify.3.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 3,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Customer.modify.4.json b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.modify.4.jsonnew file mode 100644index 00000000000..ab55014b7c3--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.modify.4.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": true,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq8uA4KHR4JzRvEAD4kqfy",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 3,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.2.jsonnew file mode 100644index 00000000000..c77f9f89c0a--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq8RA4KHR4JzRvAizme7g0",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 3,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.3.jsonnew file mode 100644index 00000000000..7913fab0d2e--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.3.json@@ -0,0 +1,76 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": true,+ "description": "zulip (Zulip Dev)",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 3,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.save.3.json b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.4.jsonsimilarity index 92%rename from corporate/tests/stripe_fixtures/replace_payment_source--Customer.save.3.jsonrename to corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.4.jsonindex 19028c05db0..af343089f5c 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.save.3.json+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.4.json@@ -3,7 +3,7 @@"balance": 0,"created": 1000000000,"currency": "usd",- "default_source": "card_NORMALIZED00000000000003",+ "default_source": null,"delinquent": true,"description": "zulip (Zulip Dev)","discount": null,diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.save.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.5.jsonsimilarity index 88%rename from corporate/tests/stripe_fixtures/replace_payment_source--Customer.save.2.jsonrename to corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.5.jsonindex a985aa0445e..af343089f5c 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.save.2.json+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.5.json@@ -3,8 +3,8 @@"balance": 0,"created": 1000000000,"currency": "usd",- "default_source": "card_NORMALIZED00000000000002",- "delinquent": false,+ "default_source": null,+ "delinquent": true,"description": "zulip (Zulip Dev)","discount": null,"email": "[email protected]",diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.6.json b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.6.jsonnew file mode 100644index 00000000000..fe815919559--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Customer.retrieve.6.json@@ -0,0 +1,76 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "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": "mastercard",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "generated_from": null,+ "last4": "4444",+ "networks": {+ "available": [+ "mastercard"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq8uA4KHR4JzRvEAD4kqfy",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 3,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Event.list.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--Event.list.1.jsonnew file mode 100644index 00000000000..c898d34f752--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Event.list.1.json@@ -0,0 +1,67 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0002",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ }+ },+ "id": "evt_1JTq8MA4KHR4JzRvocq2zO4V",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "a1f05100-8dda-4aa0-b408-69b3af3268fc"+ },+ "type": "invoiceitem.created"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Event.list.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--Event.list.2.jsonnew file mode 100644index 00000000000..8b09ebbbdec--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Event.list.2.json@@ -0,0 +1,702 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq8RA4KHR4JzRvAizme7g0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_Bj9Yr8Tt6C1yOwIgDuGD9wwO8",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8RA4KHR4JzRvAizme7g0",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq8PA4KHR4JzRv10S0dsU4",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "b62836e3-d4c8-4775-a204-0e51600a4401"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq8RA4KHR4JzRvAizme7g0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq8PA4KHR4JzRv1tMjez7L",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "b62836e3-d4c8-4775-a204-0e51600a4401"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq8RA4KHR4JzRvAizme7g0",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTq8VA4KHR4JzRvSpwUcx1A",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "e96798d9-cb70-4cc0-9b7d-d2f2302972cb"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8SA4KHR4JzRvba7BWGUH_secret_K86LWA4bthqB7cmKSk0C53UjjSbNWIz",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8SA4KHR4JzRvba7BWGUH",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq8SA4KHR4JzRvEOEyLp4y",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8RA4KHR4JzRvAizme7g0",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq8TA4KHR4JzRvvmfe6BPd",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "af804b60-507d-49f6-a764-f5505aa5953b"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "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_1JTq8RA4KHR4JzRvAizme7g0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq8TA4KHR4JzRvhWZ0f4Ik",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "af804b60-507d-49f6-a764-f5505aa5953b"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8SA4KHR4JzRvba7BWGUH_secret_K86LWA4bthqB7cmKSk0C53UjjSbNWIz",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8SA4KHR4JzRvba7BWGUH",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq8SA4KHR4JzRvEOEyLp4y",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8RA4KHR4JzRvAizme7g0",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq8TA4KHR4JzRvimFsrzKs",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "af804b60-507d-49f6-a764-f5505aa5953b"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8QA4KHR4JzRvc2IMwQgm_secret_K86LpKq7n2ksCAPb1xTP0IlS9nOOCe5",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8QA4KHR4JzRvc2IMwQgm",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq8QA4KHR4JzRvwcQ69NjM",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "20069118-7cdc-42f7-9ce1-cf2ba9233e66"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_Bj9Yr8Tt6C1yOwIgDuGD9wwO8",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq8PA4KHR4JzRv1hOvsALF",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "311db1c1-e145-48a2-8ec6-63d9e8a011de"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTq8OA4KHR4JzRvGN8WUg5x",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "eda3dfe5-e64c-427c-88fc-f802c8ade935"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Event.list.3.json b/corporate/tests/stripe_fixtures/replace_payment_method--Event.list.3.jsonnew file mode 100644index 00000000000..67bca7c33f6--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Event.list.3.json@@ -0,0 +1,1261 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001I5Xdh",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001I5Xdh/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1JTq8bA4KHR4JzRvyA8G8Dfq",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "7d7629fd-d156-41a4-8463-b3d0d196d957"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001I5Xdh",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001I5Xdh/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1JTq8bA4KHR4JzRvQEXPS1G3",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "7d7629fd-d156-41a4-8463-b3d0d196d957"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001I5Xdh",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001I5Xdh/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1JTq8bA4KHR4JzRvTJMPsE1t",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "7d7629fd-d156-41a4-8463-b3d0d196d957"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001I5Xdh",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001I5Xdh/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1JTq8bA4KHR4JzRvNbQk9gp6",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "7d7629fd-d156-41a4-8463-b3d0d196d957"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq8aA4KHR4JzRv98Prv3uX",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "2e92d12b-3781-492d-a2fb-a6c128f29890"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000003",+ "invoice": "in_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq8aA4KHR4JzRvWqjxA8XC",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "2e92d12b-3781-492d-a2fb-a6c128f29890"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq8aA4KHR4JzRvYY4YaYyq",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "2e92d12b-3781-492d-a2fb-a6c128f29890"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "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",+ "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": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ }+ },+ "id": "evt_1JTq8ZA4KHR4JzRvhhdpEwoW",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "b8ac29c1-0bf0-458e-8c0a-ea92593fc407"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ }+ },+ "id": "evt_1JTq8YA4KHR4JzRvNj5a74gM",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "19e164d0-3c6d-474d-85bd-87872d128a46"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq8RA4KHR4JzRvAizme7g0",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JTq8YA4KHR4JzRvOx2w3s8X",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "19e164d0-3c6d-474d-85bd-87872d128a46"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Event.list.4.json b/corporate/tests/stripe_fixtures/replace_payment_method--Event.list.4.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Event.list.4.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.create.1.jsonnew file mode 100644index 00000000000..b1ce8ae15bc--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.create.1.json@@ -0,0 +1,174 @@+{+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.create.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.create.2.jsonnew file mode 100644index 00000000000..f82889c7524--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.create.2.json@@ -0,0 +1,130 @@+{+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 5000,+ "amount_paid": 0,+ "amount_remaining": 5000,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": false,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 5000,+ "currency": "usd",+ "description": null,+ "discount_amounts": [],+ "discountable": true,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 5000,+ "unit_amount_decimal": "5000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": null,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 5000,+ "tax": null,+ "total": 5000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.finalize_invoice.1.jsonnew file mode 100644index 00000000000..542203d5cac--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.finalize_invoice.1.json@@ -0,0 +1,174 @@+{+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001I5Xdh",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001I5Xdh/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.finalize_invoice.2.jsonnew file mode 100644index 00000000000..31c4eee8ad1--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.finalize_invoice.2.json@@ -0,0 +1,130 @@+{+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 5000,+ "amount_paid": 0,+ "amount_remaining": 5000,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": false,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AY8rm",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AY8rm/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 5000,+ "currency": "usd",+ "description": null,+ "discount_amounts": [],+ "discountable": true,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 5000,+ "unit_amount_decimal": "5000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": null,+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 5000,+ "tax": null,+ "total": 5000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.list.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.list.1.jsonnew file mode 100644index 00000000000..e39960ab725--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.list.1.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.list.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.list.2.jsonnew file mode 100644index 00000000000..c1f4a3f20a0--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.list.2.json@@ -0,0 +1,137 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 5000,+ "amount_paid": 0,+ "amount_remaining": 5000,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": false,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AY8rm",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AY8rm/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 5000,+ "currency": "usd",+ "description": null,+ "discount_amounts": [],+ "discountable": true,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 5000,+ "unit_amount_decimal": "5000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": null,+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 5000,+ "tax": null,+ "total": 5000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.list.3.json b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.list.3.jsonnew file mode 100644index 00000000000..d3bc2758732--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.list.3.json@@ -0,0 +1,137 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 5000,+ "amount_paid": 0,+ "amount_remaining": 5000,+ "application_fee_amount": null,+ "attempt_count": 1,+ "attempted": true,+ "auto_advance": false,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": "ch_NORMALIZED00000000000002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AY8rm",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AY8rm/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 5000,+ "currency": "usd",+ "description": null,+ "discount_amounts": [],+ "discountable": true,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 5000,+ "unit_amount_decimal": "5000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": null,+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 5000,+ "tax": null,+ "total": 5000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.list.4.json b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.list.4.jsonnew file mode 100644index 00000000000..30120326fd3--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.list.4.json@@ -0,0 +1,311 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 5000,+ "amount_paid": 5000,+ "amount_remaining": 0,+ "application_fee_amount": null,+ "attempt_count": 1,+ "attempted": true,+ "auto_advance": false,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": "ch_NORMALIZED00000000000003",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AY8rm",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AY8rm/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 5000,+ "currency": "usd",+ "description": null,+ "discount_amounts": [],+ "discountable": true,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 5000,+ "unit_amount_decimal": "5000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": null,+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 5000,+ "tax": null,+ "total": 5000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001I5Xdh",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001I5Xdh/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.pay.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.pay.1.jsonnew file mode 100644index 00000000000..14d3f9e04d4--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.pay.1.json@@ -0,0 +1,537 @@+{+ "_message": "Your card was declined.",+ "code": "card_declined",+ "error": {+ "charge": "ch_NORMALIZED00000000000002",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "param": null,+ "payment_intent": {+ "amount": 5000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 5000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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": "Stripe",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Payment for Invoice",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": null,+ "receipt_number": null,+ "receipt_url": null,+ "refunded": false,+ "refunds": {},+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": null,+ "statement_descriptor_suffix": null,+ "status": "failed",+ "transfer_data": null,+ "transfer_group": null+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_f70lixzKwcMJmjTeutUc42GVN",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Payment for Invoice",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000002",+ "last_payment_error": {+ "charge": "ch_NORMALIZED00000000000002",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "livemode": false,+ "metadata": {},+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": null,+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": null,+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ },+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "setup_intent": null,+ "source": null,+ "type": "card_error"+ },+ "headers": {+ "Connection": "keep-alive",+ "Content-Length": "7950",+ "Content-Type": "application/json",+ "Date": "NORMALIZED DATETIME",+ "Server": "nginx",+ "Strict-Transport-Security": "max-age=31556926; includeSubDomains; preload",+ "access-control-allow-credentials": "true",+ "access-control-allow-methods": "GET, POST, HEAD, OPTIONS, DELETE",+ "access-control-allow-origin": "*",+ "access-control-expose-headers": "Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required",+ "access-control-max-age": "300",+ "cache-control": "no-cache, no-store",+ "idempotency-key": "00000000-0000-0000-0000-000000000000",+ "original-request": "req_NORMALIZED0012",+ "request-id": "req_NORMALIZED0012",+ "stripe-should-retry": "false",+ "stripe-version": "2020-08-27",+ "x-stripe-c-cost": "6"+ },+ "http_body": "{\n \"error\": {\n \"charge\": \"ch_NORMALIZED00000000000002\",\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"payment_intent\": {\n \"id\": \"pi_NORMALIZED00000000000002\",\n \"object\": \"payment_intent\",\n \"amount\": 5000,\n \"amount_capturable\": 0,\n \"amount_received\": 0,\n \"application\": null,\n \"application_fee_amount\": null,\n \"canceled_at\": null,\n \"cancellation_reason\": null,\n \"capture_method\": \"automatic\",\n \"charges\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ch_NORMALIZED00000000000002\",\n \"object\": \"charge\",\n \"amount\": 5000,\n \"amount_captured\": 0,\n \"amount_refunded\": 0,\n \"application\": null,\n \"application_fee\": null,\n \"application_fee_amount\": null,\n \"balance_transaction\": null,\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"calculated_statement_descriptor\": \"Stripe\",\n \"captured\": false,\n \"created\": 1000000000,\n \"currency\": \"usd\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"description\": \"Payment for Invoice\",\n \"destination\": null,\n \"dispute\": null,\n \"disputed\": false,\n \"failure_code\": \"card_declined\",\n \"failure_message\": \"Your card was declined.\",\n \"fraud_details\": {\n },\n \"invoice\": \"in_NORMALIZED00000000000002\",\n \"livemode\": false,\n \"metadata\": {\n },\n \"on_behalf_of\": null,\n \"order\": null,\n \"outcome\": {\n \"network_status\": \"declined_by_network\",\n \"reason\": \"generic_decline\",\n \"risk_level\": \"normal\",\n \"risk_score\": 12,\n \"seller_message\": \"The bank did not return any further details with this decline.\",\n \"type\": \"issuer_declined\"\n },\n \"paid\": false,\n \"payment_intent\": \"pi_NORMALIZED00000000000002\",\n \"payment_method\": \"pm_1JTq8jA4KHR4JzRvlhFpfIIj\",\n \"payment_method_details\": {\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000001\",\n \"funding\": \"credit\",\n \"installments\": null,\n \"last4\": \"0341\",\n \"network\": \"visa\",\n \"three_d_secure\": null,\n \"wallet\": null\n },\n \"type\": \"card\"\n },\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"receipt_url\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [\n\n ],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_NORMALIZED00000000000002/refunds\"\n },\n \"review\": null,\n \"shipping\": null,\n \"source\": null,\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"statement_descriptor_suffix\": null,\n \"status\": \"failed\",\n \"transfer_data\": null,\n \"transfer_group\": null\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/charges?payment_intent=pi_NORMALIZED00000000000002\"\n },\n \"client_secret\": \"pi_NORMALIZED00000000000002_secret_f70lixzKwcMJmjTeutUc42GVN\",\n \"confirmation_method\": \"automatic\",\n \"created\": 1000000000,\n \"currency\": \"usd\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"description\": \"Payment for Invoice\",\n \"invoice\": \"in_NORMALIZED00000000000002\",\n \"last_payment_error\": {\n \"charge\": \"ch_NORMALIZED00000000000002\",\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"payment_method\": {\n \"id\": \"pm_1JTq8jA4KHR4JzRvlhFpfIIj\",\n \"object\": \"payment_method\",\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000001\",\n \"funding\": \"credit\",\n \"generated_from\": null,\n \"last4\": \"0341\",\n \"networks\": {\n \"available\": [\n \"visa\"\n ],\n \"preferred\": null\n },\n \"three_d_secure_usage\": {\n \"supported\": true\n },\n \"wallet\": null\n },\n \"created\": 1000000000,\n \"customer\": \"cus_NORMALIZED0001\",\n \"livemode\": false,\n \"metadata\": {\n },\n \"type\": \"card\"\n },\n \"type\": \"card_error\"\n },\n \"livemode\": false,\n \"metadata\": {\n },\n \"next_action\": null,\n \"on_behalf_of\": null,\n \"payment_method\": null,\n \"payment_method_options\": {\n \"card\": {\n \"installments\": null,\n \"network\": null,\n \"request_three_d_secure\": \"automatic\"\n }\n },\n \"payment_method_types\": [\n \"card\"\n ],\n \"receipt_email\": null,\n \"review\": null,\n \"setup_future_usage\": null,\n \"shipping\": null,\n \"source\": null,\n \"statement_descriptor\": null,\n \"statement_descriptor_suffix\": null,\n \"status\": \"requires_payment_method\",\n \"transfer_data\": null,\n \"transfer_group\": null\n },\n \"payment_method\": {\n \"id\": \"pm_1JTq8jA4KHR4JzRvlhFpfIIj\",\n \"object\": \"payment_method\",\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000001\",\n \"funding\": \"credit\",\n \"generated_from\": null,\n \"last4\": \"0341\",\n \"networks\": {\n \"available\": [\n \"visa\"\n ],\n \"preferred\": null\n },\n \"three_d_secure_usage\": {\n \"supported\": true\n },\n \"wallet\": null\n },\n \"created\": 1000000000,\n \"customer\": \"cus_NORMALIZED0001\",\n \"livemode\": false,\n \"metadata\": {\n },\n \"type\": \"card\"\n },\n \"type\": \"card_error\"\n }\n}\n",+ "http_status": 402,+ "json_body": {+ "error": {+ "charge": "ch_NORMALIZED00000000000002",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "payment_intent": {+ "amount": 5000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 5000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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": "Stripe",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Payment for Invoice",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": null,+ "receipt_number": null,+ "receipt_url": null,+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": null,+ "statement_descriptor_suffix": null,+ "status": "failed",+ "transfer_data": null,+ "transfer_group": null+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_f70lixzKwcMJmjTeutUc42GVN",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Payment for Invoice",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000002",+ "last_payment_error": {+ "charge": "ch_NORMALIZED00000000000002",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "livemode": false,+ "metadata": {},+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": null,+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": null,+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ },+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ }+ },+ "param": null,+ "request_id": "req_NORMALIZED0012"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.pay.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.pay.2.jsonnew file mode 100644index 00000000000..559fcc09616--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--Invoice.pay.2.json@@ -0,0 +1,130 @@+{+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 5000,+ "amount_paid": 5000,+ "amount_remaining": 0,+ "application_fee_amount": null,+ "attempt_count": 1,+ "attempted": true,+ "auto_advance": false,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": "ch_NORMALIZED00000000000003",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AY8rm",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002AY8rm/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 5000,+ "currency": "usd",+ "description": null,+ "discount_amounts": [],+ "discountable": true,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 5000,+ "unit_amount_decimal": "5000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": null,+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 5000,+ "tax": null,+ "total": 5000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--InvoiceItem.create.1.jsonnew file mode 100644index 00000000000..3aa8989852b--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--InvoiceItem.create.1.json@@ -0,0 +1,45 @@+{+ "amount": -48000,+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--InvoiceItem.create.2.jsonnew file mode 100644index 00000000000..54cacd84257--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--InvoiceItem.create.2.json@@ -0,0 +1,45 @@+{+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "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",+ "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": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/replace_payment_method--InvoiceItem.create.3.jsonnew file mode 100644index 00000000000..59db9ebd505--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--InvoiceItem.create.3.json@@ -0,0 +1,45 @@+{+ "amount": 5000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": null,+ "discountable": true,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000004",+ "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",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 5000,+ "unit_amount_decimal": "5000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 5000,+ "unit_amount_decimal": "5000"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..51c1f814c5b--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentIntent.confirm.1.json@@ -0,0 +1,166 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq8RA4KHR4JzRvAizme7g0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_Bj9Yr8Tt6C1yOwIgDuGD9wwO8",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8RA4KHR4JzRvAizme7g0",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..c405fc07bc3--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_Bj9Yr8Tt6C1yOwIgDuGD9wwO8",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..07b66e5a9cc--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTq8RA4KHR4JzRvAizme7g0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.create.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.create.2.jsonnew file mode 100644index 00000000000..1b98512f383--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.create.2.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000004",+ "funding": "credit",+ "generated_from": null,+ "last4": "0002",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTq8gA4KHR4JzRvSIOszyfC",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.create.3.json b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.create.3.jsonnew file mode 100644index 00000000000..ffb6be9a6fb--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.create.3.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.create.4.json b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.create.4.jsonnew file mode 100644index 00000000000..225cbab0013--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.create.4.json@@ -0,0 +1,47 @@+{+ "billing_details": {+ "address": {+ "city": null,+ "country": null,+ "line1": null,+ "line2": null,+ "postal_code": null,+ "state": null+ },+ "email": null,+ "name": null,+ "phone": null+ },+ "card": {+ "brand": "mastercard",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "generated_from": null,+ "last4": "4444",+ "networks": {+ "available": [+ "mastercard"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTq8uA4KHR4JzRvEAD4kqfy",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.detach.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.detach.1.jsonnew file mode 100644index 00000000000..75be4501b0e--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.detach.1.json@@ -0,0 +1,47 @@+{+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.detach.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.detach.2.jsonnew file mode 100644index 00000000000..d33af16f7c4--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.detach.2.json@@ -0,0 +1,47 @@+{+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTq8RA4KHR4JzRvAizme7g0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.list.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.list.1.jsonnew file mode 100644index 00000000000..cef80616dd2--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.list.1.json@@ -0,0 +1,101 @@+{+ "data": [+ {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "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_1JTq8RA4KHR4JzRvAizme7g0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/payment_methods"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.list.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.list.2.jsonnew file mode 100644index 00000000000..7520524f740--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--PaymentMethod.list.2.json@@ -0,0 +1,54 @@+{+ "data": [+ {+ "billing_details": {+ "address": {+ "city": null,+ "country": null,+ "line1": null,+ "line2": null,+ "postal_code": null,+ "state": null+ },+ "email": null,+ "name": null,+ "phone": null+ },+ "card": {+ "brand": "mastercard",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "generated_from": null,+ "last4": "4444",+ "networks": {+ "available": [+ "mastercard"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq8uA4KHR4JzRvEAD4kqfy",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/payment_methods"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..ce0058c7744--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8SA4KHR4JzRvba7BWGUH_secret_K86LWA4bthqB7cmKSk0C53UjjSbNWIz",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8SA4KHR4JzRvba7BWGUH",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq8SA4KHR4JzRvEOEyLp4y",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8RA4KHR4JzRvAizme7g0",+ "payment_method_options": {+ "card": {+ "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/replace_payment_method--SetupIntent.create.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.create.2.jsonnew file mode 100644index 00000000000..3445f203862--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.create.2.json@@ -0,0 +1,306 @@+{+ "_message": "Your card was declined.",+ "code": "card_declined",+ "error": {+ "charge": null,+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "param": null,+ "payment_intent": null,+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000004",+ "funding": "credit",+ "generated_from": null,+ "last4": "0002",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTq8gA4KHR4JzRvSIOszyfC",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "setup_intent": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8hA4KHR4JzRvv79LhlMT_secret_K86LlJKZBLB0Ys9ecjnUiLN7UNo52Ay",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8hA4KHR4JzRvv79LhlMT",+ "last_setup_error": {+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000004",+ "funding": "credit",+ "generated_from": null,+ "last4": "0002",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTq8gA4KHR4JzRvSIOszyfC",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "latest_attempt": "setatt_1JTq8hA4KHR4JzRvJU0axOBx",+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ },+ "source": null,+ "type": "card_error"+ },+ "headers": {+ "Connection": "keep-alive",+ "Content-Length": "3817",+ "Content-Type": "application/json",+ "Date": "NORMALIZED DATETIME",+ "Server": "nginx",+ "Strict-Transport-Security": "max-age=31556926; includeSubDomains; preload",+ "access-control-allow-credentials": "true",+ "access-control-allow-methods": "GET, POST, HEAD, OPTIONS, DELETE",+ "access-control-allow-origin": "*",+ "access-control-expose-headers": "Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required",+ "access-control-max-age": "300",+ "cache-control": "no-cache, no-store",+ "idempotency-key": "00000000-0000-0000-0000-000000000000",+ "original-request": "req_NORMALIZED0013",+ "request-id": "req_NORMALIZED0013",+ "stripe-should-retry": "false",+ "stripe-version": "2020-08-27",+ "x-stripe-c-cost": "6"+ },+ "http_body": "{\n \"error\": {\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"payment_method\": {\n \"id\": \"pm_1JTq8gA4KHR4JzRvSIOszyfC\",\n \"object\": \"payment_method\",\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000004\",\n \"funding\": \"credit\",\n \"generated_from\": null,\n \"last4\": \"0002\",\n \"networks\": {\n \"available\": [\n \"visa\"\n ],\n \"preferred\": null\n },\n \"three_d_secure_usage\": {\n \"supported\": true\n },\n \"wallet\": null\n },\n \"created\": 1000000000,\n \"customer\": null,\n \"livemode\": false,\n \"metadata\": {\n },\n \"type\": \"card\"\n },\n \"setup_intent\": {\n \"id\": \"seti_1JTq8hA4KHR4JzRvv79LhlMT\",\n \"object\": \"setup_intent\",\n \"application\": null,\n \"cancellation_reason\": null,\n \"client_secret\": \"seti_1JTq8hA4KHR4JzRvv79LhlMT_secret_K86LlJKZBLB0Ys9ecjnUiLN7UNo52Ay\",\n \"created\": 1000000000,\n \"customer\": \"cus_NORMALIZED0001\",\n \"description\": null,\n \"last_setup_error\": {\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"payment_method\": {\n \"id\": \"pm_1JTq8gA4KHR4JzRvSIOszyfC\",\n \"object\": \"payment_method\",\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000004\",\n \"funding\": \"credit\",\n \"generated_from\": null,\n \"last4\": \"0002\",\n \"networks\": {\n \"available\": [\n \"visa\"\n ],\n \"preferred\": null\n },\n \"three_d_secure_usage\": {\n \"supported\": true\n },\n \"wallet\": null\n },\n \"created\": 1000000000,\n \"customer\": null,\n \"livemode\": false,\n \"metadata\": {\n },\n \"type\": \"card\"\n },\n \"type\": \"card_error\"\n },\n \"latest_attempt\": \"setatt_1JTq8hA4KHR4JzRvJU0axOBx\",\n \"livemode\": false,\n \"mandate\": null,\n \"metadata\": {\n },\n \"next_action\": null,\n \"on_behalf_of\": null,\n \"payment_method\": null,\n \"payment_method_options\": {\n \"card\": {\n \"request_three_d_secure\": \"automatic\"\n }\n },\n \"payment_method_types\": [\n \"card\"\n ],\n \"single_use_mandate\": null,\n \"status\": \"requires_payment_method\",\n \"usage\": \"off_session\"\n },\n \"type\": \"card_error\"\n }\n}\n",+ "http_status": 402,+ "json_body": {+ "error": {+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000004",+ "funding": "credit",+ "generated_from": null,+ "last4": "0002",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTq8gA4KHR4JzRvSIOszyfC",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "setup_intent": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8hA4KHR4JzRvv79LhlMT_secret_K86LlJKZBLB0Ys9ecjnUiLN7UNo52Ay",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8hA4KHR4JzRvv79LhlMT",+ "last_setup_error": {+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000004",+ "funding": "credit",+ "generated_from": null,+ "last4": "0002",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTq8gA4KHR4JzRvSIOszyfC",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "latest_attempt": "setatt_1JTq8hA4KHR4JzRvJU0axOBx",+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ },+ "type": "card_error"+ }+ },+ "param": null,+ "request_id": "req_NORMALIZED0013"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.create.3.json b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.create.3.jsonnew file mode 100644index 00000000000..e389b720089--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.create.3.json@@ -0,0 +1,29 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8kA4KHR4JzRvFWgYp41A_secret_K86LdyuHOMih3wgo8oe5safqFFQFax2",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8kA4KHR4JzRvFWgYp41A",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq8kA4KHR4JzRvBJK6cEuB",+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "payment_method_options": {+ "card": {+ "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/replace_payment_method--SetupIntent.create.4.json b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.create.4.jsonnew file mode 100644index 00000000000..a7d440e148e--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.create.4.json@@ -0,0 +1,29 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8wA4KHR4JzRvfgl6sWXU_secret_K86LrSZu8GCKco6ZLVEW5Q0qNUK0u7G",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8wA4KHR4JzRvfgl6sWXU",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq8wA4KHR4JzRvNL61X0Ey",+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8uA4KHR4JzRvEAD4kqfy",+ "payment_method_options": {+ "card": {+ "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/replace_payment_method--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..076b13fd9ba--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8QA4KHR4JzRvc2IMwQgm_secret_K86LpKq7n2ksCAPb1xTP0IlS9nOOCe5",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8QA4KHR4JzRvc2IMwQgm",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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/replace_payment_method--SetupIntent.list.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.list.2.jsonnew file mode 100644index 00000000000..ba9d73022e3--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.list.2.json@@ -0,0 +1,36 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8fA4KHR4JzRvmZ9Hqisp_secret_K86LtDdlo0BterdDp6Syegw8c22QUzz",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8fA4KHR4JzRvmZ9Hqisp",+ "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_options": {+ "card": {+ "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/replace_payment_method--SetupIntent.list.3.json b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.list.3.jsonnew file mode 100644index 00000000000..35e11ce3037--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.list.3.json@@ -0,0 +1,36 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8iA4KHR4JzRvU94C48s7_secret_K86LLzaHSaMax1lfIKJj5cPlemtpob3",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8iA4KHR4JzRvU94C48s7",+ "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_options": {+ "card": {+ "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/replace_payment_method--SetupIntent.list.4.json b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.list.4.jsonnew file mode 100644index 00000000000..60ea264d827--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.list.4.json@@ -0,0 +1,36 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8uA4KHR4JzRv8cWRyqIJ_secret_K86LYZeSenSPj4sdidbGdL6Ai7oaJ73",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8uA4KHR4JzRv8cWRyqIJ",+ "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_options": {+ "card": {+ "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/replace_payment_method--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..ce0058c7744--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8SA4KHR4JzRvba7BWGUH_secret_K86LWA4bthqB7cmKSk0C53UjjSbNWIz",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8SA4KHR4JzRvba7BWGUH",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq8SA4KHR4JzRvEOEyLp4y",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8RA4KHR4JzRvAizme7g0",+ "payment_method_options": {+ "card": {+ "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/replace_payment_method--SetupIntent.retrieve.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.retrieve.2.jsonnew file mode 100644index 00000000000..e389b720089--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.retrieve.2.json@@ -0,0 +1,29 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8kA4KHR4JzRvFWgYp41A_secret_K86LdyuHOMih3wgo8oe5safqFFQFax2",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8kA4KHR4JzRvFWgYp41A",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq8kA4KHR4JzRvBJK6cEuB",+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8jA4KHR4JzRvlhFpfIIj",+ "payment_method_options": {+ "card": {+ "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/replace_payment_method--SetupIntent.retrieve.3.json b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.retrieve.3.jsonnew file mode 100644index 00000000000..a7d440e148e--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--SetupIntent.retrieve.3.json@@ -0,0 +1,29 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq8wA4KHR4JzRvfgl6sWXU_secret_K86LrSZu8GCKco6ZLVEW5Q0qNUK0u7G",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq8wA4KHR4JzRvfgl6sWXU",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq8wA4KHR4JzRvNL61X0Ey",+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq8uA4KHR4JzRvEAD4kqfy",+ "payment_method_options": {+ "card": {+ "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/replace_payment_method--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..dc889607b94--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01MWKUOku1yVTwiY2OPyaFyiK00Mk5xb0aAfxlZXPSPnDLEY",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq8QA4KHR4JzRvc2IMwQgm",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01MWKUOku1yVTwiY2OPyaFyiK00Mk5xb0aAfxlZXPSPnDLEY#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.create.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.create.2.jsonnew file mode 100644index 00000000000..52244198919--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.create.2.json@@ -0,0 +1,38 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/billing/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED02hXs0nrJEiNoL3fGz2lq7wYe6uARlvSNHLXXWK7GXzN0gya",+ "livemode": false,+ "locale": null,+ "metadata": {+ "type": "card_update"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq8fA4KHR4JzRvmZ9Hqisp",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED02hXs0nrJEiNoL3fGz2lq7wYe6uARlvSNHLXXWK7GXzN0gya#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.create.3.json b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.create.3.jsonnew file mode 100644index 00000000000..bb49e3525c8--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.create.3.json@@ -0,0 +1,38 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/billing/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED03aaL5EyHPjA3OaKxFSz0FgmeNgnNNGCGdEG41VMPGQv0TRO",+ "livemode": false,+ "locale": null,+ "metadata": {+ "type": "card_update"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq8iA4KHR4JzRvU94C48s7",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED03aaL5EyHPjA3OaKxFSz0FgmeNgnNNGCGdEG41VMPGQv0TRO#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.create.4.json b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.create.4.jsonnew file mode 100644index 00000000000..0f07bd80341--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.create.4.json@@ -0,0 +1,38 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/billing/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED04uc93z6n0ZSUSOaAnR0zc3QgYyn3u8gKM3aDfQK02avvAGL",+ "livemode": false,+ "locale": null,+ "metadata": {+ "type": "card_update"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq8uA4KHR4JzRv8cWRyqIJ",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED04uc93z6n0ZSUSOaAnR0zc3QgYyn3u8gKM3aDfQK02avvAGL#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..b15ab84a899--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01MWKUOku1yVTwiY2OPyaFyiK00Mk5xb0aAfxlZXPSPnDLEY",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq8QA4KHR4JzRvc2IMwQgm",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01MWKUOku1yVTwiY2OPyaFyiK00Mk5xb0aAfxlZXPSPnDLEY#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.list.2.json b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.list.2.jsonnew file mode 100644index 00000000000..b1b3e9dca0d--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.list.2.json@@ -0,0 +1,45 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/billing/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED03aaL5EyHPjA3OaKxFSz0FgmeNgnNNGCGdEG41VMPGQv0TRO",+ "livemode": false,+ "locale": null,+ "metadata": {+ "type": "card_update"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq8iA4KHR4JzRvU94C48s7",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED03aaL5EyHPjA3OaKxFSz0FgmeNgnNNGCGdEG41VMPGQv0TRO#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.list.3.json b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.list.3.jsonnew file mode 100644index 00000000000..eed16209ca1--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_method--checkout.Session.list.3.json@@ -0,0 +1,45 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/billing/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED04uc93z6n0ZSUSOaAnR0zc3QgYyn3u8gKM3aDfQK02avvAGL",+ "livemode": false,+ "locale": null,+ "metadata": {+ "type": "card_update"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq8uA4KHR4JzRv8cWRyqIJ",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED04uc93z6n0ZSUSOaAnR0zc3QgYyn3u8gKM3aDfQK02avvAGL#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Charge.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--Charge.create.1.jsondeleted file mode 100644index 3114f2b6137..00000000000--- a/corporate/tests/stripe_fixtures/replace_payment_source--Charge.create.1.json+++ /dev/null@@ -1,117 +0,0 @@-{- "amount": 48000,- "amount_captured": 48000,- "amount_refunded": 0,- "application": null,- "application_fee": null,- "application_fee_amount": null,- "balance_transaction": "txn_NORMALIZED00000000000001",- "billing_details": {- "address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",- "line2": null,- "postal_code": "33333",- "state": null- },- "email": null,- "name": "Ada Starr",- "phone": null- },- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",- "captured": true,- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "description": "Upgrade to Zulip Standard, $80.0 x 6",- "destination": null,- "dispute": null,- "disputed": false,- "failure_code": null,- "failure_message": null,- "fraud_details": {},- "id": "ch_NORMALIZED00000000000001",- "invoice": null,- "livemode": false,- "metadata": {},- "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": null,- "payment_method": "card_NORMALIZED00000000000001",- "payment_method_details": {- "card": {- "brand": "visa",- "checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",- "cvc_check": "pass"- },- "country": "US",- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "installments": null,- "last4": "4242",- "network": "visa",- "three_d_secure": null,- "wallet": null- },- "type": "card"- },- "receipt_email": "[email protected]",- "receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",- "refunded": false,- "refunds": {- "data": [],- "has_more": false,- "object": "list",- "total_count": 0,- "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"- },- "review": null,- "shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "source_transfer": null,- "statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",- "status": "succeeded",- "transfer_data": null,- "transfer_group": null-}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.create.1.jsonindex 88d5c69190f..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.create.1.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.create.1.json@@ -3,7 +3,7 @@"balance": 0,"created": 1000000000,"currency": null,- "default_source": "card_NORMALIZED00000000000001",+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.modify.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.modify.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.modify.2.jsonnew file mode 100644index 00000000000..f1643806007--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.modify.3.json b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.modify.3.jsonnew file mode 100644index 00000000000..033fd58262f--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.modify.3.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JItSyA4KHR4JzRv1Y1r16Ay",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 3,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.modify.4.json b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.modify.4.jsonnew file mode 100644index 00000000000..a895b3415da--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.modify.4.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": true,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JItT7A4KHR4JzRvp5lQOWqG",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 3,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.1.jsonindex e5926664e45..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.1.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.1.json@@ -2,32 +2,8 @@"address": null,"balance": 0,"created": 1000000000,- "currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "currency": null,+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -45,43 +21,10 @@"realm_str": "zulip"},"name": null,- "next_invoice_sequence": 3,+ "next_invoice_sequence": 1,"object": "customer","phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.2.jsonindex e5926664e45..230a571b80e 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.2.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.2.json@@ -3,31 +3,7 @@"balance": 0,"created": 1000000000,"currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -36,7 +12,7 @@"invoice_prefix": "NORMA01","invoice_settings": {"custom_fields": null,- "default_payment_method": null,+ "default_payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ","footer": null},"livemode": false,@@ -50,38 +26,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.3.jsonindex e5926664e45..d46ee1e0fb3 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.3.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.3.json@@ -3,32 +3,8 @@"balance": 0,"created": 1000000000,"currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "delinquent": false,+ "default_source": null,+ "delinquent": true,"description": "zulip (Zulip Dev)","discount": null,"email": "[email protected]",@@ -36,7 +12,53 @@"invoice_prefix": "NORMA01","invoice_settings": {"custom_fields": null,- "default_payment_method": 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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JItSyA4KHR4JzRv1Y1r16Ay",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },"footer": null},"livemode": false,@@ -50,38 +72,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.4.jsonindex 0907250d59a..c48aea382f9 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.4.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.4.json@@ -3,31 +3,7 @@"balance": 0,"created": 1000000000,"currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "default_source": null,"delinquent": true,"description": "zulip (Zulip Dev)","discount": null,@@ -36,7 +12,7 @@"invoice_prefix": "NORMA01","invoice_settings": {"custom_fields": null,- "default_payment_method": null,+ "default_payment_method": "pm_1JItSyA4KHR4JzRv1Y1r16Ay","footer": null},"livemode": false,@@ -50,38 +26,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.5.json b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.5.jsonindex 0907250d59a..9581cba696f 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.5.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.5.json@@ -3,32 +3,8 @@"balance": 0,"created": 1000000000,"currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "delinquent": true,+ "default_source": null,+ "delinquent": false,"description": "zulip (Zulip Dev)","discount": null,"email": "[email protected]",@@ -36,7 +12,53 @@"invoice_prefix": "NORMA01","invoice_settings": {"custom_fields": null,- "default_payment_method": 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": "mastercard",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "generated_from": null,+ "last4": "4444",+ "networks": {+ "available": [+ "mastercard"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JItT7A4KHR4JzRvp5lQOWqG",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },"footer": null},"livemode": false,@@ -50,38 +72,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.6.json b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.6.jsondeleted file mode 100644index 4d22405ef6c..00000000000--- a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.retrieve.6.json+++ /dev/null@@ -1,87 +0,0 @@-{- "address": null,- "balance": 0,- "created": 1000000000,- "currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "MasterCard",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000003",- "funding": "credit",- "id": "card_NORMALIZED00000000000003",- "last4": "4444",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "delinquent": false,- "description": "zulip (Zulip Dev)",- "discount": null,- "email": "[email protected]",- "id": "cus_NORMALIZED0001",- "invoice_prefix": "NORMA01",- "invoice_settings": {- "custom_fields": null,- "default_payment_method": null,- "footer": null- },- "livemode": false,- "metadata": {- "realm_id": "1",- "realm_str": "zulip"- },- "name": null,- "next_invoice_sequence": 3,- "object": "customer",- "phone": null,- "preferred_locales": [],- "shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "MasterCard",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000003",- "funding": "credit",- "id": "card_NORMALIZED00000000000003",- "last4": "4444",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },- "tax_exempt": "none"-}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.save.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--Customer.save.1.jsondeleted file mode 100644index 1465905217e..00000000000--- a/corporate/tests/stripe_fixtures/replace_payment_source--Customer.save.1.json+++ /dev/null@@ -1,51 +0,0 @@-{- "_message": "Your card was declined.",- "code": "card_declined",- "error": {- "charge": null,- "code": "card_declined",- "decline_code": "lost_card",- "doc_url": "https://stripe.com/docs/error-codes/card-declined",- "message": "Your card was declined.",- "param": "",- "payment_intent": null,- "payment_method": null,- "setup_intent": null,- "source": null,- "type": "card_error"- },- "headers": {- "Connection": "keep-alive",- "Content-Length": "235",- "Content-Type": "application/json",- "Date": "NORMALIZED DATETIME",- "Server": "nginx",- "Strict-Transport-Security": "max-age=31556926; includeSubDomains; preload",- "access-control-allow-credentials": "true",- "access-control-allow-methods": "GET, POST, HEAD, OPTIONS, DELETE",- "access-control-allow-origin": "*",- "access-control-expose-headers": "Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required",- "access-control-max-age": "300",- "cache-control": "no-cache, no-store",- "idempotency-key": "00000000-0000-0000-0000-000000000000",- "original-request": "req_NORMALIZED0001",- "request-id": "req_NORMALIZED0001",- "stripe-should-retry": "false",- "stripe-version": "2020-08-27",- "x-stripe-c-cost": "6"- },- "http_body": "{\n \"error\": {\n \"code\": \"card_declined\",\n \"decline_code\": \"lost_card\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"param\": \"\",\n \"type\": \"card_error\"\n }\n}\n",- "http_status": 402,- "json_body": {- "error": {- "code": "card_declined",- "decline_code": "lost_card",- "doc_url": "https://stripe.com/docs/error-codes/card-declined",- "message": "Your card was declined.",- "param": "",- "type": "card_error"- }- },- "param": "",- "request_id": "req_NORMALIZED0001"-}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Event.list.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--Event.list.1.jsonnew file mode 100644index 00000000000..105801d6289--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Event.list.1.json@@ -0,0 +1,152 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 984000,+ "amount_paid": 0,+ "amount_remaining": 984000,+ "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": "send_invoice",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0002",+ "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": 1000000000,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000019XmJp",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000019XmJp/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 984000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1393729445,+ "start": 1362193445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 123,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 984000,+ "tax": null,+ "total": 984000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JItSfA4KHR4JzRvByroiBGa",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "6436e396-71ab-4ba8-8dcf-f1ccea116a67"+ },+ "type": "invoice.finalized"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Event.list.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--Event.list.2.jsonnew file mode 100644index 00000000000..b214bf88c75--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Event.list.2.json@@ -0,0 +1,702 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_Im1orO6NHwBivJ42MzxCIdEZr",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_1JItSqA4KHR4JzRvrOrG0FkN",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "96d3182e-dae3-43bf-a73f-589301479ade"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_1JItSqA4KHR4JzRvAGpG0LlD",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "96d3182e-dae3-43bf-a73f-589301479ade"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JItSoA4KHR4JzRvofWzFFQq",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "0aed21bf-e454-4c99-b545-49f621baaedc"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JItSlA4KHR4JzRvR6Rwwr7M_secret_Jwn2lXV2MSEZKWF3wSVdeO7lc0vuJG5",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JItSlA4KHR4JzRvR6Rwwr7M",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JItSlA4KHR4JzRv7fAlEWY9",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JItSmA4KHR4JzRvRNGH8370",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "79b5de70-d672-4624-9597-a8883d1a53e6"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "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_1JItSjA4KHR4JzRvOLviKqCQ",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JItSmA4KHR4JzRvafkfSlRY",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "79b5de70-d672-4624-9597-a8883d1a53e6"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JItSlA4KHR4JzRvR6Rwwr7M_secret_Jwn2lXV2MSEZKWF3wSVdeO7lc0vuJG5",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JItSlA4KHR4JzRvR6Rwwr7M",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JItSlA4KHR4JzRv7fAlEWY9",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JItSmA4KHR4JzRvNMFaTrZx",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "79b5de70-d672-4624-9597-a8883d1a53e6"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JItSjA4KHR4JzRv9tSAgsFv_secret_Jwn2gEUp7bL0HJuowuuzPaCB43cDc1U",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JItSjA4KHR4JzRv9tSAgsFv",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JItSjA4KHR4JzRvWwWty2vw",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "9e0ba2c8-8074-4a2a-bdf2-f183da62ffd9"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_Im1orO6NHwBivJ42MzxCIdEZr",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_1JItSiA4KHR4JzRvjNtcxlUt",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "7e909a0a-8cd3-4c9d-afd4-12d8250f2454"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JItShA4KHR4JzRvskPDM08r",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "0f864b6f-ac59-42f5-b91e-cf66d3ddf4fb"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Event.list.3.json b/corporate/tests/stripe_fixtures/replace_payment_source--Event.list.3.jsonnew file mode 100644index 00000000000..ed0fc44da90--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Event.list.3.json@@ -0,0 +1,1261 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nN4LH",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nN4LH/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JItStA4KHR4JzRv8WU2L7QL",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "0ffa9c41-6971-44db-9446-23b89f376750"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nN4LH",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nN4LH/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JItStA4KHR4JzRvi0Xcy47B",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "0ffa9c41-6971-44db-9446-23b89f376750"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nN4LH",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nN4LH/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JItStA4KHR4JzRv0Vszdsye",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "0ffa9c41-6971-44db-9446-23b89f376750"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nN4LH",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nN4LH/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1JItStA4KHR4JzRvetwD3jGX",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "0ffa9c41-6971-44db-9446-23b89f376750"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JItSsA4KHR4JzRvr2ObNmrm",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "60553241-ce66-438d-93a3-a853150437e7"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000003",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JItSsA4KHR4JzRvVZ3U32IA",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "60553241-ce66-438d-93a3-a853150437e7"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JItSsA4KHR4JzRvPVa7qQ4P",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "60553241-ce66-438d-93a3-a853150437e7"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "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",+ "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": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ }+ },+ "id": "evt_1JItSrA4KHR4JzRvmJd2oAtZ",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "87a9e8e5-9f1e-414c-87a8-c58b051a5c2a"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ }+ },+ "id": "evt_1JItSrA4KHR4JzRvEnep3mvw",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "07db5c3a-7431-4579-b57b-309f554f8ab7"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JItSrA4KHR4JzRvftHO2MBA",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "07db5c3a-7431-4579-b57b-309f554f8ab7"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Event.list.4.json b/corporate/tests/stripe_fixtures/replace_payment_source--Event.list.4.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Event.list.4.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.create.1.jsonindex 85ba0a34b97..8ed35b3b41c 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000001",+ "id": "in_NORMALIZED00000000000002","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"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",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -132,7 +134,7 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.create.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.create.2.jsonindex c8f2784982c..e249c2e577b 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.create.2.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.create.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 5000,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000002",+ "id": "in_NORMALIZED00000000000003","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": true,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,7 +90,7 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.finalize_invoice.1.jsonindex bc44ce72db5..d9b505a029c 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001GxeBj",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001GxeBj/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nN4LH",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nN4LH/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"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",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -132,12 +134,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": true,@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.finalize_invoice.2.jsonindex 4ea76045c50..9a7636ad45f 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.finalize_invoice.2.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.finalize_invoice.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 5000,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HhjrT",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HhjrT/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000358v2I",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000358v2I/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": true,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,16 +90,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0002",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": nulldiff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.1.jsonindex 5065640a135..e39960ab725 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.1.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.1.json@@ -1,135 +1,5 @@{- "data": [- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 5000,- "amount_paid": 0,- "amount_remaining": 5000,- "application_fee_amount": null,- "attempt_count": 0,- "attempted": false,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HhjrT",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HhjrT/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 5000,- "currency": "usd",- "description": null,- "discount_amounts": [],- "discountable": true,- "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",- "id": "price_NORMALIZED00000000000003",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0003",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 5000,- "unit_amount_decimal": "5000"- },- "proration": false,- "quantity": 1,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": null,- "number": "NORMALI-0002",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": null,- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 5000,- "tax": null,- "total": 5000,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- }- ],+ "data": [],"has_more": false,"object": "list","url": "/v1/invoices"diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.2.jsonindex ec3f6c264f9..7e94d0d59b5 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.2.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.2.json@@ -2,21 +2,21 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 5000,"amount_paid": 0,"amount_remaining": 5000,"application_fee_amount": null,- "attempt_count": 1,- "attempted": true,+ "attempt_count": 0,+ "attempted": false,"auto_advance": false,"automatic_tax": {"enabled": false,"status": null},"billing_reason": "manual",- "charge": "ch_NORMALIZED00000000000002",+ "charge": null,"collection_method": "charge_automatically","created": 1000000000,"currency": "usd",@@ -38,9 +38,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HhjrT",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HhjrT/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000358v2I",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000358v2I/pdf","last_finalization_error": null,"lines": {"data": [@@ -51,8 +51,8 @@"discount_amounts": [],"discountable": true,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -66,14 +66,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -91,16 +92,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0002",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": nulldiff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.3.json b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.3.jsonindex ec3f6c264f9..e7de99d9609 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.3.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.3.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 5000,"amount_paid": 0,@@ -38,9 +38,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HhjrT",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HhjrT/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000358v2I",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000358v2I/pdf","last_finalization_error": null,"lines": {"data": [@@ -51,8 +51,8 @@"discount_amounts": [],"discountable": true,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -66,14 +66,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -91,16 +92,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0002",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": nulldiff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.4.json b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.4.jsonindex 6d9fb114901..88663e5adf1 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.4.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.list.4.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 5000,"amount_paid": 5000,@@ -38,9 +38,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HhjrT",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HhjrT/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000358v2I",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000358v2I/pdf","last_finalization_error": null,"lines": {"data": [@@ -51,8 +51,8 @@"discount_amounts": [],"discountable": true,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -66,14 +66,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -91,16 +92,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0002",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": true,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -131,7 +132,7 @@},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -167,9 +168,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001GxeBj",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001GxeBj/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nN4LH",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002nN4LH/pdf","last_finalization_error": null,"lines": {"data": [@@ -180,8 +181,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -195,14 +196,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -223,8 +225,8 @@"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",@@ -238,14 +240,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -263,12 +266,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": true,diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.pay.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.pay.1.jsonindex c1639c89c6d..18d931b5488 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.pay.1.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.pay.1.json@@ -29,15 +29,15 @@"balance_transaction": null,"billing_details": {"address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",+ "city": null,+ "country": null,+ "line1": null,"line2": null,- "postal_code": "33333",+ "postal_code": null,"state": null},"email": null,- "name": "Ada Starr",+ "name": null,"phone": null},"calculated_statement_descriptor": "Stripe",@@ -53,7 +53,7 @@"failure_message": "Your card was declined.","fraud_details": {},"id": "ch_NORMALIZED00000000000002",- "invoice": "in_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000003","livemode": false,"metadata": {},"object": "charge",@@ -68,20 +68,20 @@"type": "issuer_declined"},"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",- "payment_method": "card_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000003",+ "payment_method": "pm_1JItSyA4KHR4JzRv1Y1r16Ay","payment_method_details": {"card": {"brand": "visa","checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",+ "address_line1_check": null,+ "address_postal_code_check": null,"cvc_check": "pass"},"country": "US","exp_month": 3,"exp_year": 2033,- "fingerprint": "NORMALIZED000002",+ "fingerprint": "NORMALIZED000001","funding": "credit","installments": null,"last4": "0341",@@ -98,31 +98,7 @@"refunds": {},"review": null,"shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "source": null,"source_transfer": null,"statement_descriptor": null,"statement_descriptor_suffix": null,@@ -134,46 +110,68 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000003"},- "client_secret": "pi_NORMALIZED00000000000001_secret_HnG1WHH5Lq8sSIQEgu5DgsxBW",+ "client_secret": "pi_NORMALIZED00000000000003_secret_kRNeiOWgFBpDweYKcmccTn53m","confirmation_method": "automatic","created": 1000000000,"currency": "usd","customer": "cus_NORMALIZED0001","description": "Payment for Invoice",- "id": "pi_NORMALIZED00000000000001",- "invoice": "in_NORMALIZED00000000000002",+ "id": "pi_NORMALIZED00000000000003",+ "invoice": "in_NORMALIZED00000000000003","last_payment_error": {"charge": "ch_NORMALIZED00000000000002","code": "card_declined","decline_code": "generic_decline","doc_url": "https://stripe.com/docs/error-codes/card-declined","message": "Your card was declined.",- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,"customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",+ "id": "pm_1JItSyA4KHR4JzRv1Y1r16Ay",+ "livemode": false,"metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null+ "object": "payment_method",+ "type": "card"},"type": "card_error"},@@ -204,38 +202,60 @@"transfer_data": null,"transfer_group": null},- "payment_method": null,- "setup_intent": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,"customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",+ "id": "pm_1JItSyA4KHR4JzRv1Y1r16Ay",+ "livemode": false,"metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null+ "object": "payment_method",+ "type": "card"},+ "setup_intent": null,+ "source": null,"type": "card_error"},"headers": {"Connection": "keep-alive",- "Content-Length": "7985",+ "Content-Length": "7950","Content-Type": "application/json","Date": "NORMALIZED DATETIME","Server": "nginx",@@ -247,13 +267,13 @@"access-control-max-age": "300","cache-control": "no-cache, no-store","idempotency-key": "00000000-0000-0000-0000-000000000000",- "original-request": "req_NORMALIZED0002",- "request-id": "req_NORMALIZED0002",+ "original-request": "req_NORMALIZED0012",+ "request-id": "req_NORMALIZED0012","stripe-should-retry": "false","stripe-version": "2020-08-27",- "x-stripe-c-cost": "7"+ "x-stripe-c-cost": "6"},- "http_body": "{\n \"error\": {\n \"charge\": \"ch_NORMALIZED00000000000002\",\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"payment_intent\": {\n \"id\": \"pi_NORMALIZED00000000000001\",\n \"object\": \"payment_intent\",\n \"amount\": 5000,\n \"amount_capturable\": 0,\n \"amount_received\": 0,\n \"application\": null,\n \"application_fee_amount\": null,\n \"canceled_at\": null,\n \"cancellation_reason\": null,\n \"capture_method\": \"automatic\",\n \"charges\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ch_NORMALIZED00000000000002\",\n \"object\": \"charge\",\n \"amount\": 5000,\n \"amount_captured\": 0,\n \"amount_refunded\": 0,\n \"application\": null,\n \"application_fee\": null,\n \"application_fee_amount\": null,\n \"balance_transaction\": null,\n \"billing_details\": {\n \"address\": {\n \"city\": \"Pacific\",\n \"country\": \"United States\",\n \"line1\": \"Under the sea,\",\n \"line2\": null,\n \"postal_code\": \"33333\",\n \"state\": null\n },\n \"email\": null,\n \"name\": \"Ada Starr\",\n \"phone\": null\n },\n \"calculated_statement_descriptor\": \"Stripe\",\n \"captured\": false,\n \"created\": 1000000000,\n \"currency\": \"usd\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"description\": \"Payment for Invoice\",\n \"destination\": null,\n \"dispute\": null,\n \"disputed\": false,\n \"failure_code\": \"card_declined\",\n \"failure_message\": \"Your card was declined.\",\n \"fraud_details\": {\n },\n \"invoice\": \"in_NORMALIZED00000000000002\",\n \"livemode\": false,\n \"metadata\": {\n },\n \"on_behalf_of\": null,\n \"order\": null,\n \"outcome\": {\n \"network_status\": \"declined_by_network\",\n \"reason\": \"generic_decline\",\n \"risk_level\": \"normal\",\n \"risk_score\": 38,\n \"seller_message\": \"The bank did not return any further details with this decline.\",\n \"type\": \"issuer_declined\"\n },\n \"paid\": false,\n \"payment_intent\": \"pi_NORMALIZED00000000000001\",\n \"payment_method\": \"card_NORMALIZED00000000000002\",\n \"payment_method_details\": {\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": \"pass\",\n \"address_postal_code_check\": \"pass\",\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000002\",\n \"funding\": \"credit\",\n \"installments\": null,\n \"last4\": \"0341\",\n \"network\": \"visa\",\n \"three_d_secure\": null,\n \"wallet\": null\n },\n \"type\": \"card\"\n },\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"receipt_url\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [\n\n ],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_NORMALIZED00000000000002/refunds\"\n },\n \"review\": null,\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_NORMALIZED00000000000002\",\n \"object\": \"card\",\n \"address_city\": \"Pacific\",\n \"address_country\": \"United States\",\n \"address_line1\": \"Under the sea,\",\n \"address_line1_check\": \"pass\",\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": \"33333\",\n \"address_zip_check\": \"pass\",\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000002\",\n \"funding\": \"credit\",\n \"last4\": \"0341\",\n \"metadata\": {\n },\n \"name\": \"Ada Starr\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"statement_descriptor_suffix\": null,\n \"status\": \"failed\",\n \"transfer_data\": null,\n \"transfer_group\": null\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/charges?payment_intent=pi_NORMALIZED00000000000001\"\n },\n \"client_secret\": \"pi_NORMALIZED00000000000001_secret_HnG1WHH5Lq8sSIQEgu5DgsxBW\",\n \"confirmation_method\": \"automatic\",\n \"created\": 1000000000,\n \"currency\": \"usd\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"description\": \"Payment for Invoice\",\n \"invoice\": \"in_NORMALIZED00000000000002\",\n \"last_payment_error\": {\n \"charge\": \"ch_NORMALIZED00000000000002\",\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"source\": {\n \"id\": \"card_NORMALIZED00000000000002\",\n \"object\": \"card\",\n \"address_city\": \"Pacific\",\n \"address_country\": \"United States\",\n \"address_line1\": \"Under the sea,\",\n \"address_line1_check\": \"pass\",\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": \"33333\",\n \"address_zip_check\": \"pass\",\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000002\",\n \"funding\": \"credit\",\n \"last4\": \"0341\",\n \"metadata\": {\n },\n \"name\": \"Ada Starr\",\n \"tokenization_method\": null\n },\n \"type\": \"card_error\"\n },\n \"livemode\": false,\n \"metadata\": {\n },\n \"next_action\": null,\n \"on_behalf_of\": null,\n \"payment_method\": null,\n \"payment_method_options\": {\n \"card\": {\n \"installments\": null,\n \"network\": null,\n \"request_three_d_secure\": \"automatic\"\n }\n },\n \"payment_method_types\": [\n \"card\"\n ],\n \"receipt_email\": null,\n \"review\": null,\n \"setup_future_usage\": null,\n \"shipping\": null,\n \"source\": null,\n \"statement_descriptor\": null,\n \"statement_descriptor_suffix\": null,\n \"status\": \"requires_payment_method\",\n \"transfer_data\": null,\n \"transfer_group\": null\n },\n \"source\": {\n \"id\": \"card_NORMALIZED00000000000002\",\n \"object\": \"card\",\n \"address_city\": \"Pacific\",\n \"address_country\": \"United States\",\n \"address_line1\": \"Under the sea,\",\n \"address_line1_check\": \"pass\",\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": \"33333\",\n \"address_zip_check\": \"pass\",\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000002\",\n \"funding\": \"credit\",\n \"last4\": \"0341\",\n \"metadata\": {\n },\n \"name\": \"Ada Starr\",\n \"tokenization_method\": null\n },\n \"type\": \"card_error\"\n }\n}\n",+ "http_body": "{\n \"error\": {\n \"charge\": \"ch_NORMALIZED00000000000002\",\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"payment_intent\": {\n \"id\": \"pi_NORMALIZED00000000000003\",\n \"object\": \"payment_intent\",\n \"amount\": 5000,\n \"amount_capturable\": 0,\n \"amount_received\": 0,\n \"application\": null,\n \"application_fee_amount\": null,\n \"canceled_at\": null,\n \"cancellation_reason\": null,\n \"capture_method\": \"automatic\",\n \"charges\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ch_NORMALIZED00000000000002\",\n \"object\": \"charge\",\n \"amount\": 5000,\n \"amount_captured\": 0,\n \"amount_refunded\": 0,\n \"application\": null,\n \"application_fee\": null,\n \"application_fee_amount\": null,\n \"balance_transaction\": null,\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"calculated_statement_descriptor\": \"Stripe\",\n \"captured\": false,\n \"created\": 1000000000,\n \"currency\": \"usd\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"description\": \"Payment for Invoice\",\n \"destination\": null,\n \"dispute\": null,\n \"disputed\": false,\n \"failure_code\": \"card_declined\",\n \"failure_message\": \"Your card was declined.\",\n \"fraud_details\": {\n },\n \"invoice\": \"in_NORMALIZED00000000000003\",\n \"livemode\": false,\n \"metadata\": {\n },\n \"on_behalf_of\": null,\n \"order\": null,\n \"outcome\": {\n \"network_status\": \"declined_by_network\",\n \"reason\": \"generic_decline\",\n \"risk_level\": \"normal\",\n \"risk_score\": 14,\n \"seller_message\": \"The bank did not return any further details with this decline.\",\n \"type\": \"issuer_declined\"\n },\n \"paid\": false,\n \"payment_intent\": \"pi_NORMALIZED00000000000003\",\n \"payment_method\": \"pm_1JItSyA4KHR4JzRv1Y1r16Ay\",\n \"payment_method_details\": {\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000001\",\n \"funding\": \"credit\",\n \"installments\": null,\n \"last4\": \"0341\",\n \"network\": \"visa\",\n \"three_d_secure\": null,\n \"wallet\": null\n },\n \"type\": \"card\"\n },\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"receipt_url\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [\n\n ],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_NORMALIZED00000000000002/refunds\"\n },\n \"review\": null,\n \"shipping\": null,\n \"source\": null,\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"statement_descriptor_suffix\": null,\n \"status\": \"failed\",\n \"transfer_data\": null,\n \"transfer_group\": null\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/charges?payment_intent=pi_NORMALIZED00000000000003\"\n },\n \"client_secret\": \"pi_NORMALIZED00000000000003_secret_kRNeiOWgFBpDweYKcmccTn53m\",\n \"confirmation_method\": \"automatic\",\n \"created\": 1000000000,\n \"currency\": \"usd\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"description\": \"Payment for Invoice\",\n \"invoice\": \"in_NORMALIZED00000000000003\",\n \"last_payment_error\": {\n \"charge\": \"ch_NORMALIZED00000000000002\",\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"payment_method\": {\n \"id\": \"pm_1JItSyA4KHR4JzRv1Y1r16Ay\",\n \"object\": \"payment_method\",\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000001\",\n \"funding\": \"credit\",\n \"generated_from\": null,\n \"last4\": \"0341\",\n \"networks\": {\n \"available\": [\n \"visa\"\n ],\n \"preferred\": null\n },\n \"three_d_secure_usage\": {\n \"supported\": true\n },\n \"wallet\": null\n },\n \"created\": 1000000000,\n \"customer\": \"cus_NORMALIZED0001\",\n \"livemode\": false,\n \"metadata\": {\n },\n \"type\": \"card\"\n },\n \"type\": \"card_error\"\n },\n \"livemode\": false,\n \"metadata\": {\n },\n \"next_action\": null,\n \"on_behalf_of\": null,\n \"payment_method\": null,\n \"payment_method_options\": {\n \"card\": {\n \"installments\": null,\n \"network\": null,\n \"request_three_d_secure\": \"automatic\"\n }\n },\n \"payment_method_types\": [\n \"card\"\n ],\n \"receipt_email\": null,\n \"review\": null,\n \"setup_future_usage\": null,\n \"shipping\": null,\n \"source\": null,\n \"statement_descriptor\": null,\n \"statement_descriptor_suffix\": null,\n \"status\": \"requires_payment_method\",\n \"transfer_data\": null,\n \"transfer_group\": null\n },\n \"payment_method\": {\n \"id\": \"pm_1JItSyA4KHR4JzRv1Y1r16Ay\",\n \"object\": \"payment_method\",\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000001\",\n \"funding\": \"credit\",\n \"generated_from\": null,\n \"last4\": \"0341\",\n \"networks\": {\n \"available\": [\n \"visa\"\n ],\n \"preferred\": null\n },\n \"three_d_secure_usage\": {\n \"supported\": true\n },\n \"wallet\": null\n },\n \"created\": 1000000000,\n \"customer\": \"cus_NORMALIZED0001\",\n \"livemode\": false,\n \"metadata\": {\n },\n \"type\": \"card\"\n },\n \"type\": \"card_error\"\n }\n}\n","http_status": 402,"json_body": {"error": {@@ -283,15 +303,15 @@"balance_transaction": null,"billing_details": {"address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",+ "city": null,+ "country": null,+ "line1": null,"line2": null,- "postal_code": "33333",+ "postal_code": null,"state": null},"email": null,- "name": "Ada Starr",+ "name": null,"phone": null},"calculated_statement_descriptor": "Stripe",@@ -307,7 +327,7 @@"failure_message": "Your card was declined.","fraud_details": {},"id": "ch_NORMALIZED00000000000002",- "invoice": "in_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000003","livemode": false,"metadata": {},"object": "charge",@@ -322,20 +342,20 @@"type": "issuer_declined"},"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",- "payment_method": "card_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000003",+ "payment_method": "pm_1JItSyA4KHR4JzRv1Y1r16Ay","payment_method_details": {"card": {"brand": "visa","checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",+ "address_line1_check": null,+ "address_postal_code_check": null,"cvc_check": "pass"},"country": "US","exp_month": 3,"exp_year": 2033,- "fingerprint": "NORMALIZED000002",+ "fingerprint": "NORMALIZED000001","funding": "credit","installments": null,"last4": "0341",@@ -358,31 +378,7 @@},"review": null,"shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "source": null,"source_transfer": null,"statement_descriptor": null,"statement_descriptor_suffix": null,@@ -394,46 +390,68 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000003"},- "client_secret": "pi_NORMALIZED00000000000001_secret_HnG1WHH5Lq8sSIQEgu5DgsxBW",+ "client_secret": "pi_NORMALIZED00000000000003_secret_kRNeiOWgFBpDweYKcmccTn53m","confirmation_method": "automatic","created": 1000000000,"currency": "usd","customer": "cus_NORMALIZED0001","description": "Payment for Invoice",- "id": "pi_NORMALIZED00000000000001",- "invoice": "in_NORMALIZED00000000000002",+ "id": "pi_NORMALIZED00000000000003",+ "invoice": "in_NORMALIZED00000000000003","last_payment_error": {"charge": "ch_NORMALIZED00000000000002","code": "card_declined","decline_code": "generic_decline","doc_url": "https://stripe.com/docs/error-codes/card-declined","message": "Your card was declined.",- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,"customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",+ "id": "pm_1JItSyA4KHR4JzRv1Y1r16Ay",+ "livemode": false,"metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null+ "object": "payment_method",+ "type": "card"},"type": "card_error"},@@ -464,34 +482,56 @@"transfer_data": null,"transfer_group": null},- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,"customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",+ "id": "pm_1JItSyA4KHR4JzRv1Y1r16Ay",+ "livemode": false,"metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null+ "object": "payment_method",+ "type": "card"},"type": "card_error"}},"param": null,- "request_id": "req_NORMALIZED0002"+ "request_id": "req_NORMALIZED0012"}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.pay.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.pay.2.jsonindex a39e5205ffe..a835e27391c 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.pay.2.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--Invoice.pay.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 5000,"amount_paid": 5000,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HhjrT",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HhjrT/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000358v2I",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000358v2I/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": true,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,16 +90,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0002",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": true,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": nulldiff --git a/corporate/tests/stripe_fixtures/replace_payment_source--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--InvoiceItem.create.1.jsonindex f722b040756..3aa8989852b 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--InvoiceItem.create.1.json@@ -6,7 +6,7 @@"description": "Payment (Card ending in 4242)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000002",+ "id": "ii_NORMALIZED00000000000003","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--InvoiceItem.create.2.jsonindex 3f346515e5e..54cacd84257 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--InvoiceItem.create.2.json@@ -6,7 +6,7 @@"description": "Zulip Standard","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000001",+ "id": "ii_NORMALIZED00000000000002","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/replace_payment_source--InvoiceItem.create.3.jsonindex 6812d3e0ce0..59db9ebd505 100644--- a/corporate/tests/stripe_fixtures/replace_payment_source--InvoiceItem.create.3.json+++ b/corporate/tests/stripe_fixtures/replace_payment_source--InvoiceItem.create.3.json@@ -6,7 +6,7 @@"description": null,"discountable": true,"discounts": [],- "id": "ii_NORMALIZED00000000000003",+ "id": "ii_NORMALIZED00000000000004","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..7317e6c5af9--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentIntent.confirm.1.json@@ -0,0 +1,166 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_Im1orO6NHwBivJ42MzxCIdEZr",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..62e803744bb--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_Im1orO6NHwBivJ42MzxCIdEZr",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..c43d87c7d3e--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.create.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.create.2.jsonnew file mode 100644index 00000000000..3363cb293d2--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.create.2.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JItSyA4KHR4JzRv1Y1r16Ay",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.create.3.json b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.create.3.jsonnew file mode 100644index 00000000000..c3973e8004d--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.create.3.json@@ -0,0 +1,47 @@+{+ "billing_details": {+ "address": {+ "city": null,+ "country": null,+ "line1": null,+ "line2": null,+ "postal_code": null,+ "state": null+ },+ "email": null,+ "name": null,+ "phone": null+ },+ "card": {+ "brand": "mastercard",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "generated_from": null,+ "last4": "4444",+ "networks": {+ "available": [+ "mastercard"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JItT7A4KHR4JzRvp5lQOWqG",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.list.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.list.1.jsonnew file mode 100644index 00000000000..4fa56da0a0f--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.list.1.json@@ -0,0 +1,101 @@+{+ "data": [+ {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JItSyA4KHR4JzRv1Y1r16Ay",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "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_1JItSjA4KHR4JzRvOLviKqCQ",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/payment_methods"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.list.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.list.2.jsonnew file mode 100644index 00000000000..f0dca83ed27--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--PaymentMethod.list.2.json@@ -0,0 +1,148 @@+{+ "data": [+ {+ "billing_details": {+ "address": {+ "city": null,+ "country": null,+ "line1": null,+ "line2": null,+ "postal_code": null,+ "state": null+ },+ "email": null,+ "name": null,+ "phone": null+ },+ "card": {+ "brand": "mastercard",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "generated_from": null,+ "last4": "4444",+ "networks": {+ "available": [+ "mastercard"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JItT7A4KHR4JzRvp5lQOWqG",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JItSyA4KHR4JzRv1Y1r16Ay",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000003",+ "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_1JItSjA4KHR4JzRvOLviKqCQ",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/payment_methods"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..337728aafe0--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JItSlA4KHR4JzRvR6Rwwr7M_secret_Jwn2lXV2MSEZKWF3wSVdeO7lc0vuJG5",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JItSlA4KHR4JzRvR6Rwwr7M",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JItSlA4KHR4JzRv7fAlEWY9",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "payment_method_options": {+ "card": {+ "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/replace_payment_source--SetupIntent.create.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.create.2.jsonnew file mode 100644index 00000000000..ee5bd192c2f--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.create.2.json@@ -0,0 +1,29 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JItSzA4KHR4JzRvhV3hBuoI_secret_Jwn3R0Urx34VCSRVhtzeSybhx5QLfbv",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JItSzA4KHR4JzRvhV3hBuoI",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JItSzA4KHR4JzRvyl097UvX",+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JItSyA4KHR4JzRv1Y1r16Ay",+ "payment_method_options": {+ "card": {+ "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/replace_payment_source--SetupIntent.create.3.json b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.create.3.jsonnew file mode 100644index 00000000000..f17b930b6b3--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.create.3.json@@ -0,0 +1,29 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JItT8A4KHR4JzRvbFwlwx9D_secret_Jwn3yh4lQUxNyuCFJbvla6fhpbuJznt",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JItT8A4KHR4JzRvbFwlwx9D",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JItT8A4KHR4JzRv01Rk9HCf",+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JItT7A4KHR4JzRvp5lQOWqG",+ "payment_method_options": {+ "card": {+ "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/replace_payment_source--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..5241aeccc5d--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JItSjA4KHR4JzRv9tSAgsFv_secret_Jwn2gEUp7bL0HJuowuuzPaCB43cDc1U",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JItSjA4KHR4JzRv9tSAgsFv",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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/replace_payment_source--SetupIntent.list.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.list.2.jsonnew file mode 100644index 00000000000..cb59e880de5--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.list.2.json@@ -0,0 +1,36 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JItSyA4KHR4JzRv4r8F5w0u_secret_Jwn3Gjl2zNzpeBitPsfBeAqO6QlyIm0",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JItSyA4KHR4JzRv4r8F5w0u",+ "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_options": {+ "card": {+ "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/replace_payment_source--SetupIntent.list.3.json b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.list.3.jsonnew file mode 100644index 00000000000..21cf11a6688--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.list.3.json@@ -0,0 +1,36 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JItT6A4KHR4JzRvXRrk3ZWq_secret_Jwn3gQ5ouf7fuzUaAufLXo3PVNtpLK9",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JItT6A4KHR4JzRvXRrk3ZWq",+ "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_options": {+ "card": {+ "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/replace_payment_source--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..337728aafe0--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JItSlA4KHR4JzRvR6Rwwr7M_secret_Jwn2lXV2MSEZKWF3wSVdeO7lc0vuJG5",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JItSlA4KHR4JzRvR6Rwwr7M",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JItSlA4KHR4JzRv7fAlEWY9",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JItSjA4KHR4JzRvOLviKqCQ",+ "payment_method_options": {+ "card": {+ "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/replace_payment_source--SetupIntent.retrieve.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.retrieve.2.jsonnew file mode 100644index 00000000000..ee5bd192c2f--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.retrieve.2.json@@ -0,0 +1,29 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JItSzA4KHR4JzRvhV3hBuoI_secret_Jwn3R0Urx34VCSRVhtzeSybhx5QLfbv",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JItSzA4KHR4JzRvhV3hBuoI",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JItSzA4KHR4JzRvyl097UvX",+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JItSyA4KHR4JzRv1Y1r16Ay",+ "payment_method_options": {+ "card": {+ "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/replace_payment_source--SetupIntent.retrieve.3.json b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.retrieve.3.jsonnew file mode 100644index 00000000000..f17b930b6b3--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--SetupIntent.retrieve.3.json@@ -0,0 +1,29 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JItT8A4KHR4JzRvbFwlwx9D_secret_Jwn3yh4lQUxNyuCFJbvla6fhpbuJznt",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JItT8A4KHR4JzRvbFwlwx9D",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JItT8A4KHR4JzRv01Rk9HCf",+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JItT7A4KHR4JzRvp5lQOWqG",+ "payment_method_options": {+ "card": {+ "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/replace_payment_source--Token.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--Token.create.1.jsondeleted file mode 100644index 60d47536e7c..00000000000--- a/corporate/tests/stripe_fixtures/replace_payment_source--Token.create.1.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1000000000,- "id": "tok_NORMALIZED00000000000001",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Token.create.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--Token.create.2.jsondeleted file mode 100644index ee7547e1043..00000000000--- a/corporate/tests/stripe_fixtures/replace_payment_source--Token.create.2.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000004",- "funding": "credit",- "id": "card_NORMALIZED00000000000004",- "last4": "9987",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1000000000,- "id": "tok_NORMALIZED00000000000002",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Token.create.3.json b/corporate/tests/stripe_fixtures/replace_payment_source--Token.create.3.jsondeleted file mode 100644index 64f08ed5a17..00000000000--- a/corporate/tests/stripe_fixtures/replace_payment_source--Token.create.3.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1000000000,- "id": "tok_NORMALIZED00000000000003",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--Token.create.4.json b/corporate/tests/stripe_fixtures/replace_payment_source--Token.create.4.jsondeleted file mode 100644index a0a35dd8cbf..00000000000--- a/corporate/tests/stripe_fixtures/replace_payment_source--Token.create.4.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "MasterCard",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000003",- "funding": "credit",- "id": "card_NORMALIZED00000000000003",- "last4": "4444",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1000000000,- "id": "tok_NORMALIZED00000000000004",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..0e8aeb9c2ac--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01EPECFRMhw7UNNmswnL1GlYzHKmeHmWpfl5Jpe78ESnqK62",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JItSjA4KHR4JzRv9tSAgsFv",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01EPECFRMhw7UNNmswnL1GlYzHKmeHmWpfl5Jpe78ESnqK62#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.create.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.create.2.jsonnew file mode 100644index 00000000000..da39b9ee5cd--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.create.2.json@@ -0,0 +1,38 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/billing/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED02XZkCnli4qbWit3T1APuzI3rj2qkSkZ0iz24HHIp2EjgVMv",+ "livemode": false,+ "locale": null,+ "metadata": {+ "type": "card_update"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JItSyA4KHR4JzRv4r8F5w0u",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED02XZkCnli4qbWit3T1APuzI3rj2qkSkZ0iz24HHIp2EjgVMv#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.create.3.json b/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.create.3.jsonnew file mode 100644index 00000000000..675f5abbd45--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.create.3.json@@ -0,0 +1,38 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/billing/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED03kNDyXXUBzC1CU3zYJopzvJOFN8Dmp9Bwg3OQOXmPZjSdCn",+ "livemode": false,+ "locale": null,+ "metadata": {+ "type": "card_update"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JItT6A4KHR4JzRvXRrk3ZWq",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED03kNDyXXUBzC1CU3zYJopzvJOFN8Dmp9Bwg3OQOXmPZjSdCn#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..9c54ed11c19--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01EPECFRMhw7UNNmswnL1GlYzHKmeHmWpfl5Jpe78ESnqK62",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JItSjA4KHR4JzRv9tSAgsFv",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01EPECFRMhw7UNNmswnL1GlYzHKmeHmWpfl5Jpe78ESnqK62#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.list.2.json b/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.list.2.jsonnew file mode 100644index 00000000000..a57bdf6dce4--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.list.2.json@@ -0,0 +1,45 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/billing/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED02XZkCnli4qbWit3T1APuzI3rj2qkSkZ0iz24HHIp2EjgVMv",+ "livemode": false,+ "locale": null,+ "metadata": {+ "type": "card_update"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JItSyA4KHR4JzRv4r8F5w0u",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED02XZkCnli4qbWit3T1APuzI3rj2qkSkZ0iz24HHIp2EjgVMv#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.list.3.json b/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.list.3.jsonnew file mode 100644index 00000000000..1ba4634dfb7--- /dev/null+++ b/corporate/tests/stripe_fixtures/replace_payment_source--checkout.Session.list.3.json@@ -0,0 +1,45 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/billing/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED03kNDyXXUBzC1CU3zYJopzvJOFN8Dmp9Bwg3OQOXmPZjSdCn",+ "livemode": false,+ "locale": null,+ "metadata": {+ "type": "card_update"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JItT6A4KHR4JzRvXRrk3ZWq",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED03kNDyXXUBzC1CU3zYJopzvJOFN8Dmp9Bwg3OQOXmPZjSdCn#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/restart_payment_intent_session_errors--Customer.create.1.json b/corporate/tests/stripe_fixtures/restart_payment_intent_session_errors--Customer.create.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/restart_payment_intent_session_errors--Customer.create.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/restart_payment_intent_session_errors--Customer.modify.1.json b/corporate/tests/stripe_fixtures/restart_payment_intent_session_errors--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/restart_payment_intent_session_errors--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/restart_payment_intent_session_errors--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/restart_payment_intent_session_errors--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..9e285958aaf--- /dev/null+++ b/corporate/tests/stripe_fixtures/restart_payment_intent_session_errors--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 4800,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_XfmDCnnw7QHfCrLura6EaMcGt",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/restart_payment_intent_session_errors--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/restart_payment_intent_session_errors--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..9078233c376--- /dev/null+++ b/corporate/tests/stripe_fixtures/restart_payment_intent_session_errors--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01fjqG9XpDuAeZC1DDV3fnkKZUOGFEXxsIv2ut813eRjys1k",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JPS5mA4KHR4JzRvMczPuuZG",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01fjqG9XpDuAeZC1DDV3fnkKZUOGFEXxsIv2ut813eRjys1k#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Charge.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Charge.create.1.jsondeleted file mode 100644index cccdeed3263..00000000000--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Charge.create.1.json+++ /dev/null@@ -1,117 +0,0 @@-{- "amount": 4800,- "amount_captured": 4800,- "amount_refunded": 0,- "application": null,- "application_fee": null,- "application_fee_amount": null,- "balance_transaction": "txn_NORMALIZED00000000000001",- "billing_details": {- "address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",- "line2": null,- "postal_code": "33333",- "state": null- },- "email": null,- "name": "Ada Starr",- "phone": null- },- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",- "captured": true,- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "description": "Upgrade to Zulip Standard, $8.0 x 6",- "destination": null,- "dispute": null,- "disputed": false,- "failure_code": null,- "failure_message": null,- "fraud_details": {},- "id": "ch_NORMALIZED00000000000001",- "invoice": null,- "livemode": false,- "metadata": {},- "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": null,- "payment_method": "card_NORMALIZED00000000000001",- "payment_method_details": {- "card": {- "brand": "visa",- "checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",- "cvc_check": "pass"- },- "country": "US",- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "installments": null,- "last4": "4242",- "network": "visa",- "three_d_secure": null,- "wallet": null- },- "type": "card"- },- "receipt_email": "[email protected]",- "receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",- "refunded": false,- "refunds": {- "data": [],- "has_more": false,- "object": "list",- "total_count": 0,- "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"- },- "review": null,- "shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "source_transfer": null,- "statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",- "status": "succeeded",- "transfer_data": null,- "transfer_group": null-}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.create.1.jsonindex 88d5c69190f..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.create.1.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.create.1.json@@ -3,7 +3,7 @@"balance": 0,"created": 1000000000,"currency": null,- "default_source": "card_NORMALIZED00000000000001",+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.modify.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.modify.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.modify.2.jsonnew file mode 100644index 00000000000..ef9b65edcb4--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.retrieve.1.jsonindex 3d384443cbd..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.retrieve.1.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.retrieve.1.json@@ -2,32 +2,8 @@"address": null,"balance": 0,"created": 1000000000,- "currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "currency": null,+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -45,43 +21,10 @@"realm_str": "zulip"},"name": null,- "next_invoice_sequence": 2,+ "next_invoice_sequence": 1,"object": "customer","phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.retrieve.2.jsonnew file mode 100644index 00000000000..c08632dc257--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Customer.retrieve.2.json@@ -0,0 +1,76 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "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": 3,+ "exp_year": 2033,+ "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_1JTq97A4KHR4JzRvSZnWE2hG",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 2,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Event.list.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Event.list.1.jsonnew file mode 100644index 00000000000..a8198d91e96--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Event.list.1.json@@ -0,0 +1,162 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 5000,+ "amount_paid": 5000,+ "amount_remaining": 0,+ "application_fee_amount": null,+ "attempt_count": 1,+ "attempted": true,+ "auto_advance": false,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": "ch_NORMALIZED00000000000001",+ "collection_method": "charge_automatically",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001AY8rm",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001AY8rm/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 5000,+ "currency": "usd",+ "description": null,+ "discount_amounts": [],+ "discountable": true,+ "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",+ "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": 5000,+ "unit_amount_decimal": "5000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": null,+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 5000,+ "tax": null,+ "total": 5000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ "previous_attributes": {+ "amount_paid": 0,+ "amount_remaining": 5000,+ "charge": "ch_NORMALIZED00000000000002",+ "paid": false,+ "status": "open",+ "status_transitions": {+ "paid_at": null+ }+ }+ },+ "id": "evt_1JTq92A4KHR4JzRvfATTwhBo",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "e8c8ea22-d83f-48c1-b811-9e1f16fb7ddb"+ },+ "type": "invoice.updated"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Event.list.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Event.list.2.jsonnew file mode 100644index 00000000000..14beba7b7aa--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Event.list.2.json@@ -0,0 +1,702 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 4800,+ "amount_capturable": 0,+ "amount_received": 4800,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 4800,+ "amount_captured": 4800,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000003",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000003/rcpt_NORMALIZED000000000000000000001",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000003/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_eAYqbQky9PWR3EM4jyo2zhHsu",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq95A4KHR4JzRv0CWNfJLz",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "4a0a31e9-0191-4564-910e-4f1e3309a63e"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 4800,+ "amount_captured": 4800,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000003",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000003/rcpt_NORMALIZED000000000000000000001",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000003/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq95A4KHR4JzRv0HSUFgr9",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "4a0a31e9-0191-4564-910e-4f1e3309a63e"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTq9BA4KHR4JzRvvT0DMGGm",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "cf920f0c-8de4-4224-b6e6-4a375f6f1e70"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq98A4KHR4JzRviwuCJz36_secret_K86LmMkdTzJlxssQnCI1546mzv80uql",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq98A4KHR4JzRviwuCJz36",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq98A4KHR4JzRvdIJPVVUE",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq99A4KHR4JzRvxRjtEqiR",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "5304ab03-42ba-4bf1-b154-eeeccd23c977"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "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_1JTq97A4KHR4JzRvSZnWE2hG",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq98A4KHR4JzRvwIjD1Cgr",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "5304ab03-42ba-4bf1-b154-eeeccd23c977"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq98A4KHR4JzRviwuCJz36_secret_K86LmMkdTzJlxssQnCI1546mzv80uql",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq98A4KHR4JzRviwuCJz36",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq98A4KHR4JzRvdIJPVVUE",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq99A4KHR4JzRvkzbuFLbk",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "5304ab03-42ba-4bf1-b154-eeeccd23c977"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq96A4KHR4JzRvgey5CO00_secret_K86LoAZrKEmcyyz7GdtTTU5s6Wz9MOF",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq96A4KHR4JzRvgey5CO00",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq96A4KHR4JzRvCUqimRxn",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "8e99fc5c-5f31-4824-bd67-939d1d922bd6"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 4800,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_eAYqbQky9PWR3EM4jyo2zhHsu",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq95A4KHR4JzRv0Kuuj1fJ",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "ba5b4242-0dd0-4ad8-9fc3-6cbe5923138e"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTq94A4KHR4JzRvavWuEodl",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "e1f66dd0-73d4-4ddf-9147-09f54f57eea0"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Event.list.3.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Event.list.3.jsonnew file mode 100644index 00000000000..9d0eaec73ed--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Event.list.3.json@@ -0,0 +1,1261 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 4800,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -4800,+ "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",+ "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": -4800,+ "unit_amount_decimal": "-4800"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq9HA4KHR4JzRvrLhi8wCj",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "09f3d2e8-b993-491c-b328-e6fe9bf446f0"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 4800,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -4800,+ "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",+ "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": -4800,+ "unit_amount_decimal": "-4800"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq9HA4KHR4JzRvsazbsn7L",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "09f3d2e8-b993-491c-b328-e6fe9bf446f0"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 4800,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -4800,+ "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",+ "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": -4800,+ "unit_amount_decimal": "-4800"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq9HA4KHR4JzRvgZ7AJS73",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "09f3d2e8-b993-491c-b328-e6fe9bf446f0"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 4800,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -4800,+ "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",+ "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": -4800,+ "unit_amount_decimal": "-4800"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1JTq9GA4KHR4JzRvblmuIbJD",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "09f3d2e8-b993-491c-b328-e6fe9bf446f0"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 4800,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -4800,+ "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",+ "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": -4800,+ "unit_amount_decimal": "-4800"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq9GA4KHR4JzRvSh8CWRph",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "36488c06-d88a-4d46-b241-1d54817f97fd"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -4800,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000003",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -4800,+ "unit_amount_decimal": "-4800"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -4800,+ "unit_amount_decimal": "-4800"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq9GA4KHR4JzRvRXlU7Q3U",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "36488c06-d88a-4d46-b241-1d54817f97fd"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 4800,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 800,+ "unit_amount_decimal": "800"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq9GA4KHR4JzRvQR2zdGq9",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "36488c06-d88a-4d46-b241-1d54817f97fd"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 4800,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 800,+ "unit_amount_decimal": "800"+ }+ },+ "id": "evt_1JTq9FA4KHR4JzRvaz4WcxiW",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "c4011fbe-56ec-4396-bdcc-d8b13c0a3542"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -4800,+ "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",+ "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": -4800,+ "unit_amount_decimal": "-4800"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -4800,+ "unit_amount_decimal": "-4800"+ }+ },+ "id": "evt_1JTq9EA4KHR4JzRv2On4hb7s",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "77a330bb-2dbf-48bb-b38f-8065d3eaed7f"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JTq9EA4KHR4JzRv3iZ0OsCN",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "77a330bb-2dbf-48bb-b38f-8065d3eaed7f"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Event.list.4.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Event.list.4.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Event.list.4.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.1.jsonindex 73930ab9c61..4f5a834a3a0 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000001",+ "id": "in_NORMALIZED00000000000002","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"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",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -132,7 +134,7 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.2.jsonindex 0923f62afad..4060478b33c 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.2.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 11200,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000002",+ "id": "in_NORMALIZED00000000000003","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,7 +90,7 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.3.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.3.jsonindex 456a0267ae4..249bfcbc525 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.3.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.3.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 200000,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000003",+ "id": "in_NORMALIZED00000000000004","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000005",- "invoice_item": "ii_NORMALIZED00000000000005",+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000005",+ "id": "price_NORMALIZED00000000000006","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0005",+ "product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,7 +134,7 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"},"livemode": false,"metadata": {},@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.4.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.4.jsonindex 4d5f1378680..dd82a961adc 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.4.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.4.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 36830,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000004",+ "id": "in_NORMALIZED00000000000005","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000006",- "invoice_item": "ii_NORMALIZED00000000000006",+ "id": "il_NORMALIZED00000000000007",+ "invoice_item": "ii_NORMALIZED00000000000007","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000006",+ "id": "price_NORMALIZED00000000000007","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0006",+ "product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,7 +90,7 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000005/lines"},"livemode": false,"metadata": {},@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.5.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.5.jsonindex 971e5617a6d..386c8446708 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.5.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.create.5.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 240000,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000005",+ "id": "in_NORMALIZED00000000000006","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000007",- "invoice_item": "ii_NORMALIZED00000000000007",+ "id": "il_NORMALIZED00000000000008",+ "invoice_item": "ii_NORMALIZED00000000000008","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000007",+ "id": "price_NORMALIZED00000000000008","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0007",+ "product": "prod_NORMALIZED0008","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,7 +90,7 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000005/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000006/lines"},"livemode": false,"metadata": {},@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.1.jsonindex 46081635658..f8c1e4a8eb7 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001c9NkE",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001c9NkE/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"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",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -132,12 +134,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": true,@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.2.jsonindex 6f2442d53cd..38674ab8175 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.2.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 11200,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002tFPYq",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002tFPYq/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003NRa5x",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003NRa5x/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,16 +90,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0002",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.3.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.3.jsonindex eed7cd4b158..b22bdb0739a 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.3.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.3.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 200000,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003RcbKD",- "id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003RcbKD/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004Hk35b",+ "id": "in_NORMALIZED00000000000004",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004Hk35b/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000005",- "invoice_item": "ii_NORMALIZED00000000000005",+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000005",+ "id": "price_NORMALIZED00000000000006","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0005",+ "product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,16 +134,16 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0003",+ "number": "NORMALI-0005","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000004","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.4.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.4.jsonindex 612cdb801b6..db971af1c71 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.4.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.4.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 36830,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004DQYsz",- "id": "in_NORMALIZED00000000000004",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004DQYsz/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005jAl7u",+ "id": "in_NORMALIZED00000000000005",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005jAl7u/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000006",- "invoice_item": "ii_NORMALIZED00000000000006",+ "id": "il_NORMALIZED00000000000007",+ "invoice_item": "ii_NORMALIZED00000000000007","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000006",+ "id": "price_NORMALIZED00000000000007","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0006",+ "product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,16 +90,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000005/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0004",+ "number": "NORMALI-0006","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000003",+ "payment_intent": "pi_NORMALIZED00000000000005","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.5.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.5.jsonindex e9aa908a1b0..f88de340517 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.5.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.finalize_invoice.5.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 240000,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005uuk0y",- "id": "in_NORMALIZED00000000000005",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005uuk0y/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000006DNnSr",+ "id": "in_NORMALIZED00000000000006",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000006DNnSr/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000007",- "invoice_item": "ii_NORMALIZED00000000000007",+ "id": "il_NORMALIZED00000000000008",+ "invoice_item": "ii_NORMALIZED00000000000008","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000007",+ "id": "price_NORMALIZED00000000000008","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0007",+ "product": "prod_NORMALIZED0008","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,16 +90,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000005/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000006/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0005",+ "number": "NORMALI-0007","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000004",+ "payment_intent": "pi_NORMALIZED00000000000006","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.1.jsonindex cfd1ee25d70..e39960ab725 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.1.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.1.json@@ -1,479 +1,5 @@{- "data": [- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 200000,- "amount_paid": 0,- "amount_remaining": 200000,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003RcbKD",- "id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003RcbKD/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 40000,- "currency": "usd",- "description": "Additional license (Feb 2, 2012 - Feb 2, 2013)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1359774245,- "start": 1328151845- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000004",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0004",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 8000,- "unit_amount_decimal": "8000"- },- "proration": false,- "quantity": 5,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- },- {- "amount": 160000,- "currency": "usd",- "description": "Zulip Standard - renewal",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000005",- "invoice_item": "ii_NORMALIZED00000000000005",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1359774245,- "start": 1328151845- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000005",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0005",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 8000,- "unit_amount_decimal": "8000"- },- "proration": false,- "quantity": 20,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": 1000000000,- "number": "NORMALI-0003",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000002",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 200000,- "tax": null,- "total": 200000,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- },- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 11200,- "amount_paid": 0,- "amount_remaining": 11200,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002tFPYq",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002tFPYq/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 11200,- "currency": "usd",- "description": "Additional license (Jan 2, 2012 - Feb 2, 2012)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1328151845,- "start": 1325473445- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000003",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0003",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 800,- "unit_amount_decimal": "800"- },- "proration": false,- "quantity": 14,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": 1000000000,- "number": "NORMALI-0002",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 11200,- "tax": null,- "total": 11200,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- },- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 0,- "amount_paid": 0,- "amount_remaining": 0,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001c9NkE",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001c9NkE/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 4800,- "currency": "usd",- "description": "Zulip Standard",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1328151845,- "start": 1325473445- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000001",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0001",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 800,- "unit_amount_decimal": "800"- },- "proration": false,- "quantity": 6,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- },- {- "amount": -4800,- "currency": "usd",- "description": "Payment (Card ending in 4242)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1000000000,- "start": 1000000000- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000002",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0002",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": -4800,- "unit_amount_decimal": "-4800"- },- "proration": false,- "quantity": 1,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": null,- "number": "NORMALI-0001",- "object": "invoice",- "on_behalf_of": null,- "paid": true,- "payment_intent": null,- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "paid",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": 1000000000,- "voided_at": null- },- "subscription": null,- "subtotal": 0,- "tax": null,- "total": 0,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- }- ],+ "data": [],"has_more": false,"object": "list","url": "/v1/invoices"diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.2.jsonindex 4ef3e16fb4b..b514b2fc2c6 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.2.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.2.json@@ -2,136 +2,7 @@"data": [{"account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 36830,- "amount_paid": 0,- "amount_remaining": 36830,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004DQYsz",- "id": "in_NORMALIZED00000000000004",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004DQYsz/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 36830,- "currency": "usd",- "description": "Additional license (Mar 2, 2012 - Feb 2, 2013)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000006",- "invoice_item": "ii_NORMALIZED00000000000006",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1359774245,- "start": 1330657445- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000006",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0006",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 7366,- "unit_amount_decimal": "7366"- },- "proration": false,- "quantity": 5,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": 1000000000,- "number": "NORMALI-0004",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000003",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 36830,- "tax": null,- "total": 36830,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- },- {- "account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 200000,"amount_paid": 0,@@ -167,9 +38,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003RcbKD",- "id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003RcbKD/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004Hk35b",+ "id": "in_NORMALIZED00000000000004",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004Hk35b/pdf","last_finalization_error": null,"lines": {"data": [@@ -180,8 +51,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -195,14 +66,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -223,8 +95,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000005",- "invoice_item": "ii_NORMALIZED00000000000005",+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006","livemode": false,"metadata": {},"object": "line_item",@@ -238,14 +110,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000005",+ "id": "price_NORMALIZED00000000000006","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0005",+ "product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -263,16 +136,16 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0003",+ "number": "NORMALI-0005","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000004","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -299,11 +172,11 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 11200,"amount_paid": 0,@@ -339,9 +212,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002tFPYq",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002tFPYq/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003NRa5x",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003NRa5x/pdf","last_finalization_error": null,"lines": {"data": [@@ -352,8 +225,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -367,14 +240,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -392,16 +266,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0002",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -428,11 +302,11 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -468,9 +342,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001c9NkE",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001c9NkE/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ/pdf","last_finalization_error": null,"lines": {"data": [@@ -481,8 +355,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -496,14 +370,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -524,8 +399,8 @@"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",@@ -539,14 +414,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -564,12 +440,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": true,diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.3.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.3.jsonindex bc50ee5c03b..a28d0d21047 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.3.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.3.json@@ -2,136 +2,7 @@"data": [{"account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 240000,- "amount_paid": 0,- "amount_remaining": 240000,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005uuk0y",- "id": "in_NORMALIZED00000000000005",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005uuk0y/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 240000,- "currency": "usd",- "description": "Zulip Standard - renewal",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000007",- "invoice_item": "ii_NORMALIZED00000000000007",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1391310245,- "start": 1359774245- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000007",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0007",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 8000,- "unit_amount_decimal": "8000"- },- "proration": false,- "quantity": 30,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000005/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": 1000000000,- "number": "NORMALI-0005",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000004",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 240000,- "tax": null,- "total": 240000,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- },- {- "account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 36830,"amount_paid": 0,@@ -167,9 +38,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004DQYsz",- "id": "in_NORMALIZED00000000000004",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004DQYsz/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005jAl7u",+ "id": "in_NORMALIZED00000000000005",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005jAl7u/pdf","last_finalization_error": null,"lines": {"data": [@@ -180,8 +51,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000006",- "invoice_item": "ii_NORMALIZED00000000000006",+ "id": "il_NORMALIZED00000000000007",+ "invoice_item": "ii_NORMALIZED00000000000007","livemode": false,"metadata": {},"object": "line_item",@@ -195,14 +66,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000006",+ "id": "price_NORMALIZED00000000000007","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0006",+ "product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -220,16 +92,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000005/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0004",+ "number": "NORMALI-0006","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000003",+ "payment_intent": "pi_NORMALIZED00000000000005","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -260,7 +132,7 @@},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 200000,"amount_paid": 0,@@ -296,9 +168,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003RcbKD",- "id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003RcbKD/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004Hk35b",+ "id": "in_NORMALIZED00000000000004",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004Hk35b/pdf","last_finalization_error": null,"lines": {"data": [@@ -309,8 +181,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -324,14 +196,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -352,8 +225,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000005",- "invoice_item": "ii_NORMALIZED00000000000005",+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006","livemode": false,"metadata": {},"object": "line_item",@@ -367,14 +240,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000005",+ "id": "price_NORMALIZED00000000000006","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0005",+ "product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -392,16 +266,16 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0003",+ "number": "NORMALI-0005","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000004","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -428,11 +302,11 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 11200,"amount_paid": 0,@@ -468,9 +342,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002tFPYq",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002tFPYq/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003NRa5x",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003NRa5x/pdf","last_finalization_error": null,"lines": {"data": [@@ -481,8 +355,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -496,14 +370,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -521,16 +396,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0002",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -557,11 +432,11 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -597,9 +472,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001c9NkE",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001c9NkE/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ/pdf","last_finalization_error": null,"lines": {"data": [@@ -610,8 +485,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -625,14 +500,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -653,8 +529,8 @@"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",@@ -668,14 +544,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -693,12 +570,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": true,diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.4.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.4.jsonnew file mode 100644index 00000000000..df6855bb08a--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Invoice.list.4.json@@ -0,0 +1,745 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 240000,+ "amount_paid": 0,+ "amount_remaining": 240000,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000006DNnSr",+ "id": "in_NORMALIZED00000000000006",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000006DNnSr/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 240000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000008",+ "invoice_item": "ii_NORMALIZED00000000000008",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1391310245,+ "start": 1359774245+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000008",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0008",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 30,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000006/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0007",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000006",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 240000,+ "tax": null,+ "total": 240000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 36830,+ "amount_paid": 0,+ "amount_remaining": 36830,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005jAl7u",+ "id": "in_NORMALIZED00000000000005",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000005jAl7u/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 36830,+ "currency": "usd",+ "description": "Additional license (Mar 2, 2012 - Feb 2, 2013)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000007",+ "invoice_item": "ii_NORMALIZED00000000000007",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1359774245,+ "start": 1330657445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000007",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0007",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 7366,+ "unit_amount_decimal": "7366"+ },+ "proration": false,+ "quantity": 5,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000005/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0006",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000005",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 36830,+ "tax": null,+ "total": 36830,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 200000,+ "amount_paid": 0,+ "amount_remaining": 200000,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004Hk35b",+ "id": "in_NORMALIZED00000000000004",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004Hk35b/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 40000,+ "currency": "usd",+ "description": "Additional license (Feb 2, 2012 - Feb 2, 2013)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1359774245,+ "start": 1328151845+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 5,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": 160000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1359774245,+ "start": 1328151845+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000006",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0006",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 20,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0005",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000004",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 200000,+ "tax": null,+ "total": 200000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 11200,+ "amount_paid": 0,+ "amount_remaining": 11200,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003NRa5x",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003NRa5x/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 11200,+ "currency": "usd",+ "description": "Additional license (Jan 2, 2012 - Feb 2, 2012)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 14,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0004",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000003",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 11200,+ "tax": null,+ "total": 11200,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002GAcqJ/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 4800,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -4800,+ "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",+ "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": -4800,+ "unit_amount_decimal": "-4800"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.1.jsonindex 4ffd2a77d92..efeee36e46d 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.1.json@@ -6,7 +6,7 @@"description": "Payment (Card ending in 4242)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000002",+ "id": "ii_NORMALIZED00000000000003","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.2.jsonindex 7c21fa33199..7b45efc89b5 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.2.json@@ -6,7 +6,7 @@"description": "Zulip Standard","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000001",+ "id": "ii_NORMALIZED00000000000002","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.3.jsonindex df781a6bf92..d6252b05bc8 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.3.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.3.json@@ -6,7 +6,7 @@"description": "Additional license (Jan 2, 2012 - Feb 2, 2012)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000003",+ "id": "ii_NORMALIZED00000000000004","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.4.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.4.jsonindex e984120548e..d12c606a755 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.4.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.4.json@@ -6,7 +6,7 @@"description": "Zulip Standard - renewal","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000005",+ "id": "ii_NORMALIZED00000000000006","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000005",+ "id": "price_NORMALIZED00000000000006","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0005",+ "product": "prod_NORMALIZED0006","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.5.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.5.jsonindex 6fcb44d187d..f7524c0a90c 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.5.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.5.json@@ -6,7 +6,7 @@"description": "Additional license (Feb 2, 2012 - Feb 2, 2013)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000004",+ "id": "ii_NORMALIZED00000000000005","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.6.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.6.jsonindex a11e2a56ef2..eb087a3c58e 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.6.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.6.json@@ -6,7 +6,7 @@"description": "Additional license (Mar 2, 2012 - Feb 2, 2013)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000006",+ "id": "ii_NORMALIZED00000000000007","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000006",+ "id": "price_NORMALIZED00000000000007","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0006",+ "product": "prod_NORMALIZED0007","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.7.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.7.jsonindex 41c8bd7b139..bddb07491a7 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.7.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--InvoiceItem.create.7.json@@ -6,7 +6,7 @@"description": "Zulip Standard - renewal","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000007",+ "id": "ii_NORMALIZED00000000000008","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000007",+ "id": "price_NORMALIZED00000000000008","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0007",+ "product": "prod_NORMALIZED0008","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..9b3a9da75d6--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--PaymentIntent.confirm.1.json@@ -0,0 +1,166 @@+{+ "amount": 4800,+ "amount_capturable": 0,+ "amount_received": 4800,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 4800,+ "amount_captured": 4800,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000003",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000003/rcpt_NORMALIZED000000000000000000001",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000003/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_eAYqbQky9PWR3EM4jyo2zhHsu",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..d2546511f92--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 4800,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_eAYqbQky9PWR3EM4jyo2zhHsu",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..3f36fc95b14--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "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": null,+ "id": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..0d2623f3795--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq98A4KHR4JzRviwuCJz36_secret_K86LmMkdTzJlxssQnCI1546mzv80uql",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq98A4KHR4JzRviwuCJz36",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq98A4KHR4JzRvdIJPVVUE",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "payment_method_options": {+ "card": {+ "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/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..63d4b494886--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq96A4KHR4JzRvgey5CO00_secret_K86LoAZrKEmcyyz7GdtTTU5s6Wz9MOF",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq96A4KHR4JzRvgey5CO00",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..0d2623f3795--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq98A4KHR4JzRviwuCJz36_secret_K86LmMkdTzJlxssQnCI1546mzv80uql",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq98A4KHR4JzRviwuCJz36",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq98A4KHR4JzRvdIJPVVUE",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq97A4KHR4JzRvSZnWE2hG",+ "payment_method_options": {+ "card": {+ "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/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Token.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Token.create.1.jsondeleted file mode 100644index 60d47536e7c..00000000000--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--Token.create.1.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1000000000,- "id": "tok_NORMALIZED00000000000001",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..a29c70c25d4--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01On9K8hRUMxo07lkNMXvbyz7KhBqzN27rvFKGxSM5OvtJT5",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq96A4KHR4JzRvgey5CO00",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01On9K8hRUMxo07lkNMXvbyz7KhBqzN27rvFKGxSM5OvtJT5#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..6309c68d588--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_automatic_license_management--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01On9K8hRUMxo07lkNMXvbyz7KhBqzN27rvFKGxSM5OvtJT5",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq96A4KHR4JzRvgey5CO00",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01On9K8hRUMxo07lkNMXvbyz7KhBqzN27rvFKGxSM5OvtJT5#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Charge.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Charge.create.1.jsondeleted file mode 100644index d104330f0e4..00000000000--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Charge.create.1.json+++ /dev/null@@ -1,117 +0,0 @@-{- "amount": 28000,- "amount_captured": 28000,- "amount_refunded": 0,- "application": null,- "application_fee": null,- "application_fee_amount": null,- "balance_transaction": "txn_NORMALIZED00000000000001",- "billing_details": {- "address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",- "line2": null,- "postal_code": "33333",- "state": null- },- "email": null,- "name": "Ada Starr",- "phone": null- },- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",- "captured": true,- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "description": "Upgrade to Zulip Standard, $8.0 x 35",- "destination": null,- "dispute": null,- "disputed": false,- "failure_code": null,- "failure_message": null,- "fraud_details": {},- "id": "ch_NORMALIZED00000000000001",- "invoice": null,- "livemode": false,- "metadata": {},- "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": null,- "payment_method": "card_NORMALIZED00000000000001",- "payment_method_details": {- "card": {- "brand": "visa",- "checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",- "cvc_check": "pass"- },- "country": "US",- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "installments": null,- "last4": "4242",- "network": "visa",- "three_d_secure": null,- "wallet": null- },- "type": "card"- },- "receipt_email": "[email protected]",- "receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",- "refunded": false,- "refunds": {- "data": [],- "has_more": false,- "object": "list",- "total_count": 0,- "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"- },- "review": null,- "shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "source_transfer": null,- "statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",- "status": "succeeded",- "transfer_data": null,- "transfer_group": null-}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.create.1.jsonindex 88d5c69190f..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.create.1.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.create.1.json@@ -3,7 +3,7 @@"balance": 0,"created": 1000000000,"currency": null,- "default_source": "card_NORMALIZED00000000000001",+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.modify.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.modify.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.modify.2.jsonnew file mode 100644index 00000000000..38a6385c4ba--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.retrieve.1.jsonindex 3d384443cbd..730ed973b02 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.retrieve.1.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.retrieve.1.json@@ -2,32 +2,8 @@"address": null,"balance": 0,"created": 1000000000,- "currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "currency": null,+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -45,43 +21,10 @@"realm_str": "zulip"},"name": null,- "next_invoice_sequence": 2,+ "next_invoice_sequence": 1,"object": "customer","phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.retrieve.2.jsonnew file mode 100644index 00000000000..bd90ba3713a--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Customer.retrieve.2.json@@ -0,0 +1,76 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "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": 3,+ "exp_year": 2033,+ "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_1JTq9aA4KHR4JzRvX1SBKYte",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 2,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Event.list.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Event.list.1.jsonnew file mode 100644index 00000000000..a79a249ddfd--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Event.list.1.json@@ -0,0 +1,152 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 240000,+ "amount_paid": 0,+ "amount_remaining": 240000,+ "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_NORMALIZED0002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001DNnSr",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001DNnSr/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 240000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1391310245,+ "start": 1359774245+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 30,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 240000,+ "tax": null,+ "total": 240000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq9WA4KHR4JzRvdva74aNS",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "9c9b7b47-c4b5-43b5-8874-7b0f7c3542e0"+ },+ "type": "invoice.finalized"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Event.list.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Event.list.2.jsonnew file mode 100644index 00000000000..7930b8e1139--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Event.list.2.json@@ -0,0 +1,702 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 28000,+ "amount_capturable": 0,+ "amount_received": 28000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 28000,+ "amount_captured": 28000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 35",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_klZSvBukSGd5KJGHlnsnE6k4j",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 35",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq9ZA4KHR4JzRv09qs62hf",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "ccacd0e5-e0b3-4e01-a191-981d4a916428"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 28000,+ "amount_captured": 28000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 35",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq9ZA4KHR4JzRv0eIYvgfn",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "ccacd0e5-e0b3-4e01-a191-981d4a916428"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTq9eA4KHR4JzRvq0nuiWiF",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "5b68db8e-e05c-4251-8cfe-3d2f5122b2c2"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq9bA4KHR4JzRvtLr9BV2z_secret_K86Mlb6dFfrRR6CQtcQqJFBGCAbQ48r",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq9bA4KHR4JzRvtLr9BV2z",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq9bA4KHR4JzRvnjbJhhlo",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq9cA4KHR4JzRv2Tp1i70r",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "e71e1d72-de93-461b-98ca-50f0a13c13cc"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "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_1JTq9aA4KHR4JzRvX1SBKYte",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq9cA4KHR4JzRvpz1dYmng",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "e71e1d72-de93-461b-98ca-50f0a13c13cc"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq9bA4KHR4JzRvtLr9BV2z_secret_K86Mlb6dFfrRR6CQtcQqJFBGCAbQ48r",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq9bA4KHR4JzRvtLr9BV2z",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq9bA4KHR4JzRvnjbJhhlo",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq9cA4KHR4JzRvrxMO5V6M",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "e71e1d72-de93-461b-98ca-50f0a13c13cc"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq9ZA4KHR4JzRvcqAq17cM_secret_K86MI2znRL8mWPa6ZlJY2g58kBr5DM0",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq9ZA4KHR4JzRvcqAq17cM",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq9ZA4KHR4JzRv0cVNF1cA",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "70853208-26e9-4bf0-b025-77c8da22f01f"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 28000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_klZSvBukSGd5KJGHlnsnE6k4j",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 35",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq9ZA4KHR4JzRv0Bqj7al6",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "245b38b6-bde9-4669-b669-0e0403edfb69"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTq9YA4KHR4JzRvbB2FUjtC",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "273adcf4-03af-48ea-8087-6ecd984ca15a"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Event.list.3.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Event.list.3.jsonnew file mode 100644index 00000000000..26b76f11596--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Event.list.3.json@@ -0,0 +1,1261 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 28000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 35,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -28000,+ "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",+ "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": -28000,+ "unit_amount_decimal": "-28000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1JTq9kA4KHR4JzRvfeYb4IYP",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "6c82e931-8114-4a64-8040-780bf55c12ce"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 28000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 35,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -28000,+ "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",+ "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": -28000,+ "unit_amount_decimal": "-28000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1JTq9kA4KHR4JzRvwAUdr5ZQ",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "6c82e931-8114-4a64-8040-780bf55c12ce"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 28000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 35,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -28000,+ "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",+ "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": -28000,+ "unit_amount_decimal": "-28000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1JTq9kA4KHR4JzRvEllKoFmF",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "6c82e931-8114-4a64-8040-780bf55c12ce"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 28000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 35,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -28000,+ "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",+ "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": -28000,+ "unit_amount_decimal": "-28000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1JTq9kA4KHR4JzRv5NuzJgXT",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "6c82e931-8114-4a64-8040-780bf55c12ce"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 28000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 35,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -28000,+ "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",+ "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": -28000,+ "unit_amount_decimal": "-28000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq9jA4KHR4JzRvWLfHVN4T",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "6d73b9ee-5258-4f0a-8c46-c08f89708e3a"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -28000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000003",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -28000,+ "unit_amount_decimal": "-28000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -28000,+ "unit_amount_decimal": "-28000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq9jA4KHR4JzRveMARERr8",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "6d73b9ee-5258-4f0a-8c46-c08f89708e3a"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 28000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 35,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 800,+ "unit_amount_decimal": "800"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq9jA4KHR4JzRvIOlTFyEB",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "6d73b9ee-5258-4f0a-8c46-c08f89708e3a"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 28000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 35,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 800,+ "unit_amount_decimal": "800"+ }+ },+ "id": "evt_1JTq9iA4KHR4JzRvm3fJNdeB",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "fbe89d88-66f6-4ea9-b49d-afa9968d17a9"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -28000,+ "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",+ "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": -28000,+ "unit_amount_decimal": "-28000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -28000,+ "unit_amount_decimal": "-28000"+ }+ },+ "id": "evt_1JTq9hA4KHR4JzRvdapVyKEq",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "05997cd7-890f-4eea-a319-6ab14769d4b6"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JTq9hA4KHR4JzRvuggbJX1D",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "05997cd7-890f-4eea-a319-6ab14769d4b6"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Event.list.4.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Event.list.4.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Event.list.4.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.create.1.jsonindex c2745002eb4..d061d3144b7 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000001",+ "id": "in_NORMALIZED00000000000002","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"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",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -132,7 +134,7 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.create.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.create.2.jsonindex f0a36f16700..58a28b615b9 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.create.2.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.create.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 280000,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000002",+ "id": "in_NORMALIZED00000000000003","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,7 +90,7 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.create.3.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.create.3.jsonindex 5265de6b717..3f5c4d61149 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.create.3.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.create.3.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 280000,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000003",+ "id": "in_NORMALIZED00000000000004","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,7 +90,7 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"},"livemode": false,"metadata": {},@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.finalize_invoice.1.jsonindex 1dbe8402ecb..aa9921f433f 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001eoy5M",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001eoy5M/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"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",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -132,12 +134,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": true,diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.finalize_invoice.2.jsonindex 516f5667b93..87ea76b0390 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.finalize_invoice.2.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.finalize_invoice.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 280000,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002A8nya",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002A8nya/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003XF8Ro",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003XF8Ro/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,16 +90,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0002",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.finalize_invoice.3.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.finalize_invoice.3.jsonindex c8c04114835..593b4029a0d 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.finalize_invoice.3.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.finalize_invoice.3.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 280000,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000032usLo",- "id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000032usLo/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004yiX1T",+ "id": "in_NORMALIZED00000000000004",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004yiX1T/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,16 +90,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0003",+ "number": "NORMALI-0005","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000004","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.list.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.list.1.jsonindex de545b70e3d..e39960ab725 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.list.1.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.list.1.json@@ -1,307 +1,5 @@{- "data": [- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 280000,- "amount_paid": 0,- "amount_remaining": 280000,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002A8nya",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002A8nya/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 280000,- "currency": "usd",- "description": "Zulip Standard - renewal",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1359774245,- "start": 1328151845- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000003",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0003",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 8000,- "unit_amount_decimal": "8000"- },- "proration": false,- "quantity": 35,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": 1000000000,- "number": "NORMALI-0002",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 280000,- "tax": null,- "total": 280000,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- },- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 0,- "amount_paid": 0,- "amount_remaining": 0,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001eoy5M",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001eoy5M/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 28000,- "currency": "usd",- "description": "Zulip Standard",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1328151845,- "start": 1325473445- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000001",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0001",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 800,- "unit_amount_decimal": "800"- },- "proration": false,- "quantity": 35,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- },- {- "amount": -28000,- "currency": "usd",- "description": "Payment (Card ending in 4242)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1000000000,- "start": 1000000000- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000002",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0002",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": -28000,- "unit_amount_decimal": "-28000"- },- "proration": false,- "quantity": 1,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": null,- "number": "NORMALI-0001",- "object": "invoice",- "on_behalf_of": null,- "paid": true,- "payment_intent": null,- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "paid",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": 1000000000,- "voided_at": null- },- "subscription": null,- "subtotal": 0,- "tax": null,- "total": 0,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- }- ],+ "data": [],"has_more": false,"object": "list","url": "/v1/invoices"diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.list.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.list.2.jsonindex 88b4cc624ea..c4b5536f66f 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.list.2.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.list.2.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 280000,"amount_paid": 0,@@ -38,9 +38,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000032usLo",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003XF8Ro","id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000032usLo/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003XF8Ro/pdf","last_finalization_error": null,"lines": {"data": [@@ -57,8 +57,8 @@"metadata": {},"object": "line_item","period": {- "end": 1391310245,- "start": 1359774245+ "end": 1359774245,+ "start": 1328151845},"plan": null,"price": {@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -96,11 +97,11 @@"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0003",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -127,140 +128,11 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null},{"account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 280000,- "amount_paid": 0,- "amount_remaining": 280000,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002A8nya",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002A8nya/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 280000,- "currency": "usd",- "description": "Zulip Standard - renewal",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1359774245,- "start": 1328151845- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1000000000,- "currency": "usd",- "id": "price_NORMALIZED00000000000003",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0003",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 8000,- "unit_amount_decimal": "8000"- },- "proration": false,- "quantity": 35,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": 1000000000,- "number": "NORMALI-0002",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 280000,- "tax": null,- "total": 280000,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- },- {- "account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -296,9 +168,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001eoy5M",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001eoy5M/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo/pdf","last_finalization_error": null,"lines": {"data": [@@ -309,8 +181,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -324,14 +196,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -352,8 +225,8 @@"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",@@ -367,14 +240,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -392,12 +266,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": true,diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.list.3.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.list.3.jsonnew file mode 100644index 00000000000..9c29dc8d546--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Invoice.list.3.json@@ -0,0 +1,441 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 280000,+ "amount_paid": 0,+ "amount_remaining": 280000,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004yiX1T",+ "id": "in_NORMALIZED00000000000004",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004yiX1T/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 280000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1391310245,+ "start": 1359774245+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000005",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0005",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 35,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0005",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000004",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 280000,+ "tax": null,+ "total": 280000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 280000,+ "amount_paid": 0,+ "amount_remaining": 280000,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003XF8Ro",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003XF8Ro/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 280000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1359774245,+ "start": 1328151845+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 35,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0004",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000003",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 280000,+ "tax": null,+ "total": 280000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000029rhPo/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 28000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 800,+ "unit_amount_decimal": "800"+ },+ "proration": false,+ "quantity": 35,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -28000,+ "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",+ "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": -28000,+ "unit_amount_decimal": "-28000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.1.jsonindex 146cb93250c..9bc445fc457 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.1.json@@ -6,7 +6,7 @@"description": "Payment (Card ending in 4242)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000002",+ "id": "ii_NORMALIZED00000000000003","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.2.jsonindex d3305507d6a..d850acad263 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.2.json@@ -6,7 +6,7 @@"description": "Zulip Standard","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000001",+ "id": "ii_NORMALIZED00000000000002","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.3.jsonindex 4ac8751ad47..0ff7fca29d2 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.3.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.3.json@@ -6,7 +6,7 @@"description": "Zulip Standard - renewal","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000003",+ "id": "ii_NORMALIZED00000000000004","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.4.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.4.jsonindex de41160cfe2..ef81840401c 100644--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.4.json+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--InvoiceItem.create.4.json@@ -6,7 +6,7 @@"description": "Zulip Standard - renewal","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000004",+ "id": "ii_NORMALIZED00000000000005","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..c696f95c862--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--PaymentIntent.confirm.1.json@@ -0,0 +1,166 @@+{+ "amount": 28000,+ "amount_capturable": 0,+ "amount_received": 28000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 28000,+ "amount_captured": 28000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 35",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_klZSvBukSGd5KJGHlnsnE6k4j",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 35",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..3392d22279b--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 28000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_klZSvBukSGd5KJGHlnsnE6k4j",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $8.0 x 35",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..21c5408dafb--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "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": null,+ "id": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..de3d6e90894--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq9bA4KHR4JzRvtLr9BV2z_secret_K86Mlb6dFfrRR6CQtcQqJFBGCAbQ48r",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq9bA4KHR4JzRvtLr9BV2z",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq9bA4KHR4JzRvnjbJhhlo",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "payment_method_options": {+ "card": {+ "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/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..98207f74a52--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq9ZA4KHR4JzRvcqAq17cM_secret_K86MI2znRL8mWPa6ZlJY2g58kBr5DM0",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq9ZA4KHR4JzRvcqAq17cM",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..de3d6e90894--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq9bA4KHR4JzRvtLr9BV2z_secret_K86Mlb6dFfrRR6CQtcQqJFBGCAbQ48r",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq9bA4KHR4JzRvtLr9BV2z",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq9bA4KHR4JzRvnjbJhhlo",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq9aA4KHR4JzRvX1SBKYte",+ "payment_method_options": {+ "card": {+ "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/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Token.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Token.create.1.jsondeleted file mode 100644index 60d47536e7c..00000000000--- a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--Token.create.1.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1000000000,- "id": "tok_NORMALIZED00000000000001",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..d0f33627d7c--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01Vyoq9CPOELoG9vNzYcEqvaDLkWw1nJrQRTQ7lgK3sRKZM2",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq9ZA4KHR4JzRvcqAq17cM",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01Vyoq9CPOELoG9vNzYcEqvaDLkWw1nJrQRTQ7lgK3sRKZM2#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..9f7f8e7ca33--- /dev/null+++ b/corporate/tests/stripe_fixtures/switch_from_monthly_plan_to_annual_plan_for_manual_license_management--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01Vyoq9CPOELoG9vNzYcEqvaDLkWw1nJrQRTQ7lgK3sRKZM2",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "manual",+ "licenses": "35",+ "price_per_license": "800",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq9ZA4KHR4JzRvcqAq17cM",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01Vyoq9CPOELoG9vNzYcEqvaDLkWw1nJrQRTQ7lgK3sRKZM2#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Customer.modify.1.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Customer.retrieve.1.jsonindex a38ce33448a..4fd85bce3df 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Customer.retrieve.1.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Customer.retrieve.1.json@@ -3,50 +3,7 @@"balance": 0,"created": 1000000000,"currency": "usd",- "default_source": {- "ach_credit_transfer": {- "account_number": "test_NORMALIZED01",- "bank_name": "TEST BANK",- "fingerprint": "NORMALIZED000001",- "refund_account_holder_name": null,- "refund_account_holder_type": null,- "refund_routing_number": null,- "routing_number": "110000000",- "swift_code": "TSTEZ122"- },- "amount": null,- "client_secret": "src_client_secret_NORMALIZED00000000000001",- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "flow": "receiver",- "id": "src_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "source",- "owner": {- "address": null,- "email": "[email protected]",- "name": null,- "phone": null,- "verified_address": null,- "verified_email": null,- "verified_name": null,- "verified_phone": null- },- "receiver": {- "address": "000000000-test_NORMALIZED01",- "amount_charged": 0,- "amount_received": 0,- "amount_returned": 0,- "refund_attributes_method": "email",- "refund_attributes_status": "missing"- },- "statement_descriptor": null,- "status": "pending",- "type": "ach_credit_transfer",- "usage": "reusable"- },+ "default_source": "src_NORMALIZED00000000000001","delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -69,57 +26,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "ach_credit_transfer": {- "account_number": "test_NORMALIZED01",- "bank_name": "TEST BANK",- "fingerprint": "NORMALIZED000001",- "refund_account_holder_name": null,- "refund_account_holder_type": null,- "refund_routing_number": null,- "routing_number": "110000000",- "swift_code": "TSTEZ122"- },- "amount": null,- "client_secret": "src_client_secret_NORMALIZED00000000000001",- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "flow": "receiver",- "id": "src_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "source",- "owner": {- "address": null,- "email": "[email protected]",- "name": null,- "phone": null,- "verified_address": null,- "verified_email": null,- "verified_name": null,- "verified_phone": null- },- "receiver": {- "address": "000000000-test_NORMALIZED01",- "amount_charged": 0,- "amount_received": 0,- "amount_returned": 0,- "refund_attributes_method": "email",- "refund_attributes_status": "missing"- },- "statement_descriptor": null,- "status": "pending",- "type": "ach_credit_transfer",- "usage": "reusable"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Customer.retrieve.2.jsonindex b0368c52b18..0fde3d49647 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Customer.retrieve.2.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Customer.retrieve.2.json@@ -3,50 +3,7 @@"balance": 0,"created": 1000000000,"currency": "usd",- "default_source": {- "ach_credit_transfer": {- "account_number": "test_NORMALIZED01",- "bank_name": "TEST BANK",- "fingerprint": "NORMALIZED000001",- "refund_account_holder_name": null,- "refund_account_holder_type": null,- "refund_routing_number": null,- "routing_number": "110000000",- "swift_code": "TSTEZ122"- },- "amount": null,- "client_secret": "src_client_secret_NORMALIZED00000000000001",- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "flow": "receiver",- "id": "src_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "source",- "owner": {- "address": null,- "email": "[email protected]",- "name": null,- "phone": null,- "verified_address": null,- "verified_email": null,- "verified_name": null,- "verified_phone": null- },- "receiver": {- "address": "000000000-test_NORMALIZED01",- "amount_charged": 0,- "amount_received": 0,- "amount_returned": 0,- "refund_attributes_method": "email",- "refund_attributes_status": "missing"- },- "statement_descriptor": null,- "status": "pending",- "type": "ach_credit_transfer",- "usage": "reusable"- },+ "default_source": "src_NORMALIZED00000000000001","delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -69,57 +26,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "ach_credit_transfer": {- "account_number": "test_NORMALIZED01",- "bank_name": "TEST BANK",- "fingerprint": "NORMALIZED000001",- "refund_account_holder_name": null,- "refund_account_holder_type": null,- "refund_routing_number": null,- "routing_number": "110000000",- "swift_code": "TSTEZ122"- },- "amount": null,- "client_secret": "src_client_secret_NORMALIZED00000000000001",- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "flow": "receiver",- "id": "src_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "source",- "owner": {- "address": null,- "email": "[email protected]",- "name": null,- "phone": null,- "verified_address": null,- "verified_email": null,- "verified_name": null,- "verified_phone": null- },- "receiver": {- "address": "000000000-test_NORMALIZED01",- "amount_charged": 0,- "amount_received": 0,- "amount_returned": 0,- "refund_attributes_method": "email",- "refund_attributes_status": "missing"- },- "statement_descriptor": null,- "status": "pending",- "type": "ach_credit_transfer",- "usage": "reusable"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Event.list.1.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Event.list.1.jsonnew file mode 100644index 00000000000..4c656e7ed94--- /dev/null+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Event.list.1.json@@ -0,0 +1,152 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 280000,+ "amount_paid": 0,+ "amount_remaining": 280000,+ "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_NORMALIZED0002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001NtQF0",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001NtQF0/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 280000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1391310245,+ "start": 1359774245+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 35,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 280000,+ "tax": null,+ "total": 280000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1JPMB8A4KHR4JzRvh5KvK2Q0",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "a5cafce1-a45e-4123-bc42-6e93eea0459c"+ },+ "type": "invoice.finalized"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.create.1.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.create.1.jsonindex b33e97dafac..df6cbb0715a 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 800000,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000001",+ "id": "in_NORMALIZED00000000000002","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -89,7 +90,7 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.create.2.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.create.2.jsonindex 0e4a8acb9e8..f4f95c6b8f5 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.create.2.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.create.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 1600000,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000002",+ "id": "in_NORMALIZED00000000000003","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"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",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,7 +134,7 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.create.3.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.create.3.jsonindex 358f3c401cb..3ce60572bb3 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.create.3.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.create.3.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 960000,"amount_paid": 0,@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000003",+ "id": "in_NORMALIZED00000000000004","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,7 +90,7 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"},"livemode": false,"metadata": {},@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.finalize_invoice.1.jsonindex 28d37b94b66..69f60282164 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 800000,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000144WpC",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000144WpC/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002TrCiA",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002TrCiA/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -89,16 +90,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0002","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000002","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.finalize_invoice.2.jsonindex 0580ef77d38..6a0e464e702 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.finalize_invoice.2.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.finalize_invoice.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 1600000,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002SO455",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002SO455/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003gkbLo",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003gkbLo/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"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",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -107,14 +108,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,16 +134,16 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0002",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": nulldiff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.finalize_invoice.3.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.finalize_invoice.3.jsonindex 20f641d9db9..ed349c4388b 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.finalize_invoice.3.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.finalize_invoice.3.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 960000,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003ERSJR",- "id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003ERSJR/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004tjZTO",+ "id": "in_NORMALIZED00000000000004",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004tjZTO/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -64,14 +64,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,16 +90,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0003",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000003",+ "payment_intent": "pi_NORMALIZED00000000000004","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.list.1.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.list.1.jsonindex ae5e402725b..6a8265d8ca3 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.list.1.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.list.1.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 1600000,"amount_paid": 0,@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002SO455",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002SO455/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003gkbLo",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003gkbLo/pdf","last_finalization_error": null,"lines": {"data": [@@ -51,8 +51,8 @@"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",@@ -66,14 +66,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -94,8 +95,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -109,14 +110,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -134,16 +136,16 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0002",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -174,7 +176,7 @@},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 800000,"amount_paid": 0,@@ -210,9 +212,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000144WpC",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000144WpC/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002TrCiA",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002TrCiA/pdf","last_finalization_error": null,"lines": {"data": [@@ -223,8 +225,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -238,14 +240,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -263,16 +266,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0002","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000002","payment_settings": {"payment_method_options": null,"payment_method_types": nulldiff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.list.2.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.list.2.jsonindex 22b5e0f33d0..45d743a1dbb 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.list.2.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--Invoice.list.2.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 960000,"amount_paid": 0,@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003ERSJR",- "id": "in_NORMALIZED00000000000003",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003ERSJR/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004tjZTO",+ "id": "in_NORMALIZED00000000000004",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000004tjZTO/pdf","last_finalization_error": null,"lines": {"data": [@@ -51,8 +51,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000004",- "invoice_item": "ii_NORMALIZED00000000000004",+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005","livemode": false,"metadata": {},"object": "line_item",@@ -66,14 +66,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -91,16 +92,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000004/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0003",+ "number": "NORMALI-0004","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000003",+ "payment_intent": "pi_NORMALIZED00000000000004","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -131,7 +132,7 @@},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 1600000,"amount_paid": 0,@@ -167,9 +168,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002SO455",- "id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002SO455/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003gkbLo",+ "id": "in_NORMALIZED00000000000003",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000003gkbLo/pdf","last_finalization_error": null,"lines": {"data": [@@ -180,8 +181,8 @@"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",@@ -195,14 +196,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",@@ -223,8 +225,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000003",- "invoice_item": "ii_NORMALIZED00000000000003",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -238,14 +240,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -263,16 +266,16 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000003/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0002",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000003","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -303,7 +306,7 @@},{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 800000,"amount_paid": 0,@@ -339,9 +342,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED000000000000000144WpC",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED000000000000000144WpC/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002TrCiA",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002TrCiA/pdf","last_finalization_error": null,"lines": {"data": [@@ -352,8 +355,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -367,14 +370,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -392,16 +396,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0002","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000002","payment_settings": {"payment_method_options": null,"payment_method_types": nulldiff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.1.jsonindex a5e7f5fe0ca..2355da4be07 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.1.json@@ -6,7 +6,7 @@"description": "Zulip Standard","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000001",+ "id": "ii_NORMALIZED00000000000002","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.2.jsonindex ccca30b2507..bff4c9907b8 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.2.json@@ -6,7 +6,7 @@"description": "Additional license (Jan 2, 2012 - Jan 2, 2013)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000003",+ "id": "ii_NORMALIZED00000000000004","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000003",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0003",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.3.jsonindex 8c73b385ff3..b187c7f79f1 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.3.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.3.json@@ -6,7 +6,7 @@"description": "Zulip Standard - renewal","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000002",+ "id": "ii_NORMALIZED00000000000003","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "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",diff --git a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.4.json b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.4.jsonindex d33163548c5..929ca184fdb 100644--- a/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.4.json+++ b/corporate/tests/stripe_fixtures/update_licenses_of_manual_plan_from_billing_page--InvoiceItem.create.4.json@@ -6,7 +6,7 @@"description": "Zulip Standard - renewal","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000004",+ "id": "ii_NORMALIZED00000000000005","invoice": null,"livemode": false,"metadata": {},@@ -21,14 +21,15 @@"billing_scheme": "per_unit","created": 1000000000,"currency": "usd",- "id": "price_NORMALIZED00000000000004",+ "id": "price_NORMALIZED00000000000005","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0004",+ "product": "prod_NORMALIZED0005","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Charge.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Charge.create.1.jsondeleted file mode 100644index 180168b4615..00000000000--- a/corporate/tests/stripe_fixtures/upgrade_by_card--Charge.create.1.json+++ /dev/null@@ -1,117 +0,0 @@-{- "amount": 48000,- "amount_captured": 48000,- "amount_refunded": 0,- "application": null,- "application_fee": null,- "application_fee_amount": null,- "balance_transaction": "txn_NORMALIZED00000000000001",- "billing_details": {- "address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",- "line2": null,- "postal_code": "33333",- "state": null- },- "email": null,- "name": "Ada Starr",- "phone": null- },- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",- "captured": true,- "created": 1010000001,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "description": "Upgrade to Zulip Standard, $80.0 x 6",- "destination": null,- "dispute": null,- "disputed": false,- "failure_code": null,- "failure_message": null,- "fraud_details": {},- "id": "ch_NORMALIZED00000000000001",- "invoice": null,- "livemode": false,- "metadata": {},- "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": null,- "payment_method": "card_NORMALIZED00000000000001",- "payment_method_details": {- "card": {- "brand": "visa",- "checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",- "cvc_check": "pass"- },- "country": "US",- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "installments": null,- "last4": "4242",- "network": "visa",- "three_d_secure": null,- "wallet": null- },- "type": "card"- },- "receipt_email": "[email protected]",- "receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",- "refunded": false,- "refunds": {- "data": [],- "has_more": false,- "object": "list",- "total_count": 0,- "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"- },- "review": null,- "shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "source_transfer": null,- "statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",- "status": "succeeded",- "transfer_data": null,- "transfer_group": null-}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Charge.list.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Charge.list.1.jsonindex 4c471240bcc..5710eda4b55 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card--Charge.list.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Charge.list.1.json@@ -10,18 +10,18 @@"balance_transaction": "txn_NORMALIZED00000000000001","billing_details": {"address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",+ "city": null,+ "country": null,+ "line1": null,"line2": null,- "postal_code": "33333",+ "postal_code": null,"state": null},"email": null,- "name": "Ada Starr",+ "name": null,"phone": null},- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",+ "calculated_statement_descriptor": "ZULIP STANDARD","captured": true,"created": 1010000001,"currency": "usd",@@ -36,7 +36,17 @@"id": "ch_NORMALIZED00000000000001","invoice": null,"livemode": false,- "metadata": {},+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },"object": "charge","on_behalf_of": null,"order": null,@@ -49,14 +59,14 @@"type": "authorized"},"paid": true,- "payment_intent": null,- "payment_method": "card_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0","payment_method_details": {"card": {"brand": "visa","checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",+ "address_line1_check": null,+ "address_postal_code_check": null,"cvc_check": "pass"},"country": "US",@@ -85,34 +95,10 @@},"review": null,"shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "source": null,"source_transfer": null,"statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",+ "statement_descriptor_suffix": null,"status": "succeeded","transfer_data": null,"transfer_group": nulldiff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.create.1.jsonindex 236cba3ab05..364f2d361cf 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.create.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.create.1.json@@ -3,7 +3,7 @@"balance": 0,"created": 1010000002,"currency": null,- "default_source": "card_NORMALIZED00000000000001",+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.modify.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.modify.1.jsonnew file mode 100644index 00000000000..364f2d361cf--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000002,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.modify.2.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.modify.2.jsonnew file mode 100644index 00000000000..f02fb4e749d--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000002,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.retrieve.1.jsonindex ebf57e16d5d..364f2d361cf 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.retrieve.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.retrieve.1.json@@ -2,32 +2,8 @@"address": null,"balance": 0,"created": 1010000002,- "currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "currency": null,+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -45,43 +21,10 @@"realm_str": "zulip"},"name": null,- "next_invoice_sequence": 2,+ "next_invoice_sequence": 1,"object": "customer","phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.retrieve.2.jsonindex ebf57e16d5d..7b64c528758 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.retrieve.2.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.retrieve.2.json@@ -3,31 +3,7 @@"balance": 0,"created": 1010000002,"currency": "usd",- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -36,7 +12,53 @@"invoice_prefix": "NORMA01","invoice_settings": {"custom_fields": null,- "default_payment_method": 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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000003,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },"footer": null},"livemode": false,@@ -50,38 +72,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.retrieve.3.jsonnew file mode 100644index 00000000000..7b64c528758--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Customer.retrieve.3.json@@ -0,0 +1,76 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000002,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000003,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 2,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Event.list.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Event.list.1.jsonnew file mode 100644index 00000000000..33cc7457b0e--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Event.list.1.json@@ -0,0 +1,152 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1010000004,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 280000,+ "amount_paid": 0,+ "amount_remaining": 280000,+ "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": 1010000005,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001yiX1T",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001yiX1T/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 280000,+ "currency": "usd",+ "description": "Zulip Standard - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1391310245,+ "start": 1359774245+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000005,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 35,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 280000,+ "tax": null,+ "total": 280000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq9rA4KHR4JzRv75eXP6bj",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "f0a27d4c-5666-476d-bccc-3f0ed737273b"+ },+ "type": "invoice.finalized"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Event.list.2.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Event.list.2.jsonnew file mode 100644index 00000000000..d063002fc47--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Event.list.2.json@@ -0,0 +1,702 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1010000006,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1010000001,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_r4mnrb7dDRt8bljkSzB1gs0N3",+ "confirmation_method": "automatic",+ "created": 1010000007,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq9uA4KHR4JzRv0opA7PGn",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "145d2a18-dbee-4d32-a7d5-836d954fda11"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000006,+ "data": {+ "object": {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1010000001,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq9uA4KHR4JzRv0p3cuMah",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "145d2a18-dbee-4d32-a7d5-836d954fda11"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000008,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1010000002,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTq9zA4KHR4JzRvj6v8EGg2",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "4c51e662-648e-48c7-84b6-a6d445680d20"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000009,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq9wA4KHR4JzRv4kieqeIK_secret_K86Mcah5gCqgz9tRLzjkqWgFKuiTcK2",+ "created": 1010000010,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq9wA4KHR4JzRv4kieqeIK",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq9wA4KHR4JzRvopmYc4HQ",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq9xA4KHR4JzRvj1fPpdbx",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "44f4af32-9f95-47a8-973a-0c263989a355"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000009,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000003,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq9xA4KHR4JzRvvQ1nwHw0",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "44f4af32-9f95-47a8-973a-0c263989a355"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000010,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq9wA4KHR4JzRv4kieqeIK_secret_K86Mcah5gCqgz9tRLzjkqWgFKuiTcK2",+ "created": 1010000010,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq9wA4KHR4JzRv4kieqeIK",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq9wA4KHR4JzRvopmYc4HQ",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq9xA4KHR4JzRvZBwsDt3A",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "44f4af32-9f95-47a8-973a-0c263989a355"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000007,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq9uA4KHR4JzRvjCorW3Ix_secret_K86MDvxoZFjKasgQbanU2JldhYYctFK",+ "created": 1010000007,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq9uA4KHR4JzRvjCorW3Ix",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq9uA4KHR4JzRvwbnjXS5f",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "1b07e169-9a5b-4310-b298-cd04934dc577"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000007,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_r4mnrb7dDRt8bljkSzB1gs0N3",+ "confirmation_method": "automatic",+ "created": 1010000007,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq9uA4KHR4JzRv0OViBL6B",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "4d296b26-4dce-467c-8da5-70ed9880bc9b"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000011,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1010000002,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTq9tA4KHR4JzRvdGIehpNW",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "c3b66cf2-8803-489f-a2fc-4cbdbf098b6b"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Event.list.3.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Event.list.3.jsonnew file mode 100644index 00000000000..96549a715fe--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Event.list.3.json@@ -0,0 +1,1261 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1010000012,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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": 1010000013,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002hLGc8",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002hLGc8/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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": 1010000013,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "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": 1010000014,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqA5A4KHR4JzRvF0cDAHJa",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "db52a1a8-cb3b-438d-925d-fb6e5c789fce"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000012,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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": 1010000013,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002hLGc8",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002hLGc8/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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": 1010000013,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "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": 1010000014,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqA5A4KHR4JzRv36T2fZel",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "db52a1a8-cb3b-438d-925d-fb6e5c789fce"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000012,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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": 1010000013,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002hLGc8",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002hLGc8/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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": 1010000013,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "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": 1010000014,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqA5A4KHR4JzRvEOA8x809",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "db52a1a8-cb3b-438d-925d-fb6e5c789fce"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000012,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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": 1010000013,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002hLGc8",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002hLGc8/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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": 1010000013,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "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": 1010000014,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1JTqA5A4KHR4JzRvCC8b21Sv",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "db52a1a8-cb3b-438d-925d-fb6e5c789fce"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000015,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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": 1010000013,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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": 1010000013,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "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": 1010000014,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqA4A4KHR4JzRvGwS7zgpK",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "a56abdd5-414d-4db1-a6bd-741d6c0642ac"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000015,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000003",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000014,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTqA4A4KHR4JzRvDAUcyJx4",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "a56abdd5-414d-4db1-a6bd-741d6c0642ac"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000015,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000013,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTqA4A4KHR4JzRvuHnrSq0g",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "a56abdd5-414d-4db1-a6bd-741d6c0642ac"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000013,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "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": 1010000013,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ }+ },+ "id": "evt_1JTqA3A4KHR4JzRv2RbdtrIM",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "ea212b1a-a0ca-47c1-87d5-c2cd1666cc3c"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000014,+ "data": {+ "object": {+ "amount": -48000,+ "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": 1010000014,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ }+ },+ "id": "evt_1JTqA2A4KHR4JzRvgt23ZWsD",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "2919de00-71b3-4ff3-a099-5400e541fff9"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000014,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1010000002,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JTqA2A4KHR4JzRvOeoh7F8z",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "2919de00-71b3-4ff3-a099-5400e541fff9"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Event.list.4.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Event.list.4.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Event.list.4.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.create.1.jsonindex a3990fb986e..1259b3a0e4c 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000003,+ "created": 1010000013,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000001",+ "id": "in_NORMALIZED00000000000002","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -62,16 +62,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000013,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"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",@@ -105,16 +106,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000014,"currency": "usd",- "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",@@ -132,7 +134,7 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.finalize_invoice.1.jsonindex f85aa35cc69..4fae08f4179 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000003,+ "created": 1010000013,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001TL8aa",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001TL8aa/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002hLGc8",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002hLGc8/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002","livemode": false,"metadata": {},"object": "line_item",@@ -62,16 +62,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000013,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"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",@@ -105,16 +106,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000014,"currency": "usd",- "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",@@ -132,12 +134,12 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": true,@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.list.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.list.1.jsonindex ac87099084f..e39960ab725 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.list.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.list.1.json@@ -1,178 +1,5 @@{- "data": [- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 0,- "amount_paid": 0,- "amount_remaining": 0,- "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": 1010000003,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001TL8aa",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001TL8aa/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 48000,- "currency": "usd",- "description": "Zulip Standard",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1357095845,- "start": 1325473445- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1010000004,- "currency": "usd",- "id": "price_NORMALIZED00000000000001",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0001",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 8000,- "unit_amount_decimal": "8000"- },- "proration": false,- "quantity": 6,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- },- {- "amount": -48000,- "currency": "usd",- "description": "Payment (Card ending in 4242)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1000000000,- "start": 1000000000- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1010000004,- "currency": "usd",- "id": "price_NORMALIZED00000000000002",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0002",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": -48000,- "unit_amount_decimal": "-48000"- },- "proration": false,- "quantity": 1,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": null,- "number": "NORMALI-0001",- "object": "invoice",- "on_behalf_of": null,- "paid": true,- "payment_intent": null,- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "paid",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": 1000000000,- "voided_at": null- },- "subscription": null,- "subtotal": 0,- "tax": null,- "total": 0,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- }- ],+ "data": [],"has_more": false,"object": "list","url": "/v1/invoices"diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.list.2.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.list.2.jsonnew file mode 100644index 00000000000..67c440f01e7--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--Invoice.list.2.json@@ -0,0 +1,181 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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": 1010000013,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002hLGc8",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002hLGc8/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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": 1010000013,+ "currency": "usd",+ "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": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "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": 1010000014,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--InvoiceItem.create.1.jsonindex cf52be404dc..60221bed5d0 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--InvoiceItem.create.1.json@@ -6,7 +6,7 @@"description": "Payment (Card ending in 4242)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000002",+ "id": "ii_NORMALIZED00000000000003","invoice": null,"livemode": false,"metadata": {},@@ -19,16 +19,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000014,"currency": "usd",- "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",diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/upgrade_by_card--InvoiceItem.create.2.jsonindex c1f41cd06f3..c37fccc28b4 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--InvoiceItem.create.2.json@@ -6,7 +6,7 @@"description": "Zulip Standard","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000001",+ "id": "ii_NORMALIZED00000000000002","invoice": null,"livemode": false,"metadata": {},@@ -19,16 +19,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000013,"currency": "usd",- "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,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..059e769c8a2--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--PaymentIntent.confirm.1.json@@ -0,0 +1,166 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1010000001,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_r4mnrb7dDRt8bljkSzB1gs0N3",+ "confirmation_method": "automatic",+ "created": 1010000007,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..98838cddb06--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_r4mnrb7dDRt8bljkSzB1gs0N3",+ "confirmation_method": "automatic",+ "created": 1010000007,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..ff7012a39f6--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000003,+ "customer": null,+ "id": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..25725d57ad4--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq9wA4KHR4JzRv4kieqeIK_secret_K86Mcah5gCqgz9tRLzjkqWgFKuiTcK2",+ "created": 1010000010,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq9wA4KHR4JzRv4kieqeIK",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq9wA4KHR4JzRvopmYc4HQ",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "payment_method_options": {+ "card": {+ "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_by_card--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..ab4399132a8--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq9uA4KHR4JzRvjCorW3Ix_secret_K86MDvxoZFjKasgQbanU2JldhYYctFK",+ "created": 1010000007,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq9uA4KHR4JzRvjCorW3Ix",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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_by_card--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..25725d57ad4--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq9wA4KHR4JzRv4kieqeIK_secret_K86Mcah5gCqgz9tRLzjkqWgFKuiTcK2",+ "created": 1010000010,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq9wA4KHR4JzRv4kieqeIK",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq9wA4KHR4JzRvopmYc4HQ",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq9vA4KHR4JzRv6xcwdvJ0",+ "payment_method_options": {+ "card": {+ "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_by_card--Token.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--Token.create.1.jsondeleted file mode 100644index b3a57bdccad..00000000000--- a/corporate/tests/stripe_fixtures/upgrade_by_card--Token.create.1.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1010000002,- "id": "tok_NORMALIZED00000000000001",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..8ac49748119--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01c8JXzneSmnZLPpukRbcUTsasEjMfrzf6fjZ1bIRuOcKrZa",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq9uA4KHR4JzRvjCorW3Ix",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01c8JXzneSmnZLPpukRbcUTsasEjMfrzf6fjZ1bIRuOcKrZa#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..3b40ded40cd--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01c8JXzneSmnZLPpukRbcUTsasEjMfrzf6fjZ1bIRuOcKrZa",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq9uA4KHR4JzRvjCorW3Ix",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01c8JXzneSmnZLPpukRbcUTsasEjMfrzf6fjZ1bIRuOcKrZa#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Charge.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Charge.create.1.jsondeleted file mode 100644index 180168b4615..00000000000--- a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Charge.create.1.json+++ /dev/null@@ -1,117 +0,0 @@-{- "amount": 48000,- "amount_captured": 48000,- "amount_refunded": 0,- "application": null,- "application_fee": null,- "application_fee_amount": null,- "balance_transaction": "txn_NORMALIZED00000000000001",- "billing_details": {- "address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",- "line2": null,- "postal_code": "33333",- "state": null- },- "email": null,- "name": "Ada Starr",- "phone": null- },- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",- "captured": true,- "created": 1010000001,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "description": "Upgrade to Zulip Standard, $80.0 x 6",- "destination": null,- "dispute": null,- "disputed": false,- "failure_code": null,- "failure_message": null,- "fraud_details": {},- "id": "ch_NORMALIZED00000000000001",- "invoice": null,- "livemode": false,- "metadata": {},- "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": null,- "payment_method": "card_NORMALIZED00000000000001",- "payment_method_details": {- "card": {- "brand": "visa",- "checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",- "cvc_check": "pass"- },- "country": "US",- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "installments": null,- "last4": "4242",- "network": "visa",- "three_d_secure": null,- "wallet": null- },- "type": "card"- },- "receipt_email": "[email protected]",- "receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",- "refunded": false,- "refunds": {- "data": [],- "has_more": false,- "object": "list",- "total_count": 0,- "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"- },- "review": null,- "shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "source_transfer": null,- "statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",- "status": "succeeded",- "transfer_data": null,- "transfer_group": null-}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Charge.list.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Charge.list.1.jsonindex 4c471240bcc..ab85eb1d89a 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Charge.list.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Charge.list.1.json@@ -10,18 +10,18 @@"balance_transaction": "txn_NORMALIZED00000000000001","billing_details": {"address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",+ "city": null,+ "country": null,+ "line1": null,"line2": null,- "postal_code": "33333",+ "postal_code": null,"state": null},"email": null,- "name": "Ada Starr",+ "name": null,"phone": null},- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",+ "calculated_statement_descriptor": "ZULIP STANDARD","captured": true,"created": 1010000001,"currency": "usd",@@ -36,7 +36,17 @@"id": "ch_NORMALIZED00000000000001","invoice": null,"livemode": false,- "metadata": {},+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },"object": "charge","on_behalf_of": null,"order": null,@@ -49,14 +59,14 @@"type": "authorized"},"paid": true,- "payment_intent": null,- "payment_method": "card_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTqACA4KHR4JzRv22oKQaFN","payment_method_details": {"card": {"brand": "visa","checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",+ "address_line1_check": null,+ "address_postal_code_check": null,"cvc_check": "pass"},"country": "US",@@ -85,34 +95,10 @@},"review": null,"shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "source": null,"source_transfer": null,"statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",+ "statement_descriptor_suffix": null,"status": "succeeded","transfer_data": null,"transfer_group": nulldiff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.create.1.jsonindex 236cba3ab05..364f2d361cf 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.create.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.create.1.json@@ -3,7 +3,7 @@"balance": 0,"created": 1010000002,"currency": null,- "default_source": "card_NORMALIZED00000000000001",+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.modify.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.modify.1.jsonnew file mode 100644index 00000000000..364f2d361cf--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000002,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.modify.2.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.modify.2.jsonnew file mode 100644index 00000000000..5ca9c6ff89d--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000002,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqACA4KHR4JzRv22oKQaFN",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.retrieve.1.jsonnew file mode 100644index 00000000000..364f2d361cf--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Customer.retrieve.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000002,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Event.list.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Event.list.1.jsonnew file mode 100644index 00000000000..3e2d549b0e4--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Event.list.1.json@@ -0,0 +1,196 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1010000003,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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": 1010000004,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001hLGc8",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001hLGc8/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1357095845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000004,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000005,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqA5A4KHR4JzRvF0cDAHJa",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "db52a1a8-cb3b-438d-925d-fb6e5c789fce"+ },+ "type": "invoice.payment_succeeded"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Event.list.2.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Event.list.2.jsonnew file mode 100644index 00000000000..2a6f7b8b577--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Event.list.2.json@@ -0,0 +1,702 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1010000001,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1010000001,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTqACA4KHR4JzRv22oKQaFN",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_6J7nfoiYnnjkkoRJwNKaerU7V",+ "confirmation_method": "automatic",+ "created": 1010000006,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqACA4KHR4JzRv22oKQaFN",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqABA4KHR4JzRv10udJkVB",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "ff50ba77-4670-4ac0-a550-2bbb8c12cddc"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000001,+ "data": {+ "object": {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1010000001,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTqACA4KHR4JzRv22oKQaFN",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqABA4KHR4JzRv1ce7GQxt",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "ff50ba77-4670-4ac0-a550-2bbb8c12cddc"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000007,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1010000002,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqACA4KHR4JzRv22oKQaFN",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTqAGA4KHR4JzRvUpchhnS8",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "449dbb0d-925e-400b-b2d5-16fbb5e7a094"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000008,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqADA4KHR4JzRvNZ7Y9npM_secret_K86Mg4MTEnGNuUwopcKVKgvS20oVzp7",+ "created": 1010000009,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqADA4KHR4JzRvNZ7Y9npM",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqADA4KHR4JzRv3Qn6rfDc",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqACA4KHR4JzRv22oKQaFN",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqAEA4KHR4JzRvSa5T7DXf",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "df27878d-538d-4d9a-ba8e-a36860ffe240"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000008,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000010,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTqACA4KHR4JzRv22oKQaFN",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTqAEA4KHR4JzRvDJTbX7rO",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "df27878d-538d-4d9a-ba8e-a36860ffe240"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000009,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqADA4KHR4JzRvNZ7Y9npM_secret_K86Mg4MTEnGNuUwopcKVKgvS20oVzp7",+ "created": 1010000009,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqADA4KHR4JzRvNZ7Y9npM",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqADA4KHR4JzRv3Qn6rfDc",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqACA4KHR4JzRv22oKQaFN",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqAEA4KHR4JzRv5k1sg9bY",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "df27878d-538d-4d9a-ba8e-a36860ffe240"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000006,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqABA4KHR4JzRvNe5hBHo9_secret_K86Msa77hlNy0IDEMrAUBSuC7IXh7QE",+ "created": 1010000006,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqABA4KHR4JzRvNe5hBHo9",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqABA4KHR4JzRvonykoTEv",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "3db46c69-2196-48a9-9ffa-4a319e081acd"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000006,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_6J7nfoiYnnjkkoRJwNKaerU7V",+ "confirmation_method": "automatic",+ "created": 1010000006,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqABA4KHR4JzRv1ZCN1tUz",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "3b3433ad-97a6-4703-8d95-7f531c28a369"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000002,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1010000002,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTqAAA4KHR4JzRvurWs6Xl9",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "ad035c31-23db-4955-8528-2dc816591d09"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Event.list.3.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Event.list.3.jsonnew file mode 100644index 00000000000..c5d0d10a67c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Event.list.3.json@@ -0,0 +1,946 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1010000011,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 136000,+ "amount_paid": 0,+ "amount_remaining": 136000,+ "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": 1010000012,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002cMgL8",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002cMgL8/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 184000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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": 1010000013,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000013,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 136000,+ "tax": null,+ "total": 136000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqAMA4KHR4JzRvIhV64ycG",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "4886d91f-396a-46c5-94da-382fdc497108"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000011,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 136000,+ "amount_paid": 0,+ "amount_remaining": 136000,+ "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": 1010000012,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002cMgL8",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002cMgL8/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 184000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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": 1010000013,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000013,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 136000,+ "tax": null,+ "total": 136000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ "previous_attributes": {+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "number": null,+ "payment_intent": null,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null+ }+ }+ },+ "id": "evt_1JTqAMA4KHR4JzRvP17s3Br5",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "4886d91f-396a-46c5-94da-382fdc497108"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000011,+ "data": {+ "object": {+ "amount": 136000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_EcT6csUUrhKe3oDn2htrv9XgK",+ "confirmation_method": "automatic",+ "created": 1010000011,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Payment for Invoice",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000002",+ "last_payment_error": null,+ "livemode": false,+ "metadata": {},+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": null,+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqALA4KHR4JzRv02oQ0Eod",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "4886d91f-396a-46c5-94da-382fdc497108"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000012,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 136000,+ "amount_paid": 0,+ "amount_remaining": 136000,+ "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": 1010000012,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 184000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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": 1010000013,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000013,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 136000,+ "tax": null,+ "total": 136000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqALA4KHR4JzRvLIyTGdsT",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "161186e8-3c37-4a6a-92d7-ed3f0d7ad60e"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000012,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000004",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000013,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTqALA4KHR4JzRvEqL8Lwts",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "161186e8-3c37-4a6a-92d7-ed3f0d7ad60e"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000012,+ "data": {+ "object": {+ "amount": 184000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000003",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000013,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTqALA4KHR4JzRv0tm24mKi",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "161186e8-3c37-4a6a-92d7-ed3f0d7ad60e"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000013,+ "data": {+ "object": {+ "amount": 184000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "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": 1010000013,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ }+ },+ "id": "evt_1JTqAKA4KHR4JzRvlCvzaDs7",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "50df17c7-3b19-4a47-85d5-c47873f6dd2c"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000013,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000004",+ "invoice": null,+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000013,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ }+ },+ "id": "evt_1JTqAJA4KHR4JzRvQPntmpdw",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "b773bf98-4da4-4357-b3c0-f7ffd0336d5b"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1010000013,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1010000002,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqACA4KHR4JzRv22oKQaFN",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JTqAJA4KHR4JzRvIfypaqST",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "b773bf98-4da4-4357-b3c0-f7ffd0336d5b"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Event.list.4.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Event.list.4.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Event.list.4.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.create.1.jsonindex 33f7ccbcf74..ec767f3c810 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 136000,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000003,+ "created": 1010000012,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000001",+ "id": "in_NORMALIZED00000000000002","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003","livemode": false,"metadata": {},"object": "line_item",@@ -62,16 +62,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000003,+ "created": 1010000013,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -105,16 +106,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000013,"currency": "usd",- "id": "price_NORMALIZED00000000000002",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0002",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,7 +134,7 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.finalize_invoice.1.jsonindex e4bf0da1f91..77e05d6cfe3 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 136000,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "charge_automatically",- "created": 1010000003,+ "created": 1010000012,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001lRluC",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001lRluC/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002cMgL8",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002cMgL8/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003","livemode": false,"metadata": {},"object": "line_item",@@ -62,16 +62,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000003,+ "created": 1010000013,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -92,8 +93,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004","livemode": false,"metadata": {},"object": "line_item",@@ -105,16 +106,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000013,"currency": "usd",- "id": "price_NORMALIZED00000000000002",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0002",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -132,16 +134,16 @@"has_more": false,"object": "list","total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": 1000000000,- "number": "NORMALI-0001",+ "number": "NORMALI-0003","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000002","payment_settings": {"payment_method_options": null,"payment_method_types": null@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.list.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.list.1.jsonindex f791fad79c0..e39960ab725 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.list.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.list.1.json@@ -1,178 +1,5 @@{- "data": [- {- "account_country": "US",- "account_name": null,- "account_tax_ids": null,- "amount_due": 136000,- "amount_paid": 0,- "amount_remaining": 136000,- "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": 1010000003,- "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,- "ending_balance": 0,- "footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001lRluC",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001lRluC/pdf",- "last_finalization_error": null,- "lines": {- "data": [- {- "amount": 184000,- "currency": "usd",- "description": "Zulip Standard",- "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": 1010000003,- "currency": "usd",- "id": "price_NORMALIZED00000000000001",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0001",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": 8000,- "unit_amount_decimal": "8000"- },- "proration": false,- "quantity": 23,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- },- {- "amount": -48000,- "currency": "usd",- "description": "Payment (Card ending in 4242)",- "discount_amounts": [],- "discountable": false,- "discounts": [],- "id": "il_NORMALIZED00000000000002",- "invoice_item": "ii_NORMALIZED00000000000002",- "livemode": false,- "metadata": {},- "object": "line_item",- "period": {- "end": 1000000000,- "start": 1000000000- },- "plan": null,- "price": {- "active": false,- "billing_scheme": "per_unit",- "created": 1010000004,- "currency": "usd",- "id": "price_NORMALIZED00000000000002",- "livemode": false,- "lookup_key": null,- "metadata": {},- "nickname": null,- "object": "price",- "product": "prod_NORMALIZED0002",- "recurring": null,- "tiers_mode": null,- "transform_quantity": null,- "type": "one_time",- "unit_amount": -48000,- "unit_amount_decimal": "-48000"- },- "proration": false,- "quantity": 1,- "subscription": null,- "tax_amounts": [],- "tax_rates": [],- "type": "invoiceitem"- }- ],- "has_more": false,- "object": "list",- "total_count": 2,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"- },- "livemode": false,- "metadata": {},- "next_payment_attempt": 1000000000,- "number": "NORMALI-0001",- "object": "invoice",- "on_behalf_of": null,- "paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",- "payment_settings": {- "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,- "starting_balance": 0,- "statement_descriptor": "Zulip Standard",- "status": "open",- "status_transitions": {- "finalized_at": 1000000000,- "marked_uncollectible_at": null,- "paid_at": null,- "voided_at": null- },- "subscription": null,- "subtotal": 136000,- "tax": null,- "total": 136000,- "total_discount_amounts": [],- "total_tax_amounts": [],- "transfer_data": null,- "webhooks_delivered_at": 1000000000- }- ],+ "data": [],"has_more": false,"object": "list","url": "/v1/invoices"diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.list.2.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.list.2.jsonnew file mode 100644index 00000000000..e5426641448--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Invoice.list.2.json@@ -0,0 +1,181 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 136000,+ "amount_paid": 0,+ "amount_remaining": 136000,+ "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": 1010000012,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002cMgL8",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002cMgL8/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 184000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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": 1010000013,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000013,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 136000,+ "tax": null,+ "total": 136000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--InvoiceItem.create.1.jsonindex cf52be404dc..33147feb65b 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--InvoiceItem.create.1.json@@ -6,7 +6,7 @@"description": "Payment (Card ending in 4242)","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000002",+ "id": "ii_NORMALIZED00000000000004","invoice": null,"livemode": false,"metadata": {},@@ -19,16 +19,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000004,+ "created": 1010000013,"currency": "usd",- "id": "price_NORMALIZED00000000000002",+ "id": "price_NORMALIZED00000000000004","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0002",+ "product": "prod_NORMALIZED0004","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--InvoiceItem.create.2.jsonindex daddb9e6779..2a701495f59 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--InvoiceItem.create.2.json@@ -6,7 +6,7 @@"description": "Zulip Standard","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000001",+ "id": "ii_NORMALIZED00000000000003","invoice": null,"livemode": false,"metadata": {},@@ -19,16 +19,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000003,+ "created": 1010000013,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..e919c7d0d6c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--PaymentIntent.confirm.1.json@@ -0,0 +1,166 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1010000001,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTqACA4KHR4JzRv22oKQaFN",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_6J7nfoiYnnjkkoRJwNKaerU7V",+ "confirmation_method": "automatic",+ "created": 1010000006,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqACA4KHR4JzRv22oKQaFN",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..180370598f9--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_6J7nfoiYnnjkkoRJwNKaerU7V",+ "confirmation_method": "automatic",+ "created": 1010000006,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..6ecdd7a2d2c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1010000010,+ "customer": null,+ "id": "pm_1JTqACA4KHR4JzRv22oKQaFN",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..e4c4ec7b9b0--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqADA4KHR4JzRvNZ7Y9npM_secret_K86Mg4MTEnGNuUwopcKVKgvS20oVzp7",+ "created": 1010000009,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqADA4KHR4JzRvNZ7Y9npM",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqADA4KHR4JzRv3Qn6rfDc",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqACA4KHR4JzRv22oKQaFN",+ "payment_method_options": {+ "card": {+ "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_by_card_with_outdated_seat_count--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..dbe41f36278--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqABA4KHR4JzRvNe5hBHo9_secret_K86Msa77hlNy0IDEMrAUBSuC7IXh7QE",+ "created": 1010000006,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqABA4KHR4JzRvNe5hBHo9",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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_by_card_with_outdated_seat_count--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..e4c4ec7b9b0--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqADA4KHR4JzRvNZ7Y9npM_secret_K86Mg4MTEnGNuUwopcKVKgvS20oVzp7",+ "created": 1010000009,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqADA4KHR4JzRvNZ7Y9npM",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqADA4KHR4JzRv3Qn6rfDc",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqACA4KHR4JzRv22oKQaFN",+ "payment_method_options": {+ "card": {+ "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_by_card_with_outdated_seat_count--Token.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Token.create.1.jsondeleted file mode 100644index 6281ac65afa..00000000000--- a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--Token.create.1.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1010000005,- "id": "tok_NORMALIZED00000000000001",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..ba14bbd350d--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01d98gsWvcWLP0AtD71zNcatEMdqXOGPhTfrA5L1Yofe3mXY",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTqABA4KHR4JzRvNe5hBHo9",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01d98gsWvcWLP0AtD71zNcatEMdqXOGPhTfrA5L1Yofe3mXY#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..9c67460b6ac--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_card_with_outdated_seat_count--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01d98gsWvcWLP0AtD71zNcatEMdqXOGPhTfrA5L1Yofe3mXY",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTqABA4KHR4JzRvNe5hBHo9",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01d98gsWvcWLP0AtD71zNcatEMdqXOGPhTfrA5L1Yofe3mXY#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_invoice--Customer.modify.1.json b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Customer.modify.1.jsonnew file mode 100644index 00000000000..51ee3ff9762--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1010000001,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_invoice--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Customer.retrieve.1.jsonindex 6ea816ef346..b9aaf2a4ced 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_invoice--Customer.retrieve.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Customer.retrieve.1.json@@ -3,50 +3,7 @@"balance": 0,"created": 1010000001,"currency": "usd",- "default_source": {- "ach_credit_transfer": {- "account_number": "test_NORMALIZED01",- "bank_name": "TEST BANK",- "fingerprint": "NORMALIZED000001",- "refund_account_holder_name": null,- "refund_account_holder_type": null,- "refund_routing_number": null,- "routing_number": "110000000",- "swift_code": "TSTEZ122"- },- "amount": null,- "client_secret": "src_client_secret_NORMALIZED00000000000001",- "created": 1010000002,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "flow": "receiver",- "id": "src_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "source",- "owner": {- "address": null,- "email": "[email protected]",- "name": null,- "phone": null,- "verified_address": null,- "verified_email": null,- "verified_name": null,- "verified_phone": null- },- "receiver": {- "address": "000000000-test_NORMALIZED01",- "amount_charged": 0,- "amount_received": 0,- "amount_returned": 0,- "refund_attributes_method": "email",- "refund_attributes_status": "missing"- },- "statement_descriptor": null,- "status": "pending",- "type": "ach_credit_transfer",- "usage": "reusable"- },+ "default_source": null,"delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -69,57 +26,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "ach_credit_transfer": {- "account_number": "test_NORMALIZED01",- "bank_name": "TEST BANK",- "fingerprint": "NORMALIZED000001",- "refund_account_holder_name": null,- "refund_account_holder_type": null,- "refund_routing_number": null,- "routing_number": "110000000",- "swift_code": "TSTEZ122"- },- "amount": null,- "client_secret": "src_client_secret_NORMALIZED00000000000001",- "created": 1010000002,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "flow": "receiver",- "id": "src_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "source",- "owner": {- "address": null,- "email": "[email protected]",- "name": null,- "phone": null,- "verified_address": null,- "verified_email": null,- "verified_name": null,- "verified_phone": null- },- "receiver": {- "address": "000000000-test_NORMALIZED01",- "amount_charged": 0,- "amount_received": 0,- "amount_returned": 0,- "refund_attributes_method": "email",- "refund_attributes_status": "missing"- },- "statement_descriptor": null,- "status": "pending",- "type": "ach_credit_transfer",- "usage": "reusable"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_invoice--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Customer.retrieve.2.jsonindex 6ea816ef346..92d80f584a1 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_invoice--Customer.retrieve.2.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Customer.retrieve.2.json@@ -3,50 +3,7 @@"balance": 0,"created": 1010000001,"currency": "usd",- "default_source": {- "ach_credit_transfer": {- "account_number": "test_NORMALIZED01",- "bank_name": "TEST BANK",- "fingerprint": "NORMALIZED000001",- "refund_account_holder_name": null,- "refund_account_holder_type": null,- "refund_routing_number": null,- "routing_number": "110000000",- "swift_code": "TSTEZ122"- },- "amount": null,- "client_secret": "src_client_secret_NORMALIZED00000000000001",- "created": 1010000002,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "flow": "receiver",- "id": "src_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "source",- "owner": {- "address": null,- "email": "[email protected]",- "name": null,- "phone": null,- "verified_address": null,- "verified_email": null,- "verified_name": null,- "verified_phone": null- },- "receiver": {- "address": "000000000-test_NORMALIZED01",- "amount_charged": 0,- "amount_received": 0,- "amount_returned": 0,- "refund_attributes_method": "email",- "refund_attributes_status": "missing"- },- "statement_descriptor": null,- "status": "pending",- "type": "ach_credit_transfer",- "usage": "reusable"- },+ "default_source": "src_NORMALIZED00000000000001","delinquent": false,"description": "zulip (Zulip Dev)","discount": null,@@ -69,57 +26,5 @@"phone": null,"preferred_locales": [],"shipping": null,- "sources": {- "data": [- {- "ach_credit_transfer": {- "account_number": "test_NORMALIZED01",- "bank_name": "TEST BANK",- "fingerprint": "NORMALIZED000001",- "refund_account_holder_name": null,- "refund_account_holder_type": null,- "refund_routing_number": null,- "routing_number": "110000000",- "swift_code": "TSTEZ122"- },- "amount": null,- "client_secret": "src_client_secret_NORMALIZED00000000000001",- "created": 1010000002,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "flow": "receiver",- "id": "src_NORMALIZED00000000000001",- "livemode": false,- "metadata": {},- "object": "source",- "owner": {- "address": null,- "email": "[email protected]",- "name": null,- "phone": null,- "verified_address": null,- "verified_email": null,- "verified_name": null,- "verified_phone": null- },- "receiver": {- "address": "000000000-test_NORMALIZED01",- "amount_charged": 0,- "amount_received": 0,- "amount_returned": 0,- "refund_attributes_method": "email",- "refund_attributes_status": "missing"- },- "statement_descriptor": null,- "status": "pending",- "type": "ach_credit_transfer",- "usage": "reusable"- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },"tax_exempt": "none"}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_invoice--Event.list.1.json b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Event.list.1.jsonnew file mode 100644index 00000000000..f1e4c1ae9c3--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Event.list.1.json@@ -0,0 +1,196 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1010000002,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 136000,+ "amount_paid": 0,+ "amount_remaining": 136000,+ "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": 1010000003,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001tgtTe",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001tgtTe/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 184000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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": 1010000004,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1010000005,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 136000,+ "tax": null,+ "total": 136000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JPMBrA4KHR4JzRv5XTFCk0W",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "d6d0bbaa-b5a4-4f35-917c-23f4469a87b4"+ },+ "type": "invoice.finalized"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_invoice--Invoice.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Invoice.create.1.jsonindex 4ff69f25139..9472d2b69f6 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_invoice--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "send_invoice",- "created": 1010000002,+ "created": 1010000006,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -37,7 +37,7 @@"ending_balance": null,"footer": null,"hosted_invoice_url": null,- "id": "in_NORMALIZED00000000000001",+ "id": "in_NORMALIZED00000000000002","invoice_pdf": null,"last_finalization_error": null,"lines": {@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003","livemode": false,"metadata": {},"object": "line_item",@@ -62,16 +62,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000001,+ "created": 1010000007,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,7 +90,7 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/upgrade_by_invoice--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Invoice.finalize_invoice.1.jsonindex 07c16f132ee..ef854428514 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_invoice--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -16,7 +16,7 @@"billing_reason": "manual","charge": null,"collection_method": "send_invoice",- "created": 1010000002,+ "created": 1010000006,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001LW0pX",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001LW0pX/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000021YRUX",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000021YRUX/pdf","last_finalization_error": null,"lines": {"data": [@@ -49,8 +49,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003","livemode": false,"metadata": {},"object": "line_item",@@ -62,16 +62,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000001,+ "created": 1010000007,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -89,16 +90,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0002","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000002","payment_settings": {"payment_method_options": null,"payment_method_types": nulldiff --git a/corporate/tests/stripe_fixtures/upgrade_by_invoice--Invoice.list.1.json b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Invoice.list.1.jsonindex 29b0ca6e5e4..2daa2472d47 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_invoice--Invoice.list.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_invoice--Invoice.list.1.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 984000,"amount_paid": 0,@@ -18,7 +18,7 @@"billing_reason": "manual","charge": null,"collection_method": "send_invoice",- "created": 1010000002,+ "created": 1010000006,"currency": "usd","custom_fields": null,"customer": "cus_NORMALIZED0001",@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001LW0pX",- "id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001LW0pX/pdf",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000021YRUX",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000021YRUX/pdf","last_finalization_error": null,"lines": {"data": [@@ -51,8 +51,8 @@"discount_amounts": [],"discountable": false,"discounts": [],- "id": "il_NORMALIZED00000000000001",- "invoice_item": "ii_NORMALIZED00000000000001",+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003","livemode": false,"metadata": {},"object": "line_item",@@ -64,16 +64,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000001,+ "created": 1010000007,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -91,16 +92,16 @@"has_more": false,"object": "list","total_count": 1,- "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"},"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0002","object": "invoice","on_behalf_of": null,"paid": false,- "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000002","payment_settings": {"payment_method_options": null,"payment_method_types": nulldiff --git a/corporate/tests/stripe_fixtures/upgrade_by_invoice--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/upgrade_by_invoice--InvoiceItem.create.1.jsonindex 031df5bc519..9591e7e8027 100644--- a/corporate/tests/stripe_fixtures/upgrade_by_invoice--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_by_invoice--InvoiceItem.create.1.json@@ -6,7 +6,7 @@"description": "Zulip Standard","discountable": false,"discounts": [],- "id": "ii_NORMALIZED00000000000001",+ "id": "ii_NORMALIZED00000000000003","invoice": null,"livemode": false,"metadata": {},@@ -19,16 +19,17 @@"price": {"active": false,"billing_scheme": "per_unit",- "created": 1010000001,+ "created": 1010000007,"currency": "usd",- "id": "price_NORMALIZED00000000000001",+ "id": "price_NORMALIZED00000000000003","livemode": false,"lookup_key": null,"metadata": {},"nickname": null,"object": "price",- "product": "prod_NORMALIZED0001",+ "product": "prod_NORMALIZED0003","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Charge.list.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Charge.list.1.jsonsimilarity index 63%rename from corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Charge.list.1.jsonrename to corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Charge.list.1.jsonindex f4c2357daa4..ecee252c9e2 100644--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Charge.list.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Charge.list.1.json@@ -10,18 +10,18 @@"balance_transaction": null,"billing_details": {"address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",+ "city": null,+ "country": null,+ "line1": null,"line2": null,- "postal_code": "33333",+ "postal_code": null,"state": null},"email": null,- "name": "Ada Starr",+ "name": null,"phone": null},- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",+ "calculated_statement_descriptor": "ZULIP STANDARD","captured": false,"created": 1000000000,"currency": "usd",@@ -36,7 +36,17 @@"id": "ch_NORMALIZED00000000000001","invoice": null,"livemode": false,- "metadata": {},+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },"object": "charge","on_behalf_of": null,"order": null,@@ -49,20 +59,20 @@"type": "issuer_declined"},"paid": false,- "payment_intent": null,- "payment_method": "card_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM","payment_method_details": {"card": {"brand": "visa","checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",+ "address_line1_check": null,+ "address_postal_code_check": null,"cvc_check": "pass"},"country": "US","exp_month": 3,"exp_year": 2033,- "fingerprint": "NORMALIZED000002",+ "fingerprint": "NORMALIZED000001","funding": "credit","installments": null,"last4": "0341",@@ -85,34 +95,10 @@},"review": null,"shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "source": null,"source_transfer": null,"statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",+ "statement_descriptor_suffix": null,"status": "failed","transfer_data": null,"transfer_group": nulldiff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Charge.list.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Charge.list.2.jsonsimilarity index 64%rename from corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Charge.list.2.jsonrename to corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Charge.list.2.jsonindex f94d2e808fa..11480dc51f0 100644--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Charge.list.2.json+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Charge.list.2.json@@ -10,18 +10,18 @@"balance_transaction": "txn_NORMALIZED00000000000001","billing_details": {"address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",+ "city": null,+ "country": null,+ "line1": null,"line2": null,- "postal_code": "33333",+ "postal_code": null,"state": null},"email": null,- "name": "Ada Starr",+ "name": null,"phone": null},- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",+ "calculated_statement_descriptor": "ZULIP STANDARD","captured": true,"created": 1000000000,"currency": "usd",@@ -36,7 +36,17 @@"id": "ch_NORMALIZED00000000000002","invoice": null,"livemode": false,- "metadata": {},+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },"object": "charge","on_behalf_of": null,"order": null,@@ -49,20 +59,20 @@"type": "authorized"},"paid": true,- "payment_intent": null,- "payment_method": "card_NORMALIZED00000000000001",+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve","payment_method_details": {"card": {"brand": "visa","checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",+ "address_line1_check": null,+ "address_postal_code_check": null,"cvc_check": "pass"},"country": "US","exp_month": 3,"exp_year": 2033,- "fingerprint": "NORMALIZED000001",+ "fingerprint": "NORMALIZED000002","funding": "credit","installments": null,"last4": "4242",@@ -85,34 +95,10 @@},"review": null,"shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "source": null,"source_transfer": null,"statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",+ "statement_descriptor_suffix": null,"status": "succeeded","transfer_data": null,"transfer_group": null@@ -127,18 +113,18 @@"balance_transaction": null,"billing_details": {"address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",+ "city": null,+ "country": null,+ "line1": null,"line2": null,- "postal_code": "33333",+ "postal_code": null,"state": null},"email": null,- "name": "Ada Starr",+ "name": null,"phone": null},- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",+ "calculated_statement_descriptor": "ZULIP STANDARD","captured": false,"created": 1000000000,"currency": "usd",@@ -153,7 +139,17 @@"id": "ch_NORMALIZED00000000000001","invoice": null,"livemode": false,- "metadata": {},+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },"object": "charge","on_behalf_of": null,"order": null,@@ -166,20 +162,20 @@"type": "issuer_declined"},"paid": false,- "payment_intent": null,- "payment_method": "card_NORMALIZED00000000000002",+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM","payment_method_details": {"card": {"brand": "visa","checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",+ "address_line1_check": null,+ "address_postal_code_check": null,"cvc_check": "pass"},"country": "US","exp_month": 3,"exp_year": 2033,- "fingerprint": "NORMALIZED000002",+ "fingerprint": "NORMALIZED000001","funding": "credit","installments": null,"last4": "0341",@@ -202,34 +198,10 @@},"review": null,"shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },+ "source": null,"source_transfer": null,"statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",+ "statement_descriptor_suffix": null,"status": "failed","transfer_data": null,"transfer_group": nulldiff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.create.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.create.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.modify.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.modify.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.modify.2.jsonnew file mode 100644index 00000000000..16d801592a5--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.modify.3.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.modify.3.jsonnew file mode 100644index 00000000000..01273c5dba5--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.modify.3.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.retrieve.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.retrieve.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.retrieve.2.jsonnew file mode 100644index 00000000000..1813e440fe6--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.retrieve.2.json@@ -0,0 +1,76 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.retrieve.3.jsonnew file mode 100644index 00000000000..16d801592a5--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Customer.retrieve.3.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.1.jsonnew file mode 100644index 00000000000..51882686392--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.1.json@@ -0,0 +1,61 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq1kA4KHR4JzRvFA0jnE7e_secret_K86EIkQQ0NUVjzpTlDlte1RZPPiC1FG",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0002",+ "description": null,+ "id": "seti_1JTq1kA4KHR4JzRvFA0jnE7e",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq1kA4KHR4JzRv08fYD23e",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq1dA4KHR4JzRvUC3CG3GY",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq1kA4KHR4JzRvUdhnmSbL",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "f6dcbfe7-bbc5-43cf-8017-81c7eb3f5a80"+ },+ "type": "setup_intent.succeeded"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.2.jsonnew file mode 100644index 00000000000..45769770301--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.2.json@@ -0,0 +1,756 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "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_BPWPbanpyrkqCWbBS0BO9TSGz",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq2ZA4KHR4JzRv1PDnNEwj",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "2c005700-ef35-4b6f-8ce5-bfdbfe78f0dc"+ },+ "type": "payment_intent.payment_failed"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq2ZA4KHR4JzRv1QHLpNdj",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "2c005700-ef35-4b6f-8ce5-bfdbfe78f0dc"+ },+ "type": "charge.failed"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTq2fA4KHR4JzRvdRTIFT7i",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "97d0c5e5-6c2a-44ef-ba0e-b9b2556a0e97"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq2cA4KHR4JzRvIyzpcOku_secret_K86FiWzplVM2E2CTV7Qi5MydSRBwNeZ",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq2cA4KHR4JzRvIyzpcOku",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq2cA4KHR4JzRvsnl4OZZX",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq2dA4KHR4JzRvOsMpIxo2",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "74374ef1-d5bf-4f7a-b2ea-38f3e711cbc2"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq2dA4KHR4JzRvbVabcW2y",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "74374ef1-d5bf-4f7a-b2ea-38f3e711cbc2"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq2cA4KHR4JzRvIyzpcOku_secret_K86FiWzplVM2E2CTV7Qi5MydSRBwNeZ",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq2cA4KHR4JzRvIyzpcOku",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq2cA4KHR4JzRvsnl4OZZX",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq2dA4KHR4JzRv7vkXg7BS",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "74374ef1-d5bf-4f7a-b2ea-38f3e711cbc2"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq2ZA4KHR4JzRvuZCYvjuz_secret_K86Fub8dmyWFzCOOtJCMqt5Ovy1Wj9X",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq2ZA4KHR4JzRvuZCYvjuz",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq2aA4KHR4JzRvJRR2mhS1",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "d5829cb2-57b6-4e85-bc97-c7bf44333aa3"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_BPWPbanpyrkqCWbBS0BO9TSGz",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq2ZA4KHR4JzRv1rxvnucP",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "88b6f1c6-41a6-437d-b14f-a5c5d152e41c"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTq2YA4KHR4JzRvyanl88up",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "81cdbdf2-be5d-43d7-ad78-58dba5d9c2cc"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.3.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.3.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.3.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.4.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.4.jsonnew file mode 100644index 00000000000..cdca0c54adc--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.4.json@@ -0,0 +1,242 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "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_BPWPbanpyrkqCWbBS0BO9TSGz",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq2ZA4KHR4JzRv1PDnNEwj",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "2c005700-ef35-4b6f-8ce5-bfdbfe78f0dc"+ },+ "type": "payment_intent.payment_failed"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.5.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.5.jsonnew file mode 100644index 00000000000..bafce55adcb--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.5.json@@ -0,0 +1,657 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 184000,+ "amount_capturable": 0,+ "amount_received": 184000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 184000,+ "amount_captured": 184000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 23",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000001",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_eZ82dQxSn0KwKMzYfGbLKtIUG",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 23",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq2mA4KHR4JzRv1Oa4ZL4e",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "c190ed58-43ff-42e1-999a-0a27b8913de5"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 184000,+ "amount_captured": 184000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 23",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000001",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq2mA4KHR4JzRv1Z5ya8Pf",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "c190ed58-43ff-42e1-999a-0a27b8913de5"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM"+ }+ }+ },+ "id": "evt_1JTq2rA4KHR4JzRv9exDwqkr",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "08bf7d5f-1164-41d1-a035-75cb4ed1378f"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq2oA4KHR4JzRvmVlHnTDV_secret_K86F4JiUNFDaIe92dENTyawavQVuwzp",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq2oA4KHR4JzRvmVlHnTDV",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq2oA4KHR4JzRv5UsDqEnA",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq2pA4KHR4JzRvzOkaoNBq",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "106ff81d-7ee8-4bbb-9259-c7816c72beca"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "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_1JTq2nA4KHR4JzRvrlCVdFve",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTq2pA4KHR4JzRvkfPRdY5m",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "106ff81d-7ee8-4bbb-9259-c7816c72beca"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq2oA4KHR4JzRvmVlHnTDV_secret_K86F4JiUNFDaIe92dENTyawavQVuwzp",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq2oA4KHR4JzRvmVlHnTDV",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq2oA4KHR4JzRv5UsDqEnA",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq2pA4KHR4JzRvoSfW2DEG",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "106ff81d-7ee8-4bbb-9259-c7816c72beca"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq2nA4KHR4JzRvmtOtXmhL_secret_K86FFXXWHJ3kTYFPSumJwYBbFb5a0mB",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq2nA4KHR4JzRvmtOtXmhL",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTq2nA4KHR4JzRvZ6e6esGd",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "af6afd64-3f04-4287-90b6-b0fd273ba744"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 184000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_eZ82dQxSn0KwKMzYfGbLKtIUG",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 23",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTq2mA4KHR4JzRv1mO08Fo9",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0012",+ "idempotency_key": "4cda7b2a-d18e-4899-93bb-5d1b51dafbf6"+ },+ "type": "payment_intent.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.6.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.6.jsonnew file mode 100644index 00000000000..eb1d6c9d5f7--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.6.json@@ -0,0 +1,1261 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 184000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -184000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -184000,+ "unit_amount_decimal": "-184000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq2xA4KHR4JzRvO3ETmYHw",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0013",+ "idempotency_key": "2fd351b7-11e2-42f5-98a7-94de6887c731"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 184000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -184000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -184000,+ "unit_amount_decimal": "-184000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq2xA4KHR4JzRvXndwkHOJ",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0013",+ "idempotency_key": "2fd351b7-11e2-42f5-98a7-94de6887c731"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 184000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -184000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -184000,+ "unit_amount_decimal": "-184000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq2xA4KHR4JzRvW55TvwYX",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0013",+ "idempotency_key": "2fd351b7-11e2-42f5-98a7-94de6887c731"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 184000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -184000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -184000,+ "unit_amount_decimal": "-184000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1JTq2wA4KHR4JzRvjXwb3WkA",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0013",+ "idempotency_key": "2fd351b7-11e2-42f5-98a7-94de6887c731"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 184000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -184000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -184000,+ "unit_amount_decimal": "-184000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTq2vA4KHR4JzRvjTQ8nqls",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0014",+ "idempotency_key": "e02de861-58da-463f-a8bd-1abb40914666"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -184000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -184000,+ "unit_amount_decimal": "-184000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -184000,+ "unit_amount_decimal": "-184000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq2wA4KHR4JzRvVYzU3BB4",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0014",+ "idempotency_key": "e02de861-58da-463f-a8bd-1abb40914666"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 184000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000001",+ "invoice": "in_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTq2vA4KHR4JzRvPLLqa1Ok",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0014",+ "idempotency_key": "e02de861-58da-463f-a8bd-1abb40914666"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 184000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ }+ },+ "id": "evt_1JTq2vA4KHR4JzRvHDs8HpwW",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0015",+ "idempotency_key": "9454a17e-4d29-4ef2-b0a1-5a1f44279f84"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -184000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "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",+ "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": -184000,+ "unit_amount_decimal": "-184000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -184000,+ "unit_amount_decimal": "-184000"+ }+ },+ "id": "evt_1JTq2uA4KHR4JzRv6Cq4Rs4R",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0016",+ "idempotency_key": "3d675841-cd57-40ab-96f8-acbfd411c768"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JTq2uA4KHR4JzRvY4wbo1qe",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0016",+ "idempotency_key": "3d675841-cd57-40ab-96f8-acbfd411c768"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.7.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.7.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Event.list.7.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Invoice.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.create.1.jsonsimilarity index 96%rename from corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Invoice.create.1.jsonrename to corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.create.1.jsonindex 9c8c17c5ed4..94b3c586386 100644--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -115,6 +116,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.finalize_invoice.1.jsonsimilarity index 94%rename from corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Invoice.finalize_invoice.1.jsonrename to corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.finalize_invoice.1.jsonindex a04f73a460a..5d7b233c49c 100644--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000011d2Zr",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000011d2Zr/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -115,6 +116,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -137,7 +139,7 @@"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0002","object": "invoice","on_behalf_of": null,"paid": true,@@ -168,5 +170,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.list.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.list.1.jsonnew file mode 100644index 00000000000..e39960ab725--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--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_first_card_fails_and_restart_from_begining--Invoice.list.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.list.2.jsonnew file mode 100644index 00000000000..e39960ab725--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.list.2.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.list.3.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.list.3.jsonnew file mode 100644index 00000000000..e39960ab725--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.list.3.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Invoice.list.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.list.4.jsonsimilarity index 94%rename from corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Invoice.list.2.jsonrename to corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.list.4.jsonindex aaa6d2eafd9..b61aa71022d 100644--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Invoice.list.2.json+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--Invoice.list.4.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 0,"amount_paid": 0,@@ -38,9 +38,9 @@"due_date": null,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED00000000000000011d2Zr",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED00000000000000011d2Zr/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001j7BSf/pdf","last_finalization_error": null,"lines": {"data": [@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -117,6 +118,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -139,7 +141,7 @@"livemode": false,"metadata": {},"next_payment_attempt": null,- "number": "NORMALI-0001",+ "number": "NORMALI-0002","object": "invoice","on_behalf_of": null,"paid": true,@@ -170,7 +172,7 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}],"has_more": false,diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--InvoiceItem.create.1.jsonsimilarity index 96%rename from corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--InvoiceItem.create.1.jsonrename to corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--InvoiceItem.create.1.jsonindex e7e8ac47f7b..59a7e9e1ec8 100644--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--InvoiceItem.create.1.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--InvoiceItem.create.2.jsonsimilarity index 96%rename from corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--InvoiceItem.create.2.jsonrename to corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--InvoiceItem.create.2.jsonindex 94f145f0033..25a89d76be9 100644--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--InvoiceItem.create.2.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--InvoiceItem.list.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--InvoiceItem.list.1.jsonsimilarity index 100%rename from corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--InvoiceItem.list.1.jsonrename to corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--InvoiceItem.list.1.jsondiff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..1e3872f58a6--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentIntent.confirm.1.json@@ -0,0 +1,577 @@+{+ "_message": "Your card was declined.",+ "code": "card_declined",+ "error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "param": null,+ "payment_intent": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "refunded": false,+ "refunds": {},+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "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_BPWPbanpyrkqCWbBS0BO9TSGz",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ },+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "setup_intent": null,+ "source": null,+ "type": "card_error"+ },+ "headers": {+ "Connection": "keep-alive",+ "Content-Length": "8680",+ "Content-Type": "application/json",+ "Date": "NORMALIZED DATETIME",+ "Server": "nginx",+ "Strict-Transport-Security": "max-age=31556926; includeSubDomains; preload",+ "access-control-allow-credentials": "true",+ "access-control-allow-methods": "GET, POST, HEAD, OPTIONS, DELETE",+ "access-control-allow-origin": "*",+ "access-control-expose-headers": "Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required",+ "access-control-max-age": "300",+ "cache-control": "no-cache, no-store",+ "idempotency-key": "00000000-0000-0000-0000-000000000000",+ "original-request": "req_NORMALIZED0002",+ "request-id": "req_NORMALIZED0002",+ "stripe-should-retry": "false",+ "stripe-version": "2020-08-27",+ "x-stripe-c-cost": "6"+ },+ "http_body": "{\n \"error\": {\n \"charge\": \"ch_NORMALIZED00000000000001\",\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"payment_intent\": {\n \"id\": \"pi_NORMALIZED00000000000001\",\n \"object\": \"payment_intent\",\n \"amount\": 48000,\n \"amount_capturable\": 0,\n \"amount_received\": 0,\n \"application\": null,\n \"application_fee_amount\": null,\n \"canceled_at\": null,\n \"cancellation_reason\": null,\n \"capture_method\": \"automatic\",\n \"charges\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ch_NORMALIZED00000000000001\",\n \"object\": \"charge\",\n \"amount\": 48000,\n \"amount_captured\": 0,\n \"amount_refunded\": 0,\n \"application\": null,\n \"application_fee\": null,\n \"application_fee_amount\": null,\n \"balance_transaction\": null,\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"calculated_statement_descriptor\": \"ZULIP STANDARD\",\n \"captured\": false,\n \"created\": 1000000000,\n \"currency\": \"usd\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"description\": \"Upgrade to Zulip Standard, $80.0 x 6\",\n \"destination\": null,\n \"dispute\": null,\n \"disputed\": false,\n \"failure_code\": \"card_declined\",\n \"failure_message\": \"Your card was declined.\",\n \"fraud_details\": {\n },\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {\n \"billing_modality\": \"charge_automatically\",\n \"billing_schedule\": \"1\",\n \"licenses\": \"6\",\n \"license_management\": \"automatic\",\n \"price_per_license\": \"8000\",\n \"seat_count\": \"6\",\n \"type\": \"upgrade\",\n \"user_email\": \"[email protected]\",\n \"realm_str\": \"zulip\"\n },\n \"on_behalf_of\": null,\n \"order\": null,\n \"outcome\": {\n \"network_status\": \"declined_by_network\",\n \"reason\": \"generic_decline\",\n \"risk_level\": \"normal\",\n \"risk_score\": 13,\n \"seller_message\": \"The bank did not return any further details with this decline.\",\n \"type\": \"issuer_declined\"\n },\n \"paid\": false,\n \"payment_intent\": \"pi_NORMALIZED00000000000001\",\n \"payment_method\": \"pm_1JTq2WA4KHR4JzRv7eaGGnoM\",\n \"payment_method_details\": {\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000001\",\n \"funding\": \"credit\",\n \"installments\": null,\n \"last4\": \"0341\",\n \"network\": \"visa\",\n \"three_d_secure\": null,\n \"wallet\": null\n },\n \"type\": \"card\"\n },\n \"receipt_email\": \"[email protected]\",\n \"receipt_number\": null,\n \"receipt_url\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [\n\n ],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_NORMALIZED00000000000001/refunds\"\n },\n \"review\": null,\n \"shipping\": null,\n \"source\": null,\n \"source_transfer\": null,\n \"statement_descriptor\": \"Zulip Standard\",\n \"statement_descriptor_suffix\": null,\n \"status\": \"failed\",\n \"transfer_data\": null,\n \"transfer_group\": null\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/charges?payment_intent=pi_NORMALIZED00000000000001\"\n },\n \"client_secret\": \"pi_NORMALIZED00000000000001_secret_BPWPbanpyrkqCWbBS0BO9TSGz\",\n \"confirmation_method\": \"automatic\",\n \"created\": 1000000000,\n \"currency\": \"usd\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"description\": \"Upgrade to Zulip Standard, $80.0 x 6\",\n \"invoice\": null,\n \"last_payment_error\": {\n \"charge\": \"ch_NORMALIZED00000000000001\",\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"payment_method\": {\n \"id\": \"pm_1JTq2WA4KHR4JzRv7eaGGnoM\",\n \"object\": \"payment_method\",\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000001\",\n \"funding\": \"credit\",\n \"generated_from\": null,\n \"last4\": \"0341\",\n \"networks\": {\n \"available\": [\n \"visa\"\n ],\n \"preferred\": null\n },\n \"three_d_secure_usage\": {\n \"supported\": true\n },\n \"wallet\": null\n },\n \"created\": 1000000000,\n \"customer\": \"cus_NORMALIZED0001\",\n \"livemode\": false,\n \"metadata\": {\n },\n \"type\": \"card\"\n },\n \"type\": \"card_error\"\n },\n \"livemode\": false,\n \"metadata\": {\n \"billing_modality\": \"charge_automatically\",\n \"billing_schedule\": \"1\",\n \"licenses\": \"6\",\n \"license_management\": \"automatic\",\n \"price_per_license\": \"8000\",\n \"seat_count\": \"6\",\n \"type\": \"upgrade\",\n \"user_email\": \"[email protected]\",\n \"realm_str\": \"zulip\"\n },\n \"next_action\": null,\n \"on_behalf_of\": null,\n \"payment_method\": null,\n \"payment_method_options\": {\n \"card\": {\n \"installments\": null,\n \"network\": null,\n \"request_three_d_secure\": \"automatic\"\n }\n },\n \"payment_method_types\": [\n \"card\"\n ],\n \"receipt_email\": \"[email protected]\",\n \"review\": null,\n \"setup_future_usage\": null,\n \"shipping\": null,\n \"source\": null,\n \"statement_descriptor\": \"Zulip Standard\",\n \"statement_descriptor_suffix\": null,\n \"status\": \"requires_payment_method\",\n \"transfer_data\": null,\n \"transfer_group\": null\n },\n \"payment_method\": {\n \"id\": \"pm_1JTq2WA4KHR4JzRv7eaGGnoM\",\n \"object\": \"payment_method\",\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000001\",\n \"funding\": \"credit\",\n \"generated_from\": null,\n \"last4\": \"0341\",\n \"networks\": {\n \"available\": [\n \"visa\"\n ],\n \"preferred\": null\n },\n \"three_d_secure_usage\": {\n \"supported\": true\n },\n \"wallet\": null\n },\n \"created\": 1000000000,\n \"customer\": \"cus_NORMALIZED0001\",\n \"livemode\": false,\n \"metadata\": {\n },\n \"type\": \"card\"\n },\n \"type\": \"card_error\"\n }\n}\n",+ "http_status": 402,+ "json_body": {+ "error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "payment_intent": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "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_BPWPbanpyrkqCWbBS0BO9TSGz",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ },+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ }+ },+ "param": null,+ "request_id": "req_NORMALIZED0002"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentIntent.confirm.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentIntent.confirm.2.jsonnew file mode 100644index 00000000000..a2d02d524a8--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentIntent.confirm.2.json@@ -0,0 +1,166 @@+{+ "amount": 184000,+ "amount_capturable": 0,+ "amount_received": 184000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 184000,+ "amount_captured": 184000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 23",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000001",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_eZ82dQxSn0KwKMzYfGbLKtIUG",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 23",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..e5c8dbc858c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_BPWPbanpyrkqCWbBS0BO9TSGz",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentIntent.create.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentIntent.create.2.jsonnew file mode 100644index 00000000000..3ce27d7ac48--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentIntent.create.2.json@@ -0,0 +1,62 @@+{+ "amount": 184000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_eZ82dQxSn0KwKMzYfGbLKtIUG",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 23",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..996d4bd69b7--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentMethod.create.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentMethod.create.2.jsonnew file mode 100644index 00000000000..f024bd089ea--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--PaymentMethod.create.2.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..bd85a91e144--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq2cA4KHR4JzRvIyzpcOku_secret_K86FiWzplVM2E2CTV7Qi5MydSRBwNeZ",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq2cA4KHR4JzRvIyzpcOku",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq2cA4KHR4JzRvsnl4OZZX",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "payment_method_options": {+ "card": {+ "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_first_card_fails_and_restart_from_begining--SetupIntent.create.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.create.2.jsonnew file mode 100644index 00000000000..4da388a638c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.create.2.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq2oA4KHR4JzRvmVlHnTDV_secret_K86F4JiUNFDaIe92dENTyawavQVuwzp",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq2oA4KHR4JzRvmVlHnTDV",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq2oA4KHR4JzRv5UsDqEnA",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "payment_method_options": {+ "card": {+ "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_first_card_fails_and_restart_from_begining--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..9904fd0eeb3--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq2ZA4KHR4JzRvuZCYvjuz_secret_K86Fub8dmyWFzCOOtJCMqt5Ovy1Wj9X",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq2ZA4KHR4JzRvuZCYvjuz",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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_first_card_fails_and_restart_from_begining--SetupIntent.list.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.list.2.jsonnew file mode 100644index 00000000000..3023362ea30--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.list.2.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq2nA4KHR4JzRvmtOtXmhL_secret_K86FFXXWHJ3kTYFPSumJwYBbFb5a0mB",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq2nA4KHR4JzRvmtOtXmhL",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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_first_card_fails_and_restart_from_begining--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..bd85a91e144--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq2cA4KHR4JzRvIyzpcOku_secret_K86FiWzplVM2E2CTV7Qi5MydSRBwNeZ",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq2cA4KHR4JzRvIyzpcOku",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq2cA4KHR4JzRvsnl4OZZX",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq2WA4KHR4JzRv7eaGGnoM",+ "payment_method_options": {+ "card": {+ "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_first_card_fails_and_restart_from_begining--SetupIntent.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.retrieve.2.jsonnew file mode 100644index 00000000000..4da388a638c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--SetupIntent.retrieve.2.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTq2oA4KHR4JzRvmVlHnTDV_secret_K86F4JiUNFDaIe92dENTyawavQVuwzp",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTq2oA4KHR4JzRvmVlHnTDV",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTq2oA4KHR4JzRv5UsDqEnA",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTq2nA4KHR4JzRvrlCVdFve",+ "payment_method_options": {+ "card": {+ "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_first_card_fails_and_restart_from_begining--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..70de0898c9d--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01XtbTSyLhQCdiV1Lu4bNCG9pufz123x5vQyvb3BCJoiPJEe",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq2ZA4KHR4JzRvuZCYvjuz",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01XtbTSyLhQCdiV1Lu4bNCG9pufz123x5vQyvb3BCJoiPJEe#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--checkout.Session.create.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--checkout.Session.create.2.jsonnew file mode 100644index 00000000000..79175d0e2bc--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--checkout.Session.create.2.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED02psIA7vgH0mJjQ3o7osNWBxq11q4ZpjRX1MhowEBGwee6HW",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq2nA4KHR4JzRvmtOtXmhL",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED02psIA7vgH0mJjQ3o7osNWBxq11q4ZpjRX1MhowEBGwee6HW#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..5a43f381e9b--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01XtbTSyLhQCdiV1Lu4bNCG9pufz123x5vQyvb3BCJoiPJEe",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq2ZA4KHR4JzRvuZCYvjuz",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01XtbTSyLhQCdiV1Lu4bNCG9pufz123x5vQyvb3BCJoiPJEe#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--checkout.Session.list.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--checkout.Session.list.2.jsonnew file mode 100644index 00000000000..9a407974438--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_restart_from_begining--checkout.Session.list.2.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED02psIA7vgH0mJjQ3o7osNWBxq11q4ZpjRX1MhowEBGwee6HW",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "23",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "23",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTq2nA4KHR4JzRvmtOtXmhL",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED02psIA7vgH0mJjQ3o7osNWBxq11q4ZpjRX1MhowEBGwee6HW#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Charge.list.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Charge.list.1.jsonnew file mode 100644index 00000000000..6454d35b937--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Charge.list.1.json@@ -0,0 +1,110 @@+{+ "data": [+ {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "transfer_data": null,+ "transfer_group": null+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/charges"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Charge.list.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Charge.list.2.jsonnew file mode 100644index 00000000000..800ae2cd9ad--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Charge.list.2.json@@ -0,0 +1,213 @@+{+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTqAdA4KHR4JzRvkF8mCZXf",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000001",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ },+ {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "transfer_data": null,+ "transfer_group": null+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/charges"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.create.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.create.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.modify.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.modify.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.modify.2.jsonnew file mode 100644index 00000000000..bde7aa033bb--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.modify.3.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.modify.3.jsonnew file mode 100644index 00000000000..d60ca26602e--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.modify.3.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqAdA4KHR4JzRvkF8mCZXf",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.retrieve.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.retrieve.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.retrieve.2.jsonnew file mode 100644index 00000000000..85db8197714--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.retrieve.2.json@@ -0,0 +1,76 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.retrieve.3.jsonnew file mode 100644index 00000000000..bde7aa033bb--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Customer.retrieve.3.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.1.jsonnew file mode 100644index 00000000000..80a081004aa--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.1.json@@ -0,0 +1,196 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 136000,+ "amount_paid": 0,+ "amount_remaining": 136000,+ "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_NORMALIZED0002",+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001cMgL8",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001cMgL8/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 184000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 136000,+ "tax": null,+ "total": 136000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqAMA4KHR4JzRvIhV64ycG",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "4886d91f-396a-46c5-94da-382fdc497108"+ },+ "type": "invoice.finalized"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.2.jsonnew file mode 100644index 00000000000..0d3af7de8ec--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.2.json@@ -0,0 +1,756 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "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_xVxt33T2UJomjdIlY6iKdiBvU",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqARA4KHR4JzRv0n21W5nT",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "d4e6dc71-d56b-4d61-a768-f501d3f319d8"+ },+ "type": "payment_intent.payment_failed"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqARA4KHR4JzRv0ipDHa17",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "d4e6dc71-d56b-4d61-a768-f501d3f319d8"+ },+ "type": "charge.failed"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTqAVA4KHR4JzRv28baQLpf",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "d1a31721-412a-439a-b1a3-eddd1f2bc200"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqASA4KHR4JzRvqm7jOHpq_secret_K86NHRwV2W6TnxZVcnQxdTE3JWsy8J5",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqASA4KHR4JzRvqm7jOHpq",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqASA4KHR4JzRvlyad8fKz",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqATA4KHR4JzRvfU11SS8N",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "c1eb6a0a-e000-47ed-88d9-dbc299b8a4e1"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTqATA4KHR4JzRv5hyn3oHQ",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "c1eb6a0a-e000-47ed-88d9-dbc299b8a4e1"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqASA4KHR4JzRvqm7jOHpq_secret_K86NHRwV2W6TnxZVcnQxdTE3JWsy8J5",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqASA4KHR4JzRvqm7jOHpq",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqASA4KHR4JzRvlyad8fKz",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqATA4KHR4JzRvJpG9CzmS",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "c1eb6a0a-e000-47ed-88d9-dbc299b8a4e1"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqARA4KHR4JzRvEiCwWXHQ_secret_K86NaB1GVexw8WmDIhr22u6zv68TX2I",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqARA4KHR4JzRvEiCwWXHQ",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqARA4KHR4JzRvD0ExIHAY",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "8b4c5f0f-be17-4659-9eda-9516de4a2ff3"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_xVxt33T2UJomjdIlY6iKdiBvU",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqARA4KHR4JzRv0Gz9nyf0",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "3275ac4f-4f66-4406-8533-a18b1392763f"+ },+ "type": "payment_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ }+ },+ "id": "evt_1JTqAPA4KHR4JzRvuWz0a7r0",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "d413873a-0681-4ab0-88c0-99e647492a84"+ },+ "type": "customer.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.3.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.3.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.3.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.4.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.4.jsonnew file mode 100644index 00000000000..d895049b75d--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.4.json@@ -0,0 +1,242 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "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_xVxt33T2UJomjdIlY6iKdiBvU",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqARA4KHR4JzRv0n21W5nT",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "d4e6dc71-d56b-4d61-a768-f501d3f319d8"+ },+ "type": "payment_intent.payment_failed"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.5.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.5.jsonnew file mode 100644index 00000000000..e101dc1fa24--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.5.json@@ -0,0 +1,580 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTqAdA4KHR4JzRvkF8mCZXf",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000001",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ ],+ "has_more": true,+ "object": "list",+ "total_count": 2,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_xVxt33T2UJomjdIlY6iKdiBvU",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAdA4KHR4JzRvkF8mCZXf",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqARA4KHR4JzRv0RKEiSXM",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "688b8fd7-73ff-4945-9539-c672fdee6b36"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTqAdA4KHR4JzRvkF8mCZXf",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000001",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqARA4KHR4JzRv0fouxUf6",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "688b8fd7-73ff-4945-9539-c672fdee6b36"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqAdA4KHR4JzRvkF8mCZXf",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0"+ }+ }+ },+ "id": "evt_1JTqAhA4KHR4JzRvFKyxt3kT",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "4ddbe6e2-440c-469a-9f1f-72f26813847c"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAeA4KHR4JzRvwvsjxBOb_secret_K86NUkPVA7e7fEiqm9ow0FviRNNSpzb",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAeA4KHR4JzRvwvsjxBOb",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqAfA4KHR4JzRvctBUYVVz",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAdA4KHR4JzRvkF8mCZXf",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqAfA4KHR4JzRv51RaxELz",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "f20b1a85-d1e0-4dba-9c61-b37c53dd9560"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "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_1JTqAdA4KHR4JzRvkF8mCZXf",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTqAfA4KHR4JzRvhseIA31p",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "f20b1a85-d1e0-4dba-9c61-b37c53dd9560"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAeA4KHR4JzRvwvsjxBOb_secret_K86NUkPVA7e7fEiqm9ow0FviRNNSpzb",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAeA4KHR4JzRvwvsjxBOb",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqAfA4KHR4JzRvctBUYVVz",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAdA4KHR4JzRvkF8mCZXf",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqAfA4KHR4JzRvFsG2qGe0",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "f20b1a85-d1e0-4dba-9c61-b37c53dd9560"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAdA4KHR4JzRvMroBt0xJ_secret_K86Nzlf1Sl1Kniu2RtCkmsWlngvE1wx",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAdA4KHR4JzRvMroBt0xJ",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqAdA4KHR4JzRv3C11u9FO",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "cce0ae12-3e36-4bd0-b4fc-77c6e54ae1d7"+ },+ "type": "setup_intent.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.6.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.6.jsonnew file mode 100644index 00000000000..a954fc89694--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.6.json@@ -0,0 +1,1261 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002vf9UM",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002vf9UM/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqAoA4KHR4JzRvGIvgN1Xk",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0012",+ "idempotency_key": "5319526e-4f72-4755-9dd9-203b824b6259"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002vf9UM",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002vf9UM/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqAnA4KHR4JzRv8IhkMqyj",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0012",+ "idempotency_key": "5319526e-4f72-4755-9dd9-203b824b6259"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002vf9UM",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002vf9UM/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqAnA4KHR4JzRv9wWH9Tlp",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0012",+ "idempotency_key": "5319526e-4f72-4755-9dd9-203b824b6259"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002vf9UM",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002vf9UM/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1JTqAnA4KHR4JzRv4G8Uug7h",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0012",+ "idempotency_key": "5319526e-4f72-4755-9dd9-203b824b6259"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqAmA4KHR4JzRv7fu76qSh",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0013",+ "idempotency_key": "0643f6b8-daa9-4e3d-a763-f219e4ca6479"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000004",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTqAnA4KHR4JzRvdpVaeLlk",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0013",+ "idempotency_key": "0643f6b8-daa9-4e3d-a763-f219e4ca6479"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000003",+ "invoice": "in_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTqAnA4KHR4JzRvORgE0FtX",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0013",+ "idempotency_key": "0643f6b8-daa9-4e3d-a763-f219e4ca6479"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ }+ },+ "id": "evt_1JTqAlA4KHR4JzRvuzjgPVhU",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0014",+ "idempotency_key": "346f8a75-d45a-4ce7-a54b-2fe67eefe315"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000004",+ "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",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ }+ },+ "id": "evt_1JTqAlA4KHR4JzRveZxQwWb9",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0015",+ "idempotency_key": "70d95e07-7f56-4b06-ae93-d7b72c6bc4dd"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqAdA4KHR4JzRvkF8mCZXf",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JTqAlA4KHR4JzRvLuo8t9uQ",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0015",+ "idempotency_key": "70d95e07-7f56-4b06-ae93-d7b72c6bc4dd"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.7.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.7.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Event.list.7.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.create.1.jsonnew file mode 100644index 00000000000..732c9be6f4c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.create.1.json@@ -0,0 +1,174 @@+{+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.finalize_invoice.1.jsonnew file mode 100644index 00000000000..b905f34fdb1--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.finalize_invoice.1.json@@ -0,0 +1,174 @@+{+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002vf9UM",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002vf9UM/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.list.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.list.1.jsonnew file mode 100644index 00000000000..e39960ab725--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--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_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.list.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.list.2.jsonnew file mode 100644index 00000000000..e39960ab725--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.list.2.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.list.3.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.list.3.jsonnew file mode 100644index 00000000000..e39960ab725--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.list.3.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.list.4.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.list.4.jsonnew file mode 100644index 00000000000..08bd5171ce5--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--Invoice.list.4.json@@ -0,0 +1,181 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002vf9UM",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002vf9UM/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000004",+ "invoice_item": "ii_NORMALIZED00000000000004",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--InvoiceItem.create.1.jsonnew file mode 100644index 00000000000..799c067780d--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--InvoiceItem.create.1.json@@ -0,0 +1,45 @@+{+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000004",+ "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",+ "id": "price_NORMALIZED00000000000004",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0004",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--InvoiceItem.create.2.jsonnew file mode 100644index 00000000000..66480143c6d--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--InvoiceItem.create.2.json@@ -0,0 +1,45 @@+{+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--InvoiceItem.list.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--InvoiceItem.list.1.jsonnew file mode 100644index 00000000000..3190cda6f9c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--InvoiceItem.list.1.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoiceitems"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..8803595dc72--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.confirm.1.json@@ -0,0 +1,577 @@+{+ "_message": "Your card was declined.",+ "code": "card_declined",+ "error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "param": null,+ "payment_intent": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "refunded": false,+ "refunds": {},+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "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_xVxt33T2UJomjdIlY6iKdiBvU",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ },+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "setup_intent": null,+ "source": null,+ "type": "card_error"+ },+ "headers": {+ "Connection": "keep-alive",+ "Content-Length": "8679",+ "Content-Type": "application/json",+ "Date": "NORMALIZED DATETIME",+ "Server": "nginx",+ "Strict-Transport-Security": "max-age=31556926; includeSubDomains; preload",+ "access-control-allow-credentials": "true",+ "access-control-allow-methods": "GET, POST, HEAD, OPTIONS, DELETE",+ "access-control-allow-origin": "*",+ "access-control-expose-headers": "Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required",+ "access-control-max-age": "300",+ "cache-control": "no-cache, no-store",+ "idempotency-key": "00000000-0000-0000-0000-000000000000",+ "original-request": "req_NORMALIZED0002",+ "request-id": "req_NORMALIZED0002",+ "stripe-should-retry": "false",+ "stripe-version": "2020-08-27",+ "x-stripe-c-cost": "6"+ },+ "http_body": "{\n \"error\": {\n \"charge\": \"ch_NORMALIZED00000000000001\",\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"payment_intent\": {\n \"id\": \"pi_NORMALIZED00000000000001\",\n \"object\": \"payment_intent\",\n \"amount\": 48000,\n \"amount_capturable\": 0,\n \"amount_received\": 0,\n \"application\": null,\n \"application_fee_amount\": null,\n \"canceled_at\": null,\n \"cancellation_reason\": null,\n \"capture_method\": \"automatic\",\n \"charges\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ch_NORMALIZED00000000000001\",\n \"object\": \"charge\",\n \"amount\": 48000,\n \"amount_captured\": 0,\n \"amount_refunded\": 0,\n \"application\": null,\n \"application_fee\": null,\n \"application_fee_amount\": null,\n \"balance_transaction\": null,\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"calculated_statement_descriptor\": \"ZULIP STANDARD\",\n \"captured\": false,\n \"created\": 1000000000,\n \"currency\": \"usd\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"description\": \"Upgrade to Zulip Standard, $80.0 x 6\",\n \"destination\": null,\n \"dispute\": null,\n \"disputed\": false,\n \"failure_code\": \"card_declined\",\n \"failure_message\": \"Your card was declined.\",\n \"fraud_details\": {\n },\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {\n \"billing_modality\": \"charge_automatically\",\n \"billing_schedule\": \"1\",\n \"licenses\": \"6\",\n \"license_management\": \"automatic\",\n \"price_per_license\": \"8000\",\n \"seat_count\": \"6\",\n \"type\": \"upgrade\",\n \"user_email\": \"[email protected]\",\n \"realm_str\": \"zulip\"\n },\n \"on_behalf_of\": null,\n \"order\": null,\n \"outcome\": {\n \"network_status\": \"declined_by_network\",\n \"reason\": \"generic_decline\",\n \"risk_level\": \"normal\",\n \"risk_score\": 3,\n \"seller_message\": \"The bank did not return any further details with this decline.\",\n \"type\": \"issuer_declined\"\n },\n \"paid\": false,\n \"payment_intent\": \"pi_NORMALIZED00000000000001\",\n \"payment_method\": \"pm_1JTqAOA4KHR4JzRvKUkGvxS0\",\n \"payment_method_details\": {\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000001\",\n \"funding\": \"credit\",\n \"installments\": null,\n \"last4\": \"0341\",\n \"network\": \"visa\",\n \"three_d_secure\": null,\n \"wallet\": null\n },\n \"type\": \"card\"\n },\n \"receipt_email\": \"[email protected]\",\n \"receipt_number\": null,\n \"receipt_url\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [\n\n ],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_NORMALIZED00000000000001/refunds\"\n },\n \"review\": null,\n \"shipping\": null,\n \"source\": null,\n \"source_transfer\": null,\n \"statement_descriptor\": \"Zulip Standard\",\n \"statement_descriptor_suffix\": null,\n \"status\": \"failed\",\n \"transfer_data\": null,\n \"transfer_group\": null\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/charges?payment_intent=pi_NORMALIZED00000000000001\"\n },\n \"client_secret\": \"pi_NORMALIZED00000000000001_secret_xVxt33T2UJomjdIlY6iKdiBvU\",\n \"confirmation_method\": \"automatic\",\n \"created\": 1000000000,\n \"currency\": \"usd\",\n \"customer\": \"cus_NORMALIZED0001\",\n \"description\": \"Upgrade to Zulip Standard, $80.0 x 6\",\n \"invoice\": null,\n \"last_payment_error\": {\n \"charge\": \"ch_NORMALIZED00000000000001\",\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"payment_method\": {\n \"id\": \"pm_1JTqAOA4KHR4JzRvKUkGvxS0\",\n \"object\": \"payment_method\",\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000001\",\n \"funding\": \"credit\",\n \"generated_from\": null,\n \"last4\": \"0341\",\n \"networks\": {\n \"available\": [\n \"visa\"\n ],\n \"preferred\": null\n },\n \"three_d_secure_usage\": {\n \"supported\": true\n },\n \"wallet\": null\n },\n \"created\": 1000000000,\n \"customer\": \"cus_NORMALIZED0001\",\n \"livemode\": false,\n \"metadata\": {\n },\n \"type\": \"card\"\n },\n \"type\": \"card_error\"\n },\n \"livemode\": false,\n \"metadata\": {\n \"billing_modality\": \"charge_automatically\",\n \"billing_schedule\": \"1\",\n \"licenses\": \"6\",\n \"license_management\": \"automatic\",\n \"price_per_license\": \"8000\",\n \"seat_count\": \"6\",\n \"type\": \"upgrade\",\n \"user_email\": \"[email protected]\",\n \"realm_str\": \"zulip\"\n },\n \"next_action\": null,\n \"on_behalf_of\": null,\n \"payment_method\": null,\n \"payment_method_options\": {\n \"card\": {\n \"installments\": null,\n \"network\": null,\n \"request_three_d_secure\": \"automatic\"\n }\n },\n \"payment_method_types\": [\n \"card\"\n ],\n \"receipt_email\": \"[email protected]\",\n \"review\": null,\n \"setup_future_usage\": null,\n \"shipping\": null,\n \"source\": null,\n \"statement_descriptor\": \"Zulip Standard\",\n \"statement_descriptor_suffix\": null,\n \"status\": \"requires_payment_method\",\n \"transfer_data\": null,\n \"transfer_group\": null\n },\n \"payment_method\": {\n \"id\": \"pm_1JTqAOA4KHR4JzRvKUkGvxS0\",\n \"object\": \"payment_method\",\n \"billing_details\": {\n \"address\": {\n \"city\": null,\n \"country\": null,\n \"line1\": null,\n \"line2\": null,\n \"postal_code\": null,\n \"state\": null\n },\n \"email\": null,\n \"name\": null,\n \"phone\": null\n },\n \"card\": {\n \"brand\": \"visa\",\n \"checks\": {\n \"address_line1_check\": null,\n \"address_postal_code_check\": null,\n \"cvc_check\": \"pass\"\n },\n \"country\": \"US\",\n \"exp_month\": 3,\n \"exp_year\": 2033,\n \"fingerprint\": \"NORMALIZED000001\",\n \"funding\": \"credit\",\n \"generated_from\": null,\n \"last4\": \"0341\",\n \"networks\": {\n \"available\": [\n \"visa\"\n ],\n \"preferred\": null\n },\n \"three_d_secure_usage\": {\n \"supported\": true\n },\n \"wallet\": null\n },\n \"created\": 1000000000,\n \"customer\": \"cus_NORMALIZED0001\",\n \"livemode\": false,\n \"metadata\": {\n },\n \"type\": \"card\"\n },\n \"type\": \"card_error\"\n }\n}\n",+ "http_status": 402,+ "json_body": {+ "error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "payment_intent": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "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_xVxt33T2UJomjdIlY6iKdiBvU",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ },+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ }+ },+ "param": null,+ "request_id": "req_NORMALIZED0002"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.confirm.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.confirm.2.jsonnew file mode 100644index 00000000000..e693d46f112--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.confirm.2.json@@ -0,0 +1,166 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTqAdA4KHR4JzRvkF8mCZXf",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000001",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ ],+ "has_more": true,+ "object": "list",+ "total_count": 2,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_xVxt33T2UJomjdIlY6iKdiBvU",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAdA4KHR4JzRvkF8mCZXf",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..f9aeba2a0a3--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_xVxt33T2UJomjdIlY6iKdiBvU",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.retrieve.1.jsonnew file mode 100644index 00000000000..58f4fb4d63f--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.retrieve.1.json@@ -0,0 +1,220 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 0,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": null,+ "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 STANDARD",+ "captured": false,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": "card_declined",+ "failure_message": "Your card was declined.",+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "declined_by_network",+ "reason": "generic_decline",+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "The bank did not return any further details with this decline.",+ "type": "issuer_declined"+ },+ "paid": false,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "0341",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": null,+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "failed",+ "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_xVxt33T2UJomjdIlY6iKdiBvU",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": {+ "charge": "ch_NORMALIZED00000000000001",+ "code": "card_declined",+ "decline_code": "generic_decline",+ "doc_url": "https://stripe.com/docs/error-codes/card-declined",+ "message": "Your card was declined.",+ "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": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "id": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "type": "card_error"+ },+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.retrieve.2.jsonnew file mode 100644index 00000000000..e693d46f112--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentIntent.retrieve.2.json@@ -0,0 +1,166 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTqAdA4KHR4JzRvkF8mCZXf",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000001",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ ],+ "has_more": true,+ "object": "list",+ "total_count": 2,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_xVxt33T2UJomjdIlY6iKdiBvU",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAdA4KHR4JzRvkF8mCZXf",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..04179f30800--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "generated_from": null,+ "last4": "0341",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentMethod.create.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentMethod.create.2.jsonnew file mode 100644index 00000000000..a2116c9e272--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--PaymentMethod.create.2.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000002",+ "funding": "credit",+ "generated_from": null,+ "last4": "4242",+ "networks": {+ "available": [+ "visa"+ ],+ "preferred": null+ },+ "three_d_secure_usage": {+ "supported": true+ },+ "wallet": null+ },+ "created": 1000000000,+ "customer": null,+ "id": "pm_1JTqAdA4KHR4JzRvkF8mCZXf",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..45829082f1c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqASA4KHR4JzRvqm7jOHpq_secret_K86NHRwV2W6TnxZVcnQxdTE3JWsy8J5",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqASA4KHR4JzRvqm7jOHpq",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqASA4KHR4JzRvlyad8fKz",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "payment_method_options": {+ "card": {+ "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_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.create.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.create.2.jsonnew file mode 100644index 00000000000..3c53586f23a--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.create.2.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAeA4KHR4JzRvwvsjxBOb_secret_K86NUkPVA7e7fEiqm9ow0FviRNNSpzb",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAeA4KHR4JzRvwvsjxBOb",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqAfA4KHR4JzRvctBUYVVz",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAdA4KHR4JzRvkF8mCZXf",+ "payment_method_options": {+ "card": {+ "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_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..717370020a4--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqARA4KHR4JzRvEiCwWXHQ_secret_K86NaB1GVexw8WmDIhr22u6zv68TX2I",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqARA4KHR4JzRvEiCwWXHQ",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.list.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.list.2.jsonnew file mode 100644index 00000000000..2be0a6a258f--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.list.2.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAdA4KHR4JzRvMroBt0xJ_secret_K86Nzlf1Sl1Kniu2RtCkmsWlngvE1wx",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAdA4KHR4JzRvMroBt0xJ",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..45829082f1c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqASA4KHR4JzRvqm7jOHpq_secret_K86NHRwV2W6TnxZVcnQxdTE3JWsy8J5",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqASA4KHR4JzRvqm7jOHpq",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqASA4KHR4JzRvlyad8fKz",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAOA4KHR4JzRvKUkGvxS0",+ "payment_method_options": {+ "card": {+ "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_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.retrieve.2.jsonnew file mode 100644index 00000000000..3c53586f23a--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--SetupIntent.retrieve.2.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAeA4KHR4JzRvwvsjxBOb_secret_K86NUkPVA7e7fEiqm9ow0FviRNNSpzb",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAeA4KHR4JzRvwvsjxBOb",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqAfA4KHR4JzRvctBUYVVz",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAdA4KHR4JzRvkF8mCZXf",+ "payment_method_options": {+ "card": {+ "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_first_card_fails_and_retry_with_another_card_without_starting_from_begining--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..234a8e3cdb0--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01hHHzCTGnDkfrUaQiJDalTjiNm7a9wDJ4hBmElWBkRrtUbn",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTqARA4KHR4JzRvEiCwWXHQ",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01hHHzCTGnDkfrUaQiJDalTjiNm7a9wDJ4hBmElWBkRrtUbn#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--checkout.Session.create.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--checkout.Session.create.2.jsonnew file mode 100644index 00000000000..0cc3b4722d5--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--checkout.Session.create.2.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED02kXXkSyMFxvqDPTAo2Kz6FxNRId8FZNUKgYivvTLGc7JrH3",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTqAdA4KHR4JzRvMroBt0xJ",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED02kXXkSyMFxvqDPTAo2Kz6FxNRId8FZNUKgYivvTLGc7JrH3#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..c86f64bbd1d--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01hHHzCTGnDkfrUaQiJDalTjiNm7a9wDJ4hBmElWBkRrtUbn",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTqARA4KHR4JzRvEiCwWXHQ",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01hHHzCTGnDkfrUaQiJDalTjiNm7a9wDJ4hBmElWBkRrtUbn#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--checkout.Session.list.2.json b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--checkout.Session.list.2.jsonnew file mode 100644index 00000000000..3f0254081b0--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining--checkout.Session.list.2.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED02kXXkSyMFxvqDPTAo2Kz6FxNRId8FZNUKgYivvTLGc7JrH3",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTqAdA4KHR4JzRvMroBt0xJ",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED02kXXkSyMFxvqDPTAo2Kz6FxNRId8FZNUKgYivvTLGc7JrH3#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.create.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.create.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.create.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.modify.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.modify.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.modify.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.modify.2.jsonnew file mode 100644index 00000000000..87bdfa24cfe--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.retrieve.1.jsonnew file mode 100644index 00000000000..730ed973b02--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.retrieve.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.retrieve.2.jsonnew file mode 100644index 00000000000..5da87fd7749--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.retrieve.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 2,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.retrieve.3.jsonnew file mode 100644index 00000000000..aac9864b73e--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Customer.retrieve.3.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": -48000,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 3,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.1.jsonnew file mode 100644index 00000000000..ccc4f0bec35--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.1.json@@ -0,0 +1,61 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAsA4KHR4JzRv5WaDLerO_secret_K86Nbkg8OadCoA80Cap51BApJUDcMX9",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAsA4KHR4JzRv5WaDLerO",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqAtA4KHR4JzRvZ8u0ihQ0",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "ca5b53d9-8c11-4d52-a92f-8a93f09bc5d9"+ },+ "type": "setup_intent.created"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.2.jsonnew file mode 100644index 00000000000..085e9c63b66--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.2.json@@ -0,0 +1,657 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTqAwA4KHR4JzRv62brIeAG",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_AeSEGKvy4ijB7Tok7YgArl3LN",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqAvA4KHR4JzRv1YAtr1ER",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "f30dfdcf-8892-4c30-9f26-cf4062bf31a9"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTqAwA4KHR4JzRv62brIeAG",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqAvA4KHR4JzRv1cgG8VJP",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "f30dfdcf-8892-4c30-9f26-cf4062bf31a9"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1JTqB0A4KHR4JzRvJGf2Piq8",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "c500f266-7a1a-490b-a692-ddda8eb8a905"+ },+ "type": "customer.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAyA4KHR4JzRvqLH0Hs1j_secret_K86N4ayt1CzrPlD8RgtvVeFPbqnpNtd",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAyA4KHR4JzRvqLH0Hs1j",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqAyA4KHR4JzRvGJwV77sx",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqAyA4KHR4JzRvnZHTTXpC",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "74d6cc75-58c6-418c-a8e0-e7eb6efd1d51"+ },+ "type": "setup_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "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": 3,+ "exp_year": 2033,+ "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_1JTqAwA4KHR4JzRv62brIeAG",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ }+ },+ "id": "evt_1JTqAyA4KHR4JzRvnh0Id4A0",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "74d6cc75-58c6-418c-a8e0-e7eb6efd1d51"+ },+ "type": "payment_method.attached"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAyA4KHR4JzRvqLH0Hs1j_secret_K86N4ayt1CzrPlD8RgtvVeFPbqnpNtd",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAyA4KHR4JzRvqLH0Hs1j",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqAyA4KHR4JzRvGJwV77sx",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqAyA4KHR4JzRvWRV1KuaR",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "74d6cc75-58c6-418c-a8e0-e7eb6efd1d51"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAwA4KHR4JzRv9eQGrdUG_secret_K86NSzdwSqNYZ6eaeGgcBaZv9jhyRVL",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAwA4KHR4JzRv9eQGrdUG",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ },+ "id": "evt_1JTqAwA4KHR4JzRvQ5zLQSTN",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "84619585-8821-4c23-9678-22f776132fcb"+ },+ "type": "setup_intent.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_AeSEGKvy4ijB7Tok7YgArl3LN",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqAvA4KHR4JzRv1vQKGSWy",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "043cd7e1-a797-42d0-90d9-3d0a57ca01c0"+ },+ "type": "payment_intent.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.3.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.3.jsonnew file mode 100644index 00000000000..be8450b0df6--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.3.json@@ -0,0 +1,1261 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001ucfEK",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001ucfEK/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqB7A4KHR4JzRvYOZZQPGd",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "52d5fb64-6ed5-4d2e-b888-02e162e0258f"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001ucfEK",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001ucfEK/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqB6A4KHR4JzRvrrlImUF4",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "52d5fb64-6ed5-4d2e-b888-02e162e0258f"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001ucfEK",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001ucfEK/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqB6A4KHR4JzRvEKEA8sNx",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "52d5fb64-6ed5-4d2e-b888-02e162e0258f"+ },+ "type": "invoice.finalized"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001ucfEK",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001ucfEK/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1JTqB6A4KHR4JzRvo8tcYr8v",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "52d5fb64-6ed5-4d2e-b888-02e162e0258f"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1JTqB5A4KHR4JzRvDpjnAcKF",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "d2e10fd6-f540-4eaa-8a9c-12b1c99e52fc"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "invoice": "in_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTqB5A4KHR4JzRvrMxUADH8",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "d2e10fd6-f540-4eaa-8a9c-12b1c99e52fc"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000001",+ "invoice": "in_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ },+ "previous_attributes": {+ "invoice": null+ }+ },+ "id": "evt_1JTqB5A4KHR4JzRvU0cu2e0e",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0008",+ "idempotency_key": "d2e10fd6-f540-4eaa-8a9c-12b1c99e52fc"+ },+ "type": "invoiceitem.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+ }+ },+ "id": "evt_1JTqB4A4KHR4JzRvZv7nGsH7",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0009",+ "idempotency_key": "356f4a3a-643d-4979-9a52-bcef000c7bf2"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+ }+ },+ "id": "evt_1JTqB4A4KHR4JzRvw7M5lda0",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "7ae296b3-2082-492b-b4eb-cfeb84e16740"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+ },+ "previous_attributes": {+ "currency": null+ }+ },+ "id": "evt_1JTqB3A4KHR4JzRvPDxgFPiP",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 1,+ "request": {+ "id": "req_NORMALIZED0010",+ "idempotency_key": "7ae296b3-2082-492b-b4eb-cfeb84e16740"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.4.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.4.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.4.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.5.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.5.jsonnew file mode 100644index 00000000000..eed4c7b4787--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Event.list.5.json@@ -0,0 +1,188 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": "txn_NORMALIZED00000000000002",+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTqB8A4KHR4JzRvvUaVtSb8",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000002",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_8oYf3bkYGiYpa3EtjUw0vZDSt",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqB8A4KHR4JzRvvUaVtSb8",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3JTqAsA4KHR4JzRv14ZKkCeA",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0011",+ "idempotency_key": "6253822f-3b11-4493-a54f-6c9bc7cc8b32"+ },+ "type": "payment_intent.succeeded"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.create.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.create.1.jsonnew file mode 100644index 00000000000..50e46ccd0d4--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.create.1.json@@ -0,0 +1,174 @@+{+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.create.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.create.2.jsonnew file mode 100644index 00000000000..8c5fef6daaa--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.create.2.json@@ -0,0 +1,130 @@+{+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": null,+ "footer": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": -48000,+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard Credit",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": -48000,+ "tax": null,+ "total": -48000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.finalize_invoice.1.jsonnew file mode 100644index 00000000000..8139089194a--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.finalize_invoice.1.json@@ -0,0 +1,174 @@+{+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001ucfEK",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001ucfEK/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.finalize_invoice.2.jsonnew file mode 100644index 00000000000..2119e00995c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.finalize_invoice.2.json@@ -0,0 +1,130 @@+{+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": -48000,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002BjX1f",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002BjX1f/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": -48000,+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard Credit",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": -48000,+ "tax": null,+ "total": -48000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.list.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.list.1.jsonnew file mode 100644index 00000000000..e39960ab725--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--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_race_condition_during_card_upgrade--Invoice.list.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.list.2.jsonnew file mode 100644index 00000000000..53f69b4b656--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--Invoice.list.2.json@@ -0,0 +1,311 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": -48000,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002BjX1f",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002BjX1f/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": -48000,+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard Credit",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": -48000,+ "tax": null,+ "total": -48000,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ {+ "account_country": "US",+ "account_name": "NORMALIZED-1",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "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,+ "ending_balance": 0,+ "footer": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001ucfEK",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001ucfEK/pdf",+ "last_finalization_error": null,+ "lines": {+ "data": [+ {+ "amount": 48000,+ "currency": "usd",+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ },+ {+ "amount": -48000,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 2,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "payment_intent": null,+ "payment_settings": {+ "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,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Standard",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subtotal": 0,+ "tax": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--InvoiceItem.create.1.jsonnew file mode 100644index 00000000000..8c8ea5a3784--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--InvoiceItem.create.1.json@@ -0,0 +1,45 @@+{+ "amount": -48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--InvoiceItem.create.2.jsonnew file mode 100644index 00000000000..b1663ef4226--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--InvoiceItem.create.2.json@@ -0,0 +1,45 @@+{+ "amount": 48000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Standard",+ "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",+ "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": 8000,+ "unit_amount_decimal": "8000"+ },+ "proration": false,+ "quantity": 6,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": 8000,+ "unit_amount_decimal": "8000"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--InvoiceItem.create.3.jsonnew file mode 100644index 00000000000..3aa8989852b--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--InvoiceItem.create.3.json@@ -0,0 +1,45 @@+{+ "amount": -48000,+ "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",+ "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": -48000,+ "unit_amount_decimal": "-48000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "unit_amount": -48000,+ "unit_amount_decimal": "-48000"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.confirm.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.confirm.1.jsonnew file mode 100644index 00000000000..5562844c0ad--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.confirm.1.json@@ -0,0 +1,166 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "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": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_1JTqAwA4KHR4JzRv62brIeAG",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",+ "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 Standard",+ "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_AeSEGKvy4ijB7Tok7YgArl3LN",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.confirm.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.confirm.2.jsonnew file mode 100644index 00000000000..a8e69943b2f--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.confirm.2.json@@ -0,0 +1,166 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 48000,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 48000,+ "amount_captured": 48000,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": "txn_NORMALIZED00000000000002",+ "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 STANDARD",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "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_NORMALIZED00000000000002",+ "payment_method": "pm_1JTqB8A4KHR4JzRvvUaVtSb8",+ "payment_method_details": {+ "card": {+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "installments": null,+ "last4": "4242",+ "network": "visa",+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000002",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Standard",+ "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_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_8oYf3bkYGiYpa3EtjUw0vZDSt",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqB8A4KHR4JzRvvUaVtSb8",+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..cb8d5dafebc--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.create.1.json@@ -0,0 +1,62 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_8oYf3bkYGiYpa3EtjUw0vZDSt",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.create.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.create.2.jsonnew file mode 100644index 00000000000..f19cd881d63--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.create.2.json@@ -0,0 +1,62 @@+{+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_AeSEGKvy4ijB7Tok7YgArl3LN",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.list.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.list.1.jsonnew file mode 100644index 00000000000..f2b44f23bde--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentIntent.list.1.json@@ -0,0 +1,69 @@+{+ "data": [+ {+ "amount": 48000,+ "amount_capturable": 0,+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000002"+ },+ "client_secret": "pi_NORMALIZED00000000000002_secret_8oYf3bkYGiYpa3EtjUw0vZDSt",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Standard, $80.0 x 6",+ "id": "pi_NORMALIZED00000000000002",+ "invoice": null,+ "last_payment_error": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Standard",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/payment_intents"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentMethod.create.1.jsonnew file mode 100644index 00000000000..bcde06d45d1--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentMethod.create.1.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "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": null,+ "id": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentMethod.create.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentMethod.create.2.jsonnew file mode 100644index 00000000000..f9c1ca53d90--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--PaymentMethod.create.2.json@@ -0,0 +1,47 @@+{+ "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": "unchecked"+ },+ "country": "US",+ "exp_month": 3,+ "exp_year": 2033,+ "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": null,+ "id": "pm_1JTqB8A4KHR4JzRvvUaVtSb8",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..72ab719fe16--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.create.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAyA4KHR4JzRvqLH0Hs1j_secret_K86N4ayt1CzrPlD8RgtvVeFPbqnpNtd",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAyA4KHR4JzRvqLH0Hs1j",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqAyA4KHR4JzRvGJwV77sx",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "payment_method_options": {+ "card": {+ "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_race_condition_during_card_upgrade--SetupIntent.create.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.create.2.jsonnew file mode 100644index 00000000000..02df65ea4a1--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.create.2.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqB9A4KHR4JzRv82aXMr0O_secret_K86NAw9lkvEUrQpMGTKwY26EwU3zDt8",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqB9A4KHR4JzRv82aXMr0O",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqB9A4KHR4JzRv8T9542zs",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqB8A4KHR4JzRvvUaVtSb8",+ "payment_method_options": {+ "card": {+ "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_race_condition_during_card_upgrade--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..3087a006e1a--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.list.1.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAwA4KHR4JzRv9eQGrdUG_secret_K86NSzdwSqNYZ6eaeGgcBaZv9jhyRVL",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAwA4KHR4JzRv9eQGrdUG",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_options": {+ "card": {+ "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_race_condition_during_card_upgrade--SetupIntent.list.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.list.2.jsonnew file mode 100644index 00000000000..ac10c03017e--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.list.2.json@@ -0,0 +1,46 @@+{+ "data": [+ {+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAyA4KHR4JzRvqLH0Hs1j_secret_K86N4ayt1CzrPlD8RgtvVeFPbqnpNtd",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAyA4KHR4JzRvqLH0Hs1j",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqAyA4KHR4JzRvGJwV77sx",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "payment_method_options": {+ "card": {+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/setup_intents"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..72ab719fe16--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.retrieve.1.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqAyA4KHR4JzRvqLH0Hs1j_secret_K86N4ayt1CzrPlD8RgtvVeFPbqnpNtd",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqAyA4KHR4JzRvqLH0Hs1j",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqAyA4KHR4JzRvGJwV77sx",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqAwA4KHR4JzRv62brIeAG",+ "payment_method_options": {+ "card": {+ "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_race_condition_during_card_upgrade--SetupIntent.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.retrieve.2.jsonnew file mode 100644index 00000000000..02df65ea4a1--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--SetupIntent.retrieve.2.json@@ -0,0 +1,39 @@+{+ "application": null,+ "cancellation_reason": null,+ "client_secret": "seti_1JTqB9A4KHR4JzRv82aXMr0O_secret_K86NAw9lkvEUrQpMGTKwY26EwU3zDt8",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "id": "seti_1JTqB9A4KHR4JzRv82aXMr0O",+ "last_setup_error": null,+ "latest_attempt": "setatt_1JTqB9A4KHR4JzRv8T9542zs",+ "livemode": false,+ "mandate": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1JTqB8A4KHR4JzRvvUaVtSb8",+ "payment_method_options": {+ "card": {+ "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_race_condition_during_card_upgrade--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..eda35293407--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--checkout.Session.create.1.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01eXnyHfbDNgs5sFyjrqW1tMAJ7mdjy5PlFOZP5kA0tdrpRQ",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTqAsA4KHR4JzRv5WaDLerO",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01eXnyHfbDNgs5sFyjrqW1tMAJ7mdjy5PlFOZP5kA0tdrpRQ#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--checkout.Session.create.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--checkout.Session.create.2.jsonnew file mode 100644index 00000000000..c2c1f009d9c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--checkout.Session.create.2.json@@ -0,0 +1,46 @@+{+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED02hUQdb2XihYa5LQtgQYMwWw9lVxBlPlAQ8orn7Tl3yAKYCy",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTqAwA4KHR4JzRv9eQGrdUG",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED02hUQdb2XihYa5LQtgQYMwWw9lVxBlPlAQ8orn7Tl3yAKYCy#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..91b4bf9209c--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--checkout.Session.list.1.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED01eXnyHfbDNgs5sFyjrqW1tMAJ7mdjy5PlFOZP5kA0tdrpRQ",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTqAsA4KHR4JzRv5WaDLerO",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED01eXnyHfbDNgs5sFyjrqW1tMAJ7mdjy5PlFOZP5kA0tdrpRQ#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--checkout.Session.list.2.json b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--checkout.Session.list.2.jsonnew file mode 100644index 00000000000..27226d5dfd4--- /dev/null+++ b/corporate/tests/stripe_fixtures/upgrade_race_condition_during_card_upgrade--checkout.Session.list.2.json@@ -0,0 +1,53 @@+{+ "data": [+ {+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://zulip.testserver/upgrade/",+ "client_reference_id": null,+ "currency": null,+ "customer": "cus_NORMALIZED0001",+ "customer_details": null,+ "customer_email": null,+ "id": "cs_test_NORMALIZED02hUQdb2XihYa5LQtgQYMwWw9lVxBlPlAQ8orn7Tl3yAKYCy",+ "livemode": false,+ "locale": null,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "1",+ "license_management": "automatic",+ "licenses": "6",+ "price_per_license": "8000",+ "realm_str": "zulip",+ "seat_count": "6",+ "type": "upgrade",+ "user_email": "[email protected]"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "setup_intent": "seti_1JTqAwA4KHR4JzRv9eQGrdUG",+ "shipping": null,+ "shipping_address_collection": null,+ "submit_type": null,+ "subscription": null,+ "success_url": "http://zulip.testserver/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "url": "https://checkout.stripe.com/pay/cs_test_NORMALIZED02hUQdb2XihYa5LQtgQYMwWw9lVxBlPlAQ8orn7Tl3yAKYCy#fidkdWxOYHwnPyd1blpxYHZxWjA0T0NCb2ZEMU5NVzFPf1dzRlZLQXBfNm9%2FUm9kXGcydWZXamJSYV9MMjdWPUBwdTdQXzVQbWFfdGl8dUB8YWRRSFFrRnI8VlFVTVF9UTNXUVJoVzNAf2hKNTVmdnxiaDZ3QicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBaZmppcGhrJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Charge.create.1.json b/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Charge.create.1.jsondeleted file mode 100644index 650347743e1..00000000000--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Charge.create.1.json+++ /dev/null@@ -1,51 +0,0 @@-{- "_message": "Your card was declined.",- "code": "card_declined",- "error": {- "charge": "ch_NORMALIZED00000000000001",- "code": "card_declined",- "decline_code": "generic_decline",- "doc_url": "https://stripe.com/docs/error-codes/card-declined",- "message": "Your card was declined.",- "param": null,- "payment_intent": null,- "payment_method": null,- "setup_intent": null,- "source": null,- "type": "card_error"- },- "headers": {- "Connection": "keep-alive",- "Content-Length": "269",- "Content-Type": "application/json",- "Date": "NORMALIZED DATETIME",- "Server": "nginx",- "Strict-Transport-Security": "max-age=31556926; includeSubDomains; preload",- "access-control-allow-credentials": "true",- "access-control-allow-methods": "GET, POST, HEAD, OPTIONS, DELETE",- "access-control-allow-origin": "*",- "access-control-expose-headers": "Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required",- "access-control-max-age": "300",- "cache-control": "no-cache, no-store",- "idempotency-key": "00000000-0000-0000-0000-000000000000",- "original-request": "req_NORMALIZED0001",- "request-id": "req_NORMALIZED0001",- "stripe-should-retry": "false",- "stripe-version": "2020-08-27",- "x-stripe-c-cost": "6"- },- "http_body": "{\n \"error\": {\n \"charge\": \"ch_NORMALIZED00000000000001\",\n \"code\": \"card_declined\",\n \"decline_code\": \"generic_decline\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"type\": \"card_error\"\n }\n}\n",- "http_status": 402,- "json_body": {- "error": {- "charge": "ch_NORMALIZED00000000000001",- "code": "card_declined",- "decline_code": "generic_decline",- "doc_url": "https://stripe.com/docs/error-codes/card-declined",- "message": "Your card was declined.",- "type": "card_error"- }- },- "param": null,- "request_id": "req_NORMALIZED0001"-}diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Charge.create.2.json b/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Charge.create.2.jsondeleted file mode 100644index e804e1f8fda..00000000000--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Charge.create.2.json+++ /dev/null@@ -1,117 +0,0 @@-{- "amount": 184000,- "amount_captured": 184000,- "amount_refunded": 0,- "application": null,- "application_fee": null,- "application_fee_amount": null,- "balance_transaction": "txn_NORMALIZED00000000000001",- "billing_details": {- "address": {- "city": "Pacific",- "country": "United States",- "line1": "Under the sea,",- "line2": null,- "postal_code": "33333",- "state": null- },- "email": null,- "name": "Ada Starr",- "phone": null- },- "calculated_statement_descriptor": "STRIPE* ZULIP STANDARD",- "captured": true,- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "description": "Upgrade to Zulip Standard, $80.0 x 23",- "destination": null,- "dispute": null,- "disputed": false,- "failure_code": null,- "failure_message": null,- "fraud_details": {},- "id": "ch_NORMALIZED00000000000002",- "invoice": null,- "livemode": false,- "metadata": {},- "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": null,- "payment_method": "card_NORMALIZED00000000000001",- "payment_method_details": {- "card": {- "brand": "visa",- "checks": {- "address_line1_check": "pass",- "address_postal_code_check": "pass",- "cvc_check": "pass"- },- "country": "US",- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "installments": null,- "last4": "4242",- "network": "visa",- "three_d_secure": null,- "wallet": null- },- "type": "card"- },- "receipt_email": "[email protected]",- "receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000001",- "refunded": false,- "refunds": {- "data": [],- "has_more": false,- "object": "list",- "total_count": 0,- "url": "/v1/charges/ch_NORMALIZED00000000000002/refunds"- },- "review": null,- "shipping": null,- "source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "source_transfer": null,- "statement_descriptor": "Zulip Standard",- "statement_descriptor_suffix": "Zulip Standard",- "status": "succeeded",- "transfer_data": null,- "transfer_group": null-}diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Customer.retrieve.1.jsondeleted file mode 100644index ea9d4a470e6..00000000000--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Customer.retrieve.1.json+++ /dev/null@@ -1,87 +0,0 @@-{- "address": null,- "balance": 0,- "created": 1000000000,- "currency": null,- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "delinquent": false,- "description": "zulip (Zulip Dev)",- "discount": null,- "email": "[email protected]",- "id": "cus_NORMALIZED0001",- "invoice_prefix": "NORMA01",- "invoice_settings": {- "custom_fields": null,- "default_payment_method": null,- "footer": null- },- "livemode": false,- "metadata": {- "realm_id": "1",- "realm_str": "zulip"- },- "name": null,- "next_invoice_sequence": 1,- "object": "customer",- "phone": null,- "preferred_locales": [],- "shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },- "tax_exempt": "none"-}diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Customer.retrieve.2.jsondeleted file mode 100644index ea9d4a470e6..00000000000--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Customer.retrieve.2.json+++ /dev/null@@ -1,87 +0,0 @@-{- "address": null,- "balance": 0,- "created": 1000000000,- "currency": null,- "default_source": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "delinquent": false,- "description": "zulip (Zulip Dev)",- "discount": null,- "email": "[email protected]",- "id": "cus_NORMALIZED0001",- "invoice_prefix": "NORMA01",- "invoice_settings": {- "custom_fields": null,- "default_payment_method": null,- "footer": null- },- "livemode": false,- "metadata": {- "realm_id": "1",- "realm_str": "zulip"- },- "name": null,- "next_invoice_sequence": 1,- "object": "customer",- "phone": null,- "preferred_locales": [],- "shipping": null,- "sources": {- "data": [- {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "pass",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "pass",- "brand": "Visa",- "country": "US",- "customer": "cus_NORMALIZED0001",- "cvc_check": "pass",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- }- ],- "has_more": false,- "object": "list",- "total_count": 1,- "url": "/v1/customers/cus_NORMALIZED0001/sources"- },- "tax_exempt": "none"-}diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Token.create.1.json b/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Token.create.1.jsondeleted file mode 100644index 31a829cefe4..00000000000--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Token.create.1.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000002",- "funding": "credit",- "id": "card_NORMALIZED00000000000002",- "last4": "0341",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1000000000,- "id": "tok_NORMALIZED00000000000001",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Token.create.2.json b/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Token.create.2.jsondeleted file mode 100644index 762a023c64c..00000000000--- a/corporate/tests/stripe_fixtures/upgrade_where_first_card_fails--Token.create.2.json+++ /dev/null@@ -1,33 +0,0 @@-{- "card": {- "address_city": "Pacific",- "address_country": "United States",- "address_line1": "Under the sea,",- "address_line1_check": "unchecked",- "address_line2": null,- "address_state": null,- "address_zip": "33333",- "address_zip_check": "unchecked",- "brand": "Visa",- "country": "US",- "cvc_check": "unchecked",- "dynamic_last4": null,- "exp_month": 3,- "exp_year": 2033,- "fingerprint": "NORMALIZED000001",- "funding": "credit",- "id": "card_NORMALIZED00000000000001",- "last4": "4242",- "metadata": {},- "name": "Ada Starr",- "object": "card",- "tokenization_method": null- },- "client_ip": "0.0.0.0",- "created": 1000000000,- "id": "tok_NORMALIZED00000000000002",- "livemode": false,- "object": "token",- "type": "card",- "used": false-}diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--Customer.modify.1.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--Customer.modify.1.jsonnew file mode 100644index 00000000000..276fd1f723d--- /dev/null+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--Customer.modify.1.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "zulip (Zulip Dev)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "1",+ "realm_str": "zulip"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--Customer.modify.2.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--Customer.modify.2.jsonnew file mode 100644index 00000000000..c3568a69d35--- /dev/null+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--Customer.modify.2.json@@ -0,0 +1,30 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "lear (Lear & Co.)",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0002",+ "invoice_prefix": "NORMA02",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null+ },+ "livemode": false,+ "metadata": {+ "realm_id": "2",+ "realm_str": "lear"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none"+}diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.create.1.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.create.1.jsonindex 50fa54e261e..ec12d7bd23a 100644--- a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.create.1.json+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.create.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 6400,"amount_paid": 0,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.create.2.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.create.2.jsonindex cc6fed629ab..f36e15d7c6b 100644--- a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.create.2.json+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.create.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 6400,"amount_paid": 0,@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.finalize_invoice.1.jsonindex 031ec95514b..aa4b9d6d3fd 100644--- a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.finalize_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 6400,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001pYxjh",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001OUZwi","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001pYxjh/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001OUZwi/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.finalize_invoice.2.jsonindex aee3bfc5c3c..1e8577387d4 100644--- a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.finalize_invoice.2.json+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.finalize_invoice.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 6400,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HMmgm",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002dM54C","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HMmgm/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002dM54C/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",@@ -125,5 +126,5 @@"total_discount_amounts": [],"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.1.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.1.jsonindex 8e3e6a039e7..3082a5de398 100644--- a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.1.json+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.1.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 6400,"amount_paid": 0,@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001pYxjh",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001OUZwi","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001pYxjh/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001OUZwi/pdf","last_finalization_error": null,"lines": {"data": [@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.3.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.3.jsonindex 3df5bb58ec2..bf733419743 100644--- a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.3.json+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.3.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 6400,"amount_paid": 0,@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001pYxjh",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001OUZwi","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001pYxjh/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001OUZwi/pdf","last_finalization_error": null,"lines": {"data": [@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.4.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.4.jsonindex f184b521cab..0b79c11913c 100644--- a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.4.json+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.4.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 6400,"amount_paid": 0,@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HMmgm",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002dM54C","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HMmgm/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002dM54C/pdf","last_finalization_error": null,"lines": {"data": [@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.6.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.6.jsonindex e68d8846c61..6cff5c48766 100644--- a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.6.json+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.list.6.json@@ -2,7 +2,7 @@"data": [{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 6400,"amount_paid": 0,@@ -38,9 +38,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HMmgm",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002dM54C","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HMmgm/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002dM54C/pdf","last_finalization_error": null,"lines": {"data": [@@ -74,6 +74,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.void_invoice.1.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.void_invoice.1.jsonindex 40556099986..4b03f5ceab1 100644--- a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.void_invoice.1.json+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.void_invoice.1.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 6400,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001pYxjh",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001OUZwi","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001pYxjh/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000001OUZwi/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.void_invoice.2.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.void_invoice.2.jsonindex d08bc172ac2..32c4eb6438b 100644--- a/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.void_invoice.2.json+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--Invoice.void_invoice.2.json@@ -1,6 +1,6 @@{"account_country": "US",- "account_name": null,+ "account_name": "NORMALIZED-1","account_tax_ids": null,"amount_due": 6400,"amount_paid": 0,@@ -36,9 +36,9 @@"due_date": 1000000000,"ending_balance": 0,"footer": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HMmgm",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002dM54C","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002HMmgm/pdf",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/invst_NORMALIZED0000000000000002dM54C/pdf","last_finalization_error": null,"lines": {"data": [@@ -72,6 +72,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--InvoiceItem.create.1.jsonindex 2c843d7a5b7..2e643034b5c 100644--- a/corporate/tests/stripe_fixtures/void_all_open_invoices--InvoiceItem.create.1.json+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--InvoiceItem.create.1.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0001","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/stripe_fixtures/void_all_open_invoices--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/void_all_open_invoices--InvoiceItem.create.2.jsonindex 983ea58d3c2..fd9989403b8 100644--- a/corporate/tests/stripe_fixtures/void_all_open_invoices--InvoiceItem.create.2.json+++ b/corporate/tests/stripe_fixtures/void_all_open_invoices--InvoiceItem.create.2.json@@ -29,6 +29,7 @@"object": "price","product": "prod_NORMALIZED0002","recurring": null,+ "tax_behavior": "unspecified","tiers_mode": null,"transform_quantity": null,"type": "one_time",diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.pyindex 4163a9d284d..a55bfa86e35 100644--- a/corporate/tests/test_stripe.py+++ b/corporate/tests/test_stripe.py@@ -8,19 +8,7 @@ from dataclasses import dataclassfrom datetime import datetime, timedelta, timezonefrom decimal import Decimalfrom functools import wraps-from typing import (- Any,- Callable,- Dict,- List,- Mapping,- Optional,- Sequence,- Tuple,- TypeVar,- Union,- cast,-)+from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Tuple, TypeVar, castfrom unittest.mock import Mock, patchimport orjson@@ -30,6 +18,7 @@ from django.conf import settingsfrom django.core import signingfrom django.http import HttpResponsefrom django.urls.resolvers import get_resolver+from django.utils.crypto import get_random_stringfrom django.utils.timezone import now as timezone_nowfrom corporate.lib.stripe import (@@ -45,7 +34,7 @@ from corporate.lib.stripe import (attach_discount_to_realm,catch_stripe_errors,compute_plan_parameters,- customer_has_credit_card_as_default_source,+ customer_has_credit_card_as_default_payment_method,do_create_stripe_customer,downgrade_small_realms_behind_on_payments_as_needed,get_discount_for_realm,@@ -55,13 +44,14 @@ from corporate.lib.stripe import (get_realms_to_default_discount_dict,invoice_plan,invoice_plans_as_needed,+ is_free_trial_offer_enabled,is_realm_on_free_trial,is_sponsored_realm,make_end_of_cycle_updates_if_needed,next_month,process_initial_upgrade,sign_string,- stripe_customer_has_credit_card_as_default_source,+ stripe_customer_has_credit_card_as_default_payment_method,stripe_get_customer,switch_realm_from_standard_to_plus_plan,unsign_string,@@ -76,7 +66,10 @@ from corporate.lib.stripe import (from corporate.models import (Customer,CustomerPlan,+ Event,LicenseLedger,+ PaymentIntent,+ Session,ZulipSponsorshipRequest,get_current_plan_by_customer,get_current_plan_by_realm,@@ -108,21 +101,16 @@ CallableT = TypeVar("CallableT", bound=Callable[..., Any])STRIPE_FIXTURES_DIR = "corporate/tests/stripe_fixtures"-# TODO: check that this creates a token similar to what is created by our-# actual Stripe Checkout flows-def stripe_create_token(card_number: str = "4242424242424242") -> stripe.Token:- return stripe.Token.create(++def create_payment_method(card_number: str) -> stripe.PaymentMethod:+ return stripe.PaymentMethod.create(+ type="card",card={"number": card_number,"exp_month": 3,"exp_year": 2033,"cvc": "333",- "name": "Ada Starr",- "address_line1": "Under the sea,",- "address_city": "Pacific",- "address_zip": "33333",- "address_country": "United States",- }+ },)@@ -295,6 +283,8 @@ def normalize_fixture_data(MOCKED_STRIPE_FUNCTION_NAMES = [f"stripe.{name}"for name in [+ "checkout.Session.create",+ "checkout.Session.list","Charge.create","Charge.list","Coupon.create",@@ -303,6 +293,9 @@ MOCKED_STRIPE_FUNCTION_NAMES = ["Customer.list_balance_transactions","Customer.retrieve","Customer.save",+ "Customer.list",+ "Customer.modify",+ "Event.list","Invoice.create","Invoice.finalize_invoice","Invoice.list",@@ -312,8 +305,19 @@ MOCKED_STRIPE_FUNCTION_NAMES = ["Invoice.void_invoice","InvoiceItem.create","InvoiceItem.list",+ "PaymentIntent.confirm",+ "PaymentIntent.create",+ "PaymentIntent.list",+ "PaymentIntent.retrieve",+ "PaymentMethod.attach",+ "PaymentMethod.create",+ "PaymentMethod.detach",+ "PaymentMethod.list","Plan.create","Product.create",+ "SetupIntent.create",+ "SetupIntent.list",+ "SetupIntent.retrieve","Subscription.create","Subscription.delete","Subscription.retrieve",@@ -330,6 +334,8 @@ def mock_stripe(generate_fixture = generateif generate_fixture is None:generate_fixture = settings.GENERATE_STRIPE_FIXTURES+ if generate_fixture: # nocoverage+ assert stripe.api_keyfor mocked_function_name in MOCKED_STRIPE_FUNCTION_NAMES:mocked_function = operator.attrgetter(mocked_function_name)(sys.modules[__name__])if generate_fixture:@@ -339,7 +345,12 @@ def mock_stripe(else:side_effect = read_stripe_fixture(decorated_function.__name__, mocked_function_name)decorated_function = cast(- CallableT, patch(mocked_function_name, side_effect=side_effect)(decorated_function)+ CallableT,+ patch(+ mocked_function_name,+ side_effect=side_effect,+ autospec=mocked_function_name.endswith(".refresh"),+ )(decorated_function),)@wraps(decorated_function)@@ -416,22 +427,121 @@ class StripeTestCase(ZulipTestCase):match = re.search(r"name=\"salt\" value=\"(\w+)\"", response.content.decode())return match.group(1) if match else None+ def get_test_card_number(+ self,+ attaches_to_customer: bool,+ charge_succeeds: Optional[bool] = None,+ card_provider: Optional[str] = None,+ ) -> str:+ if attaches_to_customer:+ assert charge_succeeds is not None+ if charge_succeeds:+ if card_provider == "visa":+ return "4242424242424242"+ if card_provider == "mastercard":+ return "5555555555554444"+ raise AssertionError("Unreachable code path")+ else:+ return "4000000000000341"+ else:+ return "4000000000000002"++ def assert_details_of_valid_session_from_event_status_endpoint(+ self, stripe_session_id: str, expected_details: Dict[str, Any]+ ) -> None:+ json_response = self.client_get(+ "/json/billing/event/status",+ {+ "stripe_session_id": stripe_session_id,+ },+ )+ self.assert_json_success(json_response)+ self.assertEqual(json_response.json()["session"], expected_details)++ def assert_details_of_valid_payment_intent_from_event_status_endpoint(+ self,+ stripe_payment_intent_id: str,+ expected_details: Dict[str, Any],+ ) -> None:+ json_response = self.client_get(+ "/json/billing/event/status",+ {+ "stripe_payment_intent_id": stripe_payment_intent_id,+ },+ )+ self.assert_json_success(json_response)+ self.assertEqual(json_response.json()["payment_intent"], expected_details)++ def trigger_stripe_checkout_session_completed_webhook(+ self,+ payment_method: stripe.PaymentMethod,+ stripe_session: Optional[stripe.checkout.Session] = None,+ ) -> None:+ [checkout_setup_intent] = stripe.SetupIntent.list(limit=1)+ stripe_setup_intent = stripe.SetupIntent.create(+ payment_method=payment_method.id,+ confirm=True,+ payment_method_types=checkout_setup_intent.payment_method_types,+ customer=checkout_setup_intent.customer,+ metadata=checkout_setup_intent.metadata,+ usage=checkout_setup_intent.usage,+ )+ if stripe_session is None:+ [stripe_session] = stripe.checkout.Session.list(limit=1)+ stripe_session_dict = stripe_session.to_dict_recursive()+ stripe_session_dict["setup_intent"] = stripe_setup_intent.id++ event_payload = {+ "id": "evt_{}".format(get_random_string(24)),+ "object": "event",+ "data": {"object": stripe_session_dict},+ "type": "checkout.session.completed",+ }++ response = self.client_post(+ "/stripe/webhook/", event_payload, content_type="application/json"+ )+ assert response.status_code == 200++ def send_stripe_webhook_event(self, event: stripe.Event) -> None:+ response = self.client_post(+ "/stripe/webhook/", event.to_dict_recursive(), content_type="application/json"+ )+ assert response.status_code == 200++ def send_stripe_webhook_events(self, most_recent_event: stripe.Event) -> None:+ while True:+ events_old_to_new = list(reversed(stripe.Event.list(ending_before=most_recent_event)))+ if len(events_old_to_new) == 0:+ break+ for event in events_old_to_new:+ self.send_stripe_webhook_event(event)+ most_recent_event = events_old_to_new[-1]++ def send_last_stripe_webhook_event(self) -> None:+ [last_event] = stripe.Event.list(limit=1)+ self.send_stripe_webhook_event(last_event)+def upgrade(self,invoice: bool = False,talk_to_stripe: bool = True,+ onboarding: bool = False,realm: Optional[Realm] = None,+ payment_method: Optional[stripe.PaymentMethod] = None,+ upgrade_page_response: HttpResponse = None,del_args: Sequence[str] = [],**kwargs: Any,) -> HttpResponse:host_args = {}if realm is not None: # nocoverage: TODOhost_args["HTTP_HOST"] = realm.host- response = self.client_get("/upgrade/", {}, **host_args)+ if upgrade_page_response is None:+ upgrade_page_response = self.client_get("/upgrade/", {}, **host_args)params: Dict[str, Any] = {"schedule": "annual",- "signed_seat_count": self.get_signed_seat_count_from_response(response),- "salt": self.get_salt_from_response(response),+ "signed_seat_count": self.get_signed_seat_count_from_response(upgrade_page_response),+ "salt": self.get_salt_from_response(upgrade_page_response),}if invoice: # send_invoiceparams.update(@@ -439,41 +549,92 @@ class StripeTestCase(ZulipTestCase):licenses=kwargs.get("licenses", 123),)else: # charge_automatically- stripe_token = None- if not talk_to_stripe:- stripe_token = "token"- stripe_token = kwargs.get("stripe_token", stripe_token)- if stripe_token is None:- stripe_token = stripe_create_token().idparams.update(billing_modality="charge_automatically",license_management="automatic",- stripe_token=stripe_token,+ )++ if onboarding:+ params.update(+ onboarding="true",)params.update(kwargs)for key in del_args:if key in params:del params[key]- return self.client_post("/json/billing/upgrade", params, **host_args)++ if talk_to_stripe:+ [last_event] = stripe.Event.list(limit=1)++ upgrade_json_response = self.client_post("/json/billing/upgrade", params, **host_args)++ if invoice or not talk_to_stripe:+ return upgrade_json_response++ expected_session_details = {"status": "created"}+ if is_free_trial_offer_enabled():+ if onboarding:+ expected_session_details["type"] = "free_trial_upgrade_from_onboarding_page"+ else:+ expected_session_details["type"] = "free_trial_upgrade_from_billing_page"+ else:+ expected_session_details["type"] = "upgrade_from_billing_page"+ expected_session_details[+ "stripe_payment_intent_id"+ ] = PaymentIntent.objects.last().stripe_payment_intent_id++ self.assert_details_of_valid_session_from_event_status_endpoint(+ upgrade_json_response.json()["stripe_session_id"], expected_session_details+ )+ if payment_method is None:+ payment_method = create_payment_method(+ self.get_test_card_number(+ attaches_to_customer=True, charge_succeeds=True, card_provider="visa"+ )+ )+ self.trigger_stripe_checkout_session_completed_webhook(payment_method)+ self.send_stripe_webhook_events(last_event)+ return upgrade_json_response# Upgrade without talking to Stripe- def local_upgrade(self, *args: Any) -> None:+ def local_upgrade(+ self,+ licenses: int,+ automanage_licenses: bool,+ billing_schedule: int,+ charge_automatically: bool,+ free_trial: bool,+ ) -> None:class StripeMock(Mock):def __init__(self, depth: int = 1):super().__init__(spec=stripe.Card)self.id = "id"self.created = "1000"self.last4 = "4242"- if depth == 1:- self.source = StripeMock(depth=2)- def upgrade_func(*args: Any) -> Any:- return process_initial_upgrade(self.example_user("hamlet"), *args[:4])+ def upgrade_func(+ licenses: int,+ automanage_licenses: bool,+ billing_schedule: int,+ charge_automatically: bool,+ free_trial: bool,+ *mock_args: Any,+ ) -> Any:+ return process_initial_upgrade(+ self.example_user("hamlet"),+ licenses,+ automanage_licenses,+ billing_schedule,+ charge_automatically,+ free_trial,+ )for mocked_function_name in MOCKED_STRIPE_FUNCTION_NAMES:upgrade_func = patch(mocked_function_name, return_value=StripeMock())(upgrade_func)- upgrade_func(*args)+ upgrade_func(+ licenses, automanage_licenses, billing_schedule, charge_automatically, free_trial+ )class StripeTest(StripeTestCase):@@ -525,14 +686,30 @@ class StripeTest(StripeTestCase):# Click "Make payment" in Stripe Checkoutwith patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.upgrade()+ response = self.upgrade()+ [payment_intent] = PaymentIntent.objects.all()+ assert payment_intent.stripe_payment_intent_id is not None+ self.assert_details_of_valid_session_from_event_status_endpoint(+ response.json()["stripe_session_id"],+ {+ "type": "upgrade_from_billing_page",+ "status": "completed",+ "stripe_payment_intent_id": payment_intent.stripe_payment_intent_id,+ "event_handler": {+ "status": "succeeded",+ },+ },+ )+ self.assert_details_of_valid_payment_intent_from_event_status_endpoint(+ payment_intent.stripe_payment_intent_id,+ {"status": "succeeded", "event_handler": {"status": "succeeded"}},+ )# Check that we correctly created a Customer object in Stripestripe_customer = stripe_get_customer(assert_is_not_none(Customer.objects.get(realm=user.realm).stripe_customer_id))- self.assertEqual(stripe_customer.default_source.id[:5], "card_")- self.assertTrue(stripe_customer_has_credit_card_as_default_source(stripe_customer))+ self.assertTrue(stripe_customer_has_credit_card_as_default_payment_method(stripe_customer))self.assertEqual(stripe_customer.description, "zulip (Zulip Dev)")self.assertEqual(stripe_customer.discount, None)self.assertEqual(stripe_customer.email, user.delivery_email)@@ -632,7 +809,7 @@ class StripeTest(StripeTestCase):RealmAuditLog.STRIPE_CUSTOMER_CREATED,timestamp_to_datetime(stripe_customer.created),),- (RealmAuditLog.STRIPE_CARD_CHANGED, timestamp_to_datetime(stripe_customer.created)),+ (RealmAuditLog.STRIPE_CARD_CHANGED, self.now),(RealmAuditLog.CUSTOMER_PLAN_CREATED, self.now),],)@@ -670,7 +847,7 @@ class StripeTest(StripeTestCase):"January 2, 2013",f"${80 * self.seat_count}.00",f"Billing email: <strong>{user.delivery_email}</strong>",- "Visa ending in 4242",+ "visa ending in 4242","Update card",]:self.assert_in_response(substring, response)@@ -695,7 +872,7 @@ class StripeTest(StripeTestCase):stripe_customer = stripe_get_customer(assert_is_not_none(Customer.objects.get(realm=user.realm).stripe_customer_id))- self.assertFalse(stripe_customer_has_credit_card_as_default_source(stripe_customer))+ self.assertFalse(stripe_customer_has_credit_card_as_default_payment_method(stripe_customer))# It can take a second for Stripe to attach the source to the customer, and in# particular it may not be attached at the time stripe_get_customer is called above,# causing test flakes.@@ -832,12 +1009,23 @@ class StripeTest(StripeTestCase):self.assertFalse(Customer.objects.filter(realm=user.realm).exists())with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.upgrade()+ response = self.upgrade()+ self.assertEqual(PaymentIntent.objects.count(), 0)+ self.assert_details_of_valid_session_from_event_status_endpoint(+ response.json()["stripe_session_id"],+ {+ "type": "free_trial_upgrade_from_billing_page",+ "status": "completed",+ "event_handler": {"status": "succeeded"},+ },+ )stripe_customer = stripe_get_customer(assert_is_not_none(Customer.objects.get(realm=user.realm).stripe_customer_id))- self.assertEqual(stripe_customer.default_source.id[:5], "card_")+ self.assertTrue(+ stripe_customer_has_credit_card_as_default_payment_method(stripe_customer)+ )self.assertEqual(stripe_customer.description, "zulip (Zulip Dev)")self.assertEqual(stripe_customer.discount, None)self.assertEqual(stripe_customer.email, user.delivery_email)@@ -887,7 +1075,7 @@ class StripeTest(StripeTestCase):),(RealmAuditLog.STRIPE_CARD_CHANGED,- timestamp_to_datetime(stripe_customer.created),+ self.now,),(RealmAuditLog.CUSTOMER_PLAN_CREATED, self.now),],@@ -921,7 +1109,7 @@ class StripeTest(StripeTestCase):"March 2, 2012",f"${80 * self.seat_count}.00",f"Billing email: <strong>{user.delivery_email}</strong>",- "Visa ending in 4242",+ "visa ending in 4242","Update card",]:self.assert_in_response(substring, response)@@ -1026,6 +1214,69 @@ class StripeTest(StripeTestCase):invoice_plans_as_needed(add_months(free_trial_end_date, 12))[invoice0, invoice1, invoice2] = stripe.Invoice.list(customer=stripe_customer.id)+ @mock_stripe(tested_timestamp_fields=["created"])+ def test_free_trial_upgrade_by_card_from_onboarding_page(self, *mocks: Mock) -> None:+ user = self.example_user("hamlet")+ self.login_user(user)++ with self.settings(FREE_TRIAL_DAYS=60):+ free_trial_end_date = self.now + timedelta(days=60)+ self.assertNotEqual(user.realm.plan_type, Realm.PLAN_TYPE_STANDARD)+ self.assertFalse(Customer.objects.filter(realm=user.realm).exists())++ with patch("corporate.lib.stripe.timezone_now", return_value=self.now):+ response = self.upgrade(onboarding=True)+ self.assertEqual(PaymentIntent.objects.all().count(), 0)+ self.assert_details_of_valid_session_from_event_status_endpoint(+ response.json()["stripe_session_id"],+ {+ "type": "free_trial_upgrade_from_onboarding_page",+ "status": "completed",+ "event_handler": {"status": "succeeded"},+ },+ )++ stripe_customer = stripe_get_customer(+ assert_is_not_none(Customer.objects.get(realm=user.realm).stripe_customer_id)+ )+ self.assertTrue(+ stripe_customer_has_credit_card_as_default_payment_method(stripe_customer)+ )+ self.assertEqual(stripe_customer.description, "zulip (Zulip Dev)")+ self.assertEqual(stripe_customer.discount, None)+ self.assertEqual(stripe_customer.email, user.delivery_email)+ metadata_dict = dict(stripe_customer.metadata)+ self.assertEqual(metadata_dict["realm_str"], "zulip")+ try:+ int(metadata_dict["realm_id"])+ except ValueError: # nocoverage+ raise AssertionError("realm_id is not a number")+ self.assertFalse(stripe.Charge.list(customer=stripe_customer.id))+ self.assertFalse(stripe.Invoice.list(customer=stripe_customer.id))+ customer = Customer.objects.get(stripe_customer_id=stripe_customer.id, realm=user.realm)+ customer = Customer.objects.get(stripe_customer_id=stripe_customer.id, realm=user.realm)+ plan = CustomerPlan.objects.get(+ customer=customer,+ automanage_licenses=True,+ price_per_license=8000,+ fixed_price=None,+ discount=None,+ billing_cycle_anchor=self.now,+ billing_schedule=CustomerPlan.ANNUAL,+ invoiced_through=LicenseLedger.objects.first(),+ next_invoice_date=free_trial_end_date,+ tier=CustomerPlan.STANDARD,+ status=CustomerPlan.FREE_TRIAL,+ )+ LicenseLedger.objects.get(+ plan=plan,+ is_renewal=True,+ event_time=self.now,+ licenses=self.seat_count,+ licenses_at_next_renewal=self.seat_count,+ )+ # We don't test anything else since test_free_trial_upgrade_by_card does this already.+@mock_stripe(tested_timestamp_fields=["created"])def test_free_trial_upgrade_by_invoice(self, *mocks: Mock) -> None:user = self.example_user("hamlet")@@ -1180,39 +1431,6 @@ class StripeTest(StripeTestCase):invoice_plans_as_needed(add_months(free_trial_end_date, 12))[invoice0, invoice1] = stripe.Invoice.list(customer=stripe_customer.id)- @mock_stripe()- def test_billing_page_permissions(self, *mocks: Mock) -> None:- # Guest users can't access /upgrade page- self.login_user(self.example_user("polonius"))- response = self.client_get("/upgrade/", follow=True)- self.assertEqual(response.status_code, 404)-- # Check that non-admins can access /upgrade via /billing, when there is no Customer object- self.login_user(self.example_user("hamlet"))- response = self.client_get("/billing/")- self.assertEqual(response.status_code, 302)- self.assertEqual("/upgrade/", response.url)- # Check that non-admins can sign up and pay- self.upgrade()- # Check that the non-admin hamlet can still access /billing- response = self.client_get("/billing/")- self.assert_in_success_response(["Your current plan is"], response)-- # Check realm owners can access billing, even though they are not a billing admin- desdemona = self.example_user("desdemona")- desdemona.role = UserProfile.ROLE_REALM_OWNER- desdemona.save(update_fields=["role"])- self.login_user(self.example_user("desdemona"))- response = self.client_get("/billing/")- self.assert_in_success_response(["Your current plan is"], response)-- # Check that member who is not a billing admin does not have access- self.login_user(self.example_user("cordelia"))- response = self.client_get("/billing/")- self.assert_in_success_response(- ["You must be an organization owner or a billing administrator"], response- )-@mock_stripe(tested_timestamp_fields=["created"])def test_upgrade_by_card_with_outdated_seat_count(self, *mocks: Mock) -> None:hamlet = self.example_user("hamlet")@@ -1220,7 +1438,10 @@ class StripeTest(StripeTestCase):new_seat_count = 23# Change the seat count while the user is going through the upgrade flowwith patch("corporate.lib.stripe.get_latest_seat_count", return_value=new_seat_count):- self.upgrade()+ with patch(+ "corporate.views.upgrade.get_latest_seat_count", return_value=self.seat_count+ ):+ self.upgrade()customer = Customer.objects.first()assert customer is not Nonestripe_customer_id: str = assert_is_not_none(customer.stripe_customer_id)@@ -1240,17 +1461,216 @@ class StripeTest(StripeTestCase):self.assertEqual(ledger_entry.licenses_at_next_renewal, new_seat_count)@mock_stripe()- def test_upgrade_where_first_card_fails(self, *mocks: Mock) -> None:+ def test_upgrade_first_card_fails_and_retry_with_another_card_without_starting_from_begining(+ self, *mocks: Mock+ ) -> None:+ user = self.example_user("hamlet")+ self.login_user(user)+ # From https://stripe.com/docs/testing#cards: Attaching this card to+ # a Customer object succeeds, but attempts to charge the customer fail.+ with self.assertLogs("corporate.stripe", "INFO") as m:+ response = self.upgrade(+ payment_method=create_payment_method(+ self.get_test_card_number(attaches_to_customer=True, charge_succeeds=False)+ )+ )+ self.assertEqual(+ m.output,+ [+ "INFO:corporate.stripe:Stripe payment intent failed: zulip card_error card_declined None"+ ],+ )++ [payment_intent] = PaymentIntent.objects.all()+ self.assert_details_of_valid_session_from_event_status_endpoint(+ response.json()["stripe_session_id"],+ {+ "type": "upgrade_from_billing_page",+ "status": "completed",+ "stripe_payment_intent_id": payment_intent.stripe_payment_intent_id,+ "event_handler": {+ "status": "succeeded",+ },+ },+ )+ self.assert_details_of_valid_payment_intent_from_event_status_endpoint(+ payment_intent.stripe_payment_intent_id,+ {+ "status": "requires_payment_method",+ "last_payment_error": {+ "message": "Your card was declined.",+ "description": "card_error",+ },+ "event_handler": {"status": "succeeded"},+ },+ )+ # Check that we created a Customer object but no CustomerPlan+ stripe_customer_id = Customer.objects.get(realm=get_realm("zulip")).stripe_customer_id+ assert stripe_customer_id is not None+ self.assertFalse(CustomerPlan.objects.exists())+ # Check that we created a Customer in stripe, a failed Charge, and no Invoices or Invoice Items+ self.assertTrue(stripe_get_customer(stripe_customer_id))+ [charge] = stripe.Charge.list(customer=stripe_customer_id)+ self.assertEqual(charge.failure_code, "card_declined")+ self.assertFalse(stripe.Invoice.list(customer=stripe_customer_id))+ self.assertFalse(stripe.InvoiceItem.list(customer=stripe_customer_id))+ # Check that we correctly populated RealmAuditLog+ audit_log_entries = list(+ RealmAuditLog.objects.filter(acting_user=user)+ .values_list("event_type", flat=True)+ .order_by("id")+ )+ self.assertEqual(+ audit_log_entries,+ [RealmAuditLog.STRIPE_CUSTOMER_CREATED, RealmAuditLog.STRIPE_CARD_CHANGED],+ )+ # Check that we did not update Realm+ realm = get_realm("zulip")+ self.assertNotEqual(realm.plan_type, Realm.PLAN_TYPE_STANDARD)+ # Check that we still get redirected to /upgrade+ response = self.client_get("/billing/")+ self.assertEqual(response.status_code, 302)+ self.assertEqual("/upgrade/", response.url)++ [last_event] = stripe.Event.list(limit=1)+ retry_payment_intent_json_response = self.client_post(+ "/json/billing/session/start_retry_payment_intent_session",+ {+ "stripe_payment_intent_id": payment_intent.stripe_payment_intent_id,+ },+ )+ self.assert_json_success(retry_payment_intent_json_response)+ [payment_intent] = PaymentIntent.objects.all()+ self.assert_details_of_valid_session_from_event_status_endpoint(+ retry_payment_intent_json_response.json()["stripe_session_id"],+ {+ "type": "retry_upgrade_with_another_payment_method",+ "status": "created",+ "stripe_payment_intent_id": payment_intent.stripe_payment_intent_id,+ },+ )+ self.trigger_stripe_checkout_session_completed_webhook(+ create_payment_method(+ self.get_test_card_number(+ attaches_to_customer=True, charge_succeeds=True, card_provider="visa"+ )+ )+ )+ self.assert_details_of_valid_payment_intent_from_event_status_endpoint(+ payment_intent.stripe_payment_intent_id,+ {"status": "processing"},+ )+ self.send_stripe_webhook_events(last_event)++ self.assert_details_of_valid_session_from_event_status_endpoint(+ retry_payment_intent_json_response.json()["stripe_session_id"],+ {+ "type": "retry_upgrade_with_another_payment_method",+ "status": "completed",+ "stripe_payment_intent_id": payment_intent.stripe_payment_intent_id,+ "event_handler": {+ "status": "succeeded",+ },+ },+ )+ self.assert_details_of_valid_payment_intent_from_event_status_endpoint(+ payment_intent.stripe_payment_intent_id,+ {"status": "succeeded", "event_handler": {"status": "succeeded"}},+ )++ retry_payment_intent_json_response = self.client_post(+ "/json/billing/session/start_retry_payment_intent_session",+ {+ "stripe_payment_intent_id": payment_intent.stripe_payment_intent_id,+ },+ )+ self.assert_json_error(retry_payment_intent_json_response, "Payment already succeeded.")++ customer = Customer.objects.get(realm=get_realm("zulip"))+ # It's impossible to create two Customers, but check that we didn't+ # change stripe_customer_id+ self.assertEqual(customer.stripe_customer_id, stripe_customer_id)+ # Check that we successfully added a CustomerPlan, and have the right number of licenses+ plan = CustomerPlan.objects.get(customer=customer)+ ledger_entry = LicenseLedger.objects.get(plan=plan)+ self.assertEqual(ledger_entry.licenses, self.seat_count)+ self.assertEqual(ledger_entry.licenses_at_next_renewal, self.seat_count)+ # Check the Charges and Invoices in Stripe+ [charge0, charge1] = stripe.Charge.list(customer=stripe_customer_id)+ self.assertEqual(8000 * self.seat_count, charge0.amount)+ [stripe_invoice] = stripe.Invoice.list(customer=stripe_customer_id)+ self.assertEqual(+ [8000 * self.seat_count, -8000 * self.seat_count],+ [item.amount for item in stripe_invoice.lines],+ )+ # Check that we correctly populated RealmAuditLog+ audit_log_entries = list(+ RealmAuditLog.objects.filter(acting_user=user)+ .values_list("event_type", flat=True)+ .order_by("id")+ )+ self.assertEqual(+ audit_log_entries,+ [+ RealmAuditLog.STRIPE_CUSTOMER_CREATED,+ RealmAuditLog.STRIPE_CARD_CHANGED,+ RealmAuditLog.STRIPE_CARD_CHANGED,+ RealmAuditLog.CUSTOMER_PLAN_CREATED,+ RealmAuditLog.REALM_PLAN_TYPE_CHANGED,+ ],+ )+ # Check that we correctly updated Realm+ realm = get_realm("zulip")+ self.assertEqual(realm.plan_type, Realm.PLAN_TYPE_STANDARD)+ # Check that we can no longer access /upgrade+ response = self.client_get("/upgrade/")+ self.assertEqual(response.status_code, 302)+ self.assertEqual("/billing/", response.url)++ @mock_stripe()+ def test_upgrade_first_card_fails_and_restart_from_begining(self, *mocks: Mock) -> None:user = self.example_user("hamlet")self.login_user(user)# From https://stripe.com/docs/testing#cards: Attaching this card to# a Customer object succeeds, but attempts to charge the customer fail.with self.assertLogs("corporate.stripe", "INFO") as m:- self.upgrade(stripe_token=stripe_create_token("4000000000000341").id)+ response = self.upgrade(+ payment_method=create_payment_method(+ self.get_test_card_number(attaches_to_customer=True, charge_succeeds=False)+ )+ )self.assertEqual(m.output,- ["INFO:corporate.stripe:Stripe card error: 402 card_error card_declined None"],+ [+ "INFO:corporate.stripe:Stripe payment intent failed: zulip card_error card_declined None"+ ],)++ [payment_intent] = PaymentIntent.objects.all()+ assert payment_intent.stripe_payment_intent_id is not None+ self.assert_details_of_valid_session_from_event_status_endpoint(+ response.json()["stripe_session_id"],+ {+ "type": "upgrade_from_billing_page",+ "status": "completed",+ "stripe_payment_intent_id": payment_intent.stripe_payment_intent_id,+ "event_handler": {+ "status": "succeeded",+ },+ },+ )+ self.assert_details_of_valid_payment_intent_from_event_status_endpoint(+ payment_intent.stripe_payment_intent_id,+ {+ "status": "requires_payment_method",+ "last_payment_error": {+ "message": "Your card was declined.",+ "description": "card_error",+ },+ "event_handler": {"status": "succeeded"},+ },+ )+# Check that we created a Customer object but no CustomerPlanstripe_customer_id = Customer.objects.get(realm=get_realm("zulip")).stripe_customer_idassert stripe_customer_id is not None@@ -1283,7 +1703,24 @@ class StripeTest(StripeTestCase):# Try again, with a valid card, after they added a few userswith patch("corporate.lib.stripe.get_latest_seat_count", return_value=23):with patch("corporate.views.upgrade.get_latest_seat_count", return_value=23):- self.upgrade()+ response = self.upgrade()+ [second_payment_intent, _] = PaymentIntent.objects.all().order_by("-id")+ assert second_payment_intent.stripe_payment_intent_id is not None+ self.assert_details_of_valid_session_from_event_status_endpoint(+ response.json()["stripe_session_id"],+ {+ "type": "upgrade_from_billing_page",+ "status": "completed",+ "stripe_payment_intent_id": second_payment_intent.stripe_payment_intent_id,+ "event_handler": {+ "status": "succeeded",+ },+ },+ )+ self.assert_details_of_valid_payment_intent_from_event_status_endpoint(+ second_payment_intent.stripe_payment_intent_id,+ {"status": "succeeded", "event_handler": {"status": "succeeded"}},+ )customer = Customer.objects.get(realm=get_realm("zulip"))# It's impossible to create two Customers, but check that we didn't# change stripe_customer_id@@ -1325,23 +1762,125 @@ class StripeTest(StripeTestCase):def test_upgrade_with_tampered_seat_count(self) -> None:hamlet = self.example_user("hamlet")self.login_user(hamlet)- response = self.upgrade(talk_to_stripe=False, salt="badsalt")+ with self.assertLogs("corporate.stripe", "WARNING"):+ response = self.upgrade(talk_to_stripe=False, salt="badsalt")self.assert_json_error_contains(response, "Something went wrong. Please contact")self.assertEqual(orjson.loads(response.content)["error_description"], "tampered seat count")- def test_upgrade_race_condition(self) -> None:+ @mock_stripe()+ def test_upgrade_race_condition_during_card_upgrade(self, *mocks: Mock) -> None:+ hamlet = self.example_user("hamlet")+ othello = self.example_user("othello")++ self.login_user(hamlet)+ hamlet_upgrade_page_response = self.client_get("/upgrade/")+ self.client_post(+ "/json/billing/upgrade",+ {+ "billing_modality": "charge_automatically",+ "schedule": "annual",+ "signed_seat_count": self.get_signed_seat_count_from_response(+ hamlet_upgrade_page_response+ ),+ "salt": self.get_salt_from_response(hamlet_upgrade_page_response),+ "license_management": "automatic",+ },+ )+ [hamlet_stripe_session] = stripe.checkout.Session.list(limit=1)+ [hamlet_payment_intent] = stripe.PaymentIntent.list(limit=1)++ self.login_user(othello)+ self.upgrade()++ self.login_user(hamlet)+ # Checkout session cannot be started since the organization has been already upgraded.+ with self.assertLogs("corporate.stripe", "WARNING"):+ response = self.client_post(+ "/json/billing/upgrade",+ {+ "billing_modality": "charge_automatically",+ "schedule": "annual",+ "signed_seat_count": self.get_signed_seat_count_from_response(+ hamlet_upgrade_page_response+ ),+ "salt": self.get_salt_from_response(hamlet_upgrade_page_response),+ "license_management": "automatic",+ },+ )+ self.assert_json_error_contains(+ response,+ "The organization is already subscribed to a plan. Please reload the billing page.",+ )+ payment_method = create_payment_method(+ self.get_test_card_number(+ attaches_to_customer=True, charge_succeeds=True, card_provider="visa"+ )+ )++ # Organization has been upgraded by the time hamlet completes the checkout session.+ with self.assertLogs("corporate.stripe", "WARNING"):+ self.trigger_stripe_checkout_session_completed_webhook(+ payment_method, hamlet_stripe_session+ )+ self.assert_details_of_valid_session_from_event_status_endpoint(+ hamlet_stripe_session.id,+ {+ "type": "upgrade_from_billing_page",+ "status": "completed",+ "stripe_payment_intent_id": hamlet_payment_intent.id,+ "event_handler": {+ "status": "failed",+ "error": {+ "message": "The organization is already subscribed to a plan. Please reload the billing page.",+ "description": "subscribing with existing subscription",+ },+ },+ },+ )++ # Organization has been upgraded by the time payment intent is successful.+ stripe.PaymentIntent.confirm(+ hamlet_payment_intent.id,+ payment_method=payment_method.id,+ off_session=True,+ )+ with self.assertLogs("corporate.stripe", "WARNING"):+ self.send_last_stripe_webhook_event()+ self.assert_details_of_valid_payment_intent_from_event_status_endpoint(+ hamlet_payment_intent.id,+ {+ "status": "succeeded",+ "event_handler": {+ "status": "failed",+ "error": {+ "message": "The organization is already subscribed to a plan. Please reload the billing page.",+ "description": "subscribing with existing subscription",+ },+ },+ },+ )+ charged_amount = self.seat_count * 8000+ customer = get_customer_by_realm(get_realm("zulip"))+ assert customer is not None+ assert customer.stripe_customer_id is not None+ [invoice, _] = stripe.Invoice.list(customer=customer.stripe_customer_id)+ self.assertEqual(invoice.total, -1 * charged_amount)+ stripe_customer = stripe.Customer.retrieve(customer.stripe_customer_id)+ self.assertEqual(stripe_customer.balance, -1 * charged_amount)++ def test_upgrade_race_condition_during_invoice_upgrade(self) -> None:hamlet = self.example_user("hamlet")self.login_user(hamlet)- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)with self.assertLogs("corporate.stripe", "WARNING") as m:with self.assertRaises(BillingError) as context:- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)self.assertEqual("subscribing with existing subscription", context.exception.error_description)self.assertEqual(m.output[0],- f"WARNING:corporate.stripe:Customer <Customer <Realm: zulip {hamlet.realm.id}> id> trying to upgrade, but has an active subscription",+ "WARNING:corporate.stripe:Upgrade of zulip failed because of existing active plan.",)self.assert_length(m.output, 1)@@ -1353,23 +1892,59 @@ class StripeTest(StripeTestCase):upgrade_params: Mapping[str, Any],del_args: Sequence[str] = [],) -> None:- response = self.upgrade(talk_to_stripe=False, del_args=del_args, **upgrade_params)- self.assert_json_error_contains(response, error_message)if error_description:- self.assertEqual(- orjson.loads(response.content)["error_description"], error_description- )+ with self.assertLogs("corporate.stripe", "WARNING"):+ response = self.upgrade(+ talk_to_stripe=False, del_args=del_args, **upgrade_params+ )+ self.assertEqual(+ orjson.loads(response.content)["error_description"], error_description+ )+ else:+ response = self.upgrade(talk_to_stripe=False, del_args=del_args, **upgrade_params)+ self.assert_json_error_contains(response, error_message)hamlet = self.example_user("hamlet")self.login_user(hamlet)check_error("Invalid billing_modality", "", {"billing_modality": "invalid"})check_error("Invalid schedule", "", {"schedule": "invalid"})check_error("Invalid license_management", "", {"license_management": "invalid"})+check_error(- "Something went wrong. Please contact",- "autopay with no card",- {},- del_args=["stripe_token"],+ "You must invoice for at least 30 users.",+ "not enough licenses",+ {"billing_modality": "send_invoice", "licenses": -1},+ )+ check_error(+ "You must invoice for at least 30 users.",+ "not enough licenses",+ {"billing_modality": "send_invoice"},+ )+ check_error(+ "You must invoice for at least 30 users.",+ "not enough licenses",+ {"billing_modality": "send_invoice", "licenses": 25},+ )+ check_error(+ "Invoices with more than 1000 licenses can't be processed from this page",+ "too many licenses",+ {"billing_modality": "send_invoice", "licenses": 10000},+ )++ check_error(+ "You must invoice for at least 6 users.",+ "not enough licenses",+ {"billing_modality": "charge_automatically", "license_management": "manual"},+ )++ check_error(+ "You must invoice for at least 6 users.",+ "not enough licenses",+ {+ "billing_modality": "charge_automatically",+ "license_management": "manual",+ "licenses": 3,+ },)def test_upgrade_license_counts(self) -> None:@@ -1384,16 +1959,18 @@ class StripeTest(StripeTestCase):else:del_args = []upgrade_params["licenses"] = licenses- response = self.upgrade(- invoice=invoice, talk_to_stripe=False, del_args=del_args, **upgrade_params- )+ with self.assertLogs("corporate.stripe", "WARNING"):+ response = self.upgrade(+ invoice=invoice, talk_to_stripe=False, del_args=del_args, **upgrade_params+ )self.assert_json_error_contains(response, f"at least {min_licenses_in_response} users")self.assertEqual(orjson.loads(response.content)["error_description"], "not enough licenses")def check_max_licenses_error(licenses: int) -> None:- response = self.upgrade(invoice=True, talk_to_stripe=False, licenses=licenses)+ with self.assertLogs("corporate.stripe", "WARNING"):+ response = self.upgrade(invoice=True, talk_to_stripe=False, licenses=licenses)self.assert_json_error_contains(response, f"with more than {MAX_INVOICED_LICENSES} licenses")@@ -1410,9 +1987,16 @@ class StripeTest(StripeTestCase):del_args = []upgrade_params["licenses"] = licenseswith patch("corporate.views.upgrade.process_initial_upgrade"):- response = self.upgrade(- invoice=invoice, talk_to_stripe=False, del_args=del_args, **upgrade_params- )+ stripe_session = stripe.checkout.Session()+ stripe_session.id = "stripe_session_id"+ stripe_session.url = "stripe_session_url"+ with patch(+ "corporate.views.upgrade.setup_upgrade_checkout_session_and_payment_intent",+ return_value=stripe_session,+ ):+ response = self.upgrade(+ invoice=invoice, talk_to_stripe=False, del_args=del_args, **upgrade_params+ )self.assert_json_success(response)hamlet = self.example_user("hamlet")@@ -1454,7 +2038,8 @@ class StripeTest(StripeTestCase):hamlet = self.example_user("hamlet")self.login_user(hamlet)with patch(- "corporate.views.upgrade.process_initial_upgrade", side_effect=Exception+ "corporate.views.upgrade.setup_upgrade_checkout_session_and_payment_intent",+ side_effect=Exception,), self.assertLogs("corporate.stripe", "WARNING") as m:response = self.upgrade(talk_to_stripe=False)self.assertIn("ERROR:corporate.stripe:Uncaught exception in billing", m.output[0])@@ -1466,6 +2051,103 @@ class StripeTest(StripeTestCase):orjson.loads(response.content)["error_description"], "uncaught exception during upgrade")+ @mock_stripe()+ def test_checkout_session_completed_with_uncaught_exception(self, *mock_args: Any) -> None:+ hamlet = self.example_user("hamlet")+ self.login_user(hamlet)++ with patch(+ "corporate.lib.stripe_event_handler.update_or_create_stripe_customer",+ side_effect=Exception,+ ), self.assertLogs("corporate.stripe", "WARNING"):+ response = self.upgrade()++ self.assert_details_of_valid_session_from_event_status_endpoint(+ response.json()["stripe_session_id"],+ {+ "type": "upgrade_from_billing_page",+ "status": "completed",+ "stripe_payment_intent_id": PaymentIntent.objects.get().stripe_payment_intent_id,+ "event_handler": {+ "status": "failed",+ "error": {+ "message": "Something went wrong. Please contact [email protected].",+ "description": "uncaught exception in checkout.session.completed event handler",+ },+ },+ },+ )++ @mock_stripe()+ def test_payment_intent_succeeded_event_with_uncaught_exception(self, *mock_args: Any) -> None:+ hamlet = self.example_user("hamlet")+ self.login_user(hamlet)++ with patch(+ "corporate.lib.stripe_event_handler.process_initial_upgrade", side_effect=Exception+ ), self.assertLogs("corporate.stripe", "WARNING"):+ response = self.upgrade()++ [payment_intent] = PaymentIntent.objects.all().order_by("-id")+ self.assert_details_of_valid_session_from_event_status_endpoint(+ response.json()["stripe_session_id"],+ {+ "type": "upgrade_from_billing_page",+ "status": "completed",+ "stripe_payment_intent_id": payment_intent.stripe_payment_intent_id,+ "event_handler": {+ "status": "succeeded",+ },+ },+ )++ self.assert_details_of_valid_payment_intent_from_event_status_endpoint(+ payment_intent.stripe_payment_intent_id,+ {+ "status": "succeeded",+ "event_handler": {+ "status": "failed",+ "error": {+ "message": "Something went wrong. Please contact [email protected].",+ "description": "uncaught exception in payment_intent.succeeded event handler",+ },+ },+ },+ )++ @mock_stripe()+ def test_restart_payment_intent_session_errors(self, *mocks: Any) -> None:+ user = self.example_user("hamlet")+ self.login_user(user)++ json_response = self.client_post("/json/billing/session/start_retry_payment_intent_session")+ self.assert_json_error(json_response, "Missing 'stripe_payment_intent_id' argument")++ json_response = self.client_post(+ "/json/billing/session/start_retry_payment_intent_session",+ {"stripe_payment_intent_id": "stripe_payment_intent_id"},+ )+ self.assert_json_error(json_response, "Please create a customer first.")++ upgrade_page_response = self.client_get("/upgrade/")+ self.client_post(+ "/json/billing/upgrade",+ {+ "billing_modality": "charge_automatically",+ "schedule": "monthly",+ "signed_seat_count": self.get_signed_seat_count_from_response(+ upgrade_page_response+ ),+ "salt": self.get_salt_from_response(upgrade_page_response),+ "license_management": "automatic",+ },+ )+ response = self.client_post(+ "/json/billing/session/start_retry_payment_intent_session",+ {"stripe_payment_intent_id": "stripe_payment_intent_id"},+ )+ self.assert_json_error(response, "Invalid payment intent id.")+def test_request_sponsorship_form_with_invalid_url(self) -> None:user = self.example_user("hamlet")self.login_user(user)@@ -1771,9 +2453,7 @@ class StripeTest(StripeTestCase):plan.save(update_fields=["status"])attach_discount_to_realm(user.realm, Decimal(25), acting_user=user)with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- process_initial_upgrade(- user, self.seat_count, True, CustomerPlan.ANNUAL, stripe_create_token().id- )+ self.upgrade(license_management="automatic", billing_modality="charge_automatically")[charge, _] = stripe.Charge.list(customer=customer.stripe_customer_id)self.assertEqual(6000 * self.seat_count, charge.amount)stripe_customer_id = customer.stripe_customer_id@@ -1844,76 +2524,119 @@ class StripeTest(StripeTestCase):self.assertEqual(get_discount_for_realm(user.realm), 85)@mock_stripe()- def test_replace_payment_source(self, *mocks: Mock) -> None:+ def test_replace_payment_method(self, *mocks: Mock) -> None:user = self.example_user("hamlet")self.login_user(user)self.upgrade()# Create an open invoice- stripe_customer = Customer.objects.first()- assert stripe_customer is not None- stripe_customer_id = stripe_customer.stripe_customer_id+ customer = Customer.objects.first()+ assert customer is not None+ stripe_customer_id = customer.stripe_customer_idassert stripe_customer_id is not Nonestripe.InvoiceItem.create(amount=5000, currency="usd", customer=stripe_customer_id)stripe_invoice = stripe.Invoice.create(customer=stripe_customer_id)stripe.Invoice.finalize_invoice(stripe_invoice)RealmAuditLog.objects.filter(event_type=RealmAuditLog.STRIPE_CARD_CHANGED).delete()- # Replace with an invalid card- stripe_token = stripe_create_token(card_number="4000000000009987").id- with patch("stripe.Invoice.list") as mock_invoice_list, self.assertLogs(- "corporate.stripe", "INFO"- ) as m:- response = self.client_post(- "/json/billing/sources/change",- {"stripe_token": stripe_token},- )- self.assertEqual(- m.output, ["INFO:corporate.stripe:Stripe card error: 402 card_error card_declined "]- )- mock_invoice_list.assert_not_called()- self.assertEqual(orjson.loads(response.content)["error_description"], "card error")- self.assert_json_error_contains(response, "Your card was declined")- for stripe_source in stripe_get_customer(stripe_customer_id).sources:- assert isinstance(stripe_source, stripe.Card)- self.assertEqual(stripe_source.last4, "4242")- self.assertFalse(- RealmAuditLog.objects.filter(event_type=RealmAuditLog.STRIPE_CARD_CHANGED).exists()+ start_session_json_response = self.client_post(+ "/json/billing/session/start_card_update_session")+ self.assert_details_of_valid_session_from_event_status_endpoint(+ start_session_json_response.json()["stripe_session_id"],+ {+ "type": "card_update_from_billing_page",+ "status": "created",+ },+ )+ with self.assertRaises(stripe.error.CardError):+ # We don't have to handle this since the Stripe Checkout page would+ # ask Customer to enter a valid card number. trigger_stripe_checkout_session_completed_webhook+ # emulates what happens in the Stripe Checkout page. Adding this check mostly for coverage of+ # create_payment_method.+ self.trigger_stripe_checkout_session_completed_webhook(+ create_payment_method(self.get_test_card_number(attaches_to_customer=False))+ )- # Replace with a card that's valid, but charging the card fails- stripe_token = stripe_create_token(card_number="4000000000000341").id+ start_session_json_response = self.client_post(+ "/json/billing/session/start_card_update_session"+ )+ self.assert_details_of_valid_session_from_event_status_endpoint(+ start_session_json_response.json()["stripe_session_id"],+ {+ "type": "card_update_from_billing_page",+ "status": "created",+ },+ )with self.assertLogs("corporate.stripe", "INFO") as m:- response = self.client_post(- "/json/billing/sources/change",- {"stripe_token": stripe_token},+ self.trigger_stripe_checkout_session_completed_webhook(+ create_payment_method(+ self.get_test_card_number(attaches_to_customer=True, charge_succeeds=False)+ ))self.assertEqual(- m.output,- ["INFO:corporate.stripe:Stripe card error: 402 card_error card_declined None"],+ m.output[0],+ "INFO:corporate.stripe:Stripe card error: 402 card_error card_declined None",)- self.assertEqual(orjson.loads(response.content)["error_description"], "card error")- self.assert_json_error_contains(response, "Your card was declined")- for stripe_source in stripe_get_customer(stripe_customer_id).sources:- assert isinstance(stripe_source, stripe.Card)- self.assertEqual(stripe_source.last4, "0341")- self.assertEqual(- len(list(stripe.Invoice.list(customer=stripe_customer_id, status="open"))), 1+ self.assert_details_of_valid_session_from_event_status_endpoint(+ start_session_json_response.json()["stripe_session_id"],+ {+ "type": "card_update_from_billing_page",+ "status": "completed",+ "event_handler": {+ "status": "failed",+ "error": {"message": "Your card was declined.", "description": "card error"},+ },+ },)- self.assertEqual(- 1, RealmAuditLog.objects.filter(event_type=RealmAuditLog.STRIPE_CARD_CHANGED).count()++ response = self.client_get("/billing/")+ self.assert_in_success_response(["payment method: <strong>visa ending in 0341"], response)+ assert RealmAuditLog.objects.filter(event_type=RealmAuditLog.STRIPE_CARD_CHANGED).exists()+ stripe_payment_methods = stripe.PaymentMethod.list(customer=stripe_customer_id, type="card")+ self.assert_length(stripe_payment_methods, 2)++ for stripe_payment_method in stripe_payment_methods:+ stripe.PaymentMethod.detach(stripe_payment_method.id)+ response = self.client_get("/billing/")+ self.assert_in_success_response(+ ["payment method: <strong>No payment method on file"], response)- # Replace with a valid card- stripe_token = stripe_create_token(card_number="5555555555554444").id- response = self.client_post("/json/billing/sources/change", {"stripe_token": stripe_token})- self.assert_json_success(response)- number_of_sources = 0- for stripe_source in stripe_get_customer(stripe_customer_id).sources:- assert isinstance(stripe_source, stripe.Card)- self.assertEqual(stripe_source.last4, "4444")- number_of_sources += 1- # Verify that we replaced the previous card, rather than adding a new one- self.assertEqual(number_of_sources, 1)+ start_session_json_response = self.client_post(+ "/json/billing/session/start_card_update_session"+ )+ self.assert_json_success(start_session_json_response)+ self.trigger_stripe_checkout_session_completed_webhook(+ create_payment_method(+ self.get_test_card_number(+ attaches_to_customer=True, charge_succeeds=True, card_provider="mastercard"+ )+ )+ )+ self.assert_details_of_valid_session_from_event_status_endpoint(+ start_session_json_response.json()["stripe_session_id"],+ {+ "type": "card_update_from_billing_page",+ "status": "completed",+ "event_handler": {"status": "succeeded"},+ },+ )++ self.login_user(self.example_user("iago"))+ response = self.client_get(+ "/json/billing/event/status",+ {"stripe_session_id": start_session_json_response.json()["stripe_session_id"]},+ )+ self.assert_json_error_contains(+ response, "Must be a billing administrator or an organization owner"+ )++ self.login_user(self.example_user("hamlet"))+ response = self.client_get("/billing/")+ self.assert_in_success_response(+ ["payment method: <strong>mastercard ending in 4444"], response+ )+ self.assert_length(stripe.PaymentMethod.list(customer=stripe_customer_id, type="card"), 1)# Ideally we'd also test that we don't pay invoices with collection_method=='send_invoice'for stripe_invoice in stripe.Invoice.list(customer=stripe_customer_id):self.assertEqual(stripe_invoice.status, "paid")@@ -1925,7 +2648,7 @@ class StripeTest(StripeTestCase):user = self.example_user("hamlet")self.login_user(user)with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)plan = get_current_plan_by_realm(user.realm)assert plan is not Noneself.assertEqual(plan.licenses(), self.seat_count)@@ -1946,7 +2669,7 @@ class StripeTest(StripeTestCase):self.assertEqual(plan.licenses_at_next_renewal(), None)with patch("corporate.views.billing_page.timezone_now", return_value=self.now):- mock_customer = Mock(email=user.delivery_email, default_source=None)+ mock_customer = Mock(email=user.delivery_email)with patch("corporate.views.billing_page.stripe_get_customer", return_value=mock_customer):@@ -2332,7 +3055,7 @@ class StripeTest(StripeTestCase):user = self.example_user("hamlet")self.login_user(user)with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)with self.assertLogs("corporate.stripe", "INFO") as m:with patch("corporate.views.billing_page.timezone_now", return_value=self.now):response = self.client_patch(@@ -2369,7 +3092,7 @@ class StripeTest(StripeTestCase):user = self.example_user("hamlet")self.login_user(user)with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)with self.assertLogs("corporate.stripe", "INFO") as m:stripe_customer_id = Customer.objects.get(realm=user.realm).idnew_plan = get_current_plan_by_realm(user.realm)@@ -2397,7 +3120,7 @@ class StripeTest(StripeTestCase):free_trial_end_date = self.now + timedelta(days=60)with self.settings(FREE_TRIAL_DAYS=60):with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, True)plan = CustomerPlan.objects.get()self.assertEqual(plan.next_invoice_date, free_trial_end_date)@@ -2444,7 +3167,7 @@ class StripeTest(StripeTestCase):user = self.example_user("hamlet")with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)self.login_user(user)with self.assertLogs("corporate.stripe", "INFO") as m:@@ -2462,10 +3185,10 @@ class StripeTest(StripeTestCase):"corporate.stripe", "WARNING") as m:with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)self.assertEqual(m.output[0],- f"WARNING:corporate.stripe:Customer <Customer <Realm: zulip {user.realm.id}> id> trying to upgrade, but has an active subscription",+ "WARNING:corporate.stripe:Upgrade of zulip failed because of existing active plan.",)self.assertEqual(context.exception.error_description, "subscribing with existing subscription"@@ -2477,7 +3200,7 @@ class StripeTest(StripeTestCase):self.assert_in_success_response(["Your organization is on the <b>Zulip Free</b>"], response)with patch("corporate.lib.stripe.timezone_now", return_value=self.next_year):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)self.assertEqual(Customer.objects.count(), 1)self.assertEqual(CustomerPlan.objects.count(), 2)@@ -2621,7 +3344,7 @@ class StripeTest(StripeTestCase):self.login_user(user)with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)with patch("corporate.views.billing_page.timezone_now", return_value=self.now):result = self.client_patch("/json/billing/plan", {"licenses": 100})@@ -2633,7 +3356,7 @@ class StripeTest(StripeTestCase):def test_update_plan_with_invalid_status(self) -> None:with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)self.login_user(self.example_user("hamlet"))response = self.client_patch(@@ -2644,7 +3367,7 @@ class StripeTest(StripeTestCase):def test_update_plan_without_any_params(self) -> None:with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)self.login_user(self.example_user("hamlet"))with patch("corporate.views.billing_page.timezone_now", return_value=self.now):@@ -2653,7 +3376,7 @@ class StripeTest(StripeTestCase):def test_update_plan_that_which_is_due_for_expiry(self) -> None:with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)self.login_user(self.example_user("hamlet"))with self.assertLogs("corporate.stripe", "INFO") as m:@@ -2675,7 +3398,7 @@ class StripeTest(StripeTestCase):def test_update_plan_that_which_is_due_for_replacement(self) -> None:with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.MONTHLY, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.MONTHLY, True, False)self.login_user(self.example_user("hamlet"))with self.assertLogs("corporate.stripe", "INFO") as m:@@ -2700,7 +3423,7 @@ class StripeTest(StripeTestCase):def test_deactivate_realm(self, mock_: Mock) -> None:user = self.example_user("hamlet")with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)plan = CustomerPlan.objects.get()self.assertEqual(plan.next_invoice_date, self.next_month)@@ -2745,7 +3468,7 @@ class StripeTest(StripeTestCase):user = self.example_user("hamlet")with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)do_deactivate_realm(get_realm("zulip"), acting_user=None)self.assertTrue(get_realm("zulip").deactivated)@@ -2756,7 +3479,7 @@ class StripeTest(StripeTestCase):self.assert_in_success_response(["Your organization is on the <b>Zulip Free</b>"], response)with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)self.assertEqual(Customer.objects.count(), 1)@@ -3095,20 +3818,181 @@ class StripeTest(StripeTestCase):self.assertEqual(realm_audit_log.extra_data, str(expected_extra_data))@mock_stripe()- def test_customer_has_credit_card_as_default_source(self, *mocks: Mock) -> None:+ def test_customer_has_credit_card_as_default_payment_method(self, *mocks: Mock) -> None:iago = self.example_user("iago")customer = Customer.objects.create(realm=iago.realm)- self.assertFalse(customer_has_credit_card_as_default_source(customer))+ self.assertFalse(customer_has_credit_card_as_default_payment_method(customer))customer = do_create_stripe_customer(iago)- self.assertFalse(customer_has_credit_card_as_default_source(customer))+ self.assertFalse(customer_has_credit_card_as_default_payment_method(customer))++ customer = do_create_stripe_customer(+ iago,+ payment_method=create_payment_method(+ self.get_test_card_number(+ attaches_to_customer=True, charge_succeeds=True, card_provider="visa"+ )+ ).id,+ )+ self.assertTrue(customer_has_credit_card_as_default_payment_method(customer))- customer = do_create_stripe_customer(iago, stripe_token=stripe_create_token().id)- self.assertTrue(customer_has_credit_card_as_default_source(customer))+class StripeWebhookEndpointTest(ZulipTestCase):+ def test_stripe_webhook_with_invalid_data(self) -> None:+ result = self.client_post(+ "/stripe/webhook/",+ '["dsdsds"]',+ content_type="application/json",+ )+ self.assertEqual(result.status_code, 400)-class RequiresBillingAccessTest(ZulipTestCase):- def setUp(self) -> None:+ def test_stripe_webhook_for_session_completed_event(self) -> None:+ valid_session_event_data = {+ "id": "stripe_event_id",+ "type": "checkout.session.completed",+ "data": {"object": {"object": "checkout.session", "id": "stripe_session_id"}},+ }+ with patch("corporate.views.webhook.handle_checkout_session_completed_event") as m:+ result = self.client_post(+ "/stripe/webhook/",+ valid_session_event_data,+ content_type="application/json",+ )+ self.assert_length(Event.objects.all(), 0)+ self.assertEqual(result.status_code, 200)+ m.assert_not_called()++ customer = Customer.objects.create(realm=get_realm("zulip"))+ Session.objects.create(+ stripe_session_id="stripe_session_id",+ customer=customer,+ type=Session.UPGRADE_FROM_BILLING_PAGE,+ )++ self.assert_length(Event.objects.all(), 0)+ with patch("corporate.views.webhook.handle_checkout_session_completed_event") as m:+ result = self.client_post(+ "/stripe/webhook/",+ valid_session_event_data,+ content_type="application/json",+ )+ [event] = Event.objects.all()+ self.assertEqual(result.status_code, 200)+ strip_event = stripe.Event.construct_from(valid_session_event_data, stripe.api_key)+ m.assert_called_once_with(strip_event.data.object, event)++ with patch("corporate.views.webhook.handle_checkout_session_completed_event") as m:+ result = self.client_post(+ "/stripe/webhook/",+ valid_session_event_data,+ content_type="application/json",+ )+ self.assert_length(Event.objects.all(), 1)+ self.assertEqual(result.status_code, 200)+ m.assert_not_called()++ def test_stripe_webhook_for_payment_intent_events(self) -> None:+ customer = Customer.objects.create(realm=get_realm("zulip"))++ for index, event_type in enumerate(+ ["payment_intent.succeeded", "payment_intent.payment_failed"]+ ):+ handler_function_name = "handle_" + event_type.replace(".", "_") + "_event"+ handler_function_path = f"corporate.views.webhook.{handler_function_name}"++ stripe_event_id = f"stripe_event_id_{index}"+ stripe_payment_intent_id = f"stripe_payment_intent_id{index}"++ valid_session_event_data = {+ "id": stripe_event_id,+ "type": event_type,+ "data": {"object": {"object": "payment_intent", "id": stripe_payment_intent_id}},+ }++ with patch(handler_function_path) as m:+ result = self.client_post(+ "/stripe/webhook/",+ valid_session_event_data,+ content_type="application/json",+ )+ self.assert_length(Event.objects.filter(stripe_event_id=stripe_event_id), 0)+ self.assertEqual(result.status_code, 200)+ m.assert_not_called()++ PaymentIntent.objects.create(+ stripe_payment_intent_id=stripe_payment_intent_id,+ customer=customer,+ status=PaymentIntent.REQUIRES_PAYMENT_METHOD,+ )++ self.assert_length(Event.objects.filter(stripe_event_id=stripe_event_id), 0)+ with patch(handler_function_path) as m:+ result = self.client_post(+ "/stripe/webhook/",+ valid_session_event_data,+ content_type="application/json",+ )+ [event] = Event.objects.filter(stripe_event_id=stripe_event_id)+ self.assertEqual(result.status_code, 200)+ strip_event = stripe.Event.construct_from(valid_session_event_data, stripe.api_key)+ m.assert_called_once_with(strip_event.data.object, event)++ with patch(handler_function_path) as m:+ result = self.client_post(+ "/stripe/webhook/",+ valid_session_event_data,+ content_type="application/json",+ )+ self.assert_length(Event.objects.filter(stripe_event_id=stripe_event_id), 1)+ self.assertEqual(result.status_code, 200)+ m.assert_not_called()+++class EventStatusTest(StripeTestCase):+ def test_event_status_json_endpoint_errors(self) -> None:+ self.login_user(self.example_user("iago"))++ response = self.client_get("/json/billing/event/status")+ self.assert_json_error_contains(response, "No customer for this organization!")++ Customer.objects.create(realm=get_realm("zulip"), stripe_customer_id="cus_123")+ response = self.client_get(+ "/json/billing/event/status", {"stripe_session_id": "invalid_session_id"}+ )+ self.assert_json_error_contains(response, "Session not found")++ response = self.client_get(+ "/json/billing/event/status", {"stripe_payment_intent_id": "invalid_payment_intent_id"}+ )+ self.assert_json_error_contains(response, "Payment intent not found")++ response = self.client_get(+ "/json/billing/event/status",+ )+ self.assert_json_error_contains(+ response, "Pass stripe_session_id or stripe_payment_intent_id"+ )++ def test_event_status_page(self) -> None:+ self.login_user(self.example_user("polonius"))++ stripe_session_id = "cs_test_9QCz62mPTJQUwvhcwZHBpJMHmMZiLU512AQHU9g5znkx6NweU3j7kJvY"+ response = self.client_get(+ "/billing/event_status/", {"stripe_session_id": stripe_session_id}+ )+ self.assert_in_success_response([f'data-stripe-session-id="{stripe_session_id}"'], response)++ stripe_payment_intent_id = "pi_1JGLpnA4KHR4JzRvUfkF9Tn7"+ response = self.client_get(+ "/billing/event_status/", {"stripe_payment_intent_id": stripe_payment_intent_id}+ )+ self.assert_in_success_response(+ [f'data-stripe-payment-intent-id="{stripe_payment_intent_id}"'], response+ )+++class RequiresBillingAccessTest(StripeTestCase):+ def setUp(self, *mocks: Mock) -> None:super().setUp()hamlet = self.example_user("hamlet")hamlet.is_billing_admin = True@@ -3118,81 +4002,87 @@ class RequiresBillingAccessTest(ZulipTestCase):desdemona.role = UserProfile.ROLE_REALM_OWNERdesdemona.save(update_fields=["role"])- def test_who_can_access_json_endpoints(self) -> None:- # Billing admins have access- self.login_user(self.example_user("hamlet"))- with patch("corporate.views.billing_page.do_replace_payment_source") as mocked1:- response = self.client_post("/json/billing/sources/change", {"stripe_token": "token"})- self.assert_json_success(response)- mocked1.assert_called_once()+ def test_json_endpoints_permissions(self) -> None:+ guest = self.example_user("polonius")+ member = self.example_user("othello")+ realm_admin = self.example_user("iago")- # Realm owners have access, even if they are not billing admins- self.login_user(self.example_user("desdemona"))- with patch("corporate.views.billing_page.do_replace_payment_source") as mocked2:- response = self.client_post("/json/billing/sources/change", {"stripe_token": "token"})- self.assert_json_success(response)- mocked2.assert_called_once()+ billing_admin = self.example_user("hamlet")+ billing_admin.is_billing_admin = True+ billing_admin.save(update_fields=["is_billing_admin"])- def test_who_cant_access_json_endpoints(self) -> None:- def verify_user_cant_access_endpoint(- username: str,- endpoint: str,- method: str,- request_data: Dict[str, Union[str, int]],+ tested_endpoints = set()++ def check_users_cant_access(+ users: List[UserProfile],error_message: str,+ url: str,+ method: str,+ data: Dict[str, Any],) -> None:+ tested_endpoints.add(url)+ for user in users:+ self.login_user(user)+ if method == "POST":+ client_func: Any = self.client_post+ elif method == "GET":+ client_func = self.client_get+ else:+ client_func = self.client_patch+ result = client_func(+ url,+ data,+ content_type="application/json",+ )+ self.assert_json_error_contains(result, error_message)- self.login_user(self.example_user(username))- if method == "POST":- response = self.client_post(endpoint, request_data)- elif method == "PATCH":- response = self.client_patch(endpoint, request_data)- else:- raise AssertionError("Invalid method")- self.assert_json_error_contains(response, error_message)-- verify_user_cant_access_endpoint(- "polonius",+ check_users_cant_access(+ [guest],+ "Must be an organization member","/json/billing/upgrade","POST",- {- "billing_modality": "charge_automatically",- "schedule": "annual",- "signed_seat_count": "signed count",- "salt": "salt",- },- "Must be an organization member",+ {},)- verify_user_cant_access_endpoint(- "polonius",+ check_users_cant_access(+ [guest],+ "Must be an organization member","/json/billing/sponsorship","POST",- {- "organization-type": "event",- "description": "event description",- "website": "example.com",- },- "Must be an organization member",+ {},)- for username in ["cordelia", "iago"]:- self.login_user(self.example_user(username))- verify_user_cant_access_endpoint(- username,- "/json/billing/sources/change",- "POST",- {"stripe_token": "token"},- "Must be a billing administrator or an organization owner",- )+ check_users_cant_access(+ [guest, member, realm_admin],+ "Must be a billing administrator or an organization owner",+ "/json/billing/plan",+ "PATCH",+ {},+ )- verify_user_cant_access_endpoint(- username,- "/json/billing/plan",- "PATCH",- {"status": 1},- "Must be a billing administrator or an organization owner",- )+ check_users_cant_access(+ [guest, member, realm_admin],+ "Must be a billing administrator or an organization owner",+ "/json/billing/session/start_card_update_session",+ "POST",+ {},+ )++ check_users_cant_access(+ [guest],+ "Must be an organization member",+ "/json/billing/session/start_retry_payment_intent_session",+ "POST",+ {},+ )++ check_users_cant_access(+ [guest],+ "Must be an organization member",+ "/json/billing/event/status",+ "GET",+ {},+ )# Make sure that we are testing all the JSON endpoints# Quite a hack, but probably fine for now@@ -3200,7 +4090,40 @@ class RequiresBillingAccessTest(ZulipTestCase):json_endpoints = {word.strip("\"'()[],$") for word in string_with_all_endpoints.split() if "json/" in word}- self.assert_length(json_endpoints, 4)+ self.assert_length(json_endpoints, len(tested_endpoints))++ @mock_stripe()+ def test_billing_page_permissions(self, *mocks: Mock) -> None:+ # Guest users can't access /upgrade page+ self.login_user(self.example_user("polonius"))+ response = self.client_get("/upgrade/", follow=True)+ self.assertEqual(response.status_code, 404)++ # Check that non-admins can access /upgrade via /billing, when there is no Customer object+ self.login_user(self.example_user("hamlet"))+ response = self.client_get("/billing/")+ self.assertEqual(response.status_code, 302)+ self.assertEqual("/upgrade/", response.url)+ # Check that non-admins can sign up and pay+ self.upgrade()+ # Check that the non-admin hamlet can still access /billing+ response = self.client_get("/billing/")+ self.assert_in_success_response(["Your current plan is"], response)++ # Check realm owners can access billing, even though they are not a billing admin+ desdemona = self.example_user("desdemona")+ desdemona.role = UserProfile.ROLE_REALM_OWNER+ desdemona.save(update_fields=["role"])+ self.login_user(self.example_user("desdemona"))+ response = self.client_get("/billing/")+ self.assert_in_success_response(["Your current plan is"], response)++ # Check that member who is not a billing admin does not have access+ self.login_user(self.example_user("cordelia"))+ response = self.client_get("/billing/")+ self.assert_in_success_response(+ ["You must be an organization owner or a billing administrator"], response+ )class BillingHelpersTest(ZulipTestCase):@@ -3349,7 +4272,7 @@ class BillingHelpersTest(ZulipTestCase):with patch("corporate.lib.stripe.do_create_stripe_customer", return_value="returned") as mocked1:- returned = update_or_create_stripe_customer(user, stripe_token="token")+ returned = update_or_create_stripe_customer(user, payment_method="payment_method_id")mocked1.assert_called_once()self.assertEqual(returned, "returned")@@ -3358,14 +4281,14 @@ class BillingHelpersTest(ZulipTestCase):with patch("corporate.lib.stripe.do_create_stripe_customer", return_value="returned") as mocked2:- returned = update_or_create_stripe_customer(user, stripe_token="token")+ returned = update_or_create_stripe_customer(user, payment_method="payment_method_id")mocked2.assert_called_once()self.assertEqual(returned, "returned")customer.stripe_customer_id = "cus_12345"customer.save()# Customer exists, replace payment source- with patch("corporate.lib.stripe.do_replace_payment_source") as mocked3:+ with patch("corporate.lib.stripe.do_replace_payment_method") as mocked3:returned_customer = update_or_create_stripe_customer(self.example_user("hamlet"), "token")@@ -3373,7 +4296,7 @@ class BillingHelpersTest(ZulipTestCase):self.assertEqual(returned_customer, customer)# Customer exists, do nothing- with patch("corporate.lib.stripe.do_replace_payment_source") as mocked4:+ with patch("corporate.lib.stripe.do_replace_payment_method") as mocked4:returned_customer = update_or_create_stripe_customer(self.example_user("hamlet"), None)mocked4.assert_not_called()self.assertEqual(returned_customer, customer)@@ -3478,7 +4401,7 @@ class BillingHelpersTest(ZulipTestCase):class LicenseLedgerTest(StripeTestCase):def test_add_plan_renewal_if_needed(self) -> None:with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)self.assertEqual(LicenseLedger.objects.count(), 1)plan = CustomerPlan.objects.get()# Plan hasn't renewed yet@@ -3508,7 +4431,7 @@ class LicenseLedgerTest(StripeTestCase):update_license_ledger_if_needed(realm, self.now)self.assertFalse(LicenseLedger.objects.exists())# Test plan not automanaged- self.local_upgrade(self.seat_count + 1, False, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count + 1, False, CustomerPlan.ANNUAL, True, False)plan = CustomerPlan.objects.get()self.assertEqual(LicenseLedger.objects.count(), 1)self.assertEqual(plan.licenses(), self.seat_count + 1)@@ -3530,7 +4453,7 @@ class LicenseLedgerTest(StripeTestCase):def test_update_license_ledger_for_automanaged_plan(self) -> None:realm = get_realm("zulip")with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)plan = CustomerPlan.objects.first()assert plan is not Noneself.assertEqual(plan.licenses(), self.seat_count)@@ -3579,7 +4502,7 @@ class LicenseLedgerTest(StripeTestCase):realm = get_realm("zulip")with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count + 1, False, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count + 1, False, CustomerPlan.ANNUAL, True, False)plan = get_current_plan_by_realm(realm)assert plan is not None@@ -3635,7 +4558,7 @@ class LicenseLedgerTest(StripeTestCase):update_license_ledger_for_manual_plan(plan, self.now)def test_user_changes(self) -> None:- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)user = do_create_user("email", "password", get_realm("zulip"), "name", acting_user=None)do_deactivate_user(user, acting_user=None)do_reactivate_user(user, acting_user=None)@@ -3660,7 +4583,7 @@ class LicenseLedgerTest(StripeTestCase):class InvoiceTest(StripeTestCase):def test_invoicing_status_is_started(self) -> None:- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)plan = CustomerPlan.objects.first()assert plan is not Noneplan.invoicing_status = CustomerPlan.STARTED@@ -3669,7 +4592,7 @@ class InvoiceTest(StripeTestCase):invoice_plan(assert_is_not_none(CustomerPlan.objects.first()), self.now)def test_invoice_plan_without_stripe_customer(self) -> None:- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL)+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, False, False)plan = get_current_plan_by_realm(get_realm("zulip"))assert plan and plan.customerplan.customer.stripe_customer_id = None@@ -3780,7 +4703,7 @@ class InvoiceTest(StripeTestCase):def test_no_invoice_needed(self) -> None:with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)plan = CustomerPlan.objects.first()assert plan is not Noneself.assertEqual(plan.next_invoice_date, self.next_month)@@ -3793,7 +4716,7 @@ class InvoiceTest(StripeTestCase):def test_invoice_plans_as_needed(self) -> None:with patch("corporate.lib.stripe.timezone_now", return_value=self.now):- self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, "token")+ self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)plan = CustomerPlan.objects.first()assert plan is not Noneself.assertEqual(plan.next_invoice_date, self.next_month)diff --git a/corporate/urls.py b/corporate/urls.pyindex 4fae5b72d1d..a0edfa0506a 100644--- a/corporate/urls.py+++ b/corporate/urls.py@@ -4,9 +4,15 @@ from django.conf.urls import includefrom django.urls import pathfrom django.views.generic import TemplateView-from corporate.views.billing_page import billing_home, replace_payment_source, update_plan+from corporate.views.billing_page import billing_home, update_plan+from corporate.views.event_status import event_status, event_status_page+from corporate.views.session import (+ start_card_update_stripe_session,+ start_retry_payment_intent_session,+)from corporate.views.support import support_requestfrom corporate.views.upgrade import initial_upgrade, sponsorship, upgrade+from corporate.views.webhook import stripe_webhookfrom zerver.lib.rest import rest_pathi18n_urlpatterns: Any = [@@ -15,16 +21,23 @@ i18n_urlpatterns: Any = [path("zephyr-mirror/", TemplateView.as_view(template_name="corporate/zephyr-mirror.html")),path("jobs/", TemplateView.as_view(template_name="corporate/jobs.html")),# Billing- path("billing/", billing_home),+ path("billing/", billing_home, name="billing_home"),path("upgrade/", initial_upgrade, name="initial_upgrade"),path("support/", support_request),+ path("billing/event_status/", event_status_page, name="event_status_page"),+ path("stripe/webhook/", stripe_webhook, name="stripe_webhook"),]v1_api_and_json_patterns = [rest_path("billing/upgrade", POST=upgrade),rest_path("billing/sponsorship", POST=sponsorship),rest_path("billing/plan", PATCH=update_plan),- rest_path("billing/sources/change", POST=replace_payment_source),+ rest_path("billing/session/start_card_update_session", POST=start_card_update_stripe_session),+ rest_path(+ "billing/session/start_retry_payment_intent_session",+ POST=start_retry_payment_intent_session,+ ),+ rest_path("billing/event/status", GET=event_status),]# Make a copy of i18n_urlpatterns so that they appear without prefix for Englishdiff --git a/corporate/views/billing_page.py b/corporate/views/billing_page.pyindex f4d105b873d..3dad1ea04dd 100644--- a/corporate/views/billing_page.py+++ b/corporate/views/billing_page.py@@ -1,5 +1,5 @@import logging-from typing import Any, Dict, Optional, Union+from typing import Any, Dict, Optionalimport stripefrom django.conf import settings@@ -10,10 +10,8 @@ from django.utils.timezone import now as timezone_nowfrom django.utils.translation import gettext as _from corporate.lib.stripe import (- STRIPE_PUBLISHABLE_KEY,cents_to_dollar_string,do_change_plan_status,- do_replace_payment_source,downgrade_at_the_end_of_billing_cycle,downgrade_now_without_creating_additional_invoices,get_latest_seat_count,@@ -42,17 +40,16 @@ billing_logger = logging.getLogger("corporate.stripe")# Should only be called if the customer is being charged automaticallydef payment_method_string(stripe_customer: stripe.Customer) -> str:- stripe_source: Optional[Union[stripe.Card, stripe.Source]] = stripe_customer.default_source- # In case of e.g. an expired card- if stripe_source is None: # nocoverage+ default_payment_method = stripe_customer.invoice_settings.default_payment_method+ if default_payment_method is None:return _("No payment method on file")- if stripe_source.object == "card":- assert isinstance(stripe_source, stripe.Card)++ if default_payment_method.type == "card":return _("{brand} ending in {last4}").format(- brand=stripe_source.brand,- last4=stripe_source.last4,+ brand=default_payment_method.card.brand,+ last4=default_payment_method.card.last4,)- # There might be one-off stuff we do for a particular customer that+ # There might be oneoff stuff we do for a particular customer that# would land them here. E.g. by default we don't support ACH for# automatic payments, but in theory we could add it for a customer via# the Stripe dashboard.@@ -144,7 +141,6 @@ def billing_home(renewal_amount=cents_to_dollar_string(renewal_cents),payment_method=payment_method,charge_automatically=charge_automatically,- publishable_key=STRIPE_PUBLISHABLE_KEY,stripe_email=stripe_customer.email,CustomerPlan=CustomerPlan,onboarding=onboarding,@@ -251,14 +247,3 @@ def update_plan(return json_success()raise JsonableError(_("Nothing to change."))---@require_billing_access-@has_request_variables-def replace_payment_source(- request: HttpRequest,- user: UserProfile,- stripe_token: str = REQ(),-) -> HttpResponse:- do_replace_payment_source(user, stripe_token, pay_invoices=True)- return json_success()diff --git a/corporate/views/event_status.py b/corporate/views/event_status.pynew file mode 100644index 00000000000..1f9a02f6be9--- /dev/null+++ b/corporate/views/event_status.py@@ -0,0 +1,63 @@+import logging+from typing import Optional++from django.http import HttpRequest, HttpResponse+from django.shortcuts import render+from django.utils.translation import gettext as _++from corporate.models import PaymentIntent, Session, get_customer_by_realm+from zerver.decorator import require_organization_member, zulip_login_required+from zerver.lib.exceptions import JsonableError+from zerver.lib.request import REQ, has_request_variables+from zerver.lib.response import json_success+from zerver.models import UserProfile++billing_logger = logging.getLogger("corporate.stripe")+++@require_organization_member+@has_request_variables+def event_status(+ request: HttpRequest,+ user: UserProfile,+ stripe_session_id: Optional[str] = REQ(default=None),+ stripe_payment_intent_id: Optional[str] = REQ(default=None),+) -> HttpResponse:+ customer = get_customer_by_realm(user.realm)+ if customer is None:+ raise JsonableError(_("No customer for this organization!"))++ if stripe_session_id is not None:+ try:+ session = Session.objects.get(stripe_session_id=stripe_session_id, customer=customer)+ except Session.DoesNotExist:+ raise JsonableError(_("Session not found"))++ if session.type == Session.CARD_UPDATE_FROM_BILLING_PAGE and not user.has_billing_access:+ raise JsonableError(_("Must be a billing administrator or an organization owner"))+ return json_success(data={"session": session.to_dict()})++ if stripe_payment_intent_id is not None:+ payment_intent = PaymentIntent.objects.filter(+ stripe_payment_intent_id=stripe_payment_intent_id,+ customer=customer,+ ).last()++ if payment_intent is None:+ raise JsonableError(_("Payment intent not found"))+ return json_success(data={"payment_intent": payment_intent.to_dict()})+ raise JsonableError(_("Pass stripe_session_id or stripe_payment_intent_id"))+++@zulip_login_required+@has_request_variables+def event_status_page(+ request: HttpRequest,+ stripe_session_id: str = REQ(default=""),+ stripe_payment_intent_id: str = REQ(default=""),+) -> HttpResponse:+ context = {+ "stripe_session_id": stripe_session_id,+ "stripe_payment_intent_id": stripe_payment_intent_id,+ }+ return render(request, "corporate/event_status.html", context=context)diff --git a/corporate/views/session.py b/corporate/views/session.pynew file mode 100644index 00000000000..15a24126a55--- /dev/null+++ b/corporate/views/session.py@@ -0,0 +1,95 @@+import logging++import stripe+from django.http import HttpRequest, HttpResponse+from django.utils.translation import gettext as _++from corporate.models import PaymentIntent, Session, get_customer_by_realm+from zerver.decorator import require_billing_access, require_organization_member+from zerver.lib.exceptions import JsonableError+from zerver.lib.request import REQ, has_request_variables+from zerver.lib.response import json_success+from zerver.models import UserProfile++billing_logger = logging.getLogger("corporate.stripe")+++@require_billing_access+@has_request_variables+def start_card_update_stripe_session(request: HttpRequest, user: UserProfile) -> HttpResponse:+ customer = get_customer_by_realm(user.realm)+ assert customer+ stripe_session = stripe.checkout.Session.create(+ cancel_url=f"{user.realm.uri}/billing/",+ customer=customer.stripe_customer_id,+ metadata={+ "type": "card_update",+ },+ mode="setup",+ payment_method_types=["card"],+ success_url=f"{user.realm.uri}/billing/event_status?stripe_session_id={{CHECKOUT_SESSION_ID}}",+ )+ Session.objects.create(+ stripe_session_id=stripe_session.id,+ customer=customer,+ type=Session.CARD_UPDATE_FROM_BILLING_PAGE,+ )+ return json_success(+ data={+ "stripe_session_url": stripe_session.url,+ "stripe_session_id": stripe_session.id,+ }+ )+++@require_organization_member+@has_request_variables+def start_retry_payment_intent_session(+ request: HttpRequest, user: UserProfile, stripe_payment_intent_id: str = REQ()+) -> HttpResponse:+ customer = get_customer_by_realm(user.realm)+ if customer is None:+ raise JsonableError(_("Please create a customer first."))++ try:+ payment_intent = PaymentIntent.objects.get(+ stripe_payment_intent_id=stripe_payment_intent_id, customer=customer+ )+ except PaymentIntent.DoesNotExist:+ raise JsonableError(_("Invalid payment intent id."))++ stripe_payment_intent = stripe.PaymentIntent.retrieve(stripe_payment_intent_id)++ if stripe_payment_intent.status == "succeeded":+ raise JsonableError(_("Payment already succeeded."))++ if (+ stripe_payment_intent.status == "processing"+ ): # nocoverage: Hard to arrive at this state using card+ raise JsonableError(_("Payment processing."))++ metadata = stripe_payment_intent.metadata+ stripe_session = stripe.checkout.Session.create(+ cancel_url=f"{user.realm.uri}/upgrade/",+ customer=customer.stripe_customer_id,+ metadata=metadata,+ setup_intent_data={"metadata": metadata},+ mode="setup",+ payment_method_types=["card"],+ success_url=f"{user.realm.uri}/billing/event_status?stripe_session_id={{CHECKOUT_SESSION_ID}}",+ )+ session = Session.objects.create(+ stripe_session_id=stripe_session.id,+ customer=customer,+ type=Session.RETRY_UPGRADE_WITH_ANOTHER_PAYMENT_METHOD,+ )++ session.payment_intent = payment_intent+ session.save(update_fields=["payment_intent"])+ session.save()+ return json_success(+ data={+ "stripe_session_id": stripe_session.id,+ "stripe_session_url": stripe_session.url,+ }+ )diff --git a/corporate/views/upgrade.py b/corporate/views/upgrade.pyindex df603304adc..d3462810b56 100644--- a/corporate/views/upgrade.py+++ b/corporate/views/upgrade.py@@ -2,6 +2,7 @@ import loggingfrom decimal import Decimalfrom typing import Any, Dict, Optional+import stripefrom django import formsfrom django.conf import settingsfrom django.core import signing@@ -13,19 +14,24 @@ from django.urls import reversefrom corporate.lib.stripe import (DEFAULT_INVOICE_DAYS_UNTIL_DUE,MIN_INVOICED_LICENSES,- STRIPE_PUBLISHABLE_KEY,BillingError,+ compute_plan_parameters,+ ensure_realm_does_not_have_active_plan,get_latest_seat_count,+ is_free_trial_offer_enabled,is_sponsored_realm,process_initial_upgrade,sign_string,unsign_string,+ update_or_create_stripe_customer,update_sponsorship_status,validate_licenses,)from corporate.lib.support import get_support_urlfrom corporate.models import (CustomerPlan,+ PaymentIntent,+ Session,ZulipSponsorshipRequest,get_current_plan_by_customer,get_customer_by_realm,@@ -58,23 +64,87 @@ def check_upgrade_parameters(schedule: str,license_management: Optional[str],licenses: Optional[int],- has_stripe_token: bool,seat_count: int,) -> None:if billing_modality not in VALID_BILLING_MODALITY_VALUES: # nocoverage- raise BillingError("unknown billing_modality")+ raise BillingError("unknown billing_modality", "")if schedule not in VALID_BILLING_SCHEDULE_VALUES: # nocoverageraise BillingError("unknown schedule")if license_management not in VALID_LICENSE_MANAGEMENT_VALUES: # nocoverageraise BillingError("unknown license_management")+ validate_licenses(billing_modality == "charge_automatically", licenses, seat_count)- charge_automatically = False- if billing_modality == "charge_automatically":- charge_automatically = True- if not has_stripe_token:- raise BillingError("autopay with no card")- validate_licenses(charge_automatically, licenses, seat_count)+def setup_upgrade_checkout_session_and_payment_intent(+ user: UserProfile,+ seat_count: int,+ licenses: int,+ license_management: str,+ billing_schedule: int,+ billing_modality: str,+ onboarding: bool,+) -> stripe.checkout.Session:+ customer = update_or_create_stripe_customer(user)+ assert customer is not None # for mypy+ free_trial = is_free_trial_offer_enabled()+ _, _, _, price_per_license = compute_plan_parameters(+ CustomerPlan.STANDARD,+ license_management == "automatic",+ billing_schedule,+ customer.default_discount,+ free_trial,+ )+ metadata = {+ "billing_modality": billing_modality,+ "billing_schedule": billing_schedule,+ "licenses": licenses,+ "license_management": license_management,+ "price_per_license": price_per_license,+ "seat_count": seat_count,+ "type": "upgrade",+ "user_email": user.delivery_email,+ "realm_id": user.realm.id,+ "realm_str": user.realm.string_id,+ }+ if free_trial:+ if onboarding:+ session_type = Session.FREE_TRIAL_UPGRADE_FROM_ONBOARDING_PAGE+ else:+ session_type = Session.FREE_TRIAL_UPGRADE_FROM_BILLING_PAGE+ payment_intent = None+ else:+ session_type = Session.UPGRADE_FROM_BILLING_PAGE+ stripe_payment_intent = stripe.PaymentIntent.create(+ amount=price_per_license * licenses,+ currency="usd",+ customer=customer.stripe_customer_id,+ description=f"Upgrade to Zulip Standard, ${price_per_license/100} x {licenses}",+ receipt_email=user.delivery_email,+ confirm=False,+ statement_descriptor="Zulip Standard",+ metadata=metadata,+ )+ payment_intent = PaymentIntent.objects.create(+ customer=customer,+ stripe_payment_intent_id=stripe_payment_intent.id,+ status=PaymentIntent.get_status_integer_from_status_text(stripe_payment_intent.status),+ )+ stripe_session = stripe.checkout.Session.create(+ cancel_url=f"{user.realm.uri}/upgrade/",+ customer=customer.stripe_customer_id,+ mode="setup",+ payment_method_types=["card"],+ metadata=metadata,+ setup_intent_data={"metadata": metadata},+ success_url=f"{user.realm.uri}/billing/event_status?stripe_session_id={{CHECKOUT_SESSION_ID}}",+ )+ session = Session.objects.create(+ customer=customer, stripe_session_id=stripe_session.id, type=session_type+ )+ if payment_intent is not None:+ session.payment_intent = payment_intent+ session.save(update_fields=["payment_intent"])+ return stripe_session@require_organization_member@@ -86,13 +156,13 @@ def upgrade(schedule: str = REQ(str_validator=check_string_in(VALID_BILLING_SCHEDULE_VALUES)),signed_seat_count: str = REQ(),salt: str = REQ(),+ onboarding: bool = REQ(default=False, json_validator=check_bool),license_management: Optional[str] = REQ(default=None, str_validator=check_string_in(VALID_LICENSE_MANAGEMENT_VALUES)),licenses: Optional[int] = REQ(json_validator=check_int, default=None),- stripe_token: Optional[str] = REQ(default=None),) -> HttpResponse:-+ ensure_realm_does_not_have_active_plan(user.realm)try:seat_count = unsign_seat_count(signed_seat_count, salt)if billing_modality == "charge_automatically" and license_management == "automatic":@@ -101,43 +171,61 @@ def upgrade(schedule = "annual"license_management = "manual"check_upgrade_parameters(- billing_modality,- schedule,- license_management,- licenses,- stripe_token is not None,- seat_count,+ billing_modality, schedule, license_management, licenses, seat_count)- assert licenses is not None+ assert licenses is not None and license_management is not Noneautomanage_licenses = license_management == "automatic"+ charge_automatically = billing_modality == "charge_automatically"billing_schedule = {"annual": CustomerPlan.ANNUAL, "monthly": CustomerPlan.MONTHLY}[schedule]- process_initial_upgrade(user, licenses, automanage_licenses, billing_schedule, stripe_token)- except BillingError as e:- if not settings.TEST_SUITE: # nocoverage- billing_logger.warning(- "BillingError during upgrade: %s. user=%s, realm=%s (%s), billing_modality=%s, "- "schedule=%s, license_management=%s, licenses=%s, has stripe_token: %s",- e.error_description,- user.id,- user.realm.id,- user.realm.string_id,- billing_modality,- schedule,+ if charge_automatically:+ stripe_checkout_session = setup_upgrade_checkout_session_and_payment_intent(+ user,+ seat_count,+ licenses,license_management,+ billing_schedule,+ billing_modality,+ onboarding,+ )+ return json_success(+ data={+ "stripe_session_url": stripe_checkout_session.url,+ "stripe_session_id": stripe_checkout_session.id,+ }+ )+ else:+ process_initial_upgrade(+ user,licenses,- stripe_token is not None,+ automanage_licenses,+ billing_schedule,+ False,+ is_free_trial_offer_enabled(),)- raise+ return json_success(data={})++ except BillingError as e:+ billing_logger.warning(+ "BillingError during upgrade: %s. user=%s, realm=%s (%s), billing_modality=%s, "+ "schedule=%s, license_management=%s, licenses=%s",+ e.error_description,+ user.id,+ user.realm.id,+ user.realm.string_id,+ billing_modality,+ schedule,+ license_management,+ licenses,+ )+ raise eexcept Exception:billing_logger.exception("Uncaught exception in billing:", stack_info=True)error_message = BillingError.CONTACT_SUPPORT.format(email=settings.ZULIP_ADMINISTRATOR)error_description = "uncaught exception during upgrade"raise BillingError(error_description, error_message)- else:- return json_success()@zulip_login_required@@ -172,7 +260,6 @@ def initial_upgrade(signed_seat_count, salt = sign_string(str(seat_count))context: Dict[str, Any] = {"realm": user.realm,- "publishable_key": STRIPE_PUBLISHABLE_KEY,"email": user.delivery_email,"seat_count": seat_count,"signed_seat_count": signed_seat_count,diff --git a/corporate/views/webhook.py b/corporate/views/webhook.pynew file mode 100644index 00000000000..1eed6e10392--- /dev/null+++ b/corporate/views/webhook.py@@ -0,0 +1,98 @@+import json+import logging++import stripe+from django.conf import settings+from django.contrib.contenttypes.models import ContentType+from django.http import HttpRequest, HttpResponse+from django.views.decorators.csrf import csrf_exempt++from corporate.lib.stripe_event_handler import (+ handle_checkout_session_completed_event,+ handle_payment_intent_payment_failed_event,+ handle_payment_intent_succeeded_event,+)+from corporate.models import Event, PaymentIntent, Session+from zproject.config import get_secret++billing_logger = logging.getLogger("corporate.stripe")+++@csrf_exempt+def stripe_webhook(request: HttpRequest) -> HttpResponse:+ stripe_webhook_endpoint_secret = get_secret("stripe_webhook_endpoint_secret", "")+ if (+ stripe_webhook_endpoint_secret and not settings.TEST_SUITE+ ): # nocoverage: We can't verify the signature in test suite since we fetch the events+ # from Stripe events API and manually post to the webhook endpoint.+ try:+ stripe_event = stripe.Webhook.construct_event(+ request.body,+ request.META.get("HTTP_STRIPE_SIGNATURE"),+ stripe_webhook_endpoint_secret,+ )+ except ValueError:+ return HttpResponse(status=400)+ except stripe.error.SignatureVerificationError:+ return HttpResponse(status=400)+ else:+ assert not settings.PRODUCTION+ try:+ stripe_event = stripe.Event.construct_from(json.loads(request.body), stripe.api_key)+ except Exception:+ return HttpResponse(status=400)++ if stripe_event.type not in [+ "checkout.session.completed",+ "payment_intent.succeeded",+ "payment_intent.payment_failed",+ ]:+ return HttpResponse(status=200)++ if Event.objects.filter(stripe_event_id=stripe_event.id).exists():+ return HttpResponse(status=200)++ event = Event(stripe_event_id=stripe_event.id, type=stripe_event.type)++ if stripe_event.type == "checkout.session.completed":+ stripe_session = stripe_event.data.object+ assert isinstance(stripe_session, stripe.checkout.Session)+ try:+ session = Session.objects.get(stripe_session_id=stripe_session.id)+ except Session.DoesNotExist:+ return HttpResponse(status=200)+ event.content_type = ContentType.objects.get_for_model(Session)+ event.object_id = session.id+ event.save()+ handle_checkout_session_completed_event(stripe_session, event)+ elif stripe_event.type == "payment_intent.succeeded":+ stripe_payment_intent = stripe_event.data.object+ assert isinstance(stripe_payment_intent, stripe.PaymentIntent)+ try:+ payment_intent = PaymentIntent.objects.get(+ stripe_payment_intent_id=stripe_payment_intent.id+ )+ except PaymentIntent.DoesNotExist:+ # PaymentIntent that was not manually created from the billing system.+ # Could be an Invoice getting paid which is is not an event we are interested in.+ return HttpResponse(status=200)+ event.content_type = ContentType.objects.get_for_model(PaymentIntent)+ event.object_id = payment_intent.id+ event.save()+ handle_payment_intent_succeeded_event(stripe_payment_intent, event)+ elif stripe_event.type == "payment_intent.payment_failed":+ stripe_payment_intent = stripe_event.data.object+ try:+ assert isinstance(stripe_payment_intent, stripe.PaymentIntent)+ payment_intent = PaymentIntent.objects.get(+ stripe_payment_intent_id=stripe_payment_intent.id+ )+ except PaymentIntent.DoesNotExist:+ # PaymentIntent that was not manually created from the billing system.+ # Could be an Invoice getting paid which is is not an event we are interested in.+ return HttpResponse(status=200)+ event.content_type = ContentType.objects.get_for_model(PaymentIntent)+ event.object_id = payment_intent.id+ event.save()+ handle_payment_intent_payment_failed_event(stripe_payment_intent, event)+ return HttpResponse(status=200)diff --git a/docs/subsystems/billing.md b/docs/subsystems/billing.mdindex 3057888f5e7..f895e4e385a 100644--- a/docs/subsystems/billing.md+++ b/docs/subsystems/billing.md@@ -1,20 +1,68 @@-# Billing+# Billing (Development)-Zulip uses a third party (Stripe) for billing, so working on the billing-system requires a little bit of setup.+This section deals with developing and testing the billing system.-To set up the development environment to work on the billing code:+## Common setup- Create a Stripe account+ - Make sure that the country of your Stripe account is set to USA when you create the account.+ - You might probably need to use a VPN for this.- Ensure that the [API version](https://stripe.com/docs/api/versioning) ofyour Stripe account is same as `STRIPE_API_VERSION` defined in`corporate/lib/stripe.py`. You can upgrade to a higher version fromthe Stripe dashboard.-- Go to <https://dashboard.stripe.com/account/apikeys>, and add the- publishable key and secret key as `stripe_publishable_key` and- `stripe_secret_key` to `zproject/dev-secrets.conf`.+- Set the private API key.+ - Go to <https://dashboard.stripe.com/account/apikeys>+ - Add `stripe_secret_key` to `zproject/dev-secrets.conf`.-Nearly all the billing-relevant code lives in `corporate/`.+## Manual testing++Manual testing involves testing the various flows like upgrade, card change etc manually through the browser. This is the bare minimum testing that you need to do when you review a PR or is working on adding a new feature.++### Setup++Apart from the common setup mentioned above, you also need to setup your dev environment to receive webhook events+from Stripe.++- Install Stripe CLI by following the instructions at <https://stripe.com/docs/webhooks/test> in your machine locally.+- Login to Stripe CLI by `stripe login`+- Run run the Stripe CLI to forward all the Stripe webhook events to our billing system webhook endpoint.+ `stripe listen --forward-to http://localhost:9991/stripe/webhook/`+- Wait for the `stripe listen` command in the previous step to output the webhook signing secret.+ - The signing secret would be used by our billing system to verify that the events that are sent to our webhook endpoint is sent by Stripe and not by an intruder. In production, there is no Stripe CLI, so the step for configuring this is a bit different. See the production section for more details.+- Copy the webhook signing secret and set it as `stripe_webhook_endpoint_secret` in `zproject/dev-secrets.conf`.+- The billing system is now all set to receive webhook events from Stripe.++### Test card numbers++Stripe provides various card numbers to test for specific responses from Stripe. Thee commonly used ones are mentioned in the documentation below wherever appropriate. The full list is available at <https://stripe.com/docs/testing>++### Flows to test++These are the flows that you can test manually from the browser.++- Upgrade a Zulip organization+ - Flows to test+ - When free trial is not enabled, ie `FREE_TRIAL_DAYS` is not set to any value in `dev_settings.py`. Free trial is rarely enabled. So when you are manually testing make sure that `FREE_TRIAL_DAYS` is not set to any value unless you want to test the free trial functionality.+ - Using a valid card number like `4242 4242 4242 4242`+ - Using an invalid card number like `4000000000000341` which will add the card to the Customer account but charge fails.+ - Retry the upgrade by adding a new card by clicking on the retry upgrade link.+ - Retry the upgrade from scratch.+ - Upgrade an organization when free trial is enabled. You can set `FREE_TRIAL_DAYS` to a number greater than `0` in `dev_settings.py` to enable free trial. This is a setting that is not commonly used.+ - There are two different flows to test here.+ - Right after the organization is created by following the instructions in the onboarding page.+ - Make sure that after the upgrade is complete the billing page shows a link to go to the organization.+ - By manually going to billing page and upgrading the organization.+ - What to test?+ - The flows work from start to end as expected.+ - We show appropriate success and error messages to users.+ - Charges are made or not made(free trial) as expected. You can check this through the Stripe dashboard. Though not that super important since we check these in automated tests anyway.+ - Testing that involves renewal and all is not possible through manual testing. It is taken care of in backend tests.+- Change the card+ - Flows to test+ - Go to the billing page of an organization that is upgraded using card. Then try changing the card to another valid card like `5555555555554444`.+ - Make sure that the flow completes without any error and the new card details is now shown in the billing page instead of the old card.+ - You can also try adding a card number that results in it getting attached to the customer but charges fails. But to test that you need pending invoices since we try to pay pending invoices when the card is changed. It's taken care of in backend tests so it's not super necessary to test manually.## Upgrading Stripe API versionsdiff --git a/frontend_tests/node_tests/billing.js b/frontend_tests/node_tests/billing.jsindex deddc32c700..6a7df0085fb 100644--- a/frontend_tests/node_tests/billing.js+++ b/frontend_tests/node_tests/billing.js@@ -14,10 +14,6 @@ const dom = new JSDOM(template, {pretendToBeVisual: true});const document = dom.window.document;const location = set_global("location", {});-const StripeCheckout = set_global("StripeCheckout", {- configure: () => {},-});-const helpers = mock_esm("../../static/js/billing/helpers", {set_tab: () => {},});@@ -25,91 +21,45 @@ const helpers = mock_esm("../../static/js/billing/helpers", {const billing = zrequire("billing/billing");run_test("initialize", ({override}) => {- let token_func;-let set_tab_called = false;override(helpers, "set_tab", (page_name) => {assert.equal(page_name, "billing");set_tab_called = true;});+ $.get_initialize_function()();+ assert.ok(set_tab_called);+});+run_test("card_update", ({override}) => {+ override(helpers, "set_tab", () => {});let create_ajax_request_called = false;- function card_change_ajax(- url,- form_name,- stripe_token,- ignored_inputs,- method,- success_callback,- ) {- assert.equal(url, "/json/billing/sources/change");+ function card_change_ajax(url, form_name, ignored_inputs, method, success_callback) {+ assert.equal(url, "/json/billing/session/start_card_update_session");assert.equal(form_name, "cardchange");- assert.equal(stripe_token, "stripe_token");assert.deepEqual(ignored_inputs, []);assert.equal(method, "POST");location.replace = (new_location) => {- assert.equal(new_location, "/billing");+ assert.equal(new_location, "https://stripe_session_url");};- success_callback();+ success_callback({stripe_session_url: "https://stripe_session_url"});create_ajax_request_called = true;}- let open_func_called = false;- const open_func = (config_opts) => {- assert.equal(config_opts.name, "Zulip");- assert.equal(config_opts.zipCode, true);- assert.equal(config_opts.billingAddress, true);- assert.equal(config_opts.panelLabel, "Update card");- assert.equal(config_opts.label, "Update card");- assert.equal(config_opts.allowRememberMe, false);- assert.equal(config_opts.email, "{{stripe_email}}");-- token_func("stripe_token");- open_func_called = true;- };-- let stripe_checkout_configure_called = false;- override(StripeCheckout, "configure", (config_opts) => {- assert.equal(config_opts.image, "/static/images/logo/zulip-icon-128x128.png");- assert.equal(config_opts.locale, "auto");- assert.equal(config_opts.key, "{{publishable_key}}");- token_func = config_opts.token;- stripe_checkout_configure_called = true;-- return {- open: open_func,- };- });-- $("#payment-method").data = (key) =>- document.querySelector("#payment-method").getAttribute("data-" + key);-$.get_initialize_function()();- assert.ok(set_tab_called);- assert.ok(stripe_checkout_configure_called);- const e = {- preventDefault: () => {},- };const update_card_click_handler = $("#update-card-button").get_on_handler("click");with_field(helpers, "create_ajax_request", card_change_ajax, () => {- update_card_click_handler(e);+ update_card_click_handler({preventDefault: () => {}});assert.ok(create_ajax_request_called);- assert.ok(open_func_called);});+});- create_ajax_request_called = false;- function plan_change_ajax(- url,- form_name,- stripe_token,- ignored_inputs,- method,- success_callback,- ) {+run_test("planchange", ({override}) => {+ override(helpers, "set_tab", () => {});+ let create_ajax_request_called = false;+ function plan_change_ajax(url, form_name, ignored_inputs, method, success_callback) {assert.equal(url, "/json/billing/plan");assert.equal(form_name, "planchange");- assert.equal(stripe_token, undefined);assert.deepEqual(ignored_inputs, []);assert.equal(method, "PATCH");location.replace = (new_location) => {@@ -119,25 +69,22 @@ run_test("initialize", ({override}) => {create_ajax_request_called = true;}+ $.get_initialize_function()();const change_plan_status_click_handler = $("#change-plan-status").get_on_handler("click");with_field(helpers, "create_ajax_request", plan_change_ajax, () => {- change_plan_status_click_handler(e);+ change_plan_status_click_handler({preventDefault: () => {}});assert.ok(create_ajax_request_called);});+});+run_test("licensechange", ({override}) => {+ override(helpers, "set_tab", () => {});+ let create_ajax_request_called = false;create_ajax_request_called = false;- function license_change_ajax(- url,- form_name,- stripe_token,- ignored_inputs,- method,- success_callback,- ) {+ function license_change_ajax(url, form_name, ignored_inputs, method, success_callback) {assert.equal(url, "/json/billing/plan");assert.equal(form_name, "licensechange");- assert.equal(stripe_token, undefined);assert.deepEqual(ignored_inputs, ["licenses_at_next_renewal"]);assert.equal(method, "PATCH");location.replace = (new_location) => {@@ -156,10 +103,12 @@ run_test("initialize", ({override}) => {create_update_license_request_called = true;});+ $.get_initialize_function()();+const confirm_license_update_click_handler = $("#confirm-license-update-button").get_on_handler("click",);- confirm_license_update_click_handler(e);+ confirm_license_update_click_handler({preventDefault: () => {}});assert.ok(create_update_license_request_called);let confirm_license_modal_shown = false;@@ -176,13 +125,13 @@ run_test("initialize", ({override}) => {create_update_license_request_called = false;const update_licenses_button_click_handler =$("#update-licenses-button").get_on_handler("click");- update_licenses_button_click_handler(e);+ update_licenses_button_click_handler({preventDefault: () => {}});assert.ok(create_update_license_request_called);assert.ok(!confirm_license_modal_shown);$("#new_licenses_input").val = () => 25;create_update_license_request_called = false;- update_licenses_button_click_handler(e);+ update_licenses_button_click_handler({preventDefault: () => {}});assert.ok(!create_update_license_request_called);assert.ok(confirm_license_modal_shown);@@ -203,14 +152,12 @@ run_test("initialize", ({override}) => {function licenses_at_next_renewal_change_ajax(url,form_name,- stripe_token,ignored_inputs,method,success_callback,) {assert.equal(url, "/json/billing/plan");assert.equal(form_name, "licensechange");- assert.equal(stripe_token, undefined);assert.deepEqual(ignored_inputs, ["licenses"]);assert.equal(method, "PATCH");location.replace = (new_location) => {@@ -220,7 +167,7 @@ run_test("initialize", ({override}) => {create_ajax_request_called = true;}with_field(helpers, "create_ajax_request", licenses_at_next_renewal_change_ajax, () => {- update_next_renewal_licenses_button_click_handler(e);+ update_next_renewal_licenses_button_click_handler({preventDefault: () => {}});assert.ok(create_ajax_request_called);});});diff --git a/frontend_tests/node_tests/billing_helpers.js b/frontend_tests/node_tests/billing_helpers.jsindex fb1f22a9570..a08a8e68774 100644--- a/frontend_tests/node_tests/billing_helpers.js+++ b/frontend_tests/node_tests/billing_helpers.js@@ -28,11 +28,11 @@ const location = set_global("location", dom.window.location);const helpers = zrequire("billing/helpers");run_test("create_ajax_request", ({override}) => {- const form_loading_indicator = "#autopay_loading_indicator";- const form_input_section = "#autopay-input-section";- const form_success = "#autopay-success";- const form_error = "#autopay-error";- const form_loading = "#autopay-loading";+ const form_loading_indicator = "#invoice_loading_indicator";+ const form_input_section = "#invoice-input-section";+ const form_success = "#invoice-success";+ const form_error = "#invoice-error";+ const form_loading = "#invoice-loading";const zulip_limited_section = "#zulip-limited-section";const free_trial_alert_message = "#free-trial-alert-message";@@ -108,7 +108,7 @@ run_test("create_ajax_request", ({override}) => {state.free_trial_alert_message_hide += 1;};- $("#autopay-form").serializeArray = () => jquery("#autopay-form").serializeArray();+ $("#invoice-form").serializeArray = () => jquery("#invoice-form").serializeArray();let success_callback_called = false;const success_callback = (response) => {@@ -128,13 +128,11 @@ run_test("create_ajax_request", ({override}) => {assert.equal(type, "PATCH");assert.equal(url, "/json/billing/upgrade");- assert.equal(Object.keys(data).length, 7);- assert.equal(data.stripe_token, "stripe_token_id");- assert.equal(data.seat_count, "{{ seat_count }}");+ assert.equal(Object.keys(data).length, 5);assert.equal(data.signed_seat_count, "{{ signed_seat_count }}");assert.equal(data.salt, "{{ salt }}");- assert.equal(data.billing_modality, "charge_automatically");- assert.equal(data.schedule, "monthly");+ assert.equal(data.billing_modality, "send_invoice");+ assert.equal(data.schedule, "annual");assert.equal(data.licenses, "");assert.ok(!("license_management" in data));@@ -170,8 +168,7 @@ run_test("create_ajax_request", ({override}) => {helpers.create_ajax_request("/json/billing/upgrade",- "autopay",- {id: "stripe_token_id"},+ "invoice",["license_management"],"PATCH",success_callback,diff --git a/frontend_tests/node_tests/event_status.js b/frontend_tests/node_tests/event_status.jsnew file mode 100644index 00000000000..53deaa1f815--- /dev/null+++ b/frontend_tests/node_tests/event_status.js@@ -0,0 +1,345 @@+"use strict";++const {strict: assert} = require("assert");++const {set_global, zrequire, mock_esm} = require("../zjsunit/namespace");+const {run_test} = require("../zjsunit/test");+const $ = require("../zjsunit/zjquery");++const event_status = zrequire("billing/event_status");+const helpers = mock_esm("../../static/js/billing/helpers");++run_test("initialize_retry_with_another_card_link_click_handler", ({override}) => {+ override(helpers, "create_ajax_request", (url, form_name, ignored_inputs, method, callback) => {+ assert.equal(url, "/json/billing/session/start_retry_payment_intent_session");+ assert.equal(form_name, "restartsession");+ assert.deepEqual(ignored_inputs, []);+ assert.equal(method, "POST");+ set_global("window", {+ location: {+ replace: (new_location) => {+ assert.equal(new_location, "stripe_session_url");+ },+ },+ });+ callback({stripe_session_url: "stripe_session_url"});+ });+ event_status.initialize_retry_with_another_card_link_click_handler();+ const retry_click_handler = $("#retry-with-another-card-link").get_on_handler("click");+ retry_click_handler({preventDefault: () => {}});+});++run_test("check_status", async ({override}) => {+ $("#data").attr("data-stripe-session-id", "stripe_session_id");+ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_session_id: "stripe_session_id"});+ return {+ session: {+ status: "created",+ },+ };+ });+ let completed = await event_status.check_status();+ assert.ok(!completed);++ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_session_id: "stripe_session_id"});+ return {+ session: {+ status: "completed",+ event_handler: {+ status: "started",+ },+ },+ };+ });+ completed = await event_status.check_status();+ assert.ok(!completed);++ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_session_id: "stripe_session_id"});+ return {+ session: {+ status: "completed",+ type: "upgrade_from_billing_page",+ stripe_payment_intent_id: "spid_1A",+ event_handler: {+ status: "succeeded",+ },+ },+ };+ });+ set_global("setTimeout", (callback_func) => {+ callback_func();+ });+ set_global("window", {+ location: {+ replace: (new_location) => {+ assert.equal(+ new_location,+ "/billing/event_status?stripe_payment_intent_id=spid_1A",+ );+ },+ },+ });+ completed = await event_status.check_status();+ assert.ok(completed);+ assert.equal(+ $("#webhook-success").text(),+ "We have received your billing details. Attempting to create charge...",+ );++ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_session_id: "stripe_session_id"});+ return {+ session: {+ status: "completed",+ type: "retry_upgrade_with_another_payment_method",+ stripe_payment_intent_id: "spid_1B",+ event_handler: {+ status: "succeeded",+ },+ },+ };+ });+ set_global("window", {+ location: {+ replace: (new_location) => {+ assert.equal(+ new_location,+ "/billing/event_status?stripe_payment_intent_id=spid_1B",+ );+ },+ },+ });+ completed = await event_status.check_status();+ assert.ok(completed);+ assert.equal(+ $("#webhook-success").text(),+ "We have received your billing details. Attempting to create charge...",+ );++ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_session_id: "stripe_session_id"});+ return {+ session: {+ status: "completed",+ type: "free_trial_upgrade_from_billing_page",+ event_handler: {+ status: "succeeded",+ },+ },+ };+ });+ set_global("window", {+ location: {+ replace: (new_location) => {+ assert.equal(new_location, "/billing");+ },+ },+ });+ completed = await event_status.check_status();+ assert.ok(completed);+ assert.equal(+ $("#webhook-success").text(),+ "Your free trial of Zulip Standard has been activated. You would be redirected to the billing page soon.",+ );++ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_session_id: "stripe_session_id"});+ return {+ session: {+ status: "completed",+ type: "free_trial_upgrade_from_onboarding_page",+ event_handler: {+ status: "succeeded",+ },+ },+ };+ });+ set_global("window", {+ location: {+ replace: (new_location) => {+ assert.equal(new_location, "/billing?onboarding=true");+ },+ },+ });+ completed = await event_status.check_status();+ assert.ok(completed);+ assert.equal(+ $("#webhook-success").text(),+ "Your free trial of Zulip Standard has been activated. You would be redirected to the billing page soon.",+ );++ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_session_id: "stripe_session_id"});+ return {+ session: {+ status: "completed",+ type: "card_update_from_billing_page",+ event_handler: {+ status: "succeeded",+ },+ },+ };+ });+ set_global("window", {+ location: {+ replace: (new_location) => {+ assert.equal(new_location, "/billing#payment-method");+ },+ },+ });+ completed = await event_status.check_status();+ assert.ok(completed);+ assert.equal(+ $("#webhook-success").text(),+ "Your card has been updated. You would be redirected to the billing page soon.",+ );++ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_session_id: "stripe_session_id"});+ return {+ session: {+ status: "completed",+ type: "card_update_from_billing_page",+ event_handler: {+ status: "failed",+ error: {+ message: "Something went wrong.",+ },+ },+ },+ };+ });+ completed = await event_status.check_status();+ assert.ok(completed);+ assert.equal($("#webhook-error").text(), "Something went wrong.");++ $("#data").attr("data-stripe-session-id", "");+ $("#data").attr("data-stripe-payment-intent-id", "stripe_payment_intent_id");+ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_payment_intent_id: "stripe_payment_intent_id"});+ return {+ payment_intent: {+ status: "requires_payment_method",+ last_payment_error: {+ message: "Your Card was declined.",+ },+ event_handler: {+ status: "succeeded",+ },+ },+ };+ });+ completed = await event_status.check_status();+ assert.ok(completed);+ assert.equal(+ $("#webhook-error").html(),+ 'Your Card was declined.<br>You can try adding <a id="retry-with-another-card-link"> another card or </a> or retry the upgrade.',+ );+ assert.ok($("#retry-with-another-card-link").get_on_handler("click"));++ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_payment_intent_id: "stripe_payment_intent_id"});+ return {+ payment_intent: {+ status: "requires_payment_method",+ last_payment_error: {+ message: "Your Card was declined.",+ },+ event_handler: {+ status: "failed",+ error: {+ message: "Something went wrong.",+ },+ },+ },+ };+ });+ completed = await event_status.check_status();+ assert.ok(completed);+ assert.equal($("#webhook-error").text(), "Something went wrong.");++ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_payment_intent_id: "stripe_payment_intent_id"});+ return {+ payment_intent: {+ status: "requires_payment_method",+ event_handler: {+ status: "started",+ },+ },+ };+ });+ completed = await event_status.check_status();+ assert.ok(!completed);++ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_payment_intent_id: "stripe_payment_intent_id"});+ return {+ payment_intent: {+ status: "succeeded",+ event_handler: {+ status: "succeeded",+ },+ },+ };+ });+ set_global("window", {+ location: {+ replace: (new_location) => {+ assert.equal(new_location, "/billing/");+ },+ },+ });+ completed = await event_status.check_status();+ assert.ok(completed);+ assert.equal(+ $("#webhook-success").text(),+ "Charge created successfully. Your organization has been upgraded. Redirecting to billing page...",+ );++ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_payment_intent_id: "stripe_payment_intent_id"});+ return {+ payment_intent: {+ status: "succeeded",+ event_handler: {+ status: "failed",+ error: {+ message: "Something went wrong.",+ },+ },+ },+ };+ });+ completed = await event_status.check_status();+ assert.ok(completed);+ assert.equal($("#webhook-error").text(), "Something went wrong.");++ override($, "get", async (url, data) => {+ assert.equal(url, "/json/billing/event/status");+ assert.deepEqual(data, {stripe_payment_intent_id: "stripe_payment_intent_id"});+ return {+ payment_intent: {+ status: "requires_action",+ },+ };+ });+ completed = await event_status.check_status();+ assert.ok(!completed);+});diff --git a/frontend_tests/node_tests/upgrade.js b/frontend_tests/node_tests/upgrade.jsindex c445246fbf6..f6e00b2db47 100644--- a/frontend_tests/node_tests/upgrade.js+++ b/frontend_tests/node_tests/upgrade.js@@ -16,10 +16,6 @@ const dom = new JSDOM(template, {pretendToBeVisual: true});const document = dom.window.document;const location = set_global("location", {});-const StripeCheckout = set_global("StripeCheckout", {- configure: noop,-});-const helpers = zrequire("../js/billing/helpers");zrequire("../js/billing/upgrade");@@ -29,7 +25,6 @@ run_test("initialize", ({override}) => {page_params.seat_count = 8;page_params.percent_off = 20;- let token_func;override(helpers, "set_tab", (page_name) => {assert.equal(page_name, "upgrade");});@@ -37,22 +32,21 @@ run_test("initialize", ({override}) => {let create_ajax_request_form_call_count = 0;helpers.__Rewire__("create_ajax_request",- (url, form_name, stripe_token, ignored_inputs, type, success_callback) => {+ (url, form_name, ignored_inputs, type, success_callback) => {create_ajax_request_form_call_count += 1;switch (form_name) {case "autopay":assert.equal(url, "/json/billing/upgrade");- assert.equal(stripe_token, "stripe_add_card_token");assert.deepEqual(ignored_inputs, []);assert.equal(type, "POST");location.replace = (new_location) => {- assert.equal(new_location, "/billing");+ assert.equal(new_location, "https://stripe_session_url");};- success_callback();+ // mock redirectToCheckout and verify its called+ success_callback({stripe_session_url: "https://stripe_session_url"});break;case "invoice":assert.equal(url, "/json/billing/upgrade");- assert.equal(stripe_token, undefined);assert.deepEqual(ignored_inputs, []);assert.equal(type, "POST");location.replace = (new_location) => {@@ -62,7 +56,6 @@ run_test("initialize", ({override}) => {break;case "sponsorship":assert.equal(url, "/json/billing/sponsorship");- assert.equal(stripe_token, undefined);assert.deepEqual(ignored_inputs, []);assert.equal(type, "POST");location.replace = (new_location) => {@@ -76,29 +69,6 @@ run_test("initialize", ({override}) => {},);- const open_func = (config_opts) => {- assert.equal(config_opts.name, "Zulip");- assert.equal(config_opts.zipCode, true);- assert.equal(config_opts.billingAddress, true);- assert.equal(config_opts.panelLabel, "Make payment");- assert.equal(config_opts.label, "Add card");- assert.equal(config_opts.allowRememberMe, false);- assert.equal(config_opts.email, "{{ email }}");- assert.equal(config_opts.description, "Zulip Cloud Standard");- token_func("stripe_add_card_token");- };-- StripeCheckout.configure = (config_opts) => {- assert.equal(config_opts.image, "/static/images/logo/zulip-icon-128x128.png");- assert.equal(config_opts.locale, "auto");- assert.equal(config_opts.key, "{{ publishable_key }}");- token_func = config_opts.token;-- return {- open: open_func,- };- };-override(helpers, "show_license_section", (section) => {assert.equal(section, "automatic");});@@ -118,7 +88,8 @@ run_test("initialize", ({override}) => {$("#autopay-form").data = (key) =>document.querySelector("#autopay-form").getAttribute("data-" + key);- $.get_initialize_function()();+ const initialize_function = $.get_initialize_function();+ initialize_function();const e = {preventDefault: noop,@@ -197,8 +168,6 @@ run_test("initialize", ({override}) => {});run_test("autopay_form_fields", () => {- assert.equal(document.querySelector("#autopay-form").dataset.key, "{{ publishable_key }}");- assert.equal(document.querySelector("#autopay-form").dataset.email, "{{ email }}");assert.equal(document.querySelector("#autopay-form [name=seat_count]").value,"{{ seat_count }}",diff --git a/static/js/billing/billing.js b/static/js/billing/billing.jsindex 4ae00803a4b..bd982a4798a 100644--- a/static/js/billing/billing.js+++ b/static/js/billing/billing.js@@ -6,7 +6,6 @@ export function create_update_license_request() {helpers.create_ajax_request("/json/billing/plan","licensechange",- undefined,["licenses_at_next_renewal"],"PATCH",() => window.location.replace("/billing"),@@ -16,34 +15,17 @@ export function create_update_license_request() {export function initialize() {helpers.set_tab("billing");- const stripe_key = $("#payment-method").data("key");- const card_change_handler = StripeCheckout.configure({- key: stripe_key,- image: "/static/images/logo/zulip-icon-128x128.png",- locale: "auto",- token(stripe_token) {- helpers.create_ajax_request(- "/json/billing/sources/change",- "cardchange",- stripe_token,- [],- "POST",- () => window.location.replace("/billing"),- );- },- });-$("#update-card-button").on("click", (e) => {- const email = $("#payment-method").data("email");- card_change_handler.open({- name: "Zulip",- zipCode: true,- billingAddress: true,- panelLabel: "Update card",- email,- label: "Update card",- allowRememberMe: false,- });+ const success_callback = (response) => {+ window.location.replace(response.stripe_session_url);+ };+ helpers.create_ajax_request(+ "/json/billing/session/start_card_update_session",+ "cardchange",+ [],+ "POST",+ success_callback,+ );e.preventDefault();});@@ -72,7 +54,6 @@ export function initialize() {helpers.create_ajax_request("/json/billing/plan","licensechange",- undefined,["licenses"],"PATCH",() => window.location.replace("/billing"),@@ -80,13 +61,8 @@ export function initialize() {});$("#change-plan-status").on("click", (e) => {- helpers.create_ajax_request(- "/json/billing/plan",- "planchange",- undefined,- [],- "PATCH",- () => window.location.replace("/billing"),+ helpers.create_ajax_request("/json/billing/plan", "planchange", [], "PATCH", () =>+ window.location.replace("/billing"),);e.preventDefault();});diff --git a/static/js/billing/event_status.js b/static/js/billing/event_status.jsnew file mode 100644index 00000000000..ce82a69ce03--- /dev/null+++ b/static/js/billing/event_status.js@@ -0,0 +1,165 @@+import $ from "jquery";++import * as loading from "../loading";++import * as helpers from "./helpers";++function update_status_and_redirect(status_message, redirect_to) {+ $("#webhook-loading").hide();+ $("#webhook-success").show();+ $("#webhook-success").text(status_message);+ setTimeout(() => {+ window.location.replace(redirect_to);+ }, 5000);+}++function show_error_message(message) {+ $("#webhook-loading").hide();+ $("#webhook-error").show();+ $("#webhook-error").text(message);+}++function show_html_error_message(rendered_message) {+ $("#webhook-loading").hide();+ $("#webhook-error").show();+ $("#webhook-error").html(rendered_message);+}++function handle_session_complete_event(session) {+ let message = "";+ let redirect_to = "";+ switch (session.type) {+ case "upgrade_from_billing_page":+ case "retry_upgrade_with_another_payment_method":+ message = "We have received your billing details. Attempting to create charge...";+ redirect_to = `/billing/event_status?stripe_payment_intent_id=${session.stripe_payment_intent_id}`;+ break;+ case "free_trial_upgrade_from_billing_page":+ message =+ "Your free trial of Zulip Standard has been activated. You would be redirected to the billing page soon.";+ redirect_to = "/billing";+ break;+ case "free_trial_upgrade_from_onboarding_page":+ message =+ "Your free trial of Zulip Standard has been activated. You would be redirected to the billing page soon.";+ redirect_to = "/billing?onboarding=true";+ break;+ case "card_update_from_billing_page":+ message =+ "Your card has been updated. You would be redirected to the billing page soon.";+ redirect_to = "/billing#payment-method";+ }+ update_status_and_redirect(message, redirect_to);+}++async function stripe_checkout_session_status_check(stripe_session_id) {+ const response = await $.get("/json/billing/event/status", {stripe_session_id});+ if (response.session.status === "created") {+ return false;+ }+ if (response.session.event_handler.status === "started") {+ return false;+ }+ if (response.session.event_handler.status === "succeeded") {+ handle_session_complete_event(response.session);+ return true;+ }+ if (response.session.event_handler.status === "failed") {+ show_error_message(response.session.event_handler.error.message);+ return true;+ }++ return false;+}++export function initialize_retry_with_another_card_link_click_handler() {+ $("#retry-with-another-card-link").on("click", (e) => {+ e.preventDefault();+ $("#webhook-error").hide();+ helpers.create_ajax_request(+ "/json/billing/session/start_retry_payment_intent_session",+ "restartsession",+ [],+ "POST",+ (response) => {+ window.location.replace(response.stripe_session_url);+ },+ );+ });+}++export async function stripe_payment_intent_status_check(stripe_payment_intent_id) {+ const response = await $.get("/json/billing/event/status", {stripe_payment_intent_id});++ switch (response.payment_intent.status) {+ case "requires_payment_method":+ if (response.payment_intent.event_handler.status === "succeeded") {+ show_html_error_message(+ response.payment_intent.last_payment_error.message ++ "<br>" ++ 'You can try adding <a id="retry-with-another-card-link"> another card or </a> or retry the upgrade.',+ );+ initialize_retry_with_another_card_link_click_handler();+ return true;+ }+ if (response.payment_intent.event_handler.status === "failed") {+ show_error_message(response.payment_intent.event_handler.error.message);+ return true;+ }+ return false;+ case "succeeded":+ if (response.payment_intent.event_handler.status === "succeeded") {+ update_status_and_redirect(+ "Charge created successfully. Your organization has been upgraded. Redirecting to billing page...",+ "/billing/",+ );+ return true;+ }+ if (response.payment_intent.event_handler.status === "failed") {+ show_error_message(response.payment_intent.event_handler.error.message);+ return true;+ }+ return false;+ default:+ return false;+ }+}++export async function check_status() {+ if ($("#data").attr("data-stripe-session-id")) {+ return await stripe_checkout_session_status_check(+ $("#data").attr("data-stripe-session-id"),+ );+ }+ return await stripe_payment_intent_status_check(+ $("#data").attr("data-stripe-payment-intent-id"),+ );+}++async function start_status_polling() {+ let completed = false;+ try {+ completed = await check_status();+ } catch {+ setTimeout(start_status_polling, 5000);+ }+ if (!completed) {+ setTimeout(start_status_polling, 5000);+ }+}++async function initialize() {+ const form_loading = "#webhook-loading";+ const form_loading_indicator = "#webhook_loading_indicator";++ loading.make_indicator($(form_loading_indicator), {+ text: "Processing ...",+ abs_positioned: true,+ });+ $(form_loading).show();+ await start_status_polling();+}++$(() => {+ initialize();+});diff --git a/static/js/billing/helpers.js b/static/js/billing/helpers.jsindex 854746cf4e9..c9314fa72af 100644--- a/static/js/billing/helpers.js+++ b/static/js/billing/helpers.js@@ -6,7 +6,6 @@ import {page_params} from "../page_params";export function create_ajax_request(url,form_name,- stripe_token = null,ignored_inputs = [],type = "POST",success_callback,@@ -32,9 +31,6 @@ export function create_ajax_request($(free_trial_alert_message).hide();const data = {};- if (stripe_token) {- data.stripe_token = stripe_token.id;- }for (const item of form.serializeArray()) {if (ignored_inputs.includes(item.name)) {diff --git a/static/js/billing/upgrade.js b/static/js/billing/upgrade.jsindex 4b9301cf4fe..b7ecc22f222 100644--- a/static/js/billing/upgrade.js+++ b/static/js/billing/upgrade.js@@ -6,23 +6,6 @@ import * as helpers from "./helpers";export const initialize = () => {helpers.set_tab("upgrade");-- const add_card_handler = StripeCheckout.configure({- key: $("#autopay-form").data("key"),- image: "/static/images/logo/zulip-icon-128x128.png",- locale: "auto",- token(stripe_token) {- helpers.create_ajax_request(- "/json/billing/upgrade",- "autopay",- stripe_token,- [],- "POST",- () => window.location.replace("/billing"),- );- },- });-$("#add-card-button").on("click", (e) => {const license_management = $("input[type=radio][name=license_management]:checked").val();if (@@ -30,17 +13,17 @@ export const initialize = () => {) {return;}- add_card_handler.open({- name: "Zulip",- zipCode: true,- billingAddress: true,- panelLabel: "Make payment",- email: $("#autopay-form").data("email"),- label: "Add card",- allowRememberMe: false,- description: "Zulip Cloud Standard",- });e.preventDefault();+ const success_callback = (response) => {+ window.location.replace(response.stripe_session_url);+ };+ helpers.create_ajax_request(+ "/json/billing/upgrade",+ "autopay",+ [],+ "POST",+ success_callback,+ );});$("#invoice-button").on("click", (e) => {@@ -48,7 +31,7 @@ export const initialize = () => {return;}e.preventDefault();- helpers.create_ajax_request("/json/billing/upgrade", "invoice", undefined, [], "POST", () =>+ helpers.create_ajax_request("/json/billing/upgrade", "invoice", [], "POST", () =>window.location.replace("/billing"),);});@@ -58,13 +41,8 @@ export const initialize = () => {return;}e.preventDefault();- helpers.create_ajax_request(- "/json/billing/sponsorship",- "sponsorship",- undefined,- [],- "POST",- () => window.location.replace("/"),+ helpers.create_ajax_request("/json/billing/sponsorship", "sponsorship", [], "POST", () =>+ window.location.replace("/"),);});diff --git a/static/styles/portico/billing.css b/static/styles/portico/billing.cssindex 7240fbcbe6b..368aa93666c 100644--- a/static/styles/portico/billing.css+++ b/static/styles/portico/billing.css@@ -193,6 +193,8 @@display: none;}+ #restartsession-loading,+ #webhook-loading,#sponsorship-loading,#planchange-loading,#licensechange-loading,@@ -204,6 +206,8 @@text-align: center;}+ #restartsession-success,+ #webhook-success,#sponsorship-success,#planchange-success,#licensechange-success,@@ -214,6 +218,8 @@display: none;}+ #restartsession-error,+ #webhook-error,#sponsorship-error,#planchange-error,#licensechange-error,@@ -245,6 +251,8 @@stroke: hsl(0, 0%, 100%);}+ #restartsession_loading_indicator,+ #webhook_loading_indicator,#sponsorship_loading_indicator,#planchange_loading_indicator,#licensechange_loading_indicator,@@ -254,6 +262,8 @@margin: 10px auto;}+ #restartsession_loading_indicator_box_container,+ #webhook_loading_indicator_box_container,#sponsorship_loading_indicator_box_container,#planchange_loading_indicator_box_container,#licensechange_loading_indicator_box_container,@@ -264,6 +274,8 @@left: 50%;}+ #restartsession_loading_indicator_box,+ #webhook_loading_indicator_box,#sponsorship_loading_indicator_box,#planchange_loading_indicator_box,#licensechange_loading_indicator_box,@@ -277,6 +289,8 @@border-radius: 6px;}+ #restartsession_loading_indicator .loading_indicator_text,+ #webhook_loading_indicator .loading_indicator_text,#sponsorship_loading_indicator .loading_indicator_text,#planchange_loading_indicator .loading_indicator_text,#licensechange_loading_indicator .loading_indicator_text,@@ -293,8 +307,8 @@}}-input[name="licenses"]::-webkit-outer-spin-button,-input[name="licenses"]::-webkit-inner-spin-button {+input[type="number"]::-webkit-outer-spin-button,+input[type="number"]::-webkit-inner-spin-button {appearance: none;margin: 0;}diff --git a/stubs/stripe/__init__.pyi b/stubs/stripe/__init__.pyiindex 328105a6271..bc5b2704a1b 100644--- a/stubs/stripe/__init__.pyi+++ b/stubs/stripe/__init__.pyi@@ -7,9 +7,16 @@ import stripe.api_requestor as api_requestorimport stripe.error as errorimport stripe.util as utilfrom stripe.api_resources.list_object import SubscriptionListObject+from stripe.checkout import Session+from typing_extensions import Literalapi_key: Optional[str]+class InvoiceSettings:+ custom_field: List[str]+ default_payment_method: Optional[PaymentMethod]+ footer: str+class Customer:default_source: Union[Card, Source]created: int@@ -23,6 +30,7 @@ class Customer:description: strdiscount: Optional[Discount]metadata: Dict[str, str]+ invoice_settings: InvoiceSettings@staticmethoddef retrieve(customer_id: str = ..., expand: Optional[List[str]] = ...) -> Customer: ...@staticmethod@@ -30,10 +38,13 @@ class Customer:description: str = ...,email: str = ...,metadata: Dict[str, Any] = ...,- source: Optional[str] = ...,+ payment_method: Optional[str] = ...,coupon: Optional[str] = ...,) -> Customer: ...@staticmethod+ def modify(customer_id: str, invoice_settings: Dict[str, Any]) -> Customer:+ pass+ @staticmethoddef save(customer: Customer) -> Customer: ...@staticmethoddef delete_discount(customer: Customer) -> None: ...@@ -43,6 +54,7 @@ class Customer:def create_balance_transaction(customer_id: str, amount: int, currency: str, description: str) -> None: ...+ def refresh(self, customer: Customer) -> Customer: ...class Invoice:id: str@@ -85,8 +97,7 @@ class Invoice:@staticmethoddef void_invoice(id: str) -> None: ...def get(self, key: str) -> Any: ...- @staticmethod- def refresh(invoice: Invoice) -> Invoice: ...+ def refresh(self, invoice: Invoice) -> Invoice: ...class Subscription:created: int@@ -164,6 +175,7 @@ class Charge:receipt_email: strsource: Sourcestatement_descriptor: str+ payment_method_details: PaymentMethod@staticmethoddef list(customer: Optional[str]) -> List[Charge]: ...@staticmethod@@ -195,3 +207,127 @@ class InvoiceItem:class InvoiceLineItem:amount: intdef get(self, key: str) -> Any: ...++class SetupIntent:+ id: str++ customer: str+ metadata: Dict[str, Any]+ payment_method: str+ payment_method_types: List[str]+ usage: str+ @staticmethod+ def create(+ confirm: bool = ...,+ usage: str = ...,+ customer: Optional[str] = None,+ description: Optional[str] = None,+ metadata: Optional[Dict[str, Any]] = None,+ payment_method: Optional[str] = None,+ payment_method_types: List[str] = ...,+ ) -> SetupIntent: ...+ @staticmethod+ def list(limit: int = ...) -> List[SetupIntent]: ...+ @staticmethod+ def retrieve(setup_intent_id: str, expand: Optional[List[str]] = ...) -> SetupIntent: ...++PaymentIntentStatuses = Literal[+ "requires_payment_method",+ "requires_confirmation",+ "requires_action",+ "processing",+ "requires_capture",+ "canceled",+ "succeeded",+]++class LastPaymentError:+ def get(self, key: Literal["code", "message", "type", "param"]) -> Optional[str]: ...++class PaymentIntent:+ id: str+ amount: int+ charges: List[Charge]+ customer: str+ metadata: Dict[str, str]+ status: PaymentIntentStatuses+ last_payment_error: LastPaymentError+ @staticmethod+ def create(+ amount: int,+ currency: str,+ confirm: bool = ...,+ customer: Optional[str] = None,+ description: Optional[str] = None,+ payment_method: Optional[str] = None,+ off_session: Optional[bool] = None,+ receipt_email: Optional[str] = None,+ statement_descriptor: Optional[str] = None,+ metadata: Optional[Dict[str, Any]] = None,+ ) -> PaymentMethod: ...+ @staticmethod+ def confirm(+ payment_intent_id: str,+ payment_method: Optional[str] = None,+ off_session: Optional[bool] = None,+ ) -> PaymentIntent: ...+ @staticmethod+ def list(limit: int = ...) -> List[PaymentIntent]: ...+ @staticmethod+ def retrieve(payment_intent_id: str) -> PaymentIntent: ...++PaymentMethodTypes = Literal[+ "acss_debit",+ "afterpay_clearpay",+ "alipay",+ "au_becs_debit",+ "bacs_debit",+ "bancontact",+ "boleto",+ "card",+ "eps",+ "fpx",+ "giropay",+ "grabpay",+ "ideal",+ "oxxo",+ "p24",+ "sepa_debit",+ "sofort",+ "wechat_pay",+]++class PaymentMethod:+ id: str+ status: str+ card: Card+ type: PaymentMethodTypes+ @staticmethod+ def create(+ type: PaymentMethodTypes, card: Optional[Dict[str, Any]] = None+ ) -> PaymentMethod: ...+ @staticmethod+ def detach(payment_method_id: str) -> PaymentMethod: ...+ @staticmethod+ def list(customer: Customer, type: str, limit: int = ...) -> List[PaymentMethod]: ...++EventTypes = Literal[+ "checkout.session.completed", "payment_intent.succeeded", "payment_intent.payment_failed"+]++class EventData:+ object: Union[Session, PaymentIntent]++class Event:+ id: str+ type: EventTypes+ data: EventData+ @staticmethod+ def construct_from(values: Dict[Any, Any], key: Optional[str]) -> Event: ...+ @staticmethod+ def list(limit: int = ..., ending_before: Optional[Event] = None) -> List[Event]: ...+ def to_dict_recursive(self) -> Dict[str, Any]: ...++class Webhook:+ @staticmethod+ def construct_event(payload: bytes, request_signature: str, webhook_secret: str) -> Event: ...diff --git a/stubs/stripe/checkout/__init__.pyi b/stubs/stripe/checkout/__init__.pyinew file mode 100644index 00000000000..f4b7f6ac177--- /dev/null+++ b/stubs/stripe/checkout/__init__.pyi@@ -0,0 +1,22 @@+from typing import Any, Dict, List, Optional++class Session:+ id: str++ customer: str+ metadata: Dict[str, Any]+ setup_intent: str+ url: str+ @staticmethod+ def create(+ cancel_url: str,+ success_url: str,+ mode: str,+ payment_method_types: List[str],+ customer: Optional[str] = None,+ metadata: Optional[Dict[str, Any]] = None,+ setup_intent_data: Optional[Dict[str, Any]] = None,+ ) -> Session: ...+ @staticmethod+ def list(limit: int = ...) -> List[Session]: ...+ def to_dict_recursive(self) -> Dict[str, Any]: ...diff --git a/stubs/stripe/error/__init__.pyi b/stubs/stripe/error/__init__.pyiindex a1d53918a81..2f08b5afca9 100644--- a/stubs/stripe/error/__init__.pyi+++ b/stubs/stripe/error/__init__.pyi@@ -55,3 +55,5 @@ class APIConnectionError(StripeError):code: Optional[str] = None,should_retry: bool = False,) -> None: ...++class SignatureVerificationError(StripeError): ...diff --git a/templates/corporate/billing.html b/templates/corporate/billing.htmlindex 9eae6f15ce3..b3d56994ac6 100644--- a/templates/corporate/billing.html+++ b/templates/corporate/billing.html@@ -3,7 +3,6 @@{% block customhead %}<meta name="viewport" content="width=device-width, initial-scale=1.0" />-<script src="https://checkout.stripe.com/checkout.js"></script>{% endblock %}{% block content %}@@ -62,16 +61,14 @@{% endif %}</p></div>- <div class="tab-pane" id="payment-method" data-email="{{stripe_email}}" data-key="{{publishable_key}}">+ <div class="tab-pane" id="payment-method"><div id="cardchange-error" class="alert alert-danger"></div><div id="cardchange-input-section"><form id="cardchange-form"><p>Billing email: <strong>{{ stripe_email }}</strong></p><p>Current payment method: <strong>{{ payment_method }}</strong></p>{% if charge_automatically %}- <button id="update-card-button" class="stripe-button-el">- <span id="update-card-button-span">Update card</span>- </button>+ <button class="btn-info" id="update-card-button" class="stripe-button-el">Update card</button>{% endif %}</form></div>@@ -85,7 +82,7 @@<div id="cardchange_loading_indicator"></div></div><div id="cardchange-success" class="alert alert-success">- Card updated. The page will now reload.+ Redirecting to Stripe checkout page for updating Card details.</div></div>diff --git a/templates/corporate/event_status.html b/templates/corporate/event_status.htmlnew file mode 100644index 00000000000..3135b5c91de--- /dev/null+++ b/templates/corporate/event_status.html@@ -0,0 +1,52 @@+{% extends "zerver/portico.html" %}+{% set entrypoint = "billing-event-status" %}++{% block customhead %}+<meta name="viewport" content="width=device-width, initial-scale=1.0" />+{% endblock %}++{% block content %}++<div class="app portico-page">++ {% include 'zerver/billing_nav.html' %}++ <div class="portico-landing billing-upgrade-page">+ <div class="hero small-hero"></div>++ <div class="page-content">+ <div class="main">+ <br />+ <div id="data" data-stripe-session-id="{{ stripe_session_id}}" data-stripe-payment-intent-id="{{ stripe_payment_intent_id }}"></div>+ <div class="alert alert-success" id="webhook-success"></div>+ <div class="alert alert-danger" id="webhook-error"></div>+ <div id="webhook-loading">+ <div class="zulip-loading-logo">+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 773.12 773.12">+ <circle cx="386.56" cy="386.56" r="386.56"/>+ <path d="M566.66 527.25c0 33.03-24.23 60.05-53.84 60.05H260.29c-29.61 0-53.84-27.02-53.84-60.05 0-20.22 9.09-38.2 22.93-49.09l134.37-120c2.5-2.14 5.74 1.31 3.94 4.19l-49.29 98.69c-1.38 2.76.41 6.16 3.25 6.16h191.18c29.61 0 53.83 27.03 53.83 60.05zm0-281.39c0 20.22-9.09 38.2-22.93 49.09l-134.37 120c-2.5 2.14-5.74-1.31-3.94-4.19l49.29-98.69c1.38-2.76-.41-6.16-3.25-6.16H260.29c-29.61 0-53.84-27.02-53.84-60.05s24.23-60.05 53.84-60.05h252.54c29.61 0 53.83 27.02 53.83 60.05z"/>+ </svg>+ </div>+ <div id="webhook_loading_indicator"></div>+ </div>++ <form id="restartsession-form">+ <input type="hidden" name="stripe_payment_intent_id" value="{{ stripe_payment_intent_id }}" />+ <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}" />+ </form>+ <div class="alert alert-success" id="restartsession-success">Redirecting to Stripe Checkout</div>+ <div class="alert alert-danger" id="restartsession-error"></div>+ <div id="restartsession-loading">+ <div class="zulip-loading-logo">+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 773.12 773.12">+ <circle cx="386.56" cy="386.56" r="386.56"/>+ <path d="M566.66 527.25c0 33.03-24.23 60.05-53.84 60.05H260.29c-29.61 0-53.84-27.02-53.84-60.05 0-20.22 9.09-38.2 22.93-49.09l134.37-120c2.5-2.14 5.74 1.31 3.94 4.19l-49.29 98.69c-1.38 2.76.41 6.16 3.25 6.16h191.18c29.61 0 53.83 27.03 53.83 60.05zm0-281.39c0 20.22-9.09 38.2-22.93 49.09l-134.37 120c-2.5 2.14-5.74-1.31-3.94-4.19l49.29-98.69c1.38-2.76-.41-6.16-3.25-6.16H260.29c-29.61 0-53.84-27.02-53.84-60.05s24.23-60.05 53.84-60.05h252.54c29.61 0 53.83 27.02 53.83 60.05z"/>+ </svg>+ </div>+ <div id="restartsession_loading_indicator"></div>+ </div>+ </div>+ </div>+ </div>+</div>+{% endblock %}diff --git a/templates/corporate/upgrade.html b/templates/corporate/upgrade.htmlindex bd28a3e2732..4291e394c19 100644--- a/templates/corporate/upgrade.html+++ b/templates/corporate/upgrade.html@@ -3,7 +3,6 @@{% block customhead %}<meta name="viewport" content="width=device-width, initial-scale=1.0" />-<script src="https://checkout.stripe.com/checkout.js"></script>{% endblock %}{% block content %}@@ -41,11 +40,14 @@<div class="tab-content"><div class="tab-pane active" id="autopay"><div id="autopay-input-section">- <form id="autopay-form" data-key="{{ publishable_key }}" data-email="{{ email }}" method="post">+ <form id="autopay-form"><input type="hidden" name="seat_count" value="{{ seat_count }}" /><input type="hidden" name="signed_seat_count" value="{{ signed_seat_count }}" /><input type="hidden" name="salt" value="{{ salt }}" /><input type="hidden" name="billing_modality" value="charge_automatically" />+ {% if onboarding %}+ <input type="hidden" name="onboarding" value="true" />+ {% endif %}{% if onboarding and free_trial_days %}<p><b>Not ready to start your trial?</b> <a href="/">Continue with the Zulip Cloud Free plan</a>.</p><hr />@@ -153,8 +155,8 @@</div><div id="autopay_loading_indicator"></div></div>- <div id="autopay-success" class="alert alert-success">- Upgrade complete! The page will now reload.+ <div id="autopay-success" class="alert alert-info">+ Redirecting to Stripe Checkout...</div></div>@@ -257,7 +259,7 @@</div><div id="sponsorship_loading_indicator"></div></div>- <div id="sponsorship-success" class="alert alert-success">+ <div id="sponsorship-success" class="alert alert-info">Request received! The page will now reload.</div></div>diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.pyindex df1cebff99b..e9dbaf7358a 100644--- a/tools/linter_lib/custom_check.py+++ b/tools/linter_lib/custom_check.py@@ -617,6 +617,7 @@ html_rules: List["Rule"] = ["templates/corporate/billing.html","templates/zerver/hello.html","templates/corporate/upgrade.html",+ "templates/corporate/event_status.html",},"bad_lines": ['<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>'diff --git a/tools/test-js-with-node b/tools/test-js-with-nodeindex 89d1d82d91f..43fc5a055c2 100755--- a/tools/test-js-with-node+++ b/tools/test-js-with-node@@ -186,6 +186,7 @@ EXEMPT_FILES = {"static/js/zform.js","static/js/zulip.js","static/js/zulip_test.js",+ "static/js/billing/event_status.js","static/shared/js/poll_data.js",}diff --git a/tools/webpack.assets.json b/tools/webpack.assets.jsonindex 1b543b933cd..475bba27ddf 100644--- a/tools/webpack.assets.json+++ b/tools/webpack.assets.json@@ -25,6 +25,13 @@"./static/js/loading","./static/styles/portico/billing.css"],+ "billing-event-status": [+ "./static/js/bundles/portico",+ "./static/styles/portico/landing_page.css",+ "./static/js/billing/event_status.js",+ "./static/js/billing/helpers",+ "./static/styles/portico/billing.css"+ ],"portico": ["./static/js/bundles/portico"],"error-styles": ["./static/third/bootstrap/css/bootstrap.css",