btrz-api-client 9.17.0 → 9.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client-standalone-min.js +2 -2
- package/lib/endpoints/inventory/vehicles.js +53 -6
- package/lib/endpoints/notifications/notify.js +45 -1
- package/package.json +1 -1
- package/src/endpoints/inventory/vehicles.js +53 -6
- package/src/endpoints/notifications/notify.js +35 -1
- package/test/endpoints/notifications/notify.test.js +34 -0
- package/types/endpoints/notifications/notify.d.ts +8 -1
|
@@ -22,6 +22,53 @@ const {
|
|
|
22
22
|
* @property {string} [providerIds] - Provider IDs to scope the request (internal use)
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Assigned seatmap snapshot on vehicle GET responses (btrz-api-inventory VehicleSeatmap).
|
|
27
|
+
* Present when a seatmap is assigned; omitted when the vehicle has none.
|
|
28
|
+
* Written only by POST/DELETE /vehicles/{vehicleId}/seatmaps, not by POST or PUT /vehicles.
|
|
29
|
+
* @typedef {Object} VehicleSeatmap
|
|
30
|
+
* @property {string} _id - Assigned seatmap id (24-char hex)
|
|
31
|
+
* @property {string} name - Assigned seatmap name
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Vehicle returned by GET /vehicles and GET /vehicles/{vehicleId} (btrz-api-inventory Vehicle).
|
|
36
|
+
* @typedef {Object} Vehicle
|
|
37
|
+
* @property {string} _id - Vehicle id
|
|
38
|
+
* @property {string} accountId - Account the vehicle belongs to
|
|
39
|
+
* @property {string} name - Vehicle name
|
|
40
|
+
* @property {number} capacity - Vehicle capacity
|
|
41
|
+
* @property {string} [licensePlate] - License plate
|
|
42
|
+
* @property {string} [certification] - Certification
|
|
43
|
+
* @property {string} [brand] - Brand name
|
|
44
|
+
* @property {boolean} [disabled] - Whether the vehicle is unavailable
|
|
45
|
+
* @property {string} [garageId] - Garage id
|
|
46
|
+
* @property {string} [externalId] - External id
|
|
47
|
+
* @property {string} [amenityGroupId] - Amenity group id
|
|
48
|
+
* @property {string} [brandId] - Brand id
|
|
49
|
+
* @property {number} [number] - Numeric identifier when the name is numeric
|
|
50
|
+
* @property {VehicleSeatmap} [seatmap] - Assigned seatmap snapshot; omitted when not assigned
|
|
51
|
+
* @property {string} [createdBy] - User id that created the vehicle
|
|
52
|
+
* @property {string} [updatedBy] - User id that last updated the vehicle
|
|
53
|
+
* @property {Object} [createdAt] - Creation date (BzDate)
|
|
54
|
+
* @property {Object} [updatedAt] - Last update date (BzDate)
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* GET /vehicles response (btrz-api-inventory GetVehiclesResponse).
|
|
59
|
+
* @typedef {Object} GetVehiclesResponse
|
|
60
|
+
* @property {Vehicle[]} vehicles
|
|
61
|
+
* @property {string} [next] - Next page link; empty if none
|
|
62
|
+
* @property {string} [previous] - Previous page link; empty if none
|
|
63
|
+
* @property {number} count - Total matching vehicles
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* GET /vehicles/{vehicleId} response (btrz-api-inventory VehicleResponse).
|
|
68
|
+
* @typedef {Object} VehicleResponse
|
|
69
|
+
* @property {Vehicle} vehicle
|
|
70
|
+
*/
|
|
71
|
+
|
|
25
72
|
/**
|
|
26
73
|
* Factory for vehicles API (btrz-api-inventory).
|
|
27
74
|
* @param {Object} deps
|
|
@@ -40,7 +87,7 @@ function vehiclesFactory({
|
|
|
40
87
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
41
88
|
* @param {VehiclesQuery} [opts.query] - Query params (disabled, page, name, garageId, brandId, etc.)
|
|
42
89
|
* @param {Object} [opts.headers] - Optional headers
|
|
43
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
90
|
+
* @returns {Promise<import("axios").AxiosResponse<GetVehiclesResponse>>}
|
|
44
91
|
*/
|
|
45
92
|
function all({
|
|
46
93
|
token,
|
|
@@ -66,7 +113,7 @@ function vehiclesFactory({
|
|
|
66
113
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
67
114
|
* @param {string} opts.vehicleId - Vehicle id
|
|
68
115
|
* @param {Object} [opts.headers] - Optional headers
|
|
69
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
116
|
+
* @returns {Promise<import("axios").AxiosResponse<VehicleResponse>>}
|
|
70
117
|
*/
|
|
71
118
|
function get({
|
|
72
119
|
vehicleId,
|
|
@@ -89,9 +136,9 @@ function vehiclesFactory({
|
|
|
89
136
|
* @param {Object} opts
|
|
90
137
|
* @param {string} [opts.token] - API key
|
|
91
138
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
92
|
-
* @param {Object} opts.vehicle - Vehicle payload
|
|
139
|
+
* @param {Object} opts.vehicle - Vehicle payload (VehiclePostData). Does not accept seatmap; assign with vehicles.seatmaps.create.
|
|
93
140
|
* @param {Object} [opts.headers] - Optional headers
|
|
94
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
141
|
+
* @returns {Promise<import("axios").AxiosResponse<VehicleResponse>>}
|
|
95
142
|
*/
|
|
96
143
|
function create({
|
|
97
144
|
jwtToken,
|
|
@@ -147,9 +194,9 @@ function vehiclesFactory({
|
|
|
147
194
|
* @param {string} [opts.token] - API key
|
|
148
195
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
149
196
|
* @param {string} opts.vehicleId - Vehicle id
|
|
150
|
-
* @param {Object} opts.vehicle - Vehicle payload
|
|
197
|
+
* @param {Object} opts.vehicle - Vehicle payload (VehiclePostData). Does not accept or change seatmap.
|
|
151
198
|
* @param {Object} [opts.headers] - Optional headers
|
|
152
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
199
|
+
* @returns {Promise<import("axios").AxiosResponse<VehicleResponse>>}
|
|
153
200
|
*/
|
|
154
201
|
function update({
|
|
155
202
|
jwtToken,
|
|
@@ -27,6 +27,19 @@ const {
|
|
|
27
27
|
* @property {string} [humanDate] - "mm" | "dd"
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Request body for POST /notify/whatsapp (btrz-api-notifications). See post-notify-whatsapp getSpec() and NotifyWhatsappPostData.
|
|
32
|
+
* @typedef {Object} NotifyWhatsappPostData
|
|
33
|
+
* @property {string} type - Document/template type (e.g. product, voucher, order)
|
|
34
|
+
* @property {string} itemId - ObjectId of the item (24-char hex)
|
|
35
|
+
* @property {string} [templateType] - Accounts template type when it differs from `type` (same enum as GET /sms-templates/types). Twilio only: the Salesforce branch uses the Meta approved template referenced by the account `waDefinitionKey`
|
|
36
|
+
* @property {string} [to] - Recipient phone (E.164). Optional; derived from item when omitted. The Salesforce branch only supports Mexican numbers with the 52 country code (12 digits starting with 52)
|
|
37
|
+
* @property {string} [lang] - ISO language code. Twilio only: used for template selection
|
|
38
|
+
* @property {string} [channel] - Channel filter for template selection. Twilio only
|
|
39
|
+
* @property {string} [family] - Required when type is 'product'. One of: ticket, reservation, paid in, paid out, parcel, flexpass, bundle
|
|
40
|
+
* @property {string} [humanDate] - "mm" | "dd". Twilio only
|
|
41
|
+
*/
|
|
42
|
+
|
|
30
43
|
/**
|
|
31
44
|
* Query params for POST /notify-tickets/:ticketId (btrz-api-notifications). See post-notify-tickets-by-id-handler getSpec().
|
|
32
45
|
* @typedef {Object} NotifyTicketsPostQuery
|
|
@@ -52,7 +65,7 @@ const {
|
|
|
52
65
|
* @param {Object} deps
|
|
53
66
|
* @param {import("axios").AxiosInstance} deps.client
|
|
54
67
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
55
|
-
* @returns {{ childUsers: { create: function }, tickets: { create: function }, vouchers: { create: function }, manifest: { create: function }, emailByType: { create: function }, smsByType: { create: function } }}
|
|
68
|
+
* @returns {{ childUsers: { create: function }, newSeller: { create: function }, tickets: { create: function }, vouchers: { create: function }, manifest: { create: function, resend: function }, emailByType: { create: function }, smsByType: { create: function }, whatsapp: { create: function } }}
|
|
56
69
|
*/
|
|
57
70
|
function notifyTicketFactory({
|
|
58
71
|
client,
|
|
@@ -320,6 +333,37 @@ function notifyTicketFactory({
|
|
|
320
333
|
})
|
|
321
334
|
});
|
|
322
335
|
}
|
|
336
|
+
},
|
|
337
|
+
whatsapp: {
|
|
338
|
+
/**
|
|
339
|
+
* POST /notify/whatsapp - sends WhatsApp notification specifying document type and id
|
|
340
|
+
* Uses the account's WhatsApp provider: for Twilio it uses the most relevant published SMS template;
|
|
341
|
+
* for Salesforce it uses a Meta approved WhatsApp template configured via `waDefinitionKey` in the account.
|
|
342
|
+
* @param {Object} opts
|
|
343
|
+
* @param {string} [opts.token] - API key
|
|
344
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
345
|
+
* @param {NotifyWhatsappPostData} opts.data - Request body (type, itemId; optional templateType, to, lang, channel, family, humanDate)
|
|
346
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
347
|
+
* @returns {Promise<import("axios").AxiosResponse<{ success: boolean }>>}
|
|
348
|
+
*/
|
|
349
|
+
create({
|
|
350
|
+
token,
|
|
351
|
+
jwtToken,
|
|
352
|
+
data,
|
|
353
|
+
headers
|
|
354
|
+
}) {
|
|
355
|
+
return client({
|
|
356
|
+
url: "/notify/whatsapp",
|
|
357
|
+
method: "post",
|
|
358
|
+
data: data || {},
|
|
359
|
+
headers: authorizationHeaders({
|
|
360
|
+
token,
|
|
361
|
+
jwtToken,
|
|
362
|
+
internalAuthTokenProvider,
|
|
363
|
+
headers
|
|
364
|
+
})
|
|
365
|
+
});
|
|
366
|
+
}
|
|
323
367
|
}
|
|
324
368
|
};
|
|
325
369
|
}
|
package/package.json
CHANGED
|
@@ -22,6 +22,53 @@ const {
|
|
|
22
22
|
* @property {string} [providerIds] - Provider IDs to scope the request (internal use)
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Assigned seatmap snapshot on vehicle GET responses (btrz-api-inventory VehicleSeatmap).
|
|
27
|
+
* Present when a seatmap is assigned; omitted when the vehicle has none.
|
|
28
|
+
* Written only by POST/DELETE /vehicles/{vehicleId}/seatmaps, not by POST or PUT /vehicles.
|
|
29
|
+
* @typedef {Object} VehicleSeatmap
|
|
30
|
+
* @property {string} _id - Assigned seatmap id (24-char hex)
|
|
31
|
+
* @property {string} name - Assigned seatmap name
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Vehicle returned by GET /vehicles and GET /vehicles/{vehicleId} (btrz-api-inventory Vehicle).
|
|
36
|
+
* @typedef {Object} Vehicle
|
|
37
|
+
* @property {string} _id - Vehicle id
|
|
38
|
+
* @property {string} accountId - Account the vehicle belongs to
|
|
39
|
+
* @property {string} name - Vehicle name
|
|
40
|
+
* @property {number} capacity - Vehicle capacity
|
|
41
|
+
* @property {string} [licensePlate] - License plate
|
|
42
|
+
* @property {string} [certification] - Certification
|
|
43
|
+
* @property {string} [brand] - Brand name
|
|
44
|
+
* @property {boolean} [disabled] - Whether the vehicle is unavailable
|
|
45
|
+
* @property {string} [garageId] - Garage id
|
|
46
|
+
* @property {string} [externalId] - External id
|
|
47
|
+
* @property {string} [amenityGroupId] - Amenity group id
|
|
48
|
+
* @property {string} [brandId] - Brand id
|
|
49
|
+
* @property {number} [number] - Numeric identifier when the name is numeric
|
|
50
|
+
* @property {VehicleSeatmap} [seatmap] - Assigned seatmap snapshot; omitted when not assigned
|
|
51
|
+
* @property {string} [createdBy] - User id that created the vehicle
|
|
52
|
+
* @property {string} [updatedBy] - User id that last updated the vehicle
|
|
53
|
+
* @property {Object} [createdAt] - Creation date (BzDate)
|
|
54
|
+
* @property {Object} [updatedAt] - Last update date (BzDate)
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* GET /vehicles response (btrz-api-inventory GetVehiclesResponse).
|
|
59
|
+
* @typedef {Object} GetVehiclesResponse
|
|
60
|
+
* @property {Vehicle[]} vehicles
|
|
61
|
+
* @property {string} [next] - Next page link; empty if none
|
|
62
|
+
* @property {string} [previous] - Previous page link; empty if none
|
|
63
|
+
* @property {number} count - Total matching vehicles
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* GET /vehicles/{vehicleId} response (btrz-api-inventory VehicleResponse).
|
|
68
|
+
* @typedef {Object} VehicleResponse
|
|
69
|
+
* @property {Vehicle} vehicle
|
|
70
|
+
*/
|
|
71
|
+
|
|
25
72
|
/**
|
|
26
73
|
* Factory for vehicles API (btrz-api-inventory).
|
|
27
74
|
* @param {Object} deps
|
|
@@ -37,7 +84,7 @@ function vehiclesFactory({client, internalAuthTokenProvider}) {
|
|
|
37
84
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
38
85
|
* @param {VehiclesQuery} [opts.query] - Query params (disabled, page, name, garageId, brandId, etc.)
|
|
39
86
|
* @param {Object} [opts.headers] - Optional headers
|
|
40
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
87
|
+
* @returns {Promise<import("axios").AxiosResponse<GetVehiclesResponse>>}
|
|
41
88
|
*/
|
|
42
89
|
function all({
|
|
43
90
|
token,
|
|
@@ -58,7 +105,7 @@ function vehiclesFactory({client, internalAuthTokenProvider}) {
|
|
|
58
105
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
59
106
|
* @param {string} opts.vehicleId - Vehicle id
|
|
60
107
|
* @param {Object} [opts.headers] - Optional headers
|
|
61
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
108
|
+
* @returns {Promise<import("axios").AxiosResponse<VehicleResponse>>}
|
|
62
109
|
*/
|
|
63
110
|
function get({vehicleId, token, jwtToken, headers}) {
|
|
64
111
|
return client.get(`/vehicles/${vehicleId}`, {
|
|
@@ -71,9 +118,9 @@ function vehiclesFactory({client, internalAuthTokenProvider}) {
|
|
|
71
118
|
* @param {Object} opts
|
|
72
119
|
* @param {string} [opts.token] - API key
|
|
73
120
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
74
|
-
* @param {Object} opts.vehicle - Vehicle payload
|
|
121
|
+
* @param {Object} opts.vehicle - Vehicle payload (VehiclePostData). Does not accept seatmap; assign with vehicles.seatmaps.create.
|
|
75
122
|
* @param {Object} [opts.headers] - Optional headers
|
|
76
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
123
|
+
* @returns {Promise<import("axios").AxiosResponse<VehicleResponse>>}
|
|
77
124
|
*/
|
|
78
125
|
function create({jwtToken, token, vehicle, headers}) {
|
|
79
126
|
return client({
|
|
@@ -109,9 +156,9 @@ function vehiclesFactory({client, internalAuthTokenProvider}) {
|
|
|
109
156
|
* @param {string} [opts.token] - API key
|
|
110
157
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
111
158
|
* @param {string} opts.vehicleId - Vehicle id
|
|
112
|
-
* @param {Object} opts.vehicle - Vehicle payload
|
|
159
|
+
* @param {Object} opts.vehicle - Vehicle payload (VehiclePostData). Does not accept or change seatmap.
|
|
113
160
|
* @param {Object} [opts.headers] - Optional headers
|
|
114
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
161
|
+
* @returns {Promise<import("axios").AxiosResponse<VehicleResponse>>}
|
|
115
162
|
*/
|
|
116
163
|
function update({jwtToken, token, vehicleId, vehicle, headers}) {
|
|
117
164
|
return client({
|
|
@@ -27,6 +27,19 @@ const {
|
|
|
27
27
|
* @property {string} [humanDate] - "mm" | "dd"
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Request body for POST /notify/whatsapp (btrz-api-notifications). See post-notify-whatsapp getSpec() and NotifyWhatsappPostData.
|
|
32
|
+
* @typedef {Object} NotifyWhatsappPostData
|
|
33
|
+
* @property {string} type - Document/template type (e.g. product, voucher, order)
|
|
34
|
+
* @property {string} itemId - ObjectId of the item (24-char hex)
|
|
35
|
+
* @property {string} [templateType] - Accounts template type when it differs from `type` (same enum as GET /sms-templates/types). Twilio only: the Salesforce branch uses the Meta approved template referenced by the account `waDefinitionKey`
|
|
36
|
+
* @property {string} [to] - Recipient phone (E.164). Optional; derived from item when omitted. The Salesforce branch only supports Mexican numbers with the 52 country code (12 digits starting with 52)
|
|
37
|
+
* @property {string} [lang] - ISO language code. Twilio only: used for template selection
|
|
38
|
+
* @property {string} [channel] - Channel filter for template selection. Twilio only
|
|
39
|
+
* @property {string} [family] - Required when type is 'product'. One of: ticket, reservation, paid in, paid out, parcel, flexpass, bundle
|
|
40
|
+
* @property {string} [humanDate] - "mm" | "dd". Twilio only
|
|
41
|
+
*/
|
|
42
|
+
|
|
30
43
|
/**
|
|
31
44
|
* Query params for POST /notify-tickets/:ticketId (btrz-api-notifications). See post-notify-tickets-by-id-handler getSpec().
|
|
32
45
|
* @typedef {Object} NotifyTicketsPostQuery
|
|
@@ -52,7 +65,7 @@ const {
|
|
|
52
65
|
* @param {Object} deps
|
|
53
66
|
* @param {import("axios").AxiosInstance} deps.client
|
|
54
67
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
55
|
-
* @returns {{ childUsers: { create: function }, tickets: { create: function }, vouchers: { create: function }, manifest: { create: function }, emailByType: { create: function }, smsByType: { create: function } }}
|
|
68
|
+
* @returns {{ childUsers: { create: function }, newSeller: { create: function }, tickets: { create: function }, vouchers: { create: function }, manifest: { create: function, resend: function }, emailByType: { create: function }, smsByType: { create: function }, whatsapp: { create: function } }}
|
|
56
69
|
*/
|
|
57
70
|
function notifyTicketFactory({
|
|
58
71
|
client, internalAuthTokenProvider
|
|
@@ -230,6 +243,27 @@ function notifyTicketFactory({
|
|
|
230
243
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
231
244
|
});
|
|
232
245
|
}
|
|
246
|
+
},
|
|
247
|
+
whatsapp: {
|
|
248
|
+
/**
|
|
249
|
+
* POST /notify/whatsapp - sends WhatsApp notification specifying document type and id
|
|
250
|
+
* Uses the account's WhatsApp provider: for Twilio it uses the most relevant published SMS template;
|
|
251
|
+
* for Salesforce it uses a Meta approved WhatsApp template configured via `waDefinitionKey` in the account.
|
|
252
|
+
* @param {Object} opts
|
|
253
|
+
* @param {string} [opts.token] - API key
|
|
254
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
255
|
+
* @param {NotifyWhatsappPostData} opts.data - Request body (type, itemId; optional templateType, to, lang, channel, family, humanDate)
|
|
256
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
257
|
+
* @returns {Promise<import("axios").AxiosResponse<{ success: boolean }>>}
|
|
258
|
+
*/
|
|
259
|
+
create({token, jwtToken, data, headers}) {
|
|
260
|
+
return client({
|
|
261
|
+
url: "/notify/whatsapp",
|
|
262
|
+
method: "post",
|
|
263
|
+
data: data || {},
|
|
264
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
265
|
+
});
|
|
266
|
+
}
|
|
233
267
|
}
|
|
234
268
|
};
|
|
235
269
|
}
|
|
@@ -202,3 +202,37 @@ describe("notifications/notify/sms", () => {
|
|
|
202
202
|
});
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
|
+
|
|
206
|
+
describe("notifications/notify/whatsapp", () => {
|
|
207
|
+
const token = "my-api-key";
|
|
208
|
+
const jwtToken = "my-jwt";
|
|
209
|
+
|
|
210
|
+
afterEach(() => {
|
|
211
|
+
axiosMock.reset();
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
it("should POST send WhatsApp by type and itemId", () => {
|
|
215
|
+
axiosMock.onPost("/notify/whatsapp").reply(({headers, data}) => {
|
|
216
|
+
if (headers["x-api-key"] !== token || headers.authorization !== `Bearer ${jwtToken}`) {
|
|
217
|
+
return [403];
|
|
218
|
+
}
|
|
219
|
+
const body = typeof data === "string" ? JSON.parse(data) : data;
|
|
220
|
+
if (body.type === "order" && body.itemId === "507f1f77bcf86cd799439011" && body.to === "5215555555555") {
|
|
221
|
+
return [200, {success: true}];
|
|
222
|
+
}
|
|
223
|
+
return [400];
|
|
224
|
+
});
|
|
225
|
+
return api.notifications.notify.whatsapp.create({
|
|
226
|
+
token,
|
|
227
|
+
jwtToken,
|
|
228
|
+
data: {
|
|
229
|
+
type: "order",
|
|
230
|
+
itemId: "507f1f77bcf86cd799439011",
|
|
231
|
+
to: "5215555555555"
|
|
232
|
+
}
|
|
233
|
+
}).then((res) => {
|
|
234
|
+
assert.deepStrictEqual(res.status, 200);
|
|
235
|
+
assert.deepStrictEqual(res.data.success, true);
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
});
|
|
@@ -8,7 +8,7 @@ export = notifyTicketFactory;
|
|
|
8
8
|
* @param {Object} deps
|
|
9
9
|
* @param {import("axios").AxiosInstance} deps.client
|
|
10
10
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
11
|
-
* @returns {{ childUsers: { create: function }, tickets: { create: function }, vouchers: { create: function }, manifest: { create: function }, emailByType: { create: function }, smsByType: { create: function } }}
|
|
11
|
+
* @returns {{ childUsers: { create: function }, newSeller: { create: function }, tickets: { create: function }, vouchers: { create: function }, manifest: { create: function, resend: function }, emailByType: { create: function }, smsByType: { create: function }, whatsapp: { create: function } }}
|
|
12
12
|
*/
|
|
13
13
|
declare function notifyTicketFactory({ client, internalAuthTokenProvider }: {
|
|
14
14
|
client: import("axios").AxiosInstance;
|
|
@@ -24,9 +24,16 @@ declare function notifyTicketFactory({ client, internalAuthTokenProvider }: {
|
|
|
24
24
|
/** @param opts.data type, itemId; optional to, lang, channel, family, humanDate */
|
|
25
25
|
create: (opts: { token?: string; jwtToken?: string; data: { type: string; itemId: string; to?: string; lang?: string; channel?: string; family?: string; humanDate?: string }; headers?: object }) => Promise<import("axios").AxiosResponse<{ success: boolean }>>;
|
|
26
26
|
};
|
|
27
|
+
whatsapp: {
|
|
28
|
+
/** @param opts.data type, itemId; optional templateType, to, lang, channel, family, humanDate */
|
|
29
|
+
create: (opts: { token?: string; jwtToken?: string; data?: { type: string; itemId: string; templateType?: string; to?: string; lang?: string; channel?: string; family?: string; humanDate?: string }; headers?: object }) => Promise<import("axios").AxiosResponse<{ success: boolean }>>;
|
|
30
|
+
};
|
|
27
31
|
childUsers: {
|
|
28
32
|
create: Function;
|
|
29
33
|
};
|
|
34
|
+
newSeller: {
|
|
35
|
+
create: Function;
|
|
36
|
+
};
|
|
30
37
|
tickets: {
|
|
31
38
|
create: Function;
|
|
32
39
|
};
|