passing tests
This commit is contained in:
@@ -77,7 +77,6 @@ def get_contacts(rower):
|
||||
if res.status_code != 200: # pragma: no cover
|
||||
return None
|
||||
|
||||
|
||||
data = res.json()['Data']['Items']
|
||||
|
||||
if len(data) >= 1:
|
||||
@@ -141,7 +140,7 @@ def create_invoice(rower, amount, braintreeid, dosend=True, contact_id=None, nam
|
||||
|
||||
token = idoklad_token()
|
||||
if token is None:
|
||||
return None
|
||||
return 0
|
||||
|
||||
dologging('idoklad.log','Creating idoklad invoice for '+str(rower.user.email)+'\n')
|
||||
|
||||
@@ -177,26 +176,29 @@ def create_invoice(rower, amount, braintreeid, dosend=True, contact_id=None, nam
|
||||
id = res.json()['Data']['Id']
|
||||
|
||||
if dosend:
|
||||
url = invoice_url+'/'+str(id)+'/Send'
|
||||
print(url)
|
||||
data = {
|
||||
'AttachmentIds': [id],
|
||||
'DocumentId': braintreeid,
|
||||
'AttachmentIds': [],
|
||||
'DocumentId': id,
|
||||
'EmailBody': 'Dear customer, we are sending you the invoice for your subscription. Please do not hesitate to contact us if you have any questions. Best regards, Rowsandall Team',
|
||||
'EmailSubject': 'Rowsandall Subscription Invoice',
|
||||
'Method': 1,
|
||||
'ReportLanguage': 3,
|
||||
'SendToSelf': True,
|
||||
'SendToSelf': True,
|
||||
'SendToPartner': True,
|
||||
'SendToAccountant': False,
|
||||
}
|
||||
|
||||
print(data)
|
||||
print(email_url)
|
||||
headers = {
|
||||
'Authorization': 'Bearer {access_token}'.format(access_token=token.access_token),
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
|
||||
res = requests.post(email_url, json=data, headers=headers)
|
||||
|
||||
dologging('idoklad.log','Invoice Sent - status code '+str(res.status_code)+'\n')
|
||||
if res.status_code not in [200, 201]:
|
||||
dologging('idoklad.log','Invoice Sent - reason '+str(res.reason)+'\n')
|
||||
dologging('idoklad.log','Invoice Sent - reason '+str(res.text)+'\n')
|
||||
|
||||
return id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user