Vishnu Ks
3e86fa84ea
billing: Rename RealmAuditLog.STRIPE_CARD_ADDED to STRIPE_CARD_CHANGED.
2018-09-11 00:08:38 -07:00
Rishi Gupta
18b86a9499
billing: Fix RealmAuditLog accounting for downgrade.
2018-09-01 09:42:10 -07:00
Rishi Gupta
31ed4492ce
billing: Add backend for downgrading.
2018-08-31 17:49:34 -07:00
Rishi Gupta
b7c326a161
billing: Include account balance in prorated credits calculation.
2018-08-31 17:49:34 -07:00
Rishi Gupta
bebd93b571
billing: Fix idempotency bug in setup_stripe management command.
2018-08-31 17:49:34 -07:00
Rishi Gupta
24b22e7e75
billing: Guard billing by BILLING_ENABLED rather than DEVELOPMENT.
2018-08-31 17:49:34 -07:00
Vishnu Ks
7b307fa58f
billing: Set max_invites to 3000 for Premium organizations.
...
This is meant to be effectively infinite for legitimate use.
2018-08-28 16:03:34 -07:00
Vishnu Ks
98dac0f0a9
billing: Remove Customer.billing_user.
2018-08-27 12:35:46 -07:00
Vishnu Ks
dcb7b15069
billing: Use UserProfile.is_billing_admin instead of Customer.billing_user.
2018-08-27 12:35:46 -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
4ad8f20c28
billing: Add comment explaining race condition in customer creation.
2018-08-24 16:40:34 -07:00
Rishi Gupta
90407537a0
billing: Add comment explaining race conditions in initial subscription.
2018-08-22 21:30:48 -07:00
Rishi Gupta
16a5540e58
billing: Add comment to downgrading section in views.billing_home.
2018-08-22 19:20:06 -07:00
Rishi Gupta
d081cf7b78
billing: Add transaction.atomic() for Customer creation and logging.
2018-08-22 19:20:06 -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
Vishnu Ks
9bb338be11
models: Add plan_type to Realm.
2018-08-21 12:39:06 -07:00
Rishi Gupta
c3a912f8b6
management commands: Add sleep_forever to lib/management.
2018-08-17 09:20:51 -07:00
Rishi Gupta
4181d575b1
billing: Move Stripe call to end in do_subscribe_customer_to_plan.
...
In general, everything that could throw an error and that could come before
the Stripe call should do so.
2018-08-13 20:24:08 -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
Rishi Gupta
d0e377428a
billing: Fix typo in CONTACT_SUPPORT error message.
2018-08-10 22:48:10 -07:00
Rishi Gupta
2855864f54
billing: Rename RealmAuditLog.REALM_PLAN_QUANTITY_RESET.
2018-08-10 15:54:31 -07:00
Rishi Gupta
abc044e869
billing: Rename RealmAuditLog.REALM_PLAN_STARTED.
2018-08-10 15:54:31 -07:00
Rishi Gupta
d33d7e1c28
billing: Rename RealmAuditLog.REALM_CARD_ADDED.
2018-08-10 15:54:30 -07:00
Rishi Gupta
bdb6d8213f
billing: Rename RealmAuditLog.REALM_STRIPE_INITIALIZED.
2018-08-10 15:46:55 -07:00
Vishnu Ks
0c84260faa
billing: Enforce full coverage in zilencer/tests.
2018-08-10 13:52:35 -07:00
Vishnu Ks
4895637a5a
billing: Fix the BillingError description check in test.
...
The self.assertEqual statement won't get executed because
BillingError would be raised and the execution would exit
with block.
2018-08-10 13:52:35 -07:00
Vishnu Ks
d32051b106
billing: Test that salt and seat_count are set correctly in /upgrade.
2018-08-10 13:52:35 -07:00
Vishnu Ks
132480c031
billing: Pass email to stripe.Customer.create.
2018-08-10 13:52:35 -07:00
Vishnu Ks
d64ba5d2be
billing: Update the charged amount when user changes plan in upgrade page.
2018-08-10 13:52:35 -07:00
Yago González
6a192ac84c
utils: Move random API key generator as generate_api_key.
...
random_api_key, the function we use to generate random tokens for API
keys, has been moved to zerver/lib/utils.py because it's used in more
parts of the codebase (apart from user creation), and having it in
zerver/lib/create_user.py was prone to cyclic dependencies.
The function has also been renamed to generate_api_key to have an
imperative name, that makes clearer what it does.
2018-08-08 16:45:25 -07:00
Yago González
f6219745de
users: Get all API keys via wrapper method.
...
Now reading API keys from a user is done with the get_api_key wrapper
method, rather than directly fetching it from the user object.
Also, every place where an action should be done for each API key is now
using get_all_api_keys. This method returns for the moment a single-item
list, containing the specified user's API key.
This commit is the first step towards allowing users have multiple API
keys.
2018-08-08 16:35:17 -07:00
Rishi Gupta
2cdcf4b88f
billing: Rename get_upcoming_invoice.
2018-08-06 16:24:09 -04:00
Rishi Gupta
89ca1d0d97
billing: Rename get_stripe_customer.
2018-08-06 16:24:09 -04:00
Rishi Gupta
086b7d76e5
billing: Rename customer_with_active_subscription in fixture generation.
...
Fixes regression introduced in 79dddd5
.
2018-08-06 16:24:09 -04:00
Rishi Gupta
9f2b8a4a11
billing: Move checks from process_initial_upgrade into separate function.
2018-08-06 11:05:33 -04:00
Rishi Gupta
5719633992
billing: Update and unify billing error handling.
2018-08-06 11:05:33 -04:00
Rishi Gupta
79dddd5b80
billing: Rename customer_with_active_subscriptiion.
2018-08-06 11:05:33 -04:00
Vishnu Ks
18a9e4fc9c
billing: Call mock directly in test_subscribe_customer_to_second_plan.
2018-08-06 11:05:33 -04:00
Vishnu Ks
e06957bef5
billing: Raise exceptions instead of returning errors in upgrade flow.
2018-08-06 11:05:33 -04:00
Vishnu Ks
8643c681f0
billing: Separate initial upgrade logic to another function.
2018-08-06 11:05:33 -04: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
84b148728f
billing: Don't mock functions in test_extract_current_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
8bcd4131fe
billing: Rename retrieve_customer fixture.
2018-08-04 19:17:34 -04:00
Vishnu Ks
b7d3a1a0f3
billing: Don't check for stripe key and plan objects in tests.
...
Stripe already returns an appropriate error in prod, and these checks are
just a hassle in tests.
Also fixes an error where the check for Plan.objects.exists() was missing
a "not".
2018-08-04 19:17:34 -04:00