Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stripe: Add cron-based plan invoicing to remote server billing system.
Prakhar Pratyush89f9e097dbbb
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.pyindex 6779d522bea..68a4bb5eefb 100644--- a/corporate/lib/stripe.py+++ b/corporate/lib/stripe.py@@ -4342,15 +4342,19 @@ def get_plan_renewal_or_end_date(plan: CustomerPlan, event_time: datetime) -> dadef invoice_plans_as_needed(event_time: Optional[datetime] = None) -> None:if event_time is None: # nocoverageevent_time = timezone_now()- # TODO: Add RemoteServerBillingSession cases.for plan in CustomerPlan.objects.filter(next_invoice_date__lte=event_time):+ remote_server: Optional[RemoteZulipServer] = Noneif plan.customer.realm is not None:- RealmBillingSession(realm=plan.customer.realm).invoice_plan(plan, event_time)+ billing_session: BillingSession = RealmBillingSession(realm=plan.customer.realm)elif plan.customer.remote_realm is not None:remote_realm = plan.customer.remote_realmremote_server = remote_realm.serverbilling_session = RemoteRealmBillingSession(remote_realm=remote_realm)+ elif plan.customer.remote_server is not None:+ remote_server = plan.customer.remote_server+ billing_session = RemoteServerBillingSession(remote_server=remote_server)+ if remote_server:assert remote_server.last_audit_log_update is not Noneassert plan.next_invoice_date is not Noneif plan.next_invoice_date > remote_server.last_audit_log_update:@@ -4375,8 +4379,7 @@ def invoice_plans_as_needed(event_time: Optional[datetime] = None) -> None:plan.save(update_fields=["invoice_overdue_email_sent"])continue- billing_session.invoice_plan(plan, event_time)- # TODO: Assert that we never invoice legacy plans.+ billing_session.invoice_plan(plan, event_time)def is_realm_on_free_trial(realm: Realm) -> bool:diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.modify.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.modify.1.jsonindex 418747dfd40..4f991d3aeae 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.modify.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.modify.1.json@@ -13,7 +13,7 @@"invoice_prefix": "NORMA01","invoice_settings": {"custom_fields": null,- "default_payment_method": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "default_payment_method": "pm_1OX09ZDEQaroqDjsyQWV6JZn","footer": null,"rendering_options": null},diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.1.jsonindex 364fe0554b4..3190702788d 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.1.json@@ -54,7 +54,7 @@},"created": 1000000000,"customer": "cus_NORMALIZED0001",- "id": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "id": "pm_1OX09ZDEQaroqDjsyQWV6JZn","livemode": false,"metadata": {},"object": "payment_method",diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.2.jsonindex 364fe0554b4..3190702788d 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.2.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.2.json@@ -54,7 +54,7 @@},"created": 1000000000,"customer": "cus_NORMALIZED0001",- "id": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "id": "pm_1OX09ZDEQaroqDjsyQWV6JZn","livemode": false,"metadata": {},"object": "payment_method",diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.3.jsonindex 364fe0554b4..3190702788d 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.3.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.3.json@@ -54,7 +54,7 @@},"created": 1000000000,"customer": "cus_NORMALIZED0001",- "id": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "id": "pm_1OX09ZDEQaroqDjsyQWV6JZn","livemode": false,"metadata": {},"object": "payment_method",diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.4.jsonindex 364fe0554b4..3190702788d 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.4.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Customer.retrieve.4.json@@ -54,7 +54,7 @@},"created": 1000000000,"customer": "cus_NORMALIZED0001",- "id": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "id": "pm_1OX09ZDEQaroqDjsyQWV6JZn","livemode": false,"metadata": {},"object": "payment_method",diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.1.jsonindex 3770b6ff5c1..a72ce23363d 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.1.json@@ -19,7 +19,7 @@"invoice_prefix": "NORMA01","invoice_settings": {"custom_fields": null,- "default_payment_method": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "default_payment_method": "pm_1OX09ZDEQaroqDjsyQWV6JZn","footer": null,"rendering_options": null},@@ -43,13 +43,13 @@}}},- "id": "evt_1OX00fDEQaroqDjsns6SdBq1",+ "id": "evt_1OX09bDEQaroqDjs6WiaeuQB","livemode": false,"object": "event","pending_webhooks": 0,"request": {"id": "req_NORMALIZED0001",- "idempotency_key": "2c75d1be-5167-403f-9a3b-87b28a2f308d"+ "idempotency_key": "ea13a318-9dab-42ad-9986-df98d58400ad"},"type": "customer.updated"}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.2.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.2.jsonindex e42447760e4..3ef11d0f042 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.2.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.2.json@@ -82,7 +82,7 @@},"paid": true,"payment_intent": "pi_NORMALIZED00000000000001",- "payment_method": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "payment_method": "pm_1OX09ZDEQaroqDjsyQWV6JZn","payment_method_details": {"card": {"amount_authorized": 1850,@@ -125,7 +125,7 @@"radar_options": {},"receipt_email": "[email protected]","receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKKqA-qwGMgYdDBqkQ_w6LBbfERo6dnb9XKkDvd587oTepM8AfnVhhnzGwFyy34GTW0BWue6R-g9syKub",+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKNOE-qwGMgbxR7bA4Uc6LBZ73BIesZ9f6t5TP_q7kMmnic_KDOJeYCgLNBbJRzsdqW8JliKuvZ4ytO1L","refunded": false,"refunds": {"data": [],@@ -150,7 +150,7 @@"total_count": 1,"url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"},- "client_secret": "pi_NORMALIZED00000000000001_secret_5izmOMNAaIeSvwJF1G8kiklDb",+ "client_secret": "pi_NORMALIZED00000000000001_secret_BGIqpxsPDnXc6oUIoXOKfqsnC","confirmation_method": "automatic","created": 1000000000,"currency": "usd",@@ -177,7 +177,7 @@"next_action": null,"object": "payment_intent","on_behalf_of": null,- "payment_method": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "payment_method": "pm_1OX09ZDEQaroqDjsyQWV6JZn","payment_method_configuration_details": null,"payment_method_options": {"card": {@@ -203,13 +203,13 @@"transfer_group": null}},- "id": "evt_3OX00iDEQaroqDjs1JDssUfs",+ "id": "evt_3OX09eDEQaroqDjs1X53HIFR","livemode": false,"object": "event",- "pending_webhooks": 0,+ "pending_webhooks": 2,"request": {"id": "req_NORMALIZED0002",- "idempotency_key": "aa477039-b5c7-4907-8def-def199f89bba"+ "idempotency_key": "a229ea2c-594d-48c6-b12d-4f6a076c3fa3"},"type": "payment_intent.succeeded"},@@ -280,7 +280,7 @@},"paid": true,"payment_intent": "pi_NORMALIZED00000000000001",- "payment_method": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "payment_method": "pm_1OX09ZDEQaroqDjsyQWV6JZn","payment_method_details": {"card": {"amount_authorized": 1850,@@ -323,7 +323,7 @@"radar_options": {},"receipt_email": "[email protected]","receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKKmA-qwGMgbq-tBFjBc6LBZjansqNvsPCKn8CJZZyqlOIK2jfr1h12K8GTf3Q-a3JNyxBqHwM5-2k5RC",+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKNOE-qwGMgbN7K6-sHo6LBaMmsaI_ASaqR3R38TJzMTONoE50sUxSWDeoHXw0BNmIjdTXNUpJavajhwi","refunded": false,"refunds": {"data": [],@@ -343,102 +343,15 @@"transfer_group": null}},- "id": "evt_3OX00iDEQaroqDjs1lox4GwX",+ "id": "evt_3OX09eDEQaroqDjs1XUVHtbP","livemode": false,"object": "event","pending_webhooks": 0,"request": {"id": "req_NORMALIZED0002",- "idempotency_key": "aa477039-b5c7-4907-8def-def199f89bba"+ "idempotency_key": "a229ea2c-594d-48c6-b12d-4f6a076c3fa3"},"type": "charge.succeeded"- },- {- "api_version": "2020-08-27",- "created": 1000000000,- "data": {- "object": {- "amount": 1850,- "amount_capturable": 0,- "amount_details": {- "tip": {}- },- "amount_received": 0,- "application": null,- "application_fee_amount": null,- "automatic_payment_methods": 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_5izmOMNAaIeSvwJF1G8kiklDb",- "confirmation_method": "automatic",- "created": 1000000000,- "currency": "usd",- "customer": "cus_NORMALIZED0001",- "description": "Upgrade to Zulip Basic, $3.5 x 11 - $20.0 x 1",- "id": "pi_NORMALIZED00000000000001",- "invoice": null,- "last_payment_error": null,- "latest_charge": null,- "livemode": false,- "metadata": {- "billing_modality": "charge_automatically",- "billing_schedule": "2",- "license_management": "automatic",- "licenses": "11",- "plan_tier": "103",- "price_per_license": "350",- "remote_realm_host": "zulip.testserver",- "remote_realm_user_email": "[email protected]",- "remote_realm_user_id": "1",- "seat_count": "11",- "type": "upgrade"- },- "next_action": null,- "object": "payment_intent",- "on_behalf_of": null,- "payment_method": null,- "payment_method_configuration_details": null,- "payment_method_options": {- "card": {- "installments": null,- "mandate_options": null,- "network": null,- "request_three_d_secure": "automatic"- }- },- "payment_method_types": [- "card"- ],- "processing": null,- "receipt_email": "[email protected]",- "review": null,- "setup_future_usage": null,- "shipping": null,- "source": null,- "statement_descriptor": "Zulip Basic",- "statement_descriptor_suffix": null,- "status": "requires_payment_method",- "transfer_data": null,- "transfer_group": null- }- },- "id": "evt_3OX00iDEQaroqDjs1vV2fdQ9",- "livemode": false,- "object": "event",- "pending_webhooks": 2,- "request": {- "id": "req_NORMALIZED0002",- "idempotency_key": "aa477039-b5c7-4907-8def-def199f89bba"- },- "type": "payment_intent.created"}],"has_more": false,diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.3.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.3.jsonindex 9763ec087ec..36125bb2a8f 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.3.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.3.json@@ -46,9 +46,9 @@"ending_balance": 0,"footer": null,"from_invoice": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQN0FnNzdDcXVBSWxPTkVTRmtIYkluRUF3dUxqLDk1NDI3MTE302009JecYDTw?s=ap",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZaGpvallhdVBOUnk0YTBRd3I3Vk5TU3NTR3ZMLDk1NDI3Njcw0200O5Al6uK8?s=ap","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQN0FnNzdDcXVBSWxPTkVTRmtIYkluRUF3dUxqLDk1NDI3MTE302009JecYDTw/pdf?s=ap",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZaGpvallhdVBOUnk0YTBRd3I3Vk5TU3NTR3ZMLDk1NDI3Njcw0200O5Al6uK8/pdf?s=ap","last_finalization_error": null,"latest_revision": null,"lines": {@@ -260,7 +260,7 @@"total_excluding_tax": 0,"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null},"previous_attributes": {"attempted": false,@@ -284,13 +284,13 @@}}},- "id": "evt_1OX00nDEQaroqDjsLqOH9RBm",+ "id": "evt_1OX09iDEQaroqDjscLH2Ihfx","livemode": false,"object": "event","pending_webhooks": 2,"request": {"id": "req_NORMALIZED0003",- "idempotency_key": "fe7d951e-5879-4064-9ccc-7139968ef149"+ "idempotency_key": "184bd3b9-d76b-4d80-878f-8a9aa9b252d3"},"type": "invoice.updated"},@@ -557,13 +557,13 @@"webhooks_delivered_at": null}},- "id": "evt_1OX00mDEQaroqDjseb0BeYoH",+ "id": "evt_1OX09hDEQaroqDjsSItzfRWZ","livemode": false,"object": "event","pending_webhooks": 0,"request": {"id": "req_NORMALIZED0004",- "idempotency_key": "2470a1ad-5aa2-4d17-a8b6-f297bbce7b07"+ "idempotency_key": "972d9e0b-46f4-405c-af8f-f8ced420de1d"},"type": "invoice.created"},@@ -619,13 +619,13 @@"unit_amount_decimal": "-2000"}},- "id": "evt_1OX00lDEQaroqDjsf9AJ9NVT",+ "id": "evt_1OX09gDEQaroqDjsgklv7uiQ","livemode": false,"object": "event","pending_webhooks": 0,"request": {"id": "req_NORMALIZED0005",- "idempotency_key": "2812b28a-ccb6-4c0c-99a5-0bc802e967cf"+ "idempotency_key": "cac8f9c7-e602-4f6d-9bcc-2889af682a65"},"type": "invoiceitem.created"},@@ -681,13 +681,13 @@"unit_amount_decimal": "350"}},- "id": "evt_1OX00lDEQaroqDjsstuYn7sC",+ "id": "evt_1OX09gDEQaroqDjsW4NknWGA","livemode": false,"object": "event","pending_webhooks": 0,"request": {"id": "req_NORMALIZED0006",- "idempotency_key": "24ff3100-23f7-4f55-9790-d6bc93bd42f2"+ "idempotency_key": "90c12534-8089-4805-b4cc-8854d3f1eba8"},"type": "invoiceitem.created"},@@ -743,13 +743,13 @@"unit_amount_decimal": "-1850"}},- "id": "evt_1OX00lDEQaroqDjstEk5ASzG",+ "id": "evt_1OX09fDEQaroqDjsVv6bxD51","livemode": false,"object": "event","pending_webhooks": 0,"request": {"id": "req_NORMALIZED0007",- "idempotency_key": "1552bd42-e586-4cd5-a04a-c7e576b0278c"+ "idempotency_key": "44ad2b82-ed0d-48ec-82ff-26298d5d8193"},"type": "invoiceitem.created"},@@ -772,7 +772,7 @@"invoice_prefix": "NORMA01","invoice_settings": {"custom_fields": null,- "default_payment_method": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "default_payment_method": "pm_1OX09ZDEQaroqDjsyQWV6JZn","footer": null,"rendering_options": null},@@ -795,13 +795,13 @@"default_currency": null}},- "id": "evt_1OX00lDEQaroqDjs7fUB5iQ8",+ "id": "evt_1OX09fDEQaroqDjs8sCKS68A","livemode": false,"object": "event","pending_webhooks": 0,"request": {"id": "req_NORMALIZED0007",- "idempotency_key": "1552bd42-e586-4cd5-a04a-c7e576b0278c"+ "idempotency_key": "44ad2b82-ed0d-48ec-82ff-26298d5d8193"},"type": "customer.updated"}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.4.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.4.jsonindex e1cc377c88e..7fb767ed796 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.4.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Event.list.4.json@@ -46,9 +46,9 @@"ending_balance": 0,"footer": null,"from_invoice": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQN0FnNzdDcXVBSWxPTkVTRmtIYkluRUF3dUxqLDk1NDI3MTE40200yvQLQ8KA?s=ap",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZaGpvallhdVBOUnk0YTBRd3I3Vk5TU3NTR3ZMLDk1NDI3Njcw0200O5Al6uK8?s=ap","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQN0FnNzdDcXVBSWxPTkVTRmtIYkluRUF3dUxqLDk1NDI3MTE40200yvQLQ8KA/pdf?s=ap",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZaGpvallhdVBOUnk0YTBRd3I3Vk5TU3NTR3ZMLDk1NDI3Njcw0200O5Al6uK8/pdf?s=ap","last_finalization_error": null,"latest_revision": null,"lines": {@@ -260,16 +260,16 @@"total_excluding_tax": 0,"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}},- "id": "evt_1OX00oDEQaroqDjswiYvgWuy",+ "id": "evt_1OX09iDEQaroqDjsQtXsm3UF","livemode": false,"object": "event",- "pending_webhooks": 0,+ "pending_webhooks": 2,"request": {"id": "req_NORMALIZED0003",- "idempotency_key": "fe7d951e-5879-4064-9ccc-7139968ef149"+ "idempotency_key": "184bd3b9-d76b-4d80-878f-8a9aa9b252d3"},"type": "invoice.payment_succeeded"},@@ -319,9 +319,9 @@"ending_balance": 0,"footer": null,"from_invoice": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQN0FnNzdDcXVBSWxPTkVTRmtIYkluRUF3dUxqLDk1NDI3MTE302009JecYDTw?s=ap",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZaGpvallhdVBOUnk0YTBRd3I3Vk5TU3NTR3ZMLDk1NDI3Njcw0200O5Al6uK8?s=ap","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQN0FnNzdDcXVBSWxPTkVTRmtIYkluRUF3dUxqLDk1NDI3MTE302009JecYDTw/pdf?s=ap",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZaGpvallhdVBOUnk0YTBRd3I3Vk5TU3NTR3ZMLDk1NDI3Njcw0200O5Al6uK8/pdf?s=ap","last_finalization_error": null,"latest_revision": null,"lines": {@@ -533,16 +533,16 @@"total_excluding_tax": 0,"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}},- "id": "evt_1OX00oDEQaroqDjsn1S0CjPg",+ "id": "evt_1OX09iDEQaroqDjs9sJV4wZJ","livemode": false,"object": "event",- "pending_webhooks": 0,+ "pending_webhooks": 1,"request": {"id": "req_NORMALIZED0003",- "idempotency_key": "fe7d951e-5879-4064-9ccc-7139968ef149"+ "idempotency_key": "184bd3b9-d76b-4d80-878f-8a9aa9b252d3"},"type": "invoice.paid"},@@ -592,9 +592,9 @@"ending_balance": 0,"footer": null,"from_invoice": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQN0FnNzdDcXVBSWxPTkVTRmtIYkluRUF3dUxqLDk1NDI3MTE302009JecYDTw?s=ap",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZaGpvallhdVBOUnk0YTBRd3I3Vk5TU3NTR3ZMLDk1NDI3Njcw0200O5Al6uK8?s=ap","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQN0FnNzdDcXVBSWxPTkVTRmtIYkluRUF3dUxqLDk1NDI3MTE302009JecYDTw/pdf?s=ap",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZaGpvallhdVBOUnk0YTBRd3I3Vk5TU3NTR3ZMLDk1NDI3Njcw0200O5Al6uK8/pdf?s=ap","last_finalization_error": null,"latest_revision": null,"lines": {@@ -806,16 +806,16 @@"total_excluding_tax": 0,"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}},- "id": "evt_1OX00nDEQaroqDjsr1r14C7C",+ "id": "evt_1OX09iDEQaroqDjsvwansZZM","livemode": false,"object": "event","pending_webhooks": 0,"request": {"id": "req_NORMALIZED0003",- "idempotency_key": "fe7d951e-5879-4064-9ccc-7139968ef149"+ "idempotency_key": "184bd3b9-d76b-4d80-878f-8a9aa9b252d3"},"type": "invoice.finalized"}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Invoice.finalize_invoice.1.jsonindex 470ec1c8a2d..4092062249d 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Invoice.finalize_invoice.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Invoice.finalize_invoice.1.json@@ -40,9 +40,9 @@"ending_balance": 0,"footer": null,"from_invoice": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQN0FnNzdDcXVBSWxPTkVTRmtIYkluRUF3dUxqLDk1NDI3MTE302009JecYDTw?s=ap",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZaGpvallhdVBOUnk0YTBRd3I3Vk5TU3NTR3ZMLDk1NDI3NjY50200UbFvDstT?s=ap","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQN0FnNzdDcXVBSWxPTkVTRmtIYkluRUF3dUxqLDk1NDI3MTE302009JecYDTw/pdf?s=ap",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZaGpvallhdVBOUnk0YTBRd3I3Vk5TU3NTR3ZMLDk1NDI3NjY50200UbFvDstT/pdf?s=ap","last_finalization_error": null,"latest_revision": null,"lines": {@@ -254,5 +254,5 @@"total_excluding_tax": 0,"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": 1000000000+ "webhooks_delivered_at": null}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Invoice.finalize_invoice.2.jsonindex 65c7c18c9d8..81c8458e9f4 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Invoice.finalize_invoice.2.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Invoice.finalize_invoice.2.json@@ -40,9 +40,9 @@"ending_balance": 0,"footer": null,"from_invoice": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQMVZvN3N4V29WSm9aSnptV3FpaGZpdW1QcVgwLDk1NDI3MTIy0200hLkdiy8Z?s=ap",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdGM5dlpMRHo0UVJxM3BDV005bEh5WndicjBaLDk1NDI3Njc00200MZm0Shoh?s=ap","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQMVZvN3N4V29WSm9aSnptV3FpaGZpdW1QcVgwLDk1NDI3MTIy0200hLkdiy8Z/pdf?s=ap",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdGM5dlpMRHo0UVJxM3BDV005bEh5WndicjBaLDk1NDI3Njc00200MZm0Shoh/pdf?s=ap","last_finalization_error": null,"latest_revision": null,"lines": {@@ -254,5 +254,5 @@"total_excluding_tax": 5235,"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": null+ "webhooks_delivered_at": 1000000000}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Invoice.list.2.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Invoice.list.2.jsonindex c8dce9c1b91..ff0cf012c85 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Invoice.list.2.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--Invoice.list.2.json@@ -42,9 +42,9 @@"ending_balance": 0,"footer": null,"from_invoice": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQMVZvN3N4V29WSm9aSnptV3FpaGZpdW1QcVgwLDk1NDI3MTIz0200SweJl3ZY?s=ap",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdGM5dlpMRHo0UVJxM3BDV005bEh5WndicjBaLDk1NDI3Njc10200lFDB540X?s=ap","id": "in_NORMALIZED00000000000002",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQMVZvN3N4V29WSm9aSnptV3FpaGZpdW1QcVgwLDk1NDI3MTIz0200SweJl3ZY/pdf?s=ap",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdGM5dlpMRHo0UVJxM3BDV005bEh5WndicjBaLDk1NDI3Njc10200lFDB540X/pdf?s=ap","last_finalization_error": null,"latest_revision": null,"lines": {@@ -256,7 +256,7 @@"total_excluding_tax": 5235,"total_tax_amounts": [],"transfer_data": null,- "webhooks_delivered_at": null+ "webhooks_delivered_at": 1000000000},{"account_country": "US",@@ -300,9 +300,9 @@"ending_balance": 0,"footer": null,"from_invoice": null,- "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQN0FnNzdDcXVBSWxPTkVTRmtIYkluRUF3dUxqLDk1NDI3MTIz0200ff7TEG53?s=ap",+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZaGpvallhdVBOUnk0YTBRd3I3Vk5TU3NTR3ZMLDk1NDI3Njc10200p0yUtweB?s=ap","id": "in_NORMALIZED00000000000001",- "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhQN0FnNzdDcXVBSWxPTkVTRmtIYkluRUF3dUxqLDk1NDI3MTIz0200ff7TEG53/pdf?s=ap",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZaGpvallhdVBOUnk0YTBRd3I3Vk5TU3NTR3ZMLDk1NDI3Njc10200p0yUtweB/pdf?s=ap","last_finalization_error": null,"latest_revision": null,"lines": {diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--PaymentIntent.create.1.jsonindex 93ce7e2c912..3df9a8424a2 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--PaymentIntent.create.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--PaymentIntent.create.1.json@@ -76,7 +76,7 @@},"paid": true,"payment_intent": "pi_NORMALIZED00000000000001",- "payment_method": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "payment_method": "pm_1OX09ZDEQaroqDjsyQWV6JZn","payment_method_details": {"card": {"amount_authorized": 1850,@@ -119,7 +119,7 @@"radar_options": {},"receipt_email": "[email protected]","receipt_number": null,- "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKKmA-qwGMgak6KECyWg6LBYW9FwwN8W19h2HD6jkbPmoHwspLis5Rif3neEgktDZ6TtSgQM1xR-mBeui",+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKNKE-qwGMga3GHCgBBc6LBYnWa0gnQ-nl3bhxuhF2qzhZM6pmOPr73OAtQGxn8HrmAJEbkrXQZjqpGA4","refunded": false,"refunds": {"data": [],@@ -144,7 +144,7 @@"total_count": 1,"url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"},- "client_secret": "pi_NORMALIZED00000000000001_secret_5izmOMNAaIeSvwJF1G8kiklDb",+ "client_secret": "pi_NORMALIZED00000000000001_secret_BGIqpxsPDnXc6oUIoXOKfqsnC","confirmation_method": "automatic","created": 1000000000,"currency": "usd",@@ -171,7 +171,7 @@"next_action": null,"object": "payment_intent","on_behalf_of": null,- "payment_method": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "payment_method": "pm_1OX09ZDEQaroqDjsyQWV6JZn","payment_method_configuration_details": null,"payment_method_options": {"card": {diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--SetupIntent.create.1.jsonindex 1279fca04af..5e3b5638979 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--SetupIntent.create.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--SetupIntent.create.1.json@@ -2,21 +2,21 @@"application": null,"automatic_payment_methods": null,"cancellation_reason": null,- "client_secret": "seti_1OX00dDEQaroqDjsYz8OYs5q_secret_PLhPKmGwwuBXCHjDSwSKePU33mS76qC",+ "client_secret": "seti_1OX09ZDEQaroqDjshiHfuQhQ_secret_PLhYg2Q2FJC7z7ufP5IXJF4LLhDG4N1","created": 1000000000,"customer": "cus_NORMALIZED0001","description": null,"flow_directions": null,- "id": "seti_1OX00dDEQaroqDjsYz8OYs5q",+ "id": "seti_1OX09ZDEQaroqDjshiHfuQhQ","last_setup_error": null,- "latest_attempt": "setatt_1OX00dDEQaroqDjsKG7MaMDq",+ "latest_attempt": "setatt_1OX09ZDEQaroqDjsh9ywo321","livemode": false,"mandate": null,"metadata": {},"next_action": null,"object": "setup_intent","on_behalf_of": null,- "payment_method": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "payment_method": "pm_1OX09ZDEQaroqDjsyQWV6JZn","payment_method_configuration_details": null,"payment_method_options": {"card": {diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--SetupIntent.list.1.jsonindex a0c24a5541c..de6c2ec1f75 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--SetupIntent.list.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--SetupIntent.list.1.json@@ -4,12 +4,12 @@"application": null,"automatic_payment_methods": null,"cancellation_reason": null,- "client_secret": "seti_1OX00cDEQaroqDjssWP8rzLa_secret_PLhPgisOTHQlzLbnm52K6zDc2SUxyCU",+ "client_secret": "seti_1OX09YDEQaroqDjsH3KFVptO_secret_PLhYXwrWkkRuBzd2cIlXOPB6upysKI1","created": 1000000000,"customer": "cus_NORMALIZED0001","description": null,"flow_directions": null,- "id": "seti_1OX00cDEQaroqDjssWP8rzLa",+ "id": "seti_1OX09YDEQaroqDjsH3KFVptO","last_setup_error": null,"latest_attempt": null,"livemode": false,diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--SetupIntent.retrieve.1.jsonindex 1279fca04af..5e3b5638979 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--SetupIntent.retrieve.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--SetupIntent.retrieve.1.json@@ -2,21 +2,21 @@"application": null,"automatic_payment_methods": null,"cancellation_reason": null,- "client_secret": "seti_1OX00dDEQaroqDjsYz8OYs5q_secret_PLhPKmGwwuBXCHjDSwSKePU33mS76qC",+ "client_secret": "seti_1OX09ZDEQaroqDjshiHfuQhQ_secret_PLhYg2Q2FJC7z7ufP5IXJF4LLhDG4N1","created": 1000000000,"customer": "cus_NORMALIZED0001","description": null,"flow_directions": null,- "id": "seti_1OX00dDEQaroqDjsYz8OYs5q",+ "id": "seti_1OX09ZDEQaroqDjshiHfuQhQ","last_setup_error": null,- "latest_attempt": "setatt_1OX00dDEQaroqDjsKG7MaMDq",+ "latest_attempt": "setatt_1OX09ZDEQaroqDjsh9ywo321","livemode": false,"mandate": null,"metadata": {},"next_action": null,"object": "setup_intent","on_behalf_of": null,- "payment_method": "pm_1OX00dDEQaroqDjsgtnrutJI",+ "payment_method": "pm_1OX09ZDEQaroqDjsyQWV6JZn","payment_method_configuration_details": null,"payment_method_options": {"card": {diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--checkout.Session.create.1.jsonindex 57e1a4f8295..efca8c8739c 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--checkout.Session.create.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--checkout.Session.create.1.json@@ -35,7 +35,7 @@},"customer_email": null,"expires_at": 1000000000,- "id": "cs_test_NORMALIZED02Omh5eD2eqDkYLLEIWiL1pytNkSndVObnvpQGxy9OgRfOu3",+ "id": "cs_test_NORMALIZED024Qaa25FVCfS2lIRNj8Khr0nVqLtiyBPlw1CzZFCJ2xzQR9","invoice": null,"invoice_creation": null,"livemode": false,@@ -59,7 +59,7 @@"enabled": false},"recovered_from": null,- "setup_intent": "seti_1OX00cDEQaroqDjssWP8rzLa",+ "setup_intent": "seti_1OX09YDEQaroqDjsH3KFVptO","shipping": null,"shipping_address_collection": null,"shipping_options": [],@@ -70,5 +70,5 @@"success_url": "http://selfhosting.testserver/realm/ef44aac7-28b2-413b-9315-8f00f62d1697/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}","total_details": null,"ui_mode": "hosted",- "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED02Omh5eD2eqDkYLLEIWiL1pytNkSndVObnvpQGxy9OgRfOu3#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED024Qaa25FVCfS2lIRNj8Khr0nVqLtiyBPlw1CzZFCJ2xzQR9#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--checkout.Session.list.1.jsonindex 6d572a8fd56..cbddb5ab820 100644--- a/corporate/tests/stripe_fixtures/invoice_plans_as_needed--checkout.Session.list.1.json+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed--checkout.Session.list.1.json@@ -37,7 +37,7 @@},"customer_email": null,"expires_at": 1000000000,- "id": "cs_test_NORMALIZED02Omh5eD2eqDkYLLEIWiL1pytNkSndVObnvpQGxy9OgRfOu3",+ "id": "cs_test_NORMALIZED024Qaa25FVCfS2lIRNj8Khr0nVqLtiyBPlw1CzZFCJ2xzQR9","invoice": null,"invoice_creation": null,"livemode": false,@@ -61,7 +61,7 @@"enabled": false},"recovered_from": null,- "setup_intent": "seti_1OX00cDEQaroqDjssWP8rzLa",+ "setup_intent": "seti_1OX09YDEQaroqDjsH3KFVptO","shipping": null,"shipping_address_collection": null,"shipping_options": [],@@ -72,7 +72,7 @@"success_url": "http://selfhosting.testserver/realm/ef44aac7-28b2-413b-9315-8f00f62d1697/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}","total_details": null,"ui_mode": "hosted",- "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED02Omh5eD2eqDkYLLEIWiL1pytNkSndVObnvpQGxy9OgRfOu3#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED024Qaa25FVCfS2lIRNj8Khr0nVqLtiyBPlw1CzZFCJ2xzQR9#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"}],"has_more": true,diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.create.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.create.1.jsonnew file mode 100644index 00000000000..3d6b9bc66c1--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.create.1.json@@ -0,0 +1,33 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "demo.example.com 6cde5f7a-1f7",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": null,+ "footer": null,+ "rendering_options": null+ },+ "livemode": false,+ "metadata": {+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none",+ "test_clock": null+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.modify.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.modify.1.jsonnew file mode 100644index 00000000000..95d1df79975--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.modify.1.json@@ -0,0 +1,33 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "demo.example.com 6cde5f7a-1f7",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1OX09HDEQaroqDjsST3QHbAw",+ "footer": null,+ "rendering_options": null+ },+ "livemode": false,+ "metadata": {+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none",+ "test_clock": null+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.retrieve.1.jsonnew file mode 100644index 00000000000..218883185d8--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.retrieve.1.json@@ -0,0 +1,79 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "demo.example.com 6cde5f7a-1f7",+ "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": 1,+ "exp_year": 2025,+ "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_1OX09HDEQaroqDjsST3QHbAw",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null,+ "rendering_options": null+ },+ "livemode": false,+ "metadata": {+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none",+ "test_clock": null+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.retrieve.2.jsonnew file mode 100644index 00000000000..218883185d8--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.retrieve.2.json@@ -0,0 +1,79 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "demo.example.com 6cde5f7a-1f7",+ "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": 1,+ "exp_year": 2025,+ "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_1OX09HDEQaroqDjsST3QHbAw",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null,+ "rendering_options": null+ },+ "livemode": false,+ "metadata": {+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none",+ "test_clock": null+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.retrieve.3.jsonnew file mode 100644index 00000000000..218883185d8--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.retrieve.3.json@@ -0,0 +1,79 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "demo.example.com 6cde5f7a-1f7",+ "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": 1,+ "exp_year": 2025,+ "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_1OX09HDEQaroqDjsST3QHbAw",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null,+ "rendering_options": null+ },+ "livemode": false,+ "metadata": {+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none",+ "test_clock": null+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.retrieve.4.jsonnew file mode 100644index 00000000000..218883185d8--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Customer.retrieve.4.json@@ -0,0 +1,79 @@+{+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "demo.example.com 6cde5f7a-1f7",+ "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": 1,+ "exp_year": 2025,+ "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_1OX09HDEQaroqDjsST3QHbAw",+ "livemode": false,+ "metadata": {},+ "object": "payment_method",+ "type": "card"+ },+ "footer": null,+ "rendering_options": null+ },+ "livemode": false,+ "metadata": {+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none",+ "test_clock": null+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.1.jsonnew file mode 100644index 00000000000..66d52d8f6ff--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.1.json@@ -0,0 +1,60 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": null,+ "default_currency": null,+ "default_source": null,+ "delinquent": false,+ "description": "demo.example.com 6cde5f7a-1f7",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1OX09HDEQaroqDjsST3QHbAw",+ "footer": null,+ "rendering_options": null+ },+ "livemode": false,+ "metadata": {+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none",+ "test_clock": null+ },+ "previous_attributes": {+ "invoice_settings": {+ "default_payment_method": null+ }+ }+ },+ "id": "evt_1OX09JDEQaroqDjsDQndL91y",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0001",+ "idempotency_key": "a9ce1402-3f3e-4f56-b0c3-4ec55bb8b957"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.2.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.2.jsonnew file mode 100644index 00000000000..b1ca6658fea--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.2.json@@ -0,0 +1,447 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 4300,+ "amount_capturable": 0,+ "amount_details": {+ "tip": {}+ },+ "amount_received": 4300,+ "application": null,+ "application_fee_amount": null,+ "automatic_payment_methods": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 4300,+ "amount_captured": 4300,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": "txn_NORMALIZED00000000000001",+ "billing_details": {+ "address": {+ "city": null,+ "country": null,+ "line1": null,+ "line2": null,+ "postal_code": null,+ "state": null+ },+ "email": null,+ "name": null,+ "phone": null+ },+ "calculated_statement_descriptor": "ZULIP BASIC",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Basic, $3.5 x 18 - $20.0 x 1",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_balance_transaction": null,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "18",+ "plan_tier": "103",+ "price_per_license": "350",+ "remote_server_host": "demo.example.com",+ "remote_server_user_email": "[email protected]",+ "remote_server_user_id": "1",+ "seat_count": "18",+ "type": "upgrade"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "approved_by_network",+ "reason": null,+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "Payment complete.",+ "type": "authorized"+ },+ "paid": true,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1OX09HDEQaroqDjsST3QHbAw",+ "payment_method_details": {+ "card": {+ "amount_authorized": 4300,+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 1,+ "exp_year": 2025,+ "extended_authorization": {+ "status": "disabled"+ },+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "incremental_authorization": {+ "status": "unavailable"+ },+ "installments": null,+ "last4": "4242",+ "mandate": null,+ "multicapture": {+ "status": "unavailable"+ },+ "network": "visa",+ "network_token": {+ "used": false+ },+ "overcapture": {+ "maximum_amount_capturable": 4300,+ "status": "unavailable"+ },+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "radar_options": {},+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKMGE-qwGMgZUBcV77xA6LBbdzXJX0QsLja69ddgGCUshzBDiaTgn-mRr19_0pQQ4g_etKED7s7YpRKjS",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Basic",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_0JWCg8rG2HhPCojbP2KAE8TiW",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Basic, $3.5 x 18 - $20.0 x 1",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "latest_charge": "ch_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "18",+ "plan_tier": "103",+ "price_per_license": "350",+ "remote_server_host": "demo.example.com",+ "remote_server_user_email": "[email protected]",+ "remote_server_user_id": "1",+ "seat_count": "18",+ "type": "upgrade"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1OX09HDEQaroqDjsST3QHbAw",+ "payment_method_configuration_details": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "mandate_options": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "processing": null,+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Basic",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3OX09MDEQaroqDjs0KDWSDDM",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "c758917e-6311-44fc-87d3-042db11a273c"+ },+ "type": "payment_intent.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 4300,+ "amount_captured": 4300,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": "txn_NORMALIZED00000000000001",+ "billing_details": {+ "address": {+ "city": null,+ "country": null,+ "line1": null,+ "line2": null,+ "postal_code": null,+ "state": null+ },+ "email": null,+ "name": null,+ "phone": null+ },+ "calculated_statement_descriptor": "ZULIP BASIC",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Basic, $3.5 x 18 - $20.0 x 1",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_balance_transaction": null,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "18",+ "plan_tier": "103",+ "price_per_license": "350",+ "remote_server_host": "demo.example.com",+ "remote_server_user_email": "[email protected]",+ "remote_server_user_id": "1",+ "seat_count": "18",+ "type": "upgrade"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "approved_by_network",+ "reason": null,+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "Payment complete.",+ "type": "authorized"+ },+ "paid": true,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1OX09HDEQaroqDjsST3QHbAw",+ "payment_method_details": {+ "card": {+ "amount_authorized": 4300,+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 1,+ "exp_year": 2025,+ "extended_authorization": {+ "status": "disabled"+ },+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "incremental_authorization": {+ "status": "unavailable"+ },+ "installments": null,+ "last4": "4242",+ "mandate": null,+ "multicapture": {+ "status": "unavailable"+ },+ "network": "visa",+ "network_token": {+ "used": false+ },+ "overcapture": {+ "maximum_amount_capturable": 4300,+ "status": "unavailable"+ },+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "radar_options": {},+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKMGE-qwGMgaGe_RmEQw6LBYWTpnPwuxJ7M_LKO4XnaNoob0Cq486-GvhQ_m90TG84b4nUpVhHT0pMYon",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Basic",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3OX09MDEQaroqDjs0vNXli1e",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "c758917e-6311-44fc-87d3-042db11a273c"+ },+ "type": "charge.succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 4300,+ "amount_capturable": 0,+ "amount_details": {+ "tip": {}+ },+ "amount_received": 0,+ "application": null,+ "application_fee_amount": null,+ "automatic_payment_methods": 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_0JWCg8rG2HhPCojbP2KAE8TiW",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Basic, $3.5 x 18 - $20.0 x 1",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "latest_charge": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "18",+ "plan_tier": "103",+ "price_per_license": "350",+ "remote_server_host": "demo.example.com",+ "remote_server_user_email": "[email protected]",+ "remote_server_user_id": "1",+ "seat_count": "18",+ "type": "upgrade"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_configuration_details": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "mandate_options": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "processing": null,+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Basic",+ "statement_descriptor_suffix": null,+ "status": "requires_payment_method",+ "transfer_data": null,+ "transfer_group": null+ }+ },+ "id": "evt_3OX09MDEQaroqDjs094mBHUA",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0002",+ "idempotency_key": "c758917e-6311-44fc-87d3-042db11a273c"+ },+ "type": "payment_intent.created"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.3.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.3.jsonnew file mode 100644index 00000000000..4adc442bb8f--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.3.json@@ -0,0 +1,812 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "Kandra Labs, Inc.",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "amount_shipping": 0,+ "application": null,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": true,+ "auto_advance": false,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": null,+ "collection_method": "charge_automatically",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0001",+ "customer_address": null,+ "customer_email": "[email protected]",+ "customer_name": null,+ "customer_phone": null,+ "customer_shipping": null,+ "customer_tax_exempt": "none",+ "customer_tax_ids": [],+ "default_payment_method": null,+ "default_source": null,+ "default_tax_rates": [],+ "description": null,+ "discount": null,+ "discounts": [],+ "due_date": null,+ "effective_at": 1000000000,+ "ending_balance": 0,+ "footer": null,+ "from_invoice": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdG9SN1Buakt3dUZCNG9aMWI0MTFibllDcUFMLDk1NDI3NjUy0200CsvbGkGG?s=ap",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdG9SN1Buakt3dUZCNG9aMWI0MTFibllDcUFMLDk1NDI3NjUy0200CsvbGkGG/pdf?s=ap",+ "last_finalization_error": null,+ "latest_revision": null,+ "lines": {+ "data": [+ {+ "amount": -2000,+ "amount_excluding_tax": -2000,+ "currency": "usd",+ "description": "$2000/month new customer discount",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000001",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0001",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-2000"+ },+ {+ "amount": 6300,+ "amount_excluding_tax": 6300,+ "currency": "usd",+ "description": "Zulip Basic",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000002",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0002",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 18,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "350"+ },+ {+ "amount": -4300,+ "amount_excluding_tax": -4300,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000003",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0003",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -4300,+ "unit_amount_decimal": "-4300"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-4300"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0001",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "paid_out_of_band": false,+ "payment_intent": null,+ "payment_settings": {+ "default_mandate": null,+ "payment_method_options": null,+ "payment_method_types": null+ },+ "period_end": 1000000000,+ "period_start": 1000000000,+ "post_payment_credit_notes_amount": 0,+ "pre_payment_credit_notes_amount": 0,+ "quote": null,+ "receipt_number": null,+ "rendering": {+ "amount_tax_display": null,+ "pdf": {+ "page_size": "letter"+ }+ },+ "rendering_options": null,+ "shipping_cost": null,+ "shipping_details": null,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Basic",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subscription_details": {+ "metadata": null+ },+ "subtotal": 0,+ "subtotal_excluding_tax": 0,+ "tax": null,+ "test_clock": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_excluding_tax": 0,+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ },+ "previous_attributes": {+ "attempted": false,+ "auto_advance": true,+ "effective_at": null,+ "ending_balance": null,+ "hosted_invoice_url": null,+ "invoice_pdf": null,+ "next_payment_attempt": 1000000000,+ "number": null,+ "paid": false,+ "rendering": {+ "pdf": {+ "page_size": "auto"+ }+ },+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "paid_at": null+ }+ }+ },+ "id": "evt_1OX09RDEQaroqDjs7m3nq8mh",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "e12424bd-25f8-4240-8111-f0804df39f66"+ },+ "type": "invoice.updated"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "Kandra Labs, Inc.",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "amount_shipping": 0,+ "application": null,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": false,+ "auto_advance": true,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": null,+ "collection_method": "charge_automatically",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0001",+ "customer_address": null,+ "customer_email": "[email protected]",+ "customer_name": null,+ "customer_phone": null,+ "customer_shipping": null,+ "customer_tax_exempt": "none",+ "customer_tax_ids": [],+ "default_payment_method": null,+ "default_source": null,+ "default_tax_rates": [],+ "description": null,+ "discount": null,+ "discounts": [],+ "due_date": null,+ "effective_at": null,+ "ending_balance": null,+ "footer": null,+ "from_invoice": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "latest_revision": null,+ "lines": {+ "data": [+ {+ "amount": -2000,+ "amount_excluding_tax": -2000,+ "currency": "usd",+ "description": "$2000/month new customer discount",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000001",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0001",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-2000"+ },+ {+ "amount": 6300,+ "amount_excluding_tax": 6300,+ "currency": "usd",+ "description": "Zulip Basic",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000002",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0002",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 18,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "350"+ },+ {+ "amount": -4300,+ "amount_excluding_tax": -4300,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000003",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0003",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -4300,+ "unit_amount_decimal": "-4300"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-4300"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "paid_out_of_band": false,+ "payment_intent": null,+ "payment_settings": {+ "default_mandate": null,+ "payment_method_options": null,+ "payment_method_types": null+ },+ "period_end": 1000000000,+ "period_start": 1000000000,+ "post_payment_credit_notes_amount": 0,+ "pre_payment_credit_notes_amount": 0,+ "quote": null,+ "receipt_number": null,+ "rendering": {+ "amount_tax_display": null,+ "pdf": {+ "page_size": "auto"+ }+ },+ "rendering_options": null,+ "shipping_cost": null,+ "shipping_details": null,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Basic",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subscription_details": {+ "metadata": null+ },+ "subtotal": 0,+ "subtotal_excluding_tax": 0,+ "tax": null,+ "test_clock": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_excluding_tax": 0,+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ }+ },+ "id": "evt_1OX09QDEQaroqDjslf1gJfp3",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0004",+ "idempotency_key": "1a4057b9-890a-4c1b-a247-51080273e7c7"+ },+ "type": "invoice.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -2000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "$2000/month new customer discount",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000001",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0001",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "test_clock": null,+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+ }+ },+ "id": "evt_1OX09PDEQaroqDjswLsz9MiN",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0005",+ "idempotency_key": "bd248d8b-cbbc-4861-8de5-18141cadde77"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": 6300,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Basic",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000002",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0002",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "quantity": 18,+ "subscription": null,+ "tax_rates": [],+ "test_clock": null,+ "unit_amount": 350,+ "unit_amount_decimal": "350"+ }+ },+ "id": "evt_1OX09ODEQaroqDjs5ZElGArM",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0006",+ "idempotency_key": "fd2529c3-b9e1-4f51-916f-af1bc565ce1f"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "amount": -4300,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000003",+ "invoice": null,+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000003",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0003",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -4300,+ "unit_amount_decimal": "-4300"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "test_clock": null,+ "unit_amount": -4300,+ "unit_amount_decimal": "-4300"+ }+ },+ "id": "evt_1OX09ODEQaroqDjs3gENVLy1",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "9588418f-48f8-4ef8-8e21-064f5e739c13"+ },+ "type": "invoiceitem.created"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "address": null,+ "balance": 0,+ "created": 1000000000,+ "currency": "usd",+ "default_currency": "usd",+ "default_source": null,+ "delinquent": false,+ "description": "demo.example.com 6cde5f7a-1f7",+ "discount": null,+ "email": "[email protected]",+ "id": "cus_NORMALIZED0001",+ "invoice_prefix": "NORMA01",+ "invoice_settings": {+ "custom_fields": null,+ "default_payment_method": "pm_1OX09HDEQaroqDjsST3QHbAw",+ "footer": null,+ "rendering_options": null+ },+ "livemode": false,+ "metadata": {+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"+ },+ "name": null,+ "next_invoice_sequence": 1,+ "object": "customer",+ "phone": null,+ "preferred_locales": [],+ "shipping": null,+ "tax_exempt": "none",+ "test_clock": null+ },+ "previous_attributes": {+ "currency": null,+ "default_currency": null+ }+ },+ "id": "evt_1OX09ODEQaroqDjs8PWbIANf",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0007",+ "idempotency_key": "9588418f-48f8-4ef8-8e21-064f5e739c13"+ },+ "type": "customer.updated"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.4.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.4.jsonnew file mode 100644index 00000000000..e00f952ed34--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.4.json@@ -0,0 +1,826 @@+{+ "data": [+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "Kandra Labs, Inc.",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "amount_shipping": 0,+ "application": null,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": true,+ "auto_advance": false,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": null,+ "collection_method": "charge_automatically",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0001",+ "customer_address": null,+ "customer_email": "[email protected]",+ "customer_name": null,+ "customer_phone": null,+ "customer_shipping": null,+ "customer_tax_exempt": "none",+ "customer_tax_ids": [],+ "default_payment_method": null,+ "default_source": null,+ "default_tax_rates": [],+ "description": null,+ "discount": null,+ "discounts": [],+ "due_date": null,+ "effective_at": 1000000000,+ "ending_balance": 0,+ "footer": null,+ "from_invoice": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdG9SN1Buakt3dUZCNG9aMWI0MTFibllDcUFMLDk1NDI3NjUz0200Zakxh2qm?s=ap",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdG9SN1Buakt3dUZCNG9aMWI0MTFibllDcUFMLDk1NDI3NjUz0200Zakxh2qm/pdf?s=ap",+ "last_finalization_error": null,+ "latest_revision": null,+ "lines": {+ "data": [+ {+ "amount": -2000,+ "amount_excluding_tax": -2000,+ "currency": "usd",+ "description": "$2000/month new customer discount",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000001",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0001",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-2000"+ },+ {+ "amount": 6300,+ "amount_excluding_tax": 6300,+ "currency": "usd",+ "description": "Zulip Basic",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000002",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0002",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 18,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "350"+ },+ {+ "amount": -4300,+ "amount_excluding_tax": -4300,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000003",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0003",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -4300,+ "unit_amount_decimal": "-4300"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-4300"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "paid_out_of_band": false,+ "payment_intent": null,+ "payment_settings": {+ "default_mandate": null,+ "payment_method_options": null,+ "payment_method_types": null+ },+ "period_end": 1000000000,+ "period_start": 1000000000,+ "post_payment_credit_notes_amount": 0,+ "pre_payment_credit_notes_amount": 0,+ "quote": null,+ "receipt_number": null,+ "rendering": {+ "amount_tax_display": null,+ "pdf": {+ "page_size": "letter"+ }+ },+ "rendering_options": null,+ "shipping_cost": null,+ "shipping_details": null,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Basic",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subscription_details": {+ "metadata": null+ },+ "subtotal": 0,+ "subtotal_excluding_tax": 0,+ "tax": null,+ "test_clock": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_excluding_tax": 0,+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1OX09RDEQaroqDjs1ogiml9b",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 2,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "e12424bd-25f8-4240-8111-f0804df39f66"+ },+ "type": "invoice.payment_succeeded"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "Kandra Labs, Inc.",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "amount_shipping": 0,+ "application": null,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": true,+ "auto_advance": false,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": null,+ "collection_method": "charge_automatically",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0001",+ "customer_address": null,+ "customer_email": "[email protected]",+ "customer_name": null,+ "customer_phone": null,+ "customer_shipping": null,+ "customer_tax_exempt": "none",+ "customer_tax_ids": [],+ "default_payment_method": null,+ "default_source": null,+ "default_tax_rates": [],+ "description": null,+ "discount": null,+ "discounts": [],+ "due_date": null,+ "effective_at": 1000000000,+ "ending_balance": 0,+ "footer": null,+ "from_invoice": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdG9SN1Buakt3dUZCNG9aMWI0MTFibllDcUFMLDk1NDI3NjUz0200Zakxh2qm?s=ap",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdG9SN1Buakt3dUZCNG9aMWI0MTFibllDcUFMLDk1NDI3NjUz0200Zakxh2qm/pdf?s=ap",+ "last_finalization_error": null,+ "latest_revision": null,+ "lines": {+ "data": [+ {+ "amount": -2000,+ "amount_excluding_tax": -2000,+ "currency": "usd",+ "description": "$2000/month new customer discount",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000001",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0001",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-2000"+ },+ {+ "amount": 6300,+ "amount_excluding_tax": 6300,+ "currency": "usd",+ "description": "Zulip Basic",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000002",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0002",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 18,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "350"+ },+ {+ "amount": -4300,+ "amount_excluding_tax": -4300,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000003",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0003",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -4300,+ "unit_amount_decimal": "-4300"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-4300"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "paid_out_of_band": false,+ "payment_intent": null,+ "payment_settings": {+ "default_mandate": null,+ "payment_method_options": null,+ "payment_method_types": null+ },+ "period_end": 1000000000,+ "period_start": 1000000000,+ "post_payment_credit_notes_amount": 0,+ "pre_payment_credit_notes_amount": 0,+ "quote": null,+ "receipt_number": null,+ "rendering": {+ "amount_tax_display": null,+ "pdf": {+ "page_size": "letter"+ }+ },+ "rendering_options": null,+ "shipping_cost": null,+ "shipping_details": null,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Basic",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subscription_details": {+ "metadata": null+ },+ "subtotal": 0,+ "subtotal_excluding_tax": 0,+ "tax": null,+ "test_clock": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_excluding_tax": 0,+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1OX09RDEQaroqDjsNtAgJsiG",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "e12424bd-25f8-4240-8111-f0804df39f66"+ },+ "type": "invoice.paid"+ },+ {+ "api_version": "2020-08-27",+ "created": 1000000000,+ "data": {+ "object": {+ "account_country": "US",+ "account_name": "Kandra Labs, Inc.",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "amount_shipping": 0,+ "application": null,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": true,+ "auto_advance": false,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": null,+ "collection_method": "charge_automatically",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0001",+ "customer_address": null,+ "customer_email": "[email protected]",+ "customer_name": null,+ "customer_phone": null,+ "customer_shipping": null,+ "customer_tax_exempt": "none",+ "customer_tax_ids": [],+ "default_payment_method": null,+ "default_source": null,+ "default_tax_rates": [],+ "description": null,+ "discount": null,+ "discounts": [],+ "due_date": null,+ "effective_at": 1000000000,+ "ending_balance": 0,+ "footer": null,+ "from_invoice": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdG9SN1Buakt3dUZCNG9aMWI0MTFibllDcUFMLDk1NDI3NjUz0200Zakxh2qm?s=ap",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdG9SN1Buakt3dUZCNG9aMWI0MTFibllDcUFMLDk1NDI3NjUz0200Zakxh2qm/pdf?s=ap",+ "last_finalization_error": null,+ "latest_revision": null,+ "lines": {+ "data": [+ {+ "amount": -2000,+ "amount_excluding_tax": -2000,+ "currency": "usd",+ "description": "$2000/month new customer discount",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000001",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0001",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-2000"+ },+ {+ "amount": 6300,+ "amount_excluding_tax": 6300,+ "currency": "usd",+ "description": "Zulip Basic",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000002",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0002",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 18,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "350"+ },+ {+ "amount": -4300,+ "amount_excluding_tax": -4300,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000003",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0003",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -4300,+ "unit_amount_decimal": "-4300"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-4300"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "paid_out_of_band": false,+ "payment_intent": null,+ "payment_settings": {+ "default_mandate": null,+ "payment_method_options": null,+ "payment_method_types": null+ },+ "period_end": 1000000000,+ "period_start": 1000000000,+ "post_payment_credit_notes_amount": 0,+ "pre_payment_credit_notes_amount": 0,+ "quote": null,+ "receipt_number": null,+ "rendering": {+ "amount_tax_display": null,+ "pdf": {+ "page_size": "letter"+ }+ },+ "rendering_options": null,+ "shipping_cost": null,+ "shipping_details": null,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Basic",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subscription_details": {+ "metadata": null+ },+ "subtotal": 0,+ "subtotal_excluding_tax": 0,+ "tax": null,+ "test_clock": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_excluding_tax": 0,+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ },+ "id": "evt_1OX09RDEQaroqDjs2IUlZJQx",+ "livemode": false,+ "object": "event",+ "pending_webhooks": 0,+ "request": {+ "id": "req_NORMALIZED0003",+ "idempotency_key": "e12424bd-25f8-4240-8111-f0804df39f66"+ },+ "type": "invoice.finalized"+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.5.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.5.jsonnew file mode 100644index 00000000000..6d922067afe--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Event.list.5.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/events"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.create.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.create.1.jsonnew file mode 100644index 00000000000..d02d9463d1f--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.create.1.json@@ -0,0 +1,258 @@+{+ "account_country": "US",+ "account_name": "Kandra Labs, Inc.",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "amount_shipping": 0,+ "application": null,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": false,+ "auto_advance": true,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": null,+ "collection_method": "charge_automatically",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0001",+ "customer_address": null,+ "customer_email": "[email protected]",+ "customer_name": null,+ "customer_phone": null,+ "customer_shipping": null,+ "customer_tax_exempt": "none",+ "customer_tax_ids": [],+ "default_payment_method": null,+ "default_source": null,+ "default_tax_rates": [],+ "description": null,+ "discount": null,+ "discounts": [],+ "due_date": null,+ "effective_at": null,+ "ending_balance": null,+ "footer": null,+ "from_invoice": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "latest_revision": null,+ "lines": {+ "data": [+ {+ "amount": -2000,+ "amount_excluding_tax": -2000,+ "currency": "usd",+ "description": "$2000/month new customer discount",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000001",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0001",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-2000"+ },+ {+ "amount": 6300,+ "amount_excluding_tax": 6300,+ "currency": "usd",+ "description": "Zulip Basic",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000002",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0002",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 18,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "350"+ },+ {+ "amount": -4300,+ "amount_excluding_tax": -4300,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000003",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0003",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -4300,+ "unit_amount_decimal": "-4300"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-4300"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "paid_out_of_band": false,+ "payment_intent": null,+ "payment_settings": {+ "default_mandate": null,+ "payment_method_options": null,+ "payment_method_types": null+ },+ "period_end": 1000000000,+ "period_start": 1000000000,+ "post_payment_credit_notes_amount": 0,+ "pre_payment_credit_notes_amount": 0,+ "quote": null,+ "receipt_number": null,+ "rendering": {+ "amount_tax_display": null,+ "pdf": {+ "page_size": "auto"+ }+ },+ "rendering_options": null,+ "shipping_cost": null,+ "shipping_details": null,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Basic",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subscription_details": {+ "metadata": null+ },+ "subtotal": 0,+ "subtotal_excluding_tax": 0,+ "tax": null,+ "test_clock": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_excluding_tax": 0,+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.create.2.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.create.2.jsonnew file mode 100644index 00000000000..c94c03c007f--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.create.2.json@@ -0,0 +1,258 @@+{+ "account_country": "US",+ "account_name": "Kandra Labs, Inc.",+ "account_tax_ids": null,+ "amount_due": 7685,+ "amount_paid": 0,+ "amount_remaining": 7685,+ "amount_shipping": 0,+ "application": null,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": false,+ "auto_advance": true,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": null,+ "collection_method": "charge_automatically",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0001",+ "customer_address": null,+ "customer_email": "[email protected]",+ "customer_name": null,+ "customer_phone": null,+ "customer_shipping": null,+ "customer_tax_exempt": "none",+ "customer_tax_ids": [],+ "default_payment_method": null,+ "default_source": null,+ "default_tax_rates": [],+ "description": null,+ "discount": null,+ "discounts": [],+ "due_date": null,+ "effective_at": null,+ "ending_balance": null,+ "footer": null,+ "from_invoice": null,+ "hosted_invoice_url": null,+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": null,+ "last_finalization_error": null,+ "latest_revision": null,+ "lines": {+ "data": [+ {+ "amount": -2000,+ "amount_excluding_tax": -2000,+ "currency": "usd",+ "description": "$20.00/month new customer discount",+ "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",+ "custom_unit_amount": null,+ "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": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-2000"+ },+ {+ "amount": 8050,+ "amount_excluding_tax": 8050,+ "currency": "usd",+ "description": "Zulip Basic - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1330657445,+ "start": 1328151845+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "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": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "350"+ },+ {+ "amount": 1635,+ "amount_excluding_tax": 1635,+ "currency": "usd",+ "description": "Additional license (Jan 4, 2012 - Feb 2, 2012)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1328151845,+ "start": 1325646245+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "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": 327,+ "unit_amount_decimal": "327"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 5,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "327"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": null,+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "paid_out_of_band": false,+ "payment_intent": null,+ "payment_settings": {+ "default_mandate": null,+ "payment_method_options": null,+ "payment_method_types": null+ },+ "period_end": 1000000000,+ "period_start": 1000000000,+ "post_payment_credit_notes_amount": 0,+ "pre_payment_credit_notes_amount": 0,+ "quote": null,+ "receipt_number": null,+ "rendering": {+ "amount_tax_display": null,+ "pdf": {+ "page_size": "auto"+ }+ },+ "rendering_options": null,+ "shipping_cost": null,+ "shipping_details": null,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Basic",+ "status": "draft",+ "status_transitions": {+ "finalized_at": null,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subscription_details": {+ "metadata": null+ },+ "subtotal": 7685,+ "subtotal_excluding_tax": 7685,+ "tax": null,+ "test_clock": null,+ "total": 7685,+ "total_discount_amounts": [],+ "total_excluding_tax": 7685,+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.finalize_invoice.1.jsonnew file mode 100644index 00000000000..755c5ec7e5e--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.finalize_invoice.1.json@@ -0,0 +1,258 @@+{+ "account_country": "US",+ "account_name": "Kandra Labs, Inc.",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "amount_shipping": 0,+ "application": null,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": true,+ "auto_advance": false,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": null,+ "collection_method": "charge_automatically",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0001",+ "customer_address": null,+ "customer_email": "[email protected]",+ "customer_name": null,+ "customer_phone": null,+ "customer_shipping": null,+ "customer_tax_exempt": "none",+ "customer_tax_ids": [],+ "default_payment_method": null,+ "default_source": null,+ "default_tax_rates": [],+ "description": null,+ "discount": null,+ "discounts": [],+ "due_date": null,+ "effective_at": 1000000000,+ "ending_balance": 0,+ "footer": null,+ "from_invoice": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdG9SN1Buakt3dUZCNG9aMWI0MTFibllDcUFMLDk1NDI3NjUy0200CsvbGkGG?s=ap",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdG9SN1Buakt3dUZCNG9aMWI0MTFibllDcUFMLDk1NDI3NjUy0200CsvbGkGG/pdf?s=ap",+ "last_finalization_error": null,+ "latest_revision": null,+ "lines": {+ "data": [+ {+ "amount": -2000,+ "amount_excluding_tax": -2000,+ "currency": "usd",+ "description": "$2000/month new customer discount",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000001",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0001",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-2000"+ },+ {+ "amount": 6300,+ "amount_excluding_tax": 6300,+ "currency": "usd",+ "description": "Zulip Basic",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000002",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0002",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 18,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "350"+ },+ {+ "amount": -4300,+ "amount_excluding_tax": -4300,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000003",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0003",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -4300,+ "unit_amount_decimal": "-4300"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-4300"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "paid_out_of_band": false,+ "payment_intent": null,+ "payment_settings": {+ "default_mandate": null,+ "payment_method_options": null,+ "payment_method_types": null+ },+ "period_end": 1000000000,+ "period_start": 1000000000,+ "post_payment_credit_notes_amount": 0,+ "pre_payment_credit_notes_amount": 0,+ "quote": null,+ "receipt_number": null,+ "rendering": {+ "amount_tax_display": null,+ "pdf": {+ "page_size": "letter"+ }+ },+ "rendering_options": null,+ "shipping_cost": null,+ "shipping_details": null,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Basic",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subscription_details": {+ "metadata": null+ },+ "subtotal": 0,+ "subtotal_excluding_tax": 0,+ "tax": null,+ "test_clock": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_excluding_tax": 0,+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.finalize_invoice.2.jsonnew file mode 100644index 00000000000..9c3666f4c1b--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.finalize_invoice.2.json@@ -0,0 +1,258 @@+{+ "account_country": "US",+ "account_name": "Kandra Labs, Inc.",+ "account_tax_ids": null,+ "amount_due": 7685,+ "amount_paid": 0,+ "amount_remaining": 7685,+ "amount_shipping": 0,+ "application": null,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": false,+ "auto_advance": true,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": null,+ "collection_method": "charge_automatically",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0001",+ "customer_address": null,+ "customer_email": "[email protected]",+ "customer_name": null,+ "customer_phone": null,+ "customer_shipping": null,+ "customer_tax_exempt": "none",+ "customer_tax_ids": [],+ "default_payment_method": null,+ "default_source": null,+ "default_tax_rates": [],+ "description": null,+ "discount": null,+ "discounts": [],+ "due_date": null,+ "effective_at": 1000000000,+ "ending_balance": 0,+ "footer": null,+ "from_invoice": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZelBXMm1OV3hSNnV5NjZXbk9SeWxvczVoUHpmLDk1NDI3NjU30200uRstIs2s?s=ap",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZelBXMm1OV3hSNnV5NjZXbk9SeWxvczVoUHpmLDk1NDI3NjU30200uRstIs2s/pdf?s=ap",+ "last_finalization_error": null,+ "latest_revision": null,+ "lines": {+ "data": [+ {+ "amount": -2000,+ "amount_excluding_tax": -2000,+ "currency": "usd",+ "description": "$20.00/month new customer discount",+ "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",+ "custom_unit_amount": null,+ "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": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-2000"+ },+ {+ "amount": 8050,+ "amount_excluding_tax": 8050,+ "currency": "usd",+ "description": "Zulip Basic - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1330657445,+ "start": 1328151845+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "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": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "350"+ },+ {+ "amount": 1635,+ "amount_excluding_tax": 1635,+ "currency": "usd",+ "description": "Additional license (Jan 4, 2012 - Feb 2, 2012)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1328151845,+ "start": 1325646245+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "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": 327,+ "unit_amount_decimal": "327"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 5,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "327"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "paid_out_of_band": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "default_mandate": null,+ "payment_method_options": null,+ "payment_method_types": null+ },+ "period_end": 1000000000,+ "period_start": 1000000000,+ "post_payment_credit_notes_amount": 0,+ "pre_payment_credit_notes_amount": 0,+ "quote": null,+ "receipt_number": null,+ "rendering": {+ "amount_tax_display": null,+ "pdf": {+ "page_size": "letter"+ }+ },+ "rendering_options": null,+ "shipping_cost": null,+ "shipping_details": null,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Basic",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subscription_details": {+ "metadata": null+ },+ "subtotal": 7685,+ "subtotal_excluding_tax": 7685,+ "tax": null,+ "test_clock": null,+ "total": 7685,+ "total_discount_amounts": [],+ "total_excluding_tax": 7685,+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.list.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.list.1.jsonnew file mode 100644index 00000000000..e39960ab725--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.list.1.json@@ -0,0 +1,6 @@+{+ "data": [],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.list.2.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.list.2.jsonnew file mode 100644index 00000000000..1ab39a2032d--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--Invoice.list.2.json@@ -0,0 +1,523 @@+{+ "data": [+ {+ "account_country": "US",+ "account_name": "Kandra Labs, Inc.",+ "account_tax_ids": null,+ "amount_due": 7685,+ "amount_paid": 0,+ "amount_remaining": 7685,+ "amount_shipping": 0,+ "application": null,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": false,+ "auto_advance": true,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": null,+ "collection_method": "charge_automatically",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0001",+ "customer_address": null,+ "customer_email": "[email protected]",+ "customer_name": null,+ "customer_phone": null,+ "customer_shipping": null,+ "customer_tax_exempt": "none",+ "customer_tax_ids": [],+ "default_payment_method": null,+ "default_source": null,+ "default_tax_rates": [],+ "description": null,+ "discount": null,+ "discounts": [],+ "due_date": null,+ "effective_at": 1000000000,+ "ending_balance": 0,+ "footer": null,+ "from_invoice": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZelBXMm1OV3hSNnV5NjZXbk9SeWxvczVoUHpmLDk1NDI3NjU40200W4Vfbla8?s=ap",+ "id": "in_NORMALIZED00000000000002",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZelBXMm1OV3hSNnV5NjZXbk9SeWxvczVoUHpmLDk1NDI3NjU40200W4Vfbla8/pdf?s=ap",+ "last_finalization_error": null,+ "latest_revision": null,+ "lines": {+ "data": [+ {+ "amount": -2000,+ "amount_excluding_tax": -2000,+ "currency": "usd",+ "description": "$20.00/month new customer discount",+ "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",+ "custom_unit_amount": null,+ "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": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-2000"+ },+ {+ "amount": 8050,+ "amount_excluding_tax": 8050,+ "currency": "usd",+ "description": "Zulip Basic - renewal",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000005",+ "invoice_item": "ii_NORMALIZED00000000000005",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1330657445,+ "start": 1328151845+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "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": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 23,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "350"+ },+ {+ "amount": 1635,+ "amount_excluding_tax": 1635,+ "currency": "usd",+ "description": "Additional license (Jan 4, 2012 - Feb 2, 2012)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000006",+ "invoice_item": "ii_NORMALIZED00000000000006",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1328151845,+ "start": 1325646245+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "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": 327,+ "unit_amount_decimal": "327"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 5,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "327"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000002/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": 1000000000,+ "number": "NORMALI-0003",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": false,+ "paid_out_of_band": false,+ "payment_intent": "pi_NORMALIZED00000000000002",+ "payment_settings": {+ "default_mandate": null,+ "payment_method_options": null,+ "payment_method_types": null+ },+ "period_end": 1000000000,+ "period_start": 1000000000,+ "post_payment_credit_notes_amount": 0,+ "pre_payment_credit_notes_amount": 0,+ "quote": null,+ "receipt_number": null,+ "rendering": {+ "amount_tax_display": null,+ "pdf": {+ "page_size": "letter"+ }+ },+ "rendering_options": null,+ "shipping_cost": null,+ "shipping_details": null,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Basic",+ "status": "open",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": null,+ "voided_at": null+ },+ "subscription": null,+ "subscription_details": {+ "metadata": null+ },+ "subtotal": 7685,+ "subtotal_excluding_tax": 7685,+ "tax": null,+ "test_clock": null,+ "total": 7685,+ "total_discount_amounts": [],+ "total_excluding_tax": 7685,+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": null+ },+ {+ "account_country": "US",+ "account_name": "Kandra Labs, Inc.",+ "account_tax_ids": null,+ "amount_due": 0,+ "amount_paid": 0,+ "amount_remaining": 0,+ "amount_shipping": 0,+ "application": null,+ "application_fee_amount": null,+ "attempt_count": 0,+ "attempted": true,+ "auto_advance": false,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_reason": "manual",+ "charge": null,+ "collection_method": "charge_automatically",+ "created": 1000000000,+ "currency": "usd",+ "custom_fields": null,+ "customer": "cus_NORMALIZED0001",+ "customer_address": null,+ "customer_email": "[email protected]",+ "customer_name": null,+ "customer_phone": null,+ "customer_shipping": null,+ "customer_tax_exempt": "none",+ "customer_tax_ids": [],+ "default_payment_method": null,+ "default_source": null,+ "default_tax_rates": [],+ "description": null,+ "discount": null,+ "discounts": [],+ "due_date": null,+ "effective_at": 1000000000,+ "ending_balance": 0,+ "footer": null,+ "from_invoice": null,+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdG9SN1Buakt3dUZCNG9aMWI0MTFibllDcUFMLDk1NDI3NjU40200tW7k6eRa?s=ap",+ "id": "in_NORMALIZED00000000000001",+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QTGhZdG9SN1Buakt3dUZCNG9aMWI0MTFibllDcUFMLDk1NDI3NjU40200tW7k6eRa/pdf?s=ap",+ "last_finalization_error": null,+ "latest_revision": null,+ "lines": {+ "data": [+ {+ "amount": -2000,+ "amount_excluding_tax": -2000,+ "currency": "usd",+ "description": "$2000/month new customer discount",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000001",+ "invoice_item": "ii_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000001",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0001",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-2000"+ },+ {+ "amount": 6300,+ "amount_excluding_tax": 6300,+ "currency": "usd",+ "description": "Zulip Basic",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000002",+ "invoice_item": "ii_NORMALIZED00000000000002",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000002",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0002",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 18,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "350"+ },+ {+ "amount": -4300,+ "amount_excluding_tax": -4300,+ "currency": "usd",+ "description": "Payment (Card ending in 4242)",+ "discount_amounts": [],+ "discountable": false,+ "discounts": [],+ "id": "il_NORMALIZED00000000000003",+ "invoice_item": "ii_NORMALIZED00000000000003",+ "livemode": false,+ "metadata": {},+ "object": "line_item",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000003",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0003",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -4300,+ "unit_amount_decimal": "-4300"+ },+ "proration": false,+ "proration_details": {+ "credited_items": null+ },+ "quantity": 1,+ "subscription": null,+ "tax_amounts": [],+ "tax_rates": [],+ "type": "invoiceitem",+ "unit_amount_excluding_tax": "-4300"+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 3,+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"+ },+ "livemode": false,+ "metadata": {},+ "next_payment_attempt": null,+ "number": "NORMALI-0002",+ "object": "invoice",+ "on_behalf_of": null,+ "paid": true,+ "paid_out_of_band": false,+ "payment_intent": null,+ "payment_settings": {+ "default_mandate": null,+ "payment_method_options": null,+ "payment_method_types": null+ },+ "period_end": 1000000000,+ "period_start": 1000000000,+ "post_payment_credit_notes_amount": 0,+ "pre_payment_credit_notes_amount": 0,+ "quote": null,+ "receipt_number": null,+ "rendering": {+ "amount_tax_display": null,+ "pdf": {+ "page_size": "letter"+ }+ },+ "rendering_options": null,+ "shipping_cost": null,+ "shipping_details": null,+ "starting_balance": 0,+ "statement_descriptor": "Zulip Basic",+ "status": "paid",+ "status_transitions": {+ "finalized_at": 1000000000,+ "marked_uncollectible_at": null,+ "paid_at": 1000000000,+ "voided_at": null+ },+ "subscription": null,+ "subscription_details": {+ "metadata": null+ },+ "subtotal": 0,+ "subtotal_excluding_tax": 0,+ "tax": null,+ "test_clock": null,+ "total": 0,+ "total_discount_amounts": [],+ "total_excluding_tax": 0,+ "total_tax_amounts": [],+ "transfer_data": null,+ "webhooks_delivered_at": 1000000000+ }+ ],+ "has_more": false,+ "object": "list",+ "url": "/v1/invoices"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.1.jsonnew file mode 100644index 00000000000..d320083b024--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.1.json@@ -0,0 +1,47 @@+{+ "amount": -4300,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Payment (Card ending in 4242)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000003",+ "invoice": null,+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000003",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0003",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -4300,+ "unit_amount_decimal": "-4300"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "test_clock": null,+ "unit_amount": -4300,+ "unit_amount_decimal": "-4300"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.2.jsonnew file mode 100644index 00000000000..40deb8de9cc--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.2.json@@ -0,0 +1,47 @@+{+ "amount": 6300,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Basic",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000002",+ "invoice": null,+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1328151845,+ "start": 1325473445+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000002",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0002",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "quantity": 18,+ "subscription": null,+ "tax_rates": [],+ "test_clock": null,+ "unit_amount": 350,+ "unit_amount_decimal": "350"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.3.jsonnew file mode 100644index 00000000000..4ce78115221--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.3.json@@ -0,0 +1,47 @@+{+ "amount": -2000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "$2000/month new customer discount",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1000000000,+ "start": 1000000000+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "id": "price_NORMALIZED00000000000001",+ "livemode": false,+ "lookup_key": null,+ "metadata": {},+ "nickname": null,+ "object": "price",+ "product": "prod_NORMALIZED0001",+ "recurring": null,+ "tax_behavior": "unspecified",+ "tiers_mode": null,+ "transform_quantity": null,+ "type": "one_time",+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "test_clock": null,+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.4.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.4.jsonnew file mode 100644index 00000000000..c0d44abd080--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.4.json@@ -0,0 +1,47 @@+{+ "amount": 1635,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Additional license (Jan 4, 2012 - Feb 2, 2012)",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000006",+ "invoice": null,+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1328151845,+ "start": 1325646245+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "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": 327,+ "unit_amount_decimal": "327"+ },+ "proration": false,+ "quantity": 5,+ "subscription": null,+ "tax_rates": [],+ "test_clock": null,+ "unit_amount": 327,+ "unit_amount_decimal": "327"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.5.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.5.jsonnew file mode 100644index 00000000000..67e889dd03e--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.5.json@@ -0,0 +1,47 @@+{+ "amount": 8050,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "Zulip Basic - renewal",+ "discountable": false,+ "discounts": [],+ "id": "ii_NORMALIZED00000000000005",+ "invoice": null,+ "livemode": false,+ "metadata": {},+ "object": "invoiceitem",+ "period": {+ "end": 1330657445,+ "start": 1328151845+ },+ "plan": null,+ "price": {+ "active": false,+ "billing_scheme": "per_unit",+ "created": 1000000000,+ "currency": "usd",+ "custom_unit_amount": null,+ "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": 350,+ "unit_amount_decimal": "350"+ },+ "proration": false,+ "quantity": 23,+ "subscription": null,+ "tax_rates": [],+ "test_clock": null,+ "unit_amount": 350,+ "unit_amount_decimal": "350"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.6.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.6.jsonnew file mode 100644index 00000000000..fba69300878--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--InvoiceItem.create.6.json@@ -0,0 +1,47 @@+{+ "amount": -2000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "date": 1000000000,+ "description": "$20.00/month new customer discount",+ "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",+ "custom_unit_amount": null,+ "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": -2000,+ "unit_amount_decimal": "-2000"+ },+ "proration": false,+ "quantity": 1,+ "subscription": null,+ "tax_rates": [],+ "test_clock": null,+ "unit_amount": -2000,+ "unit_amount_decimal": "-2000"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--PaymentIntent.create.1.jsonnew file mode 100644index 00000000000..b868828e972--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--PaymentIntent.create.1.json@@ -0,0 +1,198 @@+{+ "amount": 4300,+ "amount_capturable": 0,+ "amount_details": {+ "tip": {}+ },+ "amount_received": 4300,+ "application": null,+ "application_fee_amount": null,+ "automatic_payment_methods": null,+ "canceled_at": null,+ "cancellation_reason": null,+ "capture_method": "automatic",+ "charges": {+ "data": [+ {+ "amount": 4300,+ "amount_captured": 4300,+ "amount_refunded": 0,+ "application": null,+ "application_fee": null,+ "application_fee_amount": null,+ "balance_transaction": "txn_NORMALIZED00000000000001",+ "billing_details": {+ "address": {+ "city": null,+ "country": null,+ "line1": null,+ "line2": null,+ "postal_code": null,+ "state": null+ },+ "email": null,+ "name": null,+ "phone": null+ },+ "calculated_statement_descriptor": "ZULIP BASIC",+ "captured": true,+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Basic, $3.5 x 18 - $20.0 x 1",+ "destination": null,+ "dispute": null,+ "disputed": false,+ "failure_balance_transaction": null,+ "failure_code": null,+ "failure_message": null,+ "fraud_details": {},+ "id": "ch_NORMALIZED00000000000001",+ "invoice": null,+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "18",+ "plan_tier": "103",+ "price_per_license": "350",+ "remote_server_host": "demo.example.com",+ "remote_server_user_email": "[email protected]",+ "remote_server_user_id": "1",+ "seat_count": "18",+ "type": "upgrade"+ },+ "object": "charge",+ "on_behalf_of": null,+ "order": null,+ "outcome": {+ "network_status": "approved_by_network",+ "reason": null,+ "risk_level": "normal",+ "risk_score": 0,+ "seller_message": "Payment complete.",+ "type": "authorized"+ },+ "paid": true,+ "payment_intent": "pi_NORMALIZED00000000000001",+ "payment_method": "pm_1OX09HDEQaroqDjsST3QHbAw",+ "payment_method_details": {+ "card": {+ "amount_authorized": 4300,+ "brand": "visa",+ "checks": {+ "address_line1_check": null,+ "address_postal_code_check": null,+ "cvc_check": "pass"+ },+ "country": "US",+ "exp_month": 1,+ "exp_year": 2025,+ "extended_authorization": {+ "status": "disabled"+ },+ "fingerprint": "NORMALIZED000001",+ "funding": "credit",+ "incremental_authorization": {+ "status": "unavailable"+ },+ "installments": null,+ "last4": "4242",+ "mandate": null,+ "multicapture": {+ "status": "unavailable"+ },+ "network": "visa",+ "network_token": {+ "used": false+ },+ "overcapture": {+ "maximum_amount_capturable": 4300,+ "status": "unavailable"+ },+ "three_d_secure": null,+ "wallet": null+ },+ "type": "card"+ },+ "radar_options": {},+ "receipt_email": "[email protected]",+ "receipt_number": null,+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKMGE-qwGMgbjNb_zna06LBbJvOR4uNUeHo0D6ppoKUIwlTA5Wfzz9XRSLDaTwA7160L8ft8pZEQdxAmA",+ "refunded": false,+ "refunds": {+ "data": [],+ "has_more": false,+ "object": "list",+ "total_count": 0,+ "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"+ },+ "review": null,+ "shipping": null,+ "source": null,+ "source_transfer": null,+ "statement_descriptor": "Zulip Basic",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+ }+ ],+ "has_more": false,+ "object": "list",+ "total_count": 1,+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"+ },+ "client_secret": "pi_NORMALIZED00000000000001_secret_0JWCg8rG2HhPCojbP2KAE8TiW",+ "confirmation_method": "automatic",+ "created": 1000000000,+ "currency": "usd",+ "customer": "cus_NORMALIZED0001",+ "description": "Upgrade to Zulip Basic, $3.5 x 18 - $20.0 x 1",+ "id": "pi_NORMALIZED00000000000001",+ "invoice": null,+ "last_payment_error": null,+ "latest_charge": "ch_NORMALIZED00000000000001",+ "livemode": false,+ "metadata": {+ "billing_modality": "charge_automatically",+ "billing_schedule": "2",+ "license_management": "automatic",+ "licenses": "18",+ "plan_tier": "103",+ "price_per_license": "350",+ "remote_server_host": "demo.example.com",+ "remote_server_user_email": "[email protected]",+ "remote_server_user_id": "1",+ "seat_count": "18",+ "type": "upgrade"+ },+ "next_action": null,+ "object": "payment_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1OX09HDEQaroqDjsST3QHbAw",+ "payment_method_configuration_details": null,+ "payment_method_options": {+ "card": {+ "installments": null,+ "mandate_options": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "processing": null,+ "receipt_email": "[email protected]",+ "review": null,+ "setup_future_usage": null,+ "shipping": null,+ "source": null,+ "statement_descriptor": "Zulip Basic",+ "statement_descriptor_suffix": null,+ "status": "succeeded",+ "transfer_data": null,+ "transfer_group": null+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--SetupIntent.create.1.jsonnew file mode 100644index 00000000000..134f71ff5a5--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--SetupIntent.create.1.json@@ -0,0 +1,34 @@+{+ "application": null,+ "automatic_payment_methods": null,+ "cancellation_reason": null,+ "client_secret": "seti_1OX09HDEQaroqDjs4Pcxrn09_secret_PLhYDBekyXsNW8WCamT0WfO1HMKhExQ",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "flow_directions": null,+ "id": "seti_1OX09HDEQaroqDjs4Pcxrn09",+ "last_setup_error": null,+ "latest_attempt": "setatt_1OX09HDEQaroqDjsNWMNxxF1",+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1OX09HDEQaroqDjsST3QHbAw",+ "payment_method_configuration_details": null,+ "payment_method_options": {+ "card": {+ "mandate_options": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--SetupIntent.list.1.jsonnew file mode 100644index 00000000000..5e30f4acefe--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--SetupIntent.list.1.json@@ -0,0 +1,41 @@+{+ "data": [+ {+ "application": null,+ "automatic_payment_methods": null,+ "cancellation_reason": null,+ "client_secret": "seti_1OX09GDEQaroqDjsKbcVZMx8_secret_PLhYxd6TPa6zCYA6bpfmD23RLZNzxqs",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "flow_directions": null,+ "id": "seti_1OX09GDEQaroqDjsKbcVZMx8",+ "last_setup_error": null,+ "latest_attempt": null,+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": null,+ "payment_method_configuration_details": null,+ "payment_method_options": {+ "card": {+ "mandate_options": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "requires_payment_method",+ "usage": "off_session"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/setup_intents"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--SetupIntent.retrieve.1.jsonnew file mode 100644index 00000000000..134f71ff5a5--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--SetupIntent.retrieve.1.json@@ -0,0 +1,34 @@+{+ "application": null,+ "automatic_payment_methods": null,+ "cancellation_reason": null,+ "client_secret": "seti_1OX09HDEQaroqDjs4Pcxrn09_secret_PLhYDBekyXsNW8WCamT0WfO1HMKhExQ",+ "created": 1000000000,+ "customer": "cus_NORMALIZED0001",+ "description": null,+ "flow_directions": null,+ "id": "seti_1OX09HDEQaroqDjs4Pcxrn09",+ "last_setup_error": null,+ "latest_attempt": "setatt_1OX09HDEQaroqDjsNWMNxxF1",+ "livemode": false,+ "mandate": null,+ "metadata": {},+ "next_action": null,+ "object": "setup_intent",+ "on_behalf_of": null,+ "payment_method": "pm_1OX09HDEQaroqDjsST3QHbAw",+ "payment_method_configuration_details": null,+ "payment_method_options": {+ "card": {+ "mandate_options": null,+ "network": null,+ "request_three_d_secure": "automatic"+ }+ },+ "payment_method_types": [+ "card"+ ],+ "single_use_mandate": null,+ "status": "succeeded",+ "usage": "off_session"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--checkout.Session.create.1.jsonnew file mode 100644index 00000000000..374a2020b25--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--checkout.Session.create.1.json@@ -0,0 +1,74 @@+{+ "after_expiration": null,+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/upgrade/?manual_license_management=false&tier=1",+ "client_reference_id": null,+ "client_secret": null,+ "consent": null,+ "consent_collection": null,+ "created": 1000000000,+ "currency": null,+ "currency_conversion": null,+ "custom_fields": [],+ "custom_text": {+ "after_submit": null,+ "shipping_address": null,+ "submit": null,+ "terms_of_service_acceptance": null+ },+ "customer": "cus_NORMALIZED0001",+ "customer_creation": null,+ "customer_details": {+ "address": null,+ "email": "[email protected]",+ "name": null,+ "phone": null,+ "tax_exempt": null,+ "tax_ids": null+ },+ "customer_email": null,+ "expires_at": 1000000000,+ "id": "cs_test_NORMALIZED02AcMUiBJ4ndu0XVm6s5ieYiv9vd8CA0WLofCukAraBbvNme",+ "invoice": null,+ "invoice_creation": null,+ "livemode": false,+ "locale": null,+ "metadata": {+ "remote_server_user_id": "1",+ "type": "card_update"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_link": null,+ "payment_method_collection": "always",+ "payment_method_configuration_details": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "phone_number_collection": {+ "enabled": false+ },+ "recovered_from": null,+ "setup_intent": "seti_1OX09GDEQaroqDjsKbcVZMx8",+ "shipping": null,+ "shipping_address_collection": null,+ "shipping_options": [],+ "shipping_rate": null,+ "status": "open",+ "submit_type": null,+ "subscription": null,+ "success_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "ui_mode": "hosted",+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED02AcMUiBJ4ndu0XVm6s5ieYiv9vd8CA0WLofCukAraBbvNme#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"+}diff --git a/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--checkout.Session.list.1.jsonnew file mode 100644index 00000000000..e8ce746bed3--- /dev/null+++ b/corporate/tests/stripe_fixtures/invoice_plans_as_needed_server--checkout.Session.list.1.json@@ -0,0 +1,81 @@+{+ "data": [+ {+ "after_expiration": null,+ "allow_promotion_codes": null,+ "amount_subtotal": null,+ "amount_total": null,+ "automatic_tax": {+ "enabled": false,+ "status": null+ },+ "billing_address_collection": null,+ "cancel_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/upgrade/?manual_license_management=false&tier=1",+ "client_reference_id": null,+ "client_secret": null,+ "consent": null,+ "consent_collection": null,+ "created": 1000000000,+ "currency": null,+ "currency_conversion": null,+ "custom_fields": [],+ "custom_text": {+ "after_submit": null,+ "shipping_address": null,+ "submit": null,+ "terms_of_service_acceptance": null+ },+ "customer": "cus_NORMALIZED0001",+ "customer_creation": null,+ "customer_details": {+ "address": null,+ "email": "[email protected]",+ "name": null,+ "phone": null,+ "tax_exempt": null,+ "tax_ids": null+ },+ "customer_email": null,+ "expires_at": 1000000000,+ "id": "cs_test_NORMALIZED02AcMUiBJ4ndu0XVm6s5ieYiv9vd8CA0WLofCukAraBbvNme",+ "invoice": null,+ "invoice_creation": null,+ "livemode": false,+ "locale": null,+ "metadata": {+ "remote_server_user_id": "1",+ "type": "card_update"+ },+ "mode": "setup",+ "object": "checkout.session",+ "payment_intent": null,+ "payment_link": null,+ "payment_method_collection": "always",+ "payment_method_configuration_details": null,+ "payment_method_options": {},+ "payment_method_types": [+ "card"+ ],+ "payment_status": "no_payment_required",+ "phone_number_collection": {+ "enabled": false+ },+ "recovered_from": null,+ "setup_intent": "seti_1OX09GDEQaroqDjsKbcVZMx8",+ "shipping": null,+ "shipping_address_collection": null,+ "shipping_options": [],+ "shipping_rate": null,+ "status": "open",+ "submit_type": null,+ "subscription": null,+ "success_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",+ "total_details": null,+ "ui_mode": "hosted",+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED02AcMUiBJ4ndu0XVm6s5ieYiv9vd8CA0WLofCukAraBbvNme#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"+ }+ ],+ "has_more": true,+ "object": "list",+ "url": "/v1/checkout/sessions"+}diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.pyindex c89285c310c..74abc81b9a0 100644--- a/corporate/tests/test_stripe.py+++ b/corporate/tests/test_stripe.py@@ -7172,3 +7172,105 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):}for key, value in invoice_item_params.items():self.assertEqual(invoice_item2[key], value)++ @responses.activate+ @mock_stripe()+ def test_invoice_plans_as_needed_server(self, *mocks: Mock) -> None:+ self.login("hamlet")+ hamlet = self.example_user("hamlet")++ server_user_count = UserProfile.objects.filter(is_bot=False, is_active=True).count()++ self.add_mock_response()+ with time_machine.travel(self.now, tick=False):+ send_server_data_to_push_bouncer(consider_usage_statistics=False)++ self.execute_remote_billing_authentication_flow(hamlet.delivery_email, hamlet.full_name)+ with time_machine.travel(self.now, tick=False):+ stripe_customer = self.add_card_and_upgrade(+ tier=CustomerPlan.TIER_SELF_HOSTED_BASIC, schedule="monthly"+ )++ customer = Customer.objects.get(stripe_customer_id=stripe_customer.id)+ plan = CustomerPlan.objects.get(customer=customer)+ assert plan.customer.remote_server is not None+ self.assertEqual(plan.next_invoice_date, self.next_month)++ with time_machine.travel(self.now + timedelta(days=2), tick=False):+ for count in range(5):+ do_create_user(+ f"email - {count}",+ f"password {count}",+ hamlet.realm,+ "name",+ role=UserProfile.ROLE_MEMBER,+ acting_user=None,+ )+ server_user_count += 5++ # Data upload was 25 days before the invoice date.+ last_audit_log_upload = self.now + timedelta(days=5)+ with time_machine.travel(last_audit_log_upload, tick=False):+ send_server_data_to_push_bouncer(consider_usage_statistics=False)+ invoice_plans_as_needed(self.next_month)+ plan.refresh_from_db()+ self.assertEqual(plan.next_invoice_date, self.next_month)+ self.assertTrue(plan.invoice_overdue_email_sent)++ from django.core.mail import outbox++ messages_count = len(outbox)+ message = outbox[-1]+ self.assert_length(message.to, 1)+ self.assertEqual(message.to[0], "[email protected]")+ self.assertEqual(message.subject, "Invoice overdue due to stale data")+ self.assertIn(+ f"Support URL: {self.billing_session.support_url()}",+ message.body,+ )+ self.assertIn(+ f"Last data upload: {last_audit_log_upload.strftime('%Y-%m-%d')}", message.body+ )++ # Cron runs again, don't send another email to Zulip team.+ invoice_plans_as_needed(self.next_month + timedelta(days=1))+ self.assert_length(outbox, messages_count)++ # Ledger is up-to-date+ with time_machine.travel(self.next_month, tick=False):+ send_server_data_to_push_bouncer(consider_usage_statistics=False)+ invoice_plans_as_needed(self.next_month)+ plan.refresh_from_db()+ self.assertEqual(plan.next_invoice_date, add_months(self.next_month, 1))+ self.assertFalse(plan.invoice_overdue_email_sent)++ assert customer.stripe_customer_id+ [invoice0, invoice1] = iter(stripe.Invoice.list(customer=customer.stripe_customer_id))++ [invoice_item0, invoice_item1, invoice_item2] = iter(invoice0.lines)+ invoice_item_params = {+ "amount": server_user_count * 3.5 * 100,+ "description": "Zulip Basic - renewal",+ "quantity": server_user_count,+ "period": {+ "start": datetime_to_timestamp(self.next_month),+ "end": datetime_to_timestamp(add_months(self.next_month, 1)),+ },+ }+ for key, value in invoice_item_params.items():+ self.assertEqual(invoice_item1[key], value)++ invoice_item_params = {+ "description": "Additional license (Jan 4, 2012 - Feb 2, 2012)",+ "quantity": 5,+ "period": {+ "start": datetime_to_timestamp(self.now + timedelta(days=2)),+ "end": datetime_to_timestamp(self.next_month),+ },+ }+ for key, value in invoice_item_params.items():+ self.assertEqual(invoice_item2[key], value)++ # Verify Zulip team receives mail for the next cycle.+ invoice_plans_as_needed(add_months(self.next_month, 1))+ self.assert_length(outbox, messages_count + 1)