Compare commits
No commits in common. "ee2f9df3518e6c6944b5e4f799c5bbf21e188dbb" and "44c0fa20af5a3907d634594512290f4b85a50619" have entirely different histories.
ee2f9df351
...
44c0fa20af
@ -1,34 +0,0 @@
|
|||||||
package com.mob.utsmyanmar.ui.amount
|
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import com.mob.utsmyanmar.model.ProcessCode
|
|
||||||
import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
|
||||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun AmountRoute(
|
|
||||||
action: String,
|
|
||||||
sharedViewModel: SharedViewModel,
|
|
||||||
onBack: () -> Unit,
|
|
||||||
onNavigateCardWaiting: () -> Unit
|
|
||||||
) {
|
|
||||||
val canGoBack = !action.equals("Sale", ignoreCase = true)
|
|
||||||
|
|
||||||
AmountScreen(
|
|
||||||
action = action,
|
|
||||||
canGoBack = canGoBack,
|
|
||||||
onBackClick = onBack,
|
|
||||||
onCancelClick = onBack,
|
|
||||||
onNextClick = { amount ->
|
|
||||||
sharedViewModel.amount.value = amount
|
|
||||||
sharedViewModel.setAmountExist(true)
|
|
||||||
sharedViewModel.setCardDataExist(false)
|
|
||||||
sharedViewModel.setTransMenu(null)
|
|
||||||
sharedViewModel.transactionsType.value = TransactionsType.SALE
|
|
||||||
sharedViewModel.processCode.value =
|
|
||||||
ProcessCode.SALE_PURCHASE + ProcessCode.SMART + ProcessCode.TO_ACCOUNT
|
|
||||||
|
|
||||||
onNavigateCardWaiting()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
package com.mob.utsmyanmar.ui.amount
|
package com.mob.utsmyanmar.ui.amount
|
||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
@ -33,14 +32,10 @@ import com.mob.utsmyanmar.R
|
|||||||
@Composable
|
@Composable
|
||||||
fun AmountScreen(
|
fun AmountScreen(
|
||||||
action: String,
|
action: String,
|
||||||
canGoBack: Boolean = true,
|
|
||||||
onBackClick: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onCancelClick: () -> Unit = {},
|
onCancelClick: () -> Unit = {},
|
||||||
onNextClick: (String) -> Unit = {}
|
onNextClick: (String) -> Unit = {}
|
||||||
) {
|
) {
|
||||||
BackHandler(enabled = canGoBack) {
|
|
||||||
onBackClick()
|
|
||||||
}
|
|
||||||
|
|
||||||
var amount by remember {
|
var amount by remember {
|
||||||
mutableStateOf("0")
|
mutableStateOf("0")
|
||||||
@ -58,7 +53,6 @@ fun AmountScreen(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
if (canGoBack) {
|
|
||||||
IconButton(onClick = onBackClick) {
|
IconButton(onClick = onBackClick) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(R.drawable.ic_left_arrow),
|
painter = painterResource(R.drawable.ic_left_arrow),
|
||||||
@ -67,7 +61,6 @@ fun AmountScreen(
|
|||||||
tint = White
|
tint = White
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
colors = TopAppBarDefaults.topAppBarColors(
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
containerColor = Primary
|
containerColor = Primary
|
||||||
@ -111,27 +104,6 @@ fun AmountScreen(
|
|||||||
horizontalArrangement = Arrangement.spacedBy(14.dp)
|
horizontalArrangement = Arrangement.spacedBy(14.dp)
|
||||||
) {
|
) {
|
||||||
|
|
||||||
Button(
|
|
||||||
onClick = {
|
|
||||||
onNextClick(normalizeAmount(amount))
|
|
||||||
},
|
|
||||||
modifier = Modifier
|
|
||||||
.weight(if (canGoBack) 1f else 2f)
|
|
||||||
.height(68.dp),
|
|
||||||
shape = RoundedCornerShape(18.dp),
|
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
containerColor = Primary,
|
|
||||||
contentColor = White
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = "Enter",
|
|
||||||
fontSize = 20.sp,
|
|
||||||
fontWeight = FontWeight.Bold
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (canGoBack) {
|
|
||||||
Button(
|
Button(
|
||||||
onClick = onCancelClick,
|
onClick = onCancelClick,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -150,6 +122,25 @@ fun AmountScreen(
|
|||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
onNextClick(normalizeAmount(amount))
|
||||||
|
},
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.height(68.dp),
|
||||||
|
shape = RoundedCornerShape(18.dp),
|
||||||
|
colors = ButtonDefaults.buttonColors(
|
||||||
|
containerColor = Primary,
|
||||||
|
contentColor = White
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "Enter",
|
||||||
|
fontSize = 20.sp,
|
||||||
|
fontWeight = FontWeight.Bold
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +356,6 @@ private fun AmountScreenPreview() {
|
|||||||
|
|
||||||
AmountScreen(
|
AmountScreen(
|
||||||
action = "Amount",
|
action = "Amount",
|
||||||
canGoBack = true,
|
|
||||||
onBackClick = {}
|
onBackClick = {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,7 @@ fun CardWaitingScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BackHandler(enabled = uiState.canGoBack) {
|
BackHandler {
|
||||||
viewModel.onBackPressed()
|
viewModel.onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,6 @@ fun CardWaitingScreen(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
if (uiState.canGoBack) {
|
|
||||||
IconButton(onClick = onBack) {
|
IconButton(onClick = onBack) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(R.drawable.ic_left_arrow),
|
painter = painterResource(R.drawable.ic_left_arrow),
|
||||||
@ -98,7 +97,6 @@ fun CardWaitingScreen(
|
|||||||
tint = White
|
tint = White
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
colors = TopAppBarDefaults.topAppBarColors(
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
containerColor = Primary
|
containerColor = Primary
|
||||||
|
|||||||
@ -3,6 +3,5 @@ package com.mob.utsmyanmar.ui.cardwaiting
|
|||||||
data class CardWaitingUiState(
|
data class CardWaitingUiState(
|
||||||
val alertMessage: String = "Please insert, tap, or swipe card",
|
val alertMessage: String = "Please insert, tap, or swipe card",
|
||||||
val isLoading: Boolean = false,
|
val isLoading: Boolean = false,
|
||||||
val isFallback: Boolean = false,
|
val isFallback: Boolean = false
|
||||||
val canGoBack: Boolean = true
|
|
||||||
)
|
)
|
||||||
@ -61,11 +61,6 @@ class CardWaitingViewModel(
|
|||||||
retryCounter = 0
|
retryCounter = 0
|
||||||
fallbackCounter = SystemParamsOperation.getInstance().fallbackCounter
|
fallbackCounter = SystemParamsOperation.getInstance().fallbackCounter
|
||||||
fallbackEnabled = SystemParamsOperation.getInstance().fallbackEnabled
|
fallbackEnabled = SystemParamsOperation.getInstance().fallbackEnabled
|
||||||
val isSaleTransaction = sharedViewModel.transactionsType.value == TransactionsType.SALE
|
|
||||||
|
|
||||||
_uiState.update {
|
|
||||||
it.copy(canGoBack = !isSaleTransaction)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sharedViewModel.transactionsType.value == TransactionsType.REFUND) {
|
if (sharedViewModel.transactionsType.value == TransactionsType.REFUND) {
|
||||||
sharedViewModel.enableCardStatusIcon(false, false, false, false)
|
sharedViewModel.enableCardStatusIcon(false, false, false, false)
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
package com.mob.utsmyanmar.ui.dashboard
|
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun DashboardRoute(
|
|
||||||
onNavigateAmount: (String) -> Unit,
|
|
||||||
settlementEnabled: Boolean,
|
|
||||||
wavePayEnabled: Boolean,
|
|
||||||
) {
|
|
||||||
DashboardScreen(
|
|
||||||
settlementEnabled = settlementEnabled,
|
|
||||||
wavePayEnabled = wavePayEnabled,
|
|
||||||
onNavigateAmount = onNavigateAmount
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -29,11 +29,17 @@ import com.mob.utsmyanmar.ui.components.appbar.AppBar
|
|||||||
fun DashboardScreen(
|
fun DashboardScreen(
|
||||||
settlementEnabled: Boolean,
|
settlementEnabled: Boolean,
|
||||||
wavePayEnabled: Boolean,
|
wavePayEnabled: Boolean,
|
||||||
onNavigateAmount: (String) -> Unit
|
onAmountClick: (String) -> Unit,
|
||||||
|
onTransactionClick: () -> Unit,
|
||||||
|
onSettlementClick: () -> Unit,
|
||||||
|
onHistoryClick: () -> Unit,
|
||||||
|
onCardClick: () -> Unit,
|
||||||
|
onWavePayClick: () -> Unit
|
||||||
) {
|
) {
|
||||||
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
|
|
||||||
ModalNavigationDrawer(
|
ModalNavigationDrawer(
|
||||||
drawerState = drawerState,
|
drawerState = drawerState,
|
||||||
drawerContent = {
|
drawerContent = {
|
||||||
@ -65,6 +71,7 @@ fun DashboardScreen(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
scope.launch { drawerState.close() }
|
scope.launch { drawerState.close() }
|
||||||
|
onTransactionClick()
|
||||||
}
|
}
|
||||||
.padding(horizontal = 24.dp, vertical = 14.dp),
|
.padding(horizontal = 24.dp, vertical = 14.dp),
|
||||||
fontSize = 16.sp
|
fontSize = 16.sp
|
||||||
@ -75,6 +82,7 @@ fun DashboardScreen(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
scope.launch { drawerState.close() }
|
scope.launch { drawerState.close() }
|
||||||
|
onHistoryClick()
|
||||||
}
|
}
|
||||||
.padding(horizontal = 24.dp, vertical = 14.dp),
|
.padding(horizontal = 24.dp, vertical = 14.dp),
|
||||||
fontSize = 16.sp
|
fontSize = 16.sp
|
||||||
@ -85,6 +93,7 @@ fun DashboardScreen(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(enabled = settlementEnabled) {
|
.clickable(enabled = settlementEnabled) {
|
||||||
scope.launch { drawerState.close() }
|
scope.launch { drawerState.close() }
|
||||||
|
onSettlementClick()
|
||||||
}
|
}
|
||||||
.padding(horizontal = 24.dp, vertical = 14.dp),
|
.padding(horizontal = 24.dp, vertical = 14.dp),
|
||||||
color = if (settlementEnabled) Black else White,
|
color = if (settlementEnabled) Black else White,
|
||||||
@ -96,6 +105,7 @@ fun DashboardScreen(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(enabled = wavePayEnabled) {
|
.clickable(enabled = wavePayEnabled) {
|
||||||
scope.launch { drawerState.close() }
|
scope.launch { drawerState.close() }
|
||||||
|
onWavePayClick()
|
||||||
}
|
}
|
||||||
.padding(horizontal = 24.dp, vertical = 14.dp),
|
.padding(horizontal = 24.dp, vertical = 14.dp),
|
||||||
color = if (wavePayEnabled) Black else White,
|
color = if (wavePayEnabled) Black else White,
|
||||||
@ -166,7 +176,7 @@ fun DashboardScreen(
|
|||||||
contentColor = Primary,
|
contentColor = Primary,
|
||||||
iconTint = Primary,
|
iconTint = Primary,
|
||||||
border = null,
|
border = null,
|
||||||
onClick = { onNavigateAmount("Sale") },
|
onClick = { onAmountClick("Sale") },
|
||||||
)
|
)
|
||||||
SquareButton(
|
SquareButton(
|
||||||
title = "Sign On",
|
title = "Sign On",
|
||||||
@ -176,7 +186,7 @@ fun DashboardScreen(
|
|||||||
contentColor = Primary,
|
contentColor = Primary,
|
||||||
iconTint = Primary,
|
iconTint = Primary,
|
||||||
border = null,
|
border = null,
|
||||||
onClick = { onNavigateAmount("Sign On") }
|
onClick = { onAmountClick("Sign On") }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +203,7 @@ fun DashboardScreen(
|
|||||||
contentColor = Primary,
|
contentColor = Primary,
|
||||||
iconTint = Primary,
|
iconTint = Primary,
|
||||||
border = null,
|
border = null,
|
||||||
onClick = {}
|
onClick = onSettlementClick
|
||||||
)
|
)
|
||||||
SquareButton(
|
SquareButton(
|
||||||
title = "Others",
|
title = "Others",
|
||||||
@ -203,7 +213,7 @@ fun DashboardScreen(
|
|||||||
contentColor = Primary,
|
contentColor = Primary,
|
||||||
iconTint = Primary,
|
iconTint = Primary,
|
||||||
border = null,
|
border = null,
|
||||||
onClick = {}
|
onClick = onCardClick
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +230,12 @@ private fun DashboardScreenPreview() {
|
|||||||
DashboardScreen(
|
DashboardScreen(
|
||||||
settlementEnabled = true,
|
settlementEnabled = true,
|
||||||
wavePayEnabled = true,
|
wavePayEnabled = true,
|
||||||
onNavigateAmount = {}
|
onAmountClick = {},
|
||||||
|
onTransactionClick = {},
|
||||||
|
onSettlementClick = {},
|
||||||
|
onHistoryClick = {},
|
||||||
|
onCardClick = {},
|
||||||
|
onWavePayClick = {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.mob.utsmyanmar.ui.navigation
|
package com.mob.utsmyanmar.ui.navigation
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
@ -11,10 +10,11 @@ import androidx.navigation.NavType
|
|||||||
import androidx.navigation.compose.NavHost
|
import androidx.navigation.compose.NavHost
|
||||||
import androidx.navigation.compose.composable
|
import androidx.navigation.compose.composable
|
||||||
import androidx.navigation.navArgument
|
import androidx.navigation.navArgument
|
||||||
import com.mob.utsmyanmar.ui.amount.AmountRoute
|
import com.mob.utsmyanmar.model.ProcessCode
|
||||||
|
import com.mob.utsmyanmar.ui.amount.AmountScreen
|
||||||
import com.mob.utsmyanmar.ui.cardwaiting.CardWaitingScreen
|
import com.mob.utsmyanmar.ui.cardwaiting.CardWaitingScreen
|
||||||
import com.mob.utsmyanmar.ui.cardwaiting.CardWaitingViewModel
|
import com.mob.utsmyanmar.ui.cardwaiting.CardWaitingViewModel
|
||||||
import com.mob.utsmyanmar.ui.dashboard.DashboardRoute
|
import com.mob.utsmyanmar.ui.dashboard.DashboardScreen
|
||||||
import com.mob.utsmyanmar.ui.pinpad.PinPadRoute
|
import com.mob.utsmyanmar.ui.pinpad.PinPadRoute
|
||||||
import com.mob.utsmyanmar.ui.processing_card.ProcessingCardRoute
|
import com.mob.utsmyanmar.ui.processing_card.ProcessingCardRoute
|
||||||
import com.mob.utsmyanmar.ui.processing_card.ProcessingCardViewModel
|
import com.mob.utsmyanmar.ui.processing_card.ProcessingCardViewModel
|
||||||
@ -25,8 +25,8 @@ import com.mob.utsmyanmar.viewmodel.EmvTransactionProcessViewModel
|
|||||||
import com.mob.utsmyanmar.ui.pinpad.PinPadViewModel
|
import com.mob.utsmyanmar.ui.pinpad.PinPadViewModel
|
||||||
import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
||||||
import com.mob.utsmyanmar.viewmodel.TransProcessViewModel
|
import com.mob.utsmyanmar.viewmodel.TransProcessViewModel
|
||||||
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
||||||
|
|
||||||
@SuppressLint("ContextCastToActivity")
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppNavGraph(
|
fun AppNavGraph(
|
||||||
navController: NavHostController
|
navController: NavHostController
|
||||||
@ -38,17 +38,17 @@ fun AppNavGraph(
|
|||||||
startDestination = Routes.Dashboard.route
|
startDestination = Routes.Dashboard.route
|
||||||
) {
|
) {
|
||||||
composable(Routes.Dashboard.route) {
|
composable(Routes.Dashboard.route) {
|
||||||
DashboardRoute(
|
DashboardScreen(
|
||||||
onNavigateAmount = { action ->
|
|
||||||
navController.navigate(Routes.Amount.createRoute(action)) {
|
|
||||||
popUpTo(Routes.Dashboard.route) {
|
|
||||||
inclusive = false
|
|
||||||
}
|
|
||||||
launchSingleTop = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
settlementEnabled = true,
|
settlementEnabled = true,
|
||||||
wavePayEnabled = true
|
wavePayEnabled = true,
|
||||||
|
onAmountClick = { action ->
|
||||||
|
navController.navigate(Routes.Amount.createRoute(action))
|
||||||
|
},
|
||||||
|
onTransactionClick = {},
|
||||||
|
onSettlementClick = {},
|
||||||
|
onHistoryClick = {},
|
||||||
|
onCardClick = {},
|
||||||
|
onWavePayClick = {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,17 +62,20 @@ fun AppNavGraph(
|
|||||||
) { backStackEntry ->
|
) { backStackEntry ->
|
||||||
val sharedViewModel: SharedViewModel = hiltViewModel(activity)
|
val sharedViewModel: SharedViewModel = hiltViewModel(activity)
|
||||||
|
|
||||||
AmountRoute(
|
AmountScreen(
|
||||||
action = backStackEntry.arguments?.getString("action").orEmpty(),
|
action = backStackEntry.arguments?.getString("action").orEmpty(),
|
||||||
sharedViewModel = sharedViewModel,
|
onBackClick = { navController.popBackStack() },
|
||||||
onBack = { navController.popBackStack() },
|
onCancelClick = { navController.popBackStack() },
|
||||||
onNavigateCardWaiting = {
|
onNextClick = { amount ->
|
||||||
navController.navigate(Routes.CardWaiting.route) {
|
sharedViewModel.amount.value = amount
|
||||||
popUpTo(Routes.Amount.route) {
|
sharedViewModel.setAmountExist(true)
|
||||||
inclusive = true
|
sharedViewModel.setCardDataExist(false)
|
||||||
}
|
sharedViewModel.setTransMenu(null)
|
||||||
launchSingleTop = true
|
sharedViewModel.transactionsType.value = TransactionsType.SALE
|
||||||
}
|
sharedViewModel.processCode.value =
|
||||||
|
ProcessCode.SALE_PURCHASE + ProcessCode.SMART + ProcessCode.TO_ACCOUNT
|
||||||
|
|
||||||
|
navController.navigate(Routes.CardWaiting.route)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -91,12 +94,7 @@ fun AppNavGraph(
|
|||||||
viewModel = cardWaitingViewModel,
|
viewModel = cardWaitingViewModel,
|
||||||
onManualEntry = {},
|
onManualEntry = {},
|
||||||
onProcessingCard = {
|
onProcessingCard = {
|
||||||
navController.navigate(Routes.ProcessingCard.route) {
|
navController.navigate(Routes.ProcessingCard.route)
|
||||||
popUpTo(Routes.CardWaiting.route) {
|
|
||||||
inclusive = true
|
|
||||||
}
|
|
||||||
launchSingleTop = true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onTimeout = { navController.popBackStack() },
|
onTimeout = { navController.popBackStack() },
|
||||||
onBack = { navController.popBackStack() },
|
onBack = { navController.popBackStack() },
|
||||||
@ -130,12 +128,7 @@ fun AppNavGraph(
|
|||||||
ProcessingCardRoute(
|
ProcessingCardRoute(
|
||||||
viewModel = processingCardViewModel,
|
viewModel = processingCardViewModel,
|
||||||
onNavigatePinPad = {
|
onNavigatePinPad = {
|
||||||
navController.navigate(Routes.PinPad.route) {
|
navController.navigate(Routes.PinPad.route)
|
||||||
popUpTo(Routes.ProcessingCard.route) {
|
|
||||||
inclusive = true
|
|
||||||
}
|
|
||||||
launchSingleTop = true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onNavigateInputAmount = { navController.popBackStack(Routes.Amount.route, false) },
|
onNavigateInputAmount = { navController.popBackStack(Routes.Amount.route, false) },
|
||||||
onNavigateProcessing = {},
|
onNavigateProcessing = {},
|
||||||
@ -157,8 +150,8 @@ fun AppNavGraph(
|
|||||||
transProcessViewModel = transProcessViewModel,
|
transProcessViewModel = transProcessViewModel,
|
||||||
onNavigateTransactionResult = {
|
onNavigateTransactionResult = {
|
||||||
navController.navigate(Routes.TransactionResult.route) {
|
navController.navigate(Routes.TransactionResult.route) {
|
||||||
popUpTo(Routes.PinPad.route) {
|
popUpTo(Routes.Dashboard.route) {
|
||||||
inclusive = true
|
inclusive = false
|
||||||
}
|
}
|
||||||
launchSingleTop = true
|
launchSingleTop = true
|
||||||
}
|
}
|
||||||
@ -196,7 +189,6 @@ fun AppNavGraph(
|
|||||||
|
|
||||||
composable(Routes.PrintReceipt.route) {
|
composable(Routes.PrintReceipt.route) {
|
||||||
PrintReceiptScreen(
|
PrintReceiptScreen(
|
||||||
onPrint = {},
|
|
||||||
onDone = {
|
onDone = {
|
||||||
navController.navigate(Routes.Dashboard.route) {
|
navController.navigate(Routes.Dashboard.route) {
|
||||||
popUpTo(Routes.Dashboard.route) {
|
popUpTo(Routes.Dashboard.route) {
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.mob.utsmyanmar.ui.pinpad
|
package com.mob.utsmyanmar.ui.pinpad
|
||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.DisposableEffect
|
import androidx.compose.runtime.DisposableEffect
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
@ -10,7 +9,6 @@ import com.mob.utsmyanmar.model.PinPadStatus
|
|||||||
import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
||||||
import com.mob.utsmyanmar.viewmodel.TransProcessViewModel
|
import com.mob.utsmyanmar.viewmodel.TransProcessViewModel
|
||||||
import com.utsmyanmar.paylibs.Constant
|
import com.utsmyanmar.paylibs.Constant
|
||||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PinPadRoute(
|
fun PinPadRoute(
|
||||||
@ -23,11 +21,6 @@ fun PinPadRoute(
|
|||||||
val pinText by pinPadViewModel.pinText.collectAsStateWithLifecycle()
|
val pinText by pinPadViewModel.pinText.collectAsStateWithLifecycle()
|
||||||
val alertMsg by pinPadViewModel.alertMsg.collectAsStateWithLifecycle()
|
val alertMsg by pinPadViewModel.alertMsg.collectAsStateWithLifecycle()
|
||||||
val pinStatus by pinPadViewModel.pinStatus.collectAsStateWithLifecycle()
|
val pinStatus by pinPadViewModel.pinStatus.collectAsStateWithLifecycle()
|
||||||
val canGoBack = sharedViewModel.transactionsType.value != TransactionsType.SALE
|
|
||||||
|
|
||||||
BackHandler(enabled = canGoBack) {
|
|
||||||
onBack()
|
|
||||||
}
|
|
||||||
|
|
||||||
LaunchedEffect(pinStatus) {
|
LaunchedEffect(pinStatus) {
|
||||||
when (pinStatus) {
|
when (pinStatus) {
|
||||||
@ -59,7 +52,6 @@ fun PinPadRoute(
|
|||||||
PinPadScreen(
|
PinPadScreen(
|
||||||
pinText = pinText,
|
pinText = pinText,
|
||||||
alertMessage = alertMsg,
|
alertMessage = alertMsg,
|
||||||
canGoBack = canGoBack,
|
|
||||||
onBack = onBack,
|
onBack = onBack,
|
||||||
onKeyboardReady = { keyboard ->
|
onKeyboardReady = { keyboard ->
|
||||||
pinPadViewModel.startPinPadProcess(keyboard)
|
pinPadViewModel.startPinPadProcess(keyboard)
|
||||||
|
|||||||
@ -42,7 +42,6 @@ import com.utsmyanmar.baselib.ui.CustomPinPadKeyboard
|
|||||||
fun PinPadScreen(
|
fun PinPadScreen(
|
||||||
pinText: String,
|
pinText: String,
|
||||||
alertMessage: String?,
|
alertMessage: String?,
|
||||||
canGoBack: Boolean,
|
|
||||||
onBack: () -> Unit,
|
onBack: () -> Unit,
|
||||||
onKeyboardReady: (CustomPinPadKeyboard) -> Unit
|
onKeyboardReady: (CustomPinPadKeyboard) -> Unit
|
||||||
) {
|
) {
|
||||||
@ -69,7 +68,6 @@ fun PinPadScreen(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
if (canGoBack) {
|
|
||||||
IconButton(onClick = onBack) {
|
IconButton(onClick = onBack) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(R.drawable.ic_left_arrow),
|
painter = painterResource(R.drawable.ic_left_arrow),
|
||||||
@ -77,7 +75,6 @@ fun PinPadScreen(
|
|||||||
tint = White
|
tint = White
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
colors = TopAppBarDefaults.topAppBarColors(
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
containerColor = Primary
|
containerColor = Primary
|
||||||
@ -166,11 +163,7 @@ fun PinPadScreen(
|
|||||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = if (canGoBack) {
|
text = "Cancel on device or use back to exit.",
|
||||||
"Cancel on device or use back to exit."
|
|
||||||
} else {
|
|
||||||
"Cancel on device to exit."
|
|
||||||
},
|
|
||||||
color = Black,
|
color = Black,
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center
|
||||||
|
|||||||
@ -1,236 +1,63 @@
|
|||||||
package com.mob.utsmyanmar.ui.print_receipt
|
package com.mob.utsmyanmar.ui.print_receipt
|
||||||
|
|
||||||
import android.util.Log
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.border
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.ButtonDefaults
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.OutlinedButton
|
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.text.font.FontFamily
|
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.mob.utsmyanmar.ui.components.appbar.AppBar
|
import com.mob.utsmyanmar.ui.components.appbar.AppBar
|
||||||
import com.mob.utsmyanmar.ui.theme.Primary
|
|
||||||
import com.mob.utsmyanmar.ui.theme.White
|
|
||||||
import com.utsmyanmar.paylibs.print.NewPrintReceipt
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PrintReceiptScreen(
|
fun PrintReceiptScreen(
|
||||||
onPrint: () -> Unit,
|
|
||||||
onDone: () -> Unit
|
onDone: () -> Unit
|
||||||
) {
|
) {
|
||||||
BackHandler {
|
|
||||||
onDone()
|
|
||||||
}
|
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
AppBar(title = "Receipt")
|
AppBar(title = "Print Receipt")
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(paddingValues)
|
.padding(paddingValues)
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(Color(0xFFF5F5F5))
|
|
||||||
.padding(16.dp),
|
.padding(16.dp),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
verticalArrangement = Arrangement.Center,
|
||||||
) {
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
|
||||||
ReceiptPreview(
|
|
||||||
modifier = Modifier
|
|
||||||
.weight(1f)
|
|
||||||
.verticalScroll(rememberScrollState())
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
|
||||||
|
|
||||||
Row(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(12.dp)
|
|
||||||
) {
|
|
||||||
|
|
||||||
OutlinedButton(
|
|
||||||
onClick = onDone,
|
|
||||||
modifier = Modifier
|
|
||||||
.weight(1f)
|
|
||||||
.height(50.dp),
|
|
||||||
shape = RoundedCornerShape(12.dp)
|
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "Cancel",
|
text = "Print Receipt",
|
||||||
style = MaterialTheme.typography.bodyLarge.copy(
|
style = MaterialTheme.typography.titleLarge.copy(
|
||||||
fontSize = 16.sp,
|
fontSize = 24.sp,
|
||||||
fontWeight = FontWeight.SemiBold
|
fontWeight = FontWeight.SemiBold
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
Button(
|
Button(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
|
||||||
.height(50.dp),
|
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
containerColor = Primary,
|
|
||||||
contentColor = White,
|
|
||||||
disabledContainerColor = Primary,
|
|
||||||
disabledContentColor = White,
|
|
||||||
),
|
|
||||||
shape = RoundedCornerShape(12.dp),
|
|
||||||
onClick = {
|
|
||||||
onPrint()
|
|
||||||
try {
|
|
||||||
NewPrintReceipt.getInstance().testPrint()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.d("PrintReceipt", "error with $e")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = "Print",
|
|
||||||
style = MaterialTheme.typography.bodyLarge.copy(
|
|
||||||
fontSize = 16.sp,
|
|
||||||
fontWeight = FontWeight.SemiBold
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun ReceiptPreview(
|
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clip(RoundedCornerShape(12.dp))
|
.padding(top = 24.dp),
|
||||||
.background(Color.White)
|
onClick = onDone
|
||||||
.border(
|
|
||||||
width = 1.dp,
|
|
||||||
color = Color.LightGray,
|
|
||||||
shape = RoundedCornerShape(12.dp)
|
|
||||||
)
|
|
||||||
.padding(20.dp),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
|
||||||
) {
|
) {
|
||||||
|
Text(text = "Back to Dashboard")
|
||||||
Text(
|
}
|
||||||
text = "MOB POS",
|
|
||||||
fontSize = 24.sp,
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
fontFamily = FontFamily.Monospace
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = "Transaction Receipt",
|
|
||||||
fontSize = 14.sp,
|
|
||||||
fontFamily = FontFamily.Monospace
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
|
||||||
|
|
||||||
ReceiptDivider()
|
|
||||||
|
|
||||||
ReceiptRow("Merchant", "MOB UTS Myanmar")
|
|
||||||
ReceiptRow("Terminal ID", "POS001")
|
|
||||||
ReceiptRow("Transaction", "SALE")
|
|
||||||
ReceiptRow("Amount", "500.00 MMK")
|
|
||||||
ReceiptRow("Card Type", "MPU")
|
|
||||||
ReceiptRow("Card No", "1234 **** **** 5678")
|
|
||||||
ReceiptRow("Status", "SUCCESS")
|
|
||||||
ReceiptRow("Date", "13/05/2026")
|
|
||||||
ReceiptRow("Time", "14:30:22")
|
|
||||||
ReceiptRow("Ref No", "REF123456789")
|
|
||||||
|
|
||||||
ReceiptDivider()
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = "Thank You",
|
|
||||||
fontSize = 16.sp,
|
|
||||||
fontWeight = FontWeight.SemiBold,
|
|
||||||
fontFamily = FontFamily.Monospace
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(4.dp))
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = "Please keep this receipt",
|
|
||||||
fontSize = 12.sp,
|
|
||||||
fontFamily = FontFamily.Monospace
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun ReceiptRow(
|
|
||||||
label: String,
|
|
||||||
value: String
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(vertical = 6.dp),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = label,
|
|
||||||
fontSize = 13.sp,
|
|
||||||
fontFamily = FontFamily.Monospace,
|
|
||||||
color = Color.DarkGray
|
|
||||||
)
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = value,
|
|
||||||
fontSize = 13.sp,
|
|
||||||
fontWeight = FontWeight.SemiBold,
|
|
||||||
fontFamily = FontFamily.Monospace
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun ReceiptDivider() {
|
|
||||||
Text(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(vertical = 10.dp),
|
|
||||||
text = "--------------------------------",
|
|
||||||
fontFamily = FontFamily.Monospace,
|
|
||||||
color = Color.Gray
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Preview(showBackground = true, showSystemUi = true)
|
@Preview(showBackground = true, showSystemUi = true)
|
||||||
@Composable
|
@Composable
|
||||||
fun PreviewPrintReceiptScreen() {
|
fun PreviewPrintReceiptScreen() {
|
||||||
MaterialTheme {
|
PrintReceiptScreen { }
|
||||||
PrintReceiptScreen(
|
|
||||||
onPrint = {},
|
|
||||||
onDone = {}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import androidx.compose.runtime.getValue
|
|||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
||||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TransactionResultRoute(
|
fun TransactionResultRoute(
|
||||||
@ -20,7 +19,6 @@ fun TransactionResultRoute(
|
|||||||
onShowPrinterDialog: (String) -> Unit
|
onShowPrinterDialog: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
val state by viewModel.state.collectAsStateWithLifecycle()
|
val state by viewModel.state.collectAsStateWithLifecycle()
|
||||||
val canGoBack = sharedViewModel.transactionsType.value != TransactionsType.SALE
|
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
viewModel.onEvent(
|
viewModel.onEvent(
|
||||||
@ -43,7 +41,6 @@ fun TransactionResultRoute(
|
|||||||
|
|
||||||
TransactionResultScreen(
|
TransactionResultScreen(
|
||||||
state = state,
|
state = state,
|
||||||
canGoBack = canGoBack,
|
|
||||||
onEvent = {
|
onEvent = {
|
||||||
viewModel.onEvent(it, sharedViewModel)
|
viewModel.onEvent(it, sharedViewModel)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.mob.utsmyanmar.ui.transaction_result
|
package com.mob.utsmyanmar.ui.transaction_result
|
||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@ -47,21 +46,14 @@ import com.mob.utsmyanmar.ui.theme.White
|
|||||||
@Composable
|
@Composable
|
||||||
fun TransactionResultScreen(
|
fun TransactionResultScreen(
|
||||||
state: TransactionResultState,
|
state: TransactionResultState,
|
||||||
canGoBack: Boolean,
|
|
||||||
onEvent: (TransactionResultEvent) -> Unit,
|
onEvent: (TransactionResultEvent) -> Unit,
|
||||||
) {
|
) {
|
||||||
BackHandler(enabled = !canGoBack) {}
|
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
AppBar(
|
AppBar(
|
||||||
title = "Transaction Results",
|
title = "Transaction Results",
|
||||||
icon = if (canGoBack) Icons.Default.ChevronLeft else null,
|
icon = Icons.Default.ChevronLeft,
|
||||||
onIconClick = if (canGoBack) {
|
onIconClick = { TransactionResultEvent.BackClick }
|
||||||
{ onEvent(TransactionResultEvent.BackClick) }
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
@ -262,7 +254,6 @@ fun TransactionResultScreenPreview() {
|
|||||||
message = "Transaction Approved",
|
message = "Transaction Approved",
|
||||||
isLoading = false
|
isLoading = false
|
||||||
),
|
),
|
||||||
canGoBack = true,
|
|
||||||
onEvent = {}
|
onEvent = {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,7 +75,6 @@ dependencies {
|
|||||||
implementation project(path: ':sunmiui-lib')
|
implementation project(path: ':sunmiui-lib')
|
||||||
// implementation 'com.sunmi:printerlibrary:1.0.9'
|
// implementation 'com.sunmi:printerlibrary:1.0.9'
|
||||||
implementation 'com.sunmi:printerlibrary:1.0.23'
|
implementation 'com.sunmi:printerlibrary:1.0.23'
|
||||||
implementation 'com.sunmi:printerx:1.0.17'
|
|
||||||
|
|
||||||
//RxJava
|
//RxJava
|
||||||
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
|
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
|
||||||
|
|||||||
@ -98,7 +98,7 @@ public class BaseApplication extends Application {
|
|||||||
mPinPadOptV2 = sunmiPayKernel.mPinPadOptV2;
|
mPinPadOptV2 = sunmiPayKernel.mPinPadOptV2;
|
||||||
mReadCardOptV2 = sunmiPayKernel.mReadCardOptV2;
|
mReadCardOptV2 = sunmiPayKernel.mReadCardOptV2;
|
||||||
mSecurityOptV2 = sunmiPayKernel.mSecurityOptV2;
|
mSecurityOptV2 = sunmiPayKernel.mSecurityOptV2;
|
||||||
PayLibsUtils.getInstance().initPrinterX();
|
|
||||||
PayLibsUtils.getInstance().initLib(mSecurityOptV2,mEMVOptV2,securityOpt,mReadCardOptV2);
|
PayLibsUtils.getInstance().initLib(mSecurityOptV2,mEMVOptV2,securityOpt,mReadCardOptV2);
|
||||||
SunmiSDK.getInstance().initSDK(mReadCardOptV2,basicOptV2);
|
SunmiSDK.getInstance().initSDK(mReadCardOptV2,basicOptV2);
|
||||||
|
|
||||||
|
|||||||
@ -66,7 +66,6 @@ dependencies {
|
|||||||
|
|
||||||
// implementation 'com.sunmi:printerlibrary:1.0.9'
|
// implementation 'com.sunmi:printerlibrary:1.0.9'
|
||||||
implementation 'com.sunmi:printerlibrary:1.0.24'
|
implementation 'com.sunmi:printerlibrary:1.0.24'
|
||||||
implementation 'com.sunmi:printerx:1.0.17'
|
|
||||||
//paySDK
|
//paySDK
|
||||||
// implementation project(path:':PayLib-release-1.4.58')
|
// implementation project(path:':PayLib-release-1.4.58')
|
||||||
implementation project(path: ':sunmiui-lib')
|
implementation project(path: ':sunmiui-lib')
|
||||||
|
|||||||
@ -7,12 +7,6 @@ import com.sunmi.pay.hardware.aidlv2.emv.EMVOptV2;
|
|||||||
import com.sunmi.pay.hardware.aidlv2.readcard.ReadCardOptV2;
|
import com.sunmi.pay.hardware.aidlv2.readcard.ReadCardOptV2;
|
||||||
import com.sunmi.pay.hardware.aidlv2.security.SecurityOptV2;
|
import com.sunmi.pay.hardware.aidlv2.security.SecurityOptV2;
|
||||||
import com.sunmi.peripheral.printer.SunmiPrinterService;
|
import com.sunmi.peripheral.printer.SunmiPrinterService;
|
||||||
import com.sunmi.printerx.PrinterSdk;
|
|
||||||
import com.sunmi.printerx.SdkException;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import sunmi.sunmiui.utils.LogUtil;
|
|
||||||
|
|
||||||
public class PayLibsUtils {
|
public class PayLibsUtils {
|
||||||
|
|
||||||
@ -30,8 +24,6 @@ public class PayLibsUtils {
|
|||||||
|
|
||||||
public ReadCardOptV2 readCardOptV2;
|
public ReadCardOptV2 readCardOptV2;
|
||||||
|
|
||||||
public PrinterSdk.Printer printer;
|
|
||||||
|
|
||||||
private PayLibsUtils(){}
|
private PayLibsUtils(){}
|
||||||
|
|
||||||
public static PayLibsUtils getInstance(){
|
public static PayLibsUtils getInstance(){
|
||||||
@ -57,21 +49,8 @@ public class PayLibsUtils {
|
|||||||
this.readCardOptV2 = readCardOptV2;
|
this.readCardOptV2 = readCardOptV2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initPrinterX() throws SdkException {
|
|
||||||
PrinterSdk.getInstance().getPrinter(
|
|
||||||
context,
|
|
||||||
new PrinterSdk.PrinterListen() {
|
|
||||||
@Override
|
|
||||||
public void onDefPrinter(PrinterSdk.Printer defPrinter) {
|
|
||||||
LogUtil.d("PayLibsUtils", "init printer : " + defPrinter);
|
|
||||||
printer = defPrinter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPrinters(List<PrinterSdk.Printer> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,35 +0,0 @@
|
|||||||
package com.utsmyanmar.paylibs.print;
|
|
||||||
|
|
||||||
import com.sunmi.printerx.PrinterSdk;
|
|
||||||
import com.sunmi.printerx.SdkException;
|
|
||||||
import com.sunmi.printerx.style.TextStyle;
|
|
||||||
|
|
||||||
public class NewPrintReceipt {
|
|
||||||
|
|
||||||
private static NewPrintReceipt instance;
|
|
||||||
|
|
||||||
private PrinterSdk.Printer printer;
|
|
||||||
|
|
||||||
private NewPrintReceipt() {}
|
|
||||||
|
|
||||||
public static synchronized NewPrintReceipt getInstance() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new NewPrintReceipt();
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrinter(PrinterSdk.Printer printer) {
|
|
||||||
this.printer = printer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testPrint() throws SdkException {
|
|
||||||
|
|
||||||
if (printer == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
printer.lineApi().addText("testing", TextStyle.getStyle());
|
|
||||||
printer.lineApi().autoOut();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -77,8 +77,6 @@ public class PrintReceipt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void clearQueue() throws RemoteException {
|
public void clearQueue() throws RemoteException {
|
||||||
sunmiPrinterService.clearBuffer();
|
sunmiPrinterService.clearBuffer();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user