NTP-39209 | Narayan | Fixed string locale issue on formatting (#15046)
This commit is contained in:
committed by
GitHub
parent
df70aacd3a
commit
3b17d3a4ff
@@ -55,6 +55,7 @@ import com.navi.pay.utils.UPI_LITE_MANDATE_EXECUTION_SUCCESS
|
||||
import com.navi.pay.utils.toPlainAmount
|
||||
import com.navi.pay.utils.value
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import java.util.Locale
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -501,7 +502,11 @@ constructor(
|
||||
private fun mapToMandateEntity(notificationData: HashMap<String, String>): MandateEntity {
|
||||
val formattedAmount =
|
||||
try {
|
||||
String.format("%.2f", notificationData["amount"].toString().toDoubleOrNull() ?: 0.0)
|
||||
String.format(
|
||||
locale = Locale.US,
|
||||
"%.2f",
|
||||
notificationData["amount"].toString().toDoubleOrNull() ?: 0.0,
|
||||
)
|
||||
} catch (_: Exception) {
|
||||
"0.00"
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ import com.navi.pay.common.viewmodel.NaviPayBaseVM
|
||||
import com.navi.pay.management.common.sendmoney.model.view.SendMoneyScreenSource
|
||||
import java.math.BigDecimal
|
||||
import java.math.RoundingMode
|
||||
import java.util.Locale
|
||||
import kotlin.math.roundToInt
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
@@ -122,7 +123,7 @@ fun String.getFormattedAmountWithDecimal(): String {
|
||||
if (amount.isNotBlank()) {
|
||||
val numericValue = amount.toDoubleOrNull()
|
||||
if (numericValue != null) {
|
||||
amount = String.format("%.2f", numericValue)
|
||||
amount = String.format(locale = Locale.US, "%.2f", numericValue)
|
||||
}
|
||||
}
|
||||
return amount
|
||||
|
||||
Reference in New Issue
Block a user