show hide menus
This commit is contained in:
parent
80594be6f9
commit
81e383798f
@ -16,14 +16,13 @@ import com.utsmyanmar.ecr.ECRHelper
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.receiveAsFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import sunmi.sunmiui.utils.LogUtil
|
||||
|
||||
class CardWaitingViewModel(
|
||||
private val cardReadViewModel: CardReaderViewModel,
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
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.filled.AccountBalanceWallet
|
||||
import androidx.compose.material.icons.filled.CreditCard
|
||||
@ -7,7 +10,6 @@ import androidx.compose.material.icons.filled.Lock
|
||||
import androidx.compose.material.icons.filled.LockOpen
|
||||
import androidx.compose.material.icons.filled.Replay
|
||||
import androidx.compose.material.icons.filled.SwapHoriz
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
@ -15,6 +17,7 @@ import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.mob.utsmyanmar.R
|
||||
import com.mob.utsmyanmar.ui.theme.Color
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
||||
|
||||
class DashboardMenuItem(
|
||||
val title: String,
|
||||
@ -22,13 +25,27 @@ class DashboardMenuItem(
|
||||
val onClick: () -> Unit
|
||||
)
|
||||
|
||||
var sp = SystemParamsOperation.getInstance();
|
||||
|
||||
val mmqrEnabled = sp.mmqrStatus;
|
||||
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(
|
||||
onNavigateAmount: (String) -> Unit,
|
||||
onNavigateSignOn: () -> Unit,
|
||||
onNavigateSettlement: () -> Unit,
|
||||
onNavigateHistory: () -> Unit,
|
||||
onNavigateAction: (String) -> Unit
|
||||
): List<DashboardMenuItem> = listOf(
|
||||
): List<DashboardMenuItem> = buildList {
|
||||
|
||||
add(
|
||||
DashboardMenuItem(
|
||||
"Sale",
|
||||
{
|
||||
@ -38,7 +55,26 @@ fun buildMenuItems(
|
||||
modifier = Modifier.size(40.dp),
|
||||
tint = Color.LegacyRed
|
||||
)
|
||||
}) { onNavigateAmount("Sale") },
|
||||
}
|
||||
) { onNavigateAmount("Sale") }
|
||||
)
|
||||
|
||||
|
||||
if (mmqrEnabled) {
|
||||
add(
|
||||
DashboardMenuItem(
|
||||
"MMQR",
|
||||
{
|
||||
Image(
|
||||
painter = painterResource(R.drawable.ic_mmqr_logo),
|
||||
contentDescription = null,
|
||||
modifier = Modifier.height(48.dp)
|
||||
)
|
||||
}
|
||||
) { }
|
||||
)
|
||||
}
|
||||
add(
|
||||
DashboardMenuItem(
|
||||
"History",
|
||||
{
|
||||
@ -48,7 +84,11 @@ fun buildMenuItems(
|
||||
modifier = Modifier.size(32.dp),
|
||||
tint = Color.LegacyRed
|
||||
)
|
||||
}) { onNavigateHistory() },
|
||||
}
|
||||
) { onNavigateHistory() }
|
||||
)
|
||||
|
||||
add(
|
||||
DashboardMenuItem(
|
||||
"Sign On",
|
||||
{
|
||||
@ -58,7 +98,12 @@ fun buildMenuItems(
|
||||
modifier = Modifier.size(32.dp),
|
||||
tint = Color.LegacyRed
|
||||
)
|
||||
}) { onNavigateSignOn() },
|
||||
}
|
||||
) { onNavigateSignOn() }
|
||||
)
|
||||
|
||||
if (settlementEnabled) {
|
||||
add(
|
||||
DashboardMenuItem(
|
||||
"Settlement",
|
||||
{
|
||||
@ -68,7 +113,13 @@ fun buildMenuItems(
|
||||
modifier = Modifier.size(32.dp),
|
||||
tint = Color.LegacyRed
|
||||
)
|
||||
}) { onNavigateSettlement() },
|
||||
}
|
||||
) { onNavigateSettlement() }
|
||||
)
|
||||
}
|
||||
|
||||
if (voidEnabled) {
|
||||
add(
|
||||
DashboardMenuItem(
|
||||
"Void",
|
||||
{
|
||||
@ -78,7 +129,13 @@ fun buildMenuItems(
|
||||
modifier = Modifier.size(32.dp),
|
||||
tint = Color.LegacyRed
|
||||
)
|
||||
}) { onNavigateAction("Void") },
|
||||
}
|
||||
) { onNavigateAction("Void") }
|
||||
)
|
||||
}
|
||||
|
||||
if (refundEnabled) {
|
||||
add(
|
||||
DashboardMenuItem(
|
||||
"Refund",
|
||||
{
|
||||
@ -88,7 +145,13 @@ fun buildMenuItems(
|
||||
modifier = Modifier.size(32.dp),
|
||||
tint = Color.LegacyRed
|
||||
)
|
||||
}) { onNavigateAction("Refund") },
|
||||
}
|
||||
) { onNavigateAction("Refund") }
|
||||
)
|
||||
}
|
||||
|
||||
if (preAuthEnabled) {
|
||||
add(
|
||||
DashboardMenuItem(
|
||||
"Pre-Auth",
|
||||
{
|
||||
@ -98,7 +161,13 @@ fun buildMenuItems(
|
||||
modifier = Modifier.size(32.dp),
|
||||
tint = Color.LegacyRed
|
||||
)
|
||||
}) { onNavigateAmount("Pre-Auth") },
|
||||
}
|
||||
) { onNavigateAmount("Pre-Auth") }
|
||||
)
|
||||
}
|
||||
|
||||
if (preAuthVoidEnabled) {
|
||||
add(
|
||||
DashboardMenuItem(
|
||||
"Pre-Auth Void",
|
||||
{
|
||||
@ -108,7 +177,13 @@ fun buildMenuItems(
|
||||
modifier = Modifier.size(32.dp),
|
||||
tint = Color.LegacyRed
|
||||
)
|
||||
}) { onNavigateAction("Pre-Auth Void") },
|
||||
}
|
||||
) { onNavigateAction("Pre-Auth Void") }
|
||||
)
|
||||
}
|
||||
|
||||
if (preAuthCompleteEnabled) {
|
||||
add(
|
||||
DashboardMenuItem(
|
||||
"Pre-Auth Complete",
|
||||
{
|
||||
@ -118,7 +193,13 @@ fun buildMenuItems(
|
||||
modifier = Modifier.size(32.dp),
|
||||
tint = Color.LegacyRed
|
||||
)
|
||||
}) { onNavigateAction("Pre-Auth Complete") },
|
||||
}
|
||||
) { onNavigateAction("Pre-Auth Complete") }
|
||||
)
|
||||
}
|
||||
|
||||
if (preAuthCompleteVoidEnabled) {
|
||||
add(
|
||||
DashboardMenuItem(
|
||||
"Pre-Auth Comp Void",
|
||||
{
|
||||
@ -128,7 +209,13 @@ fun buildMenuItems(
|
||||
modifier = Modifier.size(32.dp),
|
||||
tint = Color.LegacyRed
|
||||
)
|
||||
}) { onNavigateAction("Pre-Auth Complete Void") },
|
||||
}
|
||||
) { onNavigateAction("Pre-Auth Complete Void") }
|
||||
)
|
||||
}
|
||||
|
||||
if (cashAdvEnabled) {
|
||||
add(
|
||||
DashboardMenuItem(
|
||||
"Cash Adv",
|
||||
{
|
||||
@ -138,5 +225,10 @@ fun buildMenuItems(
|
||||
modifier = Modifier.size(32.dp),
|
||||
tint = Color.LegacyRed
|
||||
)
|
||||
}) { onNavigateAmount("Cash Adv") },
|
||||
)
|
||||
}
|
||||
) { onNavigateAmount("Cash Adv") }
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.mob.utsmyanmar.model.CardTransactionType
|
||||
import com.mob.utsmyanmar.ui.pinpad.PinPadViewModel
|
||||
import com.mob.utsmyanmar.utils.MockCardData
|
||||
import com.mob.utsmyanmar.utils.MockData
|
||||
import com.mob.utsmyanmar.utils.TransactionUtil
|
||||
import com.mob.utsmyanmar.viewmodel.CardReaderViewModel
|
||||
|
||||
@ -6,7 +6,6 @@ import com.mob.utsmyanmar.model.ecr.ECRResultStatus
|
||||
import com.mob.utsmyanmar.utils.CoreUtils
|
||||
import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
||||
import com.utsmyanmar.baselib.emv.EmvParamOperation
|
||||
import com.utsmyanmar.baselib.network.model.sirius.SiriusRequest
|
||||
import com.utsmyanmar.ecr.ECRHelper
|
||||
import com.utsmyanmar.ecr.ECRProcess
|
||||
import com.utsmyanmar.ecr.data.model.TransactionsResp
|
||||
|
||||
@ -131,7 +131,7 @@ class TMSSetupsImpl : TMSSetups {
|
||||
}
|
||||
|
||||
//Properties
|
||||
for (prop in siriusProperty.orEmpty()) {
|
||||
for (prop in siriusProperty) {
|
||||
val name = prop.name
|
||||
val data = prop.property
|
||||
|
||||
@ -221,6 +221,7 @@ class TMSSetupsImpl : TMSSetups {
|
||||
"speedup_contactless_enable" -> ops.setSpeedUpContactless(parseBoolean(data))
|
||||
"manual_entry_pin_enable" -> ops.isManualEntryPinEnable = parseBoolean(data)
|
||||
"cmhl_enabled" -> ops.setCMHLEnable(parseBoolean(data))
|
||||
"mmqr_enable" -> ops.setMmqrStatus(parseBoolean(data))
|
||||
}
|
||||
}
|
||||
ops.carouselUrls = imgUrls.joinToString(",")
|
||||
|
||||
@ -4,6 +4,7 @@ import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.text.TextUtils
|
||||
import com.mob.utsmyanmar.model.TransResultStatus
|
||||
import com.utsmyanmar.baselib.emv.EmvParamOperation
|
||||
import com.utsmyanmar.baselib.repo.Repository
|
||||
import com.utsmyanmar.baselib.util.enums.EmvResultStatus
|
||||
@ -24,7 +25,6 @@ import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import sunmi.sunmiui.utils.LogUtil
|
||||
import javax.inject.Inject
|
||||
import com.mob.utsmyanmar.model.TransResultStatus
|
||||
|
||||
@HiltViewModel
|
||||
class EmvTransactionProcessViewModel @Inject constructor(
|
||||
|
||||
@ -25,7 +25,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
@HiltViewModel
|
||||
class TransProcessViewModel @Inject constructor(
|
||||
|
||||
@ -1,17 +1,12 @@
|
||||
package com.utsmyanmar.ecr
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.google.gson.Gson
|
||||
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.ResponseTransMapper
|
||||
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.TransactionsResp
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
||||
import java.lang.Exception
|
||||
|
||||
//@Keep
|
||||
object ECRProcess {
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
package com.utsmyanmar.paylibs.utils.core_utils;
|
||||
|
||||
import static com.utsmyanmar.paylibs.utils.core_utils.SystemParamsSettings.TRANSACTION_MANAGER_KEY;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.utsmyanmar.paylibs.utils.enums.CurrencyType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
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 static final String TAG = "SystemParamsOperation";
|
||||
@ -33,54 +33,6 @@ public class SystemParamsOperation {
|
||||
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(){
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
return params.isInjectOnce();
|
||||
@ -91,13 +43,6 @@ public class SystemParamsOperation {
|
||||
params.setInjectOnce(injectOnce);
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set serial number
|
||||
*
|
||||
* @param serialNumber Starting serial number
|
||||
*/
|
||||
public void saveSerialNumber(String serialNumber) {
|
||||
if (TextUtils.isEmpty(serialNumber)) {
|
||||
return;
|
||||
@ -106,12 +51,6 @@ public class SystemParamsOperation {
|
||||
params.setSerialNum(serialNumber);
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set invoice number
|
||||
*
|
||||
* @param invoiceNumber Starting invoice number
|
||||
*/
|
||||
public void saveInvoiceNumber(String invoiceNumber) {
|
||||
if (TextUtils.isEmpty(invoiceNumber)) {
|
||||
return;
|
||||
@ -120,13 +59,6 @@ public class SystemParamsOperation {
|
||||
params.setInvoiceNum(invoiceNumber);
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set batch number
|
||||
*
|
||||
* @param batchNumber Starting batch number
|
||||
*/
|
||||
public void saveBatchNumber(String batchNumber) {
|
||||
if (TextUtils.isEmpty(batchNumber)) {
|
||||
return;
|
||||
@ -136,11 +68,6 @@ public class SystemParamsOperation {
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Serial number increment
|
||||
*/
|
||||
private void incrementSerialNum() {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
String currentSerialNum = params.getCurrentSerialNum();
|
||||
@ -172,10 +99,6 @@ public class SystemParamsOperation {
|
||||
params.setSerialNum(transNumFormat);
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoice number increment
|
||||
*/
|
||||
private void incrementInvoiceNum() {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
String currentInvoiceNum = params.getCurrentInvoiceNum();
|
||||
@ -952,6 +875,17 @@ public class SystemParamsOperation {
|
||||
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(){
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
return params.isCmhlEnabled();
|
||||
|
||||
@ -233,6 +233,7 @@ public class SystemParamsSettings implements Serializable {
|
||||
private byte[] pik_value;
|
||||
|
||||
private byte[] pik_kcv;
|
||||
private boolean mmqrEnabled;
|
||||
|
||||
protected String getSecHostName() {
|
||||
return secHostName;
|
||||
@ -902,6 +903,14 @@ public class SystemParamsSettings implements Serializable {
|
||||
this.emvEnabled = emvEnabled;
|
||||
}
|
||||
|
||||
public void setMmqrEnabled(boolean status) {
|
||||
this.mmqrEnabled = status;
|
||||
}
|
||||
|
||||
public boolean getMmqrEnabled(){
|
||||
return mmqrEnabled;
|
||||
}
|
||||
|
||||
/* // 流水号起始
|
||||
private String serialNum = Configs.getInstance().SERIAL_NUM();
|
||||
// 批次号起始
|
||||
|
||||
Loading…
Reference in New Issue
Block a user