Commit Graph

33 Commits

Author SHA1 Message Date
Rishi Gupta db6e6472b1 billing: Set idempotency key to None when running test suite. 2019-01-30 10:35:01 -08:00
Rishi Gupta 4aa2ac1b52 billing: Add functions for automatic invoicing of plans. 2019-01-28 16:04:11 -08:00
Rishi Gupta 653416ab23 billing: Update /billing to work with new subscription model. 2018-12-23 00:18:21 -08:00
Rishi Gupta e7220fd71f billing: Do subscription management in-house instead of with Stripe Billing.
This is a major rewrite of the billing system. It moves subscription
information off of stripe Subscriptions and into a local CustomerPlan
table.

To keep this manageable, it leaves several things unimplemented
(downgrading, etc), and a variety of other TODOs in the code. There are also
some known regressions, e.g. error-handling on /upgrade is broken.
2018-12-22 13:39:30 -08:00
Rishi Gupta d813d29290 billing: Add mypy daemon warning to stripe stubs file. 2018-12-18 12:48:22 -08:00
Rishi Gupta f0538293de billing: Update test_replace_payment_source to use mock_stripe. 2018-11-28 10:45:00 -08:00
Vishnu Ks 8343ed6ceb billing: Use mock_stripe in test_downgrade_with_money_owed. 2018-11-26 15:59:19 -08:00
Vishnu Ks 1ec9097f55 billing: Use mock_stripe in test_downgrade. 2018-11-26 14:59:46 -08:00
Vishnu Ks a2c0ec207e billing: Use mock_stripe in test_attach_discount_to_realm. 2018-11-26 14:59:46 -08:00
Rishi Gupta 08daefa4a3 billing: Update payment method string to incorporate billing by invoice.
Also fixes a bug in process_initial_upgrade. If you have a card on file
(e.g. from a previous subscription), and try to upgrade by billing by
invoice, neither the if nor the elif condition applies.
2018-11-24 11:56:13 -08:00
Rishi Gupta 99506b486a billing: Add backend for paying by invoice. 2018-11-17 23:08:48 -08:00
Rishi Gupta 61e0c2693d billing: Use Subscription.save() instead of calling save on instances.
Continuation of 03d77bc.
2018-11-17 18:59:21 -08:00
Vishnu Ks 2e04cdbe5e billing: Show estimated subscription revenue on /activity.
[Substantial edits by Rishi Gupta]
2018-11-16 13:30:16 -08:00
Vishnu Ks b527c3c4ef billing: Make mock_stripe handle StripeErrors. 2018-10-30 09:55:13 -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 03d77bc6af billing: Replace instance.save() Stripe API calls with class.save(instance).
This will make it easier to mock the calls in our new stripe mocking
framework. I believe the two forms are equivalent, assuming the Stripe
Python bindings aren't doing anything crazy. And if not, well hopefully our
new testing framework will catch it :).

[Idea originally from Vishnu KS.]
2018-10-18 11:16:00 -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 5a6b2ebb1f billing: Add ability for users to change their card. 2018-09-24 19:25:26 -07:00
Rishi Gupta bd0487d503 billing: Fix mypy stubs to use keyword args instead of positional args. 2018-08-31 17:51:16 -07:00
Rishi Gupta 31ed4492ce billing: Add backend for downgrading. 2018-08-31 17:49:34 -07:00
Rishi Gupta eec07072ee billing: Add coupons. 2018-08-24 17:27:26 -07:00
Rishi Gupta d229948a43 billing: Make source optional when creating stripe customer. 2018-08-24 16:40:34 -07:00
Rishi Gupta 3cf9cd00d6 billing: Remove idempotency key from upgrade process.
This would be relevant if we retried on network failure, but we don't.
2018-08-22 19:18:32 -07:00
Rishi Gupta 56d4034db4 billing: Require successful charge to establish billing relationship.
There are several situations in which we want to create a Customer and
stripe.Customer object before we really have a billing relationship with a
customer. The main one is giving non-profit or educational discounts.
2018-08-13 20:24:08 -07:00
Rishi Gupta 27d4b1a5f0 billing: Add RealmAuditLogProcessor. 2018-08-13 17:12:50 -07:00
Rishi Gupta e804c563a8 billing: Update stripe error handling code. 2018-08-13 17:12:50 -07:00
Vishnu Ks 132480c031 billing: Pass email to stripe.Customer.create. 2018-08-10 13:52:35 -07:00
Vishnu Ks fa7b98030b billing: Add mock for cancel at period end subscriptions. 2018-08-04 19:17:34 -04:00
Vishnu Ks d89e07b8a7 billing: Add mock and test for extracting canceled subscription. 2018-08-04 19:17:34 -04:00
Vishnu Ks c2023eaaa8 billing: Mention the exact type of stripe.Customers subscriptions attribute. 2018-08-04 19:17:34 -04:00
Vishnu Ks 036ad03b3a billing: Mention the exact return type for mock functions. 2018-08-04 19:17:34 -04:00
Vishnu Ks abf485bfcb billing: Add mypy stubs to stripe imports.
Tweaked by tabbott to add an extra type: ignore.
2018-07-26 16:31:32 -07:00
Greg Price 6d44772925 mypy: Add a first stub file, for yamole.
The main purpose of this commit is to demonstrate end-to-end that
our setup for type stubs works.  I picked this library more or less
arbitrarily as one where the API surface we use is tiny, so that the
stub would be extra easy to write.
2018-07-12 14:10:53 +05:30