@commercelayer/sdk 5.13.2 → 5.15.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.
Files changed (69) hide show
  1. package/lib/cjs/api.d.ts +9 -7
  2. package/lib/cjs/api.js +9 -3
  3. package/lib/cjs/commercelayer.d.ts +4 -2
  4. package/lib/cjs/commercelayer.js +3 -1
  5. package/lib/cjs/model.d.ts +2 -0
  6. package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +137 -0
  7. package/lib/cjs/resources/buy_x_pay_y_promotions.js +75 -0
  8. package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +7 -3
  9. package/lib/cjs/resources/coupons.d.ts +3 -0
  10. package/lib/cjs/resources/custom_promotion_rules.d.ts +62 -0
  11. package/lib/cjs/resources/custom_promotion_rules.js +29 -0
  12. package/lib/cjs/resources/external_promotions.d.ts +28 -1
  13. package/lib/cjs/resources/external_promotions.js +14 -0
  14. package/lib/cjs/resources/fixed_amount_promotions.d.ts +28 -1
  15. package/lib/cjs/resources/fixed_amount_promotions.js +14 -0
  16. package/lib/cjs/resources/fixed_price_promotions.d.ts +19 -0
  17. package/lib/cjs/resources/fixed_price_promotions.js +10 -0
  18. package/lib/cjs/resources/free_gift_promotions.d.ts +19 -0
  19. package/lib/cjs/resources/free_gift_promotions.js +10 -0
  20. package/lib/cjs/resources/free_shipping_promotions.d.ts +19 -0
  21. package/lib/cjs/resources/free_shipping_promotions.js +10 -0
  22. package/lib/cjs/resources/imports.d.ts +3 -0
  23. package/lib/cjs/resources/line_items.d.ts +5 -0
  24. package/lib/cjs/resources/order_amount_promotion_rules.d.ts +7 -3
  25. package/lib/cjs/resources/order_subscription_items.d.ts +4 -0
  26. package/lib/cjs/resources/orders.d.ts +23 -0
  27. package/lib/cjs/resources/orders.js +16 -0
  28. package/lib/cjs/resources/percentage_discount_promotions.d.ts +19 -0
  29. package/lib/cjs/resources/percentage_discount_promotions.js +10 -0
  30. package/lib/cjs/resources/promotion_rules.d.ts +2 -1
  31. package/lib/cjs/resources/promotions.d.ts +6 -0
  32. package/lib/cjs/resources/promotions.js +4 -0
  33. package/lib/cjs/resources/sku_list_promotion_rules.d.ts +7 -3
  34. package/lib/esm/api.d.ts +9 -7
  35. package/lib/esm/api.js +4 -0
  36. package/lib/esm/commercelayer.d.ts +4 -2
  37. package/lib/esm/commercelayer.js +3 -1
  38. package/lib/esm/model.d.ts +2 -0
  39. package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +137 -0
  40. package/lib/esm/resources/buy_x_pay_y_promotions.js +73 -0
  41. package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +7 -3
  42. package/lib/esm/resources/coupons.d.ts +3 -0
  43. package/lib/esm/resources/custom_promotion_rules.d.ts +62 -0
  44. package/lib/esm/resources/custom_promotion_rules.js +27 -0
  45. package/lib/esm/resources/external_promotions.d.ts +28 -1
  46. package/lib/esm/resources/external_promotions.js +14 -0
  47. package/lib/esm/resources/fixed_amount_promotions.d.ts +28 -1
  48. package/lib/esm/resources/fixed_amount_promotions.js +14 -0
  49. package/lib/esm/resources/fixed_price_promotions.d.ts +19 -0
  50. package/lib/esm/resources/fixed_price_promotions.js +10 -0
  51. package/lib/esm/resources/free_gift_promotions.d.ts +19 -0
  52. package/lib/esm/resources/free_gift_promotions.js +10 -0
  53. package/lib/esm/resources/free_shipping_promotions.d.ts +19 -0
  54. package/lib/esm/resources/free_shipping_promotions.js +10 -0
  55. package/lib/esm/resources/imports.d.ts +3 -0
  56. package/lib/esm/resources/line_items.d.ts +5 -0
  57. package/lib/esm/resources/order_amount_promotion_rules.d.ts +7 -3
  58. package/lib/esm/resources/order_subscription_items.d.ts +4 -0
  59. package/lib/esm/resources/orders.d.ts +23 -0
  60. package/lib/esm/resources/orders.js +16 -0
  61. package/lib/esm/resources/percentage_discount_promotions.d.ts +19 -0
  62. package/lib/esm/resources/percentage_discount_promotions.js +10 -0
  63. package/lib/esm/resources/promotion_rules.d.ts +2 -1
  64. package/lib/esm/resources/promotions.d.ts +6 -0
  65. package/lib/esm/resources/promotions.js +4 -0
  66. package/lib/esm/resources/sku_list_promotion_rules.d.ts +7 -3
  67. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  68. package/lib/tsconfig.tsbuildinfo +1 -1
  69. package/package.json +11 -11
