Commit Graph

258 Commits

Author SHA1 Message Date
Umair Khan 0d796e6c02 django-2.0: Add on_delete to OneToOneField. 2018-01-31 12:07:36 -08:00
Greg Price f9b12952f8 stripe: Move error handling into stripe.py too.
This completes the separation of our logic for managing Stripe
customers from the view code for the billing page.

As we add more features to our Customer model and to our Stripe
integration, we might further separate those two things; but for now
they're nearly synonymous and there's no problem in them being mixed
together.
2018-01-30 12:44:35 -08:00
Greg Price 0b81762350 billing: Move most Stripe code to its own file.
We'll handle the error-handling in a separate commit, as it's still
entangled with the view function.
2018-01-30 12:44:35 -08:00
Greg Price 5feb31a957 billing: Start pulling apart the page from the logic.
Pull the code that talks to Stripe out into its own functions.
In a followup commit we'll move these to a separate file, as well
as the error-handling logic that remains in the view function
for now.

Also fix the translation markings: the translated string must be a
constant (e.g. a format string), or else translation is impossible.

Viewing with `-b` shows the few changes that happen in the logic
as it moves out of the view function; viewing without shows the
few changes in the rest of the view function.
2018-01-30 12:44:35 -08:00
rht 8106a25e61 django-2.0: Add on_delete on ForeignKeys.
In Django 2.0, one must specify the on_delete behavior for all
ForeignKeys explicitly.
2018-01-30 10:53:54 -08:00
Brock Whittaker 3b600d5591 /billing/: Rename "payment.html" => "billing.html".
This matches the URL path /billing/ to the filename "billing.html".
2018-01-29 17:24:28 -08:00
Vishnu Ks a11b742984 messages: Calculate value of first visible message ID using cron job.
[greg: Fixed buggy time conversion in estimate_recent_messages.]
2018-01-24 17:15:08 -08:00
Vishnu Ks b762b839d4 stripe: Make newly added card default source. 2018-01-22 19:31:17 -08:00
Greg Price 1ef2d9d637 billing: Simplify logging of Stripe errors.
Several changes:
* De-duplicate code for different error types.
* No need to list lots of error subtypes where we aren't treating
  them differently; StripeError is the base class of them all.
* Unexpected, non-Stripe-related, exceptions we can handle in the normal
  way.  Just make them show up in the billing-specific log too.
