NTP-7235 | PS | fixed round off crash (#13297)

This commit is contained in:
Prakhar Saxena
2024-10-23 12:56:54 +05:30
committed by GitHub
parent b45124f380
commit 2b0ba0867e

View File

@@ -28,6 +28,8 @@ import com.navi.payment.nativepayment.model.WebPaymentData
import com.navi.payment.paymentscreen.model.TransactionStatus
import com.navi.payment.utils.PaymentErrorConstants.TOKEN_INIT_FAILED
import com.navi.paymentclients.model.thirdparty.UpiResultErrorResponse
import java.math.BigDecimal
import java.math.RoundingMode
import org.json.JSONArray
import org.json.JSONObject
@@ -146,7 +148,7 @@ fun PaymentMethods.toCashFreePaymentMethod() =
}
fun Double.roundTo(decimals: Int): Double {
return "%.${decimals}f".format(this).toDouble()
return BigDecimal(this).setScale(decimals, RoundingMode.HALF_UP).toDouble()
}
suspend fun ModalBottomSheetState.showSheet() {