From 78dd4da2f2fdfbcf0d1fefc92697fbb4abb47f0d Mon Sep 17 00:00:00 2001 From: Viktoras Jegorovas Date: Fri, 1 Jun 2018 10:38:31 +0300 Subject: [PATCH] Checkout total number float point fix --- android/src/main/java/com/nextar/sumup/RNSumUpModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/nextar/sumup/RNSumUpModule.java b/android/src/main/java/com/nextar/sumup/RNSumUpModule.java index 5e3e301..20d67a4 100644 --- a/android/src/main/java/com/nextar/sumup/RNSumUpModule.java +++ b/android/src/main/java/com/nextar/sumup/RNSumUpModule.java @@ -138,7 +138,7 @@ public void checkout(ReadableMap request, Promise promise) { try { SumUpPayment.Currency currencyCode = this.getCurrency(request.getString("currencyCode")); SumUpPayment payment = SumUpPayment.builder() - .total(new BigDecimal(Double.parseDouble(request.getString("totalAmount")))) + .total(new BigDecimal(request.getString("totalAmount")).setScale(2, RoundingMode.HALF_EVEN)) .currency(currencyCode) .title(request.getString("title")) .foreignTransactionId(UUID.randomUUID().toString())