@labdigital/commercetools-mock 2.32.0 → 2.33.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
@@ -2618,6 +2618,29 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2618
2618
  this._storage
2619
2619
  );
2620
2620
  }
2621
+ setBillingAddressCustomType(context, resource, custom) {
2622
+ if (!resource.billingAddress) {
2623
+ throw new Error("Resource has no billing address");
2624
+ }
2625
+ if (!custom.type) {
2626
+ resource.billingAddress.custom = void 0;
2627
+ return;
2628
+ }
2629
+ const resolvedType = this._storage.getByResourceIdentifier(
2630
+ context.projectKey,
2631
+ custom.type
2632
+ );
2633
+ if (!resolvedType) {
2634
+ throw new Error(`Type ${custom.type} not found`);
2635
+ }
2636
+ resource.billingAddress.custom = {
2637
+ type: {
2638
+ typeId: "type",
2639
+ id: resolvedType.id
2640
+ },
2641
+ fields: custom.fields || {}
2642
+ };
2643
+ }
2621
2644
  setCountry(context, resource, { country }) {
2622
2645
  resource.country = country;
2623
2646
  }
@@ -2730,6 +2753,29 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
2730
2753
  custom
2731
2754
  };
2732
2755
  }
2756
+ setShippingAddressCustomType(context, resource, custom) {
2757
+ if (!resource.shippingAddress) {
2758
+ throw new Error("Resource has no shipping address");
2759
+ }
2760
+ if (!custom.type) {
2761
+ resource.shippingAddress.custom = void 0;
2762
+ return;
2763
+ }
2764
+ const resolvedType = this._storage.getByResourceIdentifier(
2765
+ context.projectKey,
2766
+ custom.type
2767
+ );
2768
+ if (!resolvedType) {
2769
+ throw new Error(`Type ${custom.type} not found`);
2770
+ }
2771
+ resource.shippingAddress.custom = {
2772
+ type: {
2773
+ typeId: "type",
2774
+ id: resolvedType.id
2775
+ },
2776
+ fields: custom.fields || {}
2777
+ };
2778
+ }
2733
2779
  setShippingMethod(context, resource, { shippingMethod }) {
2734
2780
  if (shippingMethod) {
2735
2781
  const method = this._storage.getByResourceIdentifier(
@@ -4114,6 +4160,9 @@ var OrderUpdateHandler = class extends AbstractUpdateHandler {
4114
4160
  setOrderNumber(context, resource, { orderNumber }) {
4115
4161
  resource.orderNumber = orderNumber;
4116
4162
  }
4163
+ setPurchaseOrderNumber(context, resource, { purchaseOrderNumber }) {
4164
+ resource.purchaseOrderNumber = purchaseOrderNumber;
4165
+ }
4117
4166
  setShippingAddress(context, resource, { address }) {
4118
4167
  resource.shippingAddress = createAddress(
4119
4168
  address,