-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
38 lines (30 loc) · 985 Bytes
/
main.py
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
import dkplus
import logging
from requests.auth import HTTPBasicAuth
# Change from logging.INFO to logging.DEBUG
# to get more information.
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(message)s',
handlers=[logging.FileHandler("logg.log"),
logging.StreamHandler()])
auth = HTTPBasicAuth('[email protected]', 'Demo123')
cust = dkplus.Customer(auth)
if (cust.loadCustomer("1710794709")):
paym = dkplus.Payments(auth)
if (paym.getpayment(8)):
prodlist = []
prodlist.append(
dkplus.Product(auth, "0001", 2, 2323)
)
prodlist.append(
dkplus.Product(auth, "29874443", 1, 1500)
)
inv = dkplus.Invoice(auth, cust, paym)
if inv.createInvoice(prodlist, True):
logging.info("Invoice no. "+inv.getInvoiceNo()+" created.")
else:
logging.info(inv.getMessage())
else:
logging.info(paym.getMessage())
else:
logging.info(cust.getMessage())