Skip to content

Commit

Permalink
Replace getDecimalPlaces with library
Browse files Browse the repository at this point in the history
  • Loading branch information
kpieloch committed Oct 7, 2024
1 parent 6f44a46 commit ac4d12e
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions adyenv6core/src/com/adyen/v6/util/AmountUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.math.BigDecimal;
import java.math.RoundingMode;

import static com.adyen.util.Util.getDecimalPlaces;

public class AmountUtil {

public static Amount createAmount(BigDecimal value, String currency) {
Expand All @@ -20,37 +22,6 @@ public static Amount createAmount(BigDecimal value, String currency) {
return amount;
}

public static int getDecimalPlaces(String currency) {
switch (currency) {
case "CVE":
case "DJF":
case "GNF":
case "IDR":
case "JPY":
case "KMF":
case "KRW":
case "PYG":
case "RWF":
case "UGX":
case "VND":
case "VUV":
case "XAF":
case "XOF":
case "XPF":
return 0;
case "BHD":
case "IQD":
case "JOD":
case "KWD":
case "LYD":
case "OMR":
case "TND":
return 3;
default:
return 2;
}
}

public static BigDecimal calculateAmountWithTaxes(final AbstractOrderModel abstractOrderModel) {
final Double totalPrice = abstractOrderModel.getTotalPrice();
final Double totalTax = Boolean.TRUE.equals(abstractOrderModel.getNet()) ? abstractOrderModel.getTotalTax() : Double.valueOf(0d);
Expand Down

0 comments on commit ac4d12e

Please sign in to comment.