@commercelayer/sdk 4.30.0 → 4.32.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 +4 -2
- package/lib/cjs/api.js +8 -2
- package/lib/cjs/client.d.ts +5 -1
- package/lib/cjs/client.js +22 -3
- package/lib/cjs/commercelayer.d.ts +4 -2
- package/lib/cjs/commercelayer.js +3 -1
- package/lib/cjs/error.d.ts +1 -0
- package/lib/cjs/error.js +1 -2
- package/lib/cjs/interceptor.d.ts +1 -1
- package/lib/cjs/jsonapi.js +4 -1
- package/lib/cjs/model.d.ts +2 -0
- package/lib/cjs/resources/authorizations.d.ts +3 -0
- package/lib/cjs/resources/authorizations.js +4 -0
- package/lib/cjs/resources/captures.d.ts +3 -0
- package/lib/cjs/resources/captures.js +4 -0
- package/lib/cjs/resources/coupons.d.ts +8 -0
- package/lib/cjs/resources/coupons.js +4 -0
- package/lib/cjs/resources/customer_addresses.d.ts +2 -0
- package/lib/cjs/resources/customers.d.ts +1 -0
- package/lib/cjs/resources/external_promotions.d.ts +3 -0
- package/lib/cjs/resources/external_promotions.js +4 -0
- package/lib/cjs/resources/fixed_amount_promotions.d.ts +3 -0
- package/lib/cjs/resources/fixed_amount_promotions.js +4 -0
- package/lib/cjs/resources/fixed_price_promotions.d.ts +8 -8
- package/lib/cjs/resources/fixed_price_promotions.js +4 -4
- package/lib/cjs/resources/free_gift_promotions.d.ts +8 -8
- package/lib/cjs/resources/free_gift_promotions.js +4 -4
- package/lib/cjs/resources/free_shipping_promotions.d.ts +3 -0
- package/lib/cjs/resources/free_shipping_promotions.js +4 -0
- package/lib/cjs/resources/imports.d.ts +0 -3
- package/lib/cjs/resources/inventory_models.d.ts +3 -0
- package/lib/cjs/resources/line_items.d.ts +5 -0
- package/lib/cjs/resources/line_items.js +4 -0
- package/lib/cjs/resources/order_amount_promotion_rules.d.ts +3 -0
- package/lib/cjs/resources/orders.d.ts +4 -4
- package/lib/cjs/resources/parcel_line_items.d.ts +1 -1
- package/lib/cjs/resources/parcels.d.ts +3 -3
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +8 -8
- package/lib/cjs/resources/percentage_discount_promotions.js +4 -4
- package/lib/cjs/resources/promotions.d.ts +3 -0
- package/lib/cjs/resources/promotions.js +4 -0
- package/lib/cjs/resources/refunds.d.ts +3 -0
- package/lib/cjs/resources/refunds.js +4 -0
- package/lib/cjs/resources/reserved_stocks.d.ts +28 -0
- package/lib/cjs/resources/reserved_stocks.js +28 -0
- package/lib/cjs/resources/return_line_items.d.ts +2 -1
- package/lib/cjs/resources/satispay_payments.d.ts +7 -0
- package/lib/cjs/resources/shipping_methods.d.ts +6 -0
- package/lib/cjs/resources/skus.d.ts +3 -0
- package/lib/cjs/resources/skus.js +4 -0
- package/lib/cjs/resources/stock_items.d.ts +6 -0
- package/lib/cjs/resources/stock_items.js +8 -0
- package/lib/cjs/resources/stock_line_items.d.ts +3 -0
- package/lib/cjs/resources/stock_line_items.js +4 -0
- package/lib/cjs/resources/stock_reservations.d.ts +36 -0
- package/lib/cjs/resources/stock_reservations.js +36 -0
- package/lib/cjs/resources/stripe_payments.d.ts +1 -0
- package/lib/cjs/resources/transactions.d.ts +5 -2
- package/lib/cjs/resources/transactions.js +4 -0
- package/lib/cjs/resources/voids.d.ts +3 -0
- package/lib/cjs/resources/voids.js +4 -0
- package/lib/cjs/util.d.ts +0 -4
- package/lib/esm/api.d.ts +4 -2
- package/lib/esm/api.js +4 -0
- package/lib/esm/client.d.ts +5 -1
- package/lib/esm/client.js +22 -3
- package/lib/esm/commercelayer.d.ts +4 -2
- package/lib/esm/commercelayer.js +3 -1
- package/lib/esm/error.d.ts +1 -0
- package/lib/esm/interceptor.d.ts +1 -1
- package/lib/esm/jsonapi.js +4 -1
- package/lib/esm/model.d.ts +2 -0
- package/lib/esm/resources/authorizations.d.ts +3 -0
- package/lib/esm/resources/authorizations.js +4 -0
- package/lib/esm/resources/captures.d.ts +3 -0
- package/lib/esm/resources/captures.js +4 -0
- package/lib/esm/resources/coupons.d.ts +8 -0
- package/lib/esm/resources/coupons.js +4 -0
- package/lib/esm/resources/customer_addresses.d.ts +2 -0
- package/lib/esm/resources/customers.d.ts +1 -0
- package/lib/esm/resources/external_promotions.d.ts +3 -0
- package/lib/esm/resources/external_promotions.js +4 -0
- package/lib/esm/resources/fixed_amount_promotions.d.ts +3 -0
- package/lib/esm/resources/fixed_amount_promotions.js +4 -0
- package/lib/esm/resources/fixed_price_promotions.d.ts +8 -8
- package/lib/esm/resources/fixed_price_promotions.js +4 -4
- package/lib/esm/resources/free_gift_promotions.d.ts +8 -8
- package/lib/esm/resources/free_gift_promotions.js +4 -4
- package/lib/esm/resources/free_shipping_promotions.d.ts +3 -0
- package/lib/esm/resources/free_shipping_promotions.js +4 -0
- package/lib/esm/resources/imports.d.ts +0 -3
- package/lib/esm/resources/inventory_models.d.ts +3 -0
- package/lib/esm/resources/line_items.d.ts +5 -0
- package/lib/esm/resources/line_items.js +4 -0
- package/lib/esm/resources/order_amount_promotion_rules.d.ts +3 -0
- package/lib/esm/resources/orders.d.ts +4 -4
- package/lib/esm/resources/parcel_line_items.d.ts +1 -1
- package/lib/esm/resources/parcels.d.ts +3 -3
- package/lib/esm/resources/percentage_discount_promotions.d.ts +8 -8
- package/lib/esm/resources/percentage_discount_promotions.js +4 -4
- package/lib/esm/resources/promotions.d.ts +3 -0
- package/lib/esm/resources/promotions.js +4 -0
- package/lib/esm/resources/refunds.d.ts +3 -0
- package/lib/esm/resources/refunds.js +4 -0
- package/lib/esm/resources/reserved_stocks.d.ts +28 -0
- package/lib/esm/resources/reserved_stocks.js +26 -0
- package/lib/esm/resources/return_line_items.d.ts +2 -1
- package/lib/esm/resources/satispay_payments.d.ts +7 -0
- package/lib/esm/resources/shipping_methods.d.ts +6 -0
- package/lib/esm/resources/skus.d.ts +3 -0
- package/lib/esm/resources/skus.js +4 -0
- package/lib/esm/resources/stock_items.d.ts +6 -0
- package/lib/esm/resources/stock_items.js +8 -0
- package/lib/esm/resources/stock_line_items.d.ts +3 -0
- package/lib/esm/resources/stock_line_items.js +4 -0
- package/lib/esm/resources/stock_reservations.d.ts +36 -0
- package/lib/esm/resources/stock_reservations.js +34 -0
- package/lib/esm/resources/stripe_payments.d.ts +1 -0
- package/lib/esm/resources/transactions.d.ts +5 -2
- package/lib/esm/resources/transactions.js +4 -0
- package/lib/esm/resources/voids.d.ts +3 -0
- package/lib/esm/resources/voids.js +4 -0
- package/lib/esm/util.d.ts +0 -4
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
@@ -85,7 +85,7 @@ interface Order extends Resource {
|
|
85
85
|
readonly type: OrderType;
|
86
86
|
number?: number | null;
|
87
87
|
autorefresh?: boolean | null;
|
88
|
-
status: 'draft' | 'pending' | 'placed' | 'approved' | 'cancelled';
|
88
|
+
status: 'draft' | 'pending' | 'placed' | 'editing' | 'approved' | 'cancelled';
|
89
89
|
payment_status: 'unpaid' | 'authorized' | 'partially_authorized' | 'paid' | 'partially_paid' | 'voided' | 'partially_voided' | 'refunded' | 'partially_refunded' | 'free';
|
90
90
|
fulfillment_status: 'unfulfilled' | 'in_progress' | 'fulfilled' | 'not_required';
|
91
91
|
guest?: boolean | null;
|
@@ -101,7 +101,6 @@ interface Order extends Resource {
|
|
101
101
|
shipping_country_code_lock?: string | null;
|
102
102
|
coupon_code?: string | null;
|
103
103
|
gift_card_code?: string | null;
|
104
|
-
gift_card_or_coupon_code?: string | null;
|
105
104
|
subtotal_amount_cents?: number | null;
|
106
105
|
subtotal_amount_float?: number | null;
|
107
106
|
formatted_subtotal_amount?: string | null;
|
@@ -166,6 +165,7 @@ interface Order extends Resource {
|
|
166
165
|
line_item_options_count?: number | null;
|
167
166
|
shipments_count?: number | null;
|
168
167
|
tax_calculations_count?: number | null;
|
168
|
+
validations_count?: number | null;
|
169
169
|
payment_source_details?: Record<string, any> | null;
|
170
170
|
token?: string | null;
|
171
171
|
cart_url?: string | null;
|
@@ -217,7 +217,6 @@ interface OrderCreate extends ResourceCreate {
|
|
217
217
|
shipping_country_code_lock?: string | null;
|
218
218
|
coupon_code?: string | null;
|
219
219
|
gift_card_code?: string | null;
|
220
|
-
gift_card_or_coupon_code?: string | null;
|
221
220
|
cart_url?: string | null;
|
222
221
|
return_url?: string | null;
|
223
222
|
terms_url?: string | null;
|
@@ -239,7 +238,6 @@ interface OrderUpdate extends ResourceUpdate {
|
|
239
238
|
shipping_country_code_lock?: string | null;
|
240
239
|
coupon_code?: string | null;
|
241
240
|
gift_card_code?: string | null;
|
242
|
-
gift_card_or_coupon_code?: string | null;
|
243
241
|
cart_url?: string | null;
|
244
242
|
return_url?: string | null;
|
245
243
|
terms_url?: string | null;
|
@@ -269,6 +267,8 @@ interface OrderUpdate extends ResourceUpdate {
|
|
269
267
|
_refresh?: boolean | null;
|
270
268
|
_validate?: boolean | null;
|
271
269
|
_create_subscriptions?: boolean | null;
|
270
|
+
_start_editing?: boolean | null;
|
271
|
+
_stop_editing?: boolean | null;
|
272
272
|
market?: MarketRel | null;
|
273
273
|
customer?: CustomerRel | null;
|
274
274
|
shipping_address?: AddressRel | null;
|
@@ -16,6 +16,7 @@ type StockLineItemRel = ResourceRel & {
|
|
16
16
|
interface ParcelLineItem extends Resource {
|
17
17
|
readonly type: ParcelLineItemType;
|
18
18
|
sku_code?: string | null;
|
19
|
+
bundle_code?: string | null;
|
19
20
|
quantity: number;
|
20
21
|
name: string;
|
21
22
|
image_url?: string | null;
|
@@ -27,7 +28,6 @@ interface ParcelLineItem extends Resource {
|
|
27
28
|
shipment_line_item?: object;
|
28
29
|
}
|
29
30
|
interface ParcelLineItemCreate extends ResourceCreate {
|
30
|
-
sku_code?: string | null;
|
31
31
|
quantity: number;
|
32
32
|
parcel: ParcelRel;
|
33
33
|
stock_line_item: StockLineItemRel;
|
@@ -38,7 +38,7 @@ interface Parcel extends Resource {
|
|
38
38
|
tracking_status?: string | null;
|
39
39
|
tracking_status_detail?: string | null;
|
40
40
|
tracking_status_updated_at?: string | null;
|
41
|
-
tracking_details?: string | null;
|
41
|
+
tracking_details?: Record<string, any> | null;
|
42
42
|
carrier_weight_oz?: string | null;
|
43
43
|
signed_by?: string | null;
|
44
44
|
incoterm?: string | null;
|
@@ -69,7 +69,7 @@ interface ParcelCreate extends ResourceCreate {
|
|
69
69
|
tracking_status?: string | null;
|
70
70
|
tracking_status_detail?: string | null;
|
71
71
|
tracking_status_updated_at?: string | null;
|
72
|
-
tracking_details?: string | null;
|
72
|
+
tracking_details?: Record<string, any> | null;
|
73
73
|
carrier_weight_oz?: string | null;
|
74
74
|
signed_by?: string | null;
|
75
75
|
incoterm?: string | null;
|
@@ -97,7 +97,7 @@ interface ParcelUpdate extends ResourceUpdate {
|
|
97
97
|
tracking_status?: string | null;
|
98
98
|
tracking_status_detail?: string | null;
|
99
99
|
tracking_status_updated_at?: string | null;
|
100
|
-
tracking_details?: string | null;
|
100
|
+
tracking_details?: Record<string, any> | null;
|
101
101
|
carrier_weight_oz?: string | null;
|
102
102
|
signed_by?: string | null;
|
103
103
|
incoterm?: string | null;
|
@@ -6,10 +6,10 @@ 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 { SkuList, SkuListType } from './sku_lists';
|
9
10
|
import type { Attachment } from './attachments';
|
10
11
|
import type { Event } from './events';
|
11
12
|
import type { Tag, TagType } from './tags';
|
12
|
-
import type { SkuList, SkuListType } from './sku_lists';
|
13
13
|
import type { Sku } from './skus';
|
14
14
|
type PercentageDiscountPromotionType = 'percentage_discount_promotions';
|
15
15
|
type PercentageDiscountPromotionRel = ResourceRel & {
|
@@ -30,12 +30,12 @@ type SkuListPromotionRuleRel = ResourceRel & {
|
|
30
30
|
type CouponCodesPromotionRuleRel = ResourceRel & {
|
31
31
|
type: CouponCodesPromotionRuleType;
|
32
32
|
};
|
33
|
-
type TagRel = ResourceRel & {
|
34
|
-
type: TagType;
|
35
|
-
};
|
36
33
|
type SkuListRel = ResourceRel & {
|
37
34
|
type: SkuListType;
|
38
35
|
};
|
36
|
+
type TagRel = ResourceRel & {
|
37
|
+
type: TagType;
|
38
|
+
};
|
39
39
|
interface PercentageDiscountPromotion extends Resource {
|
40
40
|
readonly type: PercentageDiscountPromotionType;
|
41
41
|
name: string;
|
@@ -51,10 +51,10 @@ interface PercentageDiscountPromotion extends Resource {
|
|
51
51
|
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
52
52
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
53
53
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
54
|
+
sku_list?: SkuList | null;
|
54
55
|
attachments?: Attachment[] | null;
|
55
56
|
events?: Event[] | null;
|
56
57
|
tags?: Tag[] | null;
|
57
|
-
sku_list?: SkuList | null;
|
58
58
|
skus?: Sku[] | null;
|
59
59
|
}
|
60
60
|
interface PercentageDiscountPromotionCreate extends ResourceCreate {
|
@@ -69,8 +69,8 @@ interface PercentageDiscountPromotionCreate extends ResourceCreate {
|
|
69
69
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
70
70
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
71
71
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
72
|
-
tags?: TagRel[] | null;
|
73
72
|
sku_list?: SkuListRel | null;
|
73
|
+
tags?: TagRel[] | null;
|
74
74
|
}
|
75
75
|
interface PercentageDiscountPromotionUpdate extends ResourceUpdate {
|
76
76
|
name?: string | null;
|
@@ -84,8 +84,8 @@ interface PercentageDiscountPromotionUpdate extends ResourceUpdate {
|
|
84
84
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
85
85
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
86
86
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
87
|
-
tags?: TagRel[] | null;
|
88
87
|
sku_list?: SkuListRel | null;
|
88
|
+
tags?: TagRel[] | null;
|
89
89
|
}
|
90
90
|
declare class PercentageDiscountPromotions extends ApiResource<PercentageDiscountPromotion> {
|
91
91
|
static readonly TYPE: PercentageDiscountPromotionType;
|
@@ -96,10 +96,10 @@ declare class PercentageDiscountPromotions extends ApiResource<PercentageDiscoun
|
|
96
96
|
order_amount_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
|
97
97
|
sku_list_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
98
98
|
coupon_codes_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
99
|
+
sku_list(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
99
100
|
attachments(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
100
101
|
events(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
101
102
|
tags(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
102
|
-
sku_list(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
103
103
|
skus(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
104
104
|
isPercentageDiscountPromotion(resource: any): resource is PercentageDiscountPromotion;
|
105
105
|
relationship(id: string | ResourceId | null): PercentageDiscountPromotionRel;
|
@@ -25,6 +25,10 @@ class PercentageDiscountPromotions extends ApiResource {
|
|
25
25
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
26
26
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/coupon_codes_promotion_rule`, params, options);
|
27
27
|
}
|
28
|
+
async sku_list(percentageDiscountPromotionId, params, options) {
|
29
|
+
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
30
|
+
return this.resources.fetch({ type: 'sku_lists' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/sku_list`, params, options);
|
31
|
+
}
|
28
32
|
async attachments(percentageDiscountPromotionId, params, options) {
|
29
33
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
30
34
|
return this.resources.fetch({ type: 'attachments' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/attachments`, params, options);
|
@@ -37,10 +41,6 @@ class PercentageDiscountPromotions extends ApiResource {
|
|
37
41
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
38
42
|
return this.resources.fetch({ type: 'tags' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/tags`, params, options);
|
39
43
|
}
|
40
|
-
async sku_list(percentageDiscountPromotionId, params, options) {
|
41
|
-
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
42
|
-
return this.resources.fetch({ type: 'sku_lists' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/sku_list`, params, options);
|
43
|
-
}
|
44
44
|
async skus(percentageDiscountPromotionId, params, options) {
|
45
45
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
46
46
|
return this.resources.fetch({ type: 'skus' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/skus`, params, options);
|
@@ -6,6 +6,7 @@ import type { PromotionRule } from './promotion_rules';
|
|
6
6
|
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
|
+
import type { SkuList } from './sku_lists';
|
9
10
|
import type { Attachment } from './attachments';
|
10
11
|
import type { Event } from './events';
|
11
12
|
import type { Tag } from './tags';
|
@@ -27,6 +28,7 @@ interface Promotion extends Resource {
|
|
27
28
|
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
28
29
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
29
30
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
31
|
+
sku_list?: SkuList | null;
|
30
32
|
attachments?: Attachment[] | null;
|
31
33
|
events?: Event[] | null;
|
32
34
|
tags?: Tag[] | null;
|
@@ -37,6 +39,7 @@ declare class Promotions extends ApiResource<Promotion> {
|
|
37
39
|
order_amount_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
|
38
40
|
sku_list_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
39
41
|
coupon_codes_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
42
|
+
sku_list(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
40
43
|
attachments(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
41
44
|
events(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
42
45
|
tags(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
@@ -16,6 +16,10 @@ class Promotions extends ApiResource {
|
|
16
16
|
const _promotionId = promotionId.id || promotionId;
|
17
17
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `promotions/${_promotionId}/coupon_codes_promotion_rule`, params, options);
|
18
18
|
}
|
19
|
+
async sku_list(promotionId, params, options) {
|
20
|
+
const _promotionId = promotionId.id || promotionId;
|
21
|
+
return this.resources.fetch({ type: 'sku_lists' }, `promotions/${_promotionId}/sku_list`, params, options);
|
22
|
+
}
|
19
23
|
async attachments(promotionId, params, options) {
|
20
24
|
const _promotionId = promotionId.id || promotionId;
|
21
25
|
return this.resources.fetch({ type: 'attachments' }, `promotions/${_promotionId}/attachments`, params, options);
|
@@ -2,6 +2,7 @@ import { ApiResource } from '../resource';
|
|
2
2
|
import type { Resource, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
3
|
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
4
|
import type { Order } from './orders';
|
5
|
+
import type { Attachment } from './attachments';
|
5
6
|
import type { Capture } from './captures';
|
6
7
|
import type { Event } from './events';
|
7
8
|
type RefundType = 'refunds';
|
@@ -22,12 +23,14 @@ interface Refund extends Resource {
|
|
22
23
|
token?: string | null;
|
23
24
|
gateway_transaction_id?: string | null;
|
24
25
|
order?: Order | null;
|
26
|
+
attachments?: Attachment[] | null;
|
25
27
|
reference_capture?: Capture | null;
|
26
28
|
events?: Event[] | null;
|
27
29
|
}
|
28
30
|
declare class Refunds extends ApiResource<Refund> {
|
29
31
|
static readonly TYPE: RefundType;
|
30
32
|
order(refundId: string | Refund, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
33
|
+
attachments(refundId: string | Refund, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
31
34
|
reference_capture(refundId: string | Refund, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
|
32
35
|
events(refundId: string | Refund, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
33
36
|
isRefund(resource: any): resource is Refund;
|
@@ -4,6 +4,10 @@ class Refunds extends ApiResource {
|
|
4
4
|
const _refundId = refundId.id || refundId;
|
5
5
|
return this.resources.fetch({ type: 'orders' }, `refunds/${_refundId}/order`, params, options);
|
6
6
|
}
|
7
|
+
async attachments(refundId, params, options) {
|
8
|
+
const _refundId = refundId.id || refundId;
|
9
|
+
return this.resources.fetch({ type: 'attachments' }, `refunds/${_refundId}/attachments`, params, options);
|
10
|
+
}
|
7
11
|
async reference_capture(refundId, params, options) {
|
8
12
|
const _refundId = refundId.id || refundId;
|
9
13
|
return this.resources.fetch({ type: 'captures' }, `refunds/${_refundId}/reference_capture`, params, options);
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
import type { Resource, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
|
+
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
|
+
import type { StockItem } from './stock_items';
|
5
|
+
import type { Sku } from './skus';
|
6
|
+
import type { StockReservation } from './stock_reservations';
|
7
|
+
type ReservedStockType = 'reserved_stocks';
|
8
|
+
type ReservedStockRel = ResourceRel & {
|
9
|
+
type: ReservedStockType;
|
10
|
+
};
|
11
|
+
interface ReservedStock extends Resource {
|
12
|
+
readonly type: ReservedStockType;
|
13
|
+
quantity: number;
|
14
|
+
stock_item?: StockItem | null;
|
15
|
+
sku?: Sku | null;
|
16
|
+
stock_reservations?: StockReservation[] | null;
|
17
|
+
}
|
18
|
+
declare class ReservedStocks extends ApiResource<ReservedStock> {
|
19
|
+
static readonly TYPE: ReservedStockType;
|
20
|
+
stock_item(reservedStockId: string | ReservedStock, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockItem>;
|
21
|
+
sku(reservedStockId: string | ReservedStock, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Sku>;
|
22
|
+
stock_reservations(reservedStockId: string | ReservedStock, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockReservation>>;
|
23
|
+
isReservedStock(resource: any): resource is ReservedStock;
|
24
|
+
relationship(id: string | ResourceId | null): ReservedStockRel;
|
25
|
+
type(): ReservedStockType;
|
26
|
+
}
|
27
|
+
export default ReservedStocks;
|
28
|
+
export type { ReservedStock, ReservedStockType };
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
class ReservedStocks extends ApiResource {
|
3
|
+
async stock_item(reservedStockId, params, options) {
|
4
|
+
const _reservedStockId = reservedStockId.id || reservedStockId;
|
5
|
+
return this.resources.fetch({ type: 'stock_items' }, `reserved_stocks/${_reservedStockId}/stock_item`, params, options);
|
6
|
+
}
|
7
|
+
async sku(reservedStockId, params, options) {
|
8
|
+
const _reservedStockId = reservedStockId.id || reservedStockId;
|
9
|
+
return this.resources.fetch({ type: 'skus' }, `reserved_stocks/${_reservedStockId}/sku`, params, options);
|
10
|
+
}
|
11
|
+
async stock_reservations(reservedStockId, params, options) {
|
12
|
+
const _reservedStockId = reservedStockId.id || reservedStockId;
|
13
|
+
return this.resources.fetch({ type: 'stock_reservations' }, `reserved_stocks/${_reservedStockId}/stock_reservations`, params, options);
|
14
|
+
}
|
15
|
+
isReservedStock(resource) {
|
16
|
+
return resource.type && (resource.type === ReservedStocks.TYPE);
|
17
|
+
}
|
18
|
+
relationship(id) {
|
19
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: ReservedStocks.TYPE } : { id: id.id, type: ReservedStocks.TYPE };
|
20
|
+
}
|
21
|
+
type() {
|
22
|
+
return ReservedStocks.TYPE;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
ReservedStocks.TYPE = 'reserved_stocks';
|
26
|
+
export default ReservedStocks;
|
@@ -17,8 +17,9 @@ interface ReturnLineItem extends Resource {
|
|
17
17
|
readonly type: ReturnLineItemType;
|
18
18
|
sku_code?: string | null;
|
19
19
|
bundle_code?: string | null;
|
20
|
-
name?: string | null;
|
21
20
|
quantity: number;
|
21
|
+
name?: string | null;
|
22
|
+
image_url?: string | null;
|
22
23
|
return_reason?: Record<string, any> | null;
|
23
24
|
restocked_at?: string | null;
|
24
25
|
return?: Return | null;
|
@@ -13,11 +13,18 @@ type OrderRel = ResourceRel & {
|
|
13
13
|
interface SatispayPayment extends Resource {
|
14
14
|
readonly type: SatispayPaymentType;
|
15
15
|
payment_id?: string | null;
|
16
|
+
flow?: string | null;
|
16
17
|
redirect_url?: string | null;
|
18
|
+
payment_url?: string | null;
|
19
|
+
intent_amount_cents: number;
|
20
|
+
intent_amount_float?: number | null;
|
21
|
+
formatted_intent_amount?: string | null;
|
22
|
+
payment_response?: Record<string, any> | null;
|
17
23
|
order?: Order | null;
|
18
24
|
payment_gateway?: PaymentGateway | null;
|
19
25
|
}
|
20
26
|
interface SatispayPaymentCreate extends ResourceCreate {
|
27
|
+
flow?: string | null;
|
21
28
|
redirect_url?: string | null;
|
22
29
|
order: OrderRel;
|
23
30
|
}
|
@@ -33,6 +33,7 @@ interface ShippingMethod extends Resource {
|
|
33
33
|
name: string;
|
34
34
|
scheme?: string | null;
|
35
35
|
currency_code?: string | null;
|
36
|
+
external_prices_url?: string | null;
|
36
37
|
disabled_at?: string | null;
|
37
38
|
price_amount_cents: number;
|
38
39
|
price_amount_float?: number | null;
|
@@ -40,6 +41,7 @@ interface ShippingMethod extends Resource {
|
|
40
41
|
free_over_amount_cents?: number | null;
|
41
42
|
free_over_amount_float?: number | null;
|
42
43
|
formatted_free_over_amount?: string | null;
|
44
|
+
use_subtotal?: boolean | null;
|
43
45
|
price_amount_for_shipment_cents?: number | null;
|
44
46
|
price_amount_for_shipment_float?: number | null;
|
45
47
|
formatted_price_amount_for_shipment?: string | null;
|
@@ -59,8 +61,10 @@ interface ShippingMethodCreate extends ResourceCreate {
|
|
59
61
|
name: string;
|
60
62
|
scheme?: string | null;
|
61
63
|
currency_code?: string | null;
|
64
|
+
external_prices_url?: string | null;
|
62
65
|
price_amount_cents: number;
|
63
66
|
free_over_amount_cents?: number | null;
|
67
|
+
use_subtotal?: boolean | null;
|
64
68
|
min_weight?: number | null;
|
65
69
|
max_weight?: number | null;
|
66
70
|
unit_of_weight?: string | null;
|
@@ -74,10 +78,12 @@ interface ShippingMethodUpdate extends ResourceUpdate {
|
|
74
78
|
name?: string | null;
|
75
79
|
scheme?: string | null;
|
76
80
|
currency_code?: string | null;
|
81
|
+
external_prices_url?: string | null;
|
77
82
|
_disable?: boolean | null;
|
78
83
|
_enable?: boolean | null;
|
79
84
|
price_amount_cents?: number | null;
|
80
85
|
free_over_amount_cents?: number | null;
|
86
|
+
use_subtotal?: boolean | null;
|
81
87
|
min_weight?: number | null;
|
82
88
|
max_weight?: number | null;
|
83
89
|
unit_of_weight?: string | null;
|
@@ -4,6 +4,7 @@ import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
|
4
4
|
import type { ShippingCategory, ShippingCategoryType } from './shipping_categories';
|
5
5
|
import type { Price } from './prices';
|
6
6
|
import type { StockItem } from './stock_items';
|
7
|
+
import type { StockReservation } from './stock_reservations';
|
7
8
|
import type { DeliveryLeadTime } from './delivery_lead_times';
|
8
9
|
import type { SkuOption } from './sku_options';
|
9
10
|
import type { Attachment } from './attachments';
|
@@ -35,6 +36,7 @@ interface Sku extends Resource {
|
|
35
36
|
shipping_category?: ShippingCategory | null;
|
36
37
|
prices?: Price[] | null;
|
37
38
|
stock_items?: StockItem[] | null;
|
39
|
+
stock_reservations?: StockReservation[] | null;
|
38
40
|
delivery_lead_times?: DeliveryLeadTime[] | null;
|
39
41
|
sku_options?: SkuOption[] | null;
|
40
42
|
attachments?: Attachment[] | null;
|
@@ -77,6 +79,7 @@ declare class Skus extends ApiResource<Sku> {
|
|
77
79
|
shipping_category(skuId: string | Sku, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ShippingCategory>;
|
78
80
|
prices(skuId: string | Sku, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Price>>;
|
79
81
|
stock_items(skuId: string | Sku, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockItem>>;
|
82
|
+
stock_reservations(skuId: string | Sku, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockReservation>>;
|
80
83
|
delivery_lead_times(skuId: string | Sku, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<DeliveryLeadTime>>;
|
81
84
|
sku_options(skuId: string | Sku, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<SkuOption>>;
|
82
85
|
attachments(skuId: string | Sku, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
@@ -21,6 +21,10 @@ class Skus extends ApiResource {
|
|
21
21
|
const _skuId = skuId.id || skuId;
|
22
22
|
return this.resources.fetch({ type: 'stock_items' }, `skus/${_skuId}/stock_items`, params, options);
|
23
23
|
}
|
24
|
+
async stock_reservations(skuId, params, options) {
|
25
|
+
const _skuId = skuId.id || skuId;
|
26
|
+
return this.resources.fetch({ type: 'stock_reservations' }, `skus/${_skuId}/stock_reservations`, params, options);
|
27
|
+
}
|
24
28
|
async delivery_lead_times(skuId, params, options) {
|
25
29
|
const _skuId = skuId.id || skuId;
|
26
30
|
return this.resources.fetch({ type: 'delivery_lead_times' }, `skus/${_skuId}/delivery_lead_times`, params, options);
|
@@ -3,6 +3,8 @@ import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesCon
|
|
3
3
|
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
4
|
import type { StockLocation, StockLocationType } from './stock_locations';
|
5
5
|
import type { Sku, SkuType } from './skus';
|
6
|
+
import type { ReservedStock } from './reserved_stocks';
|
7
|
+
import type { StockReservation } from './stock_reservations';
|
6
8
|
import type { Attachment } from './attachments';
|
7
9
|
type StockItemType = 'stock_items';
|
8
10
|
type StockItemRel = ResourceRel & {
|
@@ -20,6 +22,8 @@ interface StockItem extends Resource {
|
|
20
22
|
quantity: number;
|
21
23
|
stock_location?: StockLocation | null;
|
22
24
|
sku?: Sku | null;
|
25
|
+
reserved_stock?: ReservedStock | null;
|
26
|
+
stock_reservations?: StockReservation[] | null;
|
23
27
|
attachments?: Attachment[] | null;
|
24
28
|
}
|
25
29
|
interface StockItemCreate extends ResourceCreate {
|
@@ -41,6 +45,8 @@ declare class StockItems extends ApiResource<StockItem> {
|
|
41
45
|
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
42
46
|
stock_location(stockItemId: string | StockItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockLocation>;
|
43
47
|
sku(stockItemId: string | StockItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Sku>;
|
48
|
+
reserved_stock(stockItemId: string | StockItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ReservedStock>;
|
49
|
+
stock_reservations(stockItemId: string | StockItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockReservation>>;
|
44
50
|
attachments(stockItemId: string | StockItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
45
51
|
isStockItem(resource: any): resource is StockItem;
|
46
52
|
relationship(id: string | ResourceId | null): StockItemRel;
|
@@ -17,6 +17,14 @@ class StockItems extends ApiResource {
|
|
17
17
|
const _stockItemId = stockItemId.id || stockItemId;
|
18
18
|
return this.resources.fetch({ type: 'skus' }, `stock_items/${_stockItemId}/sku`, params, options);
|
19
19
|
}
|
20
|
+
async reserved_stock(stockItemId, params, options) {
|
21
|
+
const _stockItemId = stockItemId.id || stockItemId;
|
22
|
+
return this.resources.fetch({ type: 'reserved_stocks' }, `stock_items/${_stockItemId}/reserved_stock`, params, options);
|
23
|
+
}
|
24
|
+
async stock_reservations(stockItemId, params, options) {
|
25
|
+
const _stockItemId = stockItemId.id || stockItemId;
|
26
|
+
return this.resources.fetch({ type: 'stock_reservations' }, `stock_items/${_stockItemId}/stock_reservations`, params, options);
|
27
|
+
}
|
20
28
|
async attachments(stockItemId, params, options) {
|
21
29
|
const _stockItemId = stockItemId.id || stockItemId;
|
22
30
|
return this.resources.fetch({ type: 'attachments' }, `stock_items/${_stockItemId}/attachments`, params, options);
|
@@ -4,6 +4,7 @@ import type { QueryParamsRetrieve } from '../query';
|
|
4
4
|
import type { Shipment } from './shipments';
|
5
5
|
import type { LineItem } from './line_items';
|
6
6
|
import type { StockItem } from './stock_items';
|
7
|
+
import type { Sku } from './skus';
|
7
8
|
type StockLineItemType = 'stock_line_items';
|
8
9
|
type StockLineItemRel = ResourceRel & {
|
9
10
|
type: StockLineItemType;
|
@@ -16,12 +17,14 @@ interface StockLineItem extends Resource {
|
|
16
17
|
shipment?: Shipment | null;
|
17
18
|
line_item?: LineItem | null;
|
18
19
|
stock_item?: StockItem | null;
|
20
|
+
sku?: Sku | null;
|
19
21
|
}
|
20
22
|
declare class StockLineItems extends ApiResource<StockLineItem> {
|
21
23
|
static readonly TYPE: StockLineItemType;
|
22
24
|
shipment(stockLineItemId: string | StockLineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
|
23
25
|
line_item(stockLineItemId: string | StockLineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<LineItem>;
|
24
26
|
stock_item(stockLineItemId: string | StockLineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockItem>;
|
27
|
+
sku(stockLineItemId: string | StockLineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Sku>;
|
25
28
|
isStockLineItem(resource: any): resource is StockLineItem;
|
26
29
|
relationship(id: string | ResourceId | null): StockLineItemRel;
|
27
30
|
type(): StockLineItemType;
|
@@ -12,6 +12,10 @@ class StockLineItems extends ApiResource {
|
|
12
12
|
const _stockLineItemId = stockLineItemId.id || stockLineItemId;
|
13
13
|
return this.resources.fetch({ type: 'stock_items' }, `stock_line_items/${_stockLineItemId}/stock_item`, params, options);
|
14
14
|
}
|
15
|
+
async sku(stockLineItemId, params, options) {
|
16
|
+
const _stockLineItemId = stockLineItemId.id || stockLineItemId;
|
17
|
+
return this.resources.fetch({ type: 'skus' }, `stock_line_items/${_stockLineItemId}/sku`, params, options);
|
18
|
+
}
|
15
19
|
isStockLineItem(resource) {
|
16
20
|
return resource.type && (resource.type === StockLineItems.TYPE);
|
17
21
|
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
import type { Resource, ResourceId, ResourcesConfig, ResourceRel } from '../resource';
|
3
|
+
import type { QueryParamsRetrieve } from '../query';
|
4
|
+
import type { LineItem } from './line_items';
|
5
|
+
import type { Order } from './orders';
|
6
|
+
import type { StockItem } from './stock_items';
|
7
|
+
import type { ReservedStock } from './reserved_stocks';
|
8
|
+
import type { Sku } from './skus';
|
9
|
+
type StockReservationType = 'stock_reservations';
|
10
|
+
type StockReservationRel = ResourceRel & {
|
11
|
+
type: StockReservationType;
|
12
|
+
};
|
13
|
+
interface StockReservation extends Resource {
|
14
|
+
readonly type: StockReservationType;
|
15
|
+
status: 'draft' | 'pending';
|
16
|
+
quantity: number;
|
17
|
+
expires_at: string;
|
18
|
+
line_item?: LineItem | null;
|
19
|
+
order?: Order | null;
|
20
|
+
stock_item?: StockItem | null;
|
21
|
+
reserved_stock?: ReservedStock | null;
|
22
|
+
sku?: Sku | null;
|
23
|
+
}
|
24
|
+
declare class StockReservations extends ApiResource<StockReservation> {
|
25
|
+
static readonly TYPE: StockReservationType;
|
26
|
+
line_item(stockReservationId: string | StockReservation, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<LineItem>;
|
27
|
+
order(stockReservationId: string | StockReservation, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
28
|
+
stock_item(stockReservationId: string | StockReservation, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockItem>;
|
29
|
+
reserved_stock(stockReservationId: string | StockReservation, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ReservedStock>;
|
30
|
+
sku(stockReservationId: string | StockReservation, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Sku>;
|
31
|
+
isStockReservation(resource: any): resource is StockReservation;
|
32
|
+
relationship(id: string | ResourceId | null): StockReservationRel;
|
33
|
+
type(): StockReservationType;
|
34
|
+
}
|
35
|
+
export default StockReservations;
|
36
|
+
export type { StockReservation, StockReservationType };
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
class StockReservations extends ApiResource {
|
3
|
+
async line_item(stockReservationId, params, options) {
|
4
|
+
const _stockReservationId = stockReservationId.id || stockReservationId;
|
5
|
+
return this.resources.fetch({ type: 'line_items' }, `stock_reservations/${_stockReservationId}/line_item`, params, options);
|
6
|
+
}
|
7
|
+
async order(stockReservationId, params, options) {
|
8
|
+
const _stockReservationId = stockReservationId.id || stockReservationId;
|
9
|
+
return this.resources.fetch({ type: 'orders' }, `stock_reservations/${_stockReservationId}/order`, params, options);
|
10
|
+
}
|
11
|
+
async stock_item(stockReservationId, params, options) {
|
12
|
+
const _stockReservationId = stockReservationId.id || stockReservationId;
|
13
|
+
return this.resources.fetch({ type: 'stock_items' }, `stock_reservations/${_stockReservationId}/stock_item`, params, options);
|
14
|
+
}
|
15
|
+
async reserved_stock(stockReservationId, params, options) {
|
16
|
+
const _stockReservationId = stockReservationId.id || stockReservationId;
|
17
|
+
return this.resources.fetch({ type: 'reserved_stocks' }, `stock_reservations/${_stockReservationId}/reserved_stock`, params, options);
|
18
|
+
}
|
19
|
+
async sku(stockReservationId, params, options) {
|
20
|
+
const _stockReservationId = stockReservationId.id || stockReservationId;
|
21
|
+
return this.resources.fetch({ type: 'skus' }, `stock_reservations/${_stockReservationId}/sku`, params, options);
|
22
|
+
}
|
23
|
+
isStockReservation(resource) {
|
24
|
+
return resource.type && (resource.type === StockReservations.TYPE);
|
25
|
+
}
|
26
|
+
relationship(id) {
|
27
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: StockReservations.TYPE } : { id: id.id, type: StockReservations.TYPE };
|
28
|
+
}
|
29
|
+
type() {
|
30
|
+
return StockReservations.TYPE;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
StockReservations.TYPE = 'stock_reservations';
|
34
|
+
export default StockReservations;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
|
-
import type { Resource, ResourceId, ResourcesConfig, ResourceRel } from '../resource';
|
3
|
-
import type { QueryParamsRetrieve } from '../query';
|
2
|
+
import type { Resource, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
|
+
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
4
|
import type { Order } from './orders';
|
5
|
+
import type { Attachment } from './attachments';
|
5
6
|
type TransactionType = 'transactions';
|
6
7
|
type TransactionRel = ResourceRel & {
|
7
8
|
type: TransactionType;
|
@@ -20,10 +21,12 @@ interface Transaction extends Resource {
|
|
20
21
|
token?: string | null;
|
21
22
|
gateway_transaction_id?: string | null;
|
22
23
|
order?: Order | null;
|
24
|
+
attachments?: Attachment[] | null;
|
23
25
|
}
|
24
26
|
declare class Transactions extends ApiResource<Transaction> {
|
25
27
|
static readonly TYPE: TransactionType;
|
26
28
|
order(transactionId: string | Transaction, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
29
|
+
attachments(transactionId: string | Transaction, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
27
30
|
isTransaction(resource: any): resource is Transaction;
|
28
31
|
relationship(id: string | ResourceId | null): TransactionRel;
|
29
32
|
type(): TransactionType;
|
@@ -4,6 +4,10 @@ class Transactions extends ApiResource {
|
|
4
4
|
const _transactionId = transactionId.id || transactionId;
|
5
5
|
return this.resources.fetch({ type: 'orders' }, `transactions/${_transactionId}/order`, params, options);
|
6
6
|
}
|
7
|
+
async attachments(transactionId, params, options) {
|
8
|
+
const _transactionId = transactionId.id || transactionId;
|
9
|
+
return this.resources.fetch({ type: 'attachments' }, `transactions/${_transactionId}/attachments`, params, options);
|
10
|
+
}
|
7
11
|
isTransaction(resource) {
|
8
12
|
return resource.type && (resource.type === Transactions.TYPE);
|
9
13
|
}
|