-
Notifications
You must be signed in to change notification settings - Fork 5
/
requestPickup.js
executable file
·75 lines (73 loc) · 2.34 KB
/
requestPickup.js
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
#!/usr/bin/env node
import fs from 'node:fs';
import format from 'xml-formatter';
import auth from './auth.js';
import {getIsoDateTime, testRequestPickup} from './index.js';
const req = {
PickUpShipment: {
ShipmentInfo: {
ServiceType: 'U',
Billing: {
ShipperAccountNumber: auth.accountNumber,
ShippingPaymentType: 'S',
},
UnitOfMeasurement: 'SI',
},
PickupTimestamp: 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',
},
},
},
};
const res = await 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);