Private
Public Access
1
0

Merge branch 'release/v10.10'

This commit is contained in:
Sander Roosendaal
2019-08-10 14:40:18 +02:00
9 changed files with 24 additions and 6 deletions

View File

@@ -26,7 +26,7 @@ import pandas as pd
from rowsandall_app.settings import (
BRAINTREE_MERCHANT_ID,BRAINTREE_PUBLIC_KEY,BRAINTREE_PRIVATE_KEY,
BRAINTREE_SANDBOX_MERCHANT_ID,BRAINTREE_SANDBOX_PUBLIC_KEY,
BRAINTREE_SANDBOX_PRIVATE_KEY
BRAINTREE_SANDBOX_PRIVATE_KEY, BRAINTREE_MERCHANT_ACCOUNT_ID
)
if settings.DEBUG or 'dev' in settings.SITE_URL:
@@ -240,8 +240,11 @@ def create_subscription(rower,data):
nonce_from_the_client = data['payment_method_nonce']
nonce = gateway.payment_method_nonce.find(nonce_from_the_client)
info = nonce.three_d_secure_info
if info is None or not info.liability_shifted:
return False,0
paymenttype = nonce.type
if nonce.type != 'PayPalAccount':
if info is None or not info.liability_shifted:
return False,0
amount = data['amount']
planid = data['plan']
@@ -261,7 +264,8 @@ def create_subscription(rower,data):
result = gateway.subscription.create({
"payment_method_token": payment_method_token,
"plan_id": plan.external_id
"plan_id": plan.external_id,
# "merchant_account_id": BRAINTREE_MERCHANT_ACCOUNT_ID,
})

View File

@@ -57,6 +57,7 @@ class BillingForm(forms.Form):
max_digits=8)
plan = forms.IntegerField(widget=forms.HiddenInput())
payment_method_nonce = forms.CharField(max_length=255,required=True)
paymenttype = forms.CharField(max_length=255,required=True)
tac= forms.BooleanField(required=True,initial=False)

View File

@@ -33,7 +33,8 @@
return;
}
if (payload.liabilityShifted || payload.type !== 'CreditCard') {
document.querySelector('#nonce').value = payload.nonce;
document.querySelector('#nonce').value = payload.nonce;
document.querySelector('#paymenttype').value = payload.type;
hiddenNonceInput.value = payload.nonce;
form.submit();
} else {

View File

@@ -97,6 +97,7 @@
</section>
<input type="hidden" id="nonce" name="payment_method_nonce" />
<input type="hidden" id="paymenttype" name="paymenttype" />
<input type="hidden" id="plan" name="plan" value="{{ plan.id }}">
<p>
<input id="tac" type="checkbox" name="tac" value="tac">I have taken note of the

View File

@@ -95,6 +95,7 @@
</section>
<div id="paymenterror2"> </div>
<input type="hidden" id="nonce" name="payment_method_nonce" />
<input type="hidden" id="paymenttype" name="paymenttype" />
<input type="hidden" id="plan" name="plan" value="{{ plan.id }}">
<p>
<input id="tac" type="checkbox" name="tac" value="tac">I have taken note of the

View File

@@ -372,6 +372,7 @@ class PaymentTest(TestCase):
'plan': plans[1].id,
'payment_method_nonce': 'aap',
'tac':'tac',
'paymenttype': 'CreditCard'
}
form = BillingForm(form_data)
@@ -416,6 +417,7 @@ class PaymentTest(TestCase):
'amount':'15.00',
'plan': plans[1].id,
'payment_method_nonce': 'aap',
'paymenttype': 'CreditCard',
'tac':'tac',
}
@@ -460,6 +462,7 @@ class PaymentTest(TestCase):
'amount':'15.00',
'plan': plans[1].id,
'payment_method_nonce': 'aap',
'paymenttype': 'CreditCard',
'tac':'tac',
}
@@ -504,6 +507,7 @@ class PaymentTest(TestCase):
'amount':'15.00',
'plan': plans[1].id,
'payment_method_nonce': 'aap',
'paymenttype': 'CreditCard',
'tac':True,
}
@@ -553,6 +557,7 @@ class PaymentTest(TestCase):
'amount':'15.00',
'plan': plans[1].id,
'payment_method_nonce': 'aap',
'paymenttype': 'CreditCard',
'tac':True,
}
@@ -597,6 +602,7 @@ class PaymentTest(TestCase):
'amount':'15.00',
'plan': plans[1].id,
'payment_method_nonce': 'aap',
'paymenttype': 'CreditCard',
'tac':True,
}

Binary file not shown.

View File

@@ -390,7 +390,6 @@ def upgrade_checkouts_view(request):
url = reverse('billing_view')
return HttpResponseRedirect(url)
else:
print('noot',form)
messages.error(request,"There was an error in the payment form")
url = reverse(upgrade_view)
return HttpResponseRedirect(url)

View File

@@ -447,6 +447,11 @@ try:
except KeyError:
BRAINTREE_MERCHANT_ID = ''
try:
BRAINTREE_MERCHANT_ACCOUNT_ID = CFG['braintree_merchant_account_id']
except KeyError:
BRAINTREE_MERCHANT_ACCOUNT_ID = 'rowsandallEUR'
try:
BRAINTREE_PUBLIC_KEY = CFG['braintree_public_key']
except KeyError: