From d4898701c9962d6e8c26134d75d13179acf74943 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 21 Dec 2018 13:58:58 +0100 Subject: [PATCH 1/3] time based indoor races on edit page --- rowers/plannedsessions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py index 93ba5c37..7b63360d 100644 --- a/rowers/plannedsessions.py +++ b/rowers/plannedsessions.py @@ -46,7 +46,7 @@ def get_indoorraces(workout): sessionvalue=workout.distance) - if workout.duration.second != 0 and workout.duration.microsecond != 0: + if workout.duration.second == 0 and workout.duration.microsecond == 0: duration = 60*workout.duration.hour+workout.duration.minute From 328663093100139c21bb2d01a4aaf83177ecad34 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 21 Dec 2018 15:04:35 +0100 Subject: [PATCH 2/3] adding braintree info --- rowers/context_processors.py | 6 ++++++ rowers/payments.py | 5 ++++- rowers/templates/downgrade.html | 9 +++++++++ rowers/templates/paymentconfirm.html | 9 +++++++++ rowers/templates/privacypolicy.html | 9 +++++++++ rowers/templates/upgradeconfirm.html | 9 +++++++++ rowers/views.py | 25 ++++++++++++++++++++++++- rowsandall_app/settings.py | 1 + 8 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 rowers/context_processors.py diff --git a/rowers/context_processors.py b/rowers/context_processors.py new file mode 100644 index 00000000..9aa44d1d --- /dev/null +++ b/rowers/context_processors.py @@ -0,0 +1,6 @@ +from django.conf import settings # import the settings file + +def braintree_merchant(request): + # return the value you want as a dictionnary. you may add multiple values in there. + # return {'BRAINTREE_MERCHANT_ID': settings.BRAINTREE_MERCHANT_ID} + return {'BRAINTREE_MERCHANT_ID': 'jytq7yxsm66qqdzb' } diff --git a/rowers/payments.py b/rowers/payments.py index 7e71aad5..503d6f4b 100644 --- a/rowers/payments.py +++ b/rowers/payments.py @@ -34,7 +34,10 @@ def setrowerplans(): def is_existing_customer(rower): if rower.country is not None and rower.customer_id is not None and rower.country != '': - return True + if rower.subscription_id is None or rower.subscription_id == '': + return False + else: + return True return False diff --git a/rowers/templates/downgrade.html b/rowers/templates/downgrade.html index 091b0dfe..bf2e7bc7 100644 --- a/rowers/templates/downgrade.html +++ b/rowers/templates/downgrade.html @@ -5,6 +5,15 @@

Downgrade

+

+ Transactions will be procesed by Braintree (A PayPal service): +

+

+ + + +

