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