b2m-utils 0.0.221 → 0.0.223

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.
@@ -394,9 +394,12 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
394
394
  return +previous + +current;
395
395
  }, 0);
396
396
  if (totalValueFromAllFees && !isNaN(+totalValueFromAllFees)) {
397
- var valueToDivide = (1 - value).toFixed(2);
397
+ var icmsValue = (cte.icmsIncidence !== undefined && cte.icmsIncidence !== null && !isNaN(+cte.icmsIncidence))
398
+ ? cte.icmsIncidence / 100
399
+ : value;
400
+ var valueToDivide = (1 - icmsValue).toFixed(2);
398
401
  var firstTotal = +totalValueFromAllFees / +valueToDivide;
399
- var total = +firstTotal * +value;
402
+ var total = +firstTotal * +icmsValue;
400
403
  var totalValueFromAllFeesCurrency = convertNumberToCurrency(+totalValueFromAllFees, 'pt-br');
401
404
  var truncatedTo3Decimals_1 = Math.floor(total * 1000) / 1000;
402
405
  totalFee = Number(truncatedTo3Decimals_1.toFixed(2));
@@ -405,7 +408,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
405
408
  style: 'currency',
406
409
  currency: 'BRL',
407
410
  });
408
- var result = "(".concat(totalValueFromAllFeesCurrency, " / ").concat(valueToDivide, ") x ").concat(value, " = ").concat(resultCurrency);
411
+ var result = "(".concat(totalValueFromAllFeesCurrency, " / ").concat(valueToDivide, ") x ").concat(icmsValue, " = ").concat(resultCurrency);
409
412
  resultFee = result;
410
413
  }
411
414
  }
Binary file