diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions:Customer.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions:Customer.create.1.json index a6ba159bb39e1..d217ce9388062 100644 --- a/corporate/tests/stripe_fixtures/billing_page_permissions:Customer.create.1.json +++ b/corporate/tests/stripe_fixtures/billing_page_permissions:Customer.create.1.json @@ -1,14 +1,14 @@ { "account_balance": 0, - "created": 1539881153, + "created": 1542089871, "currency": null, - "default_source": "card_1DMedAGh0CmXqmnwDLwrAV1v", + "default_source": "card_NORMALIZED00000000000001", "delinquent": false, "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_DoHBcS2dBGOP9t", - "invoice_prefix": "3B3F5D6", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -29,14 +29,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_DoHBcS2dBGOP9t", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DMedAGh0CmXqmnwDLwrAV1v", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -47,14 +47,14 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_DoHBcS2dBGOP9t/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [], "has_more": false, "object": "list", "total_count": 0, - "url": "/v1/customers/cus_DoHBcS2dBGOP9t/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions:Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions:Customer.retrieve.1.json index aefeb646644e9..f9281901181aa 100644 --- a/corporate/tests/stripe_fixtures/billing_page_permissions:Customer.retrieve.1.json +++ b/corporate/tests/stripe_fixtures/billing_page_permissions:Customer.retrieve.1.json @@ -1,6 +1,6 @@ { "account_balance": 0, - "created": 1539881153, + "created": 1542089871, "currency": "usd", "default_source": { "address_city": "Pacific", @@ -13,14 +13,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_DoHBcS2dBGOP9t", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DMedAGh0CmXqmnwDLwrAV1v", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -31,8 +31,8 @@ "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_DoHBcS2dBGOP9t", - "invoice_prefix": "3B3F5D6", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -53,14 +53,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_DoHBcS2dBGOP9t", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DMedAGh0CmXqmnwDLwrAV1v", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -71,29 +71,30 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_DoHBcS2dBGOP9t/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [ { "application_fee_percent": null, "billing": "charge_automatically", - "billing_cycle_anchor": 1539881154, + "billing_cycle_anchor": 1542089872, "cancel_at_period_end": false, "canceled_at": null, - "created": 1539881154, - "current_period_end": 1571417154, - "current_period_start": 1539881154, - "customer": "cus_DoHBcS2dBGOP9t", + "created": 1542089872, + "current_period_end": 1573625872, + "current_period_start": 1542089872, + "customer": "cus_NORMALIZED0001", "days_until_due": null, + "default_source": null, "discount": null, "ended_at": null, - "id": "sub_DoHBD49xn11qGo", + "id": "sub_NORMALIZED0001", "items": { "data": [ { - "created": 1539881154, - "id": "si_DoHB9flY9e7zrZ", + "created": 1542089873, + "id": "si_NORMALIZED0001", "metadata": {}, "object": "subscription_item", "plan": { @@ -118,13 +119,13 @@ "usage_type": "licensed" }, "quantity": 8, - "subscription": "sub_DoHBD49xn11qGo" + "subscription": "sub_NORMALIZED0001" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_DoHBD49xn11qGo" + "url": "/v1/subscription_items?subscription=sub_NORMALIZED0001" }, "livemode": false, "metadata": {}, @@ -151,7 +152,7 @@ "usage_type": "licensed" }, "quantity": 8, - "start": 1539881154, + "start": 1542089872, "status": "active", "tax_percent": 0.0, "trial_end": null, @@ -161,7 +162,7 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_DoHBcS2dBGOP9t/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions:Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/billing_page_permissions:Customer.retrieve.2.json index aefeb646644e9..f9281901181aa 100644 --- a/corporate/tests/stripe_fixtures/billing_page_permissions:Customer.retrieve.2.json +++ b/corporate/tests/stripe_fixtures/billing_page_permissions:Customer.retrieve.2.json @@ -1,6 +1,6 @@ { "account_balance": 0, - "created": 1539881153, + "created": 1542089871, "currency": "usd", "default_source": { "address_city": "Pacific", @@ -13,14 +13,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_DoHBcS2dBGOP9t", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DMedAGh0CmXqmnwDLwrAV1v", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -31,8 +31,8 @@ "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_DoHBcS2dBGOP9t", - "invoice_prefix": "3B3F5D6", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -53,14 +53,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_DoHBcS2dBGOP9t", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DMedAGh0CmXqmnwDLwrAV1v", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -71,29 +71,30 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_DoHBcS2dBGOP9t/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [ { "application_fee_percent": null, "billing": "charge_automatically", - "billing_cycle_anchor": 1539881154, + "billing_cycle_anchor": 1542089872, "cancel_at_period_end": false, "canceled_at": null, - "created": 1539881154, - "current_period_end": 1571417154, - "current_period_start": 1539881154, - "customer": "cus_DoHBcS2dBGOP9t", + "created": 1542089872, + "current_period_end": 1573625872, + "current_period_start": 1542089872, + "customer": "cus_NORMALIZED0001", "days_until_due": null, + "default_source": null, "discount": null, "ended_at": null, - "id": "sub_DoHBD49xn11qGo", + "id": "sub_NORMALIZED0001", "items": { "data": [ { - "created": 1539881154, - "id": "si_DoHB9flY9e7zrZ", + "created": 1542089873, + "id": "si_NORMALIZED0001", "metadata": {}, "object": "subscription_item", "plan": { @@ -118,13 +119,13 @@ "usage_type": "licensed" }, "quantity": 8, - "subscription": "sub_DoHBD49xn11qGo" + "subscription": "sub_NORMALIZED0001" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_DoHBD49xn11qGo" + "url": "/v1/subscription_items?subscription=sub_NORMALIZED0001" }, "livemode": false, "metadata": {}, @@ -151,7 +152,7 @@ "usage_type": "licensed" }, "quantity": 8, - "start": 1539881154, + "start": 1542089872, "status": "active", "tax_percent": 0.0, "trial_end": null, @@ -161,7 +162,7 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_DoHBcS2dBGOP9t/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions:Invoice.upcoming.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions:Invoice.upcoming.1.json index 4b5af0aaa73a0..dd2ffb5019b04 100644 --- a/corporate/tests/stripe_fixtures/billing_page_permissions:Invoice.upcoming.1.json +++ b/corporate/tests/stripe_fixtures/billing_page_permissions:Invoice.upcoming.1.json @@ -10,27 +10,29 @@ "charge": null, "closed": false, "currency": "usd", - "customer": "cus_DoHBcS2dBGOP9t", - "date": 1571417154, + "customer": "cus_NORMALIZED0001", + "date": 1573625872, + "default_source": null, "description": "", "discount": null, "due_date": null, "ending_balance": 0, + "finalized_at": null, "forgiven": false, "lines": { "data": [ { "amount": 64000, "currency": "usd", - "description": "8 user \u00d7 Zulip Cloud Standard (at $80.00 / year)", + "description": "8 user \u00d7 Zulip Cloud Premium (at $80.00 / year)", "discountable": true, - "id": "sli_31180ead97e161", + "id": "sli_NORMALIZED0001", "livemode": false, "metadata": {}, "object": "line_item", "period": { - "end": 1603039554, - "start": 1571417154 + "end": 1605248272, + "start": 1573625872 }, "plan": { "active": true, @@ -55,28 +57,30 @@ }, "proration": false, "quantity": 8, - "subscription": "sub_DoHBD49xn11qGo", - "subscription_item": "si_DoHB9flY9e7zrZ", + "subscription": "sub_NORMALIZED0001", + "subscription_item": "si_NORMALIZED0001", "type": "subscription" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/invoices/upcoming/lines?customer=cus_DoHBcS2dBGOP9t" + "url": "/v1/invoices/upcoming/lines?customer=cus_NORMALIZED0001" }, "livemode": false, "metadata": {}, - "next_payment_attempt": 1571420754, - "number": "3B3F5D6-0002", + "next_payment_attempt": 1573629472, + "number": "NORMALI-0001", "object": "invoice", "paid": false, - "period_end": 1571417154, - "period_start": 1539881154, + "payment_intent": null, + "period_end": 1573625872, + "period_start": 1542089872, "receipt_number": null, "starting_balance": 0, "statement_descriptor": null, - "subscription": "sub_DoHBD49xn11qGo", + "status": "draft", + "subscription": "sub_NORMALIZED0001", "subtotal": 64000, "tax": 0, "tax_percent": 0.0, diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions:Invoice.upcoming.2.json b/corporate/tests/stripe_fixtures/billing_page_permissions:Invoice.upcoming.2.json index 4b5af0aaa73a0..dd2ffb5019b04 100644 --- a/corporate/tests/stripe_fixtures/billing_page_permissions:Invoice.upcoming.2.json +++ b/corporate/tests/stripe_fixtures/billing_page_permissions:Invoice.upcoming.2.json @@ -10,27 +10,29 @@ "charge": null, "closed": false, "currency": "usd", - "customer": "cus_DoHBcS2dBGOP9t", - "date": 1571417154, + "customer": "cus_NORMALIZED0001", + "date": 1573625872, + "default_source": null, "description": "", "discount": null, "due_date": null, "ending_balance": 0, + "finalized_at": null, "forgiven": false, "lines": { "data": [ { "amount": 64000, "currency": "usd", - "description": "8 user \u00d7 Zulip Cloud Standard (at $80.00 / year)", + "description": "8 user \u00d7 Zulip Cloud Premium (at $80.00 / year)", "discountable": true, - "id": "sli_31180ead97e161", + "id": "sli_NORMALIZED0001", "livemode": false, "metadata": {}, "object": "line_item", "period": { - "end": 1603039554, - "start": 1571417154 + "end": 1605248272, + "start": 1573625872 }, "plan": { "active": true, @@ -55,28 +57,30 @@ }, "proration": false, "quantity": 8, - "subscription": "sub_DoHBD49xn11qGo", - "subscription_item": "si_DoHB9flY9e7zrZ", + "subscription": "sub_NORMALIZED0001", + "subscription_item": "si_NORMALIZED0001", "type": "subscription" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/invoices/upcoming/lines?customer=cus_DoHBcS2dBGOP9t" + "url": "/v1/invoices/upcoming/lines?customer=cus_NORMALIZED0001" }, "livemode": false, "metadata": {}, - "next_payment_attempt": 1571420754, - "number": "3B3F5D6-0002", + "next_payment_attempt": 1573629472, + "number": "NORMALI-0001", "object": "invoice", "paid": false, - "period_end": 1571417154, - "period_start": 1539881154, + "payment_intent": null, + "period_end": 1573625872, + "period_start": 1542089872, "receipt_number": null, "starting_balance": 0, "statement_descriptor": null, - "subscription": "sub_DoHBD49xn11qGo", + "status": "draft", + "subscription": "sub_NORMALIZED0001", "subtotal": 64000, "tax": 0, "tax_percent": 0.0, diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions:Subscription.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions:Subscription.create.1.json index 6461595870d19..31d6122f6dc85 100644 --- a/corporate/tests/stripe_fixtures/billing_page_permissions:Subscription.create.1.json +++ b/corporate/tests/stripe_fixtures/billing_page_permissions:Subscription.create.1.json @@ -1,22 +1,23 @@ { "application_fee_percent": null, "billing": "charge_automatically", - "billing_cycle_anchor": 1539881154, + "billing_cycle_anchor": 1542089872, "cancel_at_period_end": false, "canceled_at": null, - "created": 1539881154, - "current_period_end": 1571417154, - "current_period_start": 1539881154, - "customer": "cus_DoHBcS2dBGOP9t", + "created": 1542089872, + "current_period_end": 1573625872, + "current_period_start": 1542089872, + "customer": "cus_NORMALIZED0001", "days_until_due": null, + "default_source": null, "discount": null, "ended_at": null, - "id": "sub_DoHBD49xn11qGo", + "id": "sub_NORMALIZED0001", "items": { "data": [ { - "created": 1539881154, - "id": "si_DoHB9flY9e7zrZ", + "created": 1542089873, + "id": "si_NORMALIZED0001", "metadata": {}, "object": "subscription_item", "plan": { @@ -41,13 +42,13 @@ "usage_type": "licensed" }, "quantity": 8, - "subscription": "sub_DoHBD49xn11qGo" + "subscription": "sub_NORMALIZED0001" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_DoHBD49xn11qGo" + "url": "/v1/subscription_items?subscription=sub_NORMALIZED0001" }, "livemode": false, "metadata": {}, @@ -74,7 +75,7 @@ "usage_type": "licensed" }, "quantity": 8, - "start": 1539881154, + "start": 1542089872, "status": "active", "tax_percent": 0.0, "trial_end": null, diff --git a/corporate/tests/stripe_fixtures/billing_page_permissions:Token.create.1.json b/corporate/tests/stripe_fixtures/billing_page_permissions:Token.create.1.json index 4a0c68702b060..76d62e198729c 100644 --- a/corporate/tests/stripe_fixtures/billing_page_permissions:Token.create.1.json +++ b/corporate/tests/stripe_fixtures/billing_page_permissions:Token.create.1.json @@ -14,18 +14,18 @@ "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DMedAGh0CmXqmnwDLwrAV1v", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", "object": "card", "tokenization_method": null }, - "client_ip": "107.202.144.213", - "created": 1539881152, - "id": "tok_1DMedAGh0CmXqmnwduQE6C3S", + "client_ip": "0.0.0.0", + "created": 1542089871, + "id": "tok_NORMALIZED00000000000001", "livemode": false, "object": "token", "type": "card", diff --git a/corporate/tests/stripe_fixtures/initial_upgrade:Customer.create.1.json b/corporate/tests/stripe_fixtures/initial_upgrade:Customer.create.1.json index ff1df030ab9e8..20fbd9cbe10d1 100644 --- a/corporate/tests/stripe_fixtures/initial_upgrade:Customer.create.1.json +++ b/corporate/tests/stripe_fixtures/initial_upgrade:Customer.create.1.json @@ -1,14 +1,14 @@ { "account_balance": 0, - "created": 1541455621, + "created": 1542089877, "currency": null, - "default_source": "card_1DTGDoGh0CmXqmnwFMUYJhqV", + "default_source": "card_NORMALIZED00000000000001", "delinquent": false, "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_Dv6QAe29ulQ1vp", - "invoice_prefix": "C7C8B1D", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -29,14 +29,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dv6QAe29ulQ1vp", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DTGDoGh0CmXqmnwFMUYJhqV", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -47,14 +47,14 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_Dv6QAe29ulQ1vp/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [], "has_more": false, "object": "list", "total_count": 0, - "url": "/v1/customers/cus_Dv6QAe29ulQ1vp/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/initial_upgrade:Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/initial_upgrade:Customer.retrieve.1.json index d6b823021ce98..c6be34d2b2596 100644 --- a/corporate/tests/stripe_fixtures/initial_upgrade:Customer.retrieve.1.json +++ b/corporate/tests/stripe_fixtures/initial_upgrade:Customer.retrieve.1.json @@ -1,6 +1,6 @@ { "account_balance": 0, - "created": 1541455621, + "created": 1542089877, "currency": "usd", "default_source": { "address_city": "Pacific", @@ -13,14 +13,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dv6QAe29ulQ1vp", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DTGDoGh0CmXqmnwFMUYJhqV", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -31,8 +31,8 @@ "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_Dv6QAe29ulQ1vp", - "invoice_prefix": "C7C8B1D", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -53,14 +53,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dv6QAe29ulQ1vp", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DTGDoGh0CmXqmnwFMUYJhqV", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -71,29 +71,30 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_Dv6QAe29ulQ1vp/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [ { "application_fee_percent": null, "billing": "charge_automatically", - "billing_cycle_anchor": 1541455622, + "billing_cycle_anchor": 1542089878, "cancel_at_period_end": false, "canceled_at": null, - "created": 1541455622, - "current_period_end": 1572991622, - "current_period_start": 1541455622, - "customer": "cus_Dv6QAe29ulQ1vp", + "created": 1542089878, + "current_period_end": 1573625878, + "current_period_start": 1542089878, + "customer": "cus_NORMALIZED0001", "days_until_due": null, + "default_source": null, "discount": null, "ended_at": null, - "id": "sub_Dv6QZdECBmtdRT", + "id": "sub_NORMALIZED0001", "items": { "data": [ { - "created": 1541455623, - "id": "si_Dv6QDNnS3DrRBx", + "created": 1542089878, + "id": "si_NORMALIZED0001", "metadata": {}, "object": "subscription_item", "plan": { @@ -118,13 +119,13 @@ "usage_type": "licensed" }, "quantity": 8, - "subscription": "sub_Dv6QZdECBmtdRT" + "subscription": "sub_NORMALIZED0001" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_Dv6QZdECBmtdRT" + "url": "/v1/subscription_items?subscription=sub_NORMALIZED0001" }, "livemode": false, "metadata": {}, @@ -151,7 +152,7 @@ "usage_type": "licensed" }, "quantity": 8, - "start": 1541455622, + "start": 1542089878, "status": "active", "tax_percent": 0.0, "trial_end": null, @@ -161,7 +162,7 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_Dv6QAe29ulQ1vp/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/initial_upgrade:Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/initial_upgrade:Customer.retrieve.2.json index d6b823021ce98..c6be34d2b2596 100644 --- a/corporate/tests/stripe_fixtures/initial_upgrade:Customer.retrieve.2.json +++ b/corporate/tests/stripe_fixtures/initial_upgrade:Customer.retrieve.2.json @@ -1,6 +1,6 @@ { "account_balance": 0, - "created": 1541455621, + "created": 1542089877, "currency": "usd", "default_source": { "address_city": "Pacific", @@ -13,14 +13,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dv6QAe29ulQ1vp", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DTGDoGh0CmXqmnwFMUYJhqV", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -31,8 +31,8 @@ "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_Dv6QAe29ulQ1vp", - "invoice_prefix": "C7C8B1D", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -53,14 +53,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dv6QAe29ulQ1vp", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DTGDoGh0CmXqmnwFMUYJhqV", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -71,29 +71,30 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_Dv6QAe29ulQ1vp/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [ { "application_fee_percent": null, "billing": "charge_automatically", - "billing_cycle_anchor": 1541455622, + "billing_cycle_anchor": 1542089878, "cancel_at_period_end": false, "canceled_at": null, - "created": 1541455622, - "current_period_end": 1572991622, - "current_period_start": 1541455622, - "customer": "cus_Dv6QAe29ulQ1vp", + "created": 1542089878, + "current_period_end": 1573625878, + "current_period_start": 1542089878, + "customer": "cus_NORMALIZED0001", "days_until_due": null, + "default_source": null, "discount": null, "ended_at": null, - "id": "sub_Dv6QZdECBmtdRT", + "id": "sub_NORMALIZED0001", "items": { "data": [ { - "created": 1541455623, - "id": "si_Dv6QDNnS3DrRBx", + "created": 1542089878, + "id": "si_NORMALIZED0001", "metadata": {}, "object": "subscription_item", "plan": { @@ -118,13 +119,13 @@ "usage_type": "licensed" }, "quantity": 8, - "subscription": "sub_Dv6QZdECBmtdRT" + "subscription": "sub_NORMALIZED0001" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_Dv6QZdECBmtdRT" + "url": "/v1/subscription_items?subscription=sub_NORMALIZED0001" }, "livemode": false, "metadata": {}, @@ -151,7 +152,7 @@ "usage_type": "licensed" }, "quantity": 8, - "start": 1541455622, + "start": 1542089878, "status": "active", "tax_percent": 0.0, "trial_end": null, @@ -161,7 +162,7 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_Dv6QAe29ulQ1vp/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/initial_upgrade:Invoice.upcoming.1.json b/corporate/tests/stripe_fixtures/initial_upgrade:Invoice.upcoming.1.json index 3aac71b73c83f..f109cc0050257 100644 --- a/corporate/tests/stripe_fixtures/initial_upgrade:Invoice.upcoming.1.json +++ b/corporate/tests/stripe_fixtures/initial_upgrade:Invoice.upcoming.1.json @@ -10,12 +10,14 @@ "charge": null, "closed": false, "currency": "usd", - "customer": "cus_Dv6QAe29ulQ1vp", - "date": 1572991622, + "customer": "cus_NORMALIZED0001", + "date": 1573625878, + "default_source": null, "description": "", "discount": null, "due_date": null, "ending_balance": 0, + "finalized_at": null, "forgiven": false, "lines": { "data": [ @@ -24,13 +26,13 @@ "currency": "usd", "description": "8 user \u00d7 Zulip Cloud Premium (at $80.00 / year)", "discountable": true, - "id": "sli_e2065db6c0b1c1", + "id": "sli_NORMALIZED0001", "livemode": false, "metadata": {}, "object": "line_item", "period": { - "end": 1604614022, - "start": 1572991622 + "end": 1605248278, + "start": 1573625878 }, "plan": { "active": true, @@ -55,29 +57,30 @@ }, "proration": false, "quantity": 8, - "subscription": "sub_Dv6QZdECBmtdRT", - "subscription_item": "si_Dv6QDNnS3DrRBx", + "subscription": "sub_NORMALIZED0001", + "subscription_item": "si_NORMALIZED0001", "type": "subscription" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/invoices/upcoming/lines?customer=cus_Dv6QAe29ulQ1vp" + "url": "/v1/invoices/upcoming/lines?customer=cus_NORMALIZED0001" }, "livemode": false, "metadata": {}, - "next_payment_attempt": 1572995222, - "number": "C7C8B1D-0002", + "next_payment_attempt": 1573629478, + "number": "NORMALI-0001", "object": "invoice", "paid": false, "payment_intent": null, - "period_end": 1572991622, - "period_start": 1541455622, + "period_end": 1573625878, + "period_start": 1542089878, "receipt_number": null, "starting_balance": 0, "statement_descriptor": null, - "subscription": "sub_Dv6QZdECBmtdRT", + "status": "draft", + "subscription": "sub_NORMALIZED0001", "subtotal": 64000, "tax": 0, "tax_percent": 0.0, diff --git a/corporate/tests/stripe_fixtures/initial_upgrade:Subscription.create.1.json b/corporate/tests/stripe_fixtures/initial_upgrade:Subscription.create.1.json index 6d3319c72cd65..09329294c4064 100644 --- a/corporate/tests/stripe_fixtures/initial_upgrade:Subscription.create.1.json +++ b/corporate/tests/stripe_fixtures/initial_upgrade:Subscription.create.1.json @@ -1,22 +1,23 @@ { "application_fee_percent": null, "billing": "charge_automatically", - "billing_cycle_anchor": 1541455622, + "billing_cycle_anchor": 1542089878, "cancel_at_period_end": false, "canceled_at": null, - "created": 1541455622, - "current_period_end": 1572991622, - "current_period_start": 1541455622, - "customer": "cus_Dv6QAe29ulQ1vp", + "created": 1542089878, + "current_period_end": 1573625878, + "current_period_start": 1542089878, + "customer": "cus_NORMALIZED0001", "days_until_due": null, + "default_source": null, "discount": null, "ended_at": null, - "id": "sub_Dv6QZdECBmtdRT", + "id": "sub_NORMALIZED0001", "items": { "data": [ { - "created": 1541455623, - "id": "si_Dv6QDNnS3DrRBx", + "created": 1542089878, + "id": "si_NORMALIZED0001", "metadata": {}, "object": "subscription_item", "plan": { @@ -41,13 +42,13 @@ "usage_type": "licensed" }, "quantity": 8, - "subscription": "sub_Dv6QZdECBmtdRT" + "subscription": "sub_NORMALIZED0001" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_Dv6QZdECBmtdRT" + "url": "/v1/subscription_items?subscription=sub_NORMALIZED0001" }, "livemode": false, "metadata": {}, @@ -74,7 +75,7 @@ "usage_type": "licensed" }, "quantity": 8, - "start": 1541455622, + "start": 1542089878, "status": "active", "tax_percent": 0.0, "trial_end": null, diff --git a/corporate/tests/stripe_fixtures/initial_upgrade:Token.create.1.json b/corporate/tests/stripe_fixtures/initial_upgrade:Token.create.1.json index 568462567158a..7ad4eaeee31ad 100644 --- a/corporate/tests/stripe_fixtures/initial_upgrade:Token.create.1.json +++ b/corporate/tests/stripe_fixtures/initial_upgrade:Token.create.1.json @@ -14,18 +14,18 @@ "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DTGDoGh0CmXqmnwFMUYJhqV", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", "object": "card", "tokenization_method": null }, - "client_ip": "209.6.237.111", - "created": 1541455620, - "id": "tok_1DTGDoGh0CmXqmnwLajjvmGz", + "client_ip": "0.0.0.0", + "created": 1542089877, + "id": "tok_NORMALIZED00000000000001", "livemode": false, "object": "token", "type": "card", diff --git a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.create.1.json b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.create.1.json index 38a8a59318c01..f1fdbd7528840 100644 --- a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.create.1.json +++ b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.create.1.json @@ -1,14 +1,14 @@ { "account_balance": 0, - "created": 1540918391, + "created": 1542089881, "currency": null, - "default_source": "card_1DR0SpGh0CmXqmnwVy9R2OVT", + "default_source": "card_NORMALIZED00000000000001", "delinquent": false, "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_Dsm0jbfb5Vxhmv", - "invoice_prefix": "705151A", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -29,14 +29,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dsm0jbfb5Vxhmv", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "DT0InlewSeDlMsHx", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DR0SpGh0CmXqmnwVy9R2OVT", + "id": "card_NORMALIZED00000000000001", "last4": "0341", "metadata": {}, "name": "Ada Starr", @@ -47,14 +47,14 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_Dsm0jbfb5Vxhmv/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [], "has_more": false, "object": "list", "total_count": 0, - "url": "/v1/customers/cus_Dsm0jbfb5Vxhmv/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.retrieve.1.json index 6344d23e963b3..85f0b358b6525 100644 --- a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.retrieve.1.json +++ b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.retrieve.1.json @@ -1,6 +1,6 @@ { "account_balance": 0, - "created": 1540918391, + "created": 1542089881, "currency": null, "default_source": { "address_city": "Pacific", @@ -13,14 +13,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dsm0jbfb5Vxhmv", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "DT0InlewSeDlMsHx", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DR0SpGh0CmXqmnwVy9R2OVT", + "id": "card_NORMALIZED00000000000001", "last4": "0341", "metadata": {}, "name": "Ada Starr", @@ -31,8 +31,8 @@ "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_Dsm0jbfb5Vxhmv", - "invoice_prefix": "705151A", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -53,14 +53,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dsm0jbfb5Vxhmv", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "DT0InlewSeDlMsHx", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DR0SpGh0CmXqmnwVy9R2OVT", + "id": "card_NORMALIZED00000000000001", "last4": "0341", "metadata": {}, "name": "Ada Starr", @@ -71,14 +71,14 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_Dsm0jbfb5Vxhmv/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [], "has_more": false, "object": "list", "total_count": 0, - "url": "/v1/customers/cus_Dsm0jbfb5Vxhmv/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.retrieve.2.json index 6344d23e963b3..85f0b358b6525 100644 --- a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.retrieve.2.json +++ b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.retrieve.2.json @@ -1,6 +1,6 @@ { "account_balance": 0, - "created": 1540918391, + "created": 1542089881, "currency": null, "default_source": { "address_city": "Pacific", @@ -13,14 +13,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dsm0jbfb5Vxhmv", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "DT0InlewSeDlMsHx", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DR0SpGh0CmXqmnwVy9R2OVT", + "id": "card_NORMALIZED00000000000001", "last4": "0341", "metadata": {}, "name": "Ada Starr", @@ -31,8 +31,8 @@ "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_Dsm0jbfb5Vxhmv", - "invoice_prefix": "705151A", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -53,14 +53,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dsm0jbfb5Vxhmv", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "DT0InlewSeDlMsHx", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DR0SpGh0CmXqmnwVy9R2OVT", + "id": "card_NORMALIZED00000000000001", "last4": "0341", "metadata": {}, "name": "Ada Starr", @@ -71,14 +71,14 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_Dsm0jbfb5Vxhmv/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [], "has_more": false, "object": "list", "total_count": 0, - "url": "/v1/customers/cus_Dsm0jbfb5Vxhmv/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.retrieve.3.json index b86de47eb0317..1936e0a77b8d7 100644 --- a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.retrieve.3.json +++ b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.retrieve.3.json @@ -1,6 +1,6 @@ { "account_balance": 0, - "created": 1540918391, + "created": 1542089881, "currency": "usd", "default_source": { "address_city": "Pacific", @@ -13,14 +13,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dsm0jbfb5Vxhmv", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000002", "funding": "credit", - "id": "card_1DR0SsGh0CmXqmnwLRYxxJTu", + "id": "card_NORMALIZED00000000000002", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -31,8 +31,8 @@ "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_Dsm0jbfb5Vxhmv", - "invoice_prefix": "705151A", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -53,14 +53,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dsm0jbfb5Vxhmv", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000002", "funding": "credit", - "id": "card_1DR0SsGh0CmXqmnwLRYxxJTu", + "id": "card_NORMALIZED00000000000002", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -71,29 +71,30 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_Dsm0jbfb5Vxhmv/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [ { "application_fee_percent": null, "billing": "charge_automatically", - "billing_cycle_anchor": 1540918396, + "billing_cycle_anchor": 1542089885, "cancel_at_period_end": false, "canceled_at": null, - "created": 1540918396, - "current_period_end": 1572454396, - "current_period_start": 1540918396, - "customer": "cus_Dsm0jbfb5Vxhmv", + "created": 1542089885, + "current_period_end": 1573625885, + "current_period_start": 1542089885, + "customer": "cus_NORMALIZED0001", "days_until_due": null, + "default_source": null, "discount": null, "ended_at": null, - "id": "sub_Dsm057t087gXIv", + "id": "sub_NORMALIZED0001", "items": { "data": [ { - "created": 1540918396, - "id": "si_Dsm07fKQl9R4ep", + "created": 1542089886, + "id": "si_NORMALIZED0001", "metadata": {}, "object": "subscription_item", "plan": { @@ -118,13 +119,13 @@ "usage_type": "licensed" }, "quantity": 8, - "subscription": "sub_Dsm057t087gXIv" + "subscription": "sub_NORMALIZED0001" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_Dsm057t087gXIv" + "url": "/v1/subscription_items?subscription=sub_NORMALIZED0001" }, "livemode": false, "metadata": {}, @@ -151,7 +152,7 @@ "usage_type": "licensed" }, "quantity": 8, - "start": 1540918396, + "start": 1542089885, "status": "active", "tax_percent": 0.0, "trial_end": null, @@ -161,7 +162,7 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_Dsm0jbfb5Vxhmv/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.save.1.json b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.save.1.json index 528e101e279a8..bd4b418de1b57 100644 --- a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.save.1.json +++ b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Customer.save.1.json @@ -1,14 +1,14 @@ { "account_balance": 0, - "created": 1540918391, + "created": 1542089881, "currency": null, - "default_source": "card_1DR0SsGh0CmXqmnwLRYxxJTu", + "default_source": "card_NORMALIZED00000000000002", "delinquent": false, "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_Dsm0jbfb5Vxhmv", - "invoice_prefix": "705151A", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -29,14 +29,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_Dsm0jbfb5Vxhmv", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000002", "funding": "credit", - "id": "card_1DR0SsGh0CmXqmnwLRYxxJTu", + "id": "card_NORMALIZED00000000000002", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -47,14 +47,14 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_Dsm0jbfb5Vxhmv/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [], "has_more": false, "object": "list", "total_count": 0, - "url": "/v1/customers/cus_Dsm0jbfb5Vxhmv/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Subscription.create.1.json b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Subscription.create.1.json index 0213d646073f6..01d597a84961d 100644 --- a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Subscription.create.1.json +++ b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Subscription.create.1.json @@ -11,8 +11,8 @@ "Connection": "keep-alive", "Content-Length": "241", "Content-Type": "application/json", - "Date": "Tue, 30 Oct 2018 16:53:13 GMT", - "Request-Id": "req_Tk1JhdtuCSSeAU", + "Date": "Tue, 13 Nov 2018 06:18:03 GMT", + "Request-Id": "req_NORMALIZED0001", "Server": "nginx", "Strict-Transport-Security": "max-age=31556926; includeSubDomains; preload", "Stripe-Version": "2018-08-23" @@ -30,5 +30,5 @@ } }, "param": "", - "request_id": "req_Tk1JhdtuCSSeAU" + "request_id": "req_NORMALIZED0001" } diff --git a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Subscription.create.2.json b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Subscription.create.2.json index 6674c1b3a0a3d..4ae825cb716d6 100644 --- a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Subscription.create.2.json +++ b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Subscription.create.2.json @@ -1,22 +1,23 @@ { "application_fee_percent": null, "billing": "charge_automatically", - "billing_cycle_anchor": 1540918396, + "billing_cycle_anchor": 1542089885, "cancel_at_period_end": false, "canceled_at": null, - "created": 1540918396, - "current_period_end": 1572454396, - "current_period_start": 1540918396, - "customer": "cus_Dsm0jbfb5Vxhmv", + "created": 1542089885, + "current_period_end": 1573625885, + "current_period_start": 1542089885, + "customer": "cus_NORMALIZED0001", "days_until_due": null, + "default_source": null, "discount": null, "ended_at": null, - "id": "sub_Dsm057t087gXIv", + "id": "sub_NORMALIZED0001", "items": { "data": [ { - "created": 1540918396, - "id": "si_Dsm07fKQl9R4ep", + "created": 1542089886, + "id": "si_NORMALIZED0001", "metadata": {}, "object": "subscription_item", "plan": { @@ -41,13 +42,13 @@ "usage_type": "licensed" }, "quantity": 8, - "subscription": "sub_Dsm057t087gXIv" + "subscription": "sub_NORMALIZED0001" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_Dsm057t087gXIv" + "url": "/v1/subscription_items?subscription=sub_NORMALIZED0001" }, "livemode": false, "metadata": {}, @@ -74,7 +75,7 @@ "usage_type": "licensed" }, "quantity": 8, - "start": 1540918396, + "start": 1542089885, "status": "active", "tax_percent": 0.0, "trial_end": null, diff --git a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Token.create.1.json b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Token.create.1.json index 3b3e0060d69d3..0136fa6d1f8a2 100644 --- a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Token.create.1.json +++ b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Token.create.1.json @@ -14,18 +14,18 @@ "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "DT0InlewSeDlMsHx", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DR0SpGh0CmXqmnwVy9R2OVT", + "id": "card_NORMALIZED00000000000001", "last4": "0341", "metadata": {}, "name": "Ada Starr", "object": "card", "tokenization_method": null }, - "client_ip": "107.202.144.213", - "created": 1540918391, - "id": "tok_1DR0SpGh0CmXqmnwb2OBac0j", + "client_ip": "0.0.0.0", + "created": 1542089881, + "id": "tok_NORMALIZED00000000000001", "livemode": false, "object": "token", "type": "card", diff --git a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Token.create.2.json b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Token.create.2.json index 8ce7bf6e2cf7b..bdec363ab624d 100644 --- a/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Token.create.2.json +++ b/corporate/tests/stripe_fixtures/upgrade_where_subscription_save_fails_at_first:Token.create.2.json @@ -14,18 +14,18 @@ "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000002", "funding": "credit", - "id": "card_1DR0SsGh0CmXqmnwLRYxxJTu", + "id": "card_NORMALIZED00000000000002", "last4": "4242", "metadata": {}, "name": "Ada Starr", "object": "card", "tokenization_method": null }, - "client_ip": "107.202.144.213", - "created": 1540918394, - "id": "tok_1DR0SsGh0CmXqmnwBW7Lj2FR", + "client_ip": "0.0.0.0", + "created": 1542089884, + "id": "tok_NORMALIZED00000000000002", "livemode": false, "object": "token", "type": "card", diff --git a/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Customer.create.1.json b/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Customer.create.1.json index a6f9f917d4ac1..493bf9fb4aa5a 100644 --- a/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Customer.create.1.json +++ b/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Customer.create.1.json @@ -1,14 +1,14 @@ { "account_balance": 0, - "created": 1539882356, + "created": 1542089887, "currency": null, - "default_source": "card_1DMewaGh0CmXqmnw659QMDX7", + "default_source": "card_NORMALIZED00000000000001", "delinquent": false, "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_DoHVyfEZQ0tNj4", - "invoice_prefix": "448916B", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -29,14 +29,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_DoHVyfEZQ0tNj4", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DMewaGh0CmXqmnw659QMDX7", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -47,14 +47,14 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_DoHVyfEZQ0tNj4/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [], "has_more": false, "object": "list", "total_count": 0, - "url": "/v1/customers/cus_DoHVyfEZQ0tNj4/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Customer.retrieve.1.json index 72dcc92089d81..9a2562d2cdf80 100644 --- a/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Customer.retrieve.1.json +++ b/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Customer.retrieve.1.json @@ -1,6 +1,6 @@ { "account_balance": 0, - "created": 1539882356, + "created": 1542089887, "currency": "usd", "default_source": { "address_city": "Pacific", @@ -13,14 +13,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_DoHVyfEZQ0tNj4", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DMewaGh0CmXqmnw659QMDX7", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -31,8 +31,8 @@ "description": "zulip (Zulip Dev)", "discount": null, "email": "hamlet@zulip.com", - "id": "cus_DoHVyfEZQ0tNj4", - "invoice_prefix": "448916B", + "id": "cus_NORMALIZED0001", + "invoice_prefix": "NORMA01", "livemode": false, "metadata": { "realm_id": "1", @@ -53,14 +53,14 @@ "address_zip_check": "pass", "brand": "Visa", "country": "US", - "customer": "cus_DoHVyfEZQ0tNj4", + "customer": "cus_NORMALIZED0001", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DMewaGh0CmXqmnw659QMDX7", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", @@ -71,29 +71,30 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_DoHVyfEZQ0tNj4/sources" + "url": "/v1/customers/cus_NORMALIZED0001/sources" }, "subscriptions": { "data": [ { "application_fee_percent": null, "billing": "charge_automatically", - "billing_cycle_anchor": 1539882357, + "billing_cycle_anchor": 1542089888, "cancel_at_period_end": false, "canceled_at": null, - "created": 1539882357, - "current_period_end": 1571418357, - "current_period_start": 1539882357, - "customer": "cus_DoHVyfEZQ0tNj4", + "created": 1542089888, + "current_period_end": 1573625888, + "current_period_start": 1542089888, + "customer": "cus_NORMALIZED0001", "days_until_due": null, + "default_source": null, "discount": null, "ended_at": null, - "id": "sub_DoHVxLMsXYtwIQ", + "id": "sub_NORMALIZED0001", "items": { "data": [ { - "created": 1539882358, - "id": "si_DoHVIcOpCMJMCt", + "created": 1542089889, + "id": "si_NORMALIZED0001", "metadata": {}, "object": "subscription_item", "plan": { @@ -118,13 +119,13 @@ "usage_type": "licensed" }, "quantity": 8, - "subscription": "sub_DoHVxLMsXYtwIQ" + "subscription": "sub_NORMALIZED0001" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_DoHVxLMsXYtwIQ" + "url": "/v1/subscription_items?subscription=sub_NORMALIZED0001" }, "livemode": false, "metadata": {}, @@ -151,7 +152,7 @@ "usage_type": "licensed" }, "quantity": 8, - "start": 1539882357, + "start": 1542089888, "status": "active", "tax_percent": 0.0, "trial_end": null, @@ -161,7 +162,7 @@ "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/customers/cus_DoHVyfEZQ0tNj4/subscriptions" + "url": "/v1/customers/cus_NORMALIZED0001/subscriptions" }, "tax_info": null, "tax_info_verification": null diff --git a/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Subscription.create.1.json b/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Subscription.create.1.json index b70a10187b35b..974a594ff69f6 100644 --- a/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Subscription.create.1.json +++ b/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Subscription.create.1.json @@ -1,22 +1,23 @@ { "application_fee_percent": null, "billing": "charge_automatically", - "billing_cycle_anchor": 1539882357, + "billing_cycle_anchor": 1542089888, "cancel_at_period_end": false, "canceled_at": null, - "created": 1539882357, - "current_period_end": 1571418357, - "current_period_start": 1539882357, - "customer": "cus_DoHVyfEZQ0tNj4", + "created": 1542089888, + "current_period_end": 1573625888, + "current_period_start": 1542089888, + "customer": "cus_NORMALIZED0001", "days_until_due": null, + "default_source": null, "discount": null, "ended_at": null, - "id": "sub_DoHVxLMsXYtwIQ", + "id": "sub_NORMALIZED0001", "items": { "data": [ { - "created": 1539882358, - "id": "si_DoHVIcOpCMJMCt", + "created": 1542089889, + "id": "si_NORMALIZED0001", "metadata": {}, "object": "subscription_item", "plan": { @@ -41,13 +42,13 @@ "usage_type": "licensed" }, "quantity": 8, - "subscription": "sub_DoHVxLMsXYtwIQ" + "subscription": "sub_NORMALIZED0001" } ], "has_more": false, "object": "list", "total_count": 1, - "url": "/v1/subscription_items?subscription=sub_DoHVxLMsXYtwIQ" + "url": "/v1/subscription_items?subscription=sub_NORMALIZED0001" }, "livemode": false, "metadata": {}, @@ -74,7 +75,7 @@ "usage_type": "licensed" }, "quantity": 8, - "start": 1539882357, + "start": 1542089888, "status": "active", "tax_percent": 0.0, "trial_end": null, diff --git a/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Token.create.1.json b/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Token.create.1.json index 0ff96f1c56723..7f10d68a2c4e7 100644 --- a/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Token.create.1.json +++ b/corporate/tests/stripe_fixtures/upgrade_with_outdated_seat_count:Token.create.1.json @@ -14,18 +14,18 @@ "dynamic_last4": null, "exp_month": 3, "exp_year": 2033, - "fingerprint": "6dAXT9VZvwro65EK", + "fingerprint": "NORMALIZED000001", "funding": "credit", - "id": "card_1DMewaGh0CmXqmnw659QMDX7", + "id": "card_NORMALIZED00000000000001", "last4": "4242", "metadata": {}, "name": "Ada Starr", "object": "card", "tokenization_method": null }, - "client_ip": "107.202.144.213", - "created": 1539882356, - "id": "tok_1DMewaGh0CmXqmnwguSDP9TQ", + "client_ip": "0.0.0.0", + "created": 1542089887, + "id": "tok_NORMALIZED00000000000001", "livemode": false, "object": "token", "type": "card", diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py index e593b211b08f7..d267c288c7c5f 100644 --- a/corporate/tests/test_stripe.py +++ b/corporate/tests/test_stripe.py @@ -34,6 +34,7 @@ GENERATE_STRIPE_FIXTURES = False +STRIPE_FIXTURES_DIR = "corporate/tests/stripe_fixtures" fixture_data_file = open(os.path.join(os.path.dirname(__file__), 'stripe_fixtures.json'), 'r') fixture_data = ujson.load(fixture_data_file) @@ -95,8 +96,15 @@ def stripe_fixture_path(decorated_function_name: str, mocked_function_name: str, # use test_* for the python test files if decorated_function_name[:5] == 'test_': decorated_function_name = decorated_function_name[5:] - return "corporate/tests/stripe_fixtures/{}:{}.{}.json".format( - decorated_function_name, mocked_function_name[7:], call_count) + return "{}/{}:{}.{}.json".format( + STRIPE_FIXTURES_DIR, decorated_function_name, mocked_function_name[7:], call_count) + +def fixture_files_for_function(decorated_function: CallableT) -> List[str]: # nocoverage + decorated_function_name = decorated_function.__name__ + if decorated_function_name[:5] == 'test_': + decorated_function_name = decorated_function_name[5:] + return sorted(['{}/{}'.format(STRIPE_FIXTURES_DIR, f) for f in os.listdir(STRIPE_FIXTURES_DIR) + if f.startswith(decorated_function_name)]) def generate_and_save_stripe_fixture(decorated_function_name: str, mocked_function_name: str, mocked_function: CallableT) -> Callable[[Any, Any], Any]: # nocoverage @@ -133,6 +141,37 @@ def _read_stripe_fixture(*args: Any, **kwargs: Any) -> Any: return stripe.util.convert_to_stripe_object(fixture) return _read_stripe_fixture +def normalize_fixture_data(decorated_function: CallableT) -> None: # nocoverage + # stripe ids are all of the form cus_D7OT2jf5YAtZQ2 + id_lengths = [ + ('cus', 14), ('sub', 14), ('si', 14), ('sli', 14), ('req', 14), ('tok', 24), ('card', 24)] + # We'll replace cus_D7OT2jf5YAtZQ2 with something like cus_NORMALIZED0001 + pattern_translations = { + "%s_[A-Za-z0-9]{%d}" % (prefix, length): "%s_NORMALIZED%%0%dd" % (prefix, length - 10) + for prefix, length in id_lengths + } + # We'll replace "invoice_prefix": "A35BC4Q" with something like "invoice_prefix": "NORMA01" + pattern_translations.update({ + '"invoice_prefix": "[A-Za-z0-9]{7}"': '"invoice_prefix": "NORMA%02d"', + '"fingerprint": "[A-Za-z0-9]{16}"': '"fingerprint": "NORMALIZED%06d"', + '"number": "[A-Za-z0-9]{7}-[A-Za-z0-9]{4}"': '"number": "NORMALI-%04d"', + }) + + normalized_values = {pattern: {} + for pattern in pattern_translations.keys()} # type: Dict[str, Dict[str, str]] + for fixture_file in fixture_files_for_function(decorated_function): + with open(fixture_file, "r") as f: + file_content = f.read() + for pattern, translation in pattern_translations.items(): + for match in re.findall(pattern, file_content): + if match not in normalized_values[pattern]: + normalized_values[pattern][match] = translation % (len(normalized_values[pattern]) + 1,) + file_content = file_content.replace(match, normalized_values[pattern][match]) + # Overwrite all IP addresses + file_content = re.sub(r'"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"', '"0.0.0.0"', file_content) + with open(fixture_file, "w") as f: + f.write(file_content) + def mock_stripe(*mocked_function_names: str, generate: Optional[bool]=None) -> Callable[[CallableT], Callable[..., Any]]: def _mock_stripe(decorated_function: CallableT) -> Callable[..., Any]: @@ -151,7 +190,10 @@ def _mock_stripe(decorated_function: CallableT) -> Callable[..., Any]: @wraps(decorated_function) def wrapped(*args: Any, **kwargs: Any) -> Any: - return decorated_function(*args, **kwargs) + val = decorated_function(*args, **kwargs) + if generate_fixture: # nocoverage + normalize_fixture_data(decorated_function) + return val return wrapped return _mock_stripe