diff --git a/app/src/main/java/com/mob/utsmyanmar/ui/dashboard/DashboardScreen2.kt b/app/src/main/java/com/mob/utsmyanmar/ui/dashboard/DashboardScreen2.kt index e14fc09..760dd4e 100644 --- a/app/src/main/java/com/mob/utsmyanmar/ui/dashboard/DashboardScreen2.kt +++ b/app/src/main/java/com/mob/utsmyanmar/ui/dashboard/DashboardScreen2.kt @@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.foundation.shape.CircleShape @@ -33,11 +34,13 @@ import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.AlertDialog import androidx.compose.material3.DrawerValue +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ModalDrawerSheet import androidx.compose.material3.ModalNavigationDrawer import androidx.compose.material3.NavigationDrawerItem import androidx.compose.material3.NavigationDrawerItemDefaults import androidx.compose.material3.Scaffold +import androidx.compose.material3.Switch import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.material3.VerticalDivider @@ -70,6 +73,7 @@ import com.mob.utsmyanmar.ui.preview.P3Preview import com.mob.utsmyanmar.ui.theme.Color import com.utsmyanmar.paylibs.sign_on.EchoTestProcess import com.utsmyanmar.paylibs.sign_on.SignOnListener +import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -267,6 +271,20 @@ fun DashboardScreen2( fontWeight = FontWeight.Medium, modifier = Modifier.padding(horizontal = 16.dp) ) + var switchChecked by remember { mutableStateOf(SystemParamsOperation.getInstance().isReversalOn) } + DrawerItem( + title = "Reversal On/Off", + icon = Icons.Default.Sync, + showSwitch = true, + isChecked = switchChecked, + onCheckedChange = { isChecked -> + switchChecked = isChecked + SystemParamsOperation.getInstance().setReversalFlag(isChecked) + + }, + onClick = {} + ) + DrawerItem("Function", Icons.Default.Dashboard) { scope.launch { drawerState.close() } } @@ -274,6 +292,7 @@ fun DashboardScreen2( scope.launch { drawerState.close() } onNavigateVersion() } + } }) { Scaffold( @@ -325,21 +344,44 @@ fun DashboardScreen2( @Composable private fun DrawerItem( - title: String, icon: ImageVector, onClick: () -> Unit + title: String, + icon: ImageVector, + showSwitch: Boolean = false, // New: Flag to enable switch mode + isChecked: Boolean = false, // New: Switch state + onCheckedChange: (Boolean) -> Unit = {}, // New: Switch callback + onClick: () -> Unit ) { NavigationDrawerItem( label = { Text( - text = title, fontWeight = FontWeight.Medium + text = title, + fontWeight = FontWeight.Medium ) }, selected = false, - onClick = onClick, + // If it's a switch item, clicking the whole row toggles the switch instead of navigating + onClick = { + if (showSwitch) { + onCheckedChange(!isChecked) + } else { + onClick() + } + }, icon = { Icon( - imageVector = icon, contentDescription = title + imageVector = icon, + contentDescription = title ) }, + + badge = { + if (showSwitch) { + Switch( + checked = isChecked, + onCheckedChange = onCheckedChange + ) + } + }, modifier = Modifier.padding(horizontal = 12.dp, vertical = 2.dp), colors = NavigationDrawerItemDefaults.colors( unselectedContainerColor = androidx.compose.ui.graphics.Color.Transparent, diff --git a/app/src/main/java/com/mob/utsmyanmar/ui/navigation/AppNavGraph.kt b/app/src/main/java/com/mob/utsmyanmar/ui/navigation/AppNavGraph.kt index ee88c95..1deca99 100644 --- a/app/src/main/java/com/mob/utsmyanmar/ui/navigation/AppNavGraph.kt +++ b/app/src/main/java/com/mob/utsmyanmar/ui/navigation/AppNavGraph.kt @@ -35,6 +35,8 @@ import com.mob.utsmyanmar.viewmodel.CardReaderViewModel import com.mob.utsmyanmar.viewmodel.EmvTransactionProcessViewModel import com.mob.utsmyanmar.ui.pinpad.PinPadViewModel import com.mob.utsmyanmar.ui.settlement.SettlementViewModel +import com.mob.utsmyanmar.ui.transaction_result.TransactionResultEvent +import com.mob.utsmyanmar.ui.transaction_result.TransactionResultViewModel import com.mob.utsmyanmar.ui.version.VersionScreen import com.mob.utsmyanmar.viewmodel.SharedViewModel import com.mob.utsmyanmar.viewmodel.TransProcessViewModel @@ -397,8 +399,9 @@ fun AppNavGraph( composable(Routes.TransactionResult.route) { val sharedViewModel: SharedViewModel = hiltViewModel(activity) - + val transResultViewModel: TransactionResultViewModel = hiltViewModel(activity) TransactionResultRoute( + viewModel = transResultViewModel, sharedViewModel = sharedViewModel, onNavigateMain = { navController.navigate(Routes.Dashboard.route) { @@ -423,8 +426,17 @@ fun AppNavGraph( } composable(Routes.PrintReceipt.route) { + val sharedViewModel: SharedViewModel = hiltViewModel(activity) + val transResultViewModel: TransactionResultViewModel = hiltViewModel(activity) PrintReceiptScreen( - onPrint = {}, + sharedViewModel = sharedViewModel, + transactionResultViewModel = transResultViewModel, + onPrint = { + transResultViewModel.onEvent( + TransactionResultEvent.RetryPrint, + sharedViewModel + ) + }, onDone = { navController.navigate(Routes.Dashboard.route) { popUpTo(Routes.Dashboard.route) { diff --git a/app/src/main/java/com/mob/utsmyanmar/ui/print_receipt/PrintReceiptScreen.kt b/app/src/main/java/com/mob/utsmyanmar/ui/print_receipt/PrintReceiptScreen.kt index 4d177de..c989aa5 100644 --- a/app/src/main/java/com/mob/utsmyanmar/ui/print_receipt/PrintReceiptScreen.kt +++ b/app/src/main/java/com/mob/utsmyanmar/ui/print_receipt/PrintReceiptScreen.kt @@ -18,6 +18,8 @@ import androidx.compose.material3.OutlinedButton import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment @@ -29,25 +31,35 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.mob.utsmyanmar.ui.components.appbar.AppBar import com.mob.utsmyanmar.ui.theme.Color +import com.mob.utsmyanmar.ui.transaction_result.TransactionResultEvent +import com.mob.utsmyanmar.ui.transaction_result.TransactionResultState +import com.mob.utsmyanmar.ui.transaction_result.TransactionResultViewModel +import com.mob.utsmyanmar.viewmodel.SharedViewModel import com.utsmyanmar.paylibs.print.PrintReceipt +import com.utsmyanmar.paylibs.utils.POSUtil import kotlinx.coroutines.delay import kotlinx.coroutines.launch @Composable fun PrintReceiptScreen( + transactionResultViewModel: TransactionResultViewModel, + sharedViewModel: SharedViewModel, onPrint: () -> Unit, onDone: () -> Unit ) { - + val state by transactionResultViewModel.state.collectAsStateWithLifecycle() val scope = rememberCoroutineScope(); val receiptOffsetY = remember { Animatable(0f); } val animationDuration = 3000; + Scaffold( topBar = { AppBar(title = "Receipt") @@ -64,6 +76,7 @@ fun PrintReceiptScreen( ) { ReceiptPreview( + state = state, modifier = Modifier .weight(1f) .verticalScroll(rememberScrollState()) @@ -107,35 +120,35 @@ fun PrintReceiptScreen( ), shape = RoundedCornerShape(12.dp), onClick = { -// onPrint() - try { - PrintReceipt.getInstance().printNow() - scope.launch { - launch { - receiptOffsetY.animateTo( - targetValue = -1500f, - animationSpec = tween( - durationMillis = animationDuration, - easing = FastOutSlowInEasing - ) - ) - } - delay(5000) - launch { - receiptOffsetY.animateTo( - targetValue = 0f, - animationSpec = tween( - durationMillis = 0, - easing = FastOutSlowInEasing - ) - ) - } - } - } catch (e: Exception) { - - Log.d("PrintReceipt", "error with $e") - - } + onPrint() +// try { +// PrintReceipt.getInstance().printNow() +// scope.launch { +// launch { +// receiptOffsetY.animateTo( +// targetValue = -1500f, +// animationSpec = tween( +// durationMillis = animationDuration, +// easing = FastOutSlowInEasing +// ) +// ) +// } +// delay(5000) +// launch { +// receiptOffsetY.animateTo( +// targetValue = 0f, +// animationSpec = tween( +// durationMillis = 0, +// easing = FastOutSlowInEasing +// ) +// ) +// } +// } +// } catch (e: Exception) { +// +// Log.d("PrintReceipt", "error with $e") +// +// } } ) { Text( @@ -155,6 +168,7 @@ fun PrintReceiptScreen( @Composable fun ReceiptPreview( + state: TransactionResultState, modifier: Modifier = Modifier ) { Column( @@ -184,16 +198,16 @@ fun ReceiptPreview( ) 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") + ReceiptRow("Merchant", state.payDetail?.merchantName.toString() ) + ReceiptRow("Terminal ID", state.payDetail?.terminalNo.toString() ) + ReceiptRow("Transaction", state.payDetail?.transType.toString()) + ReceiptRow("Amount", POSUtil.getInstance().getDecimalAmountSeparatorFormat(state.payDetail?.amount?:0)) + ReceiptRow("Card Type", state.payDetail?.accountType.toString()) + ReceiptRow("Card No", state.payDetail?.cardNo.toString()) + ReceiptRow("Status", POSUtil.getInstance().getResponse(state.payDetail?.tradeAnswerCode?: "-")) + ReceiptRow("Date", state.payDetail?.transDate.toString() ) + ReceiptRow("Time", state.payDetail?.transTime.toString()) + ReceiptRow("Ref No", state.payDetail?.referNo.toString()) ReceiptDivider() Spacer(modifier = Modifier.height(8.dp)) Text( @@ -257,6 +271,8 @@ fun ReceiptDivider() { fun PreviewPrintReceiptScreen() { MaterialTheme { PrintReceiptScreen( + sharedViewModel = hiltViewModel(), + transactionResultViewModel = hiltViewModel(), onPrint = {}, onDone = {} ) diff --git a/app/src/main/java/com/mob/utsmyanmar/ui/settlement/SettlementViewModel.kt b/app/src/main/java/com/mob/utsmyanmar/ui/settlement/SettlementViewModel.kt index df026e8..9558d74 100644 --- a/app/src/main/java/com/mob/utsmyanmar/ui/settlement/SettlementViewModel.kt +++ b/app/src/main/java/com/mob/utsmyanmar/ui/settlement/SettlementViewModel.kt @@ -99,7 +99,7 @@ class SettlementViewModel @Inject constructor( private val isoMsgX: ISOMsgX = ISOMsgX.ISOMsgXBuilder( ISOVersion.VERSION_1993, - ISOMode.BOTH_HEADER_TPDU, + ISOMode.ONLY_HEADER, HostName.MPU ).build() diff --git a/app/src/main/java/com/mob/utsmyanmar/ui/transaction_result/TransactionResultRoute.kt b/app/src/main/java/com/mob/utsmyanmar/ui/transaction_result/TransactionResultRoute.kt index fd4fef4..2248334 100644 --- a/app/src/main/java/com/mob/utsmyanmar/ui/transaction_result/TransactionResultRoute.kt +++ b/app/src/main/java/com/mob/utsmyanmar/ui/transaction_result/TransactionResultRoute.kt @@ -11,7 +11,7 @@ import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType @Composable fun TransactionResultRoute( - viewModel: TransactionResultViewModel = hiltViewModel(), + viewModel: TransactionResultViewModel, sharedViewModel: SharedViewModel, onNavigateMain: () -> Unit, onNavigatePrintReceipt: () -> Unit, diff --git a/app/src/main/java/com/mob/utsmyanmar/ui/transaction_result/TransactionResultScreen.kt b/app/src/main/java/com/mob/utsmyanmar/ui/transaction_result/TransactionResultScreen.kt index 47354a2..d6f6695 100644 --- a/app/src/main/java/com/mob/utsmyanmar/ui/transaction_result/TransactionResultScreen.kt +++ b/app/src/main/java/com/mob/utsmyanmar/ui/transaction_result/TransactionResultScreen.kt @@ -26,6 +26,7 @@ import com.mob.utsmyanmar.ui.preview.P2Preview import com.mob.utsmyanmar.ui.theme.Color import com.utsmyanmar.paylibs.model.PayDetail import com.utsmyanmar.paylibs.print.PrintReceipt +import com.utsmyanmar.paylibs.utils.POSUtil @Composable @@ -76,7 +77,7 @@ fun TransactionResultScreen( Spacer(modifier = Modifier.height(28.dp)) - AmountCard(amount = state.payDetail?.amount.toString()) + AmountCard(amount = POSUtil.getInstance().getDecimalAmountSeparatorFormat(state.payDetail?.amount?:0)) Spacer(modifier = Modifier.height(16.dp)) diff --git a/baselib/src/main/java/com/utsmyanmar/baselib/TerminalKeyUtil.java b/baselib/src/main/java/com/utsmyanmar/baselib/TerminalKeyUtil.java index 55f7e2e..694a32c 100644 --- a/baselib/src/main/java/com/utsmyanmar/baselib/TerminalKeyUtil.java +++ b/baselib/src/main/java/com/utsmyanmar/baselib/TerminalKeyUtil.java @@ -27,8 +27,8 @@ public final class TerminalKeyUtil { byte[] pik_kcv; SecurityOptV2 mSecurityOptV2 = BaseApplication.getInstance().mSecurityOptV2; - byte[] cvByte = ByteUtil.hexStr2Bytes("60430856F15FAE51"); - byte[] dataByte = ByteUtil.hexStr2Bytes("170003A44E7D5366FECD4731D9BD4E49"); + byte[] cvByte = ByteUtil.hexStr2Bytes("B7B520"); + byte[] dataByte = ByteUtil.hexStr2Bytes("e121249099a677e8b7d4f6a9d49fe8d1".toUpperCase()); byte[] makBytes = ByteUtil.hexStr2Bytes("250738083EC15BD3BA67D66B8A7AA13B"); // byte[] makCvBytes = ByteUtil.hexStr2Bytes("204E449B97"); @@ -48,7 +48,7 @@ public final class TerminalKeyUtil { if(!SystemParamsOperation.getInstance().isInjectOnce()) { try { // result = mSecurityOptV2.saveKeyDukpt(AidlConstantsV2.Security.KEY_TYPE_DUPKT_IPEK,IPEKByte,IPEKKCVByte,KSNByte,AidlConstantsV2.Security.KEY_ALG_TYPE_3DES,9); - result = mSecurityOptV2.savePlaintextKey(AidlConstantsV2.Security.KEY_TYPE_TMK,IPEKByte,IPEKKCVByte,AidlConstantsV2.Security.KEY_ALG_TYPE_3DES,9); + result = mSecurityOptV2.savePlaintextKey(AidlConstantsV2.Security.KEY_TYPE_TMK,dataByte,cvByte,AidlConstantsV2.Security.KEY_ALG_TYPE_3DES,9); LogUtil.d(ContentValues.TAG, "save TMK result:" + result); if (result != 0) { LogUtil.d(TAG, "save TMK fail"); diff --git a/paylibs/src/main/java/com/utsmyanmar/paylibs/isobuilder/builderx/BaseISOMsgX.java b/paylibs/src/main/java/com/utsmyanmar/paylibs/isobuilder/builderx/BaseISOMsgX.java index 1ea739f..d44972a 100644 --- a/paylibs/src/main/java/com/utsmyanmar/paylibs/isobuilder/builderx/BaseISOMsgX.java +++ b/paylibs/src/main/java/com/utsmyanmar/paylibs/isobuilder/builderx/BaseISOMsgX.java @@ -18,7 +18,7 @@ public abstract class BaseISOMsgX { byte[] newSendBytes = EncodePackage.assembly(map, msgIdentifier, 0, "0000000000",hostName); // String BPCTPDU = "6003550000"; - String MOBTPDU = "6030303030"; + String MOBTPDU = "6005170000"; if(isoMode == ISOMode.BOTH_HEADER_TPDU) { byte[] outBytes = new byte[newSendBytes.length - 6 ]; diff --git a/paylibs/src/main/java/com/utsmyanmar/paylibs/network/ISOSocket.java b/paylibs/src/main/java/com/utsmyanmar/paylibs/network/ISOSocket.java index 85cc684..6068dc9 100644 --- a/paylibs/src/main/java/com/utsmyanmar/paylibs/network/ISOSocket.java +++ b/paylibs/src/main/java/com/utsmyanmar/paylibs/network/ISOSocket.java @@ -148,7 +148,7 @@ public class ISOSocket { private SSLSocketFactory getSSLSocketFactory() throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, KeyManagementException { CertificateFactory cf = CertificateFactory.getInstance("X.509"); - InputStream caInput = context.getResources().openRawResource(R.raw.mob_uat); // this cert file stored in \app\src\main\res\raw folder path + InputStream caInput = context.getResources().openRawResource(R.raw.mpu_crt_2026); // this cert file stored in \app\src\main\res\raw folder path Certificate ca = cf.generateCertificate(caInput); caInput.close(); @@ -175,7 +175,7 @@ public class ISOSocket { private OkHttpClient getClient() throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, KeyManagementException { CertificateFactory cf = CertificateFactory.getInstance("X.509"); - InputStream caInput = context.getResources().openRawResource(R.raw.mob_uat); // this cert file stored in \app\src\main\res\raw folder path + InputStream caInput = context.getResources().openRawResource(R.raw.mpu_crt_2026); // this cert file stored in \app\src\main\res\raw folder path Certificate ca = cf.generateCertificate(caInput); caInput.close(); @@ -331,8 +331,10 @@ public class ISOSocket { isSwitchIp = true; // serverIP = "posuat.myanmarorientalbank.com"; // serverPort = 5033; - serverIP = "192.168.0.100"; - serverPort = 5001; +// serverIP = "192.168.0.100"; +// serverPort = 5001; + serverIP = "103.84.101.82"; + serverPort = 60147; // serverIP = getSecondaryIp(); // serverPort = getSecondaryPort(); } @@ -353,8 +355,10 @@ public class ISOSocket { if (!isSwitchIp) { // serverIP = getIp(); // serverPort = getPort(); - serverIP = "192.168.0.100"; - serverPort = 5001; +// serverIP = "192.168.0.100"; +// serverPort = 5001; + serverIP = "103.84.101.82"; + serverPort = 60147; SystemParamsOperation.getInstance().setSslSwitchStatus(false); // serverIP = "posuat.myanmarorientalbank.com"; // serverPort = 5033; diff --git a/paylibs/src/main/java/com/utsmyanmar/paylibs/print/printx/PrintXImpl.java b/paylibs/src/main/java/com/utsmyanmar/paylibs/print/printx/PrintXImpl.java index 3dfcbb6..a7dfafc 100644 --- a/paylibs/src/main/java/com/utsmyanmar/paylibs/print/printx/PrintXImpl.java +++ b/paylibs/src/main/java/com/utsmyanmar/paylibs/print/printx/PrintXImpl.java @@ -58,14 +58,14 @@ public class PrintXImpl extends BaseXPrint implements PrintX { opts.inJustDecodeBounds = true; // Step 1: Only read dimensions first - BitmapFactory.decodeResource(resources, R.drawable.primary_print_logo_yoma_bank, opts); + BitmapFactory.decodeResource(resources, R.drawable.print_logo_mpu, opts); // Step 2: Calculate sample size so width <= 384px opts.inSampleSize = calculateInSampleSize(opts, 384, 384); opts.inJustDecodeBounds = false; // Step 3: Decode scaled-down bitmap - bitmap = BitmapFactory.decodeResource(resources, R.drawable.primary_print_logo_yoma_bank, opts); + bitmap = BitmapFactory.decodeResource(resources, R.drawable.print_logo_mpu, opts); } @Override diff --git a/paylibs/src/main/java/com/utsmyanmar/paylibs/reversal/ReversalAction.java b/paylibs/src/main/java/com/utsmyanmar/paylibs/reversal/ReversalAction.java index c62ae53..6838839 100644 --- a/paylibs/src/main/java/com/utsmyanmar/paylibs/reversal/ReversalAction.java +++ b/paylibs/src/main/java/com/utsmyanmar/paylibs/reversal/ReversalAction.java @@ -53,7 +53,7 @@ public class ReversalAction { } private ReversalAction() { - isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.BOTH_HEADER_TPDU,HostName.BPC) + isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.ONLY_HEADER,HostName.MPU) .build(); } diff --git a/paylibs/src/main/java/com/utsmyanmar/paylibs/sign_on/SignOnProcess.java b/paylibs/src/main/java/com/utsmyanmar/paylibs/sign_on/SignOnProcess.java index afc7394..2f2931f 100644 --- a/paylibs/src/main/java/com/utsmyanmar/paylibs/sign_on/SignOnProcess.java +++ b/paylibs/src/main/java/com/utsmyanmar/paylibs/sign_on/SignOnProcess.java @@ -50,7 +50,7 @@ public class SignOnProcess { private SignOnProcess() { tradeData = Params.newTrade(true); // payDetail = tradeData.getPayDetail(); - isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.BOTH_HEADER_TPDU,HostName.MPU) + isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.ONLY_HEADER,HostName.MPU) .build(); } @@ -67,7 +67,7 @@ public class SignOnProcess { payDetail.setTransactionType(TransactionsType.SIGN_ON.value); payDetail.setHostName(hostName.name); - byte[] sendBytes = isoMsgX.buildISOPackets(tradeData, BitmapConfig.CZ_SIGN_ON, MessageType.NETWORK_MANAGEMENT); + byte[] sendBytes = isoMsgX.buildISOPackets(tradeData, BitmapConfig.MPU_NEW_SIGN_ON, MessageType.NETWORK_MANAGEMENT); ISOSocket.getInstance().enqueue(sendBytes, sendBytes.length,false, new ISOCallback() { @Override public void onReceive(byte[] bytes, int length) { diff --git a/paylibs/src/main/java/com/utsmyanmar/paylibs/transactions/TransactionsOperation.java b/paylibs/src/main/java/com/utsmyanmar/paylibs/transactions/TransactionsOperation.java index f17e0c8..50a1c9c 100644 --- a/paylibs/src/main/java/com/utsmyanmar/paylibs/transactions/TransactionsOperation.java +++ b/paylibs/src/main/java/com/utsmyanmar/paylibs/transactions/TransactionsOperation.java @@ -34,3444 +34,7 @@ import java.util.Objects; import sunmi.sunmiui.utils.LogUtil; -public class - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TransactionsOperation { +public class TransactionsOperation { private Map responseMap; @@ -3515,7 +78,7 @@ TransactionsOperation { TradeData transTradeData; PayDetail transPayDetail; - isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.BOTH_HEADER_TPDU, hostName) + isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.ONLY_HEADER, hostName) .build(); if (transactionsType == TransactionsType.SALE || transactionsType == TransactionsType.PRE_AUTH_SALE || transactionsType == TransactionsType.CASH_OUT) { diff --git a/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/POSUtil.java b/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/POSUtil.java index 7be7734..c68949a 100644 --- a/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/POSUtil.java +++ b/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/POSUtil.java @@ -177,6 +177,10 @@ public class POSUtil { return BaseErrorCode.convert93to87(responseCode); } + public String getResponse(String responseCode) { + return BaseErrorCode.getCode(responseCode); + } + public String getCardType(PayDetail payDetail) { int value = 0; diff --git a/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/iso_utils/TransactionsType.java b/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/iso_utils/TransactionsType.java index c7a99f8..418e0f4 100644 --- a/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/iso_utils/TransactionsType.java +++ b/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/iso_utils/TransactionsType.java @@ -3,19 +3,19 @@ package com.utsmyanmar.paylibs.utils.iso_utils; public enum TransactionsType { SALE("SALE",1,"000000"), - VOID("VOID SALE",2,"200000"), //020000 + VOID("VOID SALE",2,"020000"), //200000 SETTLEMENT("SETTLEMENT",3,"920000"), REFUND("REFUND",4,"200000"), - PRE_AUTH_SALE("PRE-AUTH",5,"930000"), + PRE_AUTH_SALE("PRE-AUTH",5,"300000"), //930000 - PRE_AUTH_VOID("PREAUTH CANCELLATION",6,"200000"), + PRE_AUTH_VOID("PREAUTH CANCELLATION",6,"020000"), - PRE_AUTH_COMPLETE("PREAUTH COMPLETION",7,"940000"), + PRE_AUTH_COMPLETE("PREAUTH COMPLETION",7,"000000"), //940000 - PRE_AUTH_COMPLETE_VOID("VOID PREAUTH COMPLETE",8,"940000"), + PRE_AUTH_COMPLETE_VOID("VOID PREAUTH COMPLETE",8,"000000"), //940000 CASH_OUT("CASH_OUT",9,"010000"), REVERSAL("REVERSAL",10,"00"), diff --git a/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/params/Params.java b/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/params/Params.java index c80467b..fca79a1 100644 --- a/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/params/Params.java +++ b/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/params/Params.java @@ -106,8 +106,11 @@ public class Params { // mock tid,mid - payDetail.setTerminalNo("00000003"); - payDetail.setMerchantNo("777031200000001"); +// payDetail.setTerminalNo("00000003"); +// payDetail.setMerchantNo("777031200000001"); + // mpu + payDetail.setTerminalNo("10040018"); + payDetail.setMerchantNo("110400000000006"); // 4, Nov ,2024 payDetail.setTransCVM(TransCVM.NO_CVM); diff --git a/paylibs/src/main/res/drawable/print_logo_mpu.png b/paylibs/src/main/res/drawable/print_logo_mpu.png new file mode 100644 index 0000000..a1dae0f Binary files /dev/null and b/paylibs/src/main/res/drawable/print_logo_mpu.png differ diff --git a/paylibs/src/main/res/raw/mpu_crt_2026.crt b/paylibs/src/main/res/raw/mpu_crt_2026.crt new file mode 100644 index 0000000..bf7b7b0 --- /dev/null +++ b/paylibs/src/main/res/raw/mpu_crt_2026.crt @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIID3DCCAsSgAwIBAgIJAIuL4ypXInCoMA0GCSqGSIb3DQEBBQUAMGcxCzAJBgNV +BAYTAk1SMQswCQYDVQQIDAJNUjEMMAoGA1UECgwDTVBVMQwwCgYDVQQLDANNUFUx +DTALBgNVBAMMBHRlc3QxIDAeBgkqhkiG9w0BCQEWEXdhaXlhbkBmcHQuY29tLnZu +MB4XDTIxMDIwMzE3MTExMloXDTIyMDIwMzE3MTExMlowdzELMAkGA1UEBhMCTVIx +DzANBgNVBAgMBllhbmdvbjEPMA0GA1UEBwwGWWFuZ29uMQwwCgYDVQQKDANNUFUx +DDAKBgNVBAsMA01QVTENMAsGA1UEAwwEdGVzdDEbMBkGCSqGSIb3DQEJARYMdGVz +dEBtcHUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAujLe6mWJ +GXliGUoLdJEA37VyBOQ7zLpge7u2QM2UMQXnKosdtZzMzXnVrnctJ6ehzLnhL0Lv +Oissr7qo53haXsJJccHeqcTH5cFkh96IswOrc8/1MMrb4zMjnNjOZaxmB4HeGHKk +KjNLKTTO8It3v/MziBhxUEEKVrN4npeUfsGVPfrvYnZXSWuRLhzYYLtEz/LFg4Yh +28pCXqk2vmGNV62oZ2+SDisoiYdIVEOMRqb/7cJg+cd0JRdvxHsTNuYRHGtJOM10 +lEnoI+moE5OIUpp8Z+i4ZcvyThpNbRWf9sRzB8oc32fZ2UWnlN5+bVRLCjlk2jNO +SGdMuMaF0bs3GwIDAQABo3sweTAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1P +cGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUipyzRYfqRc2P +QCJ0FJp6eAvI1wkwHwYDVR0jBBgwFoAUvYEAOtcvUt4CxCp+9zRG2oJqos8wDQYJ +KoZIhvcNAQEFBQADggEBAAjBQroy74ACyyJCZJ50KBTYQI3Sk82hO/+zZFqsJgWm +mNum31TtfwhvQmi94sXQSar0UsqLTmLC3UTucwEdSKOPzXF5BK4EEbkYgMm78hNK +2zqhGvcWlqun+KPxmnMRFoVmN3Ck2PkcgudvAeV0G3rm0OdLUwLoK2TcREVf1Cwg +C7jX5QtGOgVqnKDZBuoSvdbV30ka7pKkdJAy/Wus4N9hHH+bR2FNkLgTDoXnV8LL +E2dRKVYAh9TtuXiW/ejhPtEc14sMP+8JpCFX3DYx4yRW8ZeMl5jal4LhRFXdDbVl +Wm99KcWM+TNw/nzKwv0zUJXy0HlN82tvLX1/wbBUo8M= +-----END CERTIFICATE-----