Compare commits
No commits in common. "c3faee2eb0966d28352f68a612fc1d3ad9b9ab0c" and "80594be6f965a0826a7c48fa3a5507684a2e4557" have entirely different histories.
c3faee2eb0
...
80594be6f9
@ -16,13 +16,14 @@ import com.utsmyanmar.ecr.ECRHelper
|
|||||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
||||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.channels.Channel
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
import kotlinx.coroutines.flow.receiveAsFlow
|
import kotlinx.coroutines.flow.receiveAsFlow
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import sunmi.sunmiui.utils.LogUtil
|
||||||
|
|
||||||
class CardWaitingViewModel(
|
class CardWaitingViewModel(
|
||||||
private val cardReadViewModel: CardReaderViewModel,
|
private val cardReadViewModel: CardReaderViewModel,
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
package com.mob.utsmyanmar.ui.dashboard
|
package com.mob.utsmyanmar.ui.dashboard
|
||||||
|
|
||||||
import androidx.compose.foundation.Image
|
|
||||||
import androidx.compose.foundation.layout.height
|
|
||||||
import androidx.compose.foundation.layout.size
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.AccountBalanceWallet
|
import androidx.compose.material.icons.filled.AccountBalanceWallet
|
||||||
import androidx.compose.material.icons.filled.CreditCard
|
import androidx.compose.material.icons.filled.CreditCard
|
||||||
@ -10,6 +7,7 @@ import androidx.compose.material.icons.filled.Lock
|
|||||||
import androidx.compose.material.icons.filled.LockOpen
|
import androidx.compose.material.icons.filled.LockOpen
|
||||||
import androidx.compose.material.icons.filled.Replay
|
import androidx.compose.material.icons.filled.Replay
|
||||||
import androidx.compose.material.icons.filled.SwapHoriz
|
import androidx.compose.material.icons.filled.SwapHoriz
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -17,7 +15,6 @@ import androidx.compose.ui.res.painterResource
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.mob.utsmyanmar.R
|
import com.mob.utsmyanmar.R
|
||||||
import com.mob.utsmyanmar.ui.theme.Color
|
import com.mob.utsmyanmar.ui.theme.Color
|
||||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
|
||||||
|
|
||||||
class DashboardMenuItem(
|
class DashboardMenuItem(
|
||||||
val title: String,
|
val title: String,
|
||||||
@ -25,209 +22,121 @@ class DashboardMenuItem(
|
|||||||
val onClick: () -> Unit
|
val onClick: () -> Unit
|
||||||
)
|
)
|
||||||
|
|
||||||
val settlementEnabled = false
|
|
||||||
val voidEnabled = true
|
|
||||||
val refundEnabled = true
|
|
||||||
val preAuthEnabled = true
|
|
||||||
val preAuthVoidEnabled = true
|
|
||||||
val preAuthCompleteEnabled = true
|
|
||||||
val preAuthCompleteVoidEnabled = true
|
|
||||||
val cashAdvEnabled = true
|
|
||||||
|
|
||||||
fun buildMenuItems(
|
fun buildMenuItems(
|
||||||
onNavigateAmount: (String) -> Unit,
|
onNavigateAmount: (String) -> Unit,
|
||||||
onNavigateSignOn: () -> Unit,
|
onNavigateSignOn: () -> Unit,
|
||||||
onNavigateSettlement: () -> Unit,
|
onNavigateSettlement: () -> Unit,
|
||||||
onNavigateHistory: () -> Unit,
|
onNavigateHistory: () -> Unit,
|
||||||
onNavigateAction: (String) -> Unit
|
onNavigateAction: (String) -> Unit
|
||||||
): List<DashboardMenuItem> = buildList {
|
): List<DashboardMenuItem> = listOf(
|
||||||
|
DashboardMenuItem(
|
||||||
val mmqrEnabled = SystemParamsOperation.getInstance().mmqrStatus
|
"Sale",
|
||||||
|
{
|
||||||
add(
|
Icon(
|
||||||
DashboardMenuItem(
|
painterResource(R.drawable.ic_terminal),
|
||||||
"Sale",
|
contentDescription = null,
|
||||||
{
|
modifier = Modifier.size(40.dp),
|
||||||
Icon(
|
tint = Color.LegacyRed
|
||||||
painterResource(R.drawable.ic_terminal),
|
)
|
||||||
contentDescription = null,
|
}) { onNavigateAmount("Sale") },
|
||||||
modifier = Modifier.size(40.dp),
|
DashboardMenuItem(
|
||||||
tint = Color.LegacyRed
|
"History",
|
||||||
)
|
{
|
||||||
}
|
Icon(
|
||||||
) { onNavigateAmount("Sale") }
|
painterResource(R.drawable.ic_history),
|
||||||
)
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(32.dp),
|
||||||
|
tint = Color.LegacyRed
|
||||||
if (mmqrEnabled) {
|
)
|
||||||
add(
|
}) { onNavigateHistory() },
|
||||||
DashboardMenuItem(
|
DashboardMenuItem(
|
||||||
"MMQR",
|
"Sign On",
|
||||||
{
|
{
|
||||||
Image(
|
Icon(
|
||||||
painter = painterResource(R.drawable.ic_mmqr_logo),
|
painterResource(R.drawable.ic_sign_on),
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier.height(48.dp)
|
modifier = Modifier.size(32.dp),
|
||||||
)
|
tint = Color.LegacyRed
|
||||||
}
|
)
|
||||||
) { }
|
}) { onNavigateSignOn() },
|
||||||
)
|
DashboardMenuItem(
|
||||||
}
|
"Settlement",
|
||||||
add(
|
{
|
||||||
DashboardMenuItem(
|
Icon(
|
||||||
"History",
|
painterResource(R.drawable.ic_settlement),
|
||||||
{
|
contentDescription = null,
|
||||||
Icon(
|
modifier = Modifier.size(32.dp),
|
||||||
painterResource(R.drawable.ic_history),
|
tint = Color.LegacyRed
|
||||||
contentDescription = null,
|
)
|
||||||
modifier = Modifier.size(32.dp),
|
}) { onNavigateSettlement() },
|
||||||
tint = Color.LegacyRed
|
DashboardMenuItem(
|
||||||
)
|
"Void",
|
||||||
}
|
{
|
||||||
) { onNavigateHistory() }
|
Icon(
|
||||||
)
|
Icons.Default.Lock,
|
||||||
|
contentDescription = null,
|
||||||
add(
|
modifier = Modifier.size(32.dp),
|
||||||
DashboardMenuItem(
|
tint = Color.LegacyRed
|
||||||
"Sign On",
|
)
|
||||||
{
|
}) { onNavigateAction("Void") },
|
||||||
Icon(
|
DashboardMenuItem(
|
||||||
painterResource(R.drawable.ic_sign_on),
|
"Refund",
|
||||||
contentDescription = null,
|
{
|
||||||
modifier = Modifier.size(32.dp),
|
Icon(
|
||||||
tint = Color.LegacyRed
|
Icons.Default.Replay,
|
||||||
)
|
contentDescription = null,
|
||||||
}
|
modifier = Modifier.size(32.dp),
|
||||||
) { onNavigateSignOn() }
|
tint = Color.LegacyRed
|
||||||
)
|
)
|
||||||
|
}) { onNavigateAction("Refund") },
|
||||||
if (settlementEnabled) {
|
DashboardMenuItem(
|
||||||
add(
|
"Pre-Auth",
|
||||||
DashboardMenuItem(
|
{
|
||||||
"Settlement",
|
Icon(
|
||||||
{
|
Icons.Default.Lock,
|
||||||
Icon(
|
contentDescription = null,
|
||||||
painterResource(R.drawable.ic_settlement),
|
modifier = Modifier.size(32.dp),
|
||||||
contentDescription = null,
|
tint = Color.LegacyRed
|
||||||
modifier = Modifier.size(32.dp),
|
)
|
||||||
tint = Color.LegacyRed
|
}) { onNavigateAmount("Pre-Auth") },
|
||||||
)
|
DashboardMenuItem(
|
||||||
}
|
"Pre-Auth Void",
|
||||||
) { onNavigateSettlement() }
|
{
|
||||||
)
|
Icon(
|
||||||
}
|
Icons.Default.LockOpen,
|
||||||
|
contentDescription = null,
|
||||||
if (voidEnabled) {
|
modifier = Modifier.size(32.dp),
|
||||||
add(
|
tint = Color.LegacyRed
|
||||||
DashboardMenuItem(
|
)
|
||||||
"Void",
|
}) { onNavigateAction("Pre-Auth Void") },
|
||||||
{
|
DashboardMenuItem(
|
||||||
Icon(
|
"Pre-Auth Complete",
|
||||||
Icons.Default.Lock,
|
{
|
||||||
contentDescription = null,
|
Icon(
|
||||||
modifier = Modifier.size(32.dp),
|
Icons.Default.CreditCard,
|
||||||
tint = Color.LegacyRed
|
contentDescription = null,
|
||||||
)
|
modifier = Modifier.size(32.dp),
|
||||||
}
|
tint = Color.LegacyRed
|
||||||
) { onNavigateAction("Void") }
|
)
|
||||||
)
|
}) { onNavigateAction("Pre-Auth Complete") },
|
||||||
}
|
DashboardMenuItem(
|
||||||
|
"Pre-Auth Comp Void",
|
||||||
if (refundEnabled) {
|
{
|
||||||
add(
|
Icon(
|
||||||
DashboardMenuItem(
|
Icons.Default.SwapHoriz,
|
||||||
"Refund",
|
contentDescription = null,
|
||||||
{
|
modifier = Modifier.size(32.dp),
|
||||||
Icon(
|
tint = Color.LegacyRed
|
||||||
Icons.Default.Replay,
|
)
|
||||||
contentDescription = null,
|
}) { onNavigateAction("Pre-Auth Complete Void") },
|
||||||
modifier = Modifier.size(32.dp),
|
DashboardMenuItem(
|
||||||
tint = Color.LegacyRed
|
"Cash Adv",
|
||||||
)
|
{
|
||||||
}
|
Icon(
|
||||||
) { onNavigateAction("Refund") }
|
Icons.Default.AccountBalanceWallet,
|
||||||
)
|
contentDescription = null,
|
||||||
}
|
modifier = Modifier.size(32.dp),
|
||||||
|
tint = Color.LegacyRed
|
||||||
if (preAuthEnabled) {
|
)
|
||||||
add(
|
}) { onNavigateAmount("Cash Adv") },
|
||||||
DashboardMenuItem(
|
)
|
||||||
"Pre-Auth",
|
|
||||||
{
|
|
||||||
Icon(
|
|
||||||
Icons.Default.Lock,
|
|
||||||
contentDescription = null,
|
|
||||||
modifier = Modifier.size(32.dp),
|
|
||||||
tint = Color.LegacyRed
|
|
||||||
)
|
|
||||||
}
|
|
||||||
) { onNavigateAmount("Pre-Auth") }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preAuthVoidEnabled) {
|
|
||||||
add(
|
|
||||||
DashboardMenuItem(
|
|
||||||
"Pre-Auth Void",
|
|
||||||
{
|
|
||||||
Icon(
|
|
||||||
Icons.Default.LockOpen,
|
|
||||||
contentDescription = null,
|
|
||||||
modifier = Modifier.size(32.dp),
|
|
||||||
tint = Color.LegacyRed
|
|
||||||
)
|
|
||||||
}
|
|
||||||
) { onNavigateAction("Pre-Auth Void") }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preAuthCompleteEnabled) {
|
|
||||||
add(
|
|
||||||
DashboardMenuItem(
|
|
||||||
"Pre-Auth Complete",
|
|
||||||
{
|
|
||||||
Icon(
|
|
||||||
Icons.Default.CreditCard,
|
|
||||||
contentDescription = null,
|
|
||||||
modifier = Modifier.size(32.dp),
|
|
||||||
tint = Color.LegacyRed
|
|
||||||
)
|
|
||||||
}
|
|
||||||
) { onNavigateAction("Pre-Auth Complete") }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preAuthCompleteVoidEnabled) {
|
|
||||||
add(
|
|
||||||
DashboardMenuItem(
|
|
||||||
"Pre-Auth Comp Void",
|
|
||||||
{
|
|
||||||
Icon(
|
|
||||||
Icons.Default.SwapHoriz,
|
|
||||||
contentDescription = null,
|
|
||||||
modifier = Modifier.size(32.dp),
|
|
||||||
tint = Color.LegacyRed
|
|
||||||
)
|
|
||||||
}
|
|
||||||
) { onNavigateAction("Pre-Auth Complete Void") }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cashAdvEnabled) {
|
|
||||||
add(
|
|
||||||
DashboardMenuItem(
|
|
||||||
"Cash Adv",
|
|
||||||
{
|
|
||||||
Icon(
|
|
||||||
Icons.Default.AccountBalanceWallet,
|
|
||||||
contentDescription = null,
|
|
||||||
modifier = Modifier.size(32.dp),
|
|
||||||
tint = Color.LegacyRed
|
|
||||||
)
|
|
||||||
}
|
|
||||||
) { onNavigateAmount("Cash Adv") }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@ -23,9 +23,6 @@ import androidx.compose.material.icons.filled.Menu
|
|||||||
import androidx.compose.material.icons.filled.Notifications
|
import androidx.compose.material.icons.filled.Notifications
|
||||||
import androidx.compose.material.icons.filled.Sync
|
import androidx.compose.material.icons.filled.Sync
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Card
|
|
||||||
import androidx.compose.material3.CardDefaults
|
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
|
||||||
import androidx.compose.material3.DrawerValue
|
import androidx.compose.material3.DrawerValue
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
@ -50,7 +47,6 @@ import androidx.compose.ui.layout.ContentScale
|
|||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.window.Dialog
|
|
||||||
import com.mob.utsmyanmar.R
|
import com.mob.utsmyanmar.R
|
||||||
import com.mob.utsmyanmar.ui.components.appbar.AppBar
|
import com.mob.utsmyanmar.ui.components.appbar.AppBar
|
||||||
import com.mob.utsmyanmar.ui.device_info.DeviceInfoUiState
|
import com.mob.utsmyanmar.ui.device_info.DeviceInfoUiState
|
||||||
@ -180,29 +176,6 @@ fun DashboardScreen2(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dashboardUiState.isSyncing) {
|
|
||||||
Dialog(onDismissRequest = {}) {
|
|
||||||
Card(
|
|
||||||
shape = RoundedCornerShape(16.dp),
|
|
||||||
colors = CardDefaults.cardColors(containerColor = Color.White),
|
|
||||||
elevation = CardDefaults.cardElevation(8.dp)
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier.padding(32.dp),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
|
||||||
) {
|
|
||||||
CircularProgressIndicator(color = Color.LegacyRed)
|
|
||||||
Spacer(Modifier.height(16.dp))
|
|
||||||
Text(
|
|
||||||
text = dashboardUiState.syncStatusText,
|
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
|
||||||
color = Color.Black
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ModalNavigationDrawer(
|
ModalNavigationDrawer(
|
||||||
drawerState = drawerState,
|
drawerState = drawerState,
|
||||||
drawerContent = {
|
drawerContent = {
|
||||||
|
|||||||
@ -17,7 +17,5 @@ data class DashboardUiState(
|
|||||||
val totalSaleCount: Int = 0,
|
val totalSaleCount: Int = 0,
|
||||||
val totalSaleAmount: Long = 0L,
|
val totalSaleAmount: Long = 0L,
|
||||||
val settlementStatusText: String = "Pending",
|
val settlementStatusText: String = "Pending",
|
||||||
val settlementDateTimeText: String = "--/-- --:--",
|
val settlementDateTimeText: String = "--/-- --:--"
|
||||||
val isSyncing: Boolean = false,
|
|
||||||
val syncStatusText: String = "Connecting to TMS server..."
|
|
||||||
)
|
)
|
||||||
|
|||||||
@ -72,18 +72,6 @@ class DashboardViewModel @Inject constructor(
|
|||||||
.takeIf { it > 0L }
|
.takeIf { it > 0L }
|
||||||
_uiState.update { it.copy(lastSyncTime = time) }
|
_uiState.update { it.copy(lastSyncTime = time) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun startSync() {
|
|
||||||
_uiState.update { it.copy(isSyncing = true, syncStatusText = "Connecting to TMS server...") }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun finishSync(message: String) {
|
|
||||||
_uiState.update { it.copy(syncStatusText = message) }
|
|
||||||
viewModelScope.launch {
|
|
||||||
kotlinx.coroutines.delay(1500)
|
|
||||||
_uiState.update { it.copy(isSyncing = false) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun PayDetail.toRecord(): TrnxRecord {
|
private fun PayDetail.toRecord(): TrnxRecord {
|
||||||
|
|||||||
@ -125,15 +125,6 @@ fun AppNavGraph(
|
|||||||
LaunchedEffect(tmsSetupViewModel) {
|
LaunchedEffect(tmsSetupViewModel) {
|
||||||
tmsSetupViewModel.onSyncCompleted.collect {
|
tmsSetupViewModel.onSyncCompleted.collect {
|
||||||
dashboardViewModel.refreshLastSyncTime()
|
dashboardViewModel.refreshLastSyncTime()
|
||||||
dashboardViewModel.finishSync("Sync completed")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LaunchedEffect(tmsSetupUiState.isLoading, tmsSetupUiState.isError) {
|
|
||||||
if (dashboardUiState.isSyncing && !tmsSetupUiState.isLoading) {
|
|
||||||
if (tmsSetupUiState.isError) {
|
|
||||||
dashboardViewModel.finishSync(tmsSetupUiState.statusText.ifBlank { "Download failed!" })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +144,6 @@ fun AppNavGraph(
|
|||||||
dashboardUiState = dashboardUiState,
|
dashboardUiState = dashboardUiState,
|
||||||
deviceInfo = deviceInfoUiState,
|
deviceInfo = deviceInfoUiState,
|
||||||
onClickLastSync = {
|
onClickLastSync = {
|
||||||
dashboardViewModel.startSync()
|
|
||||||
tmsSetupViewModel.downloadConfigs()
|
tmsSetupViewModel.downloadConfigs()
|
||||||
},
|
},
|
||||||
onNavigateRecentTransaction = { record ->
|
onNavigateRecentTransaction = { record ->
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import androidx.lifecycle.ViewModelProvider
|
|||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.mob.utsmyanmar.model.CardTransactionType
|
import com.mob.utsmyanmar.model.CardTransactionType
|
||||||
import com.mob.utsmyanmar.ui.pinpad.PinPadViewModel
|
import com.mob.utsmyanmar.ui.pinpad.PinPadViewModel
|
||||||
|
import com.mob.utsmyanmar.utils.MockCardData
|
||||||
import com.mob.utsmyanmar.utils.MockData
|
import com.mob.utsmyanmar.utils.MockData
|
||||||
import com.mob.utsmyanmar.utils.TransactionUtil
|
import com.mob.utsmyanmar.utils.TransactionUtil
|
||||||
import com.mob.utsmyanmar.viewmodel.CardReaderViewModel
|
import com.mob.utsmyanmar.viewmodel.CardReaderViewModel
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.mob.utsmyanmar.model.ecr.ECRResultStatus
|
|||||||
import com.mob.utsmyanmar.utils.CoreUtils
|
import com.mob.utsmyanmar.utils.CoreUtils
|
||||||
import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
||||||
import com.utsmyanmar.baselib.emv.EmvParamOperation
|
import com.utsmyanmar.baselib.emv.EmvParamOperation
|
||||||
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusRequest
|
||||||
import com.utsmyanmar.ecr.ECRHelper
|
import com.utsmyanmar.ecr.ECRHelper
|
||||||
import com.utsmyanmar.ecr.ECRProcess
|
import com.utsmyanmar.ecr.ECRProcess
|
||||||
import com.utsmyanmar.ecr.data.model.TransactionsResp
|
import com.utsmyanmar.ecr.data.model.TransactionsResp
|
||||||
|
|||||||
@ -131,7 +131,7 @@ class TMSSetupsImpl : TMSSetups {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Properties
|
//Properties
|
||||||
for (prop in siriusProperty) {
|
for (prop in siriusProperty.orEmpty()) {
|
||||||
val name = prop.name
|
val name = prop.name
|
||||||
val data = prop.property
|
val data = prop.property
|
||||||
|
|
||||||
@ -221,7 +221,6 @@ class TMSSetupsImpl : TMSSetups {
|
|||||||
"speedup_contactless_enable" -> ops.setSpeedUpContactless(parseBoolean(data))
|
"speedup_contactless_enable" -> ops.setSpeedUpContactless(parseBoolean(data))
|
||||||
"manual_entry_pin_enable" -> ops.isManualEntryPinEnable = parseBoolean(data)
|
"manual_entry_pin_enable" -> ops.isManualEntryPinEnable = parseBoolean(data)
|
||||||
"cmhl_enabled" -> ops.setCMHLEnable(parseBoolean(data))
|
"cmhl_enabled" -> ops.setCMHLEnable(parseBoolean(data))
|
||||||
"mmqr_enable" -> ops.setMmqrStatus(parseBoolean(data))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ops.carouselUrls = imgUrls.joinToString(",")
|
ops.carouselUrls = imgUrls.joinToString(",")
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import android.os.Handler
|
|||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.os.Message
|
import android.os.Message
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import com.mob.utsmyanmar.model.TransResultStatus
|
|
||||||
import com.utsmyanmar.baselib.emv.EmvParamOperation
|
import com.utsmyanmar.baselib.emv.EmvParamOperation
|
||||||
import com.utsmyanmar.baselib.repo.Repository
|
import com.utsmyanmar.baselib.repo.Repository
|
||||||
import com.utsmyanmar.baselib.util.enums.EmvResultStatus
|
import com.utsmyanmar.baselib.util.enums.EmvResultStatus
|
||||||
@ -25,6 +24,7 @@ import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
|||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import sunmi.sunmiui.utils.LogUtil
|
import sunmi.sunmiui.utils.LogUtil
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
import com.mob.utsmyanmar.model.TransResultStatus
|
||||||
|
|
||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
class EmvTransactionProcessViewModel @Inject constructor(
|
class EmvTransactionProcessViewModel @Inject constructor(
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
import kotlin.time.Duration.Companion.milliseconds
|
||||||
|
|
||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
class TransProcessViewModel @Inject constructor(
|
class TransProcessViewModel @Inject constructor(
|
||||||
|
|||||||
@ -1,12 +1,17 @@
|
|||||||
package com.utsmyanmar.ecr
|
package com.utsmyanmar.ecr
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.utsmyanmar.ecr.data.ResultOf
|
import com.utsmyanmar.ecr.data.ResultOf
|
||||||
|
import com.utsmyanmar.ecr.data.TransType
|
||||||
import com.utsmyanmar.ecr.data.mapper.RequestTransMapper
|
import com.utsmyanmar.ecr.data.mapper.RequestTransMapper
|
||||||
import com.utsmyanmar.ecr.data.mapper.ResponseTransMapper
|
import com.utsmyanmar.ecr.data.mapper.ResponseTransMapper
|
||||||
import com.utsmyanmar.ecr.data.model.RequestTrans
|
import com.utsmyanmar.ecr.data.model.RequestTrans
|
||||||
|
import com.utsmyanmar.ecr.data.model.ResponseTrans
|
||||||
import com.utsmyanmar.ecr.data.model.Transactions
|
import com.utsmyanmar.ecr.data.model.Transactions
|
||||||
import com.utsmyanmar.ecr.data.model.TransactionsResp
|
import com.utsmyanmar.ecr.data.model.TransactionsResp
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
||||||
|
import java.lang.Exception
|
||||||
|
|
||||||
//@Keep
|
//@Keep
|
||||||
object ECRProcess {
|
object ECRProcess {
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
package com.utsmyanmar.paylibs.utils.core_utils;
|
package com.utsmyanmar.paylibs.utils.core_utils;
|
||||||
|
|
||||||
import static com.utsmyanmar.paylibs.utils.core_utils.SystemParamsSettings.TRANSACTION_MANAGER_KEY;
|
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.utsmyanmar.paylibs.utils.enums.CurrencyType;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import sunmi.sunmiui.utils.LogUtil;
|
import sunmi.sunmiui.utils.LogUtil;
|
||||||
|
|
||||||
|
import static com.utsmyanmar.paylibs.utils.core_utils.SystemParamsSettings.TRANSACTION_MANAGER_KEY;
|
||||||
|
|
||||||
|
import com.utsmyanmar.paylibs.utils.enums.CurrencyType;
|
||||||
|
|
||||||
public class SystemParamsOperation {
|
public class SystemParamsOperation {
|
||||||
|
|
||||||
public static final String TAG = "SystemParamsOperation";
|
public static final String TAG = "SystemParamsOperation";
|
||||||
@ -33,6 +33,54 @@ public class SystemParamsOperation {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* public void init(String serialNumStart,
|
||||||
|
String batchNumStart,
|
||||||
|
int purchaseOrderStyle,
|
||||||
|
int correctFrequency,
|
||||||
|
int transactionNumber,
|
||||||
|
boolean printNegative,
|
||||||
|
int nonConnection,
|
||||||
|
boolean stateSecret,
|
||||||
|
boolean shieldAuthorizationCard,
|
||||||
|
int nonConnectionChoice,
|
||||||
|
boolean eCashVisaExemption) {
|
||||||
|
SystemParamsSettings bean = getSystemParamsSettings();
|
||||||
|
bean.setSerialNum(serialNumStart);
|
||||||
|
bean.setBatchNumStart(batchNumStart);
|
||||||
|
bean.setPurchaseOrderStyle(purchaseOrderStyle);
|
||||||
|
bean.setCorrectFrequency(correctFrequency);
|
||||||
|
bean.setTransactionNumber(transactionNumber);
|
||||||
|
bean.setPrintNegative(printNegative);
|
||||||
|
bean.setNonConnection(nonConnection);
|
||||||
|
bean.setStateSecret(stateSecret);
|
||||||
|
bean.setShieldAuthorizationCard(shieldAuthorizationCard);
|
||||||
|
bean.setNonConnectionChoice(nonConnectionChoice);
|
||||||
|
bean.setCashVisaExemption(eCashVisaExemption);
|
||||||
|
saveSystemParamsSettings(bean);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*public boolean isDownloadParamsOnce() {
|
||||||
|
SystemParamsSettings params = getSystemParamsSettings();
|
||||||
|
return params.isDownloadParamsOnce();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveDownloadParamsOnce(boolean downloadParamsOnce) {
|
||||||
|
SystemParamsSettings params = getSystemParamsSettings();
|
||||||
|
params.setDownloadParamsOnce(downloadParamsOnce);
|
||||||
|
saveSystemParamsSettings(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNeedDownLoadICParams() {
|
||||||
|
SystemParamsSettings params = getSystemParamsSettings();
|
||||||
|
return params.isNeedDownLoadICParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveNeedDownLoadICParams(boolean needDownLoadICParams) {
|
||||||
|
SystemParamsSettings params = getSystemParamsSettings();
|
||||||
|
params.setNeedDownLoadICParams(needDownLoadICParams);
|
||||||
|
saveSystemParamsSettings(params);
|
||||||
|
}*/
|
||||||
|
|
||||||
public boolean isInjectOnce(){
|
public boolean isInjectOnce(){
|
||||||
SystemParamsSettings params = getSystemParamsSettings();
|
SystemParamsSettings params = getSystemParamsSettings();
|
||||||
return params.isInjectOnce();
|
return params.isInjectOnce();
|
||||||
@ -43,6 +91,13 @@ public class SystemParamsOperation {
|
|||||||
params.setInjectOnce(injectOnce);
|
params.setInjectOnce(injectOnce);
|
||||||
saveSystemParamsSettings(params);
|
saveSystemParamsSettings(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set serial number
|
||||||
|
*
|
||||||
|
* @param serialNumber Starting serial number
|
||||||
|
*/
|
||||||
public void saveSerialNumber(String serialNumber) {
|
public void saveSerialNumber(String serialNumber) {
|
||||||
if (TextUtils.isEmpty(serialNumber)) {
|
if (TextUtils.isEmpty(serialNumber)) {
|
||||||
return;
|
return;
|
||||||
@ -51,6 +106,12 @@ public class SystemParamsOperation {
|
|||||||
params.setSerialNum(serialNumber);
|
params.setSerialNum(serialNumber);
|
||||||
saveSystemParamsSettings(params);
|
saveSystemParamsSettings(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set invoice number
|
||||||
|
*
|
||||||
|
* @param invoiceNumber Starting invoice number
|
||||||
|
*/
|
||||||
public void saveInvoiceNumber(String invoiceNumber) {
|
public void saveInvoiceNumber(String invoiceNumber) {
|
||||||
if (TextUtils.isEmpty(invoiceNumber)) {
|
if (TextUtils.isEmpty(invoiceNumber)) {
|
||||||
return;
|
return;
|
||||||
@ -59,6 +120,13 @@ public class SystemParamsOperation {
|
|||||||
params.setInvoiceNum(invoiceNumber);
|
params.setInvoiceNum(invoiceNumber);
|
||||||
saveSystemParamsSettings(params);
|
saveSystemParamsSettings(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set batch number
|
||||||
|
*
|
||||||
|
* @param batchNumber Starting batch number
|
||||||
|
*/
|
||||||
public void saveBatchNumber(String batchNumber) {
|
public void saveBatchNumber(String batchNumber) {
|
||||||
if (TextUtils.isEmpty(batchNumber)) {
|
if (TextUtils.isEmpty(batchNumber)) {
|
||||||
return;
|
return;
|
||||||
@ -68,6 +136,11 @@ public class SystemParamsOperation {
|
|||||||
saveSystemParamsSettings(params);
|
saveSystemParamsSettings(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serial number increment
|
||||||
|
*/
|
||||||
private void incrementSerialNum() {
|
private void incrementSerialNum() {
|
||||||
SystemParamsSettings params = getSystemParamsSettings();
|
SystemParamsSettings params = getSystemParamsSettings();
|
||||||
String currentSerialNum = params.getCurrentSerialNum();
|
String currentSerialNum = params.getCurrentSerialNum();
|
||||||
@ -99,6 +172,10 @@ public class SystemParamsOperation {
|
|||||||
params.setSerialNum(transNumFormat);
|
params.setSerialNum(transNumFormat);
|
||||||
saveSystemParamsSettings(params);
|
saveSystemParamsSettings(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoice number increment
|
||||||
|
*/
|
||||||
private void incrementInvoiceNum() {
|
private void incrementInvoiceNum() {
|
||||||
SystemParamsSettings params = getSystemParamsSettings();
|
SystemParamsSettings params = getSystemParamsSettings();
|
||||||
String currentInvoiceNum = params.getCurrentInvoiceNum();
|
String currentInvoiceNum = params.getCurrentInvoiceNum();
|
||||||
@ -875,17 +952,6 @@ public class SystemParamsOperation {
|
|||||||
saveSystemParamsSettings(params);
|
saveSystemParamsSettings(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMmqrStatus(boolean status) {
|
|
||||||
SystemParamsSettings params = getSystemParamsSettings();
|
|
||||||
params.setMmqrEnabled(status);
|
|
||||||
saveSystemParamsSettings(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getMmqrStatus(){
|
|
||||||
SystemParamsSettings params = getSystemParamsSettings();
|
|
||||||
return params.getMmqrEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCMHLEnabled(){
|
public boolean isCMHLEnabled(){
|
||||||
SystemParamsSettings params = getSystemParamsSettings();
|
SystemParamsSettings params = getSystemParamsSettings();
|
||||||
return params.isCmhlEnabled();
|
return params.isCmhlEnabled();
|
||||||
|
|||||||
@ -233,7 +233,6 @@ public class SystemParamsSettings implements Serializable {
|
|||||||
private byte[] pik_value;
|
private byte[] pik_value;
|
||||||
|
|
||||||
private byte[] pik_kcv;
|
private byte[] pik_kcv;
|
||||||
private boolean mmqrEnabled;
|
|
||||||
|
|
||||||
protected String getSecHostName() {
|
protected String getSecHostName() {
|
||||||
return secHostName;
|
return secHostName;
|
||||||
@ -903,14 +902,6 @@ public class SystemParamsSettings implements Serializable {
|
|||||||
this.emvEnabled = emvEnabled;
|
this.emvEnabled = emvEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMmqrEnabled(boolean status) {
|
|
||||||
this.mmqrEnabled = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getMmqrEnabled(){
|
|
||||||
return mmqrEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* // 流水号起始
|
/* // 流水号起始
|
||||||
private String serialNum = Configs.getInstance().SERIAL_NUM();
|
private String serialNum = Configs.getInstance().SERIAL_NUM();
|
||||||
// 批次号起始
|
// 批次号起始
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user