@dv4resi/dvss-backend-module-offering-im 0.0.18 → 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;
@@ -1431,6 +1504,7 @@ interface ISiteSystemResponse {
1431
1504
  name: string;
1432
1505
  kind: string;
1433
1506
  }>;
1507
+ categoryIds: string[];
1434
1508
  }
1435
1509
 
1436
1510
  declare class TrybeIntegrationConfigurationService extends BaseIntegrationConfiguration {
package/dist/index.js CHANGED
@@ -3396,7 +3396,8 @@ function mapTrybeSiteResponseToSystem(response) {
3396
3396
  id: paymentType.id,
3397
3397
  name: paymentType.name,
3398
3398
  kind: paymentType.kind
3399
- }))
3399
+ })),
3400
+ categoryIds: response.data?.category_ids ?? []
3400
3401
  };
3401
3402
  }
3402
3403
  __name(mapTrybeSiteResponseToSystem, "mapTrybeSiteResponseToSystem");
@@ -4168,17 +4169,18 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
4168
4169
  this.logger.info(loggedInUserId, this.createOrder.name, this.fileName, "Created Trybe order for offering booking", {
4169
4170
  orderId
4170
4171
  });
4172
+ const bookableItems = submitOrderResponse.data?.booking_items && submitOrderResponse.data.booking_items.length > 0 ? submitOrderResponse.data.booking_items : submitOrderResponse.data?.purchase_items || [];
4171
4173
  return {
4172
4174
  externalBookingId: orderId,
4173
4175
  meta: {
4174
4176
  orderReference: submitOrderResponse.data?.order_ref ?? order.meta.orderReference,
4175
- 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,
4176
4178
  total: (submitOrderResponse.data?.totals?.total ?? 0) / request.currencyMultiplier,
4177
4179
  subTotal: (submitOrderResponse.data?.totals?.subtotal ?? 0) / request.currencyMultiplier,
4178
4180
  totalTax: (submitOrderResponse.data?.total_tax ?? 0) / request.currencyMultiplier,
4179
4181
  discount: (submitOrderResponse.data?.discount_total ?? 0) / request.currencyMultiplier
4180
4182
  },
4181
- items: submitOrderResponse.data?.booking_items?.map((bookableItem) => {
4183
+ items: bookableItems.map((bookableItem) => {
4182
4184
  return {
4183
4185
  externalId: bookableItem.type_id,
4184
4186
  name: bookableItem.type_name,
@@ -4194,7 +4196,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
4194
4196
  basketItemId: bookableItem.id
4195
4197
  }
4196
4198
  };
4197
- }) ?? []
4199
+ })
4198
4200
  };
4199
4201
  } catch (err) {
4200
4202
  this.logger.error(loggedInUserId, this.createOrder.name, this.fileName, "Error creating Trybe order for offering booking", err);