@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 CHANGED
@@ -1584,6 +1584,31 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
1584
1584
  resource.shippingInfo = void 0;
1585
1585
  }
1586
1586
  }
1587
+ setShippingAddressCustomField(context, resource, { name, value }) {
1588
+ if (!resource.shippingAddress) {
1589
+ throw new Error("Resource has no shipping address");
1590
+ }
1591
+ if (!resource.shippingAddress.custom) {
1592
+ throw new Error("Resource has no custom field");
1593
+ }
1594
+ resource.shippingAddress.custom.fields[name] = value;
1595
+ }
1596
+ removeShippingMethod(context, resource, { shippingKey }) {
1597
+ if (!resource.shippingInfo) {
1598
+ return;
1599
+ }
1600
+ const shippingMethod = this._storage.getByResourceIdentifier(
1601
+ context.projectKey,
1602
+ {
1603
+ typeId: "shipping-method",
1604
+ key: shippingKey
1605
+ }
1606
+ );
1607
+ if (resource.shippingInfo?.shippingMethod?.id !== shippingMethod.id) {
1608
+ throw new Error("Shipping method with key not found");
1609
+ }
1610
+ resource.shippingInfo = void 0;
1611
+ }
1587
1612
  };
1588
1613
 
1589
1614
  // src/repositories/cart/index.ts