NTP-7235 | PS | fixed round off crash (#13297)
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user