@commercelayer/sdk 5.14.0 → 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.
- package/lib/cjs/api.d.ts +9 -7
- package/lib/cjs/api.js +9 -3
- package/lib/cjs/commercelayer.d.ts +4 -2
- package/lib/cjs/commercelayer.js +3 -1
- package/lib/cjs/model.d.ts +2 -0
- package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +137 -0
- package/lib/cjs/resources/buy_x_pay_y_promotions.js +75 -0
- package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +7 -3
- package/lib/cjs/resources/coupons.d.ts +3 -0
- package/lib/cjs/resources/custom_promotion_rules.d.ts +62 -0
- package/lib/cjs/resources/custom_promotion_rules.js +29 -0
- package/lib/cjs/resources/external_promotions.d.ts +20 -1
- package/lib/cjs/resources/external_promotions.js +10 -0
- package/lib/cjs/resources/fixed_amount_promotions.d.ts +20 -1
- package/lib/cjs/resources/fixed_amount_promotions.js +10 -0
- package/lib/cjs/resources/fixed_price_promotions.d.ts +11 -0
- package/lib/cjs/resources/fixed_price_promotions.js +6 -0
- package/lib/cjs/resources/free_gift_promotions.d.ts +11 -0
- package/lib/cjs/resources/free_gift_promotions.js +6 -0
- package/lib/cjs/resources/free_shipping_promotions.d.ts +11 -0
- package/lib/cjs/resources/free_shipping_promotions.js +6 -0
- package/lib/cjs/resources/line_items.d.ts +1 -0
- package/lib/cjs/resources/order_amount_promotion_rules.d.ts +7 -3
- package/lib/cjs/resources/orders.d.ts +21 -0
- package/lib/cjs/resources/orders.js +16 -0
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +11 -0
- package/lib/cjs/resources/percentage_discount_promotions.js +6 -0
- package/lib/cjs/resources/promotion_rules.d.ts +2 -1
- package/lib/cjs/resources/promotions.d.ts +3 -0
- package/lib/cjs/resources/sku_list_promotion_rules.d.ts +7 -3
- package/lib/esm/api.d.ts +9 -7
- package/lib/esm/api.js +4 -0
- package/lib/esm/commercelayer.d.ts +4 -2
- package/lib/esm/commercelayer.js +3 -1
- package/lib/esm/model.d.ts +2 -0
- package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +137 -0
- package/lib/esm/resources/buy_x_pay_y_promotions.js +73 -0
- package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +7 -3
- package/lib/esm/resources/coupons.d.ts +3 -0
- package/lib/esm/resources/custom_promotion_rules.d.ts +62 -0
- package/lib/esm/resources/custom_promotion_rules.js +27 -0
- package/lib/esm/resources/external_promotions.d.ts +20 -1
- package/lib/esm/resources/external_promotions.js +10 -0
- package/lib/esm/resources/fixed_amount_promotions.d.ts +20 -1
- package/lib/esm/resources/fixed_amount_promotions.js +10 -0
- package/lib/esm/resources/fixed_price_promotions.d.ts +11 -0
- package/lib/esm/resources/fixed_price_promotions.js +6 -0
- package/lib/esm/resources/free_gift_promotions.d.ts +11 -0
- package/lib/esm/resources/free_gift_promotions.js +6 -0
- package/lib/esm/resources/free_shipping_promotions.d.ts +11 -0
- package/lib/esm/resources/free_shipping_promotions.js +6 -0
- package/lib/esm/resources/line_items.d.ts +1 -0
- package/lib/esm/resources/order_amount_promotion_rules.d.ts +7 -3
- package/lib/esm/resources/orders.d.ts +21 -0
- package/lib/esm/resources/orders.js +16 -0
- package/lib/esm/resources/percentage_discount_promotions.d.ts +11 -0
- package/lib/esm/resources/percentage_discount_promotions.js +6 -0
- package/lib/esm/resources/promotion_rules.d.ts +2 -1
- package/lib/esm/resources/promotions.d.ts +3 -0
- package/lib/esm/resources/sku_list_promotion_rules.d.ts +7 -3
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const resource_1 = require("../resource");
|
4
|
+
class CustomPromotionRules extends resource_1.ApiResource {
|
5
|
+
async create(resource, params, options) {
|
6
|
+
return this.resources.create({ ...resource, type: CustomPromotionRules.TYPE }, params, options);
|
7
|
+
}
|
8
|
+
async update(resource, params, options) {
|
9
|
+
return this.resources.update({ ...resource, type: CustomPromotionRules.TYPE }, params, options);
|
10
|
+
}
|
11
|
+
async delete(id, options) {
|
12
|
+
await this.resources.delete((typeof id === 'string') ? { id, type: CustomPromotionRules.TYPE } : id, options);
|
13
|
+
}
|
14
|
+
async versions(customPromotionRuleId, params, options) {
|
15
|
+
const _customPromotionRuleId = customPromotionRuleId.id || customPromotionRuleId;
|
16
|
+
return this.resources.fetch({ type: 'versions' }, `custom_promotion_rules/${_customPromotionRuleId}/versions`, params, options);
|
17
|
+
}
|
18
|
+
isCustomPromotionRule(resource) {
|
19
|
+
return resource.type && (resource.type === CustomPromotionRules.TYPE);
|
20
|
+
}
|
21
|
+
relationship(id) {
|
22
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: CustomPromotionRules.TYPE } : { id: id.id, type: CustomPromotionRules.TYPE };
|
23
|
+
}
|
24
|
+
type() {
|
25
|
+
return CustomPromotionRules.TYPE;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
CustomPromotionRules.TYPE = 'custom_promotion_rules';
|
29
|
+
exports.default = CustomPromotionRules;
|
@@ -7,11 +7,12 @@ import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './o
|
|
7
7
|
import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
|
8
8
|
import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
|
9
9
|
import type { Coupon, CouponType } from './coupons';
|
10
|
-
import type { SkuList } from './sku_lists';
|
10
|
+
import type { SkuList, SkuListType } from './sku_lists';
|
11
11
|
import type { Attachment } from './attachments';
|
12
12
|
import type { Event } from './events';
|
13
13
|
import type { Tag, TagType } from './tags';
|
14
14
|
import type { Version } from './versions';
|
15
|
+
import type { Sku } from './skus';
|
15
16
|
type ExternalPromotionType = 'external_promotions';
|
16
17
|
type ExternalPromotionRel = ResourceRel & {
|
17
18
|
type: ExternalPromotionType;
|
@@ -34,6 +35,9 @@ type CouponCodesPromotionRuleRel = ResourceRel & {
|
|
34
35
|
type CouponRel = ResourceRel & {
|
35
36
|
type: CouponType;
|
36
37
|
};
|
38
|
+
type SkuListRel = ResourceRel & {
|
39
|
+
type: SkuListType;
|
40
|
+
};
|
37
41
|
type TagRel = ResourceRel & {
|
38
42
|
type: TagType;
|
39
43
|
};
|
@@ -41,11 +45,14 @@ interface ExternalPromotion extends Resource {
|
|
41
45
|
readonly type: ExternalPromotionType;
|
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
|
promotion_url: string;
|
50
57
|
shared_secret: string;
|
51
58
|
market?: Market | null;
|
@@ -59,10 +66,13 @@ interface ExternalPromotion extends Resource {
|
|
59
66
|
events?: Event[] | null;
|
60
67
|
tags?: Tag[] | null;
|
61
68
|
versions?: Version[] | null;
|
69
|
+
skus?: Sku[] | null;
|
62
70
|
}
|
63
71
|
interface ExternalPromotionCreate extends ResourceCreate {
|
64
72
|
name: string;
|
65
73
|
currency_code?: string | null;
|
74
|
+
exclusive?: boolean | null;
|
75
|
+
priority?: number | null;
|
66
76
|
starts_at: string;
|
67
77
|
expires_at: string;
|
68
78
|
total_usage_limit: number;
|
@@ -73,14 +83,19 @@ interface ExternalPromotionCreate extends ResourceCreate {
|
|
73
83
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
74
84
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
75
85
|
coupons?: CouponRel[] | null;
|
86
|
+
sku_list?: SkuListRel | null;
|
76
87
|
tags?: TagRel[] | null;
|
77
88
|
}
|
78
89
|
interface ExternalPromotionUpdate extends ResourceUpdate {
|
79
90
|
name?: string | null;
|
80
91
|
currency_code?: string | null;
|
92
|
+
exclusive?: boolean | null;
|
93
|
+
priority?: number | null;
|
81
94
|
starts_at?: string | null;
|
82
95
|
expires_at?: string | null;
|
83
96
|
total_usage_limit?: number | null;
|
97
|
+
_disable?: boolean | null;
|
98
|
+
_enable?: boolean | null;
|
84
99
|
promotion_url?: string | null;
|
85
100
|
market?: MarketRel | null;
|
86
101
|
promotion_rules?: PromotionRuleRel[] | null;
|
@@ -88,6 +103,7 @@ interface ExternalPromotionUpdate extends ResourceUpdate {
|
|
88
103
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
89
104
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
90
105
|
coupons?: CouponRel[] | null;
|
106
|
+
sku_list?: SkuListRel | null;
|
91
107
|
tags?: TagRel[] | null;
|
92
108
|
}
|
93
109
|
declare class ExternalPromotions extends ApiResource<ExternalPromotion> {
|
@@ -105,6 +121,9 @@ declare class ExternalPromotions extends ApiResource<ExternalPromotion> {
|
|
105
121
|
events(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
106
122
|
tags(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
107
123
|
versions(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
124
|
+
skus(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
125
|
+
_disable(id: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalPromotion>;
|
126
|
+
_enable(id: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalPromotion>;
|
108
127
|
isExternalPromotion(resource: any): resource is ExternalPromotion;
|
109
128
|
relationship(id: string | ResourceId | null): ExternalPromotionRel;
|
110
129
|
type(): ExternalPromotionType;
|
@@ -51,6 +51,16 @@ class ExternalPromotions extends resource_1.ApiResource {
|
|
51
51
|
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
52
52
|
return this.resources.fetch({ type: 'versions' }, `external_promotions/${_externalPromotionId}/versions`, params, options);
|
53
53
|
}
|
54
|
+
async skus(externalPromotionId, params, options) {
|
55
|
+
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
56
|
+
return this.resources.fetch({ type: 'skus' }, `external_promotions/${_externalPromotionId}/skus`, params, options);
|
57
|
+
}
|
58
|
+
async _disable(id, params, options) {
|
59
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalPromotions.TYPE, _disable: true }, params, options);
|
60
|
+
}
|
61
|
+
async _enable(id, params, options) {
|
62
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalPromotions.TYPE, _enable: true }, params, options);
|
63
|
+
}
|
54
64
|
isExternalPromotion(resource) {
|
55
65
|
return resource.type && (resource.type === ExternalPromotions.TYPE);
|
56
66
|
}
|
@@ -7,11 +7,12 @@ import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './o
|
|
7
7
|
import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
|
8
8
|
import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
|
9
9
|
import type { Coupon, CouponType } from './coupons';
|
10
|
-
import type { SkuList } from './sku_lists';
|
10
|
+
import type { SkuList, SkuListType } from './sku_lists';
|
11
11
|
import type { Attachment } from './attachments';
|
12
12
|
import type { Event } from './events';
|
13
13
|
import type { Tag, TagType } from './tags';
|
14
14
|
import type { Version } from './versions';
|
15
|
+
import type { Sku } from './skus';
|
15
16
|
type FixedAmountPromotionType = 'fixed_amount_promotions';
|
16
17
|
type FixedAmountPromotionRel = ResourceRel & {
|
17
18
|
type: FixedAmountPromotionType;
|
@@ -34,6 +35,9 @@ type CouponCodesPromotionRuleRel = ResourceRel & {
|
|
34
35
|
type CouponRel = ResourceRel & {
|
35
36
|
type: CouponType;
|
36
37
|
};
|
38
|
+
type SkuListRel = ResourceRel & {
|
39
|
+
type: SkuListType;
|
40
|
+
};
|
37
41
|
type TagRel = ResourceRel & {
|
38
42
|
type: TagType;
|
39
43
|
};
|
@@ -41,11 +45,14 @@ interface FixedAmountPromotion extends Resource {
|
|
41
45
|
readonly type: FixedAmountPromotionType;
|
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;
|
@@ -60,10 +67,13 @@ interface FixedAmountPromotion extends Resource {
|
|
60
67
|
events?: Event[] | null;
|
61
68
|
tags?: Tag[] | null;
|
62
69
|
versions?: Version[] | null;
|
70
|
+
skus?: Sku[] | null;
|
63
71
|
}
|
64
72
|
interface FixedAmountPromotionCreate 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;
|
@@ -74,14 +84,19 @@ interface FixedAmountPromotionCreate extends ResourceCreate {
|
|
74
84
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
75
85
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
76
86
|
coupons?: CouponRel[] | null;
|
87
|
+
sku_list?: SkuListRel | null;
|
77
88
|
tags?: TagRel[] | null;
|
78
89
|
}
|
79
90
|
interface FixedAmountPromotionUpdate 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;
|
@@ -89,6 +104,7 @@ interface FixedAmountPromotionUpdate extends ResourceUpdate {
|
|
89
104
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
90
105
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
91
106
|
coupons?: CouponRel[] | null;
|
107
|
+
sku_list?: SkuListRel | null;
|
92
108
|
tags?: TagRel[] | null;
|
93
109
|
}
|
94
110
|
declare class FixedAmountPromotions extends ApiResource<FixedAmountPromotion> {
|
@@ -106,6 +122,9 @@ declare class FixedAmountPromotions extends ApiResource<FixedAmountPromotion> {
|
|
106
122
|
events(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
107
123
|
tags(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
108
124
|
versions(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
125
|
+
skus(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
126
|
+
_disable(id: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FixedAmountPromotion>;
|
127
|
+
_enable(id: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FixedAmountPromotion>;
|
109
128
|
isFixedAmountPromotion(resource: any): resource is FixedAmountPromotion;
|
110
129
|
relationship(id: string | ResourceId | null): FixedAmountPromotionRel;
|
111
130
|
type(): FixedAmountPromotionType;
|
@@ -51,6 +51,16 @@ class FixedAmountPromotions extends resource_1.ApiResource {
|
|
51
51
|
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
|
52
52
|
return this.resources.fetch({ type: 'versions' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/versions`, params, options);
|
53
53
|
}
|
54
|
+
async skus(fixedAmountPromotionId, params, options) {
|
55
|
+
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
|
56
|
+
return this.resources.fetch({ type: 'skus' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/skus`, params, options);
|
57
|
+
}
|
58
|
+
async _disable(id, params, options) {
|
59
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FixedAmountPromotions.TYPE, _disable: true }, params, options);
|
60
|
+
}
|
61
|
+
async _enable(id, params, options) {
|
62
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FixedAmountPromotions.TYPE, _enable: true }, params, options);
|
63
|
+
}
|
54
64
|
isFixedAmountPromotion(resource) {
|
55
65
|
return resource.type && (resource.type === FixedAmountPromotions.TYPE);
|
56
66
|
}
|
@@ -45,11 +45,14 @@ interface FixedPricePromotion extends Resource {
|
|
45
45
|
readonly type: FixedPricePromotionType;
|
46
46
|
name: string;
|
47
47
|
currency_code?: string | null;
|
48
|
+
exclusive?: boolean | null;
|
49
|
+
priority?: number | null;
|
48
50
|
starts_at: string;
|
49
51
|
expires_at: string;
|
50
52
|
total_usage_limit: number;
|
51
53
|
total_usage_count?: number | null;
|
52
54
|
active?: boolean | null;
|
55
|
+
disabled_at?: string | null;
|
53
56
|
fixed_amount_cents: number;
|
54
57
|
fixed_amount_float?: number | null;
|
55
58
|
formatted_fixed_amount?: string | null;
|
@@ -69,6 +72,8 @@ interface FixedPricePromotion extends Resource {
|
|
69
72
|
interface FixedPricePromotionCreate extends ResourceCreate {
|
70
73
|
name: string;
|
71
74
|
currency_code?: string | null;
|
75
|
+
exclusive?: boolean | null;
|
76
|
+
priority?: number | null;
|
72
77
|
starts_at: string;
|
73
78
|
expires_at: string;
|
74
79
|
total_usage_limit: number;
|
@@ -85,9 +90,13 @@ interface FixedPricePromotionCreate extends ResourceCreate {
|
|
85
90
|
interface FixedPricePromotionUpdate extends ResourceUpdate {
|
86
91
|
name?: string | null;
|
87
92
|
currency_code?: string | null;
|
93
|
+
exclusive?: boolean | null;
|
94
|
+
priority?: number | null;
|
88
95
|
starts_at?: string | null;
|
89
96
|
expires_at?: string | null;
|
90
97
|
total_usage_limit?: number | null;
|
98
|
+
_disable?: boolean | null;
|
99
|
+
_enable?: boolean | null;
|
91
100
|
fixed_amount_cents?: number | null;
|
92
101
|
market?: MarketRel | null;
|
93
102
|
promotion_rules?: PromotionRuleRel[] | null;
|
@@ -114,6 +123,8 @@ declare class FixedPricePromotions extends ApiResource<FixedPricePromotion> {
|
|
114
123
|
tags(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
115
124
|
versions(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
116
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>;
|
117
128
|
isFixedPricePromotion(resource: any): resource is FixedPricePromotion;
|
118
129
|
relationship(id: string | ResourceId | null): FixedPricePromotionRel;
|
119
130
|
type(): FixedPricePromotionType;
|
@@ -55,6 +55,12 @@ class FixedPricePromotions extends resource_1.ApiResource {
|
|
55
55
|
const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
|
56
56
|
return this.resources.fetch({ type: 'skus' }, `fixed_price_promotions/${_fixedPricePromotionId}/skus`, params, options);
|
57
57
|
}
|
58
|
+
async _disable(id, params, options) {
|
59
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FixedPricePromotions.TYPE, _disable: true }, params, options);
|
60
|
+
}
|
61
|
+
async _enable(id, params, options) {
|
62
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FixedPricePromotions.TYPE, _enable: true }, params, options);
|
63
|
+
}
|
58
64
|
isFixedPricePromotion(resource) {
|
59
65
|
return resource.type && (resource.type === FixedPricePromotions.TYPE);
|
60
66
|
}
|
@@ -45,11 +45,14 @@ interface FreeGiftPromotion extends Resource {
|
|
45
45
|
readonly type: FreeGiftPromotionType;
|
46
46
|
name: string;
|
47
47
|
currency_code?: string | null;
|
48
|
+
exclusive?: boolean | null;
|
49
|
+
priority?: number | null;
|
48
50
|
starts_at: string;
|
49
51
|
expires_at: string;
|
50
52
|
total_usage_limit: number;
|
51
53
|
total_usage_count?: number | null;
|
52
54
|
active?: boolean | null;
|
55
|
+
disabled_at?: string | null;
|
53
56
|
max_quantity?: number | null;
|
54
57
|
market?: Market | null;
|
55
58
|
promotion_rules?: PromotionRule[] | null;
|
@@ -67,6 +70,8 @@ interface FreeGiftPromotion extends Resource {
|
|
67
70
|
interface FreeGiftPromotionCreate extends ResourceCreate {
|
68
71
|
name: string;
|
69
72
|
currency_code?: string | null;
|
73
|
+
exclusive?: boolean | null;
|
74
|
+
priority?: number | null;
|
70
75
|
starts_at: string;
|
71
76
|
expires_at: string;
|
72
77
|
total_usage_limit: number;
|
@@ -83,9 +88,13 @@ interface FreeGiftPromotionCreate extends ResourceCreate {
|
|
83
88
|
interface FreeGiftPromotionUpdate extends ResourceUpdate {
|
84
89
|
name?: string | null;
|
85
90
|
currency_code?: string | null;
|
91
|
+
exclusive?: boolean | null;
|
92
|
+
priority?: number | null;
|
86
93
|
starts_at?: string | null;
|
87
94
|
expires_at?: string | null;
|
88
95
|
total_usage_limit?: number | null;
|
96
|
+
_disable?: boolean | null;
|
97
|
+
_enable?: boolean | null;
|
89
98
|
max_quantity?: number | null;
|
90
99
|
market?: MarketRel | null;
|
91
100
|
promotion_rules?: PromotionRuleRel[] | null;
|
@@ -112,6 +121,8 @@ declare class FreeGiftPromotions extends ApiResource<FreeGiftPromotion> {
|
|
112
121
|
tags(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
113
122
|
versions(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
114
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>;
|
115
126
|
isFreeGiftPromotion(resource: any): resource is FreeGiftPromotion;
|
116
127
|
relationship(id: string | ResourceId | null): FreeGiftPromotionRel;
|
117
128
|
type(): FreeGiftPromotionType;
|
@@ -55,6 +55,12 @@ class FreeGiftPromotions extends resource_1.ApiResource {
|
|
55
55
|
const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
|
56
56
|
return this.resources.fetch({ type: 'skus' }, `free_gift_promotions/${_freeGiftPromotionId}/skus`, params, options);
|
57
57
|
}
|
58
|
+
async _disable(id, params, options) {
|
59
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FreeGiftPromotions.TYPE, _disable: true }, params, options);
|
60
|
+
}
|
61
|
+
async _enable(id, params, options) {
|
62
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FreeGiftPromotions.TYPE, _enable: true }, params, options);
|
63
|
+
}
|
58
64
|
isFreeGiftPromotion(resource) {
|
59
65
|
return resource.type && (resource.type === FreeGiftPromotions.TYPE);
|
60
66
|
}
|
@@ -41,11 +41,14 @@ interface FreeShippingPromotion extends Resource {
|
|
41
41
|
readonly type: FreeShippingPromotionType;
|
42
42
|
name: string;
|
43
43
|
currency_code?: string | null;
|
44
|
+
exclusive?: boolean | null;
|
45
|
+
priority?: number | null;
|
44
46
|
starts_at: string;
|
45
47
|
expires_at: string;
|
46
48
|
total_usage_limit: number;
|
47
49
|
total_usage_count?: number | null;
|
48
50
|
active?: boolean | null;
|
51
|
+
disabled_at?: string | null;
|
49
52
|
market?: Market | null;
|
50
53
|
promotion_rules?: PromotionRule[] | null;
|
51
54
|
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
@@ -61,6 +64,8 @@ interface FreeShippingPromotion extends Resource {
|
|
61
64
|
interface FreeShippingPromotionCreate extends ResourceCreate {
|
62
65
|
name: string;
|
63
66
|
currency_code?: string | null;
|
67
|
+
exclusive?: boolean | null;
|
68
|
+
priority?: number | null;
|
64
69
|
starts_at: string;
|
65
70
|
expires_at: string;
|
66
71
|
total_usage_limit: number;
|
@@ -75,9 +80,13 @@ interface FreeShippingPromotionCreate extends ResourceCreate {
|
|
75
80
|
interface FreeShippingPromotionUpdate extends ResourceUpdate {
|
76
81
|
name?: string | null;
|
77
82
|
currency_code?: string | null;
|
83
|
+
exclusive?: boolean | null;
|
84
|
+
priority?: number | null;
|
78
85
|
starts_at?: string | null;
|
79
86
|
expires_at?: string | null;
|
80
87
|
total_usage_limit?: number | null;
|
88
|
+
_disable?: boolean | null;
|
89
|
+
_enable?: boolean | null;
|
81
90
|
market?: MarketRel | null;
|
82
91
|
promotion_rules?: PromotionRuleRel[] | null;
|
83
92
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
@@ -101,6 +110,8 @@ declare class FreeShippingPromotions extends ApiResource<FreeShippingPromotion>
|
|
101
110
|
events(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
102
111
|
tags(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
103
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>;
|
104
115
|
isFreeShippingPromotion(resource: any): resource is FreeShippingPromotion;
|
105
116
|
relationship(id: string | ResourceId | null): FreeShippingPromotionRel;
|
106
117
|
type(): FreeShippingPromotionType;
|
@@ -51,6 +51,12 @@ class FreeShippingPromotions extends resource_1.ApiResource {
|
|
51
51
|
const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
|
52
52
|
return this.resources.fetch({ type: 'versions' }, `free_shipping_promotions/${_freeShippingPromotionId}/versions`, params, options);
|
53
53
|
}
|
54
|
+
async _disable(id, params, options) {
|
55
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FreeShippingPromotions.TYPE, _disable: true }, params, options);
|
56
|
+
}
|
57
|
+
async _enable(id, params, options) {
|
58
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FreeShippingPromotions.TYPE, _enable: true }, params, options);
|
59
|
+
}
|
54
60
|
isFreeShippingPromotion(resource) {
|
55
61
|
return resource.type && (resource.type === FreeShippingPromotions.TYPE);
|
56
62
|
}
|
@@ -86,6 +86,7 @@ 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;
|
91
92
|
sku?: Sku | null;
|
@@ -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;
|
@@ -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;
|
@@ -220,6 +231,9 @@ interface OrderCreate extends ResourceCreate {
|
|
220
231
|
customer_password?: string | null;
|
221
232
|
language_code?: string | null;
|
222
233
|
freight_taxable?: boolean | null;
|
234
|
+
payment_method_taxable?: boolean | null;
|
235
|
+
adjustment_taxable?: boolean | null;
|
236
|
+
gift_card_taxable?: boolean | null;
|
223
237
|
shipping_country_code_lock?: string | null;
|
224
238
|
coupon_code?: string | null;
|
225
239
|
gift_card_code?: string | null;
|
@@ -242,6 +256,9 @@ interface OrderUpdate extends ResourceUpdate {
|
|
242
256
|
customer_password?: string | null;
|
243
257
|
language_code?: string | null;
|
244
258
|
freight_taxable?: boolean | null;
|
259
|
+
payment_method_taxable?: boolean | null;
|
260
|
+
adjustment_taxable?: boolean | null;
|
261
|
+
gift_card_taxable?: boolean | null;
|
245
262
|
shipping_country_code_lock?: string | null;
|
246
263
|
coupon_code?: string | null;
|
247
264
|
gift_card_code?: string | null;
|
@@ -299,6 +316,10 @@ declare class Orders extends ApiResource<Order> {
|
|
299
316
|
available_free_bundles(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Bundle>>;
|
300
317
|
payment_method(orderId: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentMethod>;
|
301
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>>;
|
302
323
|
shipments(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Shipment>>;
|
303
324
|
authorizations(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Authorization>>;
|
304
325
|
captures(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Capture>>;
|
@@ -51,6 +51,22 @@ class Orders extends resource_1.ApiResource {
|
|
51
51
|
const _orderId = orderId.id || orderId;
|
52
52
|
return this.resources.fetch({ type: 'line_items' }, `orders/${_orderId}/line_items`, params, options);
|
53
53
|
}
|
54
|
+
async line_item_options(orderId, params, options) {
|
55
|
+
const _orderId = orderId.id || orderId;
|
56
|
+
return this.resources.fetch({ type: 'line_item_options' }, `orders/${_orderId}/line_item_options`, params, options);
|
57
|
+
}
|
58
|
+
async stock_reservations(orderId, params, options) {
|
59
|
+
const _orderId = orderId.id || orderId;
|
60
|
+
return this.resources.fetch({ type: 'stock_reservations' }, `orders/${_orderId}/stock_reservations`, params, options);
|
61
|
+
}
|
62
|
+
async stock_line_items(orderId, params, options) {
|
63
|
+
const _orderId = orderId.id || orderId;
|
64
|
+
return this.resources.fetch({ type: 'stock_line_items' }, `orders/${_orderId}/stock_line_items`, params, options);
|
65
|
+
}
|
66
|
+
async stock_transfers(orderId, params, options) {
|
67
|
+
const _orderId = orderId.id || orderId;
|
68
|
+
return this.resources.fetch({ type: 'stock_transfers' }, `orders/${_orderId}/stock_transfers`, params, options);
|
69
|
+
}
|
54
70
|
async shipments(orderId, params, options) {
|
55
71
|
const _orderId = orderId.id || orderId;
|
56
72
|
return this.resources.fetch({ type: 'shipments' }, `orders/${_orderId}/shipments`, params, options);
|
@@ -45,11 +45,14 @@ interface PercentageDiscountPromotion extends Resource {
|
|
45
45
|
readonly type: PercentageDiscountPromotionType;
|
46
46
|
name: string;
|
47
47
|
currency_code?: string | null;
|
48
|
+
exclusive?: boolean | null;
|
49
|
+
priority?: number | null;
|
48
50
|
starts_at: string;
|
49
51
|
expires_at: string;
|
50
52
|
total_usage_limit: number;
|
51
53
|
total_usage_count?: number | null;
|
52
54
|
active?: boolean | null;
|
55
|
+
disabled_at?: string | null;
|
53
56
|
percentage: number;
|
54
57
|
market?: Market | null;
|
55
58
|
promotion_rules?: PromotionRule[] | null;
|
@@ -67,6 +70,8 @@ interface PercentageDiscountPromotion extends Resource {
|
|
67
70
|
interface PercentageDiscountPromotionCreate extends ResourceCreate {
|
68
71
|
name: string;
|
69
72
|
currency_code?: string | null;
|
73
|
+
exclusive?: boolean | null;
|
74
|
+
priority?: number | null;
|
70
75
|
starts_at: string;
|
71
76
|
expires_at: string;
|
72
77
|
total_usage_limit: number;
|
@@ -83,9 +88,13 @@ interface PercentageDiscountPromotionCreate extends ResourceCreate {
|
|
83
88
|
interface PercentageDiscountPromotionUpdate extends ResourceUpdate {
|
84
89
|
name?: string | null;
|
85
90
|
currency_code?: string | null;
|
91
|
+
exclusive?: boolean | null;
|
92
|
+
priority?: number | null;
|
86
93
|
starts_at?: string | null;
|
87
94
|
expires_at?: string | null;
|
88
95
|
total_usage_limit?: number | null;
|
96
|
+
_disable?: boolean | null;
|
97
|
+
_enable?: boolean | null;
|
89
98
|
percentage?: number | null;
|
90
99
|
market?: MarketRel | null;
|
91
100
|
promotion_rules?: PromotionRuleRel[] | null;
|
@@ -112,6 +121,8 @@ declare class PercentageDiscountPromotions extends ApiResource<PercentageDiscoun
|
|
112
121
|
tags(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
113
122
|
versions(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
114
123
|
skus(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
124
|
+
_disable(id: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PercentageDiscountPromotion>;
|
125
|
+
_enable(id: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PercentageDiscountPromotion>;
|
115
126
|
isPercentageDiscountPromotion(resource: any): resource is PercentageDiscountPromotion;
|
116
127
|
relationship(id: string | ResourceId | null): PercentageDiscountPromotionRel;
|
117
128
|
type(): PercentageDiscountPromotionType;
|
@@ -55,6 +55,12 @@ class PercentageDiscountPromotions extends resource_1.ApiResource {
|
|
55
55
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
56
56
|
return this.resources.fetch({ type: 'skus' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/skus`, params, options);
|
57
57
|
}
|
58
|
+
async _disable(id, params, options) {
|
59
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: PercentageDiscountPromotions.TYPE, _disable: true }, params, options);
|
60
|
+
}
|
61
|
+
async _enable(id, params, options) {
|
62
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: PercentageDiscountPromotions.TYPE, _enable: true }, params, options);
|
63
|
+
}
|
58
64
|
isPercentageDiscountPromotion(resource) {
|
59
65
|
return resource.type && (resource.type === PercentageDiscountPromotions.TYPE);
|
60
66
|
}
|
@@ -3,6 +3,7 @@ import type { Resource, ResourceId, ResourcesConfig, ResourceRel, ListResponse }
|
|
3
3
|
import type { QueryParamsList } from '../query';
|
4
4
|
import type { PercentageDiscountPromotion } from './percentage_discount_promotions';
|
5
5
|
import type { FreeShippingPromotion } from './free_shipping_promotions';
|
6
|
+
import type { BuyXPayYPromotion } from './buy_x_pay_y_promotions';
|
6
7
|
import type { FreeGiftPromotion } from './free_gift_promotions';
|
7
8
|
import type { FixedPricePromotion } from './fixed_price_promotions';
|
8
9
|
import type { ExternalPromotion } from './external_promotions';
|
@@ -14,7 +15,7 @@ type PromotionRuleRel = ResourceRel & {
|
|
14
15
|
};
|
15
16
|
interface PromotionRule extends Resource {
|
16
17
|
readonly type: PromotionRuleType;
|
17
|
-
promotion?: PercentageDiscountPromotion | FreeShippingPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion | FixedAmountPromotion | null;
|
18
|
+
promotion?: PercentageDiscountPromotion | FreeShippingPromotion | BuyXPayYPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion | FixedAmountPromotion | null;
|
18
19
|
versions?: Version[] | null;
|
19
20
|
}
|
20
21
|
declare class PromotionRules extends ApiResource<PromotionRule> {
|