@shushed/helpers 0.0.200-bug-erp-727-20251126135653 → 0.0.200-bug-erp-727-20251126163513

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -110915,12 +110915,7 @@ function transformMasterOrder(payload) {
110915
110915
  const discountAmountRaw = Number(line.line_discount_amount || 0);
110916
110916
  let discountNet = 0;
110917
110917
  let discountGross = 0;
110918
- if (discountPercent > 0) {
110919
- if (netTotal > 0) discountNet = netTotal * discountPercent / 100;
110920
- if (grossTotal > 0) discountGross = grossTotal * discountPercent / 100;
110921
- if (grossTotal === 0 && discountNet > 0 && vatRate > 0) discountGross = discountNet * (1 + vatRate);
110922
- if (netTotal === 0 && discountGross > 0 && vatRate > 0) discountNet = discountGross / (1 + vatRate);
110923
- } else if (discountAmountRaw > 0) {
110918
+ if (discountAmountRaw > 0) {
110924
110919
  if (headerPricesInclVat) {
110925
110920
  discountGross = discountAmountRaw;
110926
110921
  discountNet = vatRate > 0 ? discountGross / (1 + vatRate) : discountGross;
@@ -110928,6 +110923,11 @@ function transformMasterOrder(payload) {
110928
110923
  discountNet = discountAmountRaw;
110929
110924
  discountGross = vatRate > 0 ? discountNet * (1 + vatRate) : discountNet;
110930
110925
  }
110926
+ } else if (discountPercent > 0) {
110927
+ if (netTotal > 0) discountNet = netTotal * discountPercent / 100;
110928
+ if (grossTotal > 0) discountGross = grossTotal * discountPercent / 100;
110929
+ if (grossTotal === 0 && discountNet > 0 && vatRate > 0) discountGross = discountNet * (1 + vatRate);
110930
+ if (netTotal === 0 && discountGross > 0 && vatRate > 0) discountNet = discountGross / (1 + vatRate);
110931
110931
  }
110932
110932
  const take = Math.min(shippedRemainingBySku[sku] || 0, quantity);
110933
110933
  const remaining = quantity - take;
@@ -111304,7 +111304,7 @@ function transformMasterOrder(payload) {
111304
111304
  const any = g.entries[0] || {};
111305
111305
  const pm = mapPaymentMethod(any.payment_method_code, any);
111306
111306
  const transaction_id = any.transaction_id || `${erp_order_id}-PAY-${i + 1}`;
111307
- const psp_reference = any.psp_reference || `${erp_order_id}-PSP-${i + 1}`;
111307
+ const psp_reference = any.psp_reference || transaction_id;
111308
111308
  const created_by = "CUSTOMER";
111309
111309
  const journey_label = journeyFromCreatedBy(invoice0?.created_by || sale0?.created_by);
111310
111310
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shushed/helpers",
3
- "version": "0.0.200-bug-erp-727-20251126135653",
3
+ "version": "0.0.200-bug-erp-727-20251126163513",
4
4
  "author": "",
5
5
  "license": "UNLICENSED",
6
6
  "description": "",