b2m-utils 0.0.207 → 0.0.209
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.esm.js +7 -10
- package/build/index.esm.js.gz +0 -0
- package/build/index.esm.js.map +1 -1
- package/build/index.js +7 -10
- package/build/index.js.gz +0 -0
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.esm.js
CHANGED
|
@@ -371,9 +371,9 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
371
371
|
var firstTotal = +totalValueFromAllFees / +valueToDivide;
|
|
372
372
|
var total = +firstTotal * +value;
|
|
373
373
|
var totalValueFromAllFeesCurrency = convertNumberToCurrency(+totalValueFromAllFees, 'pt-br');
|
|
374
|
-
var
|
|
375
|
-
totalFee = Number(
|
|
376
|
-
totalToCalc = Number(
|
|
374
|
+
var truncatedTo3Decimals_1 = Math.floor(total * 1000) / 1000;
|
|
375
|
+
totalFee = Number(truncatedTo3Decimals_1.toFixed(2));
|
|
376
|
+
totalToCalc = Number(truncatedTo3Decimals_1.toFixed(2));
|
|
377
377
|
var resultCurrency = (+totalToCalc).toLocaleString('pt-BR', {
|
|
378
378
|
style: 'currency',
|
|
379
379
|
currency: 'BRL',
|
|
@@ -503,17 +503,12 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
503
503
|
return ((_a = fee.fee) === null || _a === void 0 ? void 0 : _a.id) === ((_b = ratecardLaneFee.fee) === null || _b === void 0 ? void 0 : _b.id) &&
|
|
504
504
|
fee.maxWeight &&
|
|
505
505
|
(cte === null || cte === void 0 ? void 0 : cte.taxedWeight) &&
|
|
506
|
-
fee.maxWeight < cte.taxedWeight;
|
|
506
|
+
+fee.maxWeight < +cte.taxedWeight;
|
|
507
507
|
});
|
|
508
508
|
// Ordenar pelo maxWeight do maior para o menor
|
|
509
509
|
feesWithMaxWeight === null || feesWithMaxWeight === void 0 ? void 0 : feesWithMaxWeight.sort(function (a, b) { return b.maxWeight - a.maxWeight; });
|
|
510
510
|
// Pegar o primeiro (maior maxWeight)
|
|
511
511
|
var highestIntervalFee = feesWithMaxWeight === null || feesWithMaxWeight === void 0 ? void 0 : feesWithMaxWeight[0];
|
|
512
|
-
console.log({
|
|
513
|
-
feesWithMaxWeight: feesWithMaxWeight,
|
|
514
|
-
highestIntervalFee: highestIntervalFee,
|
|
515
|
-
allFeesForCalc: allFeesForCalc,
|
|
516
|
-
});
|
|
517
512
|
if (highestIntervalFee) {
|
|
518
513
|
// Calcula baseado na taxa do intervalo mais alto que tem maxWeight
|
|
519
514
|
var total_4 = +highestIntervalFee.value;
|
|
@@ -652,7 +647,9 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
652
647
|
}*/
|
|
653
648
|
}
|
|
654
649
|
}
|
|
655
|
-
totalToCalc = totalFee;
|
|
650
|
+
// totalToCalc = totalFee;
|
|
651
|
+
var truncatedTo3Decimals = Math.floor(+totalFee * 1000) / 1000;
|
|
652
|
+
totalToCalc = Number(truncatedTo3Decimals.toFixed(2));
|
|
656
653
|
if (fee_1.parentId) {
|
|
657
654
|
var siblingFees = allFees === null || allFees === void 0 ? void 0 : allFees.filter(function (i) { var _a, _b; return ((_a = i.fee) === null || _a === void 0 ? void 0 : _a.parentId) === fee_1.parentId && ((_b = i.fee) === null || _b === void 0 ? void 0 : _b.id) !== fee_1.id; });
|
|
658
655
|
if (siblingFees && (siblingFees === null || siblingFees === void 0 ? void 0 : siblingFees.length) > 0) {
|
package/build/index.esm.js.gz
CHANGED
|
Binary file
|