Skip to content

Commit ac4d12e

Browse files
committed
Replace getDecimalPlaces with library
1 parent 6f44a46 commit ac4d12e

1 file changed

Lines changed: 2 additions & 31 deletions

File tree

adyenv6core/src/com/adyen/v6/util/AmountUtil.java

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import java.math.BigDecimal;
99
import java.math.RoundingMode;
1010

11+
import static com.adyen.util.Util.getDecimalPlaces;
12+
1113
public class AmountUtil {
1214

1315
public static Amount createAmount(BigDecimal value, String currency) {
@@ -20,37 +22,6 @@ public static Amount createAmount(BigDecimal value, String currency) {
2022
return amount;
2123
}
2224

23-
public static int getDecimalPlaces(String currency) {
24-
switch (currency) {
25-
case "CVE":
26-
case "DJF":
27-
case "GNF":
28-
case "IDR":
29-
case "JPY":
30-
case "KMF":
31-
case "KRW":
32-
case "PYG":
33-
case "RWF":
34-
case "UGX":
35-
case "VND":
36-
case "VUV":
37-
case "XAF":
38-
case "XOF":
39-
case "XPF":
40-
return 0;
41-
case "BHD":
42-
case "IQD":
43-
case "JOD":
44-
case "KWD":
45-
case "LYD":
46-
case "OMR":
47-
case "TND":
48-
return 3;
49-
default:
50-
return 2;
51-
}
52-
}
53-
5425
public static BigDecimal calculateAmountWithTaxes(final AbstractOrderModel abstractOrderModel) {
5526
final Double totalPrice = abstractOrderModel.getTotalPrice();
5627
final Double totalTax = Boolean.TRUE.equals(abstractOrderModel.getNet()) ? abstractOrderModel.getTotalTax() : Double.valueOf(0d);

0 commit comments

Comments
 (0)