Mateusz Mandera
3cafdbdc1e
counts: Add function compute_max_monthly_messages for remote servers.
...
This calculates the largest amount of messages sent within a month for
the last 3 months. The query is targeted for the specific use-case in
this function - for finding the count for a specific server. For
calculating this in bulk for a large number of remote server an
adapted, bulk query will be needed - rather than running this one in a
loop, which would likely be very inefficient.
2023-11-08 09:45:49 -08:00
Vishnu Ks
93b398bc0a
billing: Move zilencer/lib/stripe to corporate.
2018-10-01 15:43:44 -07:00
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
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
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
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
132480c031
billing: Pass email to stripe.Customer.create.
2018-08-10 13:52:35 -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
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
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
Rishi Gupta
4554b564f7
billing: Rename RealmAuditLog.REALM_PLAN_QUANTITY_UPDATED.
2018-07-31 10:56:31 -04:00
Vishnu Ks
ba7db968d8
billing: Don't check for stripe config while running tests.
2018-07-25 23:03:55 -07:00
Vishnu Ks
51c82b6d4f
models: Rename PLAN_QUANITY_UPDATED event type.
2018-07-25 23:03:55 -07:00
Vishnu Ks
975969aa89
stripe: Check for the existence of Pan objects in dev environment.
2018-07-25 23:03:55 -07:00
Vishnu Ks
b88613fd0b
billing: Expand default_source object when retrieving customer.
2018-07-24 10:20:23 -07:00
Vishnu Ks
1225bfd6ee
billing: Don't use data attribute for iterating through subscriptions.
...
Iterating through data attribute is same as iterating through
subscriptions.
2018-07-24 10:20:23 -07:00
Vishnu Ks
0bcc0ca0d8
stripe: Fix type of stripe_customer_id.
2018-07-24 10:20:23 -07:00
Vishnu Ks
d75054fb15
billing: Add function to sign strings.
2018-07-24 07:16:12 -07:00
Vishnu Ks
f2861442f7
billing: Enforce Customer can have only one live subscription at a time.
2018-07-23 19:03:36 -07:00
Vishnu Ks
db8700513b
stripe: Fix type of stripe_plan_id in do_subscribe_customer_to_plan.
2018-07-23 17:55:15 -07:00
Vishnu Ks
28167585b1
models: Rename several RealmAuditlog event types to past tense.
...
These event types haven't been used in production yet, and thus are
save to change without a migration.
2018-07-22 20:00:05 -07:00
Vishnu Ks
377fac2864
billing: Pass stripe_customer instead of Customer in upgrade functions.
2018-07-12 12:51:38 +05:30
Vishnu Ks
89fefcd1a2
mypy: Replace Any with stripe types in zilencer/lib/stripe.py.
2018-07-09 15:24:57 +05:30
Rishi Gupta
b5753d0ddc
billing: Add initial support for seat based plans.
...
The main remaining todo for correctly populating
RealmAuditLog.requires_billing_update is supporting the de-seating (and
corresponding re-seating) that happens after being offline for two weeks.
2018-07-09 14:33:08 +05:30
Rishi Gupta
16334a1ba7
billing: Update billing system.
2018-07-09 14:33:07 +05:30
Vishnu Ks
54a002c2e2
requirements: Upgrade pyflakes to 2.0.0.
...
We fix a few errors that only the new version finds.
2018-05-24 11:31:36 -07:00
Vishnu Ks
003cb0478a
stripe: Use sources.list instead of sources.all.
...
Sources.all would be depricated soon in favor of sources.list.
See https://github.com/stripe/stripe-python/blob/
v1.77.1/stripe/api_resources/list_object.py#L18
2018-02-12 12:45:46 -08:00