@dv4resi/dvss-backend-module-offering-im 0.0.19 → 0.0.20

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 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
@@ -4169,17 +4169,18 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
4169
4169
  this.logger.info(loggedInUserId, this.createOrder.name, this.fileName, "Created Trybe order for offering booking", {
4170
4170
  orderId
4171
4171
  });
4172
+ const bookableItems = submitOrderResponse.data?.booking_items && submitOrderResponse.data.booking_items.length > 0 ? submitOrderResponse.data.booking_items : submitOrderResponse.data?.purchase_items || [];
4172
4173
  return {
4173
4174
  externalBookingId: orderId,
4174
4175
  meta: {
4175
4176
  orderReference: submitOrderResponse.data?.order_ref ?? order.meta.orderReference,
4176
- room: submitOrderResponse.data?.booking_items?.find((item) => item.booking_summary?.room?.id)?.booking_summary?.room,
4177
+ room: bookableItems.find((item) => item.booking_summary?.room?.id)?.booking_summary?.room,
4177
4178
  total: (submitOrderResponse.data?.totals?.total ?? 0) / request.currencyMultiplier,
4178
4179
  subTotal: (submitOrderResponse.data?.totals?.subtotal ?? 0) / request.currencyMultiplier,
4179
4180
  totalTax: (submitOrderResponse.data?.total_tax ?? 0) / request.currencyMultiplier,
4180
4181
  discount: (submitOrderResponse.data?.discount_total ?? 0) / request.currencyMultiplier
4181
4182
  },
4182
- items: submitOrderResponse.data?.booking_items?.map((bookableItem) => {
4183
+ items: bookableItems.map((bookableItem) => {
4183
4184
  return {
4184
4185
  externalId: bookableItem.type_id,
4185
4186
  name: bookableItem.type_name,
@@ -4195,7 +4196,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
4195
4196
  basketItemId: bookableItem.id
4196
4197
  }
4197
4198
  };
4198
- }) ?? []
4199
+ })
4199
4200
  };
4200
4201
  } catch (err) {
4201
4202
  this.logger.error(loggedInUserId, this.createOrder.name, this.fileName, "Error creating Trybe order for offering booking", err);