forked from mondalaci/dhl-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequestPickup.js
More file actions
executable file
·77 lines (75 loc) · 2.36 KB
/
requestPickup.js
File metadata and controls
executable file
·77 lines (75 loc) · 2.36 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
#!/usr/bin/env node
const fs = require('fs');
const format = require('xml-formatter');
const auth = require('./auth');
const dhl = require('./index');
const req = {
PickUpShipment: {
ShipmentInfo: {
ServiceType: 'U',
Billing: {
ShipperAccountNumber: auth.accountNumber,
ShippingPaymentType: 'S',
},
UnitOfMeasurement: 'SI',
},
PickupTimestamp: dhl.getIsoDateTime(),
InternationalDetail: {
Commodities: {
Description: 'Computer Parts',
},
},
Ship: {
Shipper: {
Contact: {
PersonName: 'Topaz',
CompanyName: 'DHL Express',
PhoneNumber: '+31 6 53464291',
EmailAddress: 'Topaz.Test@dhl.com',
MobilePhoneNumber: '+31 6 53464291',
},
Address: {
StreetLines: 'GloWS',
City: 'Eindhoven',
PostalCode: '5657 ES',
CountryCode: 'NL',
},
},
Recipient: {
Contact: {
PersonName: 'Jack Jones',
CompanyName: 'J and J Company',
PhoneNumber: '+44 25 77884444',
EmailAddress: 'jack@jjcompany.com',
MobilePhoneNumber: '+44 5 88648666',
},
Address: {
StreetLines: 'Penny lane',
City: 'Liverpool',
PostalCode: 'AA21 9AA',
CountryCode: 'GB',
},
},
},
Packages: {
RequestedPackages: {
attributes: {
number: 1,
},
Weight: 12.0,
Dimensions: {
Length: 70,
Width: 21,
Height: 44,
},
CustomerReferences: 'My-PU-Call-1',
},
},
},
};
(async function() {
const res = await dhl.testRequestPickup(auth, req);
console.log(JSON.stringify(res.response, null, 4));
fs.writeFileSync('requestPickup.request.xml', format(res.requestXml));
fs.writeFileSync('requestPickup.response.xml', res.responseXml);
})();