@labdigital/commercetools-mock 2.34.1 → 2.34.3
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/index.cjs +33 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/repositories/cart/index.test.ts +151 -0
- package/src/repositories/cart/index.ts +15 -5
- package/src/repositories/order/index.test.ts +127 -45
- package/src/repositories/order/index.ts +28 -16
package/dist/index.js
CHANGED
|
@@ -2775,8 +2775,11 @@ var CartRepository = class extends AbstractResourceRepository {
|
|
|
2775
2775
|
) ?? [];
|
|
2776
2776
|
const resource = {
|
|
2777
2777
|
...getBaseResourceProperties(),
|
|
2778
|
+
anonymousId: draft.anonymousId,
|
|
2779
|
+
billingAddress: draft.billingAddress ? createAddress(draft.billingAddress, context.projectKey, this._storage) : void 0,
|
|
2778
2780
|
cartState: "Active",
|
|
2779
2781
|
country: draft.country,
|
|
2782
|
+
customerEmail: draft.customerEmail,
|
|
2780
2783
|
customLineItems: [],
|
|
2781
2784
|
directDiscounts: [],
|
|
2782
2785
|
discountCodes: [],
|
|
@@ -2794,11 +2797,11 @@ var CartRepository = class extends AbstractResourceRepository {
|
|
|
2794
2797
|
fractionDigits: 0
|
|
2795
2798
|
},
|
|
2796
2799
|
shippingMode: "Single",
|
|
2797
|
-
shippingAddress: createAddress(
|
|
2800
|
+
shippingAddress: draft.shippingAddress ? createAddress(
|
|
2798
2801
|
draft.shippingAddress,
|
|
2799
2802
|
context.projectKey,
|
|
2800
2803
|
this._storage
|
|
2801
|
-
),
|
|
2804
|
+
) : void 0,
|
|
2802
2805
|
shipping: [],
|
|
2803
2806
|
origin: draft.origin ?? "Customer",
|
|
2804
2807
|
refusedGifts: [],
|
|
@@ -2809,6 +2812,7 @@ var CartRepository = class extends AbstractResourceRepository {
|
|
|
2809
2812
|
)
|
|
2810
2813
|
};
|
|
2811
2814
|
resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
|
|
2815
|
+
resource.store = context.storeKey ? { typeId: "store", key: context.storeKey } : void 0;
|
|
2812
2816
|
return this.saveNew(context, resource);
|
|
2813
2817
|
}
|
|
2814
2818
|
getActiveCart(projectKey) {
|
|
@@ -4221,23 +4225,37 @@ var OrderRepository = class extends AbstractResourceRepository {
|
|
|
4221
4225
|
}
|
|
4222
4226
|
const resource = {
|
|
4223
4227
|
...getBaseResourceProperties(),
|
|
4224
|
-
|
|
4228
|
+
anonymousId: cart.anonymousId,
|
|
4229
|
+
billingAddress: cart.billingAddress,
|
|
4225
4230
|
cart: cartReference,
|
|
4226
|
-
|
|
4227
|
-
|
|
4231
|
+
country: cart.country,
|
|
4232
|
+
custom: cart.custom,
|
|
4233
|
+
customerEmail: cart.customerEmail,
|
|
4234
|
+
customerGroup: cart.customerGroup,
|
|
4235
|
+
customerId: cart.customerId,
|
|
4228
4236
|
customLineItems: [],
|
|
4229
|
-
|
|
4230
|
-
|
|
4237
|
+
directDiscounts: cart.directDiscounts,
|
|
4238
|
+
discountCodes: cart.discountCodes,
|
|
4239
|
+
discountOnTotalPrice: cart.discountOnTotalPrice,
|
|
4240
|
+
lastMessageSequenceNumber: 0,
|
|
4241
|
+
lineItems: cart.lineItems,
|
|
4242
|
+
locale: cart.locale,
|
|
4243
|
+
orderNumber: orderNumber ?? generateRandomString(10),
|
|
4244
|
+
orderState: "Open",
|
|
4231
4245
|
origin: "Customer",
|
|
4232
|
-
|
|
4233
|
-
|
|
4246
|
+
paymentInfo: cart.paymentInfo,
|
|
4247
|
+
refusedGifts: [],
|
|
4234
4248
|
shipping: cart.shipping,
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4249
|
+
shippingAddress: cart.shippingAddress,
|
|
4250
|
+
shippingMode: cart.shippingMode,
|
|
4251
|
+
syncInfo: [],
|
|
4252
|
+
taxCalculationMode: cart.taxCalculationMode,
|
|
4253
|
+
taxedPrice: cart.taxedPrice,
|
|
4254
|
+
taxedShippingPrice: cart.taxedShippingPrice,
|
|
4255
|
+
taxMode: cart.taxMode,
|
|
4256
|
+
taxRoundingMode: cart.taxRoundingMode,
|
|
4257
|
+
totalPrice: cart.totalPrice,
|
|
4258
|
+
store: cart.store
|
|
4241
4259
|
};
|
|
4242
4260
|
return this.saveNew(context, resource);
|
|
4243
4261
|
}
|