b2m-utils 0.0.240 → 0.0.243

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/build/index.js CHANGED
@@ -437,8 +437,8 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
437
437
  if (allFees && Array.isArray(allFees) && (allFees === null || allFees === void 0 ? void 0 : allFees.length) > 0) {
438
438
  var totalFromAllFees = filterSiblingFees(allFees).filter(function (i) { var _a; return ((_a = i.fee) === null || _a === void 0 ? void 0 : _a.id) !== fee_1.id; }).map(function (it) {
439
439
  var result = calculateFee(it, cte, allFees, debug, allFeesForCalc);
440
- if (result === null || result === void 0 ? void 0 : result.totalToCalc) {
441
- return result.totalToCalc;
440
+ if (result === null || result === void 0 ? void 0 : result.totalFee) {
441
+ return result.totalFee;
442
442
  }
443
443
  return 0;
444
444
  }, 0);
@@ -983,6 +983,28 @@ var getFilteredFeesToAudit = function (_a) {
983
983
  }
984
984
  return true;
985
985
  });
986
+ // Garantir que ICMS sempre esteja presente
987
+ var hasIcms = uniqueFees === null || uniqueFees === void 0 ? void 0 : uniqueFees.some(function (fee) { return fee.feeId === exports.FeeEnum.ICMS; });
988
+ if (!hasIcms) {
989
+ // Adicionar ICMS com valor 0 se não existir
990
+ uniqueFees === null || uniqueFees === void 0 ? void 0 : uniqueFees.push({
991
+ id: 0,
992
+ laneId: lane.id,
993
+ feeId: exports.FeeEnum.ICMS,
994
+ value: 0,
995
+ currencyId: null,
996
+ minKm: null,
997
+ maxKm: null,
998
+ minWeight: null,
999
+ maxWeight: null,
1000
+ vehicleTypeId: null,
1001
+ fee: {
1002
+ id: exports.FeeEnum.ICMS,
1003
+ name: 'ICMS',
1004
+ parentId: null,
1005
+ },
1006
+ });
1007
+ }
986
1008
  return uniqueFees;
987
1009
  };
988
1010
 
package/build/index.js.gz CHANGED
Binary file