-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_detailed_order.py
61 lines (53 loc) · 1.71 KB
/
create_detailed_order.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from paynova_api_python_client import Paynova, PaynovaException
import logging
logging.basicConfig(level='DEBUG')
# test client
client = Paynova('<MERCHANT ID>', '<API Password>')
try:
# create order
# For more information about parameters, see http://docs.paynova.com/display/API/Create+Order
response = client.create_order({
'orderNumber': 'order-id-0001',
'currencyCode': 'EUR',
'totalAmount': 10,
'orderDescription': 'This is a test order',
'salesChannel': 'My channel',
'salesLocationId': 'Test Shop',
'customer': {
'customerId': '0001',
'emailAddress': '[email protected]',
'name': {
'companyName': None,
'title': 'Mr.',
'firstName': 'John',
'middleNames': None,
'lastName': 'Snow',
'suffix': 'Sr.'
},
'homeTelephone': '+1234567890',
'workTelephone': None,
'mobileTelephone': None,
},
'billTo': None,
'shipTo': None,
'lineItems': [
{
'id': '0001',
'articleNumber': 'item-0001',
'name': 'Product',
'description': 'Our test product',
'quantity': 1,
'unitMeasure': 'meters',
'unitAmountExcludingTax': 10,
'taxPercent': 0,
'totalLineTaxAmount': 0,
'totalLineAmount': 10
}
]
})
# get order id from response
orderId = response.get('orderId')
except PaynovaException as e:
# process exception
# e.errorNumber, e.statusKey, e.statusMessage, e.errors
pass