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
Anders Kaseorg
219fc36051
stripe_fixtures: Fix incorrectly normalized JSON.
...
JSON does not allow leading zeros.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-07 15:05:01 -07:00
Anders Kaseorg
a329b538d2
test_helpers: Fix instrument_url decorator type.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-07 10:53:06 -07:00
Vishnu KS
d3834f8b9a
emails: Simplify requested by line in sponsorship email.
2020-07-24 17:39:46 -07:00
Vishnu KS
67bacd6e31
billing: Don't allow guest users to upgrade.
2020-07-22 16:57:49 -07:00
Vishnu KS
cb01a7f599
billing: Restrict access to billing page to realm owners and billing admins.
2020-07-22 16:57:49 -07:00
Steve Howell
c44500175d
database: Remove short_name from UserProfile.
...
A few major themes here:
- We remove short_name from UserProfile
and add the appropriate migration.
- We remove short_name from various
cache-related lists of fields.
- We allow import tools to continue to
write short_name to their export files,
and then we simply ignore the field
at import time.
- We change functions like do_create_user,
create_user_profile, etc.
- We keep short_name in the /json/bots
API. (It actually gets turned into
an email.)
- We don't modify our LDAP code much
here.
2020-07-17 11:15:15 -07:00
Mateusz Mandera
dd5349096f
test_stripe: Fix invalid UserProfile creation.
2020-07-15 19:29:24 +02:00
Vishnu KS
108ad84944
billing: Use no-reply address as from_address in sponsorship emails.
2020-07-14 00:36:31 -07:00
Steve Howell
0b65abcdf5
pointer: Remove pointer from UserProfile.
...
Most of the changes here are just that we no
longer need to provide a value for pointer
when we create UserProfile objects.
2020-07-03 13:08:40 +00:00
Vishnu KS
4c6350fa4b
billing: Add option to request a sponsorship in /upgrade.
2020-07-01 16:45:38 -07:00
Anders Kaseorg
f2e7076e2a
decorator: Replace type: ignore with cast, avoid Any.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-30 18:58:23 -07:00
Anders Kaseorg
e883567146
test_stripe: Fix a type: ignore issue.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-23 11:29:54 -07:00
Anders Kaseorg
b95fc4858d
corporate: Replace unchecked cast calls with assert.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-22 17:11:42 -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