b2m-utils 0.0.194 → 0.0.196

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.
@@ -355,7 +355,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
355
355
  switch (fee_1.id) {
356
356
  case FeeEnum.ICMS:
357
357
  if (allFees && Array.isArray(allFees) && (allFees === null || allFees === void 0 ? void 0 : allFees.length) > 0) {
358
- var totalFromAllFees = filterSiblingFees(allFees).filter(function (i) { var _a; return ((_a = i.fee) === null || _a === void 0 ? void 0 : _a.feeCalculationTypeId) !== FeeCalculationTypeEnum.TOTAL_PERCENTAGE; }).map(function (it) {
358
+ 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) {
359
359
  var result = calculateFee(it, cte, allFees, debug, allFeesForCalc);
360
360
  if (result === null || result === void 0 ? void 0 : result.totalToCalc) {
361
361
  return result.totalToCalc;
@@ -438,8 +438,8 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
438
438
  validValues: totalFromAllFees.filter(function (i) { return !isNaN(+i) && +i > 0; })
439
439
  });
440
440
  if (totalValueFromAllFees && !isNaN(+totalValueFromAllFees)) {
441
- var valueToMultiply = (1 - value);
442
- var total_1 = +totalValueFromAllFees * (valueToMultiply / 100);
441
+ var valueToMultiply = (+value / 100);
442
+ var total_1 = +totalValueFromAllFees * valueToMultiply;
443
443
  console.log('🧮 TOTAL_PERCENTAGE - Cálculo final:', {
444
444
  totalValueFromAllFees: totalValueFromAllFees,
445
445
  valueToMultiply: valueToMultiply,
@@ -458,7 +458,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
458
458
  style: 'currency',
459
459
  currency: 'BRL',
460
460
  });
461
- var result_1 = "".concat(totalValueFromAllFeesCurrency, " x ").concat(valueToMultiply, "%").concat(redeliveryInfo_1, " = ").concat(resultCurrency_1);
461
+ var result_1 = "".concat(totalValueFromAllFeesCurrency, " x ").concat(+value, "%").concat(redeliveryInfo_1, " = ").concat(resultCurrency_1);
462
462
  totalFee = total_1;
463
463
  resultFee = result_1;
464
464
  }
Binary file