-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewinvoice.py
More file actions
executable file
·57 lines (33 loc) · 969 Bytes
/
newinvoice.py
File metadata and controls
executable file
·57 lines (33 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
import requests
import json
import sys
import hackerspace_utils as hu
authbag = hu.get_auth_bag()
Token = authbag['token'];
url = "https://sandbox-quickbooks.api.intuit.com/v3/company/123146047051614/invoice"
querystring = {"minorversion":"14"}
invoiceItem = {
"value": 21,
"name" : "Services",
}
InvoiceLine = {
"Amount" : 200.00,
"DetailType" : "SalesItemLineDetail",
"SalesItemLineDetail": { "ItemRef": invoiceItem }
}
invoice = { "CustomerRef": { "value": 66},
"Line" : [
InvoiceLine
]
}
payload = json.dumps(invoice,indent=4,sort_keys=True)
print(payload)
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer "+Token,
'Cache-Control': "no-cache",
}
response = requests.request("POST", url, data=payload, headers=headers, params=querystring)
print(response.text)