MPU still in progress only left preauth test cases

This commit is contained in:
kizzy 2026-06-11 15:41:30 +07:00
parent b073e62a20
commit f070ad1c10
5 changed files with 28 additions and 51 deletions

View File

@ -16,6 +16,7 @@ import androidx.compose.runtime.collectAsState
import com.mob.utsmyanmar.model.TransactionStatus
import com.mob.utsmyanmar.ui.settlement.SettlementViewModel
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
import kotlinx.coroutines.channels.Channel
private const val MOCK_HOST_DELAY_MS = 2000L
@ -34,17 +35,26 @@ fun ProcessingRoute(
val settlementStatus by settlementViewModel.uiState.collectAsStateWithLifecycle()
val settlementStatusResult by settlementViewModel.events.collectAsStateWithLifecycle(Channel.BUFFERED)
if(sharedViewModel.transactionsType.value == TransactionsType.SETTLEMENT) {
LaunchedEffect(Unit) {
settlementViewModel.startSettlementProcess()
}
LaunchedEffect(settlementStatusResult) {
when(settlementStatusResult) {
TransactionStatus.ON_ERROR,
TransactionStatus.ON_SUCCESS -> onNavigateTransactionResult()
else -> {}
}
}
} else {
LaunchedEffect(Unit) {
transProcessViewModel.resetTransactionStatus()
transProcessViewModel.startOnlineProcess()
}
}
LaunchedEffect(transStatus) {
when(transStatus) {
@ -62,13 +72,11 @@ fun ProcessingRoute(
else -> {}
}
}
}
LaunchedEffect(settlementStatus.status) {
when(settlementStatus.status) {
TransactionStatus.ON_SUCCESS -> onNavigateTransactionResult()
else -> {}
}
}

View File

@ -232,6 +232,7 @@ class SettlementViewModel @Inject constructor(
deleteTrans.clear()
}
fun startSettlementProcess() {
_uiState.update {
it.copy(isLoading = true)

View File

@ -152,7 +152,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.mpu_crt_2026); // this cert file stored in \app\src\main\res\raw folder path
InputStream caInput = context.getResources().openRawResource(R.raw.mob_uat); // this cert file stored in \app\src\main\res\raw folder path
Certificate ca = cf.generateCertificate(caInput);
caInput.close();
@ -179,7 +179,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.mpu_crt_2026); // this cert file stored in \app\src\main\res\raw folder path
InputStream caInput = context.getResources().openRawResource(R.raw.mob_uat); // this cert file stored in \app\src\main\res\raw folder path
Certificate ca = cf.generateCertificate(caInput);
caInput.close();
@ -402,6 +402,8 @@ public class ISOSocket {
if (SystemParamsOperation.getInstance().isSslOn()) {
try {
// For MPU
TrustManager[] trustAll = new TrustManager[]{new X509TrustManager() {
public void checkClientTrusted(X509Certificate[] chain, String authType) {}
public void checkServerTrusted(X509Certificate[] chain, String authType) {}
@ -412,52 +414,17 @@ public class ISOSocket {
SSLSocketFactory factory = ctx.getSocketFactory();
// try (SSLSocket sslsock = (SSLSocket) factory.createSocket()) {
//
// sslsock.setEnabledProtocols(new String[]{"TLSv1.2"});
//// while (!isSSLOnline(timeout,subscriber)) {
//// Thread.sleep(150);
//// subscriber.onError(new Throwable("java.net.SocketTimeoutException: connect timed out"));
//// }
//
// sslsock.setSoTimeout(60000);
// sslsock.connect(new InetSocketAddress(serverIP, serverPort), connectTimeout);
//
// sslsock.startHandshake();
//
// SSLSession session = sslsock.getSession();
//
// LogUtil.d(TAG, "SSL handshake success to " + serverIP + ":" + serverPort + "\n");
// LogUtil.d(TAG, "TLS handshake success to " + serverIP + ":" + serverPort + "\n");
// LogUtil.d(TAG, "TLS version: " + session.getProtocol() + "\n");
// LogUtil.d(TAG,"Cipher suite: " + session.getCipherSuite() + "\n");
//
// try {
// java.security.cert.Certificate[] chain = session.getPeerCertificates();
// if (chain != null && chain.length > 0) {
// LogUtil.d(TAG,"Peer certificates:\n");
// for (int i = 0; i < chain.length; i++) {
// X509Certificate x = (X509Certificate) chain[i];
// LogUtil.d(TAG, " [" + i + "] Subject: " + x.getSubjectX500Principal().getName() + "\n");
// LogUtil.d(TAG," Issuer: " + x.getIssuerX500Principal().getName() + "\n");
// LogUtil.d(TAG," Valid: " + formatDate(x.getNotBefore()) + " - " + formatDate(x.getNotAfter()) + "\n");
// }
// }
// } catch (Exception ignored) { }
// }
// OkHttpClient client = getClient();
sslSocket = (SSLSocket) factory.createSocket();
sslSocket.setEnabledProtocols(new String[]{"TLSv1.2"});
// sslSocket.setEnabledProtocols(new String[]{"TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"});
// while (!isSSLOnline(timeout,subscriber)) {
// Thread.sleep(150);
// subscriber.onError(new Throwable("java.net.SocketTimeoutException: connect timed out"));
// }
sslSocket.setSoTimeout(60000);
sslSocket.connect(new InetSocketAddress(serverIP, serverPort), connectTimeout);
// MPU
sslSocket.startHandshake();
SSLSession session = sslSocket.getSession();
@ -512,7 +479,7 @@ public class ISOSocket {
subscriber.onComplete();
} catch ( IOException |
} catch (IOException |
NoSuchAlgorithmException | KeyManagementException e) {
e.printStackTrace();
subscriber.onError(e);

View File

@ -176,7 +176,7 @@ public class BitmapConfig {
// 703C058008C08000 7038058028C00000
public static final String MPU_NEW_REFUND ="703C058008C08000";
public static final String MPU_NEW_PRE_AUTH ="7020058020C08000";
public static final String MPU_NEW_PRE_AUTH ="7020058020C09000";

View File

@ -83,6 +83,7 @@ public class Params {
payDetail.transNum = System.currentTimeMillis() / 1000;
// need to add host logic in another place
payDetail.setHostName("MPU");
// payDetail.setHostName("MOB");
payDetail.setOriginalTransDate(SystemDateTime.getMMDD()+SystemDateTime.getYYYY());