b2m-utils 0.0.268 → 0.0.270
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/enums/FeeCalculationTypeEnum.d.ts +2 -1
- package/build/enums/FeeEnum.d.ts +4 -1
- package/build/index.esm.js +32 -10
- package/build/index.esm.js.gz +0 -0
- package/build/index.esm.js.map +1 -1
- package/build/index.js +32 -10
- package/build/index.js.gz +0 -0
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -148,6 +148,7 @@ exports.FeeCalculationTypeEnum = void 0;
|
|
|
148
148
|
FeeCalculationTypeEnum[FeeCalculationTypeEnum["TOTAL_PERCENTAGE"] = 9] = "TOTAL_PERCENTAGE";
|
|
149
149
|
FeeCalculationTypeEnum[FeeCalculationTypeEnum["MIN_VALUE"] = 10] = "MIN_VALUE";
|
|
150
150
|
FeeCalculationTypeEnum[FeeCalculationTypeEnum["SUM_CONTAINERS"] = 11] = "SUM_CONTAINERS";
|
|
151
|
+
FeeCalculationTypeEnum[FeeCalculationTypeEnum["VOLUMES_QUANTITY"] = 12] = "VOLUMES_QUANTITY";
|
|
151
152
|
})(exports.FeeCalculationTypeEnum || (exports.FeeCalculationTypeEnum = {}));
|
|
152
153
|
|
|
153
154
|
exports.FeeCategoryEnum = void 0;
|
|
@@ -185,6 +186,9 @@ exports.FeeEnum = void 0;
|
|
|
185
186
|
FeeEnum[FeeEnum["COLLECT"] = 151] = "COLLECT";
|
|
186
187
|
FeeEnum[FeeEnum["COLLECT_PERCENTAGE_TOTAL"] = 152] = "COLLECT_PERCENTAGE_TOTAL";
|
|
187
188
|
FeeEnum[FeeEnum["COLLECT_REVERSE_PERCENTAGE_TOTAL"] = 153] = "COLLECT_REVERSE_PERCENTAGE_TOTAL";
|
|
189
|
+
FeeEnum[FeeEnum["TRT_PERCENTAGE_TOTAL"] = 169] = "TRT_PERCENTAGE_TOTAL";
|
|
190
|
+
FeeEnum[FeeEnum["TDA_PERCENTAGE_TOTAL"] = 170] = "TDA_PERCENTAGE_TOTAL";
|
|
191
|
+
FeeEnum[FeeEnum["TDE_PERCENTAGE_TOTAL"] = 171] = "TDE_PERCENTAGE_TOTAL";
|
|
188
192
|
})(exports.FeeEnum || (exports.FeeEnum = {}));
|
|
189
193
|
|
|
190
194
|
exports.FreightRegionEnum = void 0;
|
|
@@ -524,7 +528,7 @@ var filterSiblingFees = function (fees) {
|
|
|
524
528
|
};
|
|
525
529
|
|
|
526
530
|
var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCalc) {
|
|
527
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
531
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
528
532
|
if (debug === void 0) { debug = false; }
|
|
529
533
|
if (ratecardLaneFee.fee) {
|
|
530
534
|
// Buscar o ratecard correto do CTE usando getRatecardFromCte
|
|
@@ -600,7 +604,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
600
604
|
if (totalValueFromAllFees && !isNaN(+totalValueFromAllFees)) {
|
|
601
605
|
var valueToMultiply = (+value / 100);
|
|
602
606
|
var total_1 = +totalValueFromAllFees * valueToMultiply;
|
|
603
|
-
var
|
|
607
|
+
var _j = applyRedeliveryMultiplier(total_1, cte), adjustedTotal_1 = _j.adjustedTotal, redeliveryInfo_1 = _j.redeliveryInfo;
|
|
604
608
|
total_1 = adjustedTotal_1;
|
|
605
609
|
var totalValueFromAllFeesCurrency = convertNumberToCurrency(+totalValueFromAllFees, 'pt-br');
|
|
606
610
|
var resultCurrency_1 = (+total_1).toLocaleString('pt-BR', {
|
|
@@ -623,7 +627,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
623
627
|
var shouldApplyFraction = +cte.taxedWeight > minWeightForFraction;
|
|
624
628
|
var fractions = shouldApplyFraction ? Math.ceil(+cte.taxedWeight / 100) : 1;
|
|
625
629
|
var total_2 = fractions * value;
|
|
626
|
-
var
|
|
630
|
+
var _k = applyRedeliveryMultiplier(total_2, cte), adjustedTotal_2 = _k.adjustedTotal, redeliveryInfo_2 = _k.redeliveryInfo;
|
|
627
631
|
total_2 = adjustedTotal_2;
|
|
628
632
|
var valueCurrency_1 = (+value).toLocaleString('pt-br', {
|
|
629
633
|
style: 'currency',
|
|
@@ -644,7 +648,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
644
648
|
if (value && (cte === null || cte === void 0 ? void 0 : cte.freightValue)) {
|
|
645
649
|
if (!isNaN(+value) && !isNaN(+cte.freightValue)) {
|
|
646
650
|
var total_3 = +cte.freightValue * (+value / 100);
|
|
647
|
-
var
|
|
651
|
+
var _l = applyRedeliveryMultiplier(total_3, cte), adjustedTotal_3 = _l.adjustedTotal, redeliveryInfo_3 = _l.redeliveryInfo;
|
|
648
652
|
total_3 = adjustedTotal_3;
|
|
649
653
|
var freightValueCurrency = (+cte.freightValue).toLocaleString('pt-br', {
|
|
650
654
|
style: 'currency',
|
|
@@ -679,7 +683,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
679
683
|
case exports.FeeCalculationTypeEnum.MIN_VALUE:
|
|
680
684
|
case exports.FeeCalculationTypeEnum.FIXED:
|
|
681
685
|
var total = +value;
|
|
682
|
-
var
|
|
686
|
+
var _m = applyRedeliveryMultiplier(total, cte), adjustedTotal = _m.adjustedTotal, redeliveryInfo = _m.redeliveryInfo;
|
|
683
687
|
total = adjustedTotal;
|
|
684
688
|
var valueCurrency = (+value).toLocaleString('pt-br', {
|
|
685
689
|
style: 'currency',
|
|
@@ -731,7 +735,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
731
735
|
// Somar ao total
|
|
732
736
|
total_4 += additionalValue;
|
|
733
737
|
// Aplicar multiplicador de redelivery ao valor final
|
|
734
|
-
var
|
|
738
|
+
var _o = applyRedeliveryMultiplier(total_4, cte), adjustedTotal_4 = _o.adjustedTotal, redeliveryInfo_4 = _o.redeliveryInfo;
|
|
735
739
|
total_4 = adjustedTotal_4;
|
|
736
740
|
var valueCurrency_2 = (+highestIntervalFee.value).toLocaleString('pt-br', {
|
|
737
741
|
style: 'currency',
|
|
@@ -773,7 +777,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
773
777
|
// Somar ao total
|
|
774
778
|
total_5 += additionalValue;
|
|
775
779
|
// Aplicar multiplicador de redelivery ao valor final
|
|
776
|
-
var
|
|
780
|
+
var _p = applyRedeliveryMultiplier(total_5, cte), adjustedTotal_5 = _p.adjustedTotal, redeliveryInfo_5 = _p.redeliveryInfo;
|
|
777
781
|
total_5 = adjustedTotal_5;
|
|
778
782
|
var valueCurrency_3 = (+highestIntervalFee.value).toLocaleString('pt-br', {
|
|
779
783
|
style: 'currency',
|
|
@@ -793,7 +797,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
793
797
|
if (value) {
|
|
794
798
|
var commodityValue = (_d = cte === null || cte === void 0 ? void 0 : cte.commodityValue) !== null && _d !== void 0 ? _d : 0;
|
|
795
799
|
var total_6 = +commodityValue * (+value / 100);
|
|
796
|
-
var
|
|
800
|
+
var _q = applyRedeliveryMultiplier(total_6, cte), adjustedTotal_6 = _q.adjustedTotal, redeliveryInfo_6 = _q.redeliveryInfo;
|
|
797
801
|
total_6 = adjustedTotal_6;
|
|
798
802
|
var resultCurrency_6 = (+total_6).toLocaleString('pt-br', {
|
|
799
803
|
style: 'currency',
|
|
@@ -808,7 +812,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
808
812
|
if (value) {
|
|
809
813
|
var taxedWeight = (_e = cte === null || cte === void 0 ? void 0 : cte.taxedWeight) !== null && _e !== void 0 ? _e : 0;
|
|
810
814
|
var total_7 = +taxedWeight * +value;
|
|
811
|
-
var
|
|
815
|
+
var _r = applyRedeliveryMultiplier(total_7, cte), adjustedTotal_7 = _r.adjustedTotal, redeliveryInfo_7 = _r.redeliveryInfo;
|
|
812
816
|
total_7 = adjustedTotal_7;
|
|
813
817
|
var resultCurrency_7 = (+total_7).toLocaleString('pt-br', {
|
|
814
818
|
style: 'currency',
|
|
@@ -821,6 +825,21 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
821
825
|
resultFee = result_7;
|
|
822
826
|
}
|
|
823
827
|
break;
|
|
828
|
+
case exports.FeeCalculationTypeEnum.VOLUMES_QUANTITY:
|
|
829
|
+
if (value && (cte === null || cte === void 0 ? void 0 : cte.commodityVolumes)) {
|
|
830
|
+
var commodityVolumes = (_f = cte.commodityVolumes) !== null && _f !== void 0 ? _f : 0;
|
|
831
|
+
var total_8 = +commodityVolumes * +value;
|
|
832
|
+
var _s = applyRedeliveryMultiplier(total_8, cte), adjustedTotal_8 = _s.adjustedTotal, redeliveryInfo_8 = _s.redeliveryInfo;
|
|
833
|
+
total_8 = adjustedTotal_8;
|
|
834
|
+
var resultCurrency_8 = (+total_8).toLocaleString('pt-br', {
|
|
835
|
+
style: 'currency',
|
|
836
|
+
currency: 'BRL',
|
|
837
|
+
});
|
|
838
|
+
var result_8 = "".concat(commodityVolumes, " ").concat(commodityVolumes === 1 ? 'volume' : 'volumes', " x ").concat(convertNumberToCurrency(+value, 'pt-br')).concat(redeliveryInfo_8, " = ").concat(resultCurrency_8);
|
|
839
|
+
totalFee = total_8;
|
|
840
|
+
resultFee = result_8;
|
|
841
|
+
}
|
|
842
|
+
break;
|
|
824
843
|
/*if (ratecardLaneFee.minWeight && cte?.taxedWeight) {
|
|
825
844
|
|
|
826
845
|
if (+ratecardLaneFee.minWeight <= +cte.taxedWeight) {
|
|
@@ -923,7 +942,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
923
942
|
return 0;
|
|
924
943
|
});
|
|
925
944
|
if ((siblingFeesResults === null || siblingFeesResults === void 0 ? void 0 : siblingFeesResults.length) > 0) {
|
|
926
|
-
if (((
|
|
945
|
+
if (((_g = siblingFeesResults[0]) === null || _g === void 0 ? void 0 : _g.totalFee) && ((_h = siblingFeesResults[0]) === null || _h === void 0 ? void 0 : _h.totalFee) > totalFee) {
|
|
927
946
|
totalToCalc = 0;
|
|
928
947
|
}
|
|
929
948
|
}
|
|
@@ -1029,10 +1048,13 @@ var getFilteredFeesToAudit = function (_a) {
|
|
|
1029
1048
|
exports.FeeEnum.SUFRAMA,
|
|
1030
1049
|
exports.FeeEnum.TDA_FREIGHT,
|
|
1031
1050
|
exports.FeeEnum.TDA_MIN,
|
|
1051
|
+
exports.FeeEnum.TDA_PERCENTAGE_TOTAL,
|
|
1032
1052
|
exports.FeeEnum.TDE_FREIGHT,
|
|
1033
1053
|
exports.FeeEnum.TDE_MIN,
|
|
1054
|
+
exports.FeeEnum.TDE_PERCENTAGE_TOTAL,
|
|
1034
1055
|
exports.FeeEnum.TRT_FREIGHT,
|
|
1035
1056
|
exports.FeeEnum.TRT_MIN,
|
|
1057
|
+
exports.FeeEnum.TRT_PERCENTAGE_TOTAL,
|
|
1036
1058
|
exports.FeeEnum.RIVER_INSURANCE_COMMODITY_VALUE,
|
|
1037
1059
|
exports.FeeEnum.RIVER_INSURANCE_MIN_VALUE,
|
|
1038
1060
|
exports.FeeEnum.RIVER_REDISPATCH_COMMODITY_VALUE,
|
package/build/index.js.gz
CHANGED
|
Binary file
|