@labdigital/commercetools-mock 2.48.1 → 2.49.1
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 +25 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/repositories/cart/actions.ts +42 -0
- package/src/services/cart.test.ts +31 -0
package/dist/index.js
CHANGED
|
@@ -1547,6 +1547,31 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
|
|
|
1547
1547
|
resource.shippingInfo = void 0;
|
|
1548
1548
|
}
|
|
1549
1549
|
}
|
|
1550
|
+
setShippingAddressCustomField(context, resource, { name, value }) {
|
|
1551
|
+
if (!resource.shippingAddress) {
|
|
1552
|
+
throw new Error("Resource has no shipping address");
|
|
1553
|
+
}
|
|
1554
|
+
if (!resource.shippingAddress.custom) {
|
|
1555
|
+
throw new Error("Resource has no custom field");
|
|
1556
|
+
}
|
|
1557
|
+
resource.shippingAddress.custom.fields[name] = value;
|
|
1558
|
+
}
|
|
1559
|
+
removeShippingMethod(context, resource, { shippingKey }) {
|
|
1560
|
+
if (!resource.shippingInfo) {
|
|
1561
|
+
return;
|
|
1562
|
+
}
|
|
1563
|
+
const shippingMethod = this._storage.getByResourceIdentifier(
|
|
1564
|
+
context.projectKey,
|
|
1565
|
+
{
|
|
1566
|
+
typeId: "shipping-method",
|
|
1567
|
+
key: shippingKey
|
|
1568
|
+
}
|
|
1569
|
+
);
|
|
1570
|
+
if (resource.shippingInfo?.shippingMethod?.id !== shippingMethod.id) {
|
|
1571
|
+
throw new Error("Shipping method with key not found");
|
|
1572
|
+
}
|
|
1573
|
+
resource.shippingInfo = void 0;
|
|
1574
|
+
}
|
|
1550
1575
|
};
|
|
1551
1576
|
|
|
1552
1577
|
// src/repositories/cart/index.ts
|