@labdigital/commercetools-mock 2.56.0 → 2.56.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.js CHANGED
@@ -824,6 +824,7 @@ const createCustomLineItemFromDraft = (projectKey, draft, storage, country) => {
824
824
  centAmount: (draft.money.centAmount ?? 0) * quantity
825
825
  });
826
826
  const taxedPrice = taxCategory ? calculateTaxedPrice(totalPrice.centAmount, taxCategory, totalPrice.currencyCode, country) : void 0;
827
+ const taxRate = taxCategory ? taxCategory.rates.find((rate) => !rate.country || rate.country === country) : void 0;
827
828
  return {
828
829
  id: v4(),
829
830
  key: draft.key,
@@ -833,6 +834,7 @@ const createCustomLineItemFromDraft = (projectKey, draft, storage, country) => {
833
834
  quantity: draft.quantity ?? 1,
834
835
  state: [],
835
836
  taxCategory: taxCategoryRef,
837
+ taxRate,
836
838
  taxedPrice,
837
839
  custom: createCustomFields(draft.custom, projectKey, storage),
838
840
  discountedPricePerQuantity: [],
@@ -977,7 +979,7 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
977
979
  custom,
978
980
  priceMode,
979
981
  key
980
- }, this._storage, resource.country);
982
+ }, this._storage, resource.shippingAddress?.country ?? resource.country);
981
983
  resource.customLineItems.push(customLineItem);
982
984
  resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
983
985
  }
@@ -1279,7 +1281,7 @@ var CartRepository = class extends AbstractResourceRepository {
1279
1281
  key: draft.businessUnit.key
1280
1282
  });
1281
1283
  const lineItems = draft.lineItems?.map((draftLineItem) => this.draftLineItemtoLineItem(context.projectKey, draftLineItem, draft.currency, draft.country)) ?? [];
1282
- const customLineItems = draft.customLineItems?.map((draftCustomLineItem) => createCustomLineItemFromDraft(context.projectKey, draftCustomLineItem, this._storage, draft.country)) ?? [];
1284
+ const customLineItems = draft.customLineItems?.map((draftCustomLineItem) => createCustomLineItemFromDraft(context.projectKey, draftCustomLineItem, this._storage, draft.shippingAddress?.country ?? draft.country)) ?? [];
1283
1285
  const resource = {
1284
1286
  ...getBaseResourceProperties(),
1285
1287
  anonymousId: draft.anonymousId,