PIG208
dcbb2a78ca
python: Migrate most json_error => JsonableError.
...
JsonableError has two major benefits over json_error:
* It can be raised from anywhere in the codebase, rather than
being a return value, which is much more convenient for refactoring,
as one doesn't potentially need to change error handling style when
extracting a bit of view code to a function.
* It is guaranteed to contain the `code` property, which is helpful
for API consistency.
Various stragglers are not updated because JsonableError requires
subclassing in order to specify custom data or HTTP status codes.
2021-06-30 16:22:38 -07:00
Vishnu KS
d456f85e01
billing: Document model fields that are not self explanatory.
2021-06-28 21:44:16 -07:00
Mateusz Mandera
bae86ad3da
billing: Move exempt_from_from_license_number_check to Customer model.
...
This belongs more on the Customer model, since this is a similar
attribute to default_discount.
2021-06-18 14:05:42 -07:00
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
cdf683e36f
billing: Create customer_has_credit_card_as_default_source function.
2021-06-14 16:49:53 -07:00
Vishnu KS
6e3d4e7e75
billing: Create is_free_trial_offer_enabled function.
2021-06-14 16:49:53 -07:00
Vishnu KS
f55dbe33bb
billing: Create is_realm_on_free_trial helper 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
40ab415005
activity: Show effective rate of realms in /activity page.
2021-06-11 07:41:02 -07:00
Vishnu KS
42119c136b
billing: Allow to exclude realms from license limit check.
2021-06-09 17:42:38 -07:00
Vishnu KS
1938076f67
billing: Enforce license limit for plans on manual license management.
2021-06-09 17:42:38 -07:00
Vishnu KS
7197c8ae89
test_classes: Create helper function for subscribing realm to manual plan.
2021-06-09 17:42:38 -07:00
Vishnu KS
3d5ee69b21
stripe: Create make_user_billing_admin helper function.
2021-06-03 10:13:59 -07:00
Mateusz Mandera
67dada8a44
corporate: Add some basic documentation of the corporate/* models.
...
The billing system has been mostly devoid of any documentation. This
commit is meant to add a basic documentation of the data model of this
system.
2021-06-03 09:31:21 -07:00
Abhijeet Prasad Bodas
352634a851
tests: Consistently use assert_length helper.
...
This helper does some nice things like printing out
the data structure incase of failure.
2021-05-19 11:55:56 -07:00
Vishnu KS
5ad50b19cb
billing: Show billing email in /billing page.
2021-05-18 17:46:38 -07:00
Vishnu KS
e019045abe
actions: Create send_message_to_signup_notification_stream.
2021-05-14 15:10:02 -07:00
Vishnu KS
13cf34f283
billing: Add test for billing page when the plan is scheduled for downgrade.
2021-05-14 15:10:02 -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
20d2e00cf9
billing: Create update_license_ledger_for_manual_plan.
2021-05-14 15:10:02 -07:00
Vishnu KS
611866e3d6
billing: Create CustomerPlan.licenses_at_next_renewal function.
2021-05-14 15:10:02 -07:00
Vishnu KS
922cfac689
billing: Create CustomerPlan.licenses function.
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
Siddharth Asthana
233c4d520c
support: Create RealmAuditLog when updating billing_method.
...
This commit also makes acting_user as a mandantory argument and fixes
the tests accordingly.
2021-04-03 08:01:46 -07:00
Siddharth Asthana
44c34cb39a
support: Create RealmAuditLog when approving sponsorship.
2021-04-03 08:01:46 -07:00
Siddharth Asthana
6945ed3587
support: Pass acting_user to attach_discount_to_realm.
2021-04-03 08:01:46 -07:00
Siddharth Asthana
c3f37c2a64
support: Pass acting_user to do_change_plan_type.
...
acting_user is now a mandatory field, so wherever this function is used,
we are passing acting_user as well.
2021-04-03 08:01:46 -07:00
shanukun
4b00e5da72
refactor: Make acting_user a mandatory kwarg for do_deactivate_realm.
2021-04-02 14:44:41 -07:00
Mateusz Mandera
f329878376
migrations: Subscription.is_user_active denormalization - step one.
...
This adds the is_user_active with the appropriate code for setting the
value correctly in the future. In the following commit a migration to
backfill the value for existing Subscriptions will be added.
To ensure correct user_profile.is_active handling also in tests, we
replace all direct .is_active mutation with calls to appropriate
functions.
2021-03-30 09:19:03 -07:00
shanukun
c95061e9b9
refactor: Make acting_user a mandatory kwarg for do_deactivate_user.
2021-03-29 15:51:45 -07:00
shanukun
8f3ae715c0
refactor: Make acting_user a mandatory kwarg for do_reactivate_user.
2021-03-29 15:51:45 -07:00
m-e-l-u-h-a-n
5ae896758d
logging: use assertEqual to assert logging output.
...
This commit migrates some tests in test_stripe.py and
test_embedded_bot_system.py to use assertEqual instead of
assertRegexpMatches for asserting logs, as suggested here:
https://github.com/zulip/zulip/pull/16818#discussion_r569888862
2021-03-25 01:10:03 -07:00
Mateusz Mandera
d91d3a05b9
tests: Use do_create_realm where possible.
...
Using do_create_realm should be preferred over manual creation where
possible, as it creates more realistic data.
2021-03-14 08:50:02 -07:00
shanukun
fafe1a31d7
refactor: Make acting_user a mandatory kwarg for do_activate_user.
2021-02-25 17:58:00 -08:00
shanukun
4b67946605
refactor: Make acting_user a mandatory kwarg for do_create_user.
2021-02-25 17:58:00 -08:00
Alex Vandiver
e53be6d043
email: Set an envelope-from which may be different from the From: field.
...
The envelope-from is used by the MTA if the destination address is not
deliverable. Route all such mail to the noreply address.
2021-02-24 17:32:28 -08:00
Mateusz Mandera
09fc79f911
actions: Remove realm argument to internal_send_private_message.
...
The argument is redundant.
2021-02-23 15:26:47 -08:00