@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.
Files changed (111) hide show
  1. package/lib/cjs/api.d.ts +4 -0
  2. package/lib/cjs/client.js +1 -33
  3. package/lib/cjs/commercelayer.d.ts +0 -1
  4. package/lib/cjs/commercelayer.js +1 -1
  5. package/lib/cjs/error.d.ts +2 -1
  6. package/lib/cjs/error.js +38 -1
  7. package/lib/cjs/resource.d.ts +1 -1
  8. package/lib/cjs/resource.js +5 -5
  9. package/lib/cjs/resources/adyen_payments.d.ts +1 -0
  10. package/lib/cjs/resources/adyen_payments.js +3 -0
  11. package/lib/cjs/resources/authorizations.d.ts +3 -0
  12. package/lib/cjs/resources/authorizations.js +9 -0
  13. package/lib/cjs/resources/axerve_payments.d.ts +1 -0
  14. package/lib/cjs/resources/axerve_payments.js +3 -0
  15. package/lib/cjs/resources/bundles.d.ts +2 -0
  16. package/lib/cjs/resources/bundles.js +6 -0
  17. package/lib/cjs/resources/captures.d.ts +2 -0
  18. package/lib/cjs/resources/captures.js +6 -0
  19. package/lib/cjs/resources/checkout_com_payments.d.ts +2 -0
  20. package/lib/cjs/resources/checkout_com_payments.js +6 -0
  21. package/lib/cjs/resources/customer_password_resets.d.ts +1 -0
  22. package/lib/cjs/resources/customer_password_resets.js +3 -0
  23. package/lib/cjs/resources/gift_cards.d.ts +4 -0
  24. package/lib/cjs/resources/gift_cards.js +12 -0
  25. package/lib/cjs/resources/in_stock_subscriptions.d.ts +2 -0
  26. package/lib/cjs/resources/in_stock_subscriptions.js +6 -0
  27. package/lib/cjs/resources/klarna_payments.d.ts +1 -0
  28. package/lib/cjs/resources/klarna_payments.js +3 -0
  29. package/lib/cjs/resources/line_items.d.ts +2 -0
  30. package/lib/cjs/resources/line_items.js +6 -0
  31. package/lib/cjs/resources/markets.d.ts +2 -0
  32. package/lib/cjs/resources/markets.js +6 -0
  33. package/lib/cjs/resources/order_subscriptions.d.ts +3 -0
  34. package/lib/cjs/resources/order_subscriptions.js +9 -0
  35. package/lib/cjs/resources/orders.d.ts +27 -0
  36. package/lib/cjs/resources/orders.js +81 -0
  37. package/lib/cjs/resources/payment_methods.d.ts +2 -0
  38. package/lib/cjs/resources/payment_methods.js +6 -0
  39. package/lib/cjs/resources/return_line_items.d.ts +1 -0
  40. package/lib/cjs/resources/return_line_items.js +3 -0
  41. package/lib/cjs/resources/returns.d.ts +9 -0
  42. package/lib/cjs/resources/returns.js +27 -0
  43. package/lib/cjs/resources/satispay_payments.d.ts +1 -0
  44. package/lib/cjs/resources/satispay_payments.js +3 -0
  45. package/lib/cjs/resources/shipments.d.ts +7 -0
  46. package/lib/cjs/resources/shipments.js +21 -0
  47. package/lib/cjs/resources/shipping_methods.d.ts +2 -0
  48. package/lib/cjs/resources/shipping_methods.js +6 -0
  49. package/lib/cjs/resources/stock_transfers.d.ts +5 -0
  50. package/lib/cjs/resources/stock_transfers.js +15 -0
  51. package/lib/cjs/resources/stripe_payments.d.ts +2 -0
  52. package/lib/cjs/resources/stripe_payments.js +6 -0
  53. package/lib/cjs/resources/webhooks.d.ts +1 -0
  54. package/lib/cjs/resources/webhooks.js +3 -0
  55. package/lib/esm/api.d.ts +4 -0
  56. package/lib/esm/client.js +1 -33
  57. package/lib/esm/commercelayer.d.ts +0 -1
  58. package/lib/esm/commercelayer.js +1 -1
  59. package/lib/esm/error.d.ts +2 -1
  60. package/lib/esm/error.js +34 -1
  61. package/lib/esm/resource.d.ts +1 -1
  62. package/lib/esm/resource.js +5 -5
  63. package/lib/esm/resources/adyen_payments.d.ts +1 -0
  64. package/lib/esm/resources/adyen_payments.js +3 -0
  65. package/lib/esm/resources/authorizations.d.ts +3 -0
  66. package/lib/esm/resources/authorizations.js +9 -0
  67. package/lib/esm/resources/axerve_payments.d.ts +1 -0
  68. package/lib/esm/resources/axerve_payments.js +3 -0
  69. package/lib/esm/resources/bundles.d.ts +2 -0
  70. package/lib/esm/resources/bundles.js +6 -0
  71. package/lib/esm/resources/captures.d.ts +2 -0
  72. package/lib/esm/resources/captures.js +6 -0
  73. package/lib/esm/resources/checkout_com_payments.d.ts +2 -0
  74. package/lib/esm/resources/checkout_com_payments.js +6 -0
  75. package/lib/esm/resources/customer_password_resets.d.ts +1 -0
  76. package/lib/esm/resources/customer_password_resets.js +3 -0
  77. package/lib/esm/resources/gift_cards.d.ts +4 -0
  78. package/lib/esm/resources/gift_cards.js +12 -0
  79. package/lib/esm/resources/in_stock_subscriptions.d.ts +2 -0
  80. package/lib/esm/resources/in_stock_subscriptions.js +6 -0
  81. package/lib/esm/resources/klarna_payments.d.ts +1 -0
  82. package/lib/esm/resources/klarna_payments.js +3 -0
  83. package/lib/esm/resources/line_items.d.ts +2 -0
  84. package/lib/esm/resources/line_items.js +6 -0
  85. package/lib/esm/resources/markets.d.ts +2 -0
  86. package/lib/esm/resources/markets.js +6 -0
  87. package/lib/esm/resources/order_subscriptions.d.ts +3 -0
  88. package/lib/esm/resources/order_subscriptions.js +9 -0
  89. package/lib/esm/resources/orders.d.ts +27 -0
  90. package/lib/esm/resources/orders.js +81 -0
  91. package/lib/esm/resources/payment_methods.d.ts +2 -0
  92. package/lib/esm/resources/payment_methods.js +6 -0
  93. package/lib/esm/resources/return_line_items.d.ts +1 -0
  94. package/lib/esm/resources/return_line_items.js +3 -0
  95. package/lib/esm/resources/returns.d.ts +9 -0
  96. package/lib/esm/resources/returns.js +27 -0
  97. package/lib/esm/resources/satispay_payments.d.ts +1 -0
  98. package/lib/esm/resources/satispay_payments.js +3 -0
  99. package/lib/esm/resources/shipments.d.ts +7 -0
  100. package/lib/esm/resources/shipments.js +21 -0
  101. package/lib/esm/resources/shipping_methods.d.ts +2 -0
  102. package/lib/esm/resources/shipping_methods.js +6 -0
  103. package/lib/esm/resources/stock_transfers.d.ts +5 -0
  104. package/lib/esm/resources/stock_transfers.js +15 -0
  105. package/lib/esm/resources/stripe_payments.d.ts +2 -0
  106. package/lib/esm/resources/stripe_payments.js +6 -0
  107. package/lib/esm/resources/webhooks.d.ts +1 -0
  108. package/lib/esm/resources/webhooks.js +3 -0
  109. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  110. package/lib/tsconfig.tsbuildinfo +1 -1
  111. package/package.json +6 -6
package/lib/cjs/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/cjs/client.js CHANGED
@@ -23,38 +23,6 @@ const debug = (0, debug_1.default)('client');
23
23
  const baseURL = (organization, domain) => {
24
24
  return `https://${organization.toLowerCase()}.${domain || config_1.default.default.domain}/api`;
25
25
  };
26
- const handleError = (error) => {
27
- let sdkError = new error_1.SdkError({ message: error.message });
28
- if (axios_1.default.isAxiosError(error)) {
29
- if (error.response) {
30
- // The request was made and the server responded with a status code that falls out of the range of 2xx
31
- const apiError = new error_1.ApiError(sdkError);
32
- apiError.type = error_1.ErrorType.RESPONSE;
33
- apiError.status = error.response.status;
34
- apiError.statusText = error.response.statusText;
35
- apiError.code = String(apiError.status);
36
- apiError.errors = error.response.data.errors;
37
- if (!apiError.message && apiError.statusText)
38
- apiError.message = apiError.statusText;
39
- sdkError = apiError;
40
- }
41
- else if (error.request) {
42
- // The request was made but no response was received
43
- // `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js
44
- sdkError.type = error_1.ErrorType.REQUEST;
45
- sdkError.request = error.request;
46
- }
47
- else {
48
- // Something happened in setting up the request that triggered an Error
49
- sdkError.type = error_1.ErrorType.CLIENT;
50
- }
51
- }
52
- else if (axios_1.default.isCancel(error))
53
- sdkError.type = error_1.ErrorType.CANCEL;
54
- else
55
- sdkError.source = error;
56
- throw sdkError;
57
- };
58
26
  class ApiClient {
59
27
  static create(options) {
60
28
  for (const attr of config_1.default.client.requiredAttributes)
@@ -138,7 +106,7 @@ class ApiClient {
138
106
  // const start = Date.now()
139
107
  return __classPrivateFieldGet(this, _ApiClient_client, "f").request(requestParams)
140
108
  .then(response => response.data)
141
- .catch(error => handleError(error));
109
+ .catch(error => (0, error_1.handleError)(error));
142
110
  // .finally(() => console.log(`<<-- ${method} ${path} ${Date.now() - start}`))
143
111
  }
144
112
  customHeaders(headers) {
@@ -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;
@@ -48,9 +48,9 @@ const debug = (0, debug_1.default)('commercelayer');
48
48
  const OPEN_API_SCHEMA_VERSION = '4.10.1';
49
49
  exports.OPEN_API_SCHEMA_VERSION = OPEN_API_SCHEMA_VERSION;
50
50
  class CommerceLayerClient {
51
- static get openApiSchemaVersion() { return OPEN_API_SCHEMA_VERSION; }
52
51
  // ##__CL_RESOURCES_DEF_STOP__##
53
52
  constructor(config) {
53
+ // static get openApiSchemaVersion(): string { return OPEN_API_SCHEMA_VERSION }
54
54
  this.openApiSchemaVersion = OPEN_API_SCHEMA_VERSION;
55
55
  _CommerceLayerClient_adapter.set(this, void 0);
56
56
  _CommerceLayerClient_organization.set(this, void 0);
@@ -26,4 +26,5 @@ declare class ApiError extends SdkError {
26
26
  constructor(error: SdkError);
27
27
  first(): any;
28
28
  }
29
- export { SdkError, ApiError, ErrorType };
29
+ declare const handleError: (error: Error) => never;
30
+ export { SdkError, ApiError, ErrorType, handleError };
package/lib/cjs/error.js CHANGED
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorType = exports.ApiError = exports.SdkError = void 0;
6
+ exports.handleError = exports.ErrorType = exports.ApiError = exports.SdkError = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
4
8
  var ErrorType;
5
9
  (function (ErrorType) {
6
10
  ErrorType["CLIENT"] = "client";
@@ -37,3 +41,36 @@ class ApiError extends SdkError {
37
41
  }
38
42
  exports.ApiError = ApiError;
39
43
  ApiError.NAME = 'ApiError';
44
+ const handleError = (error) => {
45
+ let sdkError = new SdkError({ message: error.message });
46
+ if (axios_1.default.isAxiosError(error)) {
47
+ if (error.response) {
48
+ // The request was made and the server responded with a status code that falls out of the range of 2xx
49
+ const apiError = new ApiError(sdkError);
50
+ apiError.type = ErrorType.RESPONSE;
51
+ apiError.status = error.response.status;
52
+ apiError.statusText = error.response.statusText;
53
+ apiError.code = String(apiError.status);
54
+ apiError.errors = error.response.data.errors;
55
+ if (!apiError.message && apiError.statusText)
56
+ apiError.message = apiError.statusText;
57
+ sdkError = apiError;
58
+ }
59
+ else if (error.request) {
60
+ // The request was made but no response was received
61
+ // `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js
62
+ sdkError.type = ErrorType.REQUEST;
63
+ sdkError.request = error.request;
64
+ }
65
+ else {
66
+ // Something happened in setting up the request that triggered an Error
67
+ sdkError.type = ErrorType.CLIENT;
68
+ }
69
+ }
70
+ else if (axios_1.default.isCancel(error))
71
+ sdkError.type = ErrorType.CANCEL;
72
+ else
73
+ sdkError.source = error;
74
+ throw sdkError;
75
+ };
76
+ exports.handleError = handleError;
@@ -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>;
@@ -146,11 +146,6 @@ class ApiResourceBase {
146
146
  async update(resource, params, options) {
147
147
  return this.resources.update({ ...resource, type: this.type() }, params, options);
148
148
  }
149
- async count(filter, options) {
150
- const params = { filters: (0, query_1.isParamsList)(filter) ? filter.filters : filter, pageNumber: 1, pageSize: 1 };
151
- const response = await this.resources.list({ type: this.type() }, params, options);
152
- return Promise.resolve(response.meta.recordCount);
153
- }
154
149
  }
155
150
  class ApiResource extends ApiResourceBase {
156
151
  async retrieve(id, params, options) {
@@ -159,6 +154,11 @@ class ApiResource extends ApiResourceBase {
159
154
  async list(params, options) {
160
155
  return this.resources.list({ type: this.type() }, params, options);
161
156
  }
157
+ async count(filter, options) {
158
+ const params = { filters: (0, query_1.isParamsList)(filter) ? filter.filters : filter, pageNumber: 1, pageSize: 1 };
159
+ const response = await this.list(params, options);
160
+ return Promise.resolve(response.meta.recordCount);
161
+ }
162
162
  }
163
163
  exports.ApiResource = ApiResource;
164
164
  class ApiSingleton extends ApiResourceBase {
@@ -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;
@@ -19,6 +19,9 @@ class AdyenPayments extends resource_1.ApiResource {
19
19
  const _adyenPaymentId = adyenPaymentId.id || adyenPaymentId;
20
20
  return this.resources.fetch({ type: 'payment_gateways' }, `adyen_payments/${_adyenPaymentId}/payment_gateway`, params, options);
21
21
  }
22
+ async _details(id, params, options) {
23
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: AdyenPayments.TYPE, _details: true }, params, options);
24
+ }
22
25
  isAdyenPayment(resource) {
23
26
  return resource.type && (resource.type === AdyenPayments.TYPE);
24
27
  }
@@ -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;
@@ -25,6 +25,15 @@ class Authorizations extends resource_1.ApiResource {
25
25
  const _authorizationId = authorizationId.id || authorizationId;
26
26
  return this.resources.fetch({ type: 'events' }, `authorizations/${_authorizationId}/events`, params, options);
27
27
  }
28
+ async _capture(id, params, options) {
29
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Authorizations.TYPE, _capture: true }, params, options);
30
+ }
31
+ async _capture_amount_cents(id, triggerValue, params, options) {
32
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Authorizations.TYPE, _capture_amount_cents: triggerValue }, params, options);
33
+ }
34
+ async _void(id, params, options) {
35
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Authorizations.TYPE, _void: true }, params, options);
36
+ }
28
37
  isAuthorization(resource) {
29
38
  return resource.type && (resource.type === Authorizations.TYPE);
30
39
  }
@@ -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;
@@ -19,6 +19,9 @@ class AxervePayments extends resource_1.ApiResource {
19
19
  const _axervePaymentId = axervePaymentId.id || axervePaymentId;
20
20
  return this.resources.fetch({ type: 'payment_gateways' }, `axerve_payments/${_axervePaymentId}/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: AxervePayments.TYPE, _update: true }, params, options);
24
+ }
22
25
  isAxervePayment(resource) {
23
26
  return resource.type && (resource.type === AxervePayments.TYPE);
24
27
  }
@@ -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;
@@ -35,6 +35,12 @@ class Bundles extends resource_1.ApiResource {
35
35
  const _bundleId = bundleId.id || bundleId;
36
36
  return this.resources.fetch({ type: 'tags' }, `bundles/${_bundleId}/tags`, params, options);
37
37
  }
38
+ async _compute_price_amount(id, params, options) {
39
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Bundles.TYPE, _compute_price_amount: true }, params, options);
40
+ }
41
+ async _compute_compare_at_amount(id, params, options) {
42
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Bundles.TYPE, _compute_compare_at_amount: true }, params, options);
43
+ }
38
44
  isBundle(resource) {
39
45
  return resource.type && (resource.type === Bundles.TYPE);
40
46
  }
@@ -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;
@@ -25,6 +25,12 @@ class Captures extends resource_1.ApiResource {
25
25
  const _captureId = captureId.id || captureId;
26
26
  return this.resources.fetch({ type: 'events' }, `captures/${_captureId}/events`, params, options);
27
27
  }
28
+ async _refund(id, params, options) {
29
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Captures.TYPE, _refund: true }, params, options);
30
+ }
31
+ async _refund_amount_cents(id, triggerValue, params, options) {
32
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Captures.TYPE, _refund_amount_cents: triggerValue }, params, options);
33
+ }
28
34
  isCapture(resource) {
29
35
  return resource.type && (resource.type === Captures.TYPE);
30
36
  }
@@ -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;
@@ -19,6 +19,12 @@ class CheckoutComPayments extends resource_1.ApiResource {
19
19
  const _checkoutComPaymentId = checkoutComPaymentId.id || checkoutComPaymentId;
20
20
  return this.resources.fetch({ type: 'payment_gateways' }, `checkout_com_payments/${_checkoutComPaymentId}/payment_gateway`, params, options);
21
21
  }
22
+ async _details(id, params, options) {
23
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: CheckoutComPayments.TYPE, _details: true }, params, options);
24
+ }
25
+ async _refresh(id, params, options) {
26
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: CheckoutComPayments.TYPE, _refresh: true }, params, options);
27
+ }
22
28
  isCheckoutComPayment(resource) {
23
29
  return resource.type && (resource.type === CheckoutComPayments.TYPE);
24
30
  }
@@ -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;
@@ -19,6 +19,9 @@ class CustomerPasswordResets extends resource_1.ApiResource {
19
19
  const _customerPasswordResetId = customerPasswordResetId.id || customerPasswordResetId;
20
20
  return this.resources.fetch({ type: 'events' }, `customer_password_resets/${_customerPasswordResetId}/events`, params, options);
21
21
  }
22
+ async _reset_password_token(id, triggerValue, params, options) {
23
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: CustomerPasswordResets.TYPE, _reset_password_token: triggerValue }, params, options);
24
+ }
22
25
  isCustomerPasswordReset(resource) {
23
26
  return resource.type && (resource.type === CustomerPasswordResets.TYPE);
24
27
  }
@@ -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;
@@ -31,6 +31,18 @@ class GiftCards extends resource_1.ApiResource {
31
31
  const _giftCardId = giftCardId.id || giftCardId;
32
32
  return this.resources.fetch({ type: 'tags' }, `gift_cards/${_giftCardId}/tags`, params, options);
33
33
  }
34
+ async _purchase(id, params, options) {
35
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: GiftCards.TYPE, _purchase: true }, params, options);
36
+ }
37
+ async _activate(id, params, options) {
38
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: GiftCards.TYPE, _activate: true }, params, options);
39
+ }
40
+ async _deactivate(id, params, options) {
41
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: GiftCards.TYPE, _deactivate: true }, params, options);
42
+ }
43
+ async _balance_change_cents(id, triggerValue, params, options) {
44
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: GiftCards.TYPE, _balance_change_cents: triggerValue }, params, options);
45
+ }
34
46
  isGiftCard(resource) {
35
47
  return resource.type && (resource.type === GiftCards.TYPE);
36
48
  }
@@ -55,6 +55,8 @@ declare class InStockSubscriptions extends ApiResource<InStockSubscription> {
55
55
  customer(inStockSubscriptionId: string | InStockSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Customer>;
56
56
  sku(inStockSubscriptionId: string | InStockSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Sku>;
57
57
  events(inStockSubscriptionId: string | InStockSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
58
+ _activate(id: string | InStockSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<InStockSubscription>;
59
+ _deactivate(id: string | InStockSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<InStockSubscription>;
58
60
  isInStockSubscription(resource: any): resource is InStockSubscription;
59
61
  relationship(id: string | ResourceId | null): InStockSubscriptionRel;
60
62
  type(): InStockSubscriptionType;
@@ -27,6 +27,12 @@ class InStockSubscriptions extends resource_1.ApiResource {
27
27
  const _inStockSubscriptionId = inStockSubscriptionId.id || inStockSubscriptionId;
28
28
  return this.resources.fetch({ type: 'events' }, `in_stock_subscriptions/${_inStockSubscriptionId}/events`, params, options);
29
29
  }
30
+ async _activate(id, params, options) {
31
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: InStockSubscriptions.TYPE, _activate: true }, params, options);
32
+ }
33
+ async _deactivate(id, params, options) {
34
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: InStockSubscriptions.TYPE, _deactivate: true }, params, options);
35
+ }
30
36
  isInStockSubscription(resource) {
31
37
  return resource.type && (resource.type === InStockSubscriptions.TYPE);
32
38
  }
@@ -39,6 +39,7 @@ declare class KlarnaPayments extends ApiResource<KlarnaPayment> {
39
39
  delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
40
40
  order(klarnaPaymentId: string | KlarnaPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
41
41
  payment_gateway(klarnaPaymentId: string | KlarnaPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentGateway>;
42
+ _update(id: string | KlarnaPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<KlarnaPayment>;
42
43
  isKlarnaPayment(resource: any): resource is KlarnaPayment;
43
44
  relationship(id: string | ResourceId | null): KlarnaPaymentRel;
44
45
  type(): KlarnaPaymentType;
@@ -19,6 +19,9 @@ class KlarnaPayments extends resource_1.ApiResource {
19
19
  const _klarnaPaymentId = klarnaPaymentId.id || klarnaPaymentId;
20
20
  return this.resources.fetch({ type: 'payment_gateways' }, `klarna_payments/${_klarnaPaymentId}/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: KlarnaPayments.TYPE, _update: true }, params, options);
24
+ }
22
25
  isKlarnaPayment(resource) {
23
26
  return resource.type && (resource.type === KlarnaPayments.TYPE);
24
27
  }
@@ -138,6 +138,8 @@ declare class LineItems extends ApiResource<LineItem> {
138
138
  stock_transfers(lineItemId: string | LineItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockTransfer>>;
139
139
  events(lineItemId: string | LineItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
140
140
  tags(lineItemId: string | LineItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
141
+ _external_price(id: string | LineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<LineItem>;
142
+ _reserve_stock(id: string | LineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<LineItem>;
141
143
  isLineItem(resource: any): resource is LineItem;
142
144
  relationship(id: string | ResourceId | null): LineItemRel;
143
145
  type(): LineItemType;
@@ -39,6 +39,12 @@ class LineItems extends resource_1.ApiResource {
39
39
  const _lineItemId = lineItemId.id || lineItemId;
40
40
  return this.resources.fetch({ type: 'tags' }, `line_items/${_lineItemId}/tags`, params, options);
41
41
  }
42
+ async _external_price(id, params, options) {
43
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: LineItems.TYPE, _external_price: true }, params, options);
44
+ }
45
+ async _reserve_stock(id, params, options) {
46
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: LineItems.TYPE, _reserve_stock: true }, params, options);
47
+ }
42
48
  isLineItem(resource) {
43
49
  return resource.type && (resource.type === LineItems.TYPE);
44
50
  }
@@ -89,6 +89,8 @@ declare class Markets extends ApiResource<Market> {
89
89
  tax_calculator(marketId: string | Market, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<TaxCalculator>;
90
90
  customer_group(marketId: string | Market, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomerGroup>;
91
91
  attachments(marketId: string | Market, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
92
+ _disable(id: string | Market, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Market>;
93
+ _enable(id: string | Market, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Market>;
92
94
  isMarket(resource: any): resource is Market;
93
95
  relationship(id: string | ResourceId | null): MarketRel;
94
96
  type(): MarketType;
@@ -39,6 +39,12 @@ class Markets extends resource_1.ApiResource {
39
39
  const _marketId = marketId.id || marketId;
40
40
  return this.resources.fetch({ type: 'attachments' }, `markets/${_marketId}/attachments`, params, options);
41
41
  }
42
+ async _disable(id, params, options) {
43
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Markets.TYPE, _disable: true }, params, options);
44
+ }
45
+ async _enable(id, params, options) {
46
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Markets.TYPE, _enable: true }, params, options);
47
+ }
42
48
  isMarket(resource) {
43
49
  return resource.type && (resource.type === Markets.TYPE);
44
50
  }
@@ -85,6 +85,9 @@ declare class OrderSubscriptions extends ApiResource<OrderSubscription> {
85
85
  recurring_order_copies(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<RecurringOrderCopy>>;
86
86
  orders(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Order>>;
87
87
  events(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
88
+ _activate(id: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscription>;
89
+ _deactivate(id: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscription>;
90
+ _cancel(id: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscription>;
88
91
  isOrderSubscription(resource: any): resource is OrderSubscription;
89
92
  relationship(id: string | ResourceId | null): OrderSubscriptionRel;
90
93
  type(): OrderSubscriptionType;
@@ -51,6 +51,15 @@ class OrderSubscriptions extends resource_1.ApiResource {
51
51
  const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
52
52
  return this.resources.fetch({ type: 'events' }, `order_subscriptions/${_orderSubscriptionId}/events`, params, options);
53
53
  }
54
+ async _activate(id, params, options) {
55
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: OrderSubscriptions.TYPE, _activate: true }, params, options);
56
+ }
57
+ async _deactivate(id, params, options) {
58
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: OrderSubscriptions.TYPE, _deactivate: true }, params, options);
59
+ }
60
+ async _cancel(id, params, options) {
61
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: OrderSubscriptions.TYPE, _cancel: true }, params, options);
62
+ }
54
63
  isOrderSubscription(resource) {
55
64
  return resource.type && (resource.type === OrderSubscriptions.TYPE);
56
65
  }
@@ -305,6 +305,33 @@ declare class Orders extends ApiResource<Order> {
305
305
  attachments(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
306
306
  events(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
307
307
  tags(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
308
+ _archive(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
309
+ _unarchive(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
310
+ _place(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
311
+ _cancel(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
312
+ _approve(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
313
+ _approve_and_capture(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
314
+ _authorize(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
315
+ _authorization_amount_cents(id: string | Order, triggerValue: number, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
316
+ _capture(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
317
+ _refund(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
318
+ _update_taxes(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
319
+ _nullify_payment_source(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
320
+ _billing_address_clone_id(id: string | Order, triggerValue: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
321
+ _shipping_address_clone_id(id: string | Order, triggerValue: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
322
+ _customer_payment_source_id(id: string | Order, triggerValue: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
323
+ _shipping_address_same_as_billing(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
324
+ _billing_address_same_as_shipping(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
325
+ _commit_invoice(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
326
+ _refund_invoice(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
327
+ _save_payment_source_to_customer_wallet(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
328
+ _save_shipping_address_to_customer_address_book(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
329
+ _save_billing_address_to_customer_address_book(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
330
+ _refresh(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
331
+ _validate(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
332
+ _create_subscriptions(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
333
+ _start_editing(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
334
+ _stop_editing(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
308
335
  isOrder(resource: any): resource is Order;
309
336
  relationship(id: string | ResourceId | null): OrderRel;
310
337
  type(): OrderType;
@@ -103,6 +103,87 @@ class Orders extends resource_1.ApiResource {
103
103
  const _orderId = orderId.id || orderId;
104
104
  return this.resources.fetch({ type: 'tags' }, `orders/${_orderId}/tags`, params, options);
105
105
  }
106
+ async _archive(id, params, options) {
107
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _archive: true }, params, options);
108
+ }
109
+ async _unarchive(id, params, options) {
110
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _unarchive: true }, params, options);
111
+ }
112
+ async _place(id, params, options) {
113
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _place: true }, params, options);
114
+ }
115
+ async _cancel(id, params, options) {
116
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _cancel: true }, params, options);
117
+ }
118
+ async _approve(id, params, options) {
119
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _approve: true }, params, options);
120
+ }
121
+ async _approve_and_capture(id, params, options) {
122
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _approve_and_capture: true }, params, options);
123
+ }
124
+ async _authorize(id, params, options) {
125
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _authorize: true }, params, options);
126
+ }
127
+ async _authorization_amount_cents(id, triggerValue, params, options) {
128
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _authorization_amount_cents: triggerValue }, params, options);
129
+ }
130
+ async _capture(id, params, options) {
131
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _capture: true }, params, options);
132
+ }
133
+ async _refund(id, params, options) {
134
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _refund: true }, params, options);
135
+ }
136
+ async _update_taxes(id, params, options) {
137
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _update_taxes: true }, params, options);
138
+ }
139
+ async _nullify_payment_source(id, params, options) {
140
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _nullify_payment_source: true }, params, options);
141
+ }
142
+ async _billing_address_clone_id(id, triggerValue, params, options) {
143
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _billing_address_clone_id: triggerValue }, params, options);
144
+ }
145
+ async _shipping_address_clone_id(id, triggerValue, params, options) {
146
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _shipping_address_clone_id: triggerValue }, params, options);
147
+ }
148
+ async _customer_payment_source_id(id, triggerValue, params, options) {
149
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _customer_payment_source_id: triggerValue }, params, options);
150
+ }
151
+ async _shipping_address_same_as_billing(id, params, options) {
152
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _shipping_address_same_as_billing: true }, params, options);
153
+ }
154
+ async _billing_address_same_as_shipping(id, params, options) {
155
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _billing_address_same_as_shipping: true }, params, options);
156
+ }
157
+ async _commit_invoice(id, params, options) {
158
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _commit_invoice: true }, params, options);
159
+ }
160
+ async _refund_invoice(id, params, options) {
161
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _refund_invoice: true }, params, options);
162
+ }
163
+ async _save_payment_source_to_customer_wallet(id, params, options) {
164
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _save_payment_source_to_customer_wallet: true }, params, options);
165
+ }
166
+ async _save_shipping_address_to_customer_address_book(id, params, options) {
167
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _save_shipping_address_to_customer_address_book: true }, params, options);
168
+ }
169
+ async _save_billing_address_to_customer_address_book(id, params, options) {
170
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _save_billing_address_to_customer_address_book: true }, params, options);
171
+ }
172
+ async _refresh(id, params, options) {
173
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _refresh: true }, params, options);
174
+ }
175
+ async _validate(id, params, options) {
176
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _validate: true }, params, options);
177
+ }
178
+ async _create_subscriptions(id, params, options) {
179
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _create_subscriptions: true }, params, options);
180
+ }
181
+ async _start_editing(id, params, options) {
182
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _start_editing: true }, params, options);
183
+ }
184
+ async _stop_editing(id, params, options) {
185
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _stop_editing: true }, params, options);
186
+ }
106
187
  isOrder(resource) {
107
188
  return resource.type && (resource.type === Orders.TYPE);
108
189
  }