@@ -25,6 +25,10 @@ class FixedAmountPromotions extends ApiResource {
25
25
  const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
26
26
  return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/coupon_codes_promotion_rule`, params, options);
27
27
  }
28
+ async coupons(fixedAmountPromotionId, params, options) {
29
+ const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
30
+ return this.resources.fetch({ type: 'coupons' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/coupons`, params, options);
31
+ }
28
32
  async sku_list(fixedAmountPromotionId, params, options) {
29
33
  const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
30
34
  return this.resources.fetch({ type: 'sku_lists' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/sku_list`, params, options);
@@ -45,6 +49,16 @@ class FixedAmountPromotions extends ApiResource {
45
49
  const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
46
50
  return this.resources.fetch({ type: 'versions' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/versions`, params, options);
47
51
  }
52
+ async skus(fixedAmountPromotionId, params, options) {
53
+ const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
54
+ return this.resources.fetch({ type: 'skus' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/skus`, params, options);
55
+ }
56
+ async _disable(id, params, options) {
57
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FixedAmountPromotions.TYPE, _disable: true }, params, options);
58
+ }
59
+ async _enable(id, params, options) {
60
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FixedAmountPromotions.TYPE, _enable: true }, params, options);
61
+ }
48
62
  isFixedAmountPromotion(resource) {
49
63
  return resource.type && (resource.type === FixedAmountPromotions.TYPE);
50
64
  }
@@ -6,6 +6,7 @@ import type { PromotionRule, PromotionRuleType } from './promotion_rules';
6
6
  import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
7
7
  import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
8
8
  import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
9
+ import type { Coupon, CouponType } from './coupons';
9
10
  import type { SkuList, SkuListType } from './sku_lists';
10
11
  import type { Attachment } from './attachments';
11
12
  import type { Event } from './events';
@@ -31,6 +32,9 @@ type SkuListPromotionRuleRel = ResourceRel & {
31
32
  type CouponCodesPromotionRuleRel = ResourceRel & {
32
33
  type: CouponCodesPromotionRuleType;
33
34
  };
35
+ type CouponRel = ResourceRel & {
36
+ type: CouponType;
37
+ };
34
38
  type SkuListRel = ResourceRel & {
35
39
  type: SkuListType;
36
40
  };
@@ -41,11 +45,14 @@ interface FixedPricePromotion extends Resource {
41
45
  readonly type: FixedPricePromotionType;
42
46
  name: string;
43
47
  currency_code?: string | null;
48
+ exclusive?: boolean | null;
49
+ priority?: number | null;
44
50
  starts_at: string;
45
51
  expires_at: string;
46
52
  total_usage_limit: number;
47
53
  total_usage_count?: number | null;
48
54
  active?: boolean | null;
55
+ disabled_at?: string | null;
49
56
  fixed_amount_cents: number;
50
57
  fixed_amount_float?: number | null;
51
58
  formatted_fixed_amount?: string | null;
@@ -54,6 +61,7 @@ interface FixedPricePromotion extends Resource {
54
61
  order_amount_promotion_rule?: OrderAmountPromotionRule | null;
55
62
  sku_list_promotion_rule?: SkuListPromotionRule | null;
56
63
  coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
64
+ coupons?: Coupon[] | null;
57
65
  sku_list?: SkuList | null;
58
66
  attachments?: Attachment[] | null;
59
67
  events?: Event[] | null;
@@ -64,6 +72,8 @@ interface FixedPricePromotion extends Resource {
64
72
  interface FixedPricePromotionCreate extends ResourceCreate {
65
73
  name: string;
66
74
  currency_code?: string | null;
75
+ exclusive?: boolean | null;
76
+ priority?: number | null;
67
77
  starts_at: string;
68
78
  expires_at: string;
69
79
  total_usage_limit: number;
@@ -73,21 +83,27 @@ interface FixedPricePromotionCreate extends ResourceCreate {
73
83
  order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
74
84
  sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
75
85
  coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
86
+ coupons?: CouponRel[] | null;
76
87
  sku_list: SkuListRel;
77
88
  tags?: TagRel[] | null;
78
89
  }
79
90
  interface FixedPricePromotionUpdate extends ResourceUpdate {
80
91
  name?: string | null;
81
92
  currency_code?: string | null;
93
+ exclusive?: boolean | null;
94
+ priority?: number | null;
82
95
  starts_at?: string | null;
83
96
  expires_at?: string | null;
84
97
  total_usage_limit?: number | null;
98
+ _disable?: boolean | null;
99
+ _enable?: boolean | null;
85
100
  fixed_amount_cents?: number | null;
86
101
  market?: MarketRel | null;
87
102
  promotion_rules?: PromotionRuleRel[] | null;
88
103
  order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
89
104
  sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
90
105
  coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
106
+ coupons?: CouponRel[] | null;
91
107
  sku_list?: SkuListRel | null;
92
108
  tags?: TagRel[] | null;
93
109
  }
@@ -100,12 +116,15 @@ declare class FixedPricePromotions extends ApiResource<FixedPricePromotion> {
100
116
  order_amount_promotion_rule(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
101
117
  sku_list_promotion_rule(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
102
118
  coupon_codes_promotion_rule(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
119
+ coupons(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
103
120
  sku_list(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
104
121
  attachments(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
105
122
  events(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
106
123
  tags(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
107
124
  versions(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
108
125
  skus(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
126
+ _disable(id: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FixedPricePromotion>;
127
+ _enable(id: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FixedPricePromotion>;
109
128
  isFixedPricePromotion(resource: any): resource is FixedPricePromotion;
110
129
  relationship(id: string | ResourceId | null): FixedPricePromotionRel;
111
130
  type(): FixedPricePromotionType;
@@ -25,6 +25,10 @@ class FixedPricePromotions extends ApiResource {
25
25
  const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
26
26
  return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `fixed_price_promotions/${_fixedPricePromotionId}/coupon_codes_promotion_rule`, params, options);
27
27
  }
28
+ async coupons(fixedPricePromotionId, params, options) {
29
+ const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
30
+ return this.resources.fetch({ type: 'coupons' }, `fixed_price_promotions/${_fixedPricePromotionId}/coupons`, params, options);
31
+ }
28
32
  async sku_list(fixedPricePromotionId, params, options) {
29
33
  const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
30
34
  return this.resources.fetch({ type: 'sku_lists' }, `fixed_price_promotions/${_fixedPricePromotionId}/sku_list`, params, options);
@@ -49,6 +53,12 @@ class FixedPricePromotions extends ApiResource {
49
53
  const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
50
54
  return this.resources.fetch({ type: 'skus' }, `fixed_price_promotions/${_fixedPricePromotionId}/skus`, params, options);
51
55
  }
56
+ async _disable(id, params, options) {
57
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FixedPricePromotions.TYPE, _disable: true }, params, options);
58
+ }
59
+ async _enable(id, params, options) {
60
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FixedPricePromotions.TYPE, _enable: true }, params, options);
61
+ }
52
62
  isFixedPricePromotion(resource) {
53
63
  return resource.type && (resource.type === FixedPricePromotions.TYPE);
54
64
  }
@@ -6,6 +6,7 @@ import type { PromotionRule, PromotionRuleType } from './promotion_rules';
6
6
  import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
7
7
  import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
8
8
  import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
9
+ import type { Coupon, CouponType } from './coupons';
9
10
  import type { SkuList, SkuListType } from './sku_lists';
10
11
  import type { Attachment } from './attachments';
11
12
  import type { Event } from './events';
@@ -31,6 +32,9 @@ type SkuListPromotionRuleRel = ResourceRel & {
31
32
  type CouponCodesPromotionRuleRel = ResourceRel & {
32
33
  type: CouponCodesPromotionRuleType;
33
34
  };
35
+ type CouponRel = ResourceRel & {
36
+ type: CouponType;
37
+ };
34
38
  type SkuListRel = ResourceRel & {
35
39
  type: SkuListType;
36
40
  };
@@ -41,17 +45,21 @@ interface FreeGiftPromotion extends Resource {
41
45
  readonly type: FreeGiftPromotionType;
42
46
  name: string;
43
47
  currency_code?: string | null;
48
+ exclusive?: boolean | null;
49
+ priority?: number | null;
44
50
  starts_at: string;
45
51
  expires_at: string;
46
52
  total_usage_limit: number;
47
53
  total_usage_count?: number | null;
48
54
  active?: boolean | null;
55
+ disabled_at?: string | null;
49
56
  max_quantity?: number | null;
50
57
  market?: Market | null;
51
58
  promotion_rules?: PromotionRule[] | null;
52
59
  order_amount_promotion_rule?: OrderAmountPromotionRule | null;
53
60
  sku_list_promotion_rule?: SkuListPromotionRule | null;
54
61
  coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
62
+ coupons?: Coupon[] | null;
55
63
  sku_list?: SkuList | null;
56
64
  attachments?: Attachment[] | null;
57
65
  events?: Event[] | null;
@@ -62,6 +70,8 @@ interface FreeGiftPromotion extends Resource {
62
70
  interface FreeGiftPromotionCreate extends ResourceCreate {
63
71
  name: string;
64
72
  currency_code?: string | null;
73
+ exclusive?: boolean | null;
74
+ priority?: number | null;
65
75
  starts_at: string;
66
76
  expires_at: string;
67
77
  total_usage_limit: number;
@@ -71,21 +81,27 @@ interface FreeGiftPromotionCreate extends ResourceCreate {
71
81
  order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
72
82
  sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
73
83
  coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
84
+ coupons?: CouponRel[] | null;
74
85
  sku_list: SkuListRel;
75
86
  tags?: TagRel[] | null;
76
87
  }
77
88
  interface FreeGiftPromotionUpdate extends ResourceUpdate {
78
89
  name?: string | null;
79
90
  currency_code?: string | null;
91
+ exclusive?: boolean | null;
92
+ priority?: number | null;
80
93
  starts_at?: string | null;
81
94
  expires_at?: string | null;
82
95
  total_usage_limit?: number | null;
96
+ _disable?: boolean | null;
97
+ _enable?: boolean | null;
83
98
  max_quantity?: number | null;
84
99
  market?: MarketRel | null;
85
100
  promotion_rules?: PromotionRuleRel[] | null;
86
101
  order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
87
102
  sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
88
103
  coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
104
+ coupons?: CouponRel[] | null;
89
105
  sku_list?: SkuListRel | null;
90
106
  tags?: TagRel[] | null;
91
107
  }
@@ -98,12 +114,15 @@ declare class FreeGiftPromotions extends ApiResource<FreeGiftPromotion> {
98
114
  order_amount_promotion_rule(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
99
115
  sku_list_promotion_rule(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
100
116
  coupon_codes_promotion_rule(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
117
+ coupons(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
101
118
  sku_list(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
102
119
  attachments(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
103
120
  events(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
104
121
  tags(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
105
122
  versions(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
106
123
  skus(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
124
+ _disable(id: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FreeGiftPromotion>;
125
+ _enable(id: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FreeGiftPromotion>;
107
126
  isFreeGiftPromotion(resource: any): resource is FreeGiftPromotion;
108
127
  relationship(id: string | ResourceId | null): FreeGiftPromotionRel;
109
128
  type(): FreeGiftPromotionType;
@@ -25,6 +25,10 @@ class FreeGiftPromotions extends ApiResource {
25
25
  const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
26
26
  return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `free_gift_promotions/${_freeGiftPromotionId}/coupon_codes_promotion_rule`, params, options);
27
27
  }
28
+ async coupons(freeGiftPromotionId, params, options) {
29
+ const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
30
+ return this.resources.fetch({ type: 'coupons' }, `free_gift_promotions/${_freeGiftPromotionId}/coupons`, params, options);
31
+ }
28
32
  async sku_list(freeGiftPromotionId, params, options) {
29
33
  const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
30
34
  return this.resources.fetch({ type: 'sku_lists' }, `free_gift_promotions/${_freeGiftPromotionId}/sku_list`, params, options);
@@ -49,6 +53,12 @@ class FreeGiftPromotions extends ApiResource {
49
53
  const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
50
54
  return this.resources.fetch({ type: 'skus' }, `free_gift_promotions/${_freeGiftPromotionId}/skus`, params, options);
51
55
  }
56
+ async _disable(id, params, options) {
57
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FreeGiftPromotions.TYPE, _disable: true }, params, options);
58
+ }
59
+ async _enable(id, params, options) {
60
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FreeGiftPromotions.TYPE, _enable: true }, params, options);
61
+ }
52
62
  isFreeGiftPromotion(resource) {
53
63
  return resource.type && (resource.type === FreeGiftPromotions.TYPE);
54
64
  }
@@ -6,6 +6,7 @@ import type { PromotionRule, PromotionRuleType } from './promotion_rules';
6
6
  import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
7
7
  import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
8
8
  import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
9
+ import type { Coupon, CouponType } from './coupons';
9
10
  import type { SkuList } from './sku_lists';
10
11
  import type { Attachment } from './attachments';
11
12
  import type { Event } from './events';
@@ -30,6 +31,9 @@ type SkuListPromotionRuleRel = ResourceRel & {
30
31
  type CouponCodesPromotionRuleRel = ResourceRel & {
31
32
  type: CouponCodesPromotionRuleType;
32
33
  };
34
+ type CouponRel = ResourceRel & {
35
+ type: CouponType;
36
+ };
33
37
  type TagRel = ResourceRel & {
34
38
  type: TagType;
35
39
  };
@@ -37,16 +41,20 @@ interface FreeShippingPromotion extends Resource {
37
41
  readonly type: FreeShippingPromotionType;
38
42
  name: string;
39
43
  currency_code?: string | null;
44
+ exclusive?: boolean | null;
45
+ priority?: number | null;
40
46
  starts_at: string;
41
47
  expires_at: string;
42
48
  total_usage_limit: number;
43
49
  total_usage_count?: number | null;
44
50
  active?: boolean | null;
51
+ disabled_at?: string | null;
45
52
  market?: Market | null;
46
53
  promotion_rules?: PromotionRule[] | null;
47
54
  order_amount_promotion_rule?: OrderAmountPromotionRule | null;
48
55
  sku_list_promotion_rule?: SkuListPromotionRule | null;
49
56
  coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
57
+ coupons?: Coupon[] | null;
50
58
  sku_list?: SkuList | null;
51
59
  attachments?: Attachment[] | null;
52
60
  events?: Event[] | null;
@@ -56,6 +64,8 @@ interface FreeShippingPromotion extends Resource {
56
64
  interface FreeShippingPromotionCreate extends ResourceCreate {
57
65
  name: string;
58
66
  currency_code?: string | null;
67
+ exclusive?: boolean | null;
68
+ priority?: number | null;
59
69
  starts_at: string;
60
70
  expires_at: string;
61
71
  total_usage_limit: number;
@@ -64,19 +74,25 @@ interface FreeShippingPromotionCreate extends ResourceCreate {
64
74
  order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
65
75
  sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
66
76
  coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
77
+ coupons?: CouponRel[] | null;
67
78
  tags?: TagRel[] | null;
68
79
  }
69
80
  interface FreeShippingPromotionUpdate extends ResourceUpdate {
70
81
  name?: string | null;
71
82
  currency_code?: string | null;
83
+ exclusive?: boolean | null;
84
+ priority?: number | null;
72
85
  starts_at?: string | null;
73
86
  expires_at?: string | null;
74
87
  total_usage_limit?: number | null;
88
+ _disable?: boolean | null;
89
+ _enable?: boolean | null;
75
90
  market?: MarketRel | null;
76
91
  promotion_rules?: PromotionRuleRel[] | null;
77
92
  order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
78
93
  sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
79
94
  coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
95
+ coupons?: CouponRel[] | null;
80
96
  tags?: TagRel[] | null;
81
97
  }
82
98
  declare class FreeShippingPromotions extends ApiResource<FreeShippingPromotion> {
@@ -88,11 +104,14 @@ declare class FreeShippingPromotions extends ApiResource<FreeShippingPromotion>
88
104
  order_amount_promotion_rule(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
89
105
  sku_list_promotion_rule(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
90
106
  coupon_codes_promotion_rule(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
107
+ coupons(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
91
108
  sku_list(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
92
109
  attachments(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
93
110
  events(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
94
111
  tags(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
95
112
  versions(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
113
+ _disable(id: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FreeShippingPromotion>;
114
+ _enable(id: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FreeShippingPromotion>;
96
115
  isFreeShippingPromotion(resource: any): resource is FreeShippingPromotion;
97
116
  relationship(id: string | ResourceId | null): FreeShippingPromotionRel;
98
117
  type(): FreeShippingPromotionType;
@@ -25,6 +25,10 @@ class FreeShippingPromotions extends ApiResource {
25
25
  const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
26
26
  return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `free_shipping_promotions/${_freeShippingPromotionId}/coupon_codes_promotion_rule`, params, options);
27
27
  }
28
+ async coupons(freeShippingPromotionId, params, options) {
29
+ const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
30
+ return this.resources.fetch({ type: 'coupons' }, `free_shipping_promotions/${_freeShippingPromotionId}/coupons`, params, options);
31
+ }
28
32
  async sku_list(freeShippingPromotionId, params, options) {
29
33
  const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
30
34
  return this.resources.fetch({ type: 'sku_lists' }, `free_shipping_promotions/${_freeShippingPromotionId}/sku_list`, params, options);
@@ -45,6 +49,12 @@ class FreeShippingPromotions extends ApiResource {
45
49
  const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
46
50
  return this.resources.fetch({ type: 'versions' }, `free_shipping_promotions/${_freeShippingPromotionId}/versions`, params, options);
47
51
  }
52
+ async _disable(id, params, options) {
53
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FreeShippingPromotions.TYPE, _disable: true }, params, options);
54
+ }
55
+ async _enable(id, params, options) {
56
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FreeShippingPromotions.TYPE, _enable: true }, params, options);
57
+ }
48
58
  isFreeShippingPromotion(resource) {
49
59
  return resource.type && (resource.type === FreeShippingPromotions.TYPE);
50
60
  }
@@ -9,6 +9,7 @@ type ImportRel = ResourceRel & {
9
9
  interface Import extends Resource {
10
10
  readonly type: ImportType;
11
11
  resource_type: string;
12
+ format?: string | null;
12
13
  parent_resource_id?: string | null;
13
14
  status: 'pending' | 'in_progress' | 'interrupted' | 'completed';
14
15
  started_at?: string | null;
@@ -21,6 +22,7 @@ interface Import extends Resource {
21
22
  processed_count?: number | null;
22
23
  errors_log?: Record<string, any> | null;
23
24
  warnings_log?: Record<string, any> | null;
25
+ cleanup_records?: boolean | null;
24
26
  attachment_url?: string | null;
25
27
  events?: Event[] | null;
26
28
  }
@@ -29,6 +31,7 @@ interface ImportCreate extends ResourceCreate {
29
31
  format?: string | null;
30
32
  parent_resource_id?: string | null;
31
33
  inputs: Array<Record<string, any>>;
34
+ cleanup_records?: boolean | null;
32
35
  }
33
36
  declare class Imports extends ApiResource<Import> {
34
37
  static readonly TYPE: ImportType;
@@ -86,8 +86,11 @@ interface LineItem extends Resource {
86
86
  tax_breakdown?: Record<string, any> | null;
87
87
  item_type?: 'skus' | 'bundles' | 'shipments' | 'payment_methods' | 'adjustments' | 'gift_cards' | 'percentage_discount_promotions' | 'free_shipping_promotions' | 'free_gift_promotions' | 'fixed_price_promotions' | 'external_promotions' | 'fixed_amount_promotions' | null;
88
88
  frequency?: string | null;
89
+ coupon_code?: string | null;
89
90
  order?: Order | null;
90
91
  item?: Adjustment | Bundle | ExternalPromotion | FixedAmountPromotion | FreeShippingPromotion | GiftCard | PaymentMethod | PercentageDiscountPromotion | Shipment | Sku | null;
92
+ sku?: Sku | null;
93
+ bundle?: Bundle | null;
91
94
  line_item_options?: LineItemOption[] | null;
92
95
  /**
93
96
  * @deprecated This field should not be used as it may be removed in the future without notice
@@ -113,6 +116,8 @@ interface LineItemCreate extends ResourceCreate {
113
116
  frequency?: string | null;
114
117
  order: OrderRel;
115
118
  item?: AdjustmentRel | BundleRel | ExternalPromotionRel | FixedAmountPromotionRel | FreeShippingPromotionRel | GiftCardRel | PaymentMethodRel | PercentageDiscountPromotionRel | ShipmentRel | SkuRel | null;
119
+ sku?: SkuRel | null;
120
+ bundle?: BundleRel | null;
116
121
  tags?: TagRel[] | null;
117
122
  }
118
123
  interface LineItemUpdate extends ResourceUpdate {
@@ -3,6 +3,7 @@ import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesCon
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { PercentageDiscountPromotion, PercentageDiscountPromotionType } from './percentage_discount_promotions';
5
5
  import type { FreeShippingPromotion, FreeShippingPromotionType } from './free_shipping_promotions';
6
+ import type { BuyXPayYPromotion, BuyXPayYPromotionType } from './buy_x_pay_y_promotions';
6
7
  import type { FreeGiftPromotion, FreeGiftPromotionType } from './free_gift_promotions';
7
8
  import type { FixedPricePromotion, FixedPricePromotionType } from './fixed_price_promotions';
8
9
  import type { ExternalPromotion, ExternalPromotionType } from './external_promotions';
@@ -18,6 +19,9 @@ type PercentageDiscountPromotionRel = ResourceRel & {
18
19
  type FreeShippingPromotionRel = ResourceRel & {
19
20
  type: FreeShippingPromotionType;
20
21
  };
22
+ type BuyXPayYPromotionRel = ResourceRel & {
23
+ type: BuyXPayYPromotionType;
24
+ };
21
25
  type FreeGiftPromotionRel = ResourceRel & {
22
26
  type: FreeGiftPromotionType;
23
27
  };
@@ -36,18 +40,18 @@ interface OrderAmountPromotionRule extends Resource {
36
40
  order_amount_float?: number | null;
37
41
  formatted_order_amount?: string | null;
38
42
  use_subtotal?: boolean | null;
39
- promotion?: PercentageDiscountPromotion | FreeShippingPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion | FixedAmountPromotion | null;
43
+ promotion?: PercentageDiscountPromotion | FreeShippingPromotion | BuyXPayYPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion | FixedAmountPromotion | null;
40
44
  versions?: Version[] | null;
41
45
  }
42
46
  interface OrderAmountPromotionRuleCreate extends ResourceCreate {
43
47
  order_amount_cents?: number | null;
44
48
  use_subtotal?: boolean | null;
45
- promotion: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel | FixedAmountPromotionRel;
49
+ promotion: PercentageDiscountPromotionRel | FreeShippingPromotionRel | BuyXPayYPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel | FixedAmountPromotionRel;
46
50
  }
47
51
  interface OrderAmountPromotionRuleUpdate extends ResourceUpdate {
48
52
  order_amount_cents?: number | null;
49
53
  use_subtotal?: boolean | null;
50
- promotion?: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel | FixedAmountPromotionRel | null;
54
+ promotion?: PercentageDiscountPromotionRel | FreeShippingPromotionRel | BuyXPayYPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel | FixedAmountPromotionRel | null;
51
55
  }
52
56
  declare class OrderAmountPromotionRules extends ApiResource<OrderAmountPromotionRule> {
53
57
  static readonly TYPE: OrderAmountPromotionRuleType;
@@ -33,6 +33,8 @@ interface OrderSubscriptionItem extends Resource {
33
33
  formatted_total_amount?: string | null;
34
34
  order_subscription?: OrderSubscription | null;
35
35
  item?: Adjustment | Bundle | Sku | null;
36
+ sku?: Sku | null;
37
+ bundle?: Bundle | null;
36
38
  source_line_item?: LineItem | null;
37
39
  }
38
40
  interface OrderSubscriptionItemCreate extends ResourceCreate {
@@ -42,6 +44,8 @@ interface OrderSubscriptionItemCreate extends ResourceCreate {
42
44
  unit_amount_cents?: number | null;
43
45
  order_subscription: OrderSubscriptionRel;
44
46
  item: AdjustmentRel | BundleRel | SkuRel;
47
+ sku?: SkuRel | null;
48
+ bundle?: BundleRel | null;
45
49
  }
46
50
  interface OrderSubscriptionItemUpdate extends ResourceUpdate {
47
51
  sku_code?: string | null;
@@ -19,6 +19,10 @@ import type { SatispayPayment, SatispayPaymentType } from './satispay_payments';
19
19
  import type { StripePayment, StripePaymentType } from './stripe_payments';
20
20
  import type { WireTransfer, WireTransferType } from './wire_transfers';
21
21
  import type { LineItem } from './line_items';
22
+ import type { LineItemOption } from './line_item_options';
23
+ import type { StockReservation } from './stock_reservations';
24
+ import type { StockLineItem } from './stock_line_items';
25
+ import type { StockTransfer } from './stock_transfers';
22
26
  import type { Shipment } from './shipments';
23
27
  import type { Authorization } from './authorizations';
24
28
  import type { Capture } from './captures';
@@ -97,6 +101,9 @@ interface Order extends Resource {
97
101
  tax_included?: boolean | null;
98
102
  tax_rate?: number | null;
99
103
  freight_taxable?: boolean | null;
104
+ payment_method_taxable?: boolean | null;
105
+ adjustment_taxable?: boolean | null;
106
+ gift_card_taxable?: boolean | null;
100
107
  requires_billing_info?: boolean | null;
101
108
  country_code?: string | null;
102
109
  shipping_country_code_lock?: string | null;
@@ -197,6 +204,10 @@ interface Order extends Resource {
197
204
  payment_method?: PaymentMethod | null;
198
205
  payment_source?: AdyenPayment | AxervePayment | BraintreePayment | CheckoutComPayment | ExternalPayment | KlarnaPayment | PaypalPayment | SatispayPayment | StripePayment | WireTransfer | null;
199
206
  line_items?: LineItem[] | null;
207
+ line_item_options?: LineItemOption[] | null;
208
+ stock_reservations?: StockReservation[] | null;
209
+ stock_line_items?: StockLineItem[] | null;
210
+ stock_transfers?: StockTransfer[] | null;
200
211
  shipments?: Shipment[] | null;
201
212
  transactions?: Array<Authorization | Capture | Void | Refund> | null;
202
213
  authorizations?: Authorization[] | null;
@@ -219,6 +230,10 @@ interface OrderCreate extends ResourceCreate {
219
230
  customer_email?: string | null;
220
231
  customer_password?: string | null;
221
232
  language_code?: string | null;
233
+ freight_taxable?: boolean | null;
234
+ payment_method_taxable?: boolean | null;
235
+ adjustment_taxable?: boolean | null;
236
+ gift_card_taxable?: boolean | null;
222
237
  shipping_country_code_lock?: string | null;
223
238
  coupon_code?: string | null;
224
239
  gift_card_code?: string | null;
@@ -240,6 +255,10 @@ interface OrderUpdate extends ResourceUpdate {
240
255
  customer_email?: string | null;
241
256
  customer_password?: string | null;
242
257
  language_code?: string | null;
258
+ freight_taxable?: boolean | null;
259
+ payment_method_taxable?: boolean | null;
260
+ adjustment_taxable?: boolean | null;
261
+ gift_card_taxable?: boolean | null;
243
262
  shipping_country_code_lock?: string | null;
244
263
  coupon_code?: string | null;
245
264
  gift_card_code?: string | null;
@@ -297,6 +316,10 @@ declare class Orders extends ApiResource<Order> {
297
316
  available_free_bundles(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Bundle>>;
298
317
  payment_method(orderId: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentMethod>;
299
318
  line_items(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<LineItem>>;
319
+ line_item_options(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<LineItemOption>>;
320
+ stock_reservations(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockReservation>>;
321
+ stock_line_items(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockLineItem>>;
322
+ stock_transfers(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockTransfer>>;
300
323
  shipments(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Shipment>>;
301
324
  authorizations(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Authorization>>;
302
325
  captures(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Capture>>;
@@ -49,6 +49,22 @@ class Orders extends ApiResource {
49
49
  const _orderId = orderId.id || orderId;
50
50
  return this.resources.fetch({ type: 'line_items' }, `orders/${_orderId}/line_items`, params, options);
51
51
  }
52
+ async line_item_options(orderId, params, options) {
53
+ const _orderId = orderId.id || orderId;
54
+ return this.resources.fetch({ type: 'line_item_options' }, `orders/${_orderId}/line_item_options`, params, options);
55
+ }
56
+ async stock_reservations(orderId, params, options) {
57
+ const _orderId = orderId.id || orderId;
58
+ return this.resources.fetch({ type: 'stock_reservations' }, `orders/${_orderId}/stock_reservations`, params, options);
59
+ }
60
+ async stock_line_items(orderId, params, options) {
61
+ const _orderId = orderId.id || orderId;
62
+ return this.resources.fetch({ type: 'stock_line_items' }, `orders/${_orderId}/stock_line_items`, params, options);
63
+ }
64
+ async stock_transfers(orderId, params, options) {
65
+ const _orderId = orderId.id || orderId;
66
+ return this.resources.fetch({ type: 'stock_transfers' }, `orders/${_orderId}/stock_transfers`, params, options);
67
+ }
52
68
  async shipments(orderId, params, options) {
53
69
  const _orderId = orderId.id || orderId;
54
70
  return this.resources.fetch({ type: 'shipments' }, `orders/${_orderId}/shipments`, params, options);