diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Customer.create.1.json b/corporate/tests/stripe_fixtures/payment_method_string--Customer.create.1.json new file mode 100644 index 0000000000..593a07ed0c Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Customer.create.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Customer.modify.1.json b/corporate/tests/stripe_fixtures/payment_method_string--Customer.modify.1.json new file mode 100644 index 0000000000..55e8026aab Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Customer.modify.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/payment_method_string--Customer.retrieve.1.json new file mode 100644 index 0000000000..b0683c8f30 Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Customer.retrieve.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/payment_method_string--Customer.retrieve.2.json new file mode 100644 index 0000000000..b0683c8f30 Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Customer.retrieve.2.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/payment_method_string--Customer.retrieve.3.json new file mode 100644 index 0000000000..b0683c8f30 Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Customer.retrieve.3.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/payment_method_string--Customer.retrieve.4.json new file mode 100644 index 0000000000..4ccc6404f8 Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Customer.retrieve.4.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Event.list.1.json b/corporate/tests/stripe_fixtures/payment_method_string--Event.list.1.json new file mode 100644 index 0000000000..f3a079db80 Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Event.list.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Event.list.2.json b/corporate/tests/stripe_fixtures/payment_method_string--Event.list.2.json new file mode 100644 index 0000000000..41e3db6e32 Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Event.list.2.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Event.list.3.json b/corporate/tests/stripe_fixtures/payment_method_string--Event.list.3.json new file mode 100644 index 0000000000..c7d5fe0829 Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Event.list.3.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Event.list.4.json b/corporate/tests/stripe_fixtures/payment_method_string--Event.list.4.json new file mode 100644 index 0000000000..6d922067af Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Event.list.4.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Invoice.create.1.json b/corporate/tests/stripe_fixtures/payment_method_string--Invoice.create.1.json new file mode 100644 index 0000000000..be6f23a347 Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Invoice.create.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/payment_method_string--Invoice.finalize_invoice.1.json new file mode 100644 index 0000000000..f0482c587b Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Invoice.finalize_invoice.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Invoice.list.1.json b/corporate/tests/stripe_fixtures/payment_method_string--Invoice.list.1.json new file mode 100644 index 0000000000..e39960ab72 Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Invoice.list.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--Invoice.pay.1.json b/corporate/tests/stripe_fixtures/payment_method_string--Invoice.pay.1.json new file mode 100644 index 0000000000..ce3559ac2f Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--Invoice.pay.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/payment_method_string--InvoiceItem.create.1.json new file mode 100644 index 0000000000..40cfc90def Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--InvoiceItem.create.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/payment_method_string--SetupIntent.create.1.json new file mode 100644 index 0000000000..22298f8cf7 Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--SetupIntent.create.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/payment_method_string--SetupIntent.list.1.json new file mode 100644 index 0000000000..0d5dbf49fa Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--SetupIntent.list.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/payment_method_string--SetupIntent.retrieve.1.json new file mode 100644 index 0000000000..22298f8cf7 Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--SetupIntent.retrieve.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/payment_method_string--checkout.Session.create.1.json new file mode 100644 index 0000000000..0ce5641942 Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--checkout.Session.create.1.json differ diff --git a/corporate/tests/stripe_fixtures/payment_method_string--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/payment_method_string--checkout.Session.list.1.json new file mode 100644 index 0000000000..719684035c Binary files /dev/null and b/corporate/tests/stripe_fixtures/payment_method_string--checkout.Session.list.1.json differ diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py index 4d64e87f86..30e40c7f46 100644 --- a/corporate/tests/test_stripe.py +++ b/corporate/tests/test_stripe.py @@ -2169,28 +2169,19 @@ class StripeTest(StripeTestCase): with self.assertRaises(signing.BadSignature): unsign_string(signed_string, "randomsalt") - # This tests both the payment method string, and also is a very basic - # test that the various upgrade paths involving non-standard payment - # histories don't throw errors @mock_stripe() def test_payment_method_string(self, *mocks: Mock) -> None: - pass - # If you sign up with a card, we should show your card as the payment method - # Already tested in test_initial_upgrade - # If you pay by invoice, your payment method should be - # "Billed by invoice", even if you have a card on file - # user = self.example_user("hamlet") - # billing_session = RealmBillingSession(user) - # billing_session.create_stripe_customer() - # self.login_user(user) - # self.upgrade(invoice=True) - # stripe_customer = stripe_get_customer(Customer.objects.get(realm=user.realm).stripe_customer_id) - # self.assertEqual('Billed by invoice', payment_method_string(stripe_customer)) - - # If you sign up with a card and then downgrade, we still have your - # card on file, and should show it - # TODO + # "Invoice", even if you have a card on file. + user = self.example_user("hamlet") + billing_session = RealmBillingSession(user) + billing_session.create_stripe_customer() + self.login_user(user) + self.add_card_to_customer_for_upgrade() + self.upgrade(invoice=True) + response = self.client_get("/billing/") + self.assert_not_in_success_response(["Visa ending in"], response) + self.assert_in_success_response(["Invoice", "You will receive an invoice for"], response) @mock_stripe() def test_replace_payment_method(self, *mocks: Mock) -> None: