@compassdigital/sdk.typescript 4.569.0 → 4.571.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compassdigital/sdk.typescript",
3
- "version": "4.569.0",
3
+ "version": "4.571.0",
4
4
  "description": "Compass Digital Labs TypeScript SDK",
5
5
  "type": "commonjs",
6
6
  "main": "./lib/index.js",
package/src/index.ts CHANGED
@@ -1422,6 +1422,9 @@ import {
1422
1422
  PostRewardsQuery,
1423
1423
  PostRewardsBody,
1424
1424
  PostRewardsResponse,
1425
+ PostDiscountValidateDiscountsQuery,
1426
+ PostDiscountValidateDiscountsBody,
1427
+ PostDiscountValidateDiscountsResponse,
1425
1428
  PutDiscountPublishBody,
1426
1429
  PutDiscountPublishResponse,
1427
1430
  } from './interface/discount';
@@ -16044,6 +16047,28 @@ export class ServiceClient extends BaseServiceClient {
16044
16047
  );
16045
16048
  }
16046
16049
 
16050
+ /**
16051
+ * POST /discount/validate-discounts - Validate and calculate discounts for a shopping cart
16052
+ *
16053
+ * @param body
16054
+ * @param options - additional request options
16055
+ */
16056
+ post_discount_validate_discounts(
16057
+ body: PostDiscountValidateDiscountsBody,
16058
+ options?: {
16059
+ query?: PostDiscountValidateDiscountsQuery;
16060
+ } & RequestOptions,
16061
+ ): ResponsePromise<PostDiscountValidateDiscountsResponse> {
16062
+ return this.request(
16063
+ 'discount',
16064
+ '/discount/validate-discounts',
16065
+ 'POST',
16066
+ `/discount/validate-discounts`,
16067
+ body,
16068
+ options,
16069
+ );
16070
+ }
16071
+
16047
16072
  /**
16048
16073
  * PUT /discount/{id}/publish - Publish a discount
16049
16074
  *
@@ -259,6 +259,7 @@ export interface DiscountTaxonomy {
259
259
  export interface PostDiscountRequestDTO {
260
260
  // What the discount type is
261
261
  type: 'Total Order' | 'Single Items' | 'Bundle';
262
+ createdBy: string;
262
263
  name: string;
263
264
  is?: DiscountIs;
264
265
  meta?: DiscountMeta;
@@ -267,7 +268,6 @@ export interface PostDiscountRequestDTO {
267
268
  itemLevelConfig?: ItemLevelConfig;
268
269
  taxonomy?: DiscountTaxonomy;
269
270
  status?: DiscountStatus;
270
- createdBy: string;
271
271
  }
272
272
 
273
273
  export interface PostDiscountResponseDTO {
@@ -393,18 +393,82 @@ export interface PostRewardsResponseDTO {
393
393
  campaigns: CustomerRewardCampaignDTO[];
394
394
  }
395
395
 
396
- export interface PutDiscountRequestDTO {
396
+ export interface UsedPaymentMethodsDTO {
397
+ hasMealplan?: boolean;
398
+ hasMealSwipes?: boolean;
399
+ hasMealExchange?: boolean;
400
+ hasBadgePay?: boolean;
401
+ hasStipend?: boolean;
402
+ hasVoucher?: boolean;
403
+ hasCouponVoucher?: boolean;
404
+ hasPaymentWallet?: boolean;
405
+ hasCreditCard?: boolean;
406
+ }
407
+
408
+ export interface PostValidateDiscountsRequestDTO {
409
+ // Site ID
410
+ siteId: string;
411
+ // Brand IDs
412
+ brandIds: string[];
413
+ // Shopping cart ID
414
+ cartId: string;
415
+ // Total cart amount
416
+ cartTotal: number;
417
+ // ISO 8601 creation date
418
+ createdDate: string;
419
+ // Currency code
420
+ currency: string;
421
+ // Payment methods used in the cart
422
+ usedPaymentMethods?: UsedPaymentMethodsDTO;
423
+ // Total of other incentives already applied
424
+ currentIncentivesTotal?: number;
425
+ // Customer ID for personalized discounts
426
+ customerId?: string;
427
+ // Items in the cart
428
+ cartItems: Record<string, any>[];
429
+ }
430
+
431
+ export interface StackedDiscountDTO {
432
+ // discount id
433
+ id: string;
434
+ // user id of discount creator
435
+ createdBy: string;
436
+ // user id of most recent update
437
+ updatedBy: string;
397
438
  // What the discount type is
398
439
  type: 'Total Order' | 'Single Items' | 'Bundle';
440
+ // Applied discount amount
441
+ appliedAmount: number;
442
+ createdAt: string;
443
+ updatedAt: string;
399
444
  name: string;
445
+ status: DiscountStatus;
400
446
  is?: DiscountIs;
401
447
  meta?: DiscountMeta;
402
448
  schedule?: DiscountSchedule;
403
449
  channelConfig: DiscountChannelConfig;
404
450
  itemLevelConfig?: ItemLevelConfig;
451
+ }
452
+
453
+ export interface PostValidateDiscountsResponseDTO {
454
+ // Total stacked discount amount
455
+ stackedTotal: number;
456
+ // List of validated and applied discounts
457
+ stackedDiscounts: StackedDiscountDTO[];
458
+ }
459
+
460
+ export interface PutDiscountRequestDTO {
461
+ // What the discount type is
462
+ type: 'Total Order' | 'Single Items' | 'Bundle';
405
463
  updatedBy: string;
406
464
  taxonomy?: DiscountTaxonomy;
407
465
  status?: DiscountStatus;
466
+ name: string;
467
+ is?: DiscountIs;
468
+ meta?: DiscountMeta;
469
+ schedule?: DiscountSchedule;
470
+ channelConfig: DiscountChannelConfig;
471
+ itemLevelConfig?: ItemLevelConfig;
408
472
  }
409
473
 
410
474
  export interface PutDiscountResponseDTO {
@@ -441,15 +505,15 @@ export interface PutDiscountPublishResponseDTO {
441
505
  updatedBy: string;
442
506
  // What the discount type is
443
507
  type: 'Total Order' | 'Single Items' | 'Bundle';
508
+ is: DiscountIs;
509
+ meta: DiscountMeta;
510
+ schedule: DiscountSchedule;
511
+ channelConfig: DiscountChannelConfig;
444
512
  createdAt: string;
445
513
  updatedAt: string;
446
514
  name: string;
447
515
  status: DiscountStatus;
448
516
  itemLevelConfig?: ItemLevelConfig;
449
- is: DiscountIs;
450
- meta: DiscountMeta;
451
- schedule: DiscountSchedule;
452
- channelConfig: DiscountChannelConfig;
453
517
  }
454
518
 
455
519
  // DELETE /discount/{id} - Delete a discount
@@ -529,6 +593,17 @@ export type PostRewardsBody = PostRewardsBodyDTO;
529
593
 
530
594
  export type PostRewardsResponse = PostRewardsResponseDTO;
531
595
 
596
+ // POST /discount/validate-discounts - Validate and calculate discounts for a shopping cart
597
+
598
+ export interface PostDiscountValidateDiscountsQuery {
599
+ statusFilter?: string;
600
+ validateSchedule?: boolean;
601
+ }
602
+
603
+ export type PostDiscountValidateDiscountsBody = PostValidateDiscountsRequestDTO;
604
+
605
+ export type PostDiscountValidateDiscountsResponse = PostValidateDiscountsResponseDTO;
606
+
532
607
  // PUT /discount/{id}/publish - Publish a discount
533
608
 
534
609
  export interface PutDiscountPublishPath {
@@ -41,6 +41,8 @@ export interface Menu {
41
41
  last_modified_user?: string;
42
42
  centricos?: boolean;
43
43
  version?: number;
44
+ // Unique identifier regenerated on every publish. Consumers can compare against a previously seen value to detect whether the V2 menu has changed (e.g. to de-dupe sync events).
45
+ revision?: string;
44
46
  // V3 Brand metadata if menu came from Centric
45
47
  brand?: {
46
48
  id?: string;