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.
package/build/index.js CHANGED
@@ -359,7 +359,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
359
359
  switch (fee_1.id) {
360
360
  case exports.FeeEnum.ICMS:
361
361
  if (allFees && Array.isArray(allFees) && (allFees === null || allFees === void 0 ? void 0 : allFees.length) > 0) {
362
- var totalFromAllFees = filterSiblingFees(allFees).filter(function (i) { var _a; return ((_a = i.fee) === null || _a === void 0 ? void 0 : _a.feeCalculationTypeId) !== exports.FeeCalculationTypeEnum.TOTAL_PERCENTAGE; }).map(function (it) {
362
+ 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) {
363
363
  var result = calculateFee(it, cte, allFees, debug, allFeesForCalc);
364
364
  if (result === null || result === void 0 ? void 0 : result.totalToCalc) {
365
365
  return result.totalToCalc;
@@ -442,8 +442,8 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
442
442
  validValues: totalFromAllFees.filter(function (i) { return !isNaN(+i) && +i > 0; })
443
443
  });
444
444
  if (totalValueFromAllFees && !isNaN(+totalValueFromAllFees)) {
445
- var valueToMultiply = (1 - value);
446
- var total_1 = +totalValueFromAllFees * (valueToMultiply / 100);
445
+ var valueToMultiply = (+value / 100);
446
+ var total_1 = +totalValueFromAllFees * valueToMultiply;
447
447
  console.log('🧮 TOTAL_PERCENTAGE - Cálculo final:', {
448
448
  totalValueFromAllFees: totalValueFromAllFees,
449
449
  valueToMultiply: valueToMultiply,
@@ -462,7 +462,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
462
462
  style: 'currency',
463
463
  currency: 'BRL',
464
464
  });
465
- var result_1 = "".concat(totalValueFromAllFeesCurrency, " x ").concat(valueToMultiply, "%").concat(redeliveryInfo_1, " = ").concat(resultCurrency_1);
465
+ var result_1 = "".concat(totalValueFromAllFeesCurrency, " x ").concat(+value, "%").concat(redeliveryInfo_1, " = ").concat(resultCurrency_1);
466
466
  totalFee = total_1;
467
467
  resultFee = result_1;
468
468
  }
package/build/index.js.gz CHANGED
Binary file