Private
Public Access
1
0

adding braintree info

This commit is contained in:
Sander Roosendaal
2018-12-21 15:04:35 +01:00
parent d4898701c9
commit 3286630931
8 changed files with 71 additions and 2 deletions

View File

@@ -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' }

View File

@@ -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

View File

@@ -5,6 +5,15 @@
<h1>Downgrade</h1>
<p>
Transactions will be procesed by Braintree (A PayPal service):
</p>
<p>
<a href="https://www.braintreegateway.com/merchants/{{ BRAINTREE_MERCHANT_ID }}/verified" target="_blank">
<img src="https://s3.amazonaws.com/braintree-badges/braintree-badge-light.png" width="164px" height ="44px" border="0"/>
</a>
</p>
<form action="" method="post">
<ul class="main-content">
<li class="grid_3">

View File

@@ -7,6 +7,15 @@
<h2>Order Overview</h2>
<p>
Payments will be procesed by Braintree (A PayPal service):
</p>
<p>
<a href="https://www.braintreegateway.com/merchants/{{ BRAINTREE_MERCHANT_ID }}/verified" target="_blank">
<img src="https://s3.amazonaws.com/braintree-badges/braintree-badge-light.png" width="164px" height ="44px" border="0"/>
</a>
</p>
<ul class="main-content">
<li class="grid_2">
<p>

View File

@@ -202,6 +202,15 @@
You agree to such cross-border transfers of personal information.
</p>
<h3>Payment Information</h3>
<p>
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.
</p>
<h3>Team Functionality</h3>
<p>

View File

@@ -7,6 +7,15 @@
<h2>Order Overview</h2>
<p>
Payments will be procesed by Braintree (A PayPal service):
</p>
<p>
<a href="https://www.braintreegateway.com/merchants/{{ BRAINTREE_MERCHANT_ID }}/verified" target="_blank">
<img src="https://s3.amazonaws.com/braintree-badges/braintree-badge-light.png" width="164px" height ="44px" border="0"/>
</a>
</p>
<ul class="main-content">
<li class="grid_2">
<p>

View File

@@ -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)

View File

@@ -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',