-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexamples.py
More file actions
97 lines (88 loc) · 2.63 KB
/
examples.py
File metadata and controls
97 lines (88 loc) · 2.63 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
""" Newgistics Fulfillments API """
from newgistics import NewgisticsFulfillment
ngf_client = NewgisticsFulfillment(api_key="", staging=False)
# Create Shipment
request_payload = {
"Orders": {
"Order": {
"AllowDuplicate": False,
"CustomerInfo": {
"Address1": "32142 Waverton Lane",
"Address2": None,
"City": "Huntersville",
"Company": None,
"Country": "US",
"Email": "yestestmail@gmail.com",
"FirstName": "John",
"IsResidential": "true",
"LastName": "Barron",
"Phone": None,
"State": "NC",
"Zip": "28078",
},
"HoldForAllInventory": False,
"Items": {"Item": [{"Qty": 10, "SKU": "HLU"}]},
"OrderDate": "04-12-2019",
"RequiresSignature": False,
"id": "4321",
}
}
}
resp = ngf_client.shipments.create(payload=request_payload)
resp.json()
# Fetch Shipment
resp = ngf_client.shipments.fetch(params={"id": "4231"})
resp.json()
# Create Inbound Return
inbound_returns_payload = {
"Returns": {
"Return": {
"id": "SHIPMENTID",
"RMA": "1234",
"Comments": "COMMENTS",
"Items": {"Item": [{"SKU": "HLU", "Qty": 10, "Reason": "Some_Reason"}]},
}
}
}
resp = ngf_client.inbound_returns.create(payload=inbound_returns_payload)
resp.json()
# Fetch Inbound Return
resp = ngf_client.inbound_returns.fetch(
params={"startCreatedTimestamp": "", "endCreatedTimestamp": ""}
)
resp.json()
# Fetch Return
resp = ngf_client.returns.fetch(params={"Id": "1234"})
resp.json()
""" Newgistics Web API """
from newgistics import NewgisticsWeb
ngw_client = NewgisticsWeb(api_key="", staging=False)
label_payload = {
"clientServiceFlag": "Standard",
"consumer": {
"Address": {
"Address1": "2700 Via Fortuna Drive",
"Address2": "",
"Address3": "",
"City": "Austin",
"CountryCode": "US",
"State": "TX",
"Zip": "78746",
},
"DaytimePhoneNumber": "5122256000",
"EveningPhoneNumber": "",
"FaxNumber": "",
"FirstName": "testname",
"Honorific": "",
"LastName": "tester",
"MiddleInitial": "",
"PrimaryEmailAddress": "croosken@newgistics.com",
},
"deliveryMethod": "SelfService",
"dispositionRuleSetId": 99,
"labelCount": 1,
"merchantID": "NGST",
"returnId": "123456789A",
}
resp = ngw_client.labels.create(payload=label_payload)
resp.json()