@dv4resi/dvss-backend-module-offering-im 0.0.19 → 0.0.21
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/dist/index.d.ts +74 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1330,7 +1330,80 @@ interface ITrybeSubmitOrderResponse {
|
|
|
1330
1330
|
};
|
|
1331
1331
|
is_modifiable: boolean;
|
|
1332
1332
|
}[];
|
|
1333
|
-
purchase_items
|
|
1333
|
+
purchase_items?: {
|
|
1334
|
+
id: string;
|
|
1335
|
+
status: string;
|
|
1336
|
+
item_type: string;
|
|
1337
|
+
date: string;
|
|
1338
|
+
type_id: string;
|
|
1339
|
+
type_name: string;
|
|
1340
|
+
type_product_code: string | null;
|
|
1341
|
+
guests: {
|
|
1342
|
+
id: string;
|
|
1343
|
+
name: string;
|
|
1344
|
+
first_name: string;
|
|
1345
|
+
last_name: string;
|
|
1346
|
+
email: string | null;
|
|
1347
|
+
intake_form_complete: boolean;
|
|
1348
|
+
checked_in_at: string | null;
|
|
1349
|
+
checked_out_at: string | null;
|
|
1350
|
+
is_lead_booker: boolean;
|
|
1351
|
+
customer_id: string;
|
|
1352
|
+
}[];
|
|
1353
|
+
price: number;
|
|
1354
|
+
discount_amount: number;
|
|
1355
|
+
discounts: [];
|
|
1356
|
+
order_discount_amount: number;
|
|
1357
|
+
booking_summary?: {
|
|
1358
|
+
id: string;
|
|
1359
|
+
status: string;
|
|
1360
|
+
offering: {
|
|
1361
|
+
id: string;
|
|
1362
|
+
type: string;
|
|
1363
|
+
name: string;
|
|
1364
|
+
product_code: string | null;
|
|
1365
|
+
};
|
|
1366
|
+
start_time: string;
|
|
1367
|
+
end_time: string;
|
|
1368
|
+
duration: number;
|
|
1369
|
+
practitioner_ids: string[];
|
|
1370
|
+
practitioners: {
|
|
1371
|
+
id: string;
|
|
1372
|
+
name: string;
|
|
1373
|
+
}[];
|
|
1374
|
+
room_id: string;
|
|
1375
|
+
room?: {
|
|
1376
|
+
id: string;
|
|
1377
|
+
name: string;
|
|
1378
|
+
capacity: number;
|
|
1379
|
+
};
|
|
1380
|
+
equipment_ids: string[];
|
|
1381
|
+
equipment: {
|
|
1382
|
+
id: string;
|
|
1383
|
+
name: string;
|
|
1384
|
+
}[];
|
|
1385
|
+
practitioner_was_requested: false;
|
|
1386
|
+
room_was_requested: false;
|
|
1387
|
+
};
|
|
1388
|
+
total_cost: number;
|
|
1389
|
+
net_total: number;
|
|
1390
|
+
inclusive_tax_amount: number;
|
|
1391
|
+
exclusive_tax_amount: number;
|
|
1392
|
+
booking_reserved_until: string;
|
|
1393
|
+
guest: {
|
|
1394
|
+
id: string;
|
|
1395
|
+
name: string;
|
|
1396
|
+
first_name: string;
|
|
1397
|
+
last_name: string;
|
|
1398
|
+
email: string | null;
|
|
1399
|
+
intake_form_complete: boolean;
|
|
1400
|
+
checked_in_at: string | null;
|
|
1401
|
+
checked_out_at: string | null;
|
|
1402
|
+
is_lead_booker: boolean;
|
|
1403
|
+
customer_id: string;
|
|
1404
|
+
};
|
|
1405
|
+
is_modifiable: boolean;
|
|
1406
|
+
}[];
|
|
1334
1407
|
package_items: [];
|
|
1335
1408
|
booking_items_start_date: string;
|
|
1336
1409
|
booking_items_end_date: string;
|
package/dist/index.js
CHANGED
|
@@ -3068,7 +3068,10 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3068
3068
|
baseUrl: integration.config.platformConfig.baseUrl,
|
|
3069
3069
|
headers: integration.headers
|
|
3070
3070
|
}, integration, loggedInUserId);
|
|
3071
|
-
if (!response.data || response.data
|
|
3071
|
+
if (!response.data || !Array.isArray(response.data)) {
|
|
3072
|
+
throw new dvssBackendModuleUtility.CustomException(dvssBackendModuleUtility.ERROR_NAMES.BAD_REQUEST, "Invalid Credentials");
|
|
3073
|
+
}
|
|
3074
|
+
if (response.data.length === 0) {
|
|
3072
3075
|
return void 0;
|
|
3073
3076
|
}
|
|
3074
3077
|
return response.data[0];
|
|
@@ -4169,17 +4172,18 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4169
4172
|
this.logger.info(loggedInUserId, this.createOrder.name, this.fileName, "Created Trybe order for offering booking", {
|
|
4170
4173
|
orderId
|
|
4171
4174
|
});
|
|
4175
|
+
const bookableItems = submitOrderResponse.data?.booking_items && submitOrderResponse.data.booking_items.length > 0 ? submitOrderResponse.data.booking_items : submitOrderResponse.data?.purchase_items || [];
|
|
4172
4176
|
return {
|
|
4173
4177
|
externalBookingId: orderId,
|
|
4174
4178
|
meta: {
|
|
4175
4179
|
orderReference: submitOrderResponse.data?.order_ref ?? order.meta.orderReference,
|
|
4176
|
-
room:
|
|
4180
|
+
room: bookableItems.find((item) => item.booking_summary?.room?.id)?.booking_summary?.room,
|
|
4177
4181
|
total: (submitOrderResponse.data?.totals?.total ?? 0) / request.currencyMultiplier,
|
|
4178
4182
|
subTotal: (submitOrderResponse.data?.totals?.subtotal ?? 0) / request.currencyMultiplier,
|
|
4179
4183
|
totalTax: (submitOrderResponse.data?.total_tax ?? 0) / request.currencyMultiplier,
|
|
4180
4184
|
discount: (submitOrderResponse.data?.discount_total ?? 0) / request.currencyMultiplier
|
|
4181
4185
|
},
|
|
4182
|
-
items:
|
|
4186
|
+
items: bookableItems.map((bookableItem) => {
|
|
4183
4187
|
return {
|
|
4184
4188
|
externalId: bookableItem.type_id,
|
|
4185
4189
|
name: bookableItem.type_name,
|
|
@@ -4195,7 +4199,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4195
4199
|
basketItemId: bookableItem.id
|
|
4196
4200
|
}
|
|
4197
4201
|
};
|
|
4198
|
-
})
|
|
4202
|
+
})
|
|
4199
4203
|
};
|
|
4200
4204
|
} catch (err) {
|
|
4201
4205
|
this.logger.error(loggedInUserId, this.createOrder.name, this.fileName, "Error creating Trybe order for offering booking", err);
|