@commercelayer/sdk 5.31.1 → 5.33.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 +3 -2
- package/lib/cjs/api.js +5 -2
- package/lib/cjs/commercelayer.d.ts +3 -2
- package/lib/cjs/commercelayer.js +2 -1
- package/lib/cjs/model.d.ts +1 -0
- package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +4 -14
- package/lib/cjs/resources/buy_x_pay_y_promotions.js +4 -4
- package/lib/cjs/resources/external_promotions.d.ts +4 -14
- package/lib/cjs/resources/external_promotions.js +4 -4
- package/lib/cjs/resources/fixed_amount_promotions.d.ts +4 -14
- package/lib/cjs/resources/fixed_amount_promotions.js +4 -4
- package/lib/cjs/resources/fixed_price_promotions.d.ts +4 -14
- package/lib/cjs/resources/fixed_price_promotions.js +4 -4
- package/lib/cjs/resources/free_gift_promotions.d.ts +4 -14
- package/lib/cjs/resources/free_gift_promotions.js +4 -4
- package/lib/cjs/resources/free_shipping_promotions.d.ts +9 -14
- package/lib/cjs/resources/free_shipping_promotions.js +4 -4
- package/lib/cjs/resources/gift_cards.d.ts +3 -0
- package/lib/cjs/resources/orders.d.ts +10 -1
- package/lib/cjs/resources/orders.js +7 -0
- package/lib/cjs/resources/payment_methods.d.ts +3 -0
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +4 -14
- package/lib/cjs/resources/percentage_discount_promotions.js +4 -4
- package/lib/cjs/resources/promotions.d.ts +3 -3
- package/lib/cjs/resources/promotions.js +4 -4
- package/lib/cjs/resources/resource_errors.d.ts +22 -0
- package/lib/cjs/resources/resource_errors.js +16 -0
- package/lib/cjs/resources/stock_transfers.d.ts +1 -1
- package/lib/cjs/resources/stripe_payments.d.ts +4 -1
- package/lib/esm/api.d.ts +3 -2
- package/lib/esm/api.js +2 -0
- package/lib/esm/commercelayer.d.ts +3 -2
- package/lib/esm/commercelayer.js +2 -1
- package/lib/esm/model.d.ts +1 -0
- package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +4 -14
- package/lib/esm/resources/buy_x_pay_y_promotions.js +4 -4
- package/lib/esm/resources/external_promotions.d.ts +4 -14
- package/lib/esm/resources/external_promotions.js +4 -4
- package/lib/esm/resources/fixed_amount_promotions.d.ts +4 -14
- package/lib/esm/resources/fixed_amount_promotions.js +4 -4
- package/lib/esm/resources/fixed_price_promotions.d.ts +4 -14
- package/lib/esm/resources/fixed_price_promotions.js +4 -4
- package/lib/esm/resources/free_gift_promotions.d.ts +4 -14
- package/lib/esm/resources/free_gift_promotions.js +4 -4
- package/lib/esm/resources/free_shipping_promotions.d.ts +9 -14
- package/lib/esm/resources/free_shipping_promotions.js +4 -4
- package/lib/esm/resources/gift_cards.d.ts +3 -0
- package/lib/esm/resources/orders.d.ts +10 -1
- package/lib/esm/resources/orders.js +7 -0
- package/lib/esm/resources/payment_methods.d.ts +3 -0
- package/lib/esm/resources/percentage_discount_promotions.d.ts +4 -14
- package/lib/esm/resources/percentage_discount_promotions.js +4 -4
- package/lib/esm/resources/promotions.d.ts +3 -3
- package/lib/esm/resources/promotions.js +4 -4
- package/lib/esm/resources/resource_errors.d.ts +22 -0
- package/lib/esm/resources/resource_errors.js +14 -0
- package/lib/esm/resources/stock_transfers.d.ts +1 -1
- package/lib/esm/resources/stripe_payments.d.ts +4 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
@@ -35,6 +35,7 @@ import type { OrderFactory } from './order_factories';
|
|
35
35
|
import type { OrderCopy } from './order_copies';
|
36
36
|
import type { RecurringOrderCopy } from './recurring_order_copies';
|
37
37
|
import type { Attachment } from './attachments';
|
38
|
+
import type { ResourceError } from './resource_errors';
|
38
39
|
import type { Event } from './events';
|
39
40
|
import type { Tag, TagType } from './tags';
|
40
41
|
import type { Version } from './versions';
|
@@ -91,7 +92,8 @@ interface Order extends Resource {
|
|
91
92
|
readonly type: OrderType;
|
92
93
|
number?: string | null;
|
93
94
|
autorefresh?: boolean | null;
|
94
|
-
|
95
|
+
place_async?: boolean | null;
|
96
|
+
status: 'draft' | 'pending' | 'placing' | 'placed' | 'editing' | 'approved' | 'cancelled';
|
95
97
|
payment_status: 'unpaid' | 'authorized' | 'partially_authorized' | 'paid' | 'partially_paid' | 'voided' | 'partially_voided' | 'refunded' | 'partially_refunded' | 'free';
|
96
98
|
fulfillment_status: 'unfulfilled' | 'in_progress' | 'fulfilled' | 'not_required';
|
97
99
|
guest?: boolean | null;
|
@@ -178,6 +180,7 @@ interface Order extends Resource {
|
|
178
180
|
shipments_count?: number | null;
|
179
181
|
tax_calculations_count?: number | null;
|
180
182
|
validations_count?: number | null;
|
183
|
+
errors_count?: number | null;
|
181
184
|
payment_source_details?: Record<string, any> | null;
|
182
185
|
token?: string | null;
|
183
186
|
cart_url?: string | null;
|
@@ -223,6 +226,7 @@ interface Order extends Resource {
|
|
223
226
|
order_copies?: OrderCopy[] | null;
|
224
227
|
recurring_order_copies?: RecurringOrderCopy[] | null;
|
225
228
|
attachments?: Attachment[] | null;
|
229
|
+
resource_errors?: ResourceError[] | null;
|
226
230
|
events?: Event[] | null;
|
227
231
|
tags?: Tag[] | null;
|
228
232
|
versions?: Version[] | null;
|
@@ -230,6 +234,7 @@ interface Order extends Resource {
|
|
230
234
|
interface OrderCreate extends ResourceCreate {
|
231
235
|
number?: string | null;
|
232
236
|
autorefresh?: boolean | null;
|
237
|
+
place_async?: boolean | null;
|
233
238
|
guest?: boolean | null;
|
234
239
|
customer_email?: string | null;
|
235
240
|
customer_password?: string | null;
|
@@ -256,6 +261,7 @@ interface OrderCreate extends ResourceCreate {
|
|
256
261
|
interface OrderUpdate extends ResourceUpdate {
|
257
262
|
number?: string | null;
|
258
263
|
autorefresh?: boolean | null;
|
264
|
+
place_async?: boolean | null;
|
259
265
|
guest?: boolean | null;
|
260
266
|
customer_email?: string | null;
|
261
267
|
customer_password?: string | null;
|
@@ -273,6 +279,7 @@ interface OrderUpdate extends ResourceUpdate {
|
|
273
279
|
privacy_url?: string | null;
|
274
280
|
_archive?: boolean | null;
|
275
281
|
_unarchive?: boolean | null;
|
282
|
+
_pending?: boolean | null;
|
276
283
|
_place?: boolean | null;
|
277
284
|
_cancel?: boolean | null;
|
278
285
|
_approve?: boolean | null;
|
@@ -338,11 +345,13 @@ declare class Orders extends ApiResource<Order> {
|
|
338
345
|
order_copies(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderCopy>>;
|
339
346
|
recurring_order_copies(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<RecurringOrderCopy>>;
|
340
347
|
attachments(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
348
|
+
resource_errors(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<ResourceError>>;
|
341
349
|
events(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
342
350
|
tags(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
343
351
|
versions(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
344
352
|
_archive(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
345
353
|
_unarchive(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
354
|
+
_pending(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
346
355
|
_place(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
347
356
|
_cancel(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
348
357
|
_approve(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
@@ -117,6 +117,10 @@ class Orders extends ApiResource {
|
|
117
117
|
const _orderId = orderId.id || orderId;
|
118
118
|
return this.resources.fetch({ type: 'attachments' }, `orders/${_orderId}/attachments`, params, options);
|
119
119
|
}
|
120
|
+
async resource_errors(orderId, params, options) {
|
121
|
+
const _orderId = orderId.id || orderId;
|
122
|
+
return this.resources.fetch({ type: 'resource_errors' }, `orders/${_orderId}/resource_errors`, params, options);
|
123
|
+
}
|
120
124
|
async events(orderId, params, options) {
|
121
125
|
const _orderId = orderId.id || orderId;
|
122
126
|
return this.resources.fetch({ type: 'events' }, `orders/${_orderId}/events`, params, options);
|
@@ -135,6 +139,9 @@ class Orders extends ApiResource {
|
|
135
139
|
async _unarchive(id, params, options) {
|
136
140
|
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _unarchive: true }, params, options);
|
137
141
|
}
|
142
|
+
async _pending(id, params, options) {
|
143
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _pending: true }, params, options);
|
144
|
+
}
|
138
145
|
async _place(id, params, options) {
|
139
146
|
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _place: true }, params, options);
|
140
147
|
}
|
@@ -22,6 +22,7 @@ interface PaymentMethod extends Resource {
|
|
22
22
|
currency_code?: string | null;
|
23
23
|
moto?: boolean | null;
|
24
24
|
require_capture?: boolean | null;
|
25
|
+
auto_place?: boolean | null;
|
25
26
|
auto_capture?: boolean | null;
|
26
27
|
disabled_at?: string | null;
|
27
28
|
price_amount_cents: number;
|
@@ -40,6 +41,7 @@ interface PaymentMethodCreate extends ResourceCreate {
|
|
40
41
|
currency_code?: string | null;
|
41
42
|
moto?: boolean | null;
|
42
43
|
require_capture?: boolean | null;
|
44
|
+
auto_place?: boolean | null;
|
43
45
|
auto_capture?: boolean | null;
|
44
46
|
_disable?: boolean | null;
|
45
47
|
_enable?: boolean | null;
|
@@ -53,6 +55,7 @@ interface PaymentMethodUpdate extends ResourceUpdate {
|
|
53
55
|
currency_code?: string | null;
|
54
56
|
moto?: boolean | null;
|
55
57
|
require_capture?: boolean | null;
|
58
|
+
auto_place?: boolean | null;
|
56
59
|
auto_capture?: boolean | null;
|
57
60
|
_disable?: boolean | null;
|
58
61
|
_enable?: boolean | null;
|
@@ -2,13 +2,13 @@ import { ApiResource } from '../resource';
|
|
2
2
|
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
3
|
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
4
|
import type { Market, MarketType } from './markets';
|
5
|
-
import type { PromotionRule
|
5
|
+
import type { PromotionRule } 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
9
|
import type { CustomPromotionRule, CustomPromotionRuleType } from './custom_promotion_rules';
|
10
|
-
import type { Coupon, CouponType } from './coupons';
|
11
10
|
import type { SkuList, SkuListType } from './sku_lists';
|
11
|
+
import type { Coupon } from './coupons';
|
12
12
|
import type { Attachment } from './attachments';
|
13
13
|
import type { Event } from './events';
|
14
14
|
import type { Tag, TagType } from './tags';
|
@@ -21,9 +21,6 @@ type PercentageDiscountPromotionRel = ResourceRel & {
|
|
21
21
|
type MarketRel = ResourceRel & {
|
22
22
|
type: MarketType;
|
23
23
|
};
|
24
|
-
type PromotionRuleRel = ResourceRel & {
|
25
|
-
type: PromotionRuleType;
|
26
|
-
};
|
27
24
|
type OrderAmountPromotionRuleRel = ResourceRel & {
|
28
25
|
type: OrderAmountPromotionRuleType;
|
29
26
|
};
|
@@ -36,9 +33,6 @@ type CouponCodesPromotionRuleRel = ResourceRel & {
|
|
36
33
|
type CustomPromotionRuleRel = ResourceRel & {
|
37
34
|
type: CustomPromotionRuleType;
|
38
35
|
};
|
39
|
-
type CouponRel = ResourceRel & {
|
40
|
-
type: CouponType;
|
41
|
-
};
|
42
36
|
type SkuListRel = ResourceRel & {
|
43
37
|
type: SkuListType;
|
44
38
|
};
|
@@ -64,8 +58,8 @@ interface PercentageDiscountPromotion extends Resource {
|
|
64
58
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
65
59
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
66
60
|
custom_promotion_rule?: CustomPromotionRule | null;
|
67
|
-
coupons?: Coupon[] | null;
|
68
61
|
sku_list?: SkuList | null;
|
62
|
+
coupons?: Coupon[] | null;
|
69
63
|
attachments?: Attachment[] | null;
|
70
64
|
events?: Event[] | null;
|
71
65
|
tags?: Tag[] | null;
|
@@ -84,12 +78,10 @@ interface PercentageDiscountPromotionCreate extends ResourceCreate {
|
|
84
78
|
_enable?: boolean | null;
|
85
79
|
percentage: number;
|
86
80
|
market?: MarketRel | null;
|
87
|
-
promotion_rules?: PromotionRuleRel[] | null;
|
88
81
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
89
82
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
90
83
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
91
84
|
custom_promotion_rule?: CustomPromotionRuleRel | null;
|
92
|
-
coupons?: CouponRel[] | null;
|
93
85
|
sku_list?: SkuListRel | null;
|
94
86
|
tags?: TagRel[] | null;
|
95
87
|
}
|
@@ -105,12 +97,10 @@ interface PercentageDiscountPromotionUpdate extends ResourceUpdate {
|
|
105
97
|
_enable?: boolean | null;
|
106
98
|
percentage?: number | null;
|
107
99
|
market?: MarketRel | null;
|
108
|
-
promotion_rules?: PromotionRuleRel[] | null;
|
109
100
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
110
101
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
111
102
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
112
103
|
custom_promotion_rule?: CustomPromotionRuleRel | null;
|
113
|
-
coupons?: CouponRel[] | null;
|
114
104
|
sku_list?: SkuListRel | null;
|
115
105
|
tags?: TagRel[] | null;
|
116
106
|
}
|
@@ -124,8 +114,8 @@ declare class PercentageDiscountPromotions extends ApiResource<PercentageDiscoun
|
|
124
114
|
sku_list_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
125
115
|
coupon_codes_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
126
116
|
custom_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomPromotionRule>;
|
127
|
-
coupons(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
128
117
|
sku_list(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
118
|
+
coupons(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
129
119
|
attachments(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
130
120
|
events(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
131
121
|
tags(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
@@ -29,14 +29,14 @@ class PercentageDiscountPromotions extends ApiResource {
|
|
29
29
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
30
30
|
return this.resources.fetch({ type: 'custom_promotion_rules' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/custom_promotion_rule`, params, options);
|
31
31
|
}
|
32
|
-
async coupons(percentageDiscountPromotionId, params, options) {
|
33
|
-
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
34
|
-
return this.resources.fetch({ type: 'coupons' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/coupons`, params, options);
|
35
|
-
}
|
36
32
|
async sku_list(percentageDiscountPromotionId, params, options) {
|
37
33
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
38
34
|
return this.resources.fetch({ type: 'sku_lists' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/sku_list`, params, options);
|
39
35
|
}
|
36
|
+
async coupons(percentageDiscountPromotionId, params, options) {
|
37
|
+
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
38
|
+
return this.resources.fetch({ type: 'coupons' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/coupons`, params, options);
|
39
|
+
}
|
40
40
|
async attachments(percentageDiscountPromotionId, params, options) {
|
41
41
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
42
42
|
return this.resources.fetch({ type: 'attachments' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/attachments`, params, options);
|
@@ -7,8 +7,8 @@ import type { OrderAmountPromotionRule } from './order_amount_promotion_rules';
|
|
7
7
|
import type { SkuListPromotionRule } from './sku_list_promotion_rules';
|
8
8
|
import type { CouponCodesPromotionRule } from './coupon_codes_promotion_rules';
|
9
9
|
import type { CustomPromotionRule } from './custom_promotion_rules';
|
10
|
-
import type { Coupon } from './coupons';
|
11
10
|
import type { SkuList } from './sku_lists';
|
11
|
+
import type { Coupon } from './coupons';
|
12
12
|
import type { Attachment } from './attachments';
|
13
13
|
import type { Event } from './events';
|
14
14
|
import type { Tag } from './tags';
|
@@ -35,8 +35,8 @@ interface Promotion extends Resource {
|
|
35
35
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
36
36
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
37
37
|
custom_promotion_rule?: CustomPromotionRule | null;
|
38
|
-
coupons?: Coupon[] | null;
|
39
38
|
sku_list?: SkuList | null;
|
39
|
+
coupons?: Coupon[] | null;
|
40
40
|
attachments?: Attachment[] | null;
|
41
41
|
events?: Event[] | null;
|
42
42
|
tags?: Tag[] | null;
|
@@ -49,8 +49,8 @@ declare class Promotions extends ApiResource<Promotion> {
|
|
49
49
|
sku_list_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
50
50
|
coupon_codes_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
51
51
|
custom_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomPromotionRule>;
|
52
|
-
coupons(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
53
52
|
sku_list(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
53
|
+
coupons(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
54
54
|
attachments(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
55
55
|
events(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
56
56
|
tags(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
@@ -20,14 +20,14 @@ class Promotions extends ApiResource {
|
|
20
20
|
const _promotionId = promotionId.id || promotionId;
|
21
21
|
return this.resources.fetch({ type: 'custom_promotion_rules' }, `promotions/${_promotionId}/custom_promotion_rule`, params, options);
|
22
22
|
}
|
23
|
-
async coupons(promotionId, params, options) {
|
24
|
-
const _promotionId = promotionId.id || promotionId;
|
25
|
-
return this.resources.fetch({ type: 'coupons' }, `promotions/${_promotionId}/coupons`, params, options);
|
26
|
-
}
|
27
23
|
async sku_list(promotionId, params, options) {
|
28
24
|
const _promotionId = promotionId.id || promotionId;
|
29
25
|
return this.resources.fetch({ type: 'sku_lists' }, `promotions/${_promotionId}/sku_list`, params, options);
|
30
26
|
}
|
27
|
+
async coupons(promotionId, params, options) {
|
28
|
+
const _promotionId = promotionId.id || promotionId;
|
29
|
+
return this.resources.fetch({ type: 'coupons' }, `promotions/${_promotionId}/coupons`, params, options);
|
30
|
+
}
|
31
31
|
async attachments(promotionId, params, options) {
|
32
32
|
const _promotionId = promotionId.id || promotionId;
|
33
33
|
return this.resources.fetch({ type: 'attachments' }, `promotions/${_promotionId}/attachments`, params, options);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
import type { Resource, ResourceId, ResourceRel } from '../resource';
|
3
|
+
import type { Order } from './orders';
|
4
|
+
type ResourceErrorType = 'resource_errors';
|
5
|
+
type ResourceErrorRel = ResourceRel & {
|
6
|
+
type: ResourceErrorType;
|
7
|
+
};
|
8
|
+
interface ResourceError extends Resource {
|
9
|
+
readonly type: ResourceErrorType;
|
10
|
+
name: string;
|
11
|
+
code: string;
|
12
|
+
message: string;
|
13
|
+
resource?: Order | null;
|
14
|
+
}
|
15
|
+
declare class ResourceErrors extends ApiResource<ResourceError> {
|
16
|
+
static readonly TYPE: ResourceErrorType;
|
17
|
+
isResourceError(resource: any): resource is ResourceError;
|
18
|
+
relationship(id: string | ResourceId | null): ResourceErrorRel;
|
19
|
+
type(): ResourceErrorType;
|
20
|
+
}
|
21
|
+
export default ResourceErrors;
|
22
|
+
export type { ResourceError, ResourceErrorType };
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
class ResourceErrors extends ApiResource {
|
3
|
+
isResourceError(resource) {
|
4
|
+
return resource.type && (resource.type === ResourceErrors.TYPE);
|
5
|
+
}
|
6
|
+
relationship(id) {
|
7
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: ResourceErrors.TYPE } : { id: id.id, type: ResourceErrors.TYPE };
|
8
|
+
}
|
9
|
+
type() {
|
10
|
+
return ResourceErrors.TYPE;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
ResourceErrors.TYPE = 'resource_errors';
|
14
|
+
export default ResourceErrors;
|
@@ -25,7 +25,7 @@ type LineItemRel = ResourceRel & {
|
|
25
25
|
};
|
26
26
|
interface StockTransfer extends Resource {
|
27
27
|
readonly type: StockTransferType;
|
28
|
-
number?:
|
28
|
+
number?: string | null;
|
29
29
|
sku_code?: string | null;
|
30
30
|
status: 'draft' | 'upcoming' | 'on_hold' | 'picking' | 'in_transit' | 'completed' | 'cancelled';
|
31
31
|
quantity: number;
|
@@ -13,7 +13,8 @@ type OrderRel = ResourceRel & {
|
|
13
13
|
};
|
14
14
|
interface StripePayment extends Resource {
|
15
15
|
readonly type: StripePaymentType;
|
16
|
-
|
16
|
+
stripe_id?: string | null;
|
17
|
+
client_secret?: string | null;
|
17
18
|
publishable_key?: string | null;
|
18
19
|
options?: Record<string, any> | null;
|
19
20
|
payment_method?: Record<string, any> | null;
|
@@ -29,6 +30,8 @@ interface StripePayment extends Resource {
|
|
29
30
|
versions?: Version[] | null;
|
30
31
|
}
|
31
32
|
interface StripePaymentCreate extends ResourceCreate {
|
33
|
+
stripe_id?: string | null;
|
34
|
+
client_secret?: string | null;
|
32
35
|
options?: Record<string, any> | null;
|
33
36
|
return_url?: string | null;
|
34
37
|
receipt_email?: string | null;
|