@commercelayer/sdk 5.10.0 → 5.12.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 -0
- package/lib/cjs/client.js +1 -33
- package/lib/cjs/commercelayer.d.ts +0 -1
- package/lib/cjs/commercelayer.js +1 -1
- package/lib/cjs/error.d.ts +2 -1
- package/lib/cjs/error.js +38 -1
- package/lib/cjs/resource.d.ts +1 -1
- package/lib/cjs/resource.js +5 -5
- package/lib/cjs/resources/adyen_payments.d.ts +1 -0
- package/lib/cjs/resources/adyen_payments.js +3 -0
- package/lib/cjs/resources/authorizations.d.ts +3 -0
- package/lib/cjs/resources/authorizations.js +9 -0
- package/lib/cjs/resources/axerve_payments.d.ts +1 -0
- package/lib/cjs/resources/axerve_payments.js +3 -0
- package/lib/cjs/resources/bundles.d.ts +2 -0
- package/lib/cjs/resources/bundles.js +6 -0
- package/lib/cjs/resources/captures.d.ts +2 -0
- package/lib/cjs/resources/captures.js +6 -0
- package/lib/cjs/resources/checkout_com_payments.d.ts +2 -0
- package/lib/cjs/resources/checkout_com_payments.js +6 -0
- package/lib/cjs/resources/customer_password_resets.d.ts +1 -0
- package/lib/cjs/resources/customer_password_resets.js +3 -0
- package/lib/cjs/resources/gift_cards.d.ts +4 -0
- package/lib/cjs/resources/gift_cards.js +12 -0
- package/lib/cjs/resources/in_stock_subscriptions.d.ts +2 -0
- package/lib/cjs/resources/in_stock_subscriptions.js +6 -0
- package/lib/cjs/resources/klarna_payments.d.ts +1 -0
- package/lib/cjs/resources/klarna_payments.js +3 -0
- package/lib/cjs/resources/line_items.d.ts +2 -0
- package/lib/cjs/resources/line_items.js +6 -0
- package/lib/cjs/resources/markets.d.ts +2 -0
- package/lib/cjs/resources/markets.js +6 -0
- package/lib/cjs/resources/order_subscriptions.d.ts +3 -0
- package/lib/cjs/resources/order_subscriptions.js +9 -0
- package/lib/cjs/resources/orders.d.ts +27 -0
- package/lib/cjs/resources/orders.js +81 -0
- package/lib/cjs/resources/payment_methods.d.ts +2 -0
- package/lib/cjs/resources/payment_methods.js +6 -0
- package/lib/cjs/resources/return_line_items.d.ts +1 -0
- package/lib/cjs/resources/return_line_items.js +3 -0
- package/lib/cjs/resources/returns.d.ts +9 -0
- package/lib/cjs/resources/returns.js +27 -0
- package/lib/cjs/resources/satispay_payments.d.ts +1 -0
- package/lib/cjs/resources/satispay_payments.js +3 -0
- package/lib/cjs/resources/shipments.d.ts +7 -0
- package/lib/cjs/resources/shipments.js +21 -0
- package/lib/cjs/resources/shipping_methods.d.ts +2 -0
- package/lib/cjs/resources/shipping_methods.js +6 -0
- package/lib/cjs/resources/stock_transfers.d.ts +5 -0
- package/lib/cjs/resources/stock_transfers.js +15 -0
- package/lib/cjs/resources/stripe_payments.d.ts +2 -0
- package/lib/cjs/resources/stripe_payments.js +6 -0
- package/lib/cjs/resources/webhooks.d.ts +1 -0
- package/lib/cjs/resources/webhooks.js +3 -0
- package/lib/esm/api.d.ts +4 -0
- package/lib/esm/client.js +1 -33
- package/lib/esm/commercelayer.d.ts +0 -1
- package/lib/esm/commercelayer.js +1 -1
- package/lib/esm/error.d.ts +2 -1
- package/lib/esm/error.js +34 -1
- package/lib/esm/resource.d.ts +1 -1
- package/lib/esm/resource.js +5 -5
- package/lib/esm/resources/adyen_payments.d.ts +1 -0
- package/lib/esm/resources/adyen_payments.js +3 -0
- package/lib/esm/resources/authorizations.d.ts +3 -0
- package/lib/esm/resources/authorizations.js +9 -0
- package/lib/esm/resources/axerve_payments.d.ts +1 -0
- package/lib/esm/resources/axerve_payments.js +3 -0
- package/lib/esm/resources/bundles.d.ts +2 -0
- package/lib/esm/resources/bundles.js +6 -0
- package/lib/esm/resources/captures.d.ts +2 -0
- package/lib/esm/resources/captures.js +6 -0
- package/lib/esm/resources/checkout_com_payments.d.ts +2 -0
- package/lib/esm/resources/checkout_com_payments.js +6 -0
- package/lib/esm/resources/customer_password_resets.d.ts +1 -0
- package/lib/esm/resources/customer_password_resets.js +3 -0
- package/lib/esm/resources/gift_cards.d.ts +4 -0
- package/lib/esm/resources/gift_cards.js +12 -0
- package/lib/esm/resources/in_stock_subscriptions.d.ts +2 -0
- package/lib/esm/resources/in_stock_subscriptions.js +6 -0
- package/lib/esm/resources/klarna_payments.d.ts +1 -0
- package/lib/esm/resources/klarna_payments.js +3 -0
- package/lib/esm/resources/line_items.d.ts +2 -0
- package/lib/esm/resources/line_items.js +6 -0
- package/lib/esm/resources/markets.d.ts +2 -0
- package/lib/esm/resources/markets.js +6 -0
- package/lib/esm/resources/order_subscriptions.d.ts +3 -0
- package/lib/esm/resources/order_subscriptions.js +9 -0
- package/lib/esm/resources/orders.d.ts +27 -0
- package/lib/esm/resources/orders.js +81 -0
- package/lib/esm/resources/payment_methods.d.ts +2 -0
- package/lib/esm/resources/payment_methods.js +6 -0
- package/lib/esm/resources/return_line_items.d.ts +1 -0
- package/lib/esm/resources/return_line_items.js +3 -0
- package/lib/esm/resources/returns.d.ts +9 -0
- package/lib/esm/resources/returns.js +27 -0
- package/lib/esm/resources/satispay_payments.d.ts +1 -0
- package/lib/esm/resources/satispay_payments.js +3 -0
- package/lib/esm/resources/shipments.d.ts +7 -0
- package/lib/esm/resources/shipments.js +21 -0
- package/lib/esm/resources/shipping_methods.d.ts +2 -0
- package/lib/esm/resources/shipping_methods.js +6 -0
- package/lib/esm/resources/stock_transfers.d.ts +5 -0
- package/lib/esm/resources/stock_transfers.js +15 -0
- package/lib/esm/resources/stripe_payments.d.ts +2 -0
- package/lib/esm/resources/stripe_payments.js +6 -0
- package/lib/esm/resources/webhooks.d.ts +1 -0
- package/lib/esm/resources/webhooks.js +3 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
@@ -65,6 +65,8 @@ declare class PaymentMethods extends ApiResource<PaymentMethod> {
|
|
65
65
|
market(paymentMethodId: string | PaymentMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Market>;
|
66
66
|
payment_gateway(paymentMethodId: string | PaymentMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentGateway>;
|
67
67
|
attachments(paymentMethodId: string | PaymentMethod, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
68
|
+
_disable(id: string | PaymentMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentMethod>;
|
69
|
+
_enable(id: string | PaymentMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentMethod>;
|
68
70
|
isPaymentMethod(resource: any): resource is PaymentMethod;
|
69
71
|
relationship(id: string | ResourceId | null): PaymentMethodRel;
|
70
72
|
type(): PaymentMethodType;
|
@@ -23,6 +23,12 @@ class PaymentMethods extends resource_1.ApiResource {
|
|
23
23
|
const _paymentMethodId = paymentMethodId.id || paymentMethodId;
|
24
24
|
return this.resources.fetch({ type: 'attachments' }, `payment_methods/${_paymentMethodId}/attachments`, params, options);
|
25
25
|
}
|
26
|
+
async _disable(id, params, options) {
|
27
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: PaymentMethods.TYPE, _disable: true }, params, options);
|
28
|
+
}
|
29
|
+
async _enable(id, params, options) {
|
30
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: PaymentMethods.TYPE, _enable: true }, params, options);
|
31
|
+
}
|
26
32
|
isPaymentMethod(resource) {
|
27
33
|
return resource.type && (resource.type === PaymentMethods.TYPE);
|
28
34
|
}
|
@@ -43,6 +43,7 @@ declare class ReturnLineItems extends ApiResource<ReturnLineItem> {
|
|
43
43
|
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
44
44
|
return(returnLineItemId: string | ReturnLineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Return>;
|
45
45
|
line_item(returnLineItemId: string | ReturnLineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<LineItem>;
|
46
|
+
_restock(id: string | ReturnLineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ReturnLineItem>;
|
46
47
|
isReturnLineItem(resource: any): resource is ReturnLineItem;
|
47
48
|
relationship(id: string | ResourceId | null): ReturnLineItemRel;
|
48
49
|
type(): ReturnLineItemType;
|
@@ -19,6 +19,9 @@ class ReturnLineItems extends resource_1.ApiResource {
|
|
19
19
|
const _returnLineItemId = returnLineItemId.id || returnLineItemId;
|
20
20
|
return this.resources.fetch({ type: 'line_items' }, `return_line_items/${_returnLineItemId}/line_item`, params, options);
|
21
21
|
}
|
22
|
+
async _restock(id, params, options) {
|
23
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ReturnLineItems.TYPE, _restock: true }, params, options);
|
24
|
+
}
|
22
25
|
isReturnLineItem(resource) {
|
23
26
|
return resource.type && (resource.type === ReturnLineItems.TYPE);
|
24
27
|
}
|
@@ -76,6 +76,15 @@ declare class Returns extends ApiResource<Return> {
|
|
76
76
|
attachments(returnId: string | Return, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
77
77
|
events(returnId: string | Return, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
78
78
|
tags(returnId: string | Return, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
79
|
+
_request(id: string | Return, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Return>;
|
80
|
+
_approve(id: string | Return, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Return>;
|
81
|
+
_cancel(id: string | Return, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Return>;
|
82
|
+
_ship(id: string | Return, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Return>;
|
83
|
+
_reject(id: string | Return, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Return>;
|
84
|
+
_receive(id: string | Return, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Return>;
|
85
|
+
_restock(id: string | Return, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Return>;
|
86
|
+
_archive(id: string | Return, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Return>;
|
87
|
+
_unarchive(id: string | Return, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Return>;
|
79
88
|
isReturn(resource: any): resource is Return;
|
80
89
|
relationship(id: string | ResourceId | null): ReturnRel;
|
81
90
|
type(): ReturnType;
|
@@ -47,6 +47,33 @@ class Returns extends resource_1.ApiResource {
|
|
47
47
|
const _returnId = returnId.id || returnId;
|
48
48
|
return this.resources.fetch({ type: 'tags' }, `returns/${_returnId}/tags`, params, options);
|
49
49
|
}
|
50
|
+
async _request(id, params, options) {
|
51
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Returns.TYPE, _request: true }, params, options);
|
52
|
+
}
|
53
|
+
async _approve(id, params, options) {
|
54
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Returns.TYPE, _approve: true }, params, options);
|
55
|
+
}
|
56
|
+
async _cancel(id, params, options) {
|
57
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Returns.TYPE, _cancel: true }, params, options);
|
58
|
+
}
|
59
|
+
async _ship(id, params, options) {
|
60
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Returns.TYPE, _ship: true }, params, options);
|
61
|
+
}
|
62
|
+
async _reject(id, params, options) {
|
63
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Returns.TYPE, _reject: true }, params, options);
|
64
|
+
}
|
65
|
+
async _receive(id, params, options) {
|
66
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Returns.TYPE, _receive: true }, params, options);
|
67
|
+
}
|
68
|
+
async _restock(id, params, options) {
|
69
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Returns.TYPE, _restock: true }, params, options);
|
70
|
+
}
|
71
|
+
async _archive(id, params, options) {
|
72
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Returns.TYPE, _archive: true }, params, options);
|
73
|
+
}
|
74
|
+
async _unarchive(id, params, options) {
|
75
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Returns.TYPE, _unarchive: true }, params, options);
|
76
|
+
}
|
50
77
|
isReturn(resource) {
|
51
78
|
return resource.type && (resource.type === Returns.TYPE);
|
52
79
|
}
|
@@ -40,6 +40,7 @@ declare class SatispayPayments extends ApiResource<SatispayPayment> {
|
|
40
40
|
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
41
41
|
order(satispayPaymentId: string | SatispayPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
42
42
|
payment_gateway(satispayPaymentId: string | SatispayPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentGateway>;
|
43
|
+
_refresh(id: string | SatispayPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SatispayPayment>;
|
43
44
|
isSatispayPayment(resource: any): resource is SatispayPayment;
|
44
45
|
relationship(id: string | ResourceId | null): SatispayPaymentRel;
|
45
46
|
type(): SatispayPaymentType;
|
@@ -19,6 +19,9 @@ class SatispayPayments extends resource_1.ApiResource {
|
|
19
19
|
const _satispayPaymentId = satispayPaymentId.id || satispayPaymentId;
|
20
20
|
return this.resources.fetch({ type: 'payment_gateways' }, `satispay_payments/${_satispayPaymentId}/payment_gateway`, params, options);
|
21
21
|
}
|
22
|
+
async _refresh(id, params, options) {
|
23
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: SatispayPayments.TYPE, _refresh: true }, params, options);
|
24
|
+
}
|
22
25
|
isSatispayPayment(resource) {
|
23
26
|
return resource.type && (resource.type === SatispayPayments.TYPE);
|
24
27
|
}
|
@@ -91,6 +91,13 @@ declare class Shipments extends ApiResource<Shipment> {
|
|
91
91
|
parcels(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Parcel>>;
|
92
92
|
attachments(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
93
93
|
events(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
94
|
+
_on_hold(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
|
95
|
+
_picking(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
|
96
|
+
_packing(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
|
97
|
+
_ready_to_ship(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
|
98
|
+
_ship(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
|
99
|
+
_get_rates(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
|
100
|
+
_purchase(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
|
94
101
|
isShipment(resource: any): resource is Shipment;
|
95
102
|
relationship(id: string | ResourceId | null): ShipmentRel;
|
96
103
|
type(): ShipmentType;
|
@@ -61,6 +61,27 @@ class Shipments extends resource_1.ApiResource {
|
|
61
61
|
const _shipmentId = shipmentId.id || shipmentId;
|
62
62
|
return this.resources.fetch({ type: 'events' }, `shipments/${_shipmentId}/events`, params, options);
|
63
63
|
}
|
64
|
+
async _on_hold(id, params, options) {
|
65
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Shipments.TYPE, _on_hold: true }, params, options);
|
66
|
+
}
|
67
|
+
async _picking(id, params, options) {
|
68
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Shipments.TYPE, _picking: true }, params, options);
|
69
|
+
}
|
70
|
+
async _packing(id, params, options) {
|
71
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Shipments.TYPE, _packing: true }, params, options);
|
72
|
+
}
|
73
|
+
async _ready_to_ship(id, params, options) {
|
74
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Shipments.TYPE, _ready_to_ship: true }, params, options);
|
75
|
+
}
|
76
|
+
async _ship(id, params, options) {
|
77
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Shipments.TYPE, _ship: true }, params, options);
|
78
|
+
}
|
79
|
+
async _get_rates(id, params, options) {
|
80
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Shipments.TYPE, _get_rates: true }, params, options);
|
81
|
+
}
|
82
|
+
async _purchase(id, params, options) {
|
83
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Shipments.TYPE, _purchase: true }, params, options);
|
84
|
+
}
|
64
85
|
isShipment(resource) {
|
65
86
|
return resource.type && (resource.type === Shipments.TYPE);
|
66
87
|
}
|
@@ -106,6 +106,8 @@ declare class ShippingMethods extends ApiResource<ShippingMethod> {
|
|
106
106
|
shipping_method_tiers(shippingMethodId: string | ShippingMethod, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<ShippingMethodTier>>;
|
107
107
|
shipping_weight_tiers(shippingMethodId: string | ShippingMethod, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<ShippingWeightTier>>;
|
108
108
|
attachments(shippingMethodId: string | ShippingMethod, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
109
|
+
_disable(id: string | ShippingMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ShippingMethod>;
|
110
|
+
_enable(id: string | ShippingMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ShippingMethod>;
|
109
111
|
isShippingMethod(resource: any): resource is ShippingMethod;
|
110
112
|
relationship(id: string | ResourceId | null): ShippingMethodRel;
|
111
113
|
type(): ShippingMethodType;
|
@@ -43,6 +43,12 @@ class ShippingMethods extends resource_1.ApiResource {
|
|
43
43
|
const _shippingMethodId = shippingMethodId.id || shippingMethodId;
|
44
44
|
return this.resources.fetch({ type: 'attachments' }, `shipping_methods/${_shippingMethodId}/attachments`, params, options);
|
45
45
|
}
|
46
|
+
async _disable(id, params, options) {
|
47
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ShippingMethods.TYPE, _disable: true }, params, options);
|
48
|
+
}
|
49
|
+
async _enable(id, params, options) {
|
50
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ShippingMethods.TYPE, _enable: true }, params, options);
|
51
|
+
}
|
46
52
|
isShippingMethod(resource) {
|
47
53
|
return resource.type && (resource.type === ShippingMethods.TYPE);
|
48
54
|
}
|
@@ -67,6 +67,11 @@ declare class StockTransfers extends ApiResource<StockTransfer> {
|
|
67
67
|
shipment(stockTransferId: string | StockTransfer, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
|
68
68
|
line_item(stockTransferId: string | StockTransfer, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<LineItem>;
|
69
69
|
events(stockTransferId: string | StockTransfer, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
70
|
+
_upcoming(id: string | StockTransfer, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockTransfer>;
|
71
|
+
_picking(id: string | StockTransfer, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockTransfer>;
|
72
|
+
_in_transit(id: string | StockTransfer, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockTransfer>;
|
73
|
+
_complete(id: string | StockTransfer, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockTransfer>;
|
74
|
+
_cancel(id: string | StockTransfer, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockTransfer>;
|
70
75
|
isStockTransfer(resource: any): resource is StockTransfer;
|
71
76
|
relationship(id: string | ResourceId | null): StockTransferRel;
|
72
77
|
type(): StockTransferType;
|
@@ -35,6 +35,21 @@ class StockTransfers extends resource_1.ApiResource {
|
|
35
35
|
const _stockTransferId = stockTransferId.id || stockTransferId;
|
36
36
|
return this.resources.fetch({ type: 'events' }, `stock_transfers/${_stockTransferId}/events`, params, options);
|
37
37
|
}
|
38
|
+
async _upcoming(id, params, options) {
|
39
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: StockTransfers.TYPE, _upcoming: true }, params, options);
|
40
|
+
}
|
41
|
+
async _picking(id, params, options) {
|
42
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: StockTransfers.TYPE, _picking: true }, params, options);
|
43
|
+
}
|
44
|
+
async _in_transit(id, params, options) {
|
45
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: StockTransfers.TYPE, _in_transit: true }, params, options);
|
46
|
+
}
|
47
|
+
async _complete(id, params, options) {
|
48
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: StockTransfers.TYPE, _complete: true }, params, options);
|
49
|
+
}
|
50
|
+
async _cancel(id, params, options) {
|
51
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: StockTransfers.TYPE, _cancel: true }, params, options);
|
52
|
+
}
|
38
53
|
isStockTransfer(resource) {
|
39
54
|
return resource.type && (resource.type === StockTransfers.TYPE);
|
40
55
|
}
|
@@ -41,6 +41,8 @@ declare class StripePayments extends ApiResource<StripePayment> {
|
|
41
41
|
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
42
42
|
order(stripePaymentId: string | StripePayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
43
43
|
payment_gateway(stripePaymentId: string | StripePayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentGateway>;
|
44
|
+
_update(id: string | StripePayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StripePayment>;
|
45
|
+
_refresh(id: string | StripePayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StripePayment>;
|
44
46
|
isStripePayment(resource: any): resource is StripePayment;
|
45
47
|
relationship(id: string | ResourceId | null): StripePaymentRel;
|
46
48
|
type(): StripePaymentType;
|
@@ -19,6 +19,12 @@ class StripePayments extends resource_1.ApiResource {
|
|
19
19
|
const _stripePaymentId = stripePaymentId.id || stripePaymentId;
|
20
20
|
return this.resources.fetch({ type: 'payment_gateways' }, `stripe_payments/${_stripePaymentId}/payment_gateway`, params, options);
|
21
21
|
}
|
22
|
+
async _update(id, params, options) {
|
23
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: StripePayments.TYPE, _update: true }, params, options);
|
24
|
+
}
|
25
|
+
async _refresh(id, params, options) {
|
26
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: StripePayments.TYPE, _refresh: true }, params, options);
|
27
|
+
}
|
22
28
|
isStripePayment(resource) {
|
23
29
|
return resource.type && (resource.type === StripePayments.TYPE);
|
24
30
|
}
|
@@ -36,6 +36,7 @@ declare class Webhooks extends ApiResource<Webhook> {
|
|
36
36
|
update(resource: WebhookUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
|
37
37
|
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
38
38
|
last_event_callbacks(webhookId: string | Webhook, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<EventCallback>>;
|
39
|
+
_reset_circuit(id: string | Webhook, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
|
39
40
|
isWebhook(resource: any): resource is Webhook;
|
40
41
|
relationship(id: string | ResourceId | null): WebhookRel;
|
41
42
|
type(): WebhookType;
|
@@ -15,6 +15,9 @@ class Webhooks extends resource_1.ApiResource {
|
|
15
15
|
const _webhookId = webhookId.id || webhookId;
|
16
16
|
return this.resources.fetch({ type: 'event_callbacks' }, `webhooks/${_webhookId}/last_event_callbacks`, params, options);
|
17
17
|
}
|
18
|
+
async _reset_circuit(id, params, options) {
|
19
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Webhooks.TYPE, _reset_circuit: true }, params, options);
|
20
|
+
}
|
18
21
|
isWebhook(resource) {
|
19
22
|
return resource.type && (resource.type === Webhooks.TYPE);
|
20
23
|
}
|
package/lib/esm/api.d.ts
CHANGED
@@ -139,3 +139,7 @@ export type DeletableResourceType = 'addresses' | 'adjustments' | 'adyen_gateway
|
|
139
139
|
export type DeletableResource = {
|
140
140
|
type: DeletableResourceType;
|
141
141
|
};
|
142
|
+
export type TaggableResourceType = 'addresses' | 'bundles' | 'coupons' | 'customers' | 'external_promotions' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_cards' | 'line_item_options' | 'line_items' | 'orders' | 'percentage_discount_promotions' | 'promotions' | 'returns' | 'sku_options' | 'skus';
|
143
|
+
export type TaggableResource = {
|
144
|
+
type: TaggableResourceType;
|
145
|
+
};
|
package/lib/esm/client.js
CHANGED
@@ -11,45 +11,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
11
11
|
};
|
12
12
|
var _ApiClient_accessToken, _ApiClient_client;
|
13
13
|
import axios from 'axios';
|
14
|
-
import { SdkError,
|
14
|
+
import { SdkError, handleError } from './error';
|
15
15
|
import config from './config';
|
16
16
|
import Debug from './debug';
|
17
17
|
const debug = Debug('client');
|
18
18
|
const baseURL = (organization, domain) => {
|
19
19
|
return `https://${organization.toLowerCase()}.${domain || config.default.domain}/api`;
|
20
20
|
};
|
21
|
-
const handleError = (error) => {
|
22
|
-
let sdkError = new SdkError({ message: error.message });
|
23
|
-
if (axios.isAxiosError(error)) {
|
24
|
-
if (error.response) {
|
25
|
-
// The request was made and the server responded with a status code that falls out of the range of 2xx
|
26
|
-
const apiError = new ApiError(sdkError);
|
27
|
-
apiError.type = ErrorType.RESPONSE;
|
28
|
-
apiError.status = error.response.status;
|
29
|
-
apiError.statusText = error.response.statusText;
|
30
|
-
apiError.code = String(apiError.status);
|
31
|
-
apiError.errors = error.response.data.errors;
|
32
|
-
if (!apiError.message && apiError.statusText)
|
33
|
-
apiError.message = apiError.statusText;
|
34
|
-
sdkError = apiError;
|
35
|
-
}
|
36
|
-
else if (error.request) {
|
37
|
-
// The request was made but no response was received
|
38
|
-
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js
|
39
|
-
sdkError.type = ErrorType.REQUEST;
|
40
|
-
sdkError.request = error.request;
|
41
|
-
}
|
42
|
-
else {
|
43
|
-
// Something happened in setting up the request that triggered an Error
|
44
|
-
sdkError.type = ErrorType.CLIENT;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
else if (axios.isCancel(error))
|
48
|
-
sdkError.type = ErrorType.CANCEL;
|
49
|
-
else
|
50
|
-
sdkError.source = error;
|
51
|
-
throw sdkError;
|
52
|
-
};
|
53
21
|
class ApiClient {
|
54
22
|
static create(options) {
|
55
23
|
for (const attr of config.client.requiredAttributes)
|
@@ -9,7 +9,6 @@ type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
|
|
9
9
|
type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
|
10
10
|
declare class CommerceLayerClient {
|
11
11
|
#private;
|
12
|
-
static get openApiSchemaVersion(): string;
|
13
12
|
readonly openApiSchemaVersion = "4.10.1";
|
14
13
|
addresses: api.Addresses;
|
15
14
|
adjustments: api.Adjustments;
|
package/lib/esm/commercelayer.js
CHANGED
@@ -19,9 +19,9 @@ const debug = Debug('commercelayer');
|
|
19
19
|
const OPEN_API_SCHEMA_VERSION = '4.10.1';
|
20
20
|
export { OPEN_API_SCHEMA_VERSION };
|
21
21
|
class CommerceLayerClient {
|
22
|
-
static get openApiSchemaVersion() { return OPEN_API_SCHEMA_VERSION; }
|
23
22
|
// ##__CL_RESOURCES_DEF_STOP__##
|
24
23
|
constructor(config) {
|
24
|
+
// static get openApiSchemaVersion(): string { return OPEN_API_SCHEMA_VERSION }
|
25
25
|
this.openApiSchemaVersion = OPEN_API_SCHEMA_VERSION;
|
26
26
|
_CommerceLayerClient_adapter.set(this, void 0);
|
27
27
|
_CommerceLayerClient_organization.set(this, void 0);
|
package/lib/esm/error.d.ts
CHANGED
package/lib/esm/error.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import axios from 'axios';
|
1
2
|
var ErrorType;
|
2
3
|
(function (ErrorType) {
|
3
4
|
ErrorType["CLIENT"] = "client";
|
@@ -32,4 +33,36 @@ class ApiError extends SdkError {
|
|
32
33
|
}
|
33
34
|
}
|
34
35
|
ApiError.NAME = 'ApiError';
|
35
|
-
|
36
|
+
const handleError = (error) => {
|
37
|
+
let sdkError = new SdkError({ message: error.message });
|
38
|
+
if (axios.isAxiosError(error)) {
|
39
|
+
if (error.response) {
|
40
|
+
// The request was made and the server responded with a status code that falls out of the range of 2xx
|
41
|
+
const apiError = new ApiError(sdkError);
|
42
|
+
apiError.type = ErrorType.RESPONSE;
|
43
|
+
apiError.status = error.response.status;
|
44
|
+
apiError.statusText = error.response.statusText;
|
45
|
+
apiError.code = String(apiError.status);
|
46
|
+
apiError.errors = error.response.data.errors;
|
47
|
+
if (!apiError.message && apiError.statusText)
|
48
|
+
apiError.message = apiError.statusText;
|
49
|
+
sdkError = apiError;
|
50
|
+
}
|
51
|
+
else if (error.request) {
|
52
|
+
// The request was made but no response was received
|
53
|
+
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js
|
54
|
+
sdkError.type = ErrorType.REQUEST;
|
55
|
+
sdkError.request = error.request;
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
// Something happened in setting up the request that triggered an Error
|
59
|
+
sdkError.type = ErrorType.CLIENT;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
else if (axios.isCancel(error))
|
63
|
+
sdkError.type = ErrorType.CANCEL;
|
64
|
+
else
|
65
|
+
sdkError.source = error;
|
66
|
+
throw sdkError;
|
67
|
+
};
|
68
|
+
export { SdkError, ApiError, ErrorType, handleError };
|
package/lib/esm/resource.d.ts
CHANGED
@@ -71,11 +71,11 @@ declare abstract class ApiResourceBase<R extends Resource> {
|
|
71
71
|
abstract relationship(id: string | ResourceId | null): ResourceRel;
|
72
72
|
abstract type(): ResourceTypeLock;
|
73
73
|
update(resource: ResourceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
74
|
-
count(filter?: QueryFilter | QueryParamsList, options?: ResourcesConfig): Promise<number>;
|
75
74
|
}
|
76
75
|
declare abstract class ApiResource<R extends Resource> extends ApiResourceBase<R> {
|
77
76
|
retrieve(id: string | ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
78
77
|
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<R>>;
|
78
|
+
count(filter?: QueryFilter | QueryParamsList, options?: ResourcesConfig): Promise<number>;
|
79
79
|
}
|
80
80
|
declare abstract class ApiSingleton<R extends Resource> extends ApiResourceBase<R> {
|
81
81
|
retrieve(params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
package/lib/esm/resource.js
CHANGED
@@ -140,11 +140,6 @@ class ApiResourceBase {
|
|
140
140
|
async update(resource, params, options) {
|
141
141
|
return this.resources.update({ ...resource, type: this.type() }, params, options);
|
142
142
|
}
|
143
|
-
async count(filter, options) {
|
144
|
-
const params = { filters: isParamsList(filter) ? filter.filters : filter, pageNumber: 1, pageSize: 1 };
|
145
|
-
const response = await this.resources.list({ type: this.type() }, params, options);
|
146
|
-
return Promise.resolve(response.meta.recordCount);
|
147
|
-
}
|
148
143
|
}
|
149
144
|
class ApiResource extends ApiResourceBase {
|
150
145
|
async retrieve(id, params, options) {
|
@@ -153,6 +148,11 @@ class ApiResource extends ApiResourceBase {
|
|
153
148
|
async list(params, options) {
|
154
149
|
return this.resources.list({ type: this.type() }, params, options);
|
155
150
|
}
|
151
|
+
async count(filter, options) {
|
152
|
+
const params = { filters: isParamsList(filter) ? filter.filters : filter, pageNumber: 1, pageSize: 1 };
|
153
|
+
const response = await this.list(params, options);
|
154
|
+
return Promise.resolve(response.meta.recordCount);
|
155
|
+
}
|
156
156
|
}
|
157
157
|
class ApiSingleton extends ApiResourceBase {
|
158
158
|
async retrieve(params, options) {
|
@@ -39,6 +39,7 @@ declare class AdyenPayments extends ApiResource<AdyenPayment> {
|
|
39
39
|
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
40
40
|
order(adyenPaymentId: string | AdyenPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
41
41
|
payment_gateway(adyenPaymentId: string | AdyenPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentGateway>;
|
42
|
+
_details(id: string | AdyenPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<AdyenPayment>;
|
42
43
|
isAdyenPayment(resource: any): resource is AdyenPayment;
|
43
44
|
relationship(id: string | ResourceId | null): AdyenPaymentRel;
|
44
45
|
type(): AdyenPaymentType;
|
@@ -17,6 +17,9 @@ class AdyenPayments extends ApiResource {
|
|
17
17
|
const _adyenPaymentId = adyenPaymentId.id || adyenPaymentId;
|
18
18
|
return this.resources.fetch({ type: 'payment_gateways' }, `adyen_payments/${_adyenPaymentId}/payment_gateway`, params, options);
|
19
19
|
}
|
20
|
+
async _details(id, params, options) {
|
21
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: AdyenPayments.TYPE, _details: true }, params, options);
|
22
|
+
}
|
20
23
|
isAdyenPayment(resource) {
|
21
24
|
return resource.type && (resource.type === AdyenPayments.TYPE);
|
22
25
|
}
|
@@ -56,6 +56,9 @@ declare class Authorizations extends ApiResource<Authorization> {
|
|
56
56
|
captures(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Capture>>;
|
57
57
|
voids(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Void>>;
|
58
58
|
events(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
59
|
+
_capture(id: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
|
60
|
+
_capture_amount_cents(id: string | Authorization, triggerValue: number, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
|
61
|
+
_void(id: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
|
59
62
|
isAuthorization(resource: any): resource is Authorization;
|
60
63
|
relationship(id: string | ResourceId | null): AuthorizationRel;
|
61
64
|
type(): AuthorizationType;
|
@@ -23,6 +23,15 @@ class Authorizations extends ApiResource {
|
|
23
23
|
const _authorizationId = authorizationId.id || authorizationId;
|
24
24
|
return this.resources.fetch({ type: 'events' }, `authorizations/${_authorizationId}/events`, params, options);
|
25
25
|
}
|
26
|
+
async _capture(id, params, options) {
|
27
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Authorizations.TYPE, _capture: true }, params, options);
|
28
|
+
}
|
29
|
+
async _capture_amount_cents(id, triggerValue, params, options) {
|
30
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Authorizations.TYPE, _capture_amount_cents: triggerValue }, params, options);
|
31
|
+
}
|
32
|
+
async _void(id, params, options) {
|
33
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Authorizations.TYPE, _void: true }, params, options);
|
34
|
+
}
|
26
35
|
isAuthorization(resource) {
|
27
36
|
return resource.type && (resource.type === Authorizations.TYPE);
|
28
37
|
}
|
@@ -39,6 +39,7 @@ declare class AxervePayments extends ApiResource<AxervePayment> {
|
|
39
39
|
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
40
40
|
order(axervePaymentId: string | AxervePayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
41
41
|
payment_gateway(axervePaymentId: string | AxervePayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentGateway>;
|
42
|
+
_update(id: string | AxervePayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<AxervePayment>;
|
42
43
|
isAxervePayment(resource: any): resource is AxervePayment;
|
43
44
|
relationship(id: string | ResourceId | null): AxervePaymentRel;
|
44
45
|
type(): AxervePaymentType;
|
@@ -17,6 +17,9 @@ class AxervePayments extends ApiResource {
|
|
17
17
|
const _axervePaymentId = axervePaymentId.id || axervePaymentId;
|
18
18
|
return this.resources.fetch({ type: 'payment_gateways' }, `axerve_payments/${_axervePaymentId}/payment_gateway`, params, options);
|
19
19
|
}
|
20
|
+
async _update(id, params, options) {
|
21
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: AxervePayments.TYPE, _update: true }, params, options);
|
22
|
+
}
|
20
23
|
isAxervePayment(resource) {
|
21
24
|
return resource.type && (resource.type === AxervePayments.TYPE);
|
22
25
|
}
|
@@ -80,6 +80,8 @@ declare class Bundles extends ApiResource<Bundle> {
|
|
80
80
|
attachments(bundleId: string | Bundle, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
81
81
|
events(bundleId: string | Bundle, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
82
82
|
tags(bundleId: string | Bundle, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
83
|
+
_compute_price_amount(id: string | Bundle, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Bundle>;
|
84
|
+
_compute_compare_at_amount(id: string | Bundle, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Bundle>;
|
83
85
|
isBundle(resource: any): resource is Bundle;
|
84
86
|
relationship(id: string | ResourceId | null): BundleRel;
|
85
87
|
type(): BundleType;
|
@@ -33,6 +33,12 @@ class Bundles extends ApiResource {
|
|
33
33
|
const _bundleId = bundleId.id || bundleId;
|
34
34
|
return this.resources.fetch({ type: 'tags' }, `bundles/${_bundleId}/tags`, params, options);
|
35
35
|
}
|
36
|
+
async _compute_price_amount(id, params, options) {
|
37
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Bundles.TYPE, _compute_price_amount: true }, params, options);
|
38
|
+
}
|
39
|
+
async _compute_compare_at_amount(id, params, options) {
|
40
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Bundles.TYPE, _compute_compare_at_amount: true }, params, options);
|
41
|
+
}
|
36
42
|
isBundle(resource) {
|
37
43
|
return resource.type && (resource.type === Bundles.TYPE);
|
38
44
|
}
|
@@ -47,6 +47,8 @@ declare class Captures extends ApiResource<Capture> {
|
|
47
47
|
reference_authorization(captureId: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
|
48
48
|
refunds(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Refund>>;
|
49
49
|
events(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
50
|
+
_refund(id: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
|
51
|
+
_refund_amount_cents(id: string | Capture, triggerValue: number, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
|
50
52
|
isCapture(resource: any): resource is Capture;
|
51
53
|
relationship(id: string | ResourceId | null): CaptureRel;
|
52
54
|
type(): CaptureType;
|
@@ -23,6 +23,12 @@ class Captures extends ApiResource {
|
|
23
23
|
const _captureId = captureId.id || captureId;
|
24
24
|
return this.resources.fetch({ type: 'events' }, `captures/${_captureId}/events`, params, options);
|
25
25
|
}
|
26
|
+
async _refund(id, params, options) {
|
27
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Captures.TYPE, _refund: true }, params, options);
|
28
|
+
}
|
29
|
+
async _refund_amount_cents(id, triggerValue, params, options) {
|
30
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Captures.TYPE, _refund_amount_cents: triggerValue }, params, options);
|
31
|
+
}
|
26
32
|
isCapture(resource) {
|
27
33
|
return resource.type && (resource.type === Captures.TYPE);
|
28
34
|
}
|
@@ -52,6 +52,8 @@ declare class CheckoutComPayments extends ApiResource<CheckoutComPayment> {
|
|
52
52
|
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
53
53
|
order(checkoutComPaymentId: string | CheckoutComPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
54
54
|
payment_gateway(checkoutComPaymentId: string | CheckoutComPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentGateway>;
|
55
|
+
_details(id: string | CheckoutComPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CheckoutComPayment>;
|
56
|
+
_refresh(id: string | CheckoutComPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CheckoutComPayment>;
|
55
57
|
isCheckoutComPayment(resource: any): resource is CheckoutComPayment;
|
56
58
|
relationship(id: string | ResourceId | null): CheckoutComPaymentRel;
|
57
59
|
type(): CheckoutComPaymentType;
|
@@ -17,6 +17,12 @@ class CheckoutComPayments extends ApiResource {
|
|
17
17
|
const _checkoutComPaymentId = checkoutComPaymentId.id || checkoutComPaymentId;
|
18
18
|
return this.resources.fetch({ type: 'payment_gateways' }, `checkout_com_payments/${_checkoutComPaymentId}/payment_gateway`, params, options);
|
19
19
|
}
|
20
|
+
async _details(id, params, options) {
|
21
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: CheckoutComPayments.TYPE, _details: true }, params, options);
|
22
|
+
}
|
23
|
+
async _refresh(id, params, options) {
|
24
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: CheckoutComPayments.TYPE, _refresh: true }, params, options);
|
25
|
+
}
|
20
26
|
isCheckoutComPayment(resource) {
|
21
27
|
return resource.type && (resource.type === CheckoutComPayments.TYPE);
|
22
28
|
}
|
@@ -29,6 +29,7 @@ declare class CustomerPasswordResets extends ApiResource<CustomerPasswordReset>
|
|
29
29
|
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
30
30
|
customer(customerPasswordResetId: string | CustomerPasswordReset, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Customer>;
|
31
31
|
events(customerPasswordResetId: string | CustomerPasswordReset, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
32
|
+
_reset_password_token(id: string | CustomerPasswordReset, triggerValue: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomerPasswordReset>;
|
32
33
|
isCustomerPasswordReset(resource: any): resource is CustomerPasswordReset;
|
33
34
|
relationship(id: string | ResourceId | null): CustomerPasswordResetRel;
|
34
35
|
type(): CustomerPasswordResetType;
|
@@ -17,6 +17,9 @@ class CustomerPasswordResets extends ApiResource {
|
|
17
17
|
const _customerPasswordResetId = customerPasswordResetId.id || customerPasswordResetId;
|
18
18
|
return this.resources.fetch({ type: 'events' }, `customer_password_resets/${_customerPasswordResetId}/events`, params, options);
|
19
19
|
}
|
20
|
+
async _reset_password_token(id, triggerValue, params, options) {
|
21
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: CustomerPasswordResets.TYPE, _reset_password_token: triggerValue }, params, options);
|
22
|
+
}
|
20
23
|
isCustomerPasswordReset(resource) {
|
21
24
|
return resource.type && (resource.type === CustomerPasswordResets.TYPE);
|
22
25
|
}
|
@@ -86,6 +86,10 @@ declare class GiftCards extends ApiResource<GiftCard> {
|
|
86
86
|
attachments(giftCardId: string | GiftCard, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
87
87
|
events(giftCardId: string | GiftCard, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
88
88
|
tags(giftCardId: string | GiftCard, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
89
|
+
_purchase(id: string | GiftCard, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<GiftCard>;
|
90
|
+
_activate(id: string | GiftCard, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<GiftCard>;
|
91
|
+
_deactivate(id: string | GiftCard, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<GiftCard>;
|
92
|
+
_balance_change_cents(id: string | GiftCard, triggerValue: number, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<GiftCard>;
|
89
93
|
isGiftCard(resource: any): resource is GiftCard;
|
90
94
|
relationship(id: string | ResourceId | null): GiftCardRel;
|
91
95
|
type(): GiftCardType;
|