logging for braintree
This commit is contained in:
@@ -67,6 +67,8 @@ def create_contact(rower):
|
||||
def create_invoice(rower,amount,braintreeid,dosend=True):
|
||||
|
||||
r_id = get_contacts(rower)
|
||||
with open('braintreewebhooks.log','a') as f:
|
||||
f.write('Creating invoice for contact iD '+str(r_id)+'\n')
|
||||
|
||||
if not r_id:
|
||||
return 0
|
||||
@@ -90,6 +92,8 @@ def create_invoice(rower,amount,braintreeid,dosend=True):
|
||||
|
||||
|
||||
res = requests.post(invoices_url, data=json.dumps(post_data), auth=auth,headers=headers)
|
||||
with open('braintreewebhooks.log','a') as f:
|
||||
f.write('Invoice Created - status code '+str(res.status_code)+'\n')
|
||||
|
||||
if res.status_code not in [200,201]:
|
||||
return 0
|
||||
@@ -107,12 +111,18 @@ def create_invoice(rower,amount,braintreeid,dosend=True):
|
||||
|
||||
res = requests.post(urlpay,auth=auth,headers=headers)
|
||||
|
||||
with open('braintreewebhooks.log','a') as f:
|
||||
f.write('Invoice Set to paid - status code '+str(res.status_code)+'\n')
|
||||
|
||||
if res.status_code not in [200,201]:
|
||||
return 0
|
||||
|
||||
if dosend:
|
||||
res = requests.post(urlsend,auth=auth,headers=headers)
|
||||
|
||||
with open('braintreewebhooks.log','a') as f:
|
||||
f.write('Invoice Sent - status code '+str(res.status_code)+'\n')
|
||||
|
||||
return id
|
||||
|
||||
#curl -u vas@email.cz:API_TOKEN -H 'User-Agent: YourApp (yourname@example.com)' \
|
||||
|
||||
Reference in New Issue
Block a user