Skip to content

Commit 1d08cd1

Browse files
committed
Added hard check for no tariffs.
1 parent eb80aca commit 1d08cd1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/java/com/ubs/tariffapp/utils/DutyParser.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ public static DutyInfo parseDutyRates(String avRate, String specificRate) {
104104
DutyInfo info = new DutyInfo();
105105
info.originalSpecificDuty = specificRate != null ? specificRate.trim() : "";
106106

107+
// Check if both rates are empty or zero - treat as free duty (AD_VALOREM with 0%)
108+
boolean avIsZeroOrEmpty = avRate == null || avRate.trim().isEmpty() || avRate.trim().equals("0");
109+
boolean specificIsZeroOrEmpty = specificRate == null || specificRate.trim().isEmpty() ||
110+
specificRate.trim().equals("0") || specificRate.trim().equalsIgnoreCase("free");
111+
112+
if (avIsZeroOrEmpty && specificIsZeroOrEmpty) {
113+
info.dutyType = "AD_VALOREM";
114+
info.standardizedAVRate = 0.0;
115+
return info;
116+
}
117+
107118
// Check if there's already an AV rate
108119
boolean hasExistingAV = false;
109120
if (avRate != null && !avRate.trim().isEmpty()) {

0 commit comments

Comments
 (0)