Vishnu KS
203ddfc546
billing: Create cents_to_dollar_string helper function.
2021-06-14 16:56:18 -07:00
Vishnu KS
1eb83cbadc
billing: Create is_sponsored_realm function.
2021-06-14 16:49:53 -07:00
Vishnu KS
06b5f9feae
billing: Create is_free_trial function in CustomerPlan model.
2021-06-14 16:49:53 -07:00
Vishnu KS
3d5ee69b21
stripe: Create make_user_billing_admin helper function.
2021-06-03 10:13:59 -07:00
Vishnu KS
323ad83d98
billing: Allow updating licenses of plans on manual license management.
2021-05-14 15:10:02 -07:00
Vishnu KS
878dcd95d0
billing: Call make_end_of_cycle_updates_if_needed before plan is updated.
2021-05-14 15:10:02 -07:00
Vishnu KS
45f7a25351
billing: Rename licenses_used variable to seat_count.
2021-05-14 15:10:02 -07:00
Vishnu KS
c9f4439850
billing: Extract out validate_licenses function.
2021-05-14 15:10:02 -07:00
Vishnu KS
d9baa681b2
billing: Use PATCH request for changing plan status.
...
I think it's much more cleaner to use PATCH request on
/json/billing/plan than using a POST request on
/json/billing/plan/change to update the plan.
2021-05-14 15:10:02 -07:00
Tim Abbott
7563e3692c
billing: Add nocoverage for some untested error cases.
...
Ideally, we'd have tests covering these cases.
2021-05-07 09:51:23 -07:00
Vishnu KS
d88f1103b7
corporate: Use check_int_in in change_plan_status.
2021-05-07 09:37:41 -07:00
Vishnu KS
752fd2e2d1
corporate: Fix string encoding in billing and sponsorship endpoints.
2021-05-07 09:37:40 -07:00
Vishnu KS
760a3861e1
corporate: Create VALID_BILLING_SCHEDULE_VALUES in views.py.
2021-05-07 09:32:29 -07:00
Vishnu KS
ef1b3a4067
corporate: Create VALID_BILLING_MODALITY_VALUES in views.py.
2021-05-07 09:32:29 -07:00
Vishnu KS
6db6fab5ff
corporate: Create VALID_LICENSE_MANAGEMENT_VALUES in views.py.
2021-05-07 09:32:29 -07:00
Anders Kaseorg
e7ed907cf6
python: Convert deprecated Django ugettext alias to gettext.
...
django.utils.translation.ugettext is a deprecated alias of
django.utils.translation.gettext as of Django 3.0, and will be removed
in Django 4.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-15 18:01:34 -07:00
Anders Kaseorg
f0e655f1d8
request: Rename validator parameter of REQ to json_validator.
...
This makes it much more clear that this feature does JSON encoding,
which previously was only indicated in the documentation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-07 14:13:06 -07:00
Siddharth Asthana
80c9243c6a
support: Create RealmAuditLog when updating sponsorship status.
2021-04-03 08:01:46 -07:00
Anders Kaseorg
6e4c3e41dc
python: Normalize quotes with Black.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Anders Kaseorg
11741543da
python: Reformat with Black, except quotes.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Anders Kaseorg
f461a64a6b
i18n: Fix some ineffective calls to ugettext at top level.
...
Translation has no effect when we don’t yet know what language we’re
translating for.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-10-18 14:31:15 -07:00
Vishnu KS
dbaea757ae
billing: Create downgrade_at_the_end_of_billing_cycle.
2020-09-28 15:37:49 -07:00
Vishnu KS
0d30f59c97
billing: downgrade_now -> downgrade_now_without_creating_additional_invoice.
2020-09-28 15:37:49 -07:00
Anders Kaseorg
faf600e9f5
urls: Remove unused URL names and shorten others.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-22 10:46:28 -07:00
Anders Kaseorg
bef46dab3c
python: Prefer kwargs form of dict.update.
...
For less inflation by Black.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-03 17:51:09 -07:00
Vishnu KS
d3c7277f77
billing: Show sponsorship message for organization on STANDARD_FREE.
...
Fixes #16180
2020-08-24 18:25:01 -07:00
Alex Vandiver
2928bbc8bd
logging: Report stack_info on logging.exception calls.
...
The exception trace only goes from where the exception was thrown up
to where the `logging.exception` call is; any context as to where
_that_ was called from is lost, unless `stack_info` is passed as well.
Having the stack is particularly useful for Sentry exceptions, which
gain the full stack trace.
Add `stack_info=True` on all `logging.exception` calls with a
non-trivial stack; we omit `wsgi.py`. Adjusts tests to match.
2020-08-11 10:16:54 -07:00
Vishnu KS
f6cbb9177a
models: Add plan_name attribute to CustomerPlan.
2020-07-24 17:37:41 -07:00
Vishnu KS
67bacd6e31
billing: Don't allow guest users to upgrade.
2020-07-22 16:57:49 -07:00
Clara Dantas
8b30e03d4b
models.py: Add get_role_name function in UserProfile class.
...
This function returns the name of the user role that we can use
to display in error report emails.
2020-07-21 16:12:16 -07:00
Vishnu KS
108ad84944
billing: Use no-reply address as from_address in sponsorship emails.
2020-07-14 00:36:31 -07:00
Vishnu KS
4c6350fa4b
billing: Add option to request a sponsorship in /upgrade.
2020-07-01 16:45:38 -07:00
Vishnu KS
508ba663dc
billing: Wrap make_end_of_cycle_updates_if_needed with transaction.atomic.
...
Otherwise, the plan would be left in an inconsistent state if one of the
queries fail.
2020-06-18 17:34:03 -07:00
Vishnu KS
cde4486f8c
billing: Support switching from monthly to annual plan.
2020-06-18 17:34:03 -07:00
Vishnu KS
98cd52cc3e
billing: Mention how the licenses are managed in /billing.
2020-06-18 16:30:48 -07:00
Anders Kaseorg
f364d06fb5
python: Convert percent formatting to .format for translated strings.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-15 16:24:46 -07:00
Anders Kaseorg
1ed2d9b4a0
logging: Use logging.exception and exc_info for unexpected exceptions.
...
logging.exception() and logging.debug(exc_info=True),
etc. automatically include a traceback.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-14 23:27:22 -07:00
Anders Kaseorg
365fe0b3d5
python: Sort imports with isort.
...
Fixes #2665 .
Regenerated by tabbott with `lint --fix` after a rebase and change in
parameters.
Note from tabbott: In a few cases, this converts technical debt in the
form of unsorted imports into different technical debt in the form of
our largest files having very long, ugly import sequences at the
start. I expect this change will increase pressure for us to split
those files, which isn't a bad thing.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 16:45:32 -07:00
Anders Kaseorg
67e7a3631d
python: Convert percent formatting to Python 3.6 f-strings.
...
Generated by pyupgrade --py36-plus.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-10 15:02:09 -07:00
Anders Kaseorg
8dd83228e7
python: Convert "".format to Python 3.6 f-strings.
...
Generated by pyupgrade --py36-plus --keep-percent-format, but with the
NamedTuple changes reverted (see commit
ba7906a3c6
, #15132 ).
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-08 15:31:20 -07:00
Vishnu KS
8784539d53
free trial: Send users to /upgrade after realm creation.
2020-05-26 17:01:32 -07:00
Vishnu Ks
66b1ad7002
billing: User FREE_TRIAL_DAYS instead of FREE_TRIAL_MONTHS.
2020-05-16 14:52:01 -07:00
Vishnu KS
8fb1f2af58
billing: Support downgrading plan from /billing page.
2020-05-11 17:20:54 -07:00
Vishnu KS
f1b1bf5a0d
billing: Add support for Zulip Standard free trial.
2020-05-11 17:20:54 -07:00
Vishnu Ks
66a437bbf1
billing: Restrict max licenses to 1000 during upgrade via invoice.
2020-05-11 17:09:49 -07:00
Anders Kaseorg
7271fb68aa
logging: Pass format arguments to unconventionally-named loggers too.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-02 16:37:07 -07:00
Vishnu KS
aca80206df
billing: Rename change_plan_at_end_of_cycle to change_plan_status.
2020-04-28 22:05:49 -07:00
Anders Kaseorg
fead14951c
python: Convert assignment type annotations to Python 3.6 style.
...
This commit was split by tabbott; this piece covers the vast majority
of files in Zulip, but excludes scripts/, tools/, and puppet/ to help
ensure we at least show the right error messages for Xenial systems.
We can likely further refine the remaining pieces with some testing.
Generated by com2ann, with whitespace fixes and various manual fixes
for runtime issues:
- invoiced_through: Optional[LicenseLedger] = models.ForeignKey(
+ invoiced_through: Optional["LicenseLedger"] = models.ForeignKey(
-_apns_client: Optional[APNsClient] = None
+_apns_client: Optional["APNsClient"] = None
- notifications_stream: Optional[Stream] = models.ForeignKey('Stream', related_name='+', null=True, blank=True, on_delete=CASCADE)
- signup_notifications_stream: Optional[Stream] = models.ForeignKey('Stream', related_name='+', null=True, blank=True, on_delete=CASCADE)
+ notifications_stream: Optional["Stream"] = models.ForeignKey('Stream', related_name='+', null=True, blank=True, on_delete=CASCADE)
+ signup_notifications_stream: Optional["Stream"] = models.ForeignKey('Stream', related_name='+', null=True, blank=True, on_delete=CASCADE)
- author: Optional[UserProfile] = models.ForeignKey('UserProfile', blank=True, null=True, on_delete=CASCADE)
+ author: Optional["UserProfile"] = models.ForeignKey('UserProfile', blank=True, null=True, on_delete=CASCADE)
- bot_owner: Optional[UserProfile] = models.ForeignKey('self', null=True, on_delete=models.SET_NULL)
+ bot_owner: Optional["UserProfile"] = models.ForeignKey('self', null=True, on_delete=models.SET_NULL)
- default_sending_stream: Optional[Stream] = models.ForeignKey('zerver.Stream', null=True, related_name='+', on_delete=CASCADE)
- default_events_register_stream: Optional[Stream] = models.ForeignKey('zerver.Stream', null=True, related_name='+', on_delete=CASCADE)
+ default_sending_stream: Optional["Stream"] = models.ForeignKey('zerver.Stream', null=True, related_name='+', on_delete=CASCADE)
+ default_events_register_stream: Optional["Stream"] = models.ForeignKey('zerver.Stream', null=True, related_name='+', on_delete=CASCADE)
-descriptors_by_handler_id: Dict[int, ClientDescriptor] = {}
+descriptors_by_handler_id: Dict[int, "ClientDescriptor"] = {}
-worker_classes: Dict[str, Type[QueueProcessingWorker]] = {}
-queues: Dict[str, Dict[str, Type[QueueProcessingWorker]]] = {}
+worker_classes: Dict[str, Type["QueueProcessingWorker"]] = {}
+queues: Dict[str, Dict[str, Type["QueueProcessingWorker"]]] = {}
-AUTH_LDAP_REVERSE_EMAIL_SEARCH: Optional[LDAPSearch] = None
+AUTH_LDAP_REVERSE_EMAIL_SEARCH: Optional["LDAPSearch"] = None
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-22 11:02:32 -07:00
Vishnu KS
3f94195d51
billing: Show appropriate message when not on a paid plan.
2020-04-16 19:28:37 -07:00
Vishnu KS
dc4d88f6c9
billing: Call stripe_get_customer only if plan is not empty.
...
Saves an unnecesary call to Stripe if the plan is empty.
2020-04-16 19:28:37 -07:00