Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2021-02-03 18:18:42 +01:00
parent 5d251be783
commit 9aaa22b423
2 changed files with 7 additions and 2 deletions

View File

@@ -81,7 +81,7 @@ def send_invoice(subscription):
f.write('Rower '+str(r)+'\n')
fakturoid_contact_id = fakturoid.get_contacts(r)
with open('braintreewebhooks.log','a') as f:
f.write('Fakturoid ID '+str(fakturoid_contact_id)+'\n')
f.write('Fakturoid Contact ID '+str(fakturoid_contact_id)+'\n')
if not fakturoid_contact_id:
fakturoid_contact_id = fakturoid.create_contact(r)
transactions = subscription.transactions

View File

@@ -21,13 +21,18 @@ headers = {
def get_contacts(rower):
res = requests.get(contacts_url, auth=auth, headers=headers)
url = contacts_search_url+'?query='+rower.user.email
url = contacts_search_url+'?query='+str(rower.user.email)
res = requests.get(url, auth=auth, headers=headers)
with open('braintreewebhooks.log','a') as f:
f.write('Searching Contact Status code'+str(res.status_code)+'\n')
if res.status_code != 200:
return None
with open('braintreewebhooks.log','a') as f:
f.write('Status Code '+json.dumps(res.json())+'\n')
if len(res.json())>=1:
r = res.json()[0]
return r['id']