* The Stripe client library already logs type, code, param, and message
  before raising an error, so we don't need to repeat those; just add the
  HTTP status code (because it's not there already and sure why not),
  and the Python exception type the client library chose to raise
  in case that makes things a bit easier to interpret.
2018-01-17 18:10:17 -08:00
Greg Price 858b9d7bc1 billing: Log important requests to Stripe. 2018-01-17 18:10:17 -08:00
Greg Price e8ceea7f0f billing: Send logs to a dedicated file.
This will help make them easy to read through.  Include messages to
the logger name `stripe`, which Stripe's client library logs to.
2018-01-17 18:10:17 -08:00
Greg Price 3aa5529b96 billing: Better error message for dev on lacking Stripe credentials.
Normal server admins will never run this code, and zulipchat.com will
have this information configured before users see it, so this message
is really just for development.
2018-01-17 16:44:04 -08:00
Greg Price 2b6e526ea2 zilencer: Make /billing appear without i18n prefix.
This copies what we do in `zproject/urls.py` for pages in the
main Django app.
2018-01-17 16:44:04 -08:00
Vishnu Ks 0bca0286a1 billing: Integrate Stripe, using Stripe Checkout.
Stripe Checkout means using JS code provided by Stripe to handle
almost all of the UI, which is great for us.

There are more features we should add to this page and changes we
should make, but this gives us an MVP.

[greg: expanded commit message; fixed import ordering and some types.]
2018-01-17 16:43:54 -08:00
Vishnu Ks a978336765 billing: Create model for customers paying with Stripe.
[greg: reduced migration dependencies, revised commit message.]
2018-01-17 16:15:14 -08:00
Greg Price 9a4cd54a25 zilencer: Add a simple management command to create a RemoteZulipServer.
This saves us from having to go into a `manage.py shell` to do this,
and adds a bit more structure like the usage message.
2018-01-08 17:46:46 -08:00
Marco Burstein 6f8792729d manage.py: Move the maximum digits calculation to outside of a loop. 2018-01-02 17:21:28 -05:00
Marco Burstein ff5a73e027 manage.py: Make it easy to create lots of streams with `populate_db`.
Fix #7968.
2018-01-02 16:48:03 -05:00
Viraat Chandra 65337603b6 mypy: Use Python 3 syntax for typing in `zilencer/views.py`. 2017-12-26 08:31:43 -05:00
rht 92d62f62e1 zilencer/management: Use Python 3 syntax for typing. 2017-12-12 17:41:12 -08:00
Greg Price 50e451cd7b populate_db: Create an email-reusing Cordelia in the "lear" realm. 2017-11-28 16:23:10 -08:00
Greg Price a753f49e6a populate_db: Add a "lear" realm for testing cross-realm email sharing.
We don't yet actually allow sharing emails across realms, but we
will soon.  This lets us start testing some pieces of those changes.
2017-11-28 16:23:10 -08:00
rht 138c486548 zilencer: Use python 3 syntax for typing. 2017-11-22 12:29:03 -08:00
Rishi Gupta 42652713c8 onboarding: Refactor away setup_initial_private_stream.
It is a confusing name, now that the stream creation part has been taken
away.
2017-11-21 17:39:50 -08:00
Tim Abbott 708872f361 populate_db: Use call_consume_in_tests when generating test data.
We'd rather this work be just executed immediately, rather than
queued, since queued events can confuse the queue workers if the
database is dropped and recreated repeatedly.
2017-11-21 09:43:54 -08:00
Tim Abbott 64230b3bd5 populate_db: Remove the 'simple' realm.
The 'simple' realm was super broken and confusing for new users.  We
should replace this with having an easy way to make a new realm in
development, done properly.

Fixes #6116.
2017-11-15 22:42:05 -08:00
Tim Abbott 2b43a0302a python: Sort imports in smaller apps. 2017-11-15 15:55:49 -08:00
Umair Khan ad8f5650a3 user-groups: Generate test data of user groups. 2017-11-13 13:08:15 +05:00
rht 548c96ad86 zilencer: Text-wrap long lines exceeding 110. 2017-11-07 17:24:06 -08:00
rht 995b300840 zilencer: Remove unused imports (F401). 2017-11-07 16:37:01 -08:00
rht ccf2792c1c refactor: Remove six.moves.configparser import. 2017-11-07 10:51:44 -08:00
rht ec5120e807 refactor: Remove six.moves.zip import. 2017-11-07 10:46:42 -08:00
rht 0e71b243ce zilencer: Remove inheritance from object. 2017-11-06 08:53:48 -08:00
neiljp (Neil Pilgrim) 6c995db231 mypy: Use Iterator[Any] as return type of queryset_iterator. 2017-11-04 19:47:45 -07:00
Harshit Bansal 233595b2f7 actions.py: Rename `do_add_reaction()` to `do_add_reaction_legacy()`. 2017-10-31 15:42:35 -07:00
Tim Abbott 1cd017288d views: Fix imports of REQ/has_request_variables from the wrong place.
These were never in zerver/decorator.py, and so it makes sense to
import them zerver/lib/request.py, mostly for ease of finding things.
2017-10-27 15:07:31 -07:00
Vishnu Ks 1d94119d31 actions: Call send_initial_pms from process_new_human_user. 2017-10-25 14:14:59 -07:00
Tim Abbott 735b49e505 zilencer: Fix uniqueness rules for RemotePushDeviceToken.
Since a user could use the same installation of the Zulip mobile app
with multiple Zulip servers, correct behavior is to allow reusing the
same token with multiple Zulip servers in the RemotePushDeviceToken
model.
2017-10-18 21:24:06 -07:00
rht 691598a88b py3: Remove "from six.moves import range".
This is no longer required, since in Python 3, this is what the range
built-in does.
2017-10-17 23:28:14 -07:00
rht 2f3ae84e5a py3: Remove all `__future__ import division`. 2017-10-17 23:09:12 -07:00
rht b2ad8fd747 py3: Remove all `from __future__ import unicode_literals`.
This was mostly used in migrations, so it's a pretty safe change.
2017-10-17 23:07:42 -07:00
Tim Abbott 66a3f514d4 zilencer: Remove long-obsolete Deployment model.
This was a precursor to RemoteZulipServer, which is no longer used for
anything, and was cluttering the codebase.
2017-10-11 23:48:01 -07:00
Tim Abbott 51006f4a43 populate_db: Create bots before sending messages.
Apparently, the order we'd just created in
cbbdd539f4 broke populate_db; this is a
better and more sustainable fix to the overall problem.
2017-10-11 23:27:00 -07:00
Tim Abbott cbbdd539f4 populate_db: Fix creating welcome-bot at the wrong place.
While it might be useful to have created welcome-bot earlier in a
certain sense, it's definitely not a good idea in this populate_db
implementation, because doing so threw off the random initial
assignment of users to streams and thus broke the casper tests.
2017-10-11 22:17:09 -07:00
derAnfaenger 5ddc336844 tests: Add welcome bot as user. 2017-10-11 20:45:42 -07:00
Brock Whittaker 835b6c7059 components: Make checkboxes darker.
This makes the standard checkboxes 7% darker and makes the disabled
ones about 12% darker + 7% darker than they were before, to
increase visibility.

Fixes: #6331.
2017-10-11 13:15:44 -07:00
rht 8d289b8228 zilencer: Remove absolute_import. 2017-09-27 20:20:07 -07:00
rht ed9b3ca440 zilencer: Remove import print_function. 2017-09-27 18:06:47 -07:00
Robert Hönig c77b245944 backend tests: Add 'AARON' as bot owner of OUTGOING_WEBHOOK_BOT. 2017-09-26 16:11:27 -07:00
Rishi Gupta 0727f045f5 zilencer: Add management commands to create new dev users and realms. 2017-09-22 06:35:43 -07:00