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
f55dbe33bb
billing: Create is_realm_on_free_trial helper function.
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
7197c8ae89
test_classes: Create helper function for subscribing realm to manual plan.
2021-06-09 17:42:38 -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
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
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
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
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
m-e-l-u-h-a-n
ccf520ff13
logging: Migrate many backend tests to use assertLogs.
...
This commit migrates some of the backend tests to use assertLogs(),
instead of mock.patch() as planned in #15331 .
Tweaked by tabbott to avoid tautological assertions.
2021-02-03 17:55:49 -08:00
m-e-l-u-h-a-n
7417ac9165
logging: Remove unncessary logging patches in backend tests.
...
There were some tests that had mock patches for logging, although no
logging was actually happening there. This commit removes such patches
in `corporate/tests/test_stripe.py`, `zerver/tests/test_cache.py`,
`zerver/tests/test_queue_worker.py`,
and `zerver/tests/test_signup.py`.
2021-02-03 17:47:38 -08:00
Vishnu KS
bd2642a7b8
billing: Make attach discount update the current price per license.
2020-12-17 17:09:20 -08:00
Vishnu KS
71efcca679
stripe: Create get_price_per_license function.
2020-12-17 17:09:20 -08:00
Anders Kaseorg
f294688157
test_stripe: Add CallableT cast.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-11-10 15:54:27 -08:00
Anders Kaseorg
4e9d587535
python: Pass query parameters as a dict when making GET requests.
...
This provides automatic URL-encoding.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-10-27 13:47:02 -07:00
Anders Kaseorg
dd48dbd912
docs: Add spaces to “check out”, “log in”, “set up”, “sign up” as verbs.
...
“Checkout”, “login”, “setup”, and “signup” are nouns, not verbs.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-10-13 15:47:13 -07:00
Vishnu KS
510efbc1a8
support: Add option to change billing method.
2020-09-28 15:37:49 -07:00
Vishnu KS
b8b2e443bc
stripe: Create void_all_open_invoices.
2020-09-28 15:37:49 -07:00
Alex Vandiver
b06253049a
stripe: Change `assert_called` to `assert_called_once`.
...
Prefer using `assert_called_once` to protect against places where a
mock might be reused, and in so doing have been previously called,
thus making the second usage of `assert_called` not assert anything of
note.
2020-09-23 15:29:47 -07:00
Alex Vandiver
ab4f6b54ea
stripe: Do not log credit card issues as errors.
...
Problems with the card itself should not be logged as errors -- while
perhaps notable in aggregate, they are not worthy of being logged to
Sentry, for instance.
Downgrade these to `info`; continue to log other problems at the
`error` level. This updates tests for this change, and in so doing
corrects a test that does not do its job, due to a missing
`reset_mock`.
2020-09-23 15:29:47 -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
Anders Kaseorg
9048f79e53
test_stripe: Simplify with iterable unpacking.
...
Issue suggested by the flake8-comprehensions plugin, although the
solution is simpler.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-02 11:15:41 -07:00
Anders Kaseorg
ab120a03bc
python: Replace unnecessary intermediate lists with generators.
...
Mostly suggested by the flake8-comprehension plugin.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-02 11:15:41 -07:00
Vishnu KS
d3c7277f77
billing: Show sponsorship message for organization on STANDARD_FREE.
...
Fixes #16180
2020-08-24 18:25:01 -07:00
Anders Kaseorg
61d0417e75
python: Replace ujson with orjson.
...
Fixes #6507 .
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-11 10:55:12 -07:00