b2m-utils 0.0.245 → 0.0.247

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.
@@ -883,7 +883,7 @@ var getFilteredFeesToAudit = function (_a) {
883
883
  var _b;
884
884
  var lane = _a.lane, ratecard = _a.ratecard, cte = _a.cte;
885
885
  var filteredFees = (_b = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _b === void 0 ? void 0 : _b.filter(function (i) {
886
- var _a, _b, _c, _d, _e, _f, _g, _h;
886
+ var _a, _b, _c, _d, _e, _f, _g;
887
887
  var defaultConditionalFees = [
888
888
  FeeEnum.SUFRAMA,
889
889
  FeeEnum.TDA_FREIGHT,
@@ -951,34 +951,15 @@ var getFilteredFeesToAudit = function (_a) {
951
951
  }
952
952
  }
953
953
  }
954
- else if (i.minWeight) {
954
+ else if (i.minWeight || i.maxWeight) {
955
955
  if (cte === null || cte === void 0 ? void 0 : cte.taxedWeight) {
956
- var ceiledWeight = Math.ceil(+cte.taxedWeight);
957
- console.log('[getFilteredFeesToAudit] Verificando fee por peso:', {
958
- feeName: (_h = i.fee) === null || _h === void 0 ? void 0 : _h.name,
959
- feeId: i.feeId,
960
- minWeight: i.minWeight,
961
- maxWeight: i.maxWeight,
962
- cteTaxedWeight: cte.taxedWeight,
963
- ceiledWeight: ceiledWeight,
964
- passedMinCheck: ceiledWeight >= +i.minWeight,
965
- passedMaxCheck: i.maxWeight ? ceiledWeight <= +i.maxWeight : 'sem maxWeight',
966
- });
967
- if (ceiledWeight >= +i.minWeight) {
968
- if (ceiledWeight <= +i.maxWeight) {
969
- console.log('[getFilteredFeesToAudit] ✅ Fee aprovada (dentro do intervalo)');
956
+ if (Math.ceil(+cte.taxedWeight) >= +i.minWeight) {
957
+ if (Math.ceil(+cte.taxedWeight) <= +i.maxWeight) {
970
958
  return true;
971
959
  }
972
960
  else if (!i.maxWeight) {
973
- console.log('[getFilteredFeesToAudit] ✅ Fee aprovada (excedente)');
974
961
  return true;
975
962
  }
976
- else {
977
- console.log('[getFilteredFeesToAudit] ❌ Fee rejeitada (peso excede maxWeight)');
978
- }
979
- }
980
- else {
981
- console.log('[getFilteredFeesToAudit] ❌ Fee rejeitada (peso menor que minWeight)');
982
963
  }
983
964
  }
984
965
  }
@@ -987,18 +968,10 @@ var getFilteredFeesToAudit = function (_a) {
987
968
  }
988
969
  return false;
989
970
  });
990
- console.log('[getFilteredFeesToAudit] Fees após filtro inicial:', filteredFees === null || filteredFees === void 0 ? void 0 : filteredFees.length);
991
971
  // Remover fees duplicadas, mantendo apenas uma ocorrência de cada feeId
992
972
  var seenFeeIds = new Set();
993
973
  var uniqueFees = filteredFees === null || filteredFees === void 0 ? void 0 : filteredFees.filter(function (fee) {
994
- var _a;
995
974
  if (fee.feeId && seenFeeIds.has(fee.feeId)) {
996
- console.log('[getFilteredFeesToAudit] ⚠️ Fee duplicada removida:', {
997
- feeName: (_a = fee.fee) === null || _a === void 0 ? void 0 : _a.name,
998
- feeId: fee.feeId,
999
- minWeight: fee.minWeight,
1000
- maxWeight: fee.maxWeight,
1001
- });
1002
975
  return false;
1003
976
  }
1004
977
  if (fee.feeId) {
@@ -1006,7 +979,6 @@ var getFilteredFeesToAudit = function (_a) {
1006
979
  }
1007
980
  return true;
1008
981
  });
1009
- console.log('[getFilteredFeesToAudit] Fees após remoção de duplicatas:', uniqueFees === null || uniqueFees === void 0 ? void 0 : uniqueFees.length);
1010
982
  // Garantir que ICMS sempre esteja presente
1011
983
  var hasIcms = uniqueFees === null || uniqueFees === void 0 ? void 0 : uniqueFees.some(function (fee) { return fee.feeId === FeeEnum.ICMS; });
1012
984
  if (!hasIcms) {
@@ -1029,7 +1001,6 @@ var getFilteredFeesToAudit = function (_a) {
1029
1001
  },
1030
1002
  });
1031
1003
  }
1032
- console.log('[getFilteredFeesToAudit] Fees finais retornadas:', uniqueFees === null || uniqueFees === void 0 ? void 0 : uniqueFees.length);
1033
1004
  return uniqueFees;
1034
1005
  };
1035
1006
 
Binary file