-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateDeliveryAtWorkShipment.ts
More file actions
157 lines (156 loc) · 6.41 KB
/
Copy pathcreateDeliveryAtWorkShipment.ts
File metadata and controls
157 lines (156 loc) · 6.41 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import {
DEFAULT_DATA_TYPES_FOR_SERVICES,
DEFAULT_PARAMETERS_FOR_SERVICES,
DEFAULT_SIGNATURE_FOR_SERVICES, postShipmentHelper
} from "../../helpers";
import {ActionSdk, HerculesFunctionContext} from "@code0-tech/hercules";
import {ShipmentWithoutServices} from "../../types/glsShipment";
import {PrintingOptions} from "../../types/glsPrintingOptions";
import {CustomContent} from "../../types/glsCustomContent";
import {ReturnOptions} from "../../types/glsReturnOptions";
import {CreateParcelsResponse} from "../../types/glsCreateParcelsResponse";
export default (sdk: ActionSdk) => {
return sdk.registerFunctionDefinitions(
{
definition: {
runtimeName: "createDeliveryAtWorkShipment",
documentation: [
{
code: "en-US",
content: "Delivers a parcel to a specific location within a workplace (building, floor, room)."
}
],
displayMessage: [
{
code: "en-US",
content: "Create delivery at work shipment"
}
],
name: [
{
code: "en-US",
content: "Create delivery at work shipment",
}
],
description: [
{
code: "en-US",
content: "Delivers a parcel to a specific location within a workplace (building, floor, room).",
}
],
signature: `(recipientName: string, building: string, floor: number, ${DEFAULT_SIGNATURE_FOR_SERVICES}, alternateRecipientName?: string, room?: number, phonenumber?: string): GLS_CREATE_PARCELS_RESPONSE`,
parameters: [
{
runtimeName: "recipientName",
name: [
{
code: "en-US",
content: "Recipient name",
}
],
description: [
{
code: "en-US",
content: "The recipient name for the delivery at work shipment.",
}
]
},
{
runtimeName: "building",
name: [
{
code: "en-US",
content: "Building",
}
],
description: [
{
code: "en-US",
content: "The building of the delivery at work shipment.",
}
]
},
{
runtimeName: "floor",
name: [
{
code: "en-US",
content: "Floor",
}
],
description: [
{
code: "en-US",
content: "The floor of the delivery at work shipment.",
}
]
},
...DEFAULT_PARAMETERS_FOR_SERVICES,
{
runtimeName: "alternateRecipientName",
name: [
{
code: "en-US",
content: "Alternate recipient name",
}
],
description: [
{
code: "en-US",
content: "The alternate recipient name for the delivery at work shipment.",
}
]
},
{
runtimeName: "room",
name: [
{
code: "en-US",
content: "Room",
}
],
description: [
{
code: "en-US",
content: "The room of the delivery at work shipment.",
}
]
},
{
runtimeName: "phonenumber",
name: [
{
code: "en-US",
content: "Phone number",
}
],
description: [
{
code: "en-US",
content: "The phone number for the delivery at work shipment.",
}
]
}
],
linkedDataTypes: [
...DEFAULT_DATA_TYPES_FOR_SERVICES,
]
},
handler: async (context: HerculesFunctionContext,
recipientName: string, building: string, floor: number,
shipment: ShipmentWithoutServices, printingOptions: PrintingOptions, customContent?: CustomContent, returnOptions?: ReturnOptions,
alternateRecipientName?: string, room?: number, phonenumber?: string): Promise<CreateParcelsResponse> => {
return postShipmentHelper(context, [{
DeliveryAtWork: {
RecipientName: recipientName,
Building: building,
Floor: floor,
AlternateRecipientName: alternateRecipientName,
Room: room,
Phonenumber: phonenumber,
}
}], shipment, printingOptions, customContent, returnOptions)
}
},
)
}