logging braintree
This commit is contained in:
@@ -19,6 +19,7 @@ from rowers.utils import myqueue
|
||||
import rowers.fakturoid as fakturoid
|
||||
from braintree.exceptions.invalid_signature_error import InvalidSignatureError
|
||||
import time
|
||||
import sys, traceback
|
||||
|
||||
import braintree
|
||||
from django.utils import timezone
|
||||
@@ -236,6 +237,7 @@ def update_subscription(rower, data, method='up'):
|
||||
info = nonce.three_d_secure_info
|
||||
if nonce.type.lower() == 'creditcard': # pragma: no cover
|
||||
if info is None or not info.liability_shifted:
|
||||
dologging('braintree.log','Nonce info {info}'.format(info=info))
|
||||
return False, 0
|
||||
amount = data['amount']
|
||||
amount = '{amount:.2f}'.format(amount=amount)
|
||||
@@ -259,7 +261,14 @@ def update_subscription(rower, data, method='up'):
|
||||
rower.subscription_id,
|
||||
gatewaydata
|
||||
)
|
||||
except: # pragma: no cover
|
||||
except BaseException as e: # pragma: no cover
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||
dologging('braintree.log','Payment failed with error')
|
||||
dologging('braintree.log','{t}, {v}'.format(t=exc_type,v=exc_value))
|
||||
trace_back = traceback.extract_tb(exc_traceback)
|
||||
for trace in trace_back:
|
||||
dologging('braintree.log','{t}'.format(t=trace))
|
||||
|
||||
return False, 0
|
||||
|
||||
if result.is_success:
|
||||
@@ -329,6 +338,8 @@ def update_subscription(rower, data, method='up'):
|
||||
if create_new:
|
||||
return create_subscription(rower, data)
|
||||
|
||||
dologging('braintree.log','Unrecognized proceed code {c}'.format(c=codes))
|
||||
|
||||
return False, 0
|
||||
|
||||
return False, 0 # pragma: no cover
|
||||
@@ -342,6 +353,7 @@ def create_subscription(rower, data):
|
||||
|
||||
if nonce.type != 'PayPalAccount': # pragma: no cover
|
||||
if info is None or not info.liability_shifted:
|
||||
dologging('braintree.log','Create Subscription. Nonce info {info}'.format(info=info))
|
||||
return False, 0
|
||||
# amount = data['amount']
|
||||
|
||||
@@ -357,6 +369,7 @@ def create_subscription(rower, data):
|
||||
if result.is_success:
|
||||
payment_method_token = result.payment_method.token
|
||||
else: # pragma: no cover
|
||||
dologging('braintree.log','Payment failed {result}'.format(result=result))
|
||||
return False, 0
|
||||
|
||||
result = gateway.subscription.create({
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user