looper.git
2 days agoErase Braintree client token when charge fails master
Anna Sirota [Wed, 5 May 2021 16:21:46 +0000 (18:21 +0200)]
Erase Braintree client token when charge fails

2 days agoErase Braintree client token when adding a payment method fails
Anna Sirota [Wed, 5 May 2021 15:47:19 +0000 (17:47 +0200)]
Erase Braintree client token when adding a payment method fails

2 days agoCatch and report "nonce not found" Braintree error
Anna Sirota [Wed, 5 May 2021 15:46:44 +0000 (17:46 +0200)]
Catch and report "nonce not found" Braintree error

2 days agoOrder plan variations by default for currency first
Anna Sirota [Wed, 5 May 2021 12:24:29 +0000 (14:24 +0200)]
Order plan variations by default for currency first

2 weeks agoChange the gateway widget by wrapping labels into stylable elements
Anna Sirota [Fri, 23 Apr 2021 14:43:20 +0000 (16:43 +0200)]
Change the gateway widget by wrapping labels into stylable elements

2 weeks agoBump the version
Anna Sirota [Thu, 22 Apr 2021 11:19:17 +0000 (13:19 +0200)]
Bump the version

2 weeks agoShow the original error message returned by the gateway, if possible
Anna Sirota [Thu, 22 Apr 2021 11:18:43 +0000 (13:18 +0200)]
Show the original error message returned by the gateway, if possible

2 weeks agoBump the version
Anna Sirota [Mon, 19 Apr 2021 09:38:17 +0000 (11:38 +0200)]
Bump the version

3 weeks agoDo not use payment method authentications already linked to transactions
Anna Sirota [Thu, 15 Apr 2021 11:15:05 +0000 (13:15 +0200)]
Do not use payment method authentications already linked to transactions

3 weeks agoMark Braintree transactions as `recurring` in accordance with their docs
Anna Sirota [Thu, 15 Apr 2021 10:26:16 +0000 (12:26 +0200)]
Mark Braintree transactions as `recurring` in accordance with their docs

This patch adds appropriate transaction_source parameter to the Braintree's .sale() call, in accordance with their guide for exemptions from Strong Customer Authentication for recurring transactions.
It corrects a bunch of invalid assumptions in the code due to which 3D Secure authentication was not included into transactions even though it was acquired in the checkout.
See {D10501} for more details.

3 weeks agoRevert "Allow AbstractPaymentView to be used when logged out"
Anna Sirota [Thu, 15 Apr 2021 09:22:00 +0000 (11:22 +0200)]
Revert "Allow AbstractPaymentView to be used when logged out"

This reverts commit 29163437acfdc448f664c5fb621560e8d061a886.

3 weeks agoAllow AbstractPaymentView to be used when logged out
Anna Sirota [Thu, 15 Apr 2021 09:01:47 +0000 (11:01 +0200)]
Allow AbstractPaymentView to be used when logged out

E.g. Blender Studio join view handles both logged in and logged out sessions.

4 weeks agoFix typos
Anna Sirota [Thu, 8 Apr 2021 15:55:51 +0000 (17:55 +0200)]
Fix typos

4 weeks agoFix PEP8 errors
Anna Sirota [Thu, 8 Apr 2021 11:53:06 +0000 (13:53 +0200)]
Fix PEP8 errors

4 weeks agoRemove already unused PaymentMethodReplaceView
Anna Sirota [Thu, 8 Apr 2021 11:45:50 +0000 (13:45 +0200)]
Remove already unused PaymentMethodReplaceView

4 weeks agoAdd payment methods to the admin
Anna Sirota [Wed, 7 Apr 2021 13:00:26 +0000 (15:00 +0200)]
Add payment methods to the admin

4 weeks ago[PEP8] Remove double spaces
Anna Sirota [Wed, 7 Apr 2021 12:59:30 +0000 (14:59 +0200)]
[PEP8] Remove double spaces

4 weeks agoUpgrade braintree SDK
Anna Sirota [Wed, 7 Apr 2021 12:53:22 +0000 (14:53 +0200)]
Upgrade braintree SDK

Braintree 4.0.0 introduces new parameters (such as `three_d_secure_authentication_id`),
which are necessary for correct implementation of SCA-compatible payment flows.

4 weeks ago[PEP8] fix a long line
Anna Sirota [Tue, 6 Apr 2021 15:25:39 +0000 (17:25 +0200)]
[PEP8] fix a long line

6 weeks agoMove customer IP validation to the views D10820
Anna Sirota [Thu, 25 Mar 2021 16:34:40 +0000 (17:34 +0100)]
Move customer IP validation to the views D10820

Decouples IP address validation from the actual process of transacting a sale.
Before this patch, if an invalid IP address was passed via the request headers,
the checkout views failed with a `DataError` in the `Transaction.charge()` call,
while still creating a Transaction.
This makes sure they faile earlier with a `ValidationError`.

6 weeks agoAdd missing checkout templates to the example project
Anna Sirota [Thu, 25 Mar 2021 15:25:53 +0000 (16:25 +0100)]
Add missing checkout templates to the example project

6 weeks agoDisplay IP address in Transaction admin
Anna Sirota [Thu, 25 Mar 2021 15:25:11 +0000 (16:25 +0100)]
Display IP address in Transaction admin

6 weeks agoSnippet for including looper scripts
Anna Sirota [Wed, 24 Mar 2021 16:02:01 +0000 (17:02 +0100)]
Snippet for including looper scripts

Adds a "looper/scripts.html" that takes care or including all necessary looper scripts.
Bumps the version to 1.2.1.

7 weeks agoBump version
Anna Sirota [Thu, 18 Mar 2021 15:09:58 +0000 (16:09 +0100)]
Bump version

7 weeks agoUse devfund looper
Anna Sirota [Thu, 18 Mar 2021 15:06:14 +0000 (16:06 +0100)]
Use devfund looper

2 months agoConsistent use of Any in decorators
Anna Sirota [Tue, 16 Feb 2021 14:51:30 +0000 (15:51 +0100)]
Consistent use of Any in decorators

2 months agoBring back the usual way of running tests D10398
Anna Sirota [Tue, 16 Feb 2021 14:19:01 +0000 (15:19 +0100)]
Bring back the usual way of running tests D10398

2 months agoFature parity with the DevFund implementation D7445
Anna Sirota [Thu, 11 Feb 2021 14:25:36 +0000 (15:25 +0100)]
Fature parity with the DevFund implementation D7445

12 months agoUpdate comments in settings.example.py
Francesco Siddi [Wed, 15 Apr 2020 21:29:25 +0000 (23:29 +0200)]
Update comments in settings.example.py

Additional instructions on how to configure the Braintree gateway.

13 months agoFix tests due to changes in previous Differentials
Sem Mulder [Tue, 31 Mar 2020 13:46:52 +0000 (15:46 +0200)]
Fix tests due to changes in previous Differentials

13 months agoAddress raised concerns
Sem Mulder [Tue, 31 Mar 2020 11:23:20 +0000 (13:23 +0200)]
Address raised concerns

13 months agoFix tests
Sem Mulder [Fri, 27 Mar 2020 13:10:10 +0000 (14:10 +0100)]
Fix tests

13 months agoRender AddressForm as list
Sem Mulder [Fri, 27 Mar 2020 07:25:19 +0000 (08:25 +0100)]
Render AddressForm as list

13 months agoDo not derive from a class in a Mixin
Sem Mulder [Thu, 26 Mar 2020 13:22:33 +0000 (14:22 +0100)]
Do not derive from a class in a Mixin

13 months agoRemove dead code
Sem Mulder [Thu, 26 Mar 2020 13:21:56 +0000 (14:21 +0100)]
Remove dead code

13 months agoNaming and docs for the "finished payment" and the "new subscription when the user...
Sem Mulder [Tue, 31 Mar 2020 13:31:01 +0000 (15:31 +0200)]
Naming and docs for the "finished payment" and the "new subscription when the user is anonymous" views

13 months agoHandle falsy client_token
Sem Mulder [Tue, 31 Mar 2020 13:11:24 +0000 (15:11 +0200)]
Handle falsy client_token

13 months agoOnly use path from `next` parameter
Sem Mulder [Tue, 31 Mar 2020 13:01:18 +0000 (15:01 +0200)]
Only use path from `next` parameter

13 months agoRename `can_change_customer` to `is_authorized_for_customer`
Sem Mulder [Tue, 31 Mar 2020 12:46:29 +0000 (14:46 +0200)]
Rename `can_change_customer` to `is_authorized_for_customer`

13 months agoAddress some of the raised concerns
Sem Mulder [Tue, 31 Mar 2020 09:13:29 +0000 (11:13 +0200)]
Address some of the raised concerns

13 months agoRemove the IpAddress NewType
Sem Mulder [Tue, 31 Mar 2020 08:37:36 +0000 (10:37 +0200)]
Remove the IpAddress NewType

13 months agoAdd checkout/existing_order view
Sem Mulder [Thu, 26 Mar 2020 13:04:28 +0000 (14:04 +0100)]
Add checkout/existing_order view

13 months agoAdd new_subscription view
Sem Mulder [Thu, 26 Mar 2020 13:01:52 +0000 (14:01 +0100)]
Add new_subscription view

13 months agoAdd add_payment_method view
Sem Mulder [Thu, 26 Mar 2020 12:58:07 +0000 (13:58 +0100)]
Add add_payment_method view

13 months agoImplement checkout logic
Sem Mulder [Thu, 26 Mar 2020 13:02:47 +0000 (14:02 +0100)]
Implement checkout logic

13 months agoRemove GatewayRadioSelect since we now define the structure in the PaymentMethodForm...
Sem Mulder [Thu, 26 Mar 2020 12:35:53 +0000 (13:35 +0100)]
Remove GatewayRadioSelect since we now define the structure in the PaymentMethodForm template

13 months agoRework the forms.
Sem Mulder [Thu, 26 Mar 2020 12:24:01 +0000 (13:24 +0100)]
Rework the forms.

Move the forms for the admin to admin.py, and simplify the other
forms.

13 months agoAdd functions for dealing with Braintree tokens
Sem Mulder [Thu, 26 Mar 2020 12:16:20 +0000 (13:16 +0100)]
Add functions for dealing with Braintree tokens

13 months agoAdd a function to check ReCAPTCHAs
Sem Mulder [Thu, 26 Mar 2020 12:15:36 +0000 (13:15 +0100)]
Add a function to check ReCAPTCHAs

13 months agoPreparation for splitting up views/checkout.py
Sem Mulder [Thu, 26 Mar 2020 12:13:35 +0000 (13:13 +0100)]
Preparation for splitting up views/checkout.py

In the next few commits the views will be reimplemented in a
functional style.

13 months agoRemove support for GET from preferred_currency
Sem Mulder [Thu, 26 Mar 2020 12:03:47 +0000 (13:03 +0100)]
Remove support for GET from preferred_currency

This is not really used anymore since we do not use AJAX anymore
to get the preferred_currency, instead we just pass it as a
context variable to the template.

13 months agoRemove all settings views
Sem Mulder [Thu, 26 Mar 2020 12:00:00 +0000 (13:00 +0100)]
Remove all settings views

13 months agoUpdate urls.py with the new views
Sem Mulder [Thu, 26 Mar 2020 11:50:53 +0000 (12:50 +0100)]
Update urls.py with the new views

Note that these views do not exist yet, they will be created in the
following commits. The reason for removing all the settings pages
is that is too complicated to provide ready made views that fit
all projects (e.g. consider different menu structures, user account
handling, etc.). So the decision was made to instead make downstream
projects implement this themselves. We might provide utilities for this
(e.g. ready made Forms) at a later point in time, once we know what
is a feasible approach.

13 months agoRemove TODO about using Exceptions
Sem Mulder [Tue, 31 Mar 2020 08:30:11 +0000 (10:30 +0200)]
Remove TODO about using Exceptions

13 months agoMake can_change_customer PEP257 compliant
Sem Mulder [Tue, 31 Mar 2020 08:29:57 +0000 (10:29 +0200)]
Make can_change_customer PEP257 compliant

13 months agoRevert "Add IpAddress newtype"
Sem Mulder [Tue, 31 Mar 2020 08:21:09 +0000 (10:21 +0200)]
Revert "Add IpAddress newtype"

This reverts commit dc437d6bcb08ece297504b190b6abb7da7719055.

13 months agoAdd an active() method to the SubscriptionManager
Sem Mulder [Thu, 26 Mar 2020 11:39:58 +0000 (12:39 +0100)]
Add an active() method to the SubscriptionManager

13 months agoMinor cleanups
Sem Mulder [Thu, 26 Mar 2020 11:39:13 +0000 (12:39 +0100)]
Minor cleanups

13 months agoUse Customer instead of User
Sem Mulder [Thu, 26 Mar 2020 10:12:46 +0000 (11:12 +0100)]
Use Customer instead of User

This is needed for support of Organizations in some projects.
The Customer is now an abstract concept in Looper. It is up to
projects using Looper to connect Customers to Users or
Organizations.

13 months agoRemove Customer.billing_address_as_text and add Address.as_text instead
Sem Mulder [Thu, 26 Mar 2020 11:42:49 +0000 (12:42 +0100)]
Remove Customer.billing_address_as_text and add Address.as_text instead

13 months agoRemove the pricing template tag and make it a method instead
Sem Mulder [Thu, 26 Mar 2020 09:58:56 +0000 (10:58 +0100)]
Remove the pricing template tag and make it a method instead

13 months agoMove TODO inside function for clarity
Sem Mulder [Thu, 26 Mar 2020 09:40:45 +0000 (10:40 +0100)]
Move TODO inside function for clarity

13 months agoAdd assert_cast utility function for runtime type checking
Sem Mulder [Thu, 26 Mar 2020 13:18:25 +0000 (14:18 +0100)]
Add assert_cast utility function for runtime type checking

13 months agoAdd IpAddress newtype
Sem Mulder [Thu, 26 Mar 2020 13:17:58 +0000 (14:17 +0100)]
Add IpAddress newtype

13 months agoAddress some of the raised concerns
Sem Mulder [Tue, 31 Mar 2020 07:47:21 +0000 (09:47 +0200)]
Address some of the raised concerns

13 months agoAdd Looper developer documentation
Sem Mulder [Thu, 26 Mar 2020 09:32:16 +0000 (10:32 +0100)]
Add Looper developer documentation

13 months agoAdd Looper user documentation
Sem Mulder [Thu, 26 Mar 2020 09:32:10 +0000 (10:32 +0100)]
Add Looper user documentation

13 months agoRemove old docs
Sem Mulder [Thu, 26 Mar 2020 09:30:49 +0000 (10:30 +0100)]
Remove old docs

13 months agoAdd and bump dependencies
Sem Mulder [Thu, 26 Mar 2020 09:18:02 +0000 (10:18 +0100)]
Add and bump dependencies

13 months agoAdd manage.sh
Sem Mulder [Thu, 26 Mar 2020 09:17:38 +0000 (10:17 +0100)]
Add manage.sh

13 months agoAdd LICENSE
Sem Mulder [Thu, 26 Mar 2020 09:16:37 +0000 (10:16 +0100)]
Add LICENSE

13 months agoUpdate dependencies to latest version
Sem Mulder [Fri, 6 Mar 2020 08:30:42 +0000 (09:30 +0100)]
Update dependencies to latest version

13 months agoRemove blender_id_oauth_client dependency
Sem Mulder [Fri, 6 Mar 2020 08:19:57 +0000 (09:19 +0100)]
Remove blender_id_oauth_client dependency

13 months agoFix type issues, a lot of type issues
Sem Mulder [Thu, 5 Mar 2020 16:59:25 +0000 (17:59 +0100)]
Fix type issues, a lot of type issues

13 months agoEnable django-stubs
Sem Mulder [Thu, 5 Mar 2020 10:54:00 +0000 (11:54 +0100)]
Enable django-stubs

13 months agoMake tests pass by using empty templates
Sem Mulder [Thu, 5 Mar 2020 10:51:20 +0000 (11:51 +0100)]
Make tests pass by using empty templates

13 months agoBasic tests working
Sem Mulder [Thu, 5 Mar 2020 09:48:57 +0000 (10:48 +0100)]
Basic tests working

13 months agoReformat using Black
Sem Mulder [Thu, 5 Mar 2020 09:10:31 +0000 (10:10 +0100)]
Reformat using Black

13 months agoRemove unused dependencies
Sem Mulder [Thu, 5 Mar 2020 09:09:43 +0000 (10:09 +0100)]
Remove unused dependencies

13 months agoRemove files not related to Looper
Sem Mulder [Thu, 5 Mar 2020 08:46:52 +0000 (09:46 +0100)]
Remove files not related to Looper

13 months agoAdd .arcconfig
Sem Mulder [Thu, 26 Mar 2020 14:14:16 +0000 (15:14 +0100)]
Add .arcconfig

14 months agoFix error when user tries to pay existing order online via bank transfer gitlab/review/01_root
Sybren A. Stüvel [Mon, 24 Feb 2020 13:03:21 +0000 (14:03 +0100)]
Fix error when user tries to pay existing order online via bank transfer

Paying online via bank transfer is not possible, and this was taken into
account for new memberships but not when paying existing orders.

14 months agoReCaptcha: include reCaptcha response in the log in case of a failed check
Sybren A. Stüvel [Thu, 20 Feb 2020 09:40:17 +0000 (10:40 +0100)]
ReCaptcha: include reCaptcha response in the log in case of a failed check

14 months agoImproved reCaptcha error messages
Sybren A. Stüvel [Thu, 20 Feb 2020 09:39:55 +0000 (10:39 +0100)]
Improved reCaptcha error messages

The `Please check the "I'm not a Robot" checkbox and try again.` message
was confusing, as with the invisible reCaptcha approach we use now there
is no such checkbox.

When no reCaptcha response (or an empty one) is included in the POST
request, a message is now shown that asks users to disable script/ad
blockers, as that's my guess as to why the response is missing.

When there is a reCaptcha response but it's invalid it just explains the
check failed, and asks to try again.

15 months agoAdded reCAPTCHA v2 protection to the checkout page
Sybren A. Stüvel [Thu, 6 Feb 2020 15:13:23 +0000 (16:13 +0100)]
Added reCAPTCHA v2 protection to the checkout page

On the client side this is as unintrusive as possible, only showing
a validation popup when the reCAPTCHA API deems it necessary.

The server side validation is using a Requests session to reuse TCP/IP
connections and set up proper retrying of failing connections.

In the server's settings.py it is required to set the following keys:
  - `GOOGLE_RECAPTCHA_SECRET_KEY`
  - `GOOGLE_RECAPTCHA_SITE_KEY`

An empty `GOOGLE_RECAPTCHA_SECRET_KEY` will cause the reCAPTCHA feature to
be silently disabled.

Failures to connect to the reCAPTCHA service will result in an email sent
to the admins. Regular verification failures are just logged at WARNING
level. If this causes too much noise we can lower that level, but for now
I think it's a good idea to keep an eye on the number of verification
failures.

15 months agoUpgrade dependencies, mostly Dango 2.1 → 2.2
Sybren A. Stüvel [Thu, 6 Feb 2020 10:26:30 +0000 (11:26 +0100)]
Upgrade dependencies, mostly Dango 2.1 → 2.2

Django 2.1 is EOL, so we have to move to 2.2. This is a LTS release that's
already out of mainstream support as well, but will have extended support
until april 2022.

15 months agoChange Error 500 handler to be a regular function
Sybren A. Stüvel [Thu, 6 Feb 2020 10:25:19 +0000 (11:25 +0100)]
Change Error 500 handler to be a regular function

This is required by Django, and will actually be tested for (and cause
an error if it's not) when upgrading to Django 2.2.

15 months agoCleanup: Reformatting
Sybren A. Stüvel [Thu, 6 Feb 2020 09:37:06 +0000 (10:37 +0100)]
Cleanup: Reformatting

15 months agoMissing migration: nullability of BadgerQueuedCall.user
Sybren A. Stüvel [Thu, 6 Feb 2020 09:37:00 +0000 (10:37 +0100)]
Missing migration: nullability of BadgerQueuedCall.user

15 months agoRemoved unused code
Sybren A. Stüvel [Thu, 23 Jan 2020 16:57:23 +0000 (17:57 +0100)]
Removed unused code

15 months agoFix issue with doubly-charged subscription
Sybren A. Stüvel [Thu, 23 Jan 2020 17:21:32 +0000 (18:21 +0100)]
Fix issue with doubly-charged subscription

In the production site there was a subscription that had its order paid for,
but did NOT have its next payment date bumped. There was some retrying
involved, where PayPal first said 'PayPal Buyer Revoked Pre-Approved
Payment Authorization' but the 2nd attempt still succeeded.

I'm not entirely sure how this could have happened, but I did make the
order status change handling a bit more robust. In the new code, whenever
an order is marked as paid, it checks the subscription's next payment date.
If that is in the past, it'll bump it to "now + 1 payment interval". This
should avoid such double charges.

Note that this does NOT update the `intervals_elapsed` field of the
subscription. The clock is still the only one responsible for that.

16 months agoAdded missing dependencies to the base docker image
Sybren A. Stüvel [Thu, 2 Jan 2020 10:56:38 +0000 (11:56 +0100)]
Added missing dependencies to the base docker image

These are necessary to build the MySQL client package. Not sure what
changed apart from a re-pull of the base `ubuntu:18.04` image.

16 months agoUpdated Poetry to 1.0
Sybren A. Stüvel [Thu, 2 Jan 2020 10:47:56 +0000 (11:47 +0100)]
Updated Poetry to 1.0

This introduced a backward-incompatible change: the setting
`settings.virtualenvs.in-project` was changed to `virtualenvs.in-project`.

16 months agoFixed typo in Francesco's name
Sybren A. Stüvel [Thu, 2 Jan 2020 10:46:37 +0000 (11:46 +0100)]
Fixed typo in Francesco's name

16 months agoGracefully handle IOErrors when transacting a sale
Sybren A. Stüvel [Thu, 2 Jan 2020 10:27:59 +0000 (11:27 +0100)]
Gracefully handle IOErrors when transacting a sale

17 months agoFixed changes introduced in mypy upgrade
Sybren A. Stüvel [Wed, 13 Nov 2019 13:59:16 +0000 (14:59 +0100)]
Fixed changes introduced in mypy upgrade

When moving from Pipenv to Poetry some packages were upgraded, and mypy
caused an issue. The '# type: ignore' comment apparently needs to be on
a different line now, and success is also reported on stdout (so we
can't have the simple "output means failure" logic we had before).

17 months agoMoved from Pipenv to Poetry
Sybren A. Stüvel [Wed, 13 Nov 2019 11:21:22 +0000 (12:21 +0100)]
Moved from Pipenv to Poetry

This change includes being more specific about the versions we require.
Currently this is done with caret notation, which means we'll automatically
get new releases as long as they don't update the major version (or the
minor version in case of 0.x.y version numbers).

The only exception to the above are Django, which is pinned to 2.1.*, and
Blender ID OAuth plugin, which just requires >= 0.7.

17 months agoPrevent AttributeError when changing payment method while logged out
Sybren A. Stüvel [Wed, 13 Nov 2019 11:02:15 +0000 (12:02 +0100)]
Prevent AttributeError when changing payment method while logged out

17 months agoRemoved no-longer-used files from .gitignore
Sybren A. Stüvel [Wed, 13 Nov 2019 13:51:28 +0000 (14:51 +0100)]
Removed no-longer-used files from .gitignore

18 months agoHomepage: Start counting members at a lower number so it always goes up.
Pablo Vazquez [Wed, 6 Nov 2019 15:42:06 +0000 (16:42 +0100)]
Homepage: Start counting members at a lower number so it always goes up.

It was starting to count at 1024 and then down to match the number of
corporate members, looked a bit weird.

Thanks to @dfelinto for the suggestion.