diff --git a/app/src/main/java/com/mob/utsmyanmar/ui/input_amount/InputAmountScreen.kt b/app/src/main/java/com/mob/utsmyanmar/ui/input_amount/InputAmountScreen.kt index 66b6b93..016d225 100644 --- a/app/src/main/java/com/mob/utsmyanmar/ui/input_amount/InputAmountScreen.kt +++ b/app/src/main/java/com/mob/utsmyanmar/ui/input_amount/InputAmountScreen.kt @@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.rounded.ArrowBack import androidx.compose.material.icons.rounded.Backspace import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults @@ -55,7 +56,7 @@ fun InputAmount( val supportingText = "Enter the amount to continue" Scaffold( - topBar = { AppBar(title = "Amount") }, + topBar = { AppBar(title = "Amount", icon = Icons.AutoMirrored.Rounded.ArrowBack, onIconClick = onBackClick) }, containerColor = Color.IvoryBeige ) {paddingValues -> @@ -162,7 +163,7 @@ fun InputAmount( horizontalArrangement = Arrangement.spacedBy(12.dp) ) { Button( - onClick = {}, + onClick = onBackClick, modifier = Modifier .weight(1f) .height(56.dp), diff --git a/app/src/main/java/com/mob/utsmyanmar/utils/tms/TMSSetupsImpl.kt b/app/src/main/java/com/mob/utsmyanmar/utils/tms/TMSSetupsImpl.kt index e340302..3afbef5 100644 --- a/app/src/main/java/com/mob/utsmyanmar/utils/tms/TMSSetupsImpl.kt +++ b/app/src/main/java/com/mob/utsmyanmar/utils/tms/TMSSetupsImpl.kt @@ -91,47 +91,47 @@ class TMSSetupsImpl : TMSSetups { siriusResponse.address.takeIf { it.isNotEmpty() }?.let { ops.merchantAddress = it } //host - if (siriusHosts.isNotEmpty()) { + if (!siriusHosts.isNullOrEmpty()) { for (host in siriusHosts) { val isMMQR = listOf(host.name, host.description).any { - it.lowercase().run { contains("mmqr") } + it?.lowercase()?.contains("mmqr") == true } if (isMMQR) { - ops.secHostName = host.name - ops.secHostTerminalId = host.tid - ops.secHostMerchantId = host.mid + ops.secHostName = host.name.orEmpty() + ops.secHostTerminalId = host.tid.orEmpty() + ops.secHostMerchantId = host.mid.orEmpty() - host.secondaryIP.trim().let { ip -> + host.secondaryIP?.trim()?.let { ip -> ops.secHostIpAddress = if (ip.contains(":")) "$ip/" else "" } - host.currency.takeIf { it.isNotEmpty() }?.let { + host.currency?.takeIf { it.isNotEmpty() }?.let { ops.secHostCurrency = currencyTextToCode(it) } - if (host.tid.isEmpty()) ops.secHostTerminalId = "" - if (host.mid.isEmpty()) ops.secHostTerminalId = "" + if (host.tid.isNullOrEmpty()) ops.secHostTerminalId = "" + if (host.mid.isNullOrEmpty()) ops.secHostTerminalId = "" } else { - ops.hostName = host.name - ops.terminalId = host.tid - ops.merchantId = host.mid + ops.hostName = host.name.orEmpty() + ops.terminalId = host.tid.orEmpty() + ops.merchantId = host.mid.orEmpty() - host.primaryIP.trim().let { ip -> + host.primaryIP?.trim()?.let { ip -> ops.ipAddress = if (ip.contains(":")) ip else "" } - host.secondaryIP.trim().let { ip -> + host.secondaryIP?.trim()?.let { ip -> ops.secIpAddress = if (ip.contains(":")) ip else "" } - host.currency.takeIf { it.isNotEmpty() }?.let { + host.currency?.takeIf { it.isNotEmpty() }?.let { ops.currencyType = currencyTextToCurrencyType(it) } - if (host.tid.isEmpty()) ops.terminalId = "" - if (host.mid.isEmpty()) ops.merchantId = "" + if (host.tid.isNullOrEmpty()) ops.terminalId = "" + if (host.mid.isNullOrEmpty()) ops.merchantId = "" } } } //Properties - for (prop in siriusProperty) { + for (prop in siriusProperty.orEmpty()) { val name = prop.name val data = prop.property