diff --git a/rowers/braintreestuff.py b/rowers/braintreestuff.py index 6fde6606..e524bcf3 100644 --- a/rowers/braintreestuff.py +++ b/rowers/braintreestuff.py @@ -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 diff --git a/rowers/fakturoid.py b/rowers/fakturoid.py index 2fba2b31..4b2f6bdd 100644 --- a/rowers/fakturoid.py +++ b/rowers/fakturoid.py @@ -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']