@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.cjs
CHANGED
|
@@ -2812,8 +2812,11 @@ var CartRepository = class extends AbstractResourceRepository {
|
|
|
2812
2812
|
) ?? [];
|
|
2813
2813
|
const resource = {
|
|
2814
2814
|
...getBaseResourceProperties(),
|
|
2815
|
+
anonymousId: draft.anonymousId,
|
|
2816
|
+
billingAddress: draft.billingAddress ? createAddress(draft.billingAddress, context.projectKey, this._storage) : void 0,
|
|
2815
2817
|
cartState: "Active",
|
|
2816
2818
|
country: draft.country,
|
|
2819
|
+
customerEmail: draft.customerEmail,
|
|
2817
2820
|
customLineItems: [],
|
|
2818
2821
|
directDiscounts: [],
|
|
2819
2822
|
discountCodes: [],
|
|
@@ -2831,11 +2834,11 @@ var CartRepository = class extends AbstractResourceRepository {
|
|
|
2831
2834
|
fractionDigits: 0
|
|
2832
2835
|
},
|
|
2833
2836
|
shippingMode: "Single",
|
|
2834
|
-
shippingAddress: createAddress(
|
|
2837
|
+
shippingAddress: draft.shippingAddress ? createAddress(
|
|
2835
2838
|
draft.shippingAddress,
|
|
2836
2839
|
context.projectKey,
|
|
2837
2840
|
this._storage
|
|
2838
|
-
),
|
|
2841
|
+
) : void 0,
|
|
2839
2842
|
shipping: [],
|
|
2840
2843
|
origin: draft.origin ?? "Customer",
|
|
2841
2844
|
refusedGifts: [],
|
|
@@ -2846,6 +2849,7 @@ var CartRepository = class extends AbstractResourceRepository {
|
|
|
2846
2849
|
)
|
|
2847
2850
|
};
|
|
2848
2851
|
resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
|
|
2852
|
+
resource.store = context.storeKey ? { typeId: "store", key: context.storeKey } : void 0;
|
|
2849
2853
|
return this.saveNew(context, resource);
|
|
2850
2854
|
}
|
|
2851
2855
|
getActiveCart(projectKey) {
|
|
@@ -4258,23 +4262,37 @@ var OrderRepository = class extends AbstractResourceRepository {
|
|
|
4258
4262
|
}
|
|
4259
4263
|
const resource = {
|
|
4260
4264
|
...getBaseResourceProperties(),
|
|
4261
|
-
|
|
4265
|
+
anonymousId: cart.anonymousId,
|
|
4266
|
+
billingAddress: cart.billingAddress,
|
|
4262
4267
|
cart: cartReference,
|
|
4263
|
-
|
|
4264
|
-
|
|
4268
|
+
country: cart.country,
|
|
4269
|
+
custom: cart.custom,
|
|
4270
|
+
customerEmail: cart.customerEmail,
|
|
4271
|
+
customerGroup: cart.customerGroup,
|
|
4272
|
+
customerId: cart.customerId,
|
|
4265
4273
|
customLineItems: [],
|
|
4266
|
-
|
|
4267
|
-
|
|
4274
|
+
directDiscounts: cart.directDiscounts,
|
|
4275
|
+
discountCodes: cart.discountCodes,
|
|
4276
|
+
discountOnTotalPrice: cart.discountOnTotalPrice,
|
|
4277
|
+
lastMessageSequenceNumber: 0,
|
|
4278
|
+
lineItems: cart.lineItems,
|
|
4279
|
+
locale: cart.locale,
|
|
4280
|
+
orderNumber: orderNumber ?? generateRandomString(10),
|
|
4281
|
+
orderState: "Open",
|
|
4268
4282
|
origin: "Customer",
|
|
4269
|
-
|
|
4270
|
-
|
|
4283
|
+
paymentInfo: cart.paymentInfo,
|
|
4284
|
+
refusedGifts: [],
|
|
4271
4285
|
shipping: cart.shipping,
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4286
|
+
shippingAddress: cart.shippingAddress,
|
|
4287
|
+
shippingMode: cart.shippingMode,
|
|
4288
|
+
syncInfo: [],
|
|
4289
|
+
taxCalculationMode: cart.taxCalculationMode,
|
|
4290
|
+
taxedPrice: cart.taxedPrice,
|
|
4291
|
+
taxedShippingPrice: cart.taxedShippingPrice,
|
|
4292
|
+
taxMode: cart.taxMode,
|
|
4293
|
+
taxRoundingMode: cart.taxRoundingMode,
|
|
4294
|
+
totalPrice: cart.totalPrice,
|
|
4295
|
+
store: cart.store
|
|
4278
4296
|
};
|
|
4279
4297
|
return this.saveNew(context, resource);
|
|
4280
4298
|
}
|