fix
This commit is contained in:
@@ -81,7 +81,7 @@ def send_invoice(subscription):
|
|||||||
f.write('Rower '+str(r)+'\n')
|
f.write('Rower '+str(r)+'\n')
|
||||||
fakturoid_contact_id = fakturoid.get_contacts(r)
|
fakturoid_contact_id = fakturoid.get_contacts(r)
|
||||||
with open('braintreewebhooks.log','a') as f:
|
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:
|
if not fakturoid_contact_id:
|
||||||
fakturoid_contact_id = fakturoid.create_contact(r)
|
fakturoid_contact_id = fakturoid.create_contact(r)
|
||||||
transactions = subscription.transactions
|
transactions = subscription.transactions
|
||||||
|
|||||||
@@ -21,13 +21,18 @@ headers = {
|
|||||||
|
|
||||||
def get_contacts(rower):
|
def get_contacts(rower):
|
||||||
res = requests.get(contacts_url, auth=auth, headers=headers)
|
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)
|
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:
|
if res.status_code != 200:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
with open('braintreewebhooks.log','a') as f:
|
||||||
|
f.write('Status Code '+json.dumps(res.json())+'\n')
|
||||||
|
|
||||||
if len(res.json())>=1:
|
if len(res.json())>=1:
|
||||||
r = res.json()[0]
|
r = res.json()[0]
|
||||||
return r['id']
|
return r['id']
|
||||||
|
|||||||
Reference in New Issue
Block a user