+
  • diff --git a/rowers/templates/paymentconfirm.html b/rowers/templates/paymentconfirm.html index f9748ccf..10fba5ad 100644 --- a/rowers/templates/paymentconfirm.html +++ b/rowers/templates/paymentconfirm.html @@ -7,6 +7,15 @@

    Order Overview

    +

    + Payments will be procesed by Braintree (A PayPal service): +

    +

    + + + +

    +
    • diff --git a/rowers/templates/privacypolicy.html b/rowers/templates/privacypolicy.html index 34f72020..087f52c3 100644 --- a/rowers/templates/privacypolicy.html +++ b/rowers/templates/privacypolicy.html @@ -202,6 +202,15 @@ You agree to such cross-border transfers of personal information.

      +

      Payment Information

      + +

      + We user PayPal and Braintree (a PayPal service) to process payments. + Your payment information, such as credit card information, is not + stored on our servers, but is stored in a secure vault at our payment + processors PayPal and Braintree. +

      +

      Team Functionality

      diff --git a/rowers/templates/upgradeconfirm.html b/rowers/templates/upgradeconfirm.html index 6d88470b..0776fccf 100644 --- a/rowers/templates/upgradeconfirm.html +++ b/rowers/templates/upgradeconfirm.html @@ -7,6 +7,15 @@

      Order Overview

      +

      + Payments will be procesed by Braintree (A PayPal service): +

      +

      + + + +

      +
      • diff --git a/rowers/views.py b/rowers/views.py index 73e3dad9..a60d9df7 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -1063,6 +1063,8 @@ def add_defaultfavorites(r): def paidplans_view(request): if not request.user.is_anonymous(): r = getrequestrower(request) + if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': + messages.error(request,'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed') else: r = None @@ -1080,6 +1082,9 @@ def billing_view(request): r = getrequestrower(request) + if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': + messages.error(request,'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed') + if payments.is_existing_customer(r): url = reverse(upgrade_view) return HttpResponseRedirect(url) @@ -1127,6 +1132,9 @@ def upgrade_view(request): r = getrequestrower(request) + if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': + messages.error(request,'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed') + if r.subscription_id is None or r.subscription_id == '': url = reverse(billing_view) return HttpResponseRedirect(url) @@ -1169,6 +1177,9 @@ def downgrade_view(request): r = getrequestrower(request) + if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': + messages.error(request,'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed') + if r.subscription_id is None or r.subscription_id == '': url = reverse(billing_view) return HttpResponseRedirect(url) @@ -1223,6 +1234,9 @@ def plan_stop_view(request): subscriptions = [] + if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': + messages.error(request,'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed') + if r.paidplan is not None and r.paidplan.paymentprocessor == 'braintree': try: subscriptions = braintreestuff.find_subscriptions(r) @@ -1275,6 +1289,9 @@ def upgrade_confirm_view(request,planid = 0): r = getrequestrower(request) + if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': + messages.error(request,'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed') + client_token = braintreestuff.get_client_token(r) return render(request, @@ -1326,6 +1343,9 @@ def payment_confirm_view(request,planid = 0): r = getrequestrower(request) + if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': + messages.error(request,'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed') + client_token = braintreestuff.get_client_token(r) return render(request, @@ -1342,10 +1362,13 @@ def checkouts_view(request): if not PAYMENT_PROCESSING_ON: url = reverse('promembership') return HttpResponseRedirect(url) - + r = getrequestrower(request) + if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': + messages.error(request,'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed') + if request.method != 'POST': url = reverse(paidplans_view) return HttpResponseRedirect(url) diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index b96c3f66..63f81dac 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -125,6 +125,7 @@ TEMPLATES = [ 'django.template.context_processors.i18n', # 'context_processors.google_analytics', 'context_processors.warning_message', + 'rowers.context_processors.braintree_merchant', ], # 'loaders': [ # 'django.template.loaders.app_directories.Loader', From a9b315e8bfee929289276292f08dfcbc9297093f Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 21 Dec 2018 15:17:12 +0100 Subject: [PATCH 3/3] typos corrected in notification emails --- rowers/templates/subscription_create_notification.html | 2 +- rowers/templates/subscription_downgrade_notification.html | 2 +- rowers/templates/subscription_update_notification.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rowers/templates/subscription_create_notification.html b/rowers/templates/subscription_create_notification.html index 37a8c8eb..89c0ebf1 100644 --- a/rowers/templates/subscription_create_notification.html +++ b/rowers/templates/subscription_create_notification.html @@ -10,7 +10,7 @@ {% if recurring %}

        The subscription cost is €{{ price }} per year. - The next charge is due on {{ end_of_billing_period }}. on that date. + The next charge is due on {{ end_of_billing_period }}.

        {% else %}

        diff --git a/rowers/templates/subscription_downgrade_notification.html b/rowers/templates/subscription_downgrade_notification.html index dce13caf..6fb0589d 100644 --- a/rowers/templates/subscription_downgrade_notification.html +++ b/rowers/templates/subscription_downgrade_notification.html @@ -10,7 +10,7 @@ {% if recurring %}

        The subscription cost is €{{ price }} per year. - The next charge is due on {{ end_of_billing_period }}. on that date. + The next charge is due on {{ end_of_billing_period }}.

        {% else %}

        diff --git a/rowers/templates/subscription_update_notification.html b/rowers/templates/subscription_update_notification.html index 1df49f73..ce72fe97 100644 --- a/rowers/templates/subscription_update_notification.html +++ b/rowers/templates/subscription_update_notification.html @@ -10,7 +10,7 @@ {% if recurring %}

        The subscription cost is €{{ price }} per year. - The next charge is due on {{ end_of_billing_period }}. on that date. + The next charge is due on {{ end_of_billing_period }}.

        {% else %}