@viu/emporix-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +407 -0
- package/LICENSE +21 -0
- package/README.md +115 -0
- package/dist/cart.cjs +214 -0
- package/dist/cart.cjs.map +1 -0
- package/dist/cart.d.cts +1807 -0
- package/dist/cart.d.ts +1807 -0
- package/dist/cart.js +4 -0
- package/dist/cart.js.map +1 -0
- package/dist/category.cjs +97 -0
- package/dist/category.cjs.map +1 -0
- package/dist/category.d.cts +313 -0
- package/dist/category.d.ts +313 -0
- package/dist/category.js +4 -0
- package/dist/category.js.map +1 -0
- package/dist/checkout.cjs +98 -0
- package/dist/checkout.cjs.map +1 -0
- package/dist/checkout.d.cts +252 -0
- package/dist/checkout.d.ts +252 -0
- package/dist/checkout.js +4 -0
- package/dist/checkout.js.map +1 -0
- package/dist/chunk-4BJUCCKJ.js +86 -0
- package/dist/chunk-4BJUCCKJ.js.map +1 -0
- package/dist/chunk-6UNFMCHZ.js +95 -0
- package/dist/chunk-6UNFMCHZ.js.map +1 -0
- package/dist/chunk-B56JZNI7.js +49 -0
- package/dist/chunk-B56JZNI7.js.map +1 -0
- package/dist/chunk-BFQ732VZ.js +11 -0
- package/dist/chunk-BFQ732VZ.js.map +1 -0
- package/dist/chunk-F3WAQH2E.js +120 -0
- package/dist/chunk-F3WAQH2E.js.map +1 -0
- package/dist/chunk-GWJ2U2CP.js +14 -0
- package/dist/chunk-GWJ2U2CP.js.map +1 -0
- package/dist/chunk-HEO34WLO.js +47 -0
- package/dist/chunk-HEO34WLO.js.map +1 -0
- package/dist/chunk-HKPZI7Y5.js +30 -0
- package/dist/chunk-HKPZI7Y5.js.map +1 -0
- package/dist/chunk-IEZHGU7F.js +171 -0
- package/dist/chunk-IEZHGU7F.js.map +1 -0
- package/dist/chunk-KTODT6DV.js +86 -0
- package/dist/chunk-KTODT6DV.js.map +1 -0
- package/dist/chunk-NM7VDXBR.js +57 -0
- package/dist/chunk-NM7VDXBR.js.map +1 -0
- package/dist/chunk-OMYVOOSX.js +57 -0
- package/dist/chunk-OMYVOOSX.js.map +1 -0
- package/dist/chunk-QDABAMVN.js +89 -0
- package/dist/chunk-QDABAMVN.js.map +1 -0
- package/dist/chunk-RXVVFNYN.js +56 -0
- package/dist/chunk-RXVVFNYN.js.map +1 -0
- package/dist/chunk-SKX7KCMH.js +23 -0
- package/dist/chunk-SKX7KCMH.js.map +1 -0
- package/dist/chunk-TLH6SLAF.js +215 -0
- package/dist/chunk-TLH6SLAF.js.map +1 -0
- package/dist/chunk-Z6PNI5VT.js +142 -0
- package/dist/chunk-Z6PNI5VT.js.map +1 -0
- package/dist/companies.cjs +58 -0
- package/dist/companies.cjs.map +1 -0
- package/dist/companies.d.cts +31 -0
- package/dist/companies.d.ts +31 -0
- package/dist/companies.js +3 -0
- package/dist/companies.js.map +1 -0
- package/dist/contacts.cjs +51 -0
- package/dist/contacts.cjs.map +1 -0
- package/dist/contacts.d.cts +28 -0
- package/dist/contacts.d.ts +28 -0
- package/dist/contacts.js +3 -0
- package/dist/contacts.js.map +1 -0
- package/dist/context-vKgzZ-5f.d.cts +329 -0
- package/dist/context-vKgzZ-5f.d.ts +329 -0
- package/dist/customer-groups.cjs +25 -0
- package/dist/customer-groups.cjs.map +1 -0
- package/dist/customer-groups.d.cts +36 -0
- package/dist/customer-groups.d.ts +36 -0
- package/dist/customer-groups.js +3 -0
- package/dist/customer-groups.js.map +1 -0
- package/dist/customer.cjs +262 -0
- package/dist/customer.cjs.map +1 -0
- package/dist/customer.d.cts +386 -0
- package/dist/customer.d.ts +386 -0
- package/dist/customer.js +5 -0
- package/dist/customer.js.map +1 -0
- package/dist/index.cjs +2075 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +218 -0
- package/dist/index.d.ts +218 -0
- package/dist/index.js +791 -0
- package/dist/index.js.map +1 -0
- package/dist/locations.cjs +59 -0
- package/dist/locations.cjs.map +1 -0
- package/dist/locations.d.cts +30 -0
- package/dist/locations.d.ts +30 -0
- package/dist/locations.js +3 -0
- package/dist/locations.js.map +1 -0
- package/dist/media.cjs +123 -0
- package/dist/media.cjs.map +1 -0
- package/dist/media.d.cts +219 -0
- package/dist/media.d.ts +219 -0
- package/dist/media.js +3 -0
- package/dist/media.js.map +1 -0
- package/dist/orders.cjs +98 -0
- package/dist/orders.cjs.map +1 -0
- package/dist/orders.d.cts +167 -0
- package/dist/orders.d.ts +167 -0
- package/dist/orders.js +3 -0
- package/dist/orders.js.map +1 -0
- package/dist/payment.cjs +77 -0
- package/dist/payment.cjs.map +1 -0
- package/dist/payment.d.cts +110 -0
- package/dist/payment.d.ts +110 -0
- package/dist/payment.js +5 -0
- package/dist/payment.js.map +1 -0
- package/dist/price.cjs +88 -0
- package/dist/price.cjs.map +1 -0
- package/dist/price.d.cts +445 -0
- package/dist/price.d.ts +445 -0
- package/dist/price.js +4 -0
- package/dist/price.js.map +1 -0
- package/dist/product.cjs +100 -0
- package/dist/product.cjs.map +1 -0
- package/dist/product.d.cts +400 -0
- package/dist/product.d.ts +400 -0
- package/dist/product.js +4 -0
- package/dist/product.js.map +1 -0
- package/dist/segment.cjs +189 -0
- package/dist/segment.cjs.map +1 -0
- package/dist/segment.d.cts +241 -0
- package/dist/segment.d.ts +241 -0
- package/dist/segment.js +5 -0
- package/dist/segment.js.map +1 -0
- package/dist/types.gen-D1QuqPLs.d.cts +166 -0
- package/dist/types.gen-D1QuqPLs.d.ts +166 -0
- package/package.json +141 -0
package/dist/cart.d.ts
ADDED
|
@@ -0,0 +1,1807 @@
|
|
|
1
|
+
import { C as ClientContext, b as AuthContext } from './context-vKgzZ-5f.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Access control identifier that determines who can view or manage the cart.
|
|
5
|
+
*
|
|
6
|
+
* **Purpose**: Restricts cart visibility based on scope permissions. Only users/applications
|
|
7
|
+
* with matching restriction scopes can access carts with a specific restriction value.
|
|
8
|
+
*
|
|
9
|
+
* **Access Control**:
|
|
10
|
+
* - *Reading*: Users can only query and view carts with the `restriction` value that matches one of their authorized restrictions.
|
|
11
|
+
*
|
|
12
|
+
* **Validation**: The value must exist in the tenant's configured list of valid restrictions.
|
|
13
|
+
*
|
|
14
|
+
* **Restriction Synchronization**:
|
|
15
|
+
* - If cart is created by customer and `restriction` is not set, the `restriction` will be inherited from customer's restriction'.
|
|
16
|
+
* - If the `restriction` property is not set with tenant configuration property `enableSyncBetweenRestrictionsAndSiteCodes` set to `true`, the `restriction` field automatically syncs with cart's siteCode property.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
type Restriction = string | null;
|
|
20
|
+
type BaseCart = {
|
|
21
|
+
/**
|
|
22
|
+
* Cart unique identifier generated when a cart is created.
|
|
23
|
+
*/
|
|
24
|
+
id?: string;
|
|
25
|
+
yrn?: Yrn;
|
|
26
|
+
restriction?: Restriction;
|
|
27
|
+
/**
|
|
28
|
+
* Customer unique identifier generated when a customer account is created through the Customer Service.
|
|
29
|
+
*/
|
|
30
|
+
customerId?: string;
|
|
31
|
+
/**
|
|
32
|
+
* ID of the legal entity to which customer is assigned.
|
|
33
|
+
*/
|
|
34
|
+
legalEntityId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The identifier of an order generated from this cart.
|
|
37
|
+
*/
|
|
38
|
+
orderId?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Identifier of a quote created from this cart.
|
|
41
|
+
*/
|
|
42
|
+
quoteId?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Three-letter currency code, compliant with the ISO 4217 standard.
|
|
45
|
+
*/
|
|
46
|
+
currency?: string;
|
|
47
|
+
deliveryWindow?: DeliveryWindow;
|
|
48
|
+
/**
|
|
49
|
+
* Site unique identifier. A site is a specific shop.
|
|
50
|
+
*/
|
|
51
|
+
siteCode: string;
|
|
52
|
+
/**
|
|
53
|
+
* Cart type.
|
|
54
|
+
*/
|
|
55
|
+
type?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Customer address - zip code.
|
|
58
|
+
*/
|
|
59
|
+
zipCode?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Two-letter country code, compliant with the ISO 3166 standard.
|
|
62
|
+
*/
|
|
63
|
+
countryCode?: string;
|
|
64
|
+
/**
|
|
65
|
+
* A list of addresses used in the cart. The list contains one `BILLING` and one `SHIPPING` address `type`.
|
|
66
|
+
* If one of the address `types` is not provided in the request, it is automatically populated in the following order:
|
|
67
|
+
* * If the cart has a legal entity, it gets the first location of the legal entity that has both `country` and `zipCode`, and matches the required `type` - then the address has origin=`LEGAL_ENTITY`.
|
|
68
|
+
* * Otherwise, if the cart has a logged-in customer, it finds the `default` address that has both `country` and `zipCode`, and matches the required `type`. If there is no matching default address with the required information, it uses the first customer address that meets the criteria. The address has origin=`CUSTOMER`.
|
|
69
|
+
* * Otherwise, the cart uses the site homebase address. Then the address has origin=`SITE`.
|
|
70
|
+
* These addresses are used in the tax country code determination [How to determine a tax country at cart level](https://developer.emporix.io/api-references/api-guides/checkout/cart/cart#how-to-determine-a-tax-country-at-cart-level) and shipping cost calculation [How to calculate shipping cost at cart level](https://developer.emporix.io/api-references/api-guides/checkout/cart/cart#how-to-calculate-shipping-cost-at-cart-level).
|
|
71
|
+
*/
|
|
72
|
+
addresses?: Array<AddressResponse>;
|
|
73
|
+
channel?: Channel;
|
|
74
|
+
calculatedPrice?: CartCalculatedPrice;
|
|
75
|
+
/**
|
|
76
|
+
* Discounts applied to the cart.
|
|
77
|
+
*/
|
|
78
|
+
discounts?: Array<DiscountResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* External discounts that should be applied to this cart. Requires the `cart.cart_manage_external_prices` scope.
|
|
81
|
+
*/
|
|
82
|
+
externalDiscounts?: Array<ExternalCartDiscount>;
|
|
83
|
+
/**
|
|
84
|
+
* Total number of items added to the cart.
|
|
85
|
+
*/
|
|
86
|
+
totalUnitsCount?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Customer unique session identifier.
|
|
89
|
+
*/
|
|
90
|
+
sessionId?: string;
|
|
91
|
+
metadata?: MetadataResponse;
|
|
92
|
+
totalTax?: Price;
|
|
93
|
+
/**
|
|
94
|
+
* Information about the applied tax.
|
|
95
|
+
*/
|
|
96
|
+
taxDescription?: string;
|
|
97
|
+
mixins?: {
|
|
98
|
+
[key: string]: unknown;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Time needed to prepare the products for the delivery, expressed in hours. Time is calculated based on the products added to the cart. It is equal to the maximum lead time of all the products - `mixins.productCustomAttributes.leadTime`.
|
|
102
|
+
*/
|
|
103
|
+
leadTime?: number;
|
|
104
|
+
/**
|
|
105
|
+
* List of days on which the products cannot be delivered. Days are presented by numbers where Monday is `0`, Tuesday is `1` etc. `nonDelivery` list is the union of all `mixins.productCustomAttributes.nonDelivery` products values.
|
|
106
|
+
*/
|
|
107
|
+
nonDelivery?: Array<string>;
|
|
108
|
+
};
|
|
109
|
+
type Cart$1 = BaseCart & {
|
|
110
|
+
/**
|
|
111
|
+
* Items added to the cart.
|
|
112
|
+
*/
|
|
113
|
+
items?: Array<CartItemResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* Delivery window unique identifier, as defined in the Shipping Service.
|
|
116
|
+
*
|
|
117
|
+
* ***NOTE***
|
|
118
|
+
* This attribute is deprecated. Please use the `deliveryWindow` attribute.
|
|
119
|
+
* @deprecated
|
|
120
|
+
*/
|
|
121
|
+
deliveryWindowId?: string;
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated
|
|
124
|
+
*/
|
|
125
|
+
feeYrnAggregate?: FeeAggregate & {
|
|
126
|
+
[key: string]: unknown;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated
|
|
130
|
+
*/
|
|
131
|
+
totalPrice?: Price & {
|
|
132
|
+
[key: string]: unknown;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* @deprecated
|
|
136
|
+
*/
|
|
137
|
+
subTotalPrice?: Price & {
|
|
138
|
+
[key: string]: unknown;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* @deprecated
|
|
142
|
+
*/
|
|
143
|
+
shipping?: Shipping & {
|
|
144
|
+
[key: string]: unknown;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* @deprecated
|
|
148
|
+
*/
|
|
149
|
+
taxAggregate?: TaxAggregate & {
|
|
150
|
+
[key: string]: unknown;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated
|
|
154
|
+
*/
|
|
155
|
+
subtotalAggregate?: SubtotalAggregate & {
|
|
156
|
+
[key: string]: unknown;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* @deprecated
|
|
160
|
+
*/
|
|
161
|
+
totalDiscount?: Price & {
|
|
162
|
+
[key: string]: unknown;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* @deprecated
|
|
166
|
+
*/
|
|
167
|
+
itemFeesTotal?: Total & {
|
|
168
|
+
[key: string]: unknown;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* @deprecated
|
|
172
|
+
*/
|
|
173
|
+
paymentFeesTotal?: Total & {
|
|
174
|
+
[key: string]: unknown;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* @deprecated
|
|
178
|
+
*/
|
|
179
|
+
totalAuthorizedAmount?: Price & {
|
|
180
|
+
[key: string]: unknown;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
type CartItemRequest = {
|
|
184
|
+
/**
|
|
185
|
+
* Cart item's unique identifier.
|
|
186
|
+
*/
|
|
187
|
+
id?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Indicates that products are maintained as individual entries in the cart, rather than being consolidated. When identical products are added multiple times, each addition creates a new line item instead of increasing the quantity of an existing one.
|
|
190
|
+
*/
|
|
191
|
+
keepAsSeparateLineItem?: boolean;
|
|
192
|
+
product?: Product & {
|
|
193
|
+
[key: string]: unknown;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* A unique identifier of a global resource, which stores information about the resource, such as its type, ID or name of the tenant. This field should not be provided when itemType is EXTERNAL and request contains external product.
|
|
197
|
+
*/
|
|
198
|
+
itemYrn?: string;
|
|
199
|
+
externalFees?: Array<ExternalFee>;
|
|
200
|
+
/**
|
|
201
|
+
* External discounts that should be applied to this cart item. Requires `cart.cart_manage_external_prices` scope
|
|
202
|
+
*/
|
|
203
|
+
externalDiscounts?: Array<ExternalDiscount>;
|
|
204
|
+
itemType?: ItemType & {
|
|
205
|
+
[key: string]: unknown;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Tax code. Tax indicated in this field overrides the site's default tax value.
|
|
209
|
+
*/
|
|
210
|
+
taxCode?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Quantity of the product added to cart.
|
|
213
|
+
*/
|
|
214
|
+
quantity: number;
|
|
215
|
+
price: PriceRowItem;
|
|
216
|
+
tax?: TaxValue & {
|
|
217
|
+
[key: string]: unknown;
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Externally calculated total line price (`unit price × quantity`). When provided, this overrides internal calculations.
|
|
221
|
+
*/
|
|
222
|
+
linePrice?: {
|
|
223
|
+
effectiveAmount: number;
|
|
224
|
+
originalAmount: number;
|
|
225
|
+
currency: string;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Externally calculated total tax for the item line. Only allowed when `itemType = EXTERNAL`.
|
|
229
|
+
*/
|
|
230
|
+
lineTax?: TaxValue & {
|
|
231
|
+
[key: string]: unknown;
|
|
232
|
+
};
|
|
233
|
+
metadata?: MetadataRequest;
|
|
234
|
+
mixins?: {
|
|
235
|
+
[key: string]: unknown;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Deprecated, use product `weightDependent` attribute that is stored in the database.
|
|
239
|
+
* If set to `true`, the storefront displays a hint that the total price of the product may vary depending on the product’s actual weight.
|
|
240
|
+
*
|
|
241
|
+
* @deprecated
|
|
242
|
+
*/
|
|
243
|
+
weightDependent?: boolean;
|
|
244
|
+
};
|
|
245
|
+
type CouponDiscount = {
|
|
246
|
+
/**
|
|
247
|
+
* ID of coupon.
|
|
248
|
+
*/
|
|
249
|
+
couponId?: string;
|
|
250
|
+
/**
|
|
251
|
+
* Absolute value indicating how much given coupon lowered the price of given item.
|
|
252
|
+
*/
|
|
253
|
+
value?: number;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Collection of couponId-value pairs indicating how much particular coupon lowered absolute price of given item. Coupons of FREE_SHIPPING discount type are not taken into account.
|
|
257
|
+
*/
|
|
258
|
+
type CouponDiscounts = Array<CouponDiscount>;
|
|
259
|
+
/**
|
|
260
|
+
* Localized value which can have different structure which depends on provided `Content-Language` header.
|
|
261
|
+
*/
|
|
262
|
+
type LocalizedValue = string | {
|
|
263
|
+
[key: string]: string;
|
|
264
|
+
};
|
|
265
|
+
type ExternalFee = {
|
|
266
|
+
/**
|
|
267
|
+
* Unique identifier of the fee.
|
|
268
|
+
*/
|
|
269
|
+
id?: string;
|
|
270
|
+
name?: LocalizedValue & {
|
|
271
|
+
[key: string]: unknown;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Unique identifier of the fee.
|
|
275
|
+
*/
|
|
276
|
+
yrn?: string;
|
|
277
|
+
/**
|
|
278
|
+
* Type of the fee.
|
|
279
|
+
*/
|
|
280
|
+
feeType: 'PERCENT' | 'ABSOLUTE' | 'ABSOLUTE_MULTIPLY_ITEMQUANTITY';
|
|
281
|
+
/**
|
|
282
|
+
* Value of fee as percentage. It must be provided when feeType equals `PERCENT`.
|
|
283
|
+
*/
|
|
284
|
+
feePercentage?: number;
|
|
285
|
+
/**
|
|
286
|
+
* Value of fee as absolute. It must be provided when feeType equals `ABSOLUTE` or `ABSOLUTE_MULTIPLY_ITEMQUANTITY`.
|
|
287
|
+
*/
|
|
288
|
+
feeAbsolute?: {
|
|
289
|
+
/**
|
|
290
|
+
* Currency of fee absolute.
|
|
291
|
+
*/
|
|
292
|
+
currency: string;
|
|
293
|
+
/**
|
|
294
|
+
* Value of fee absolute.
|
|
295
|
+
*/
|
|
296
|
+
amount: number;
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Whether tax should be included to the fee or not.
|
|
300
|
+
*/
|
|
301
|
+
taxable?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Tax code of the fee.
|
|
304
|
+
*/
|
|
305
|
+
taxCode?: string;
|
|
306
|
+
taxValues?: Array<{
|
|
307
|
+
/**
|
|
308
|
+
* Name of the tax.
|
|
309
|
+
*/
|
|
310
|
+
name?: string;
|
|
311
|
+
/**
|
|
312
|
+
* Rate of the tax.
|
|
313
|
+
*/
|
|
314
|
+
rate?: number;
|
|
315
|
+
/**
|
|
316
|
+
* The taxable amount.
|
|
317
|
+
*/
|
|
318
|
+
taxable?: number;
|
|
319
|
+
value?: {
|
|
320
|
+
/**
|
|
321
|
+
* Currency of the tax.
|
|
322
|
+
*/
|
|
323
|
+
currency?: string;
|
|
324
|
+
/**
|
|
325
|
+
* Value of the tax.
|
|
326
|
+
*/
|
|
327
|
+
amount?: number;
|
|
328
|
+
};
|
|
329
|
+
}>;
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* Type of the external discount.
|
|
333
|
+
*/
|
|
334
|
+
type ExternalDiscountType = 'PERCENT' | 'ABSOLUTE';
|
|
335
|
+
/**
|
|
336
|
+
* External discount that can be applied to cart items.
|
|
337
|
+
*/
|
|
338
|
+
type ExternalDiscount = {
|
|
339
|
+
/**
|
|
340
|
+
* Unique identifier of the external discount.
|
|
341
|
+
*/
|
|
342
|
+
id: string;
|
|
343
|
+
discountType: ExternalDiscountType;
|
|
344
|
+
/**
|
|
345
|
+
* Value of the discount (percentage e.g 15.00 -> 15% or absolute amount e.g 10.00 -> 10 EUR depending on the discountType).
|
|
346
|
+
*/
|
|
347
|
+
value: number;
|
|
348
|
+
/**
|
|
349
|
+
* Flag indicating whether the discount should be also applied to fees.
|
|
350
|
+
*/
|
|
351
|
+
includeFees?: boolean;
|
|
352
|
+
/**
|
|
353
|
+
* Sequence number determining the order in which discounts are applied. The lowest sequence number is applied first.
|
|
354
|
+
*/
|
|
355
|
+
sequence?: number;
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* External discount that can be applied to cart items.
|
|
359
|
+
*/
|
|
360
|
+
type ExternalCartDiscount = {
|
|
361
|
+
/**
|
|
362
|
+
* Unique identifier of the external discount.
|
|
363
|
+
*/
|
|
364
|
+
id: string;
|
|
365
|
+
/**
|
|
366
|
+
* Indicates the type of discount applied:
|
|
367
|
+
* * `PERCENT` — a percentage-based discount
|
|
368
|
+
* * `ABSOLUTE` — a fixed monetary amount
|
|
369
|
+
* * `FREE_SHIPPING` — shipping is fully discounted
|
|
370
|
+
*/
|
|
371
|
+
discountType: 'PERCENT' | 'ABSOLUTE' | 'FREE_SHIPPING';
|
|
372
|
+
/**
|
|
373
|
+
* Value of the discount (percentage e.g 15.00 -> 15% or absolute amount e.g 10.00 -> 10 EUR depending on the discountType).
|
|
374
|
+
*/
|
|
375
|
+
value: number;
|
|
376
|
+
/**
|
|
377
|
+
* Determines whether the discount is applied to the total or subtotal value of the order.
|
|
378
|
+
* * `TOTAL` - discount is spread across products with product fees and shipping cost.
|
|
379
|
+
* * `SUBTOTAL` - discount is spread across products without fees
|
|
380
|
+
*/
|
|
381
|
+
discountCalculationType?: 'TOTAL' | 'SUBTOTAL';
|
|
382
|
+
/**
|
|
383
|
+
* Sequence number determining the order in which discounts are applied. The lowest sequence number is applied first.
|
|
384
|
+
*/
|
|
385
|
+
sequence?: number;
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Cart item details.
|
|
389
|
+
*/
|
|
390
|
+
type BaseCartItemResponse = {
|
|
391
|
+
/**
|
|
392
|
+
* Cart item's unique identifier generated when the item is added to cart.
|
|
393
|
+
*/
|
|
394
|
+
id?: string;
|
|
395
|
+
/**
|
|
396
|
+
* Indicates that products are maintained as individual entries in the cart, rather than being consolidated. When identical products are added multiple times, each addition creates a new line item instead of increasing the quantity of an existing one.
|
|
397
|
+
*/
|
|
398
|
+
keepAsSeparateLineItem?: boolean;
|
|
399
|
+
yrn?: Yrn;
|
|
400
|
+
product?: CartItemResponseProduct;
|
|
401
|
+
itemYrn?: Yrn;
|
|
402
|
+
type?: ItemType;
|
|
403
|
+
/**
|
|
404
|
+
* Quantity of the product added to cart.
|
|
405
|
+
*/
|
|
406
|
+
quantity: number;
|
|
407
|
+
/**
|
|
408
|
+
* Effective quantity of the product added to cart.
|
|
409
|
+
*/
|
|
410
|
+
effectiveQuantity: number;
|
|
411
|
+
calculatedPrice?: ItemCalculatedPrice;
|
|
412
|
+
/**
|
|
413
|
+
* Tax code. Tax indicated in this field overrides the site's default tax value.
|
|
414
|
+
*/
|
|
415
|
+
taxCode?: string;
|
|
416
|
+
unitPrice?: CalculatedPrice & {
|
|
417
|
+
[key: string]: unknown;
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* Product total tax amount.
|
|
421
|
+
*/
|
|
422
|
+
totalTax?: number;
|
|
423
|
+
metadata?: MetadataRequest;
|
|
424
|
+
mixins?: {
|
|
425
|
+
[key: string]: unknown;
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* External discounts applied to this cart item.
|
|
429
|
+
*/
|
|
430
|
+
externalDiscounts?: Array<ExternalDiscount>;
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* Cart item details.
|
|
434
|
+
*/
|
|
435
|
+
type CartItemResponse = BaseCartItemResponse & {
|
|
436
|
+
/**
|
|
437
|
+
* @deprecated
|
|
438
|
+
*/
|
|
439
|
+
price?: PriceRow & {
|
|
440
|
+
[key: string]: unknown;
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* Externally calculated total line price (`unit price × quantity`). When provided, this overrides internal calculations.
|
|
444
|
+
*/
|
|
445
|
+
linePrice?: {
|
|
446
|
+
effectiveAmount: number;
|
|
447
|
+
originalAmount: number;
|
|
448
|
+
currency: string;
|
|
449
|
+
};
|
|
450
|
+
/**
|
|
451
|
+
* Externally calculated total tax for the item line. Only allowed when `itemType = EXTERNAL`.
|
|
452
|
+
*/
|
|
453
|
+
lineTax?: TaxValueWithQuantity;
|
|
454
|
+
/**
|
|
455
|
+
* @deprecated
|
|
456
|
+
*/
|
|
457
|
+
couponDiscounts?: CouponDiscounts & {
|
|
458
|
+
[key: string]: unknown;
|
|
459
|
+
};
|
|
460
|
+
/**
|
|
461
|
+
* @deprecated
|
|
462
|
+
*/
|
|
463
|
+
itemPrice?: Price & {
|
|
464
|
+
[key: string]: unknown;
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* **This field is deprecated**. Please use `calculatedPrice.price` instead.
|
|
468
|
+
* @deprecated
|
|
469
|
+
*/
|
|
470
|
+
itemTaxInfo?: Array<TaxValue>;
|
|
471
|
+
/**
|
|
472
|
+
* @deprecated
|
|
473
|
+
*/
|
|
474
|
+
fees?: FeeAggregate & {
|
|
475
|
+
[key: string]: unknown;
|
|
476
|
+
};
|
|
477
|
+
/**
|
|
478
|
+
* @deprecated
|
|
479
|
+
*/
|
|
480
|
+
authorizedAmount?: Price & {
|
|
481
|
+
[key: string]: unknown;
|
|
482
|
+
};
|
|
483
|
+
/**
|
|
484
|
+
* @deprecated
|
|
485
|
+
*/
|
|
486
|
+
totalDiscount?: Price & {
|
|
487
|
+
[key: string]: unknown;
|
|
488
|
+
};
|
|
489
|
+
/**
|
|
490
|
+
* **This field is deprecated**. Please use `calculatedPrice.fees` instead. A fee has an enum value that allows to distinguish external prices
|
|
491
|
+
* @deprecated
|
|
492
|
+
*/
|
|
493
|
+
externalFees?: Array<ExternalFee>;
|
|
494
|
+
};
|
|
495
|
+
/**
|
|
496
|
+
* Channel through which the cart was created.
|
|
497
|
+
*/
|
|
498
|
+
type Channel = {
|
|
499
|
+
name?: string;
|
|
500
|
+
source?: string;
|
|
501
|
+
};
|
|
502
|
+
type CreateCart = {
|
|
503
|
+
/**
|
|
504
|
+
* Customer unique identifier generated when a customer account is created through the Customer Service.
|
|
505
|
+
*/
|
|
506
|
+
customerId?: string;
|
|
507
|
+
restriction?: Restriction;
|
|
508
|
+
/**
|
|
509
|
+
* Three-letter currency code, compliant with the ISO 4217 standard.
|
|
510
|
+
*/
|
|
511
|
+
currency: string;
|
|
512
|
+
/**
|
|
513
|
+
* ID of the legal entity to which customer is assigned.
|
|
514
|
+
*/
|
|
515
|
+
legalEntityId?: string;
|
|
516
|
+
/**
|
|
517
|
+
* Delivery window unique identifier, as defined in the Shipping Service.
|
|
518
|
+
*/
|
|
519
|
+
deliveryWindowId?: string;
|
|
520
|
+
deliveryWindow?: DeliveryWindow;
|
|
521
|
+
/**
|
|
522
|
+
* Site unique identifier. A site is a specific shop.
|
|
523
|
+
*
|
|
524
|
+
* If the tenant owns only one shop, the value should be set to `main`.
|
|
525
|
+
*/
|
|
526
|
+
siteCode?: string;
|
|
527
|
+
/**
|
|
528
|
+
* Cart type. You can use this field if your store offers different types of carts, such as shopping carts and wishlists.
|
|
529
|
+
*/
|
|
530
|
+
type?: string;
|
|
531
|
+
channel?: Channel;
|
|
532
|
+
/**
|
|
533
|
+
* List of addresses that should be associated with the cart and used for tax determination and shipping cost. There can be one address of type `BILLING` and one of type `SHIPPING` - others are ignored. These addresses are returned with the origin `REQUEST` in the cart response.
|
|
534
|
+
*/
|
|
535
|
+
addresses?: Array<AddressRequest>;
|
|
536
|
+
metadata?: MetadataRequest;
|
|
537
|
+
mixins?: {
|
|
538
|
+
[key: string]: unknown;
|
|
539
|
+
};
|
|
540
|
+
/**
|
|
541
|
+
* If set to `true`, endpoints validate whether the `session-id` used to create the cart matches the `session-id` passed in the request header.
|
|
542
|
+
*
|
|
543
|
+
* **Note**: The `sessionValidated` parameter only applies to anonymous customer carts.
|
|
544
|
+
*/
|
|
545
|
+
sessionValidated?: boolean;
|
|
546
|
+
};
|
|
547
|
+
type DeliveryWindow = {
|
|
548
|
+
/**
|
|
549
|
+
* ID of the delivery window.
|
|
550
|
+
*/
|
|
551
|
+
id?: string;
|
|
552
|
+
/**
|
|
553
|
+
* ID of the delivery time slot.
|
|
554
|
+
*/
|
|
555
|
+
slotId?: string;
|
|
556
|
+
/**
|
|
557
|
+
* Delivery date. It has to be of "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" format.
|
|
558
|
+
*/
|
|
559
|
+
deliveryDate?: string;
|
|
560
|
+
};
|
|
561
|
+
/**
|
|
562
|
+
* Information about the cart address that can be provided in the request.
|
|
563
|
+
*/
|
|
564
|
+
type AddressRequest = {
|
|
565
|
+
/**
|
|
566
|
+
* Contact name.
|
|
567
|
+
*/
|
|
568
|
+
contactName?: string;
|
|
569
|
+
/**
|
|
570
|
+
* Company name.
|
|
571
|
+
*/
|
|
572
|
+
companyName?: string;
|
|
573
|
+
/**
|
|
574
|
+
* Street.
|
|
575
|
+
*/
|
|
576
|
+
street?: string;
|
|
577
|
+
/**
|
|
578
|
+
* Street number.
|
|
579
|
+
*/
|
|
580
|
+
streetNumber?: string;
|
|
581
|
+
/**
|
|
582
|
+
* Street appendix.
|
|
583
|
+
*/
|
|
584
|
+
streetAppendix?: string;
|
|
585
|
+
/**
|
|
586
|
+
* Zip code.
|
|
587
|
+
*/
|
|
588
|
+
zipCode?: string;
|
|
589
|
+
/**
|
|
590
|
+
* City.
|
|
591
|
+
*/
|
|
592
|
+
city?: string;
|
|
593
|
+
/**
|
|
594
|
+
* Country.
|
|
595
|
+
*/
|
|
596
|
+
country?: string;
|
|
597
|
+
/**
|
|
598
|
+
* State.
|
|
599
|
+
*/
|
|
600
|
+
state?: string;
|
|
601
|
+
/**
|
|
602
|
+
* Contact phone.
|
|
603
|
+
*/
|
|
604
|
+
contactPhone?: string;
|
|
605
|
+
/**
|
|
606
|
+
* Type of the address data
|
|
607
|
+
*/
|
|
608
|
+
type?: 'BILLING' | 'SHIPPING';
|
|
609
|
+
metadata?: MetadataRequest;
|
|
610
|
+
/**
|
|
611
|
+
* Mixins object.
|
|
612
|
+
*/
|
|
613
|
+
mixins?: {
|
|
614
|
+
[key: string]: unknown;
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
/**
|
|
618
|
+
* Information about the carts address used for shipping and tax determination.
|
|
619
|
+
*/
|
|
620
|
+
type AddressResponse = {
|
|
621
|
+
/**
|
|
622
|
+
* Holds information about the origin of the address. Possible values:
|
|
623
|
+
* * `REQUEST` - provided in create/update cart request
|
|
624
|
+
* * `LEGAL_ENTITY` - automatically populated from from cart's legal entity location
|
|
625
|
+
* * `CUSTOMER` - automatically populated from fetched from customer addresses
|
|
626
|
+
* * `SITE` - automatically populated from sites base address
|
|
627
|
+
*/
|
|
628
|
+
origin?: 'REQUEST' | 'LEGAL_ENTITY' | 'CUSTOMER' | 'SITE';
|
|
629
|
+
/**
|
|
630
|
+
* Site unique identifier. A site is a specific shop.
|
|
631
|
+
*/
|
|
632
|
+
siteCode?: string;
|
|
633
|
+
/**
|
|
634
|
+
* ID of the legal entity to which customer is assigned.
|
|
635
|
+
*/
|
|
636
|
+
legalEntityId?: string;
|
|
637
|
+
/**
|
|
638
|
+
* ID of the legal entity location.
|
|
639
|
+
*/
|
|
640
|
+
legalEntityLocationId?: string;
|
|
641
|
+
/**
|
|
642
|
+
* ID of the customer address.
|
|
643
|
+
*/
|
|
644
|
+
customerAddressId?: string;
|
|
645
|
+
/**
|
|
646
|
+
* Contact name.
|
|
647
|
+
*/
|
|
648
|
+
contactName?: string;
|
|
649
|
+
/**
|
|
650
|
+
* Company name.
|
|
651
|
+
*/
|
|
652
|
+
companyName?: string;
|
|
653
|
+
/**
|
|
654
|
+
* Street.
|
|
655
|
+
*/
|
|
656
|
+
street?: string;
|
|
657
|
+
/**
|
|
658
|
+
* Street number.
|
|
659
|
+
*/
|
|
660
|
+
streetNumber?: string;
|
|
661
|
+
/**
|
|
662
|
+
* Street appendix.
|
|
663
|
+
*/
|
|
664
|
+
streetAppendix?: string;
|
|
665
|
+
/**
|
|
666
|
+
* Zip code.
|
|
667
|
+
*/
|
|
668
|
+
zipCode?: string;
|
|
669
|
+
/**
|
|
670
|
+
* City.
|
|
671
|
+
*/
|
|
672
|
+
city?: string;
|
|
673
|
+
/**
|
|
674
|
+
* Country.
|
|
675
|
+
*/
|
|
676
|
+
country?: string;
|
|
677
|
+
/**
|
|
678
|
+
* State.
|
|
679
|
+
*/
|
|
680
|
+
state?: string;
|
|
681
|
+
/**
|
|
682
|
+
* Contact phone.
|
|
683
|
+
*/
|
|
684
|
+
contactPhone?: string;
|
|
685
|
+
/**
|
|
686
|
+
* Type of the address data.
|
|
687
|
+
*/
|
|
688
|
+
type?: 'BILLING' | 'SHIPPING';
|
|
689
|
+
metadata?: MetadataRequest;
|
|
690
|
+
/**
|
|
691
|
+
* Mixins object
|
|
692
|
+
*/
|
|
693
|
+
mixins?: {
|
|
694
|
+
[key: string]: unknown;
|
|
695
|
+
};
|
|
696
|
+
};
|
|
697
|
+
type CreatedCart = {
|
|
698
|
+
/**
|
|
699
|
+
* Cart unique identifier.
|
|
700
|
+
*/
|
|
701
|
+
cartId: string;
|
|
702
|
+
yrn: Yrn;
|
|
703
|
+
};
|
|
704
|
+
/**
|
|
705
|
+
* Discount details.
|
|
706
|
+
*/
|
|
707
|
+
type DiscountResponse = {
|
|
708
|
+
/**
|
|
709
|
+
* Discount's unique identifier.
|
|
710
|
+
*/
|
|
711
|
+
id?: string;
|
|
712
|
+
yrn?: Yrn;
|
|
713
|
+
couponYrn?: Yrn;
|
|
714
|
+
/**
|
|
715
|
+
* Discount code generated when a discount coupon is created through the Coupon Service.
|
|
716
|
+
*/
|
|
717
|
+
code: string;
|
|
718
|
+
/**
|
|
719
|
+
* Discount expressed as fixed amount.
|
|
720
|
+
*/
|
|
721
|
+
amount?: number;
|
|
722
|
+
/**
|
|
723
|
+
* Three-letter currency code, compliant with the ISO 4217 standard.
|
|
724
|
+
*/
|
|
725
|
+
currency?: string;
|
|
726
|
+
/**
|
|
727
|
+
* Discount expressed as a percentage of the price.
|
|
728
|
+
*/
|
|
729
|
+
discountRate?: number;
|
|
730
|
+
/**
|
|
731
|
+
* Discount's displayed name.
|
|
732
|
+
*/
|
|
733
|
+
name?: string;
|
|
734
|
+
/**
|
|
735
|
+
* Calculation type specifies how the discount should be calculated. Can be set to one of the following:
|
|
736
|
+
* * `ApplyDiscountBeforeTax`
|
|
737
|
+
* * `ApplyDiscountAfterTax`
|
|
738
|
+
*/
|
|
739
|
+
calculationType?: 'ApplyDiscountBeforeTax' | 'ApplyDiscountAfterTax';
|
|
740
|
+
/**
|
|
741
|
+
* Determines whether the coupon is applied to the total or subtotal value of the order.
|
|
742
|
+
*/
|
|
743
|
+
discountCalculationType?: 'SUBTOTAL' | 'TOTAL';
|
|
744
|
+
/**
|
|
745
|
+
* Flag indicating whether the discount is valid.
|
|
746
|
+
* Invalid discounts are not taken into account when the cart is calculated.
|
|
747
|
+
*/
|
|
748
|
+
valid?: boolean;
|
|
749
|
+
/**
|
|
750
|
+
* Links to Coupon Service endpoints used to validate and redeem the discount.
|
|
751
|
+
*/
|
|
752
|
+
links?: Array<Link>;
|
|
753
|
+
discountValidationDetails?: DiscountValidationDetails;
|
|
754
|
+
/**
|
|
755
|
+
* The index of the discount. It represents the discount position in the cart discounts array.
|
|
756
|
+
*/
|
|
757
|
+
discountIndex?: number;
|
|
758
|
+
};
|
|
759
|
+
type DiscountValidationDetails = {
|
|
760
|
+
message?: string;
|
|
761
|
+
details?: Array<string>;
|
|
762
|
+
};
|
|
763
|
+
type Fee = {
|
|
764
|
+
yrn?: Yrn;
|
|
765
|
+
name?: LocalizedValue;
|
|
766
|
+
taxCode?: string;
|
|
767
|
+
amount: number;
|
|
768
|
+
totalTax: number;
|
|
769
|
+
total: Total;
|
|
770
|
+
taxValues?: Array<TaxValue>;
|
|
771
|
+
};
|
|
772
|
+
type FeeAggregate = {
|
|
773
|
+
elements?: Array<Fee>;
|
|
774
|
+
total?: Total;
|
|
775
|
+
};
|
|
776
|
+
type Link = {
|
|
777
|
+
/**
|
|
778
|
+
* Action to be done using the endpoint provided in the `href` field.
|
|
779
|
+
*/
|
|
780
|
+
rel: 'validate' | 'redeem';
|
|
781
|
+
/**
|
|
782
|
+
* Detailed link description.
|
|
783
|
+
*/
|
|
784
|
+
title?: string;
|
|
785
|
+
/**
|
|
786
|
+
* Endpoint used to validate or redeem the discount.
|
|
787
|
+
*/
|
|
788
|
+
href: string;
|
|
789
|
+
/**
|
|
790
|
+
* Content type.
|
|
791
|
+
*/
|
|
792
|
+
type: string;
|
|
793
|
+
};
|
|
794
|
+
/**
|
|
795
|
+
* Information about the unit by which the customer can order the product.
|
|
796
|
+
*/
|
|
797
|
+
type MeasurementUnit = {
|
|
798
|
+
/**
|
|
799
|
+
* Quantity of the measurement unit.
|
|
800
|
+
*
|
|
801
|
+
* For example, if the customer can order a product by one piece, the value should be set to `1`.
|
|
802
|
+
*/
|
|
803
|
+
quantity: number;
|
|
804
|
+
/**
|
|
805
|
+
* Code of the measurement unit by which the customer can order the product. The possible values for the `unitCode` field are explained in the table below:
|
|
806
|
+
* | | |
|
|
807
|
+
* | --- | --- |
|
|
808
|
+
* | **Value** | **Measurement unit** |
|
|
809
|
+
* | `H87` | Pieces |
|
|
810
|
+
* | `KGM` | Kilograms |
|
|
811
|
+
* | `GRM` | Grams |
|
|
812
|
+
* | `LTR` | Liters |
|
|
813
|
+
* | `MLT` | Milliliters |
|
|
814
|
+
* | `MTR` | Meters |
|
|
815
|
+
* | `RO` | Rolls |
|
|
816
|
+
*
|
|
817
|
+
* For example, if the customer can order a product by pieces, the value should be set to `H87`.
|
|
818
|
+
*/
|
|
819
|
+
unitCode?: 'kg' | 'g' | 'mg' | 'l' | 'ml' | 'lb' | 'qt' | 'qtr' | 'gal' | 'pt' | 'oz' | 'MTR' | 'XRO' | 'MLT' | 'LTR' | 'H87' | 'KGM' | 'GRM' | 'HLT' | 'DL' | 'DAG' | 'RO';
|
|
820
|
+
};
|
|
821
|
+
type MetadataRequest = {
|
|
822
|
+
/**
|
|
823
|
+
* Links to mixin schemas.
|
|
824
|
+
*/
|
|
825
|
+
mixins?: {
|
|
826
|
+
[key: string]: unknown;
|
|
827
|
+
};
|
|
828
|
+
};
|
|
829
|
+
type MetadataResponse = {
|
|
830
|
+
/**
|
|
831
|
+
* Date and time when the object was created, compliant with the ISO 8601 format.
|
|
832
|
+
*/
|
|
833
|
+
createdAt: string;
|
|
834
|
+
/**
|
|
835
|
+
* Date and time when the object was last modified, compliant with the ISO 8601 format.
|
|
836
|
+
*/
|
|
837
|
+
modifiedAt: string;
|
|
838
|
+
/**
|
|
839
|
+
* Date and time when the object was last calculated, compliant with the ISO 8601 format.
|
|
840
|
+
*/
|
|
841
|
+
calculatedAt?: string;
|
|
842
|
+
version: number;
|
|
843
|
+
mixins?: {
|
|
844
|
+
[key: string]: unknown;
|
|
845
|
+
};
|
|
846
|
+
};
|
|
847
|
+
type Price = {
|
|
848
|
+
/**
|
|
849
|
+
* Price.
|
|
850
|
+
*/
|
|
851
|
+
amount: number;
|
|
852
|
+
/**
|
|
853
|
+
* Three-letter currency code, compliant with the ISO 4217 standard.
|
|
854
|
+
*/
|
|
855
|
+
currency: string;
|
|
856
|
+
};
|
|
857
|
+
/**
|
|
858
|
+
* Price details.
|
|
859
|
+
*/
|
|
860
|
+
type PriceRow = {
|
|
861
|
+
/**
|
|
862
|
+
* Price’s unique identifier generated when the price is created through the Price Service.
|
|
863
|
+
*/
|
|
864
|
+
priceId: string;
|
|
865
|
+
/**
|
|
866
|
+
* Identifier of price list. The field is populated only in case when the returned prices belongs to any price list.
|
|
867
|
+
*/
|
|
868
|
+
priceListId?: string;
|
|
869
|
+
yrn?: Yrn;
|
|
870
|
+
/**
|
|
871
|
+
* Product’s regular price per specified `measurementUnit`.
|
|
872
|
+
*/
|
|
873
|
+
originalAmount: number;
|
|
874
|
+
/**
|
|
875
|
+
* Actual amount the customer will pay per specified `measurementUnit`.
|
|
876
|
+
*/
|
|
877
|
+
effectiveAmount: number;
|
|
878
|
+
/**
|
|
879
|
+
* Three-letter currency code, compliant with the ISO 4217 standard.
|
|
880
|
+
*/
|
|
881
|
+
currency: string;
|
|
882
|
+
measurementUnit?: MeasurementUnit;
|
|
883
|
+
};
|
|
884
|
+
/**
|
|
885
|
+
* Price details.
|
|
886
|
+
*/
|
|
887
|
+
type PriceRowItem = {
|
|
888
|
+
/**
|
|
889
|
+
* Price’s unique identifier generated when the price is created through the Price Service. This field should not be provided when itemType is EXTERNAL.
|
|
890
|
+
*/
|
|
891
|
+
priceId: string;
|
|
892
|
+
yrn?: Yrn;
|
|
893
|
+
/**
|
|
894
|
+
* Product’s regular price per specified `measurementUnit`. Property can be made optional by setting `cartItemValidationSkipOriginalAmount` configuration to `true` in the configuration-service. In that case, the value is fetched from `priceId`.
|
|
895
|
+
*/
|
|
896
|
+
originalAmount: number;
|
|
897
|
+
/**
|
|
898
|
+
* Actual amount the customer will pay per specified `measurementUnit`. Property can be made optional by setting `cartItemValidationSkipEffectiveAmount` configuration to `true` in the configuration-service. In that case, the value is fetched from `priceId`.
|
|
899
|
+
*/
|
|
900
|
+
effectiveAmount: number;
|
|
901
|
+
/**
|
|
902
|
+
* Three-letter currency code, compliant with the ISO 4217 standard. Property can be made optional by setting `cartItemValidationSkipCurrency` configuration to `true` in the configuration-service. In that case, the value is fetched from cart currency.
|
|
903
|
+
*/
|
|
904
|
+
currency: string;
|
|
905
|
+
measurementUnit?: MeasurementUnit;
|
|
906
|
+
};
|
|
907
|
+
/**
|
|
908
|
+
* Product details.
|
|
909
|
+
*/
|
|
910
|
+
type Product = {
|
|
911
|
+
/**
|
|
912
|
+
* Product’s unique identifier. This field should be provided when itemType is EXTERNAl and request contains external product.
|
|
913
|
+
*/
|
|
914
|
+
id?: string;
|
|
915
|
+
/**
|
|
916
|
+
* Product Stock Keeping Unit (SKU).
|
|
917
|
+
*/
|
|
918
|
+
sku?: string;
|
|
919
|
+
/**
|
|
920
|
+
* Product code.
|
|
921
|
+
*/
|
|
922
|
+
code?: string;
|
|
923
|
+
yrn?: Yrn;
|
|
924
|
+
/**
|
|
925
|
+
* Product name.
|
|
926
|
+
*/
|
|
927
|
+
name?: string;
|
|
928
|
+
/**
|
|
929
|
+
* A product name represented as a map, with language as the key and the corresponding translated name as the value
|
|
930
|
+
*/
|
|
931
|
+
localizedName?: {
|
|
932
|
+
[key: string]: string;
|
|
933
|
+
};
|
|
934
|
+
/**
|
|
935
|
+
* Product description.
|
|
936
|
+
*/
|
|
937
|
+
description?: string;
|
|
938
|
+
/**
|
|
939
|
+
* List of product images.
|
|
940
|
+
*/
|
|
941
|
+
images?: Array<ProductImage>;
|
|
942
|
+
metadata?: MetadataRequest;
|
|
943
|
+
mixins?: {
|
|
944
|
+
[key: string]: unknown;
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
type CartItemResponseProduct = Product & {
|
|
948
|
+
vendor?: Vendor;
|
|
949
|
+
};
|
|
950
|
+
/**
|
|
951
|
+
* Product vendor information, autopopulated based on product catalog information.
|
|
952
|
+
*/
|
|
953
|
+
type Vendor = {
|
|
954
|
+
/**
|
|
955
|
+
* An identifier of a vendor to whom the product belongs
|
|
956
|
+
*/
|
|
957
|
+
id: string;
|
|
958
|
+
/**
|
|
959
|
+
* vendor name
|
|
960
|
+
*/
|
|
961
|
+
name?: string;
|
|
962
|
+
};
|
|
963
|
+
/**
|
|
964
|
+
* Product image details.
|
|
965
|
+
*/
|
|
966
|
+
type ProductImage = {
|
|
967
|
+
/**
|
|
968
|
+
* Product image''s unique identifier, generated when the image is added through the Product Service.
|
|
969
|
+
*/
|
|
970
|
+
id: string;
|
|
971
|
+
/**
|
|
972
|
+
* Product image's URL with the file extension specified.
|
|
973
|
+
*/
|
|
974
|
+
url: string;
|
|
975
|
+
};
|
|
976
|
+
type SingleBatchResponse = {
|
|
977
|
+
/**
|
|
978
|
+
* Index of the processed cart item, matching the position in the request body.
|
|
979
|
+
*/
|
|
980
|
+
index?: number;
|
|
981
|
+
/**
|
|
982
|
+
* HTTP response status code.
|
|
983
|
+
*/
|
|
984
|
+
status: number;
|
|
985
|
+
/**
|
|
986
|
+
* Cart item's unique identifier.
|
|
987
|
+
*/
|
|
988
|
+
id?: string;
|
|
989
|
+
/**
|
|
990
|
+
* Descriptive error message for debugging purposes.
|
|
991
|
+
*/
|
|
992
|
+
errorMessage?: string;
|
|
993
|
+
headers?: {
|
|
994
|
+
/**
|
|
995
|
+
* Cart item location.
|
|
996
|
+
*/
|
|
997
|
+
location?: string;
|
|
998
|
+
};
|
|
999
|
+
yrn?: Yrn;
|
|
1000
|
+
};
|
|
1001
|
+
/**
|
|
1002
|
+
* Shipping cost information.
|
|
1003
|
+
*/
|
|
1004
|
+
type Shipping = {
|
|
1005
|
+
fee?: Price;
|
|
1006
|
+
total?: Total;
|
|
1007
|
+
};
|
|
1008
|
+
type TaxAggregate = {
|
|
1009
|
+
lines?: Array<TaxAggregateLine>;
|
|
1010
|
+
};
|
|
1011
|
+
type SubtotalAggregate = {
|
|
1012
|
+
currency?: string;
|
|
1013
|
+
netValue?: number;
|
|
1014
|
+
grossValue?: number;
|
|
1015
|
+
taxValue?: number;
|
|
1016
|
+
};
|
|
1017
|
+
type TaxAggregateLine = {
|
|
1018
|
+
/**
|
|
1019
|
+
* The tax name e.g.: CANADA GST/TPS
|
|
1020
|
+
*/
|
|
1021
|
+
name?: string;
|
|
1022
|
+
/**
|
|
1023
|
+
* The tax amount for the line.
|
|
1024
|
+
*/
|
|
1025
|
+
amount?: number;
|
|
1026
|
+
/**
|
|
1027
|
+
* The tax rate is a percentage between 0 and 100, e.g.: 5.00
|
|
1028
|
+
*/
|
|
1029
|
+
rate?: number;
|
|
1030
|
+
/**
|
|
1031
|
+
* The taxable amount.
|
|
1032
|
+
*/
|
|
1033
|
+
taxable?: number;
|
|
1034
|
+
};
|
|
1035
|
+
/**
|
|
1036
|
+
* The tax amount from an external source, requiring either gross amount, net amount, or both to be specified
|
|
1037
|
+
*/
|
|
1038
|
+
type TaxValue = {
|
|
1039
|
+
/**
|
|
1040
|
+
* Tax name. This field is required only when the itemType is set as EXTERNAL and the request contains an external price.
|
|
1041
|
+
*/
|
|
1042
|
+
name?: string;
|
|
1043
|
+
/**
|
|
1044
|
+
* Tax rate based on which the net/gross values can be calculated. This field is required only when the itemType is set as EXTERNAL and the request contains an external price.
|
|
1045
|
+
*/
|
|
1046
|
+
rate?: number;
|
|
1047
|
+
/**
|
|
1048
|
+
* The gross value (amount including tax). If not provided, it's calculated based on the net value and tax rate. If provided then the price effective amount must be equal to it. This field is required only when the itemType is set as EXTERNAL and the request contains an external price.
|
|
1049
|
+
*/
|
|
1050
|
+
grossValue?: number;
|
|
1051
|
+
/**
|
|
1052
|
+
* The net value (amount excluding tax). If not provided, it's calculated based on the gross value and tax rate. If provided then the price effective amount must be equal to it. This field is required only when the itemType is set as EXTERNAL and the request contains an external price.
|
|
1053
|
+
*/
|
|
1054
|
+
netValue?: number;
|
|
1055
|
+
};
|
|
1056
|
+
type TaxValueWithQuantity = TaxValue & {
|
|
1057
|
+
/**
|
|
1058
|
+
* Represents the item quantity for which the external `lineTax` was provided.
|
|
1059
|
+
*/
|
|
1060
|
+
quantity?: number;
|
|
1061
|
+
};
|
|
1062
|
+
type Total = {
|
|
1063
|
+
/**
|
|
1064
|
+
* Subtotal for the products.
|
|
1065
|
+
*/
|
|
1066
|
+
subTotal?: number;
|
|
1067
|
+
/**
|
|
1068
|
+
* Total tax for the products.
|
|
1069
|
+
*/
|
|
1070
|
+
totalTax?: number;
|
|
1071
|
+
/**
|
|
1072
|
+
* Total amount the customer will pay for the products.
|
|
1073
|
+
*/
|
|
1074
|
+
total?: number;
|
|
1075
|
+
/**
|
|
1076
|
+
* Total discount for the products
|
|
1077
|
+
*/
|
|
1078
|
+
discount?: number;
|
|
1079
|
+
};
|
|
1080
|
+
type UpdateCartItem = {
|
|
1081
|
+
externalFees?: Array<ExternalFee>;
|
|
1082
|
+
/**
|
|
1083
|
+
* External discounts applied to this cart item.
|
|
1084
|
+
*/
|
|
1085
|
+
externalDiscounts?: Array<ExternalDiscount>;
|
|
1086
|
+
product?: UpdateProduct;
|
|
1087
|
+
itemYrn?: Yrn;
|
|
1088
|
+
itemType?: ItemType & {
|
|
1089
|
+
[key: string]: unknown;
|
|
1090
|
+
};
|
|
1091
|
+
/**
|
|
1092
|
+
* Quantity of the product added to cart.
|
|
1093
|
+
*/
|
|
1094
|
+
quantity?: number;
|
|
1095
|
+
/**
|
|
1096
|
+
* Tax code. Tax indicated in this field overrides the site's default tax value.
|
|
1097
|
+
*/
|
|
1098
|
+
taxCode?: string;
|
|
1099
|
+
tax?: TaxValue & {
|
|
1100
|
+
[key: string]: unknown;
|
|
1101
|
+
};
|
|
1102
|
+
price?: PriceRowItem;
|
|
1103
|
+
/**
|
|
1104
|
+
* Externally calculated total line price (`unit price × quantity`). When provided, this overrides internal calculations.
|
|
1105
|
+
*/
|
|
1106
|
+
linePrice?: {
|
|
1107
|
+
effectiveAmount: number;
|
|
1108
|
+
originalAmount: number;
|
|
1109
|
+
currency: string;
|
|
1110
|
+
};
|
|
1111
|
+
/**
|
|
1112
|
+
* Externally calculated total tax for the item line. Only allowed when `itemType = EXTERNAL`.
|
|
1113
|
+
*/
|
|
1114
|
+
lineTax?: TaxValue;
|
|
1115
|
+
metadata?: MetadataRequest;
|
|
1116
|
+
mixins?: {
|
|
1117
|
+
[key: string]: unknown;
|
|
1118
|
+
};
|
|
1119
|
+
};
|
|
1120
|
+
type UpdateProduct = {
|
|
1121
|
+
/**
|
|
1122
|
+
* Product code.
|
|
1123
|
+
*/
|
|
1124
|
+
code?: string;
|
|
1125
|
+
/**
|
|
1126
|
+
* Product Stock Keeping Unit (SKU).
|
|
1127
|
+
*/
|
|
1128
|
+
sku?: string;
|
|
1129
|
+
/**
|
|
1130
|
+
* Product description.
|
|
1131
|
+
*/
|
|
1132
|
+
description?: string;
|
|
1133
|
+
/**
|
|
1134
|
+
* Product name.
|
|
1135
|
+
*/
|
|
1136
|
+
name?: string;
|
|
1137
|
+
/**
|
|
1138
|
+
* A product name represented as a map, with language as the key and the corresponding translated name as the value
|
|
1139
|
+
*/
|
|
1140
|
+
localizedName?: {
|
|
1141
|
+
[key: string]: string;
|
|
1142
|
+
};
|
|
1143
|
+
/**
|
|
1144
|
+
* List of product images.
|
|
1145
|
+
*/
|
|
1146
|
+
images?: Array<ProductImage>;
|
|
1147
|
+
metadata?: MetadataRequest;
|
|
1148
|
+
mixins?: {
|
|
1149
|
+
[key: string]: unknown;
|
|
1150
|
+
};
|
|
1151
|
+
};
|
|
1152
|
+
type BatchResponse = Array<SingleBatchResponse>;
|
|
1153
|
+
/**
|
|
1154
|
+
* A unique identifier of a global resource, which stores information about the resource, such as its type, ID or name of the tenant.
|
|
1155
|
+
*/
|
|
1156
|
+
type Yrn = string;
|
|
1157
|
+
type ItemType = 'EXTERNAL' | 'INTERNAL';
|
|
1158
|
+
/**
|
|
1159
|
+
* A price calculation model containing net and gross amounts along with their associated tax details.
|
|
1160
|
+
*/
|
|
1161
|
+
type CalculatedPrice = {
|
|
1162
|
+
/**
|
|
1163
|
+
* Net value of the price, price without tax.
|
|
1164
|
+
*/
|
|
1165
|
+
netValue?: number;
|
|
1166
|
+
/**
|
|
1167
|
+
* Gross value of the price, price with tax.
|
|
1168
|
+
*/
|
|
1169
|
+
grossValue?: number;
|
|
1170
|
+
/**
|
|
1171
|
+
* Tax value of the price, it's the actual amount of tax that has to be paid.
|
|
1172
|
+
*/
|
|
1173
|
+
taxValue?: number;
|
|
1174
|
+
/**
|
|
1175
|
+
* Tax code applied to the price, a tax code is a country's set of tax rules.
|
|
1176
|
+
*/
|
|
1177
|
+
taxCode?: string;
|
|
1178
|
+
/**
|
|
1179
|
+
* Tax rate applied to the price, it's the percentage at which an individual or business is taxed.
|
|
1180
|
+
*/
|
|
1181
|
+
taxRate?: number;
|
|
1182
|
+
};
|
|
1183
|
+
type CalculatedPriceWithDiscounts = CalculatedPrice & {
|
|
1184
|
+
/**
|
|
1185
|
+
* List of applied discounts for the calculated price.
|
|
1186
|
+
*/
|
|
1187
|
+
appliedDiscounts?: Array<CalculatedAppliedDiscount>;
|
|
1188
|
+
};
|
|
1189
|
+
type CalculatedPriceWithTaxAggregate = CalculatedPrice & {
|
|
1190
|
+
taxAggregate?: CalculatedTaxAggregate;
|
|
1191
|
+
};
|
|
1192
|
+
/**
|
|
1193
|
+
* Aggregated tax information showing detailed tax calculations
|
|
1194
|
+
*/
|
|
1195
|
+
type CalculatedTaxAggregate = {
|
|
1196
|
+
/**
|
|
1197
|
+
* List of tax calculations grouped by taxCode and taxRate
|
|
1198
|
+
*/
|
|
1199
|
+
lines?: Array<CalculatedPrice>;
|
|
1200
|
+
};
|
|
1201
|
+
/**
|
|
1202
|
+
* A breakdown of the total price calculated from all line items, including detailed pricing components.
|
|
1203
|
+
*/
|
|
1204
|
+
type CartCalculatedPrice = {
|
|
1205
|
+
price?: CalculatedPrice & {
|
|
1206
|
+
/**
|
|
1207
|
+
* Net value of the price, price without tax.
|
|
1208
|
+
*/
|
|
1209
|
+
netValue?: number;
|
|
1210
|
+
/**
|
|
1211
|
+
* Gross value of the price, price with tax.
|
|
1212
|
+
*/
|
|
1213
|
+
grossValue?: number;
|
|
1214
|
+
/**
|
|
1215
|
+
* Tax value of the price, it's the actual amount of tax that has to be paid.
|
|
1216
|
+
*/
|
|
1217
|
+
taxValue?: number;
|
|
1218
|
+
/**
|
|
1219
|
+
* Tax code applied to the price, a tax code is a country's set of tax rules. If all fees have the same taxRate, then the value is present. Otherwise, the field is not returned.
|
|
1220
|
+
*/
|
|
1221
|
+
taxCode?: string;
|
|
1222
|
+
/**
|
|
1223
|
+
* Tax rate applied to the price, it's the percentage at which an individual or business is taxed. If all fees have the same taxRate, then the value is present. Otherwise, the field is not returned.
|
|
1224
|
+
*/
|
|
1225
|
+
taxRate?: number;
|
|
1226
|
+
};
|
|
1227
|
+
upliftValue?: CalculatedPrice & {
|
|
1228
|
+
/**
|
|
1229
|
+
* Net value of the uplift amount, value without tax.
|
|
1230
|
+
*/
|
|
1231
|
+
netValue?: number;
|
|
1232
|
+
/**
|
|
1233
|
+
* Gross value of the uplift amount, value with tax.
|
|
1234
|
+
*/
|
|
1235
|
+
grossValue?: number;
|
|
1236
|
+
/**
|
|
1237
|
+
* Tax value of the uplift amount, it's the actual amount of tax that has to be paid.
|
|
1238
|
+
*/
|
|
1239
|
+
taxValue?: number;
|
|
1240
|
+
/**
|
|
1241
|
+
* Tax code applied to uplift amount, a tax code is a country's set of tax rules. If all fees have the same taxRate, then the value is present. Otherwise, the field is not returned.
|
|
1242
|
+
*/
|
|
1243
|
+
taxCode?: string;
|
|
1244
|
+
/**
|
|
1245
|
+
* Tax rate applied to the uplift amount, it's the percentage at which an individual or business is taxed. If all fees have the same taxRate, then the value is present. Otherwise, the field is not returned.
|
|
1246
|
+
*/
|
|
1247
|
+
taxRate?: number;
|
|
1248
|
+
};
|
|
1249
|
+
discountedPrice?: CalculatedPriceWithDiscounts & {
|
|
1250
|
+
/**
|
|
1251
|
+
* The net value after applying discounts.
|
|
1252
|
+
*/
|
|
1253
|
+
netValue?: number;
|
|
1254
|
+
/**
|
|
1255
|
+
* The gross value after applying discounts.
|
|
1256
|
+
*/
|
|
1257
|
+
grossValue?: number;
|
|
1258
|
+
/**
|
|
1259
|
+
* The difference between `grossValue` and `netValue`.
|
|
1260
|
+
*/
|
|
1261
|
+
taxValue?: number;
|
|
1262
|
+
/**
|
|
1263
|
+
* Tax code applied to the discounted price, a tax code is a country's set of tax rules. If all fees have the same taxRate, then the value is present. Otherwise, the field is not returned.
|
|
1264
|
+
*/
|
|
1265
|
+
taxCode?: string;
|
|
1266
|
+
/**
|
|
1267
|
+
* Tax rate applied to the discounted price, it's the percentage at which an individual or business is taxed. If all fees have the same taxRate, then the value is present. Otherwise, the field is not returned.
|
|
1268
|
+
*/
|
|
1269
|
+
taxRate?: number;
|
|
1270
|
+
};
|
|
1271
|
+
fees?: CalculatedPrice & {
|
|
1272
|
+
[key: string]: unknown;
|
|
1273
|
+
};
|
|
1274
|
+
totalFee?: CalculatedPriceWithDiscounts & {
|
|
1275
|
+
/**
|
|
1276
|
+
* Net value of the total fee, value without tax.
|
|
1277
|
+
*/
|
|
1278
|
+
netValue?: number;
|
|
1279
|
+
/**
|
|
1280
|
+
* Gross value of the total fee, value with tax.
|
|
1281
|
+
*/
|
|
1282
|
+
grossValue?: number;
|
|
1283
|
+
/**
|
|
1284
|
+
* Tax value of the total fee, it's the actual amount of tax that has to be paid.
|
|
1285
|
+
*/
|
|
1286
|
+
taxValue?: number;
|
|
1287
|
+
/**
|
|
1288
|
+
* If all fees have the same `taxCode` defined, resulting in the same `taxRate`, the value is present. Otherwise, the field is not returned in the response.
|
|
1289
|
+
*/
|
|
1290
|
+
taxRate?: number;
|
|
1291
|
+
/**
|
|
1292
|
+
* If all fees have the same `taxCode` defined, the value is present. Otherwise, the field is not returned in the response.
|
|
1293
|
+
*/
|
|
1294
|
+
taxCode?: string;
|
|
1295
|
+
/**
|
|
1296
|
+
* A list of discounts applied to on the line item fees. The payment fee itself is not discountable.
|
|
1297
|
+
*/
|
|
1298
|
+
appliedDiscounts?: unknown;
|
|
1299
|
+
};
|
|
1300
|
+
shipping?: CalculatedPrice & {
|
|
1301
|
+
[key: string]: unknown;
|
|
1302
|
+
};
|
|
1303
|
+
/**
|
|
1304
|
+
* The total shipping cost is calculated by summing `items[].calculatedPrice.price.grossValue` for shipping estimation. `GrossValue` is used because, even for zero-tax items, it remains equal to `netValue`. The `totalShipping` is the value *after all the discounts*, if any discounts were applied.
|
|
1305
|
+
*/
|
|
1306
|
+
totalShipping?: CalculatedPriceWithDiscounts & {
|
|
1307
|
+
/**
|
|
1308
|
+
* The net value after applying discounts.
|
|
1309
|
+
*/
|
|
1310
|
+
netValue?: number;
|
|
1311
|
+
/**
|
|
1312
|
+
* The gross value after applying discounts.
|
|
1313
|
+
*/
|
|
1314
|
+
grossValue?: number;
|
|
1315
|
+
/**
|
|
1316
|
+
* The difference between `grossValue` and `netValue`.
|
|
1317
|
+
*/
|
|
1318
|
+
taxValue?: number;
|
|
1319
|
+
/**
|
|
1320
|
+
* Tax code applied to the shipping cost, a tax code is a country's set of tax rules.
|
|
1321
|
+
*/
|
|
1322
|
+
taxCode?: string;
|
|
1323
|
+
/**
|
|
1324
|
+
* Tax rate applied to the shipping cost, it's the percentage at which an individual or business is taxed.
|
|
1325
|
+
*/
|
|
1326
|
+
taxRate?: number;
|
|
1327
|
+
/**
|
|
1328
|
+
* A list of discounts applied to shipping.
|
|
1329
|
+
*/
|
|
1330
|
+
appliedDiscounts?: Array<CalculatedAppliedDiscount & {
|
|
1331
|
+
/**
|
|
1332
|
+
* Discount identifier.
|
|
1333
|
+
*/
|
|
1334
|
+
id?: string;
|
|
1335
|
+
/**
|
|
1336
|
+
* Value of the discount that was applied.
|
|
1337
|
+
*/
|
|
1338
|
+
value?: number;
|
|
1339
|
+
/**
|
|
1340
|
+
* PERCENT for percentage discounts and ABSOLUTE for amount applied to the line item.
|
|
1341
|
+
*/
|
|
1342
|
+
discountType?: 'PERCENT' | 'ABSOLUTE' | 'FREE_SHIPPING';
|
|
1343
|
+
}>;
|
|
1344
|
+
};
|
|
1345
|
+
totalDiscount?: CalculatedTotalDiscount & {
|
|
1346
|
+
/**
|
|
1347
|
+
* Indicates whether discounts were applied to net or gross values.
|
|
1348
|
+
*/
|
|
1349
|
+
calculationType?: 'ApplyDiscountBeforeTax' | 'ApplyDiscountAfterTax';
|
|
1350
|
+
/**
|
|
1351
|
+
* Aggregated sum of `lines[].calculatedPrice.totalDiscount.value` plus the sum of shipping discounts `totalShipping.appliedDiscounts[].value`.
|
|
1352
|
+
*/
|
|
1353
|
+
value?: number;
|
|
1354
|
+
/**
|
|
1355
|
+
* A list of the applied discounts.
|
|
1356
|
+
*/
|
|
1357
|
+
appliedDiscounts?: Array<CalculatedAppliedDiscount & {
|
|
1358
|
+
/**
|
|
1359
|
+
* Discount identifier.
|
|
1360
|
+
*/
|
|
1361
|
+
id?: string;
|
|
1362
|
+
/**
|
|
1363
|
+
* The sum of all `lines[].calculatedPrice.totalDiscount.value` plus `totalShipping.appliedDiscounts[].value` grouped by the discount ID.
|
|
1364
|
+
*/
|
|
1365
|
+
value?: number;
|
|
1366
|
+
/**
|
|
1367
|
+
* PERCENT for percentage discounts, ABSOLUTE for monetary amount and FREE_SHIPPING is shipping is fully discounted.
|
|
1368
|
+
*/
|
|
1369
|
+
discountType?: 'PERCENT' | 'ABSOLUTE' | 'FREE_SHIPPING';
|
|
1370
|
+
}>;
|
|
1371
|
+
};
|
|
1372
|
+
finalPrice?: CalculatedPriceWithTaxAggregate & {
|
|
1373
|
+
/**
|
|
1374
|
+
* The sum of line items, `discountedPrice.netValue` or `price.netValue`, and `totalFee.netValue`.
|
|
1375
|
+
*/
|
|
1376
|
+
netValue?: number;
|
|
1377
|
+
/**
|
|
1378
|
+
* The sum of line items, `discountedPrice.grossValue` or `price.grossValue`, and `totalFee.grossValue`.
|
|
1379
|
+
*/
|
|
1380
|
+
grossValue?: number;
|
|
1381
|
+
/**
|
|
1382
|
+
* The result of subtracting `netValue` and `grossValue`, which is equal to the sum of all `taxValues` from the prices.
|
|
1383
|
+
*/
|
|
1384
|
+
taxValue?: number;
|
|
1385
|
+
/**
|
|
1386
|
+
* If the tax code of the line item matches the tax code of all applied fees, the tax rate is populated with the value. Otherwise, it's not returned in the response.
|
|
1387
|
+
*/
|
|
1388
|
+
taxRate?: number;
|
|
1389
|
+
/**
|
|
1390
|
+
* The common tax code of the line item and all applicable fees. If at least one fee does not have a defined tax code, the common tax code cannot be determined, and the field is empty.
|
|
1391
|
+
*/
|
|
1392
|
+
taxCode?: string;
|
|
1393
|
+
taxAggregate?: {
|
|
1394
|
+
lines?: CalculatedPrice & {
|
|
1395
|
+
/**
|
|
1396
|
+
* Net value of the tax, value without tax.
|
|
1397
|
+
*/
|
|
1398
|
+
netValue?: number;
|
|
1399
|
+
/**
|
|
1400
|
+
* Gross value of the tax, value with tax.
|
|
1401
|
+
*/
|
|
1402
|
+
grossValue?: number;
|
|
1403
|
+
/**
|
|
1404
|
+
* Tax value of the tax, it's the actual amount of tax that has to be paid.
|
|
1405
|
+
*/
|
|
1406
|
+
taxValue?: number;
|
|
1407
|
+
/**
|
|
1408
|
+
* Tax code applied to the tax, a tax code is a country's set of tax rules.
|
|
1409
|
+
*/
|
|
1410
|
+
taxCode?: string;
|
|
1411
|
+
/**
|
|
1412
|
+
* Tax rate applied to the tax, it's the percentage at which an individual or business is taxed.
|
|
1413
|
+
*/
|
|
1414
|
+
taxRate?: number;
|
|
1415
|
+
};
|
|
1416
|
+
};
|
|
1417
|
+
};
|
|
1418
|
+
};
|
|
1419
|
+
type CalculatedFee = {
|
|
1420
|
+
/**
|
|
1421
|
+
* Unique identifier of the fee.
|
|
1422
|
+
*/
|
|
1423
|
+
id?: string;
|
|
1424
|
+
/**
|
|
1425
|
+
* INTERNAL defined in commerce engine, EXTERNAL specified when an item is added to the cart
|
|
1426
|
+
*/
|
|
1427
|
+
origin?: 'INTERNAL' | 'EXTERNAL';
|
|
1428
|
+
/**
|
|
1429
|
+
* Type of the fee.
|
|
1430
|
+
*/
|
|
1431
|
+
type?: 'PERCENT' | 'ABSOLUTE' | 'ABSOLUTE_MULTIPLY_ITEMQUANTITY';
|
|
1432
|
+
/**
|
|
1433
|
+
* Localized names of the fee.
|
|
1434
|
+
*/
|
|
1435
|
+
name?: {
|
|
1436
|
+
[key: string]: string;
|
|
1437
|
+
};
|
|
1438
|
+
price?: CalculatedPrice & {
|
|
1439
|
+
[key: string]: unknown;
|
|
1440
|
+
};
|
|
1441
|
+
discountedPrice?: CalculatedPriceWithDiscounts & {
|
|
1442
|
+
[key: string]: unknown;
|
|
1443
|
+
};
|
|
1444
|
+
};
|
|
1445
|
+
type ItemCalculatedPrice = {
|
|
1446
|
+
price?: CalculatedPrice & {
|
|
1447
|
+
[key: string]: unknown;
|
|
1448
|
+
} & {
|
|
1449
|
+
/**
|
|
1450
|
+
* Indicates how the line item price was determined. - `INTERNAL` — Calculated by Emporix using unit price × quantity. - `EXTERNAL` — Provided externally with `lineTax`.
|
|
1451
|
+
*/
|
|
1452
|
+
calculated?: 'INTERNAL' | 'EXTERNAL';
|
|
1453
|
+
};
|
|
1454
|
+
upliftValue?: CalculatedPrice & {
|
|
1455
|
+
/**
|
|
1456
|
+
* Net value of the uplift amount, value without tax.
|
|
1457
|
+
*/
|
|
1458
|
+
netValue?: number;
|
|
1459
|
+
/**
|
|
1460
|
+
* Gross value of the uplift amount, value with tax.
|
|
1461
|
+
*/
|
|
1462
|
+
grossValue?: number;
|
|
1463
|
+
/**
|
|
1464
|
+
* Tax value of the uplift amount, it's the actual amount of tax that has to be paid.
|
|
1465
|
+
*/
|
|
1466
|
+
taxValue?: number;
|
|
1467
|
+
/**
|
|
1468
|
+
* Tax code applied to uplift amount, a tax code is a country's set of tax rules.
|
|
1469
|
+
*/
|
|
1470
|
+
taxCode?: string;
|
|
1471
|
+
/**
|
|
1472
|
+
* Tax rate applied to the uplift amount, it's the percentage at which an individual or business is taxed.
|
|
1473
|
+
*/
|
|
1474
|
+
taxRate?: number;
|
|
1475
|
+
};
|
|
1476
|
+
discountedPrice?: CalculatedPriceWithDiscounts & {
|
|
1477
|
+
/**
|
|
1478
|
+
* The net value after applying discounts, calculated if `includesTax=false`.
|
|
1479
|
+
*/
|
|
1480
|
+
netValue?: number;
|
|
1481
|
+
/**
|
|
1482
|
+
* The gross value after applying discounts, calculated if `includesTax=true`.
|
|
1483
|
+
*/
|
|
1484
|
+
grossValue?: number;
|
|
1485
|
+
/**
|
|
1486
|
+
* The difference between `grossValue` and `netValue`.
|
|
1487
|
+
*/
|
|
1488
|
+
taxValue?: number;
|
|
1489
|
+
/**
|
|
1490
|
+
* Tax rate applied to the discounted price, it's the percentage at which an individual or business is taxed.
|
|
1491
|
+
*/
|
|
1492
|
+
taxRate?: number;
|
|
1493
|
+
/**
|
|
1494
|
+
* Tax code applied to the discounted price, a tax code is a country's set of tax rules.
|
|
1495
|
+
*/
|
|
1496
|
+
taxCode?: string;
|
|
1497
|
+
/**
|
|
1498
|
+
* A list of discounts applied to the line item.
|
|
1499
|
+
*/
|
|
1500
|
+
appliedDiscounts?: Array<CalculatedAppliedDiscount & {
|
|
1501
|
+
/**
|
|
1502
|
+
* Discount identifier.
|
|
1503
|
+
*/
|
|
1504
|
+
id?: string;
|
|
1505
|
+
/**
|
|
1506
|
+
* Value of the discount that was applied.
|
|
1507
|
+
*/
|
|
1508
|
+
value?: number;
|
|
1509
|
+
/**
|
|
1510
|
+
* PERCENT for percentage discounts and ABSOLUTE for amount applied to the line item.
|
|
1511
|
+
*/
|
|
1512
|
+
discountType?: 'PERCENT' | 'ABSOLUTE' | 'FREE_SHIPPING';
|
|
1513
|
+
}>;
|
|
1514
|
+
};
|
|
1515
|
+
/**
|
|
1516
|
+
* A list of fees applied to the line item. If there are no fees on the item line, it's not returned in the response.
|
|
1517
|
+
*/
|
|
1518
|
+
fees?: Array<CalculatedFee & {
|
|
1519
|
+
/**
|
|
1520
|
+
* Fee identifier.
|
|
1521
|
+
*/
|
|
1522
|
+
id?: string;
|
|
1523
|
+
/**
|
|
1524
|
+
* PERCENT for fee percentage of the item's line `price.netValue` - unit price x quantity. ABSOLUTE for the absolute amount assigned to the item line. ABSOLUTE_MULTIPLY_ITEMQUANTITY for the monetary amount multiplied by the item quantity and assigned to the item line.
|
|
1525
|
+
*/
|
|
1526
|
+
type?: 'PERCENT' | 'ABSOLUTE' | 'ABSOLUTE_MULTIPLY_ITEMQUANTITY';
|
|
1527
|
+
/**
|
|
1528
|
+
* INTERNAL defined in commerce engine, EXTERNAL specified when an item is added to the cart.
|
|
1529
|
+
*/
|
|
1530
|
+
origin?: 'INTERNAL' | 'EXTERNAL';
|
|
1531
|
+
/**
|
|
1532
|
+
* Fee name.
|
|
1533
|
+
*/
|
|
1534
|
+
name?: {
|
|
1535
|
+
[key: string]: unknown;
|
|
1536
|
+
};
|
|
1537
|
+
/**
|
|
1538
|
+
* The calculated price of the fee.
|
|
1539
|
+
*/
|
|
1540
|
+
price?: {
|
|
1541
|
+
/**
|
|
1542
|
+
* Monetary amount of the fee, depends on the fee type.
|
|
1543
|
+
*/
|
|
1544
|
+
netValue?: number;
|
|
1545
|
+
/**
|
|
1546
|
+
* Value calculated based on the `taxCode` and the `taxRate` if `taxable=true`.
|
|
1547
|
+
*/
|
|
1548
|
+
grossValue?: number;
|
|
1549
|
+
/**
|
|
1550
|
+
* If a fee is defined with the attribute `taxable=true`, the tax rate is calculated based on the provided `taxCode` at the fee level. A taxable fee must have a defined `taxCode`.
|
|
1551
|
+
*/
|
|
1552
|
+
taxRate?: number;
|
|
1553
|
+
/**
|
|
1554
|
+
* Tax code defined on the fee level, for example STANDARD. The value should match the available tax codes in the system configuration.
|
|
1555
|
+
*/
|
|
1556
|
+
taxCode?: string;
|
|
1557
|
+
discountedPrice?: CalculatedPriceWithDiscounts & {
|
|
1558
|
+
/**
|
|
1559
|
+
* The net value after applying discounts, calculated if `includesTax=false`.
|
|
1560
|
+
*/
|
|
1561
|
+
netValue?: number;
|
|
1562
|
+
/**
|
|
1563
|
+
* The gross value after applying discounts, calculated if `includesTax=true`.
|
|
1564
|
+
*/
|
|
1565
|
+
grossValue?: number;
|
|
1566
|
+
/**
|
|
1567
|
+
* The difference between `grossValue` and `netValue`.
|
|
1568
|
+
*/
|
|
1569
|
+
taxValue?: number;
|
|
1570
|
+
/**
|
|
1571
|
+
* Refers to `fees[].price.taxRate`.
|
|
1572
|
+
*/
|
|
1573
|
+
taxRate?: number;
|
|
1574
|
+
/**
|
|
1575
|
+
* Refers to `fees[].price.taxCode`.
|
|
1576
|
+
*/
|
|
1577
|
+
taxCode?: string;
|
|
1578
|
+
/**
|
|
1579
|
+
* A list of discounts applied to the line item.
|
|
1580
|
+
*/
|
|
1581
|
+
appliedDiscounts?: Array<CalculatedAppliedDiscount & {
|
|
1582
|
+
/**
|
|
1583
|
+
* Discount identifier.
|
|
1584
|
+
*/
|
|
1585
|
+
id?: string;
|
|
1586
|
+
/**
|
|
1587
|
+
* Monetary amount of the discount applied to the price for the given discount ID.
|
|
1588
|
+
*/
|
|
1589
|
+
value?: number;
|
|
1590
|
+
/**
|
|
1591
|
+
* PERCENT for percentage discounts and ABSOLUTE for amount applied to the line item.
|
|
1592
|
+
*/
|
|
1593
|
+
discountType?: 'PERCENT' | 'ABSOLUTE' | 'FREE_SHIPPING';
|
|
1594
|
+
}>;
|
|
1595
|
+
};
|
|
1596
|
+
};
|
|
1597
|
+
}>;
|
|
1598
|
+
totalFee?: CalculatedPriceWithDiscounts & {
|
|
1599
|
+
/**
|
|
1600
|
+
* Net value of the price, price without tax.
|
|
1601
|
+
*/
|
|
1602
|
+
netValue?: number;
|
|
1603
|
+
/**
|
|
1604
|
+
* Gross value of the price, price with tax.
|
|
1605
|
+
*/
|
|
1606
|
+
grossValue?: number;
|
|
1607
|
+
/**
|
|
1608
|
+
* Tax value of the price, it's the actual amount of tax that has to be paid.
|
|
1609
|
+
*/
|
|
1610
|
+
taxValue?: number;
|
|
1611
|
+
/**
|
|
1612
|
+
* If all fees have the same `taxCode` defined, which results in the same `taxRate`, then the value is present. Otherwise, the field is not returned.
|
|
1613
|
+
*/
|
|
1614
|
+
taxRate?: number;
|
|
1615
|
+
/**
|
|
1616
|
+
* If all fees have the same `taxCode`, then the value is present. Otherwise, the field is not returned.
|
|
1617
|
+
*/
|
|
1618
|
+
taxCode?: string;
|
|
1619
|
+
/**
|
|
1620
|
+
* A list of discounts applied to the line item.
|
|
1621
|
+
*/
|
|
1622
|
+
appliedDiscounts?: Array<CalculatedAppliedDiscount & {
|
|
1623
|
+
/**
|
|
1624
|
+
* Discount identifier.
|
|
1625
|
+
*/
|
|
1626
|
+
id?: string;
|
|
1627
|
+
/**
|
|
1628
|
+
* Sum of all `fees[].discountedPrice.appliedDiscounts[].value` grouped by `discount.id`
|
|
1629
|
+
*/
|
|
1630
|
+
value?: number;
|
|
1631
|
+
/**
|
|
1632
|
+
* PERCENT for percentage discounts and ABSOLUTE for amount applied to the line item.
|
|
1633
|
+
*/
|
|
1634
|
+
discountType?: 'PERCENT' | 'ABSOLUTE' | 'FREE_SHIPPING';
|
|
1635
|
+
}>;
|
|
1636
|
+
};
|
|
1637
|
+
totalDiscount?: CalculatedTotalDiscount & {
|
|
1638
|
+
/**
|
|
1639
|
+
* Indicates whether discounts were applied to net or gross values.
|
|
1640
|
+
*/
|
|
1641
|
+
calculationType?: 'ApplyDiscountBeforeTax' | 'ApplyDiscountAfterTax';
|
|
1642
|
+
/**
|
|
1643
|
+
* Aggregated sum of `lines[].calculatedPrice.totalDiscount.value` plus the sum of shipping discounts `totalShipping.appliedDiscounts[].value`.
|
|
1644
|
+
*/
|
|
1645
|
+
value?: number;
|
|
1646
|
+
/**
|
|
1647
|
+
* A list of the applied discounts.
|
|
1648
|
+
*/
|
|
1649
|
+
appliedDiscounts?: Array<CalculatedAppliedDiscount & {
|
|
1650
|
+
/**
|
|
1651
|
+
* Discount identifier.
|
|
1652
|
+
*/
|
|
1653
|
+
id?: string;
|
|
1654
|
+
/**
|
|
1655
|
+
* The sum of `discountedPrice.appliedDiscounts[].value` and `fees[].discountedPrice.appliedDiscounts[].value`.
|
|
1656
|
+
*/
|
|
1657
|
+
value?: number;
|
|
1658
|
+
/**
|
|
1659
|
+
* PERCENT for percentage discounts and ABSOLUTE for monetary amount.
|
|
1660
|
+
*/
|
|
1661
|
+
discountType?: 'PERCENT' | 'ABSOLUTE' | 'FREE_SHIPPING';
|
|
1662
|
+
}>;
|
|
1663
|
+
};
|
|
1664
|
+
/**
|
|
1665
|
+
* Detailed price calculation for a single line item with all pricing components.
|
|
1666
|
+
*/
|
|
1667
|
+
finalPrice?: CalculatedPrice & {
|
|
1668
|
+
/**
|
|
1669
|
+
* The sum of line items, `discountedPrice.netValue` or `price.netValue`, and `totalFee.netValue`.
|
|
1670
|
+
*/
|
|
1671
|
+
netValue?: number;
|
|
1672
|
+
/**
|
|
1673
|
+
* The sum of line items, `discountedPrice.grossValue` or `price.grossValue`, and `totalFee.grossValue`.
|
|
1674
|
+
*/
|
|
1675
|
+
grossValue?: number;
|
|
1676
|
+
/**
|
|
1677
|
+
* The result of subtracting `netValue` and `grossValue`, which is equal to the sum of all `taxValues` from the prices.
|
|
1678
|
+
*/
|
|
1679
|
+
taxValue?: number;
|
|
1680
|
+
/**
|
|
1681
|
+
* If the tax code of the line item matches the tax code of all applied fees, the tax rate is populated with the value. Otherwise, it's not returned in the response.
|
|
1682
|
+
*/
|
|
1683
|
+
taxRate?: number;
|
|
1684
|
+
/**
|
|
1685
|
+
* The common tax code of the line item and all applicable fees. If at least one fee does not have a defined tax code, the common tax code cannot be determined, and the field is empty.
|
|
1686
|
+
*/
|
|
1687
|
+
taxCode?: string;
|
|
1688
|
+
};
|
|
1689
|
+
};
|
|
1690
|
+
type CalculatedAppliedDiscount = {
|
|
1691
|
+
/**
|
|
1692
|
+
* The ID of the applied discount.
|
|
1693
|
+
*/
|
|
1694
|
+
id?: string;
|
|
1695
|
+
/**
|
|
1696
|
+
* The calculated value of the discount.
|
|
1697
|
+
*/
|
|
1698
|
+
value?: number;
|
|
1699
|
+
price?: CalculatedPrice & {
|
|
1700
|
+
[key: string]: unknown;
|
|
1701
|
+
};
|
|
1702
|
+
/**
|
|
1703
|
+
* The discount type which shows how the discount was calculated. PERCENT refers to a percentage discount for example 10%. ABSOLUTE is a monetary amount.
|
|
1704
|
+
*/
|
|
1705
|
+
discountType?: 'PERCENT' | 'ABSOLUTE' | 'FREE_SHIPPING';
|
|
1706
|
+
/**
|
|
1707
|
+
* Indicates whether the discount is from internal coupon (INTERNAL) or external discount (EXTERNAL).
|
|
1708
|
+
*/
|
|
1709
|
+
origin?: 'INTERNAL' | 'EXTERNAL';
|
|
1710
|
+
};
|
|
1711
|
+
/**
|
|
1712
|
+
* The total combined value of all applied discounts.
|
|
1713
|
+
*/
|
|
1714
|
+
type CalculatedTotalDiscount = {
|
|
1715
|
+
/**
|
|
1716
|
+
* Indicates whether discounts were calculated using net or gross price values.
|
|
1717
|
+
*/
|
|
1718
|
+
calculationType?: 'ApplyDiscountBeforeTax' | 'ApplyDiscountAfterTax';
|
|
1719
|
+
/**
|
|
1720
|
+
* The calculated amount of all discounts.
|
|
1721
|
+
*/
|
|
1722
|
+
value?: number;
|
|
1723
|
+
price?: CalculatedPrice & {
|
|
1724
|
+
[key: string]: unknown;
|
|
1725
|
+
};
|
|
1726
|
+
/**
|
|
1727
|
+
* All applied discounts that are parts of the sum. Sum of all `discountedPrice.appliedDiscounts[].value` and `fees[].discountedPrice.appliedDiscounts[].value`.
|
|
1728
|
+
*/
|
|
1729
|
+
appliedDiscounts?: Array<CalculatedAppliedDiscount>;
|
|
1730
|
+
};
|
|
1731
|
+
|
|
1732
|
+
/** A cart as returned by the Cart service (all generated fields). */
|
|
1733
|
+
type Cart = Cart$1;
|
|
1734
|
+
/** The cart-create response (`{ cartId, yrn }`, generated). */
|
|
1735
|
+
type CartCreated = CreatedCart;
|
|
1736
|
+
/** Generated request bodies (caller sends the exact wire shape). */
|
|
1737
|
+
type CreateCartInput = CreateCart;
|
|
1738
|
+
type CartItemInput = CartItemRequest;
|
|
1739
|
+
type CartItemUpdate = UpdateCartItem;
|
|
1740
|
+
/** Per-entry result of `addItemsBatch`. `status` is HTTP-style per entry (e.g. 201 = added, 4xx = failed). */
|
|
1741
|
+
type CartItemBatchEntry = SingleBatchResponse;
|
|
1742
|
+
/** Response shape of `addItemsBatch` — one entry per input item, matching by `index`. */
|
|
1743
|
+
type CartItemsBatchResponse = BatchResponse;
|
|
1744
|
+
/** An address payload for cart shipping/billing (generated). */
|
|
1745
|
+
type CartAddress = AddressRequest;
|
|
1746
|
+
/** Cart operations. Every method requires an explicit customer/anonymous context. */
|
|
1747
|
+
declare class CartService {
|
|
1748
|
+
private readonly ctx;
|
|
1749
|
+
constructor(ctx: ClientContext);
|
|
1750
|
+
private base;
|
|
1751
|
+
/** Creates a cart. */
|
|
1752
|
+
create(input: CreateCartInput | undefined, auth: AuthContext): Promise<CartCreated>;
|
|
1753
|
+
/** Fetches a cart by id. */
|
|
1754
|
+
get(cartId: string, auth: AuthContext): Promise<Cart>;
|
|
1755
|
+
/** Returns the current cart for the session, or null if none. */
|
|
1756
|
+
/**
|
|
1757
|
+
* Get the customer / anonymous cart matching the given criteria. Per Emporix:
|
|
1758
|
+
* uniqueness is defined by `siteCode` + `type` + `legalEntityId` +
|
|
1759
|
+
* (`customerId` derived from a customer token, or `sessionId` derived from an
|
|
1760
|
+
* anonymous token). With `create: true`, Emporix creates a new cart if none
|
|
1761
|
+
* matches.
|
|
1762
|
+
*
|
|
1763
|
+
* Returns `null` on 404 (no cart found and `create` was not set). All other
|
|
1764
|
+
* errors are propagated.
|
|
1765
|
+
*/
|
|
1766
|
+
getCurrent(auth: AuthContext, opts: {
|
|
1767
|
+
siteCode: string;
|
|
1768
|
+
type?: string;
|
|
1769
|
+
legalEntityId?: string;
|
|
1770
|
+
create?: boolean;
|
|
1771
|
+
}): Promise<Cart | null>;
|
|
1772
|
+
/** Adds an item. */
|
|
1773
|
+
addItem(cartId: string, item: CartItemInput, auth: AuthContext): Promise<Cart>;
|
|
1774
|
+
/**
|
|
1775
|
+
* Adds multiple items in a single request via `POST /carts/{id}/itemsBatch`.
|
|
1776
|
+
* Server-side limit is 200 entries per call — callers handling larger sets
|
|
1777
|
+
* must chunk. The response carries a per-entry `status` (HTTP-style: 201
|
|
1778
|
+
* for added, 4xx/5xx for failed) and `index` matching the input position;
|
|
1779
|
+
* partial failures do **not** throw — inspect `status` per entry.
|
|
1780
|
+
*/
|
|
1781
|
+
addItemsBatch(cartId: string, items: CartItemInput[], auth: AuthContext): Promise<CartItemsBatchResponse>;
|
|
1782
|
+
/** Updates an item. */
|
|
1783
|
+
updateItem(cartId: string, itemId: string, patch: CartItemUpdate, auth: AuthContext): Promise<Cart>;
|
|
1784
|
+
/** Removes an item. */
|
|
1785
|
+
removeItem(cartId: string, itemId: string, auth: AuthContext): Promise<Cart>;
|
|
1786
|
+
/** Empties the cart. */
|
|
1787
|
+
clear(cartId: string, auth: AuthContext): Promise<Cart>;
|
|
1788
|
+
/** Applies a coupon. */
|
|
1789
|
+
applyCoupon(cartId: string, code: string, auth: AuthContext): Promise<Cart>;
|
|
1790
|
+
/** Removes a coupon. */
|
|
1791
|
+
removeCoupon(cartId: string, code: string, auth: AuthContext): Promise<Cart>;
|
|
1792
|
+
/** Sets the shipping address. */
|
|
1793
|
+
setShippingAddress(cartId: string, address: CartAddress, auth: AuthContext): Promise<Cart>;
|
|
1794
|
+
/** Sets the billing address. */
|
|
1795
|
+
setBillingAddress(cartId: string, address: CartAddress, auth: AuthContext): Promise<Cart>;
|
|
1796
|
+
/**
|
|
1797
|
+
* Merges one or more anonymous carts into the specified customer cart.
|
|
1798
|
+
* Per Emporix: the target cart in the path **must belong to the logged-in
|
|
1799
|
+
* customer**, and each id in `anonymousCartIds` must belong to an anonymous
|
|
1800
|
+
* customer. Anonymous carts go `CLOSED` on success.
|
|
1801
|
+
*
|
|
1802
|
+
* Requires a customer `AuthContext`.
|
|
1803
|
+
*/
|
|
1804
|
+
merge(customerCartId: string, anonymousCartIds: string[], auth: AuthContext): Promise<Cart>;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
export { type Cart, type CartAddress, type CartCreated, type CartItemBatchEntry, type CartItemInput, type CartItemUpdate, type CartItemsBatchResponse, CartService, type CreateCartInput };
|