@revenexx/sdk 0.0.4 → 0.0.6
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/dist/cjs/sdk.js +13491 -6163
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +13464 -6162
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +13491 -6163
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/enums/address-type.ts +4 -0
- package/src/enums/cart-export-format.ts +4 -0
- package/src/enums/cart-io-apply-mode.ts +5 -0
- package/src/enums/cart-io-direction.ts +4 -0
- package/src/enums/cart-io-entity.ts +4 -0
- package/src/enums/cart-io-format.ts +4 -0
- package/src/enums/cart-item-type.ts +5 -0
- package/src/enums/channel-status.ts +4 -0
- package/src/enums/channel-type.ts +7 -0
- package/src/enums/contact-role.ts +6 -0
- package/src/enums/contact-status.ts +5 -0
- package/src/enums/location-type.ts +6 -0
- package/src/enums/market-status.ts +4 -0
- package/src/enums/order-comment-visibility.ts +4 -0
- package/src/enums/order-item-type.ts +5 -0
- package/src/enums/order-list-kind.ts +4 -0
- package/src/enums/order-payment-status.ts +9 -0
- package/src/enums/organization-status.ts +4 -0
- package/src/enums/page-status.ts +5 -0
- package/src/enums/payment-fee-type.ts +5 -0
- package/src/enums/payment-method-kind.ts +4 -0
- package/src/enums/price-entry-type.ts +4 -0
- package/src/enums/price-list-status.ts +4 -0
- package/src/enums/shipping-method-matrix-basis.ts +6 -0
- package/src/enums/shipping-method-pricing-type.ts +5 -0
- package/src/enums/store-asset-request-visibility.ts +4 -0
- package/src/enums/visibility.ts +4 -0
- package/src/index.ts +28 -2
- package/src/models.ts +5309 -1009
- package/src/services/apps.ts +154 -154
- package/src/services/avatars.ts +57 -57
- package/src/services/carts.ts +739 -104
- package/src/services/channels.ts +147 -19
- package/src/services/customers.ts +809 -69
- package/src/services/greetings.ts +18 -18
- package/src/services/inventories.ts +620 -65
- package/src/services/locale.ts +16 -16
- package/src/services/markets.ts +690 -75
- package/src/services/messaging.ts +273 -273
- package/src/services/orderlists.ts +889 -0
- package/src/services/orders.ts +692 -137
- package/src/services/pages.ts +661 -155
- package/src/services/payments.ts +591 -64
- package/src/services/prices.ts +585 -59
- package/src/services/products.ts +1908 -272
- package/src/services/search.ts +24 -24
- package/src/services/shipping.ts +451 -59
- package/src/services/sites.ts +116 -116
- package/src/services/storage.ts +933 -599
- package/src/services/tokens.ts +14 -14
- package/types/enums/address-type.d.ts +4 -0
- package/types/enums/cart-export-format.d.ts +4 -0
- package/types/enums/cart-io-apply-mode.d.ts +5 -0
- package/types/enums/cart-io-direction.d.ts +4 -0
- package/types/enums/cart-io-entity.d.ts +4 -0
- package/types/enums/cart-io-format.d.ts +4 -0
- package/types/enums/cart-item-type.d.ts +5 -0
- package/types/enums/channel-status.d.ts +4 -0
- package/types/enums/channel-type.d.ts +7 -0
- package/types/enums/contact-role.d.ts +6 -0
- package/types/enums/contact-status.d.ts +5 -0
- package/types/enums/location-type.d.ts +6 -0
- package/types/enums/market-status.d.ts +4 -0
- package/types/enums/order-comment-visibility.d.ts +4 -0
- package/types/enums/order-item-type.d.ts +5 -0
- package/types/enums/order-list-kind.d.ts +4 -0
- package/types/enums/order-payment-status.d.ts +9 -0
- package/types/enums/organization-status.d.ts +4 -0
- package/types/enums/page-status.d.ts +5 -0
- package/types/enums/payment-fee-type.d.ts +5 -0
- package/types/enums/payment-method-kind.d.ts +4 -0
- package/types/enums/price-entry-type.d.ts +4 -0
- package/types/enums/price-list-status.d.ts +4 -0
- package/types/enums/shipping-method-matrix-basis.d.ts +6 -0
- package/types/enums/shipping-method-pricing-type.d.ts +5 -0
- package/types/enums/store-asset-request-visibility.d.ts +4 -0
- package/types/enums/visibility.d.ts +4 -0
- package/types/index.d.ts +28 -2
- package/types/models.d.ts +5170 -1010
- package/types/services/carts.d.ts +271 -12
- package/types/services/channels.d.ts +54 -2
- package/types/services/customers.d.ts +298 -12
- package/types/services/inventories.d.ts +225 -11
- package/types/services/markets.d.ts +235 -6
- package/types/services/orderlists.d.ts +324 -0
- package/types/services/orders.d.ts +238 -16
- package/types/services/pages.d.ts +190 -6
- package/types/services/payments.d.ts +221 -7
- package/types/services/prices.d.ts +218 -6
- package/types/services/products.d.ts +672 -32
- package/types/services/shipping.d.ts +168 -6
- package/types/services/storage.d.ts +353 -285
package/src/services/shipping.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { Service } from '../service';
|
|
|
2
2
|
import { RevenexxException, Client, type Payload, UploadProgress } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
4
|
|
|
5
|
+
import { ShippingMethodMatrixBasis } from '../enums/shipping-method-matrix-basis';
|
|
6
|
+
import { ShippingMethodPricingType } from '../enums/shipping-method-pricing-type';
|
|
5
7
|
|
|
6
8
|
export class Shipping {
|
|
7
9
|
client: Client;
|
|
@@ -18,7 +20,7 @@ export class Shipping {
|
|
|
18
20
|
shippingMethodsList(): Promise<{}> {
|
|
19
21
|
|
|
20
22
|
const apiPath = '/v1/shipping/methods';
|
|
21
|
-
const
|
|
23
|
+
const apiPayload: Payload = {};
|
|
22
24
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
23
25
|
|
|
24
26
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -28,19 +30,165 @@ export class Shipping {
|
|
|
28
30
|
'get',
|
|
29
31
|
uri,
|
|
30
32
|
apiHeaders,
|
|
31
|
-
|
|
33
|
+
apiPayload
|
|
32
34
|
);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
/**
|
|
36
38
|
*
|
|
39
|
+
* @param {string} params.code - Stable method code, unique per tenant (e.g. standard, express).
|
|
40
|
+
* @param {string} params.name - Display name.
|
|
41
|
+
* @param {string} params.carrier - Carrier anchor for the upcoming carrier connect (dynamic rates, tracking links).
|
|
42
|
+
* @param {string[]} params.countries - Allowed ISO 3166-1 alpha-2 codes; null or empty = worldwide.
|
|
43
|
+
* @param {string} params.currency - ISO 4217 code (default EUR).
|
|
44
|
+
* @param {string} params.description -
|
|
45
|
+
* @param {boolean} params.enabled - Only enabled methods appear in rate responses (default false).
|
|
46
|
+
* @param {number} params.etaDaysMax - Delivery-time estimate for the checkout (days, upper bound).
|
|
47
|
+
* @param {number} params.etaDaysMin - Delivery-time estimate for the checkout (days, lower bound).
|
|
48
|
+
* @param {number} params.freeAbove - Free shipping at or above this order value — wins over every pricing model.
|
|
49
|
+
* @param {object} params.labels - Localized display names keyed by locale (e.g. {de, en}).
|
|
50
|
+
* @param {string} params.matrixAttribute - Attribute name for matrix_basis 'attribute'.
|
|
51
|
+
* @param {ShippingMethodMatrixBasis} params.matrixBasis - The measure a matrix method prices over; 'attribute' reads matrix_attribute from the rate request.
|
|
52
|
+
* @param {object} params.metadata - Free-form metadata.
|
|
53
|
+
* @param {number} params.position - Sort order in the checkout (default 0).
|
|
54
|
+
* @param {number} params.price - The fixed price (default 0) — ignored for 'free' and 'matrix'.
|
|
55
|
+
* @param {ShippingMethodPricingType} params.pricingType - Pricing model (default 'fixed'): one price, no price, or tiered over a measure.
|
|
37
56
|
* @throws {RevenexxException}
|
|
38
57
|
* @returns {Promise<Models.ShippingMethod>}
|
|
39
58
|
*/
|
|
40
|
-
shippingMethodsCreate(): Promise<Models.ShippingMethod
|
|
59
|
+
shippingMethodsCreate(params: { code: string, name: string, carrier?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, position?: number, price?: number, pricingType?: ShippingMethodPricingType }): Promise<Models.ShippingMethod>;
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param {string} code - Stable method code, unique per tenant (e.g. standard, express).
|
|
63
|
+
* @param {string} name - Display name.
|
|
64
|
+
* @param {string} carrier - Carrier anchor for the upcoming carrier connect (dynamic rates, tracking links).
|
|
65
|
+
* @param {string[]} countries - Allowed ISO 3166-1 alpha-2 codes; null or empty = worldwide.
|
|
66
|
+
* @param {string} currency - ISO 4217 code (default EUR).
|
|
67
|
+
* @param {string} description -
|
|
68
|
+
* @param {boolean} enabled - Only enabled methods appear in rate responses (default false).
|
|
69
|
+
* @param {number} etaDaysMax - Delivery-time estimate for the checkout (days, upper bound).
|
|
70
|
+
* @param {number} etaDaysMin - Delivery-time estimate for the checkout (days, lower bound).
|
|
71
|
+
* @param {number} freeAbove - Free shipping at or above this order value — wins over every pricing model.
|
|
72
|
+
* @param {object} labels - Localized display names keyed by locale (e.g. {de, en}).
|
|
73
|
+
* @param {string} matrixAttribute - Attribute name for matrix_basis 'attribute'.
|
|
74
|
+
* @param {ShippingMethodMatrixBasis} matrixBasis - The measure a matrix method prices over; 'attribute' reads matrix_attribute from the rate request.
|
|
75
|
+
* @param {object} metadata - Free-form metadata.
|
|
76
|
+
* @param {number} position - Sort order in the checkout (default 0).
|
|
77
|
+
* @param {number} price - The fixed price (default 0) — ignored for 'free' and 'matrix'.
|
|
78
|
+
* @param {ShippingMethodPricingType} pricingType - Pricing model (default 'fixed'): one price, no price, or tiered over a measure.
|
|
79
|
+
* @throws {RevenexxException}
|
|
80
|
+
* @returns {Promise<Models.ShippingMethod>}
|
|
81
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
82
|
+
*/
|
|
83
|
+
shippingMethodsCreate(code: string, name: string, carrier?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, position?: number, price?: number, pricingType?: ShippingMethodPricingType): Promise<Models.ShippingMethod>;
|
|
84
|
+
shippingMethodsCreate(
|
|
85
|
+
paramsOrFirst: { code: string, name: string, carrier?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, position?: number, price?: number, pricingType?: ShippingMethodPricingType } | string,
|
|
86
|
+
...rest: [(string)?, (string)?, (string[])?, (string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (object)?, (string)?, (ShippingMethodMatrixBasis)?, (object)?, (number)?, (number)?, (ShippingMethodPricingType)?]
|
|
87
|
+
): Promise<Models.ShippingMethod> {
|
|
88
|
+
let params: { code: string, name: string, carrier?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, position?: number, price?: number, pricingType?: ShippingMethodPricingType };
|
|
89
|
+
|
|
90
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
91
|
+
params = (paramsOrFirst || {}) as { code: string, name: string, carrier?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, position?: number, price?: number, pricingType?: ShippingMethodPricingType };
|
|
92
|
+
} else {
|
|
93
|
+
params = {
|
|
94
|
+
code: paramsOrFirst as string,
|
|
95
|
+
name: rest[0] as string,
|
|
96
|
+
carrier: rest[1] as string,
|
|
97
|
+
countries: rest[2] as string[],
|
|
98
|
+
currency: rest[3] as string,
|
|
99
|
+
description: rest[4] as string,
|
|
100
|
+
enabled: rest[5] as boolean,
|
|
101
|
+
etaDaysMax: rest[6] as number,
|
|
102
|
+
etaDaysMin: rest[7] as number,
|
|
103
|
+
freeAbove: rest[8] as number,
|
|
104
|
+
labels: rest[9] as object,
|
|
105
|
+
matrixAttribute: rest[10] as string,
|
|
106
|
+
matrixBasis: rest[11] as ShippingMethodMatrixBasis,
|
|
107
|
+
metadata: rest[12] as object,
|
|
108
|
+
position: rest[13] as number,
|
|
109
|
+
price: rest[14] as number,
|
|
110
|
+
pricingType: rest[15] as ShippingMethodPricingType
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const code = params.code;
|
|
115
|
+
const name = params.name;
|
|
116
|
+
const carrier = params.carrier;
|
|
117
|
+
const countries = params.countries;
|
|
118
|
+
const currency = params.currency;
|
|
119
|
+
const description = params.description;
|
|
120
|
+
const enabled = params.enabled;
|
|
121
|
+
const etaDaysMax = params.etaDaysMax;
|
|
122
|
+
const etaDaysMin = params.etaDaysMin;
|
|
123
|
+
const freeAbove = params.freeAbove;
|
|
124
|
+
const labels = params.labels;
|
|
125
|
+
const matrixAttribute = params.matrixAttribute;
|
|
126
|
+
const matrixBasis = params.matrixBasis;
|
|
127
|
+
const metadata = params.metadata;
|
|
128
|
+
const position = params.position;
|
|
129
|
+
const price = params.price;
|
|
130
|
+
const pricingType = params.pricingType;
|
|
131
|
+
|
|
132
|
+
if (typeof code === 'undefined') {
|
|
133
|
+
throw new RevenexxException('Missing required parameter: "code"');
|
|
134
|
+
}
|
|
135
|
+
if (typeof name === 'undefined') {
|
|
136
|
+
throw new RevenexxException('Missing required parameter: "name"');
|
|
137
|
+
}
|
|
41
138
|
|
|
42
139
|
const apiPath = '/v1/shipping/methods';
|
|
43
|
-
const
|
|
140
|
+
const apiPayload: Payload = {};
|
|
141
|
+
if (typeof carrier !== 'undefined') {
|
|
142
|
+
apiPayload['carrier'] = carrier;
|
|
143
|
+
}
|
|
144
|
+
if (typeof code !== 'undefined') {
|
|
145
|
+
apiPayload['code'] = code;
|
|
146
|
+
}
|
|
147
|
+
if (typeof countries !== 'undefined') {
|
|
148
|
+
apiPayload['countries'] = countries;
|
|
149
|
+
}
|
|
150
|
+
if (typeof currency !== 'undefined') {
|
|
151
|
+
apiPayload['currency'] = currency;
|
|
152
|
+
}
|
|
153
|
+
if (typeof description !== 'undefined') {
|
|
154
|
+
apiPayload['description'] = description;
|
|
155
|
+
}
|
|
156
|
+
if (typeof enabled !== 'undefined') {
|
|
157
|
+
apiPayload['enabled'] = enabled;
|
|
158
|
+
}
|
|
159
|
+
if (typeof etaDaysMax !== 'undefined') {
|
|
160
|
+
apiPayload['eta_days_max'] = etaDaysMax;
|
|
161
|
+
}
|
|
162
|
+
if (typeof etaDaysMin !== 'undefined') {
|
|
163
|
+
apiPayload['eta_days_min'] = etaDaysMin;
|
|
164
|
+
}
|
|
165
|
+
if (typeof freeAbove !== 'undefined') {
|
|
166
|
+
apiPayload['free_above'] = freeAbove;
|
|
167
|
+
}
|
|
168
|
+
if (typeof labels !== 'undefined') {
|
|
169
|
+
apiPayload['labels'] = labels;
|
|
170
|
+
}
|
|
171
|
+
if (typeof matrixAttribute !== 'undefined') {
|
|
172
|
+
apiPayload['matrix_attribute'] = matrixAttribute;
|
|
173
|
+
}
|
|
174
|
+
if (typeof matrixBasis !== 'undefined') {
|
|
175
|
+
apiPayload['matrix_basis'] = matrixBasis;
|
|
176
|
+
}
|
|
177
|
+
if (typeof metadata !== 'undefined') {
|
|
178
|
+
apiPayload['metadata'] = metadata;
|
|
179
|
+
}
|
|
180
|
+
if (typeof name !== 'undefined') {
|
|
181
|
+
apiPayload['name'] = name;
|
|
182
|
+
}
|
|
183
|
+
if (typeof position !== 'undefined') {
|
|
184
|
+
apiPayload['position'] = position;
|
|
185
|
+
}
|
|
186
|
+
if (typeof price !== 'undefined') {
|
|
187
|
+
apiPayload['price'] = price;
|
|
188
|
+
}
|
|
189
|
+
if (typeof pricingType !== 'undefined') {
|
|
190
|
+
apiPayload['pricing_type'] = pricingType;
|
|
191
|
+
}
|
|
44
192
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
45
193
|
|
|
46
194
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -51,7 +199,7 @@ export class Shipping {
|
|
|
51
199
|
'post',
|
|
52
200
|
uri,
|
|
53
201
|
apiHeaders,
|
|
54
|
-
|
|
202
|
+
apiPayload
|
|
55
203
|
);
|
|
56
204
|
}
|
|
57
205
|
|
|
@@ -63,7 +211,7 @@ export class Shipping {
|
|
|
63
211
|
shippingMethodsDefaults(): Promise<{}> {
|
|
64
212
|
|
|
65
213
|
const apiPath = '/v1/shipping/methods/defaults';
|
|
66
|
-
const
|
|
214
|
+
const apiPayload: Payload = {};
|
|
67
215
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
68
216
|
|
|
69
217
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -73,7 +221,7 @@ export class Shipping {
|
|
|
73
221
|
'post',
|
|
74
222
|
uri,
|
|
75
223
|
apiHeaders,
|
|
76
|
-
|
|
224
|
+
apiPayload
|
|
77
225
|
);
|
|
78
226
|
}
|
|
79
227
|
|
|
@@ -112,7 +260,7 @@ export class Shipping {
|
|
|
112
260
|
}
|
|
113
261
|
|
|
114
262
|
const apiPath = '/v1/shipping/methods/{id}'.replace('{id}', id);
|
|
115
|
-
const
|
|
263
|
+
const apiPayload: Payload = {};
|
|
116
264
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
117
265
|
|
|
118
266
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -122,7 +270,7 @@ export class Shipping {
|
|
|
122
270
|
'delete',
|
|
123
271
|
uri,
|
|
124
272
|
apiHeaders,
|
|
125
|
-
|
|
273
|
+
apiPayload
|
|
126
274
|
);
|
|
127
275
|
}
|
|
128
276
|
|
|
@@ -161,7 +309,7 @@ export class Shipping {
|
|
|
161
309
|
}
|
|
162
310
|
|
|
163
311
|
const apiPath = '/v1/shipping/methods/{id}'.replace('{id}', id);
|
|
164
|
-
const
|
|
312
|
+
const apiPayload: Payload = {};
|
|
165
313
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
166
314
|
|
|
167
315
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -171,46 +319,166 @@ export class Shipping {
|
|
|
171
319
|
'get',
|
|
172
320
|
uri,
|
|
173
321
|
apiHeaders,
|
|
174
|
-
|
|
322
|
+
apiPayload
|
|
175
323
|
);
|
|
176
324
|
}
|
|
177
325
|
|
|
178
326
|
/**
|
|
179
327
|
*
|
|
180
328
|
* @param {string} params.id -
|
|
329
|
+
* @param {string} params.carrier - Carrier anchor for the upcoming carrier connect (dynamic rates, tracking links).
|
|
330
|
+
* @param {string} params.code - Stable method code, unique per tenant (e.g. standard, express).
|
|
331
|
+
* @param {string[]} params.countries - Allowed ISO 3166-1 alpha-2 codes; null or empty = worldwide.
|
|
332
|
+
* @param {string} params.currency - ISO 4217 code (default EUR).
|
|
333
|
+
* @param {string} params.description -
|
|
334
|
+
* @param {boolean} params.enabled - Only enabled methods appear in rate responses (default false).
|
|
335
|
+
* @param {number} params.etaDaysMax - Delivery-time estimate for the checkout (days, upper bound).
|
|
336
|
+
* @param {number} params.etaDaysMin - Delivery-time estimate for the checkout (days, lower bound).
|
|
337
|
+
* @param {number} params.freeAbove - Free shipping at or above this order value — wins over every pricing model.
|
|
338
|
+
* @param {object} params.labels - Localized display names keyed by locale (e.g. {de, en}).
|
|
339
|
+
* @param {string} params.matrixAttribute - Attribute name for matrix_basis 'attribute'.
|
|
340
|
+
* @param {ShippingMethodMatrixBasis} params.matrixBasis - The measure a matrix method prices over; 'attribute' reads matrix_attribute from the rate request.
|
|
341
|
+
* @param {object} params.metadata - Free-form metadata.
|
|
342
|
+
* @param {string} params.name - Display name.
|
|
343
|
+
* @param {number} params.position - Sort order in the checkout (default 0).
|
|
344
|
+
* @param {number} params.price - The fixed price (default 0) — ignored for 'free' and 'matrix'.
|
|
345
|
+
* @param {ShippingMethodPricingType} params.pricingType - Pricing model (default 'fixed'): one price, no price, or tiered over a measure.
|
|
181
346
|
* @throws {RevenexxException}
|
|
182
347
|
* @returns {Promise<Models.ShippingMethod>}
|
|
183
348
|
*/
|
|
184
|
-
shippingMethodsUpdate(params: { id: string }): Promise<Models.ShippingMethod>;
|
|
349
|
+
shippingMethodsUpdate(params: { id: string, carrier?: string, code?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, name?: string, position?: number, price?: number, pricingType?: ShippingMethodPricingType }): Promise<Models.ShippingMethod>;
|
|
185
350
|
/**
|
|
186
351
|
*
|
|
187
352
|
* @param {string} id -
|
|
353
|
+
* @param {string} carrier - Carrier anchor for the upcoming carrier connect (dynamic rates, tracking links).
|
|
354
|
+
* @param {string} code - Stable method code, unique per tenant (e.g. standard, express).
|
|
355
|
+
* @param {string[]} countries - Allowed ISO 3166-1 alpha-2 codes; null or empty = worldwide.
|
|
356
|
+
* @param {string} currency - ISO 4217 code (default EUR).
|
|
357
|
+
* @param {string} description -
|
|
358
|
+
* @param {boolean} enabled - Only enabled methods appear in rate responses (default false).
|
|
359
|
+
* @param {number} etaDaysMax - Delivery-time estimate for the checkout (days, upper bound).
|
|
360
|
+
* @param {number} etaDaysMin - Delivery-time estimate for the checkout (days, lower bound).
|
|
361
|
+
* @param {number} freeAbove - Free shipping at or above this order value — wins over every pricing model.
|
|
362
|
+
* @param {object} labels - Localized display names keyed by locale (e.g. {de, en}).
|
|
363
|
+
* @param {string} matrixAttribute - Attribute name for matrix_basis 'attribute'.
|
|
364
|
+
* @param {ShippingMethodMatrixBasis} matrixBasis - The measure a matrix method prices over; 'attribute' reads matrix_attribute from the rate request.
|
|
365
|
+
* @param {object} metadata - Free-form metadata.
|
|
366
|
+
* @param {string} name - Display name.
|
|
367
|
+
* @param {number} position - Sort order in the checkout (default 0).
|
|
368
|
+
* @param {number} price - The fixed price (default 0) — ignored for 'free' and 'matrix'.
|
|
369
|
+
* @param {ShippingMethodPricingType} pricingType - Pricing model (default 'fixed'): one price, no price, or tiered over a measure.
|
|
188
370
|
* @throws {RevenexxException}
|
|
189
371
|
* @returns {Promise<Models.ShippingMethod>}
|
|
190
372
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
191
373
|
*/
|
|
192
|
-
shippingMethodsUpdate(id: string): Promise<Models.ShippingMethod>;
|
|
374
|
+
shippingMethodsUpdate(id: string, carrier?: string, code?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, name?: string, position?: number, price?: number, pricingType?: ShippingMethodPricingType): Promise<Models.ShippingMethod>;
|
|
193
375
|
shippingMethodsUpdate(
|
|
194
|
-
paramsOrFirst: { id: string } | string
|
|
376
|
+
paramsOrFirst: { id: string, carrier?: string, code?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, name?: string, position?: number, price?: number, pricingType?: ShippingMethodPricingType } | string,
|
|
377
|
+
...rest: [(string)?, (string)?, (string[])?, (string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (object)?, (string)?, (ShippingMethodMatrixBasis)?, (object)?, (string)?, (number)?, (number)?, (ShippingMethodPricingType)?]
|
|
195
378
|
): Promise<Models.ShippingMethod> {
|
|
196
|
-
let params: { id: string };
|
|
379
|
+
let params: { id: string, carrier?: string, code?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, name?: string, position?: number, price?: number, pricingType?: ShippingMethodPricingType };
|
|
197
380
|
|
|
198
381
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
199
|
-
params = (paramsOrFirst || {}) as { id: string };
|
|
382
|
+
params = (paramsOrFirst || {}) as { id: string, carrier?: string, code?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, name?: string, position?: number, price?: number, pricingType?: ShippingMethodPricingType };
|
|
200
383
|
} else {
|
|
201
384
|
params = {
|
|
202
|
-
id: paramsOrFirst as string
|
|
385
|
+
id: paramsOrFirst as string,
|
|
386
|
+
carrier: rest[0] as string,
|
|
387
|
+
code: rest[1] as string,
|
|
388
|
+
countries: rest[2] as string[],
|
|
389
|
+
currency: rest[3] as string,
|
|
390
|
+
description: rest[4] as string,
|
|
391
|
+
enabled: rest[5] as boolean,
|
|
392
|
+
etaDaysMax: rest[6] as number,
|
|
393
|
+
etaDaysMin: rest[7] as number,
|
|
394
|
+
freeAbove: rest[8] as number,
|
|
395
|
+
labels: rest[9] as object,
|
|
396
|
+
matrixAttribute: rest[10] as string,
|
|
397
|
+
matrixBasis: rest[11] as ShippingMethodMatrixBasis,
|
|
398
|
+
metadata: rest[12] as object,
|
|
399
|
+
name: rest[13] as string,
|
|
400
|
+
position: rest[14] as number,
|
|
401
|
+
price: rest[15] as number,
|
|
402
|
+
pricingType: rest[16] as ShippingMethodPricingType
|
|
203
403
|
};
|
|
204
404
|
}
|
|
205
405
|
|
|
206
406
|
const id = params.id;
|
|
407
|
+
const carrier = params.carrier;
|
|
408
|
+
const code = params.code;
|
|
409
|
+
const countries = params.countries;
|
|
410
|
+
const currency = params.currency;
|
|
411
|
+
const description = params.description;
|
|
412
|
+
const enabled = params.enabled;
|
|
413
|
+
const etaDaysMax = params.etaDaysMax;
|
|
414
|
+
const etaDaysMin = params.etaDaysMin;
|
|
415
|
+
const freeAbove = params.freeAbove;
|
|
416
|
+
const labels = params.labels;
|
|
417
|
+
const matrixAttribute = params.matrixAttribute;
|
|
418
|
+
const matrixBasis = params.matrixBasis;
|
|
419
|
+
const metadata = params.metadata;
|
|
420
|
+
const name = params.name;
|
|
421
|
+
const position = params.position;
|
|
422
|
+
const price = params.price;
|
|
423
|
+
const pricingType = params.pricingType;
|
|
207
424
|
|
|
208
425
|
if (typeof id === 'undefined') {
|
|
209
426
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
210
427
|
}
|
|
211
428
|
|
|
212
429
|
const apiPath = '/v1/shipping/methods/{id}'.replace('{id}', id);
|
|
213
|
-
const
|
|
430
|
+
const apiPayload: Payload = {};
|
|
431
|
+
if (typeof carrier !== 'undefined') {
|
|
432
|
+
apiPayload['carrier'] = carrier;
|
|
433
|
+
}
|
|
434
|
+
if (typeof code !== 'undefined') {
|
|
435
|
+
apiPayload['code'] = code;
|
|
436
|
+
}
|
|
437
|
+
if (typeof countries !== 'undefined') {
|
|
438
|
+
apiPayload['countries'] = countries;
|
|
439
|
+
}
|
|
440
|
+
if (typeof currency !== 'undefined') {
|
|
441
|
+
apiPayload['currency'] = currency;
|
|
442
|
+
}
|
|
443
|
+
if (typeof description !== 'undefined') {
|
|
444
|
+
apiPayload['description'] = description;
|
|
445
|
+
}
|
|
446
|
+
if (typeof enabled !== 'undefined') {
|
|
447
|
+
apiPayload['enabled'] = enabled;
|
|
448
|
+
}
|
|
449
|
+
if (typeof etaDaysMax !== 'undefined') {
|
|
450
|
+
apiPayload['eta_days_max'] = etaDaysMax;
|
|
451
|
+
}
|
|
452
|
+
if (typeof etaDaysMin !== 'undefined') {
|
|
453
|
+
apiPayload['eta_days_min'] = etaDaysMin;
|
|
454
|
+
}
|
|
455
|
+
if (typeof freeAbove !== 'undefined') {
|
|
456
|
+
apiPayload['free_above'] = freeAbove;
|
|
457
|
+
}
|
|
458
|
+
if (typeof labels !== 'undefined') {
|
|
459
|
+
apiPayload['labels'] = labels;
|
|
460
|
+
}
|
|
461
|
+
if (typeof matrixAttribute !== 'undefined') {
|
|
462
|
+
apiPayload['matrix_attribute'] = matrixAttribute;
|
|
463
|
+
}
|
|
464
|
+
if (typeof matrixBasis !== 'undefined') {
|
|
465
|
+
apiPayload['matrix_basis'] = matrixBasis;
|
|
466
|
+
}
|
|
467
|
+
if (typeof metadata !== 'undefined') {
|
|
468
|
+
apiPayload['metadata'] = metadata;
|
|
469
|
+
}
|
|
470
|
+
if (typeof name !== 'undefined') {
|
|
471
|
+
apiPayload['name'] = name;
|
|
472
|
+
}
|
|
473
|
+
if (typeof position !== 'undefined') {
|
|
474
|
+
apiPayload['position'] = position;
|
|
475
|
+
}
|
|
476
|
+
if (typeof price !== 'undefined') {
|
|
477
|
+
apiPayload['price'] = price;
|
|
478
|
+
}
|
|
479
|
+
if (typeof pricingType !== 'undefined') {
|
|
480
|
+
apiPayload['pricing_type'] = pricingType;
|
|
481
|
+
}
|
|
214
482
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
215
483
|
|
|
216
484
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -221,7 +489,7 @@ export class Shipping {
|
|
|
221
489
|
'put',
|
|
222
490
|
uri,
|
|
223
491
|
apiHeaders,
|
|
224
|
-
|
|
492
|
+
apiPayload
|
|
225
493
|
);
|
|
226
494
|
}
|
|
227
495
|
|
|
@@ -259,8 +527,8 @@ export class Shipping {
|
|
|
259
527
|
throw new RevenexxException('Missing required parameter: "methodId"');
|
|
260
528
|
}
|
|
261
529
|
|
|
262
|
-
const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{
|
|
263
|
-
const
|
|
530
|
+
const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{method_id}', methodId);
|
|
531
|
+
const apiPayload: Payload = {};
|
|
264
532
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
265
533
|
|
|
266
534
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -270,46 +538,68 @@ export class Shipping {
|
|
|
270
538
|
'get',
|
|
271
539
|
uri,
|
|
272
540
|
apiHeaders,
|
|
273
|
-
|
|
541
|
+
apiPayload
|
|
274
542
|
);
|
|
275
543
|
}
|
|
276
544
|
|
|
277
545
|
/**
|
|
278
546
|
*
|
|
279
547
|
* @param {string} params.methodId -
|
|
548
|
+
* @param {number} params.fromValue - Tier threshold (default 0) — the tier with the highest from_value at or below the measured value wins.
|
|
549
|
+
* @param {number} params.position - Sort order (default 0; bulk replace derives it from the array index).
|
|
550
|
+
* @param {number} params.price - Price of this tier (default 0).
|
|
280
551
|
* @throws {RevenexxException}
|
|
281
552
|
* @returns {Promise<Models.ShippingRateTier>}
|
|
282
553
|
*/
|
|
283
|
-
shippingTiersCreate(params: { methodId: string }): Promise<Models.ShippingRateTier>;
|
|
554
|
+
shippingTiersCreate(params: { methodId: string, fromValue?: number, position?: number, price?: number }): Promise<Models.ShippingRateTier>;
|
|
284
555
|
/**
|
|
285
556
|
*
|
|
286
557
|
* @param {string} methodId -
|
|
558
|
+
* @param {number} fromValue - Tier threshold (default 0) — the tier with the highest from_value at or below the measured value wins.
|
|
559
|
+
* @param {number} position - Sort order (default 0; bulk replace derives it from the array index).
|
|
560
|
+
* @param {number} price - Price of this tier (default 0).
|
|
287
561
|
* @throws {RevenexxException}
|
|
288
562
|
* @returns {Promise<Models.ShippingRateTier>}
|
|
289
563
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
290
564
|
*/
|
|
291
|
-
shippingTiersCreate(methodId: string): Promise<Models.ShippingRateTier>;
|
|
565
|
+
shippingTiersCreate(methodId: string, fromValue?: number, position?: number, price?: number): Promise<Models.ShippingRateTier>;
|
|
292
566
|
shippingTiersCreate(
|
|
293
|
-
paramsOrFirst: { methodId: string } | string
|
|
567
|
+
paramsOrFirst: { methodId: string, fromValue?: number, position?: number, price?: number } | string,
|
|
568
|
+
...rest: [(number)?, (number)?, (number)?]
|
|
294
569
|
): Promise<Models.ShippingRateTier> {
|
|
295
|
-
let params: { methodId: string };
|
|
570
|
+
let params: { methodId: string, fromValue?: number, position?: number, price?: number };
|
|
296
571
|
|
|
297
572
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
298
|
-
params = (paramsOrFirst || {}) as { methodId: string };
|
|
573
|
+
params = (paramsOrFirst || {}) as { methodId: string, fromValue?: number, position?: number, price?: number };
|
|
299
574
|
} else {
|
|
300
575
|
params = {
|
|
301
|
-
methodId: paramsOrFirst as string
|
|
576
|
+
methodId: paramsOrFirst as string,
|
|
577
|
+
fromValue: rest[0] as number,
|
|
578
|
+
position: rest[1] as number,
|
|
579
|
+
price: rest[2] as number
|
|
302
580
|
};
|
|
303
581
|
}
|
|
304
582
|
|
|
305
583
|
const methodId = params.methodId;
|
|
584
|
+
const fromValue = params.fromValue;
|
|
585
|
+
const position = params.position;
|
|
586
|
+
const price = params.price;
|
|
306
587
|
|
|
307
588
|
if (typeof methodId === 'undefined') {
|
|
308
589
|
throw new RevenexxException('Missing required parameter: "methodId"');
|
|
309
590
|
}
|
|
310
591
|
|
|
311
|
-
const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{
|
|
312
|
-
const
|
|
592
|
+
const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{method_id}', methodId);
|
|
593
|
+
const apiPayload: Payload = {};
|
|
594
|
+
if (typeof fromValue !== 'undefined') {
|
|
595
|
+
apiPayload['from_value'] = fromValue;
|
|
596
|
+
}
|
|
597
|
+
if (typeof position !== 'undefined') {
|
|
598
|
+
apiPayload['position'] = position;
|
|
599
|
+
}
|
|
600
|
+
if (typeof price !== 'undefined') {
|
|
601
|
+
apiPayload['price'] = price;
|
|
602
|
+
}
|
|
313
603
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
314
604
|
|
|
315
605
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -320,46 +610,57 @@ export class Shipping {
|
|
|
320
610
|
'post',
|
|
321
611
|
uri,
|
|
322
612
|
apiHeaders,
|
|
323
|
-
|
|
613
|
+
apiPayload
|
|
324
614
|
);
|
|
325
615
|
}
|
|
326
616
|
|
|
327
617
|
/**
|
|
328
618
|
*
|
|
329
619
|
* @param {string} params.methodId -
|
|
620
|
+
* @param {Models.ShippingRateTierReplaceItem[]} params.tiers - The complete new tier set (set semantics) — positions are derived from the array order.
|
|
330
621
|
* @throws {RevenexxException}
|
|
331
622
|
* @returns {Promise<{}>}
|
|
332
623
|
*/
|
|
333
|
-
shippingTiersReplace(params: { methodId: string }): Promise<{}>;
|
|
624
|
+
shippingTiersReplace(params: { methodId: string, tiers: Models.ShippingRateTierReplaceItem[] }): Promise<{}>;
|
|
334
625
|
/**
|
|
335
626
|
*
|
|
336
627
|
* @param {string} methodId -
|
|
628
|
+
* @param {Models.ShippingRateTierReplaceItem[]} tiers - The complete new tier set (set semantics) — positions are derived from the array order.
|
|
337
629
|
* @throws {RevenexxException}
|
|
338
630
|
* @returns {Promise<{}>}
|
|
339
631
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
340
632
|
*/
|
|
341
|
-
shippingTiersReplace(methodId: string): Promise<{}>;
|
|
633
|
+
shippingTiersReplace(methodId: string, tiers: Models.ShippingRateTierReplaceItem[]): Promise<{}>;
|
|
342
634
|
shippingTiersReplace(
|
|
343
|
-
paramsOrFirst: { methodId: string } | string
|
|
635
|
+
paramsOrFirst: { methodId: string, tiers: Models.ShippingRateTierReplaceItem[] } | string,
|
|
636
|
+
...rest: [(Models.ShippingRateTierReplaceItem[])?]
|
|
344
637
|
): Promise<{}> {
|
|
345
|
-
let params: { methodId: string };
|
|
638
|
+
let params: { methodId: string, tiers: Models.ShippingRateTierReplaceItem[] };
|
|
346
639
|
|
|
347
640
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
348
|
-
params = (paramsOrFirst || {}) as { methodId: string };
|
|
641
|
+
params = (paramsOrFirst || {}) as { methodId: string, tiers: Models.ShippingRateTierReplaceItem[] };
|
|
349
642
|
} else {
|
|
350
643
|
params = {
|
|
351
|
-
methodId: paramsOrFirst as string
|
|
644
|
+
methodId: paramsOrFirst as string,
|
|
645
|
+
tiers: rest[0] as Models.ShippingRateTierReplaceItem[]
|
|
352
646
|
};
|
|
353
647
|
}
|
|
354
648
|
|
|
355
649
|
const methodId = params.methodId;
|
|
650
|
+
const tiers = params.tiers;
|
|
356
651
|
|
|
357
652
|
if (typeof methodId === 'undefined') {
|
|
358
653
|
throw new RevenexxException('Missing required parameter: "methodId"');
|
|
359
654
|
}
|
|
655
|
+
if (typeof tiers === 'undefined') {
|
|
656
|
+
throw new RevenexxException('Missing required parameter: "tiers"');
|
|
657
|
+
}
|
|
360
658
|
|
|
361
|
-
const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{
|
|
362
|
-
const
|
|
659
|
+
const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{method_id}', methodId);
|
|
660
|
+
const apiPayload: Payload = {};
|
|
661
|
+
if (typeof tiers !== 'undefined') {
|
|
662
|
+
apiPayload['tiers'] = tiers;
|
|
663
|
+
}
|
|
363
664
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
364
665
|
|
|
365
666
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -370,7 +671,7 @@ export class Shipping {
|
|
|
370
671
|
'put',
|
|
371
672
|
uri,
|
|
372
673
|
apiHeaders,
|
|
373
|
-
|
|
674
|
+
apiPayload
|
|
374
675
|
);
|
|
375
676
|
}
|
|
376
677
|
|
|
@@ -416,8 +717,8 @@ export class Shipping {
|
|
|
416
717
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
417
718
|
}
|
|
418
719
|
|
|
419
|
-
const apiPath = '/v1/shipping/methods/{method_id}/tiers/{id}'.replace('{
|
|
420
|
-
const
|
|
720
|
+
const apiPath = '/v1/shipping/methods/{method_id}/tiers/{id}'.replace('{method_id}', methodId).replace('{id}', id);
|
|
721
|
+
const apiPayload: Payload = {};
|
|
421
722
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
422
723
|
|
|
423
724
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -427,7 +728,7 @@ export class Shipping {
|
|
|
427
728
|
'delete',
|
|
428
729
|
uri,
|
|
429
730
|
apiHeaders,
|
|
430
|
-
|
|
731
|
+
apiPayload
|
|
431
732
|
);
|
|
432
733
|
}
|
|
433
734
|
|
|
@@ -473,8 +774,8 @@ export class Shipping {
|
|
|
473
774
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
474
775
|
}
|
|
475
776
|
|
|
476
|
-
const apiPath = '/v1/shipping/methods/{method_id}/tiers/{id}'.replace('{
|
|
477
|
-
const
|
|
777
|
+
const apiPath = '/v1/shipping/methods/{method_id}/tiers/{id}'.replace('{method_id}', methodId).replace('{id}', id);
|
|
778
|
+
const apiPayload: Payload = {};
|
|
478
779
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
479
780
|
|
|
480
781
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -484,7 +785,7 @@ export class Shipping {
|
|
|
484
785
|
'get',
|
|
485
786
|
uri,
|
|
486
787
|
apiHeaders,
|
|
487
|
-
|
|
788
|
+
apiPayload
|
|
488
789
|
);
|
|
489
790
|
}
|
|
490
791
|
|
|
@@ -492,36 +793,48 @@ export class Shipping {
|
|
|
492
793
|
*
|
|
493
794
|
* @param {string} params.methodId -
|
|
494
795
|
* @param {string} params.id -
|
|
796
|
+
* @param {number} params.fromValue - Tier threshold (default 0) — the tier with the highest from_value at or below the measured value wins.
|
|
797
|
+
* @param {number} params.position - Sort order (default 0; bulk replace derives it from the array index).
|
|
798
|
+
* @param {number} params.price - Price of this tier (default 0).
|
|
495
799
|
* @throws {RevenexxException}
|
|
496
800
|
* @returns {Promise<Models.ShippingRateTier>}
|
|
497
801
|
*/
|
|
498
|
-
shippingTiersUpdate(params: { methodId: string, id: string }): Promise<Models.ShippingRateTier>;
|
|
802
|
+
shippingTiersUpdate(params: { methodId: string, id: string, fromValue?: number, position?: number, price?: number }): Promise<Models.ShippingRateTier>;
|
|
499
803
|
/**
|
|
500
804
|
*
|
|
501
805
|
* @param {string} methodId -
|
|
502
806
|
* @param {string} id -
|
|
807
|
+
* @param {number} fromValue - Tier threshold (default 0) — the tier with the highest from_value at or below the measured value wins.
|
|
808
|
+
* @param {number} position - Sort order (default 0; bulk replace derives it from the array index).
|
|
809
|
+
* @param {number} price - Price of this tier (default 0).
|
|
503
810
|
* @throws {RevenexxException}
|
|
504
811
|
* @returns {Promise<Models.ShippingRateTier>}
|
|
505
812
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
506
813
|
*/
|
|
507
|
-
shippingTiersUpdate(methodId: string, id: string): Promise<Models.ShippingRateTier>;
|
|
814
|
+
shippingTiersUpdate(methodId: string, id: string, fromValue?: number, position?: number, price?: number): Promise<Models.ShippingRateTier>;
|
|
508
815
|
shippingTiersUpdate(
|
|
509
|
-
paramsOrFirst: { methodId: string, id: string } | string,
|
|
510
|
-
...rest: [(string)?]
|
|
816
|
+
paramsOrFirst: { methodId: string, id: string, fromValue?: number, position?: number, price?: number } | string,
|
|
817
|
+
...rest: [(string)?, (number)?, (number)?, (number)?]
|
|
511
818
|
): Promise<Models.ShippingRateTier> {
|
|
512
|
-
let params: { methodId: string, id: string };
|
|
819
|
+
let params: { methodId: string, id: string, fromValue?: number, position?: number, price?: number };
|
|
513
820
|
|
|
514
821
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
515
|
-
params = (paramsOrFirst || {}) as { methodId: string, id: string };
|
|
822
|
+
params = (paramsOrFirst || {}) as { methodId: string, id: string, fromValue?: number, position?: number, price?: number };
|
|
516
823
|
} else {
|
|
517
824
|
params = {
|
|
518
825
|
methodId: paramsOrFirst as string,
|
|
519
|
-
id: rest[0] as string
|
|
826
|
+
id: rest[0] as string,
|
|
827
|
+
fromValue: rest[1] as number,
|
|
828
|
+
position: rest[2] as number,
|
|
829
|
+
price: rest[3] as number
|
|
520
830
|
};
|
|
521
831
|
}
|
|
522
832
|
|
|
523
833
|
const methodId = params.methodId;
|
|
524
834
|
const id = params.id;
|
|
835
|
+
const fromValue = params.fromValue;
|
|
836
|
+
const position = params.position;
|
|
837
|
+
const price = params.price;
|
|
525
838
|
|
|
526
839
|
if (typeof methodId === 'undefined') {
|
|
527
840
|
throw new RevenexxException('Missing required parameter: "methodId"');
|
|
@@ -530,8 +843,17 @@ export class Shipping {
|
|
|
530
843
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
531
844
|
}
|
|
532
845
|
|
|
533
|
-
const apiPath = '/v1/shipping/methods/{method_id}/tiers/{id}'.replace('{
|
|
534
|
-
const
|
|
846
|
+
const apiPath = '/v1/shipping/methods/{method_id}/tiers/{id}'.replace('{method_id}', methodId).replace('{id}', id);
|
|
847
|
+
const apiPayload: Payload = {};
|
|
848
|
+
if (typeof fromValue !== 'undefined') {
|
|
849
|
+
apiPayload['from_value'] = fromValue;
|
|
850
|
+
}
|
|
851
|
+
if (typeof position !== 'undefined') {
|
|
852
|
+
apiPayload['position'] = position;
|
|
853
|
+
}
|
|
854
|
+
if (typeof price !== 'undefined') {
|
|
855
|
+
apiPayload['price'] = price;
|
|
856
|
+
}
|
|
535
857
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
536
858
|
|
|
537
859
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -542,19 +864,89 @@ export class Shipping {
|
|
|
542
864
|
'put',
|
|
543
865
|
uri,
|
|
544
866
|
apiHeaders,
|
|
545
|
-
|
|
867
|
+
apiPayload
|
|
546
868
|
);
|
|
547
869
|
}
|
|
548
870
|
|
|
549
871
|
/**
|
|
550
872
|
*
|
|
873
|
+
* @param {object} params.attributes - Measure values for attribute matrices, keyed by attribute name.
|
|
874
|
+
* @param {string} params.country - Destination ISO 3166-1 alpha-2 code — checked against method country restrictions.
|
|
875
|
+
* @param {string} params.currency - Echoed into the rates (default 'EUR').
|
|
876
|
+
* @param {string} params.marketId - Buyer market for tax resolution (else inferred from country, else first market).
|
|
877
|
+
* @param {number} params.orderValue - Order value (default 0) — drives free-above thresholds and order_value matrices.
|
|
878
|
+
* @param {number} params.quantity - Total quantity — measure for quantity matrices.
|
|
879
|
+
* @param {number} params.weight - Total weight — measure for weight matrices.
|
|
880
|
+
* @throws {RevenexxException}
|
|
881
|
+
* @returns {Promise<{}>}
|
|
882
|
+
*/
|
|
883
|
+
shippingRates(params?: { attributes?: object, country?: string, currency?: string, marketId?: string, orderValue?: number, quantity?: number, weight?: number }): Promise<{}>;
|
|
884
|
+
/**
|
|
885
|
+
*
|
|
886
|
+
* @param {object} attributes - Measure values for attribute matrices, keyed by attribute name.
|
|
887
|
+
* @param {string} country - Destination ISO 3166-1 alpha-2 code — checked against method country restrictions.
|
|
888
|
+
* @param {string} currency - Echoed into the rates (default 'EUR').
|
|
889
|
+
* @param {string} marketId - Buyer market for tax resolution (else inferred from country, else first market).
|
|
890
|
+
* @param {number} orderValue - Order value (default 0) — drives free-above thresholds and order_value matrices.
|
|
891
|
+
* @param {number} quantity - Total quantity — measure for quantity matrices.
|
|
892
|
+
* @param {number} weight - Total weight — measure for weight matrices.
|
|
551
893
|
* @throws {RevenexxException}
|
|
552
894
|
* @returns {Promise<{}>}
|
|
895
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
553
896
|
*/
|
|
554
|
-
shippingRates(): Promise<{}
|
|
897
|
+
shippingRates(attributes?: object, country?: string, currency?: string, marketId?: string, orderValue?: number, quantity?: number, weight?: number): Promise<{}>;
|
|
898
|
+
shippingRates(
|
|
899
|
+
paramsOrFirst?: { attributes?: object, country?: string, currency?: string, marketId?: string, orderValue?: number, quantity?: number, weight?: number } | object,
|
|
900
|
+
...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (number)?]
|
|
901
|
+
): Promise<{}> {
|
|
902
|
+
let params: { attributes?: object, country?: string, currency?: string, marketId?: string, orderValue?: number, quantity?: number, weight?: number };
|
|
903
|
+
|
|
904
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('attributes' in paramsOrFirst || 'country' in paramsOrFirst || 'currency' in paramsOrFirst || 'marketId' in paramsOrFirst || 'orderValue' in paramsOrFirst || 'quantity' in paramsOrFirst || 'weight' in paramsOrFirst))) {
|
|
905
|
+
params = (paramsOrFirst || {}) as { attributes?: object, country?: string, currency?: string, marketId?: string, orderValue?: number, quantity?: number, weight?: number };
|
|
906
|
+
} else {
|
|
907
|
+
params = {
|
|
908
|
+
attributes: paramsOrFirst as object,
|
|
909
|
+
country: rest[0] as string,
|
|
910
|
+
currency: rest[1] as string,
|
|
911
|
+
marketId: rest[2] as string,
|
|
912
|
+
orderValue: rest[3] as number,
|
|
913
|
+
quantity: rest[4] as number,
|
|
914
|
+
weight: rest[5] as number
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
const attributes = params.attributes;
|
|
919
|
+
const country = params.country;
|
|
920
|
+
const currency = params.currency;
|
|
921
|
+
const marketId = params.marketId;
|
|
922
|
+
const orderValue = params.orderValue;
|
|
923
|
+
const quantity = params.quantity;
|
|
924
|
+
const weight = params.weight;
|
|
925
|
+
|
|
555
926
|
|
|
556
927
|
const apiPath = '/v1/shipping/rates';
|
|
557
|
-
const
|
|
928
|
+
const apiPayload: Payload = {};
|
|
929
|
+
if (typeof attributes !== 'undefined') {
|
|
930
|
+
apiPayload['attributes'] = attributes;
|
|
931
|
+
}
|
|
932
|
+
if (typeof country !== 'undefined') {
|
|
933
|
+
apiPayload['country'] = country;
|
|
934
|
+
}
|
|
935
|
+
if (typeof currency !== 'undefined') {
|
|
936
|
+
apiPayload['currency'] = currency;
|
|
937
|
+
}
|
|
938
|
+
if (typeof marketId !== 'undefined') {
|
|
939
|
+
apiPayload['market_id'] = marketId;
|
|
940
|
+
}
|
|
941
|
+
if (typeof orderValue !== 'undefined') {
|
|
942
|
+
apiPayload['order_value'] = orderValue;
|
|
943
|
+
}
|
|
944
|
+
if (typeof quantity !== 'undefined') {
|
|
945
|
+
apiPayload['quantity'] = quantity;
|
|
946
|
+
}
|
|
947
|
+
if (typeof weight !== 'undefined') {
|
|
948
|
+
apiPayload['weight'] = weight;
|
|
949
|
+
}
|
|
558
950
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
559
951
|
|
|
560
952
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -565,7 +957,7 @@ export class Shipping {
|
|
|
565
957
|
'post',
|
|
566
958
|
uri,
|
|
567
959
|
apiHeaders,
|
|
568
|
-
|
|
960
|
+
apiPayload
|
|
569
961
|
);
|
|
570
962
|
}
|
|
571
963
|
}
|