Commit Graph

275 Commits

Author SHA1 Message Date
Rishi Gupta 99506b486a billing: Add backend for paying by invoice. 2018-11-17 23:08:48 -08:00
Rishi Gupta 63614f28fe billing: Upgrade to Stripe API version 2018-11-08.
Was hoping to do this after adding timestamp normalization to
normalize_fixture_data, which would have turned this into a <10 line
diff. There is a potentially material change in this API upgrade though
(around how invoices are handled), so just doing it now.
2018-11-17 18:09:56 -08:00
Vishnu Ks a7c33e12cb billing: Make mock_stripe handle calls which dont return object. 2018-11-16 13:30:16 -08:00
Vishnu Ks 2d140bae3e billing: Cast return value of _mock_stripe to CallableT.
Without the cast mypy raises the following error:

Incompatible return value type (got "Callable[..., Any]",
expected "CallableT")

This is a known issue: https://github.com/python/mypy/issues/1927
2018-11-12 23:42:59 -08:00
Vishnu Ks 20c41f3d3e billing: Replace IDs and other values before writing fixtures.
This makes a few other changes to the fixtures as well. Most are from API
updates, though I'm not sure why "Zulip Cloud Standard" got changed to
"Zulip Cloud Premium".

[Substantial edits by Rishi Gupta]
2018-11-12 23:24:33 -08:00
Vishnu Ks f812b76c3b billing: Allow mock_stripe to take multiple function_name arguments. 2018-11-10 00:38:32 -05:00
Rishi Gupta 2e89ffb0e2 billing: Make it easier to access /billing in tests. 2018-11-07 22:18:54 -05:00
Rishi Gupta 9b6b842f00 billing: Merge test_billing_home into test_initial_upgrade. 2018-11-07 22:18:54 -05:00
Rishi Gupta 7dc021a6b2 billing: Improve error message for require_billing_access. 2018-11-01 14:17:36 -07:00
Vishnu Ks 677f34c2b9 billing: Use require_billing_access decorator in JSON endpoints. 2018-11-01 12:45:29 -07:00
Vishnu Ks b527c3c4ef billing: Make mock_stripe handle StripeErrors. 2018-10-30 09:55:13 -07:00
Vishnu Ks be162d5428 billing: Disable fixture generation in setUp function.
This means you'll need access to our Stripe API key to add new fixtures.

Will be undone eventually, but having this in place will make it easier to
finish the mock.patch to mock_stripe migration.
2018-10-30 09:33:02 -07:00
Vishnu Ks 052640dfd5 billing: Add test for error during source replacement. 2018-10-24 19:39:23 -07:00
Vishnu Ks 20de90066b billing: Add test for exception during initial upgrade. 2018-10-24 18:54:53 -07:00
Vishnu Ks a7f4ea4b2c billing: Add test for billing disabled settings. 2018-10-24 18:54:18 -07:00
Rishi Gupta 458169928c billing: Rename Zulip Premium to Zulip Standard. 2018-10-24 10:42:16 -07:00
Rishi Gupta fbd884f934 billing: Rename MAX_INVITES_PREMIUM.
Largely to have parallel structure with INVITES_DEFAULT_REALM_DAILY_MAX.
2018-10-23 14:47:00 -07:00
Vishnu Ks 3b026559d4 stripe: Make stripe.error stubs more similiar to stripe python lib.
This will also fix the error that is generated during
the mypy 0.641 upgrade in PR #10691.
2018-10-22 13:51:05 +05:30
Rishi Gupta 690705858a billing: Update test_upgrade_where_..._fails_at_first to use @mock_stripe. 2018-10-18 11:16:00 -07:00
Rishi Gupta 80c482428d billing: Update test_upgrade_with_outdated_seat_count to use @mock_stripe. 2018-10-18 10:08:40 -07:00
Rishi Gupta 509707007c billing: Update test_billing_page_permissions to use @mock_stripe. 2018-10-18 09:49:50 -07:00
Rishi Gupta c4bad258f7 billing: Import from mock in test_stripe.py.
The string 'mock' appears over 200 times in this file. This removes about 80
of them.
2018-10-17 21:06:09 -07:00
Vishnu Ks 50de59102d billing: Add system to generate fixture data from the billing tests.
This will improve both the maintainability and accuracy of the fixture
data. It also makes it less scary to upgrade Stripe API versions.

[With significant changes by Rishi Gupta.]
2018-10-17 20:35:42 -07:00
Vishnu Ks d8c19cb003 models: Move billing models from zilencer to corporate. 2018-10-11 14:54:29 -07:00
Vishnu Ks 59865797ac billing: Move billing tests from zilencer to corporate. 2018-10-01 15:44:02 -07:00