b2m-utils 0.0.182 → 0.0.184

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
@@ -113,7 +113,7 @@ exports.FeeEnum = void 0;
113
113
  FeeEnum[FeeEnum["TDE_FREIGHT"] = 91] = "TDE_FREIGHT";
114
114
  FeeEnum[FeeEnum["TDE_MIN"] = 92] = "TDE_MIN";
115
115
  FeeEnum[FeeEnum["TRT_FREIGHT"] = 93] = "TRT_FREIGHT";
116
- FeeEnum[FeeEnum["TRT_MIN"] = 93] = "TRT_MIN";
116
+ FeeEnum[FeeEnum["TRT_MIN"] = 94] = "TRT_MIN";
117
117
  FeeEnum[FeeEnum["ICMS"] = 95] = "ICMS";
118
118
  FeeEnum[FeeEnum["SCHEDULING_TAX"] = 108] = "SCHEDULING_TAX";
119
119
  FeeEnum[FeeEnum["COLLECT_COMMODITY_VALUE"] = 136] = "COLLECT_COMMODITY_VALUE";
@@ -6959,19 +6959,31 @@ var getFilteredFeesToAudit = function (_a) {
6959
6959
  };
6960
6960
 
6961
6961
  var getLaneFromRatecard = function (cte) {
6962
- var _a, _b;
6962
+ var _a, _b, _c, _d;
6963
6963
  var ratecard = getRatecardFromCte(cte);
6964
6964
  var cityOriginId = cte.cityOriginId, cityDestination = cte.cityDestination;
6965
6965
  var destinationUf = (_a = cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.state) === null || _a === void 0 ? void 0 : _a.uf;
6966
6966
  if ((ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardLane) && ((_b = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardLane) === null || _b === void 0 ? void 0 : _b.length) > 0 && cityOriginId && destinationUf) {
6967
- var lane = ratecard.RatecardLane.find(function (i) {
6968
- if (i.cityOriginId === cte.cityOriginId && i.ufDestination === destinationUf) {
6969
- return true;
6970
- }
6971
- return false;
6967
+ // Primeiro, buscar rota direta (Origem -> Destino)
6968
+ var directLane = ratecard.RatecardLane.find(function (i) {
6969
+ return i.cityOriginId === cityOriginId && i.ufDestination === destinationUf;
6972
6970
  });
6973
- return lane;
6971
+ if (directLane) {
6972
+ return directLane;
6973
+ }
6974
+ // Se não encontrar rota direta, buscar rota inversa (Destino -> Origem)
6975
+ // Para isso, precisamos encontrar a UF da origem
6976
+ var originUf_1 = (_d = (_c = cte.cityOrigin) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.uf;
6977
+ if (originUf_1) {
6978
+ var reverseLane = ratecard.RatecardLane.find(function (i) {
6979
+ return i.cityOriginId === (cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.id) && i.ufDestination === originUf_1;
6980
+ });
6981
+ if (reverseLane) {
6982
+ return reverseLane;
6983
+ }
6984
+ }
6974
6985
  }
6986
+ return undefined;
6975
6987
  };
6976
6988
 
6977
6989
  var getNormalizedCityName = function (name) {
package/build/index.js.gz CHANGED
Binary file