cardzone sign on got approved

This commit is contained in:
kizzy 2026-05-30 17:55:58 +07:00
parent f95208aa9d
commit 000c48bf6b
12 changed files with 381 additions and 60 deletions

View File

@ -128,7 +128,7 @@ fun AppNavGraph(
SettlementScreen( SettlementScreen(
sharedViewModel = sharedViewModel, sharedViewModel = sharedViewModel,
onBack = { navController.popBackStack() }, onBack = { navController.popBackStack(Routes.Dashboard.route,false) },
onStartSettlement = { onStartSettlement = {
sharedViewModel.transactionsType.value = com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType.SETTLEMENT sharedViewModel.transactionsType.value = com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType.SETTLEMENT
navController.navigate(Routes.Processing.route) { navController.navigate(Routes.Processing.route) {

View File

@ -15,6 +15,7 @@ import java.util.Locale;
import sunmi.sunmiui.utils.LogUtil; import sunmi.sunmiui.utils.LogUtil;
public class DecodePackage { public class DecodePackage {
public final static String TAG = "DecodePackage"; public final static String TAG = "DecodePackage";
@ -24,18 +25,217 @@ public class DecodePackage {
} }
public static HashMap<String, MsgField> unAssembly(byte[] body, HostName hostName,boolean printLog) { public static HashMap<String, MsgField> unAssembly(byte[] body, HostName hostName,boolean printLog) {
return unAssembly(body, FieldConfig.FieldTypeConfig128,hostName,printLog); return unAssembly(body,hostName == HostName.BPC? FieldConfig.FieldTypeConfig128 : FieldConfig.FieldTypeConfigV1,hostName,printLog);
} }
public synchronized static HashMap<String, MsgField> unAssembly(byte[] body, int[][] fieldConfig) {
HashMap<String, MsgField> resMap = new HashMap<>();
// Request header length 15
// Len[2] + tPDU[5] + Header[6] + Type[2]
int head = 7 + FieldConfig.MESSAGE_HEADER_LENGTH;
// Calculate the length of the message type
byte[] msgData = null;
int typeLength = FieldConfig.FieldTypeConfig128[0][2];
switch (FieldConfig.FieldTypeConfig128[0][3]) {
case FieldConfig.SDK_8583_DATA_BCD:
head += (typeLength + 1) / 2;
msgData = new byte[(typeLength + 1) / 2];
break;
case FieldConfig.SDK_8583_DATA_ASC:
case FieldConfig.SDK_8583_DATA_BIT:
head += typeLength;
msgData = new byte[typeLength];
break;
default:
break;
}
// Fetch header
byte[] headerData = new byte[FieldConfig.MESSAGE_HEADER_LENGTH];
System.arraycopy(body, 7, headerData, 0, FieldConfig.MESSAGE_HEADER_LENGTH);
MsgField headerFiled = new MsgField();
headerFiled.setFieldPos(-1);
headerFiled.setLengthType(fieldConfig[0][0]);
headerFiled.setLengthTypeEncode(fieldConfig[0][1]);
headerFiled.setDataType(fieldConfig[0][3]);
headerFiled.setAlignType(fieldConfig[0][4]);
headerFiled.setFillChar(fieldConfig[0][5]);
headerFiled.setDataLength(fieldConfig[0][2]);
headerFiled.setDataBytes(headerData);
headerFiled.setDataStr(Utils.byte2HexStr(headerData));
resMap.put("header", headerFiled);
String header = Utils.byte2HexStr(headerData);
LogUtil.d(TAG, "header" + header);
// Get message type
System.arraycopy(body, 7 + FieldConfig.MESSAGE_HEADER_LENGTH, msgData, 0, msgData.length);
String msgType = "";
switch (FieldConfig.FieldTypeConfig128[0][3]) {
case FieldConfig.SDK_8583_DATA_BCD:
case FieldConfig.SDK_8583_DATA_BIT:
msgType = Utils.byte2HexStr(msgData);
break;
case FieldConfig.SDK_8583_DATA_ASC:
try {
msgType = new String(msgData, "ISO-8859-1");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
break;
default:
break;
}
MsgField msgFiled = new MsgField();
msgFiled.setFieldPos(0);
msgFiled.setLengthType(fieldConfig[0][0]);
msgFiled.setLengthTypeEncode(fieldConfig[0][1]);
msgFiled.setDataType(fieldConfig[0][3]);
msgFiled.setAlignType(fieldConfig[0][4]);
msgFiled.setFillChar(fieldConfig[0][5]);
msgFiled.setDataLength(fieldConfig[0][2]);
msgFiled.setDataBytes(msgData);
msgFiled.setDataStr(msgType);
resMap.put("type", msgFiled);
LogUtil.d(TAG, "Message type" + msgType);
// Get bitmap
boolean[] boolBitmap;
byte[] bitmap = new byte[8];
System.arraycopy(body, head, bitmap, 0, 8);
boolBitmap = Utils.getBinaryFromByte(bitmap);
if (boolBitmap[1]) {
//If the first bit is 1, it is an expandable bitmap, set to 16 bytes in length.
byte[] b = new byte[16];
System.arraycopy(body, head, b, 0, 16);
boolBitmap = Utils.getBinaryFromByte(b);
head += 16;
} else {
head += 8;
}
int size = boolBitmap.length;
// Total length of request header and bitmap
int tmpLen = head;
// 0 1 Domain not used
for (int i = 2; i < size; i++) {
if (boolBitmap[i]) {
MsgField outField = new MsgField();
outField.setFieldPos(i);
outField.setLengthType(fieldConfig[i][0]);
outField.setLengthTypeEncode(fieldConfig[i][1]);
outField.setDataType(fieldConfig[i][3]);
outField.setAlignType(fieldConfig[i][4]);
outField.setFillChar(fieldConfig[i][5]);
// len is useless for variable length
outField.setDataLength(fieldConfig[i][2]);
byte[] nextData;
//53 templen - 54
// Get the value of the variable length part
if (outField.getLengthType() > 0) {
// Get the length of the byte array
int varLen = (outField.getLengthType() + 1) / 2;
byte[] varValue = new byte[varLen];
if(i==62){
tmpLen++;
}
System.arraycopy(body, tmpLen, varValue, 0, varValue.length);
// Length of data length
tmpLen += varLen; //tmp len 54
// Number of bytes of variable length data
int datLen;
int bcdLength = Utils.bcdToint(varValue); //31
// Determine the data type (binary type data is not processed)
if (outField.getDataType() == FieldConfig.SDK_8583_DATA_BCD) {
datLen = (bcdLength / 2) + (bcdLength % 2);
outField.setDataLength(bcdLength); // Fill the variable length
} else if (outField.getDataType() == FieldConfig.SDK_8583_DATA_BIT) {
datLen = bcdLength;
outField.setDataLength(2 * bcdLength); // Fill the variable length
} else {
//asc
datLen = bcdLength;
outField.setDataLength(bcdLength); // Fill the variable length
}
// Take the value of the variable length part
nextData = new byte[datLen];
//tmp len 55
System.arraycopy(body, tmpLen, nextData, 0, datLen);
//updated
/* if(body.length>tmpLen+datLen){
System.arraycopy(body, tmpLen, nextData, 0, datLen);
}else {
return null;
}*/
// Data length
tmpLen += datLen;
} else {
// Fixed-length data length
int datLen;
// Determine the data type (binary type data is not processed)
if (outField.getDataType() == FieldConfig.SDK_8583_DATA_BCD) {
datLen = (outField.getDataLength() / 2) + (outField.getDataLength() % 2);
} else if (outField.getDataType() == FieldConfig.SDK_8583_DATA_ASC) {
datLen = outField.getDataLength();
} else {
datLen = outField.getDataLength();
}
nextData = new byte[datLen];
System.arraycopy(body, tmpLen, nextData, 0, nextData.length);
tmpLen += nextData.length;
}
// Data input
if (outField.getDataType() == FieldConfig.SDK_8583_DATA_ASC) {
String s = null;
try {
s = new String(nextData, "gbk");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
if (!TextUtils.isEmpty(s) && Utils.isMessyCode(s)) {
LogUtil.d(TAG, "field pos:" + outField.getFieldPos() + " = " + Utils.byte2HexStr(nextData));
} else {
LogUtil.d(TAG, "field pos:" + outField.getFieldPos() + " = " + s);
}
// Determine whether it is GBK encoding or garbled
outField.setDataStr(new String(nextData));
} else if (outField.getDataType() == FieldConfig.SDK_8583_DATA_BIT) {
LogUtil.d(TAG, "field pos:" + outField.getFieldPos() + " = " + Utils.byte2HexStr(nextData));
outField.setDataStr(Utils.byte2HexStr(nextData));
} else if (outField.getDataType() == FieldConfig.SDK_8583_DATA_BCD) {
LogUtil.d(TAG, "field pos:" + outField.getFieldPos() + " = " + Utils.Bcd2String(nextData));
outField.setDataStr(Utils.Bcd2String(nextData));
}
outField.setDataBytes(nextData);
resMap.put("F" + String.format(Locale.getDefault(), "%03d", i), outField);
}
}
return resMap;
}
public synchronized static HashMap<String, MsgField> unAssembly(byte[] body, int[][] fieldConfig,HostName hostName,boolean printLog) { public synchronized static HashMap<String, MsgField> unAssembly(byte[] body, int[][] fieldConfig,HostName hostName,boolean printLog) {
HashMap<String, MsgField> resMap = new HashMap<>(); HashMap<String, MsgField> resMap = new HashMap<>();
int [][] fieldTypeViaHost = hostName == HostName.BPC ? FieldConfig.FieldTypeConfig128 : FieldConfig.FieldTypeConfigV1; int [][] fieldTypeViaHost = hostName == HostName.BPC ? FieldConfig.FieldTypeConfig128 : FieldConfig.FieldTypeConfigV1;
/* /*
* 2 - Header length * 2 - Header length
* 5 - Message Header Length ( TPDU - length ) * 5 - Message Header Length ( TPDU - length )
* */ * */
int head = 2 + FieldConfig.MESSAGE_HEADER_LENGTH; int head = 2 + FieldConfig.MESSAGE_HEADER_LENGTH;
@ -152,11 +352,19 @@ public class DecodePackage {
// Get the value of the variable length part // Get the value of the variable length part
if (outField.getLengthType() > 0) { if (outField.getLengthType() > 0) {
int varLen;
if( hostName == HostName.BPC) {
varLen = outField.getLengthType();
} else {
varLen = (outField.getLengthType() + 1) / 2;
}
// Get the length of the byte array // Get the length of the byte array
// int varLen = (outField.getLengthType() + 1) / 2; // int varLen = (outField.getLengthType() + 1) / 2;
int varLen = outField.getLengthType(); // varLen = outField.getLengthType();
byte[] varValue = new byte[varLen]; byte[] varValue = new byte[varLen];
if(i==62){ if(i==62 || i==63){
tmpLen++; tmpLen++;
} }
@ -172,6 +380,7 @@ public class DecodePackage {
bcdLength = Integer.parseInt(new String(varValue)); //31 bcdLength = Integer.parseInt(new String(varValue)); //31
} else { } else {
bcdLength = Utils.bcdToint(varValue); //31 bcdLength = Utils.bcdToint(varValue); //31
// bcdLength = Integer.parseInt(new String(varValue)); //31
} }
// Determine the data type (binary type data is not processed) // Determine the data type (binary type data is not processed)
@ -197,10 +406,16 @@ public class DecodePackage {
//tmp len 55 //tmp len 55
try { try {
// System.arraycopy(body, tmpLen, nextData, 0, datLen); 25/May/2026 if(hostName == HostName.BPC) {
System.arraycopy(body, tmpLen, nextData, 0, body.length-tmpLen); System.arraycopy(body, tmpLen, nextData, 0, datLen);
} else {
System.arraycopy(body, tmpLen, nextData, 0, body.length-tmpLen);
}
//
} catch (IndexOutOfBoundsException e){ } catch (IndexOutOfBoundsException e){
e.printStackTrace(); e.printStackTrace();
System.arraycopy(body, tmpLen, nextData, 0, datLen);
} }
// Data length // Data length

View File

@ -17,14 +17,15 @@ public abstract class BaseISOMsgX {
byte[] newSendBytes = EncodePackage.assembly(map, msgIdentifier, 0, "0000000000",hostName); byte[] newSendBytes = EncodePackage.assembly(map, msgIdentifier, 0, "0000000000",hostName);
String BPCTPDU = "6003550000"; // String BPCTPDU = "6003550000";
String MOBTPDU = "6030303030";
if(isoMode == ISOMode.BOTH_HEADER_TPDU) { if(isoMode == ISOMode.BOTH_HEADER_TPDU) {
byte[] outBytes = new byte[newSendBytes.length - 6 ]; byte[] outBytes = new byte[newSendBytes.length - 6 ];
byte[] tpdu = ByteUtil.hexStr2Bytes(BPCTPDU); byte[] tpdu = ByteUtil.hexStr2Bytes(MOBTPDU);
// LogUtil.d(Constant.TAG,"HexString new Send bytes :" + ByteUtil.bytes2HexStr(newSendBytes)); // LogUtil.d(Constant.TAG,"HexString new Send bytes :" + ByteUtil.bytes2HexStr(newSendBytes));
// LogUtil.d(Constant.TAG,"HexString tpdu :" + ByteUtil.bytes2HexStr(tpdu)); // LogUtil.d(Constant.TAG,"HexString tpdu :" + ByteUtil.bytes2HexStr(tpdu));
@ -48,7 +49,8 @@ public abstract class BaseISOMsgX {
int low = (outBytes.length - 2) % 256; int low = (outBytes.length - 2) % 256;
outBytes[0] = (byte) hig; outBytes[0] = (byte) hig;
outBytes[1] = (byte) low; outBytes[1] = (byte) low;
// outBytes[0] = (byte) 0x00;
// outBytes[1] = (byte) 0x00;
String str = "HexString:" + ByteUtil.bytes2HexStr(outBytes); String str = "HexString:" + ByteUtil.bytes2HexStr(outBytes);
LogUtil.d(Constant.TAG, str); LogUtil.d(Constant.TAG, str);
return outBytes; return outBytes;
@ -58,7 +60,7 @@ public abstract class BaseISOMsgX {
byte[] tpdu = ByteUtil.hexStr2Bytes(BPCTPDU); byte[] tpdu = ByteUtil.hexStr2Bytes(MOBTPDU);
LogUtil.d(Constant.TAG,"HexString new Send bytes :" + ByteUtil.bytes2HexStr(newSendBytes)); LogUtil.d(Constant.TAG,"HexString new Send bytes :" + ByteUtil.bytes2HexStr(newSendBytes));
LogUtil.d(Constant.TAG,"HexString tpdu :" + ByteUtil.bytes2HexStr(tpdu)); LogUtil.d(Constant.TAG,"HexString tpdu :" + ByteUtil.bytes2HexStr(tpdu));
@ -122,17 +124,14 @@ public abstract class BaseISOMsgX {
return newBytes; return newBytes;
} else if(isoMode == ISOMode.ONLY_HEADER) { } else if(isoMode == ISOMode.ONLY_HEADER) {
byte[] outBytes = new byte[receiveBytes.length + 6]; byte[] outBytes = new byte[receiveBytes.length + 5];
byte[] headBytes = ByteUtil.hexStr2Bytes("888888888888"); byte[] headBytes = ByteUtil.hexStr2Bytes("8888888888");
System.arraycopy(receiveBytes, 0, outBytes, 0, 7); System.arraycopy(receiveBytes, 0, outBytes, 0, 2);
System.arraycopy(headBytes, 0, outBytes, 7, headBytes.length); System.arraycopy(headBytes, 0, outBytes, 2, headBytes.length);
System.arraycopy(receiveBytes, 7, outBytes, 13, receiveBytes.length - 7); System.arraycopy(receiveBytes, 2, outBytes, 7, receiveBytes.length-2);
log = "HexString:" + ByteUtil.bytes2HexStr(outBytes);
LogUtil.d(Constant.TAG, log); LogUtil.d(Constant.TAG, log);
return outBytes; return outBytes;
} else { } else {

View File

@ -148,7 +148,7 @@ public class ISOSocket {
private SSLSocketFactory getSSLSocketFactory() private SSLSocketFactory getSSLSocketFactory()
throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, KeyManagementException { throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, KeyManagementException {
CertificateFactory cf = CertificateFactory.getInstance("X.509"); CertificateFactory cf = CertificateFactory.getInstance("X.509");
InputStream caInput = context.getResources().openRawResource(R.raw.smile_uat); // 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); Certificate ca = cf.generateCertificate(caInput);
caInput.close(); caInput.close();
@ -175,7 +175,7 @@ public class ISOSocket {
private OkHttpClient getClient() private OkHttpClient getClient()
throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, KeyManagementException { throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, KeyManagementException {
CertificateFactory cf = CertificateFactory.getInstance("X.509"); CertificateFactory cf = CertificateFactory.getInstance("X.509");
InputStream caInput = context.getResources().openRawResource(R.raw.smile_uat); // 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); Certificate ca = cf.generateCertificate(caInput);
caInput.close(); caInput.close();
@ -329,8 +329,10 @@ public class ISOSocket {
public void switchIp() { public void switchIp() {
isSwitchIp = true; isSwitchIp = true;
serverIP = "192.168.0.107"; serverIP = "posuat.myanmarorientalbank.com";
serverPort = 5001; serverPort = 5033;
// serverIP = "192.168.0.107";
// serverPort = 5001;
// serverIP = getSecondaryIp(); // serverIP = getSecondaryIp();
// serverPort = getSecondaryPort(); // serverPort = getSecondaryPort();
} }
@ -351,10 +353,11 @@ public class ISOSocket {
if (!isSwitchIp) { if (!isSwitchIp) {
// serverIP = getIp(); // serverIP = getIp();
// serverPort = getPort(); // serverPort = getPort();
// serverIP = "posuat.myanmarorientalbank.com"; // serverIP = "192.168.0.107";
// serverPort = 5033; // serverPort = 5001;
serverIP = "192.168.0.107"; SystemParamsOperation.getInstance().setSslSwitchStatus(true);
serverPort = 5001; serverIP = "posuat.myanmarorientalbank.com";
serverPort = 5033;
} else { } else {
isSwitchIp = false; isSwitchIp = false;
} }

View File

@ -50,7 +50,7 @@ public class SignOnProcess {
private SignOnProcess() { private SignOnProcess() {
tradeData = Params.newTrade(true); tradeData = Params.newTrade(true);
// payDetail = tradeData.getPayDetail(); // payDetail = tradeData.getPayDetail();
isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.BOTH_HEADER_TPDU,HostName.CARDZONE) isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.ONLY_HEADER,HostName.CARDZONE)
.build(); .build();
} }
@ -59,7 +59,7 @@ public class SignOnProcess {
flag = false; flag = false;
return listener -> { return listener -> {
// LogUtil.d(TAG, "Starting TX SignOn"); // LogUtil.d(TAG, "Starting TX SignOn");
HostName hostName = HostName.BPC; HostName hostName = HostName.CARDZONE;
PayDetail payDetail = tradeData.getPayDetail(); PayDetail payDetail = tradeData.getPayDetail();
payDetail.setProcessCode(TransactionsType.SIGN_ON.processCode); payDetail.setProcessCode(TransactionsType.SIGN_ON.processCode);
@ -87,33 +87,65 @@ public class SignOnProcess {
LogUtil.d(TAG, "SIGN ON SUCCESS!"); LogUtil.d(TAG, "SIGN ON SUCCESS!");
if (responseMap.get("F062") != null) { if (responseMap.get("F062") != null) {
byte[] field62 = Objects.requireNonNull(responseMap.get("F062")).getDataBytes();
byte[] encryptedPIK = new byte[16];
System.arraycopy(field62, 2, encryptedPIK, 0, 16); if(hostName == HostName.CARDZONE) {
byte[] field62 = Objects.requireNonNull(responseMap.get("F062")).getDataBytes();
byte[] encryptedPIK = new byte[16];
try { System.arraycopy(field62, 0, encryptedPIK, 0, 8);
byte[] kcv = ByteUtil.hexStr2Bytes(TriDes.getKcv(encryptedPIK)); System.arraycopy(field62, 0, encryptedPIK, 8, 8);
LogUtil.d(TAG, "Encrypted PIK:" + ByteUtil.bytes2HexStr(encryptedPIK)); try {
LogUtil.d(TAG, "KCV:" + ByteUtil.bytes2HexStr(kcv)); byte[] kcv = ByteUtil.hexStr2Bytes(TriDes.getKcv(encryptedPIK));
int tmkIndex = 0; LogUtil.d(TAG, "Encrypted PIK:" + ByteUtil.bytes2HexStr(encryptedPIK));
if (!TextUtils.equals(SystemParamsOperation.getInstance().getTMKIndex(), "")) { LogUtil.d(TAG, "KCV:" + ByteUtil.bytes2HexStr(kcv));
tmkIndex = Integer.parseInt(SystemParamsOperation.getInstance().getTMKIndex()); int tmkIndex = 0;
if (!TextUtils.equals(SystemParamsOperation.getInstance().getTMKIndex(), "")) {
tmkIndex = Integer.parseInt(SystemParamsOperation.getInstance().getTMKIndex());
}
LogUtil.d(TAG, "TMK Index:" + tmkIndex);
int res = PayLibsUtils.getInstance().securityOptV2.saveCiphertextKey(AidlConstantsV2.Security.KEY_TYPE_PIK, encryptedPIK, null, tmkIndex, AidlConstantsV2.Security.KEY_ALG_TYPE_3DES, 11);
resultCode = res;
if (res < 0) {
flag = false;
LogUtil.d(TAG, "Fail PIK result code:" + res);
} else {
flag = true;
LogUtil.d(TAG, "Success PIK result code:" + res);
}
} catch (RemoteException | GeneralSecurityException e) {
e.printStackTrace();
} }
} else {
byte[] field62 = Objects.requireNonNull(responseMap.get("F062")).getDataBytes();
byte[] encryptedPIK = new byte[16];
LogUtil.d(TAG, "TMK Index:" + tmkIndex); System.arraycopy(field62, 2, encryptedPIK, 0, 16);
int res = PayLibsUtils.getInstance().securityOptV2.saveCiphertextKey(AidlConstantsV2.Security.KEY_TYPE_PIK, encryptedPIK, null, tmkIndex, AidlConstantsV2.Security.KEY_ALG_TYPE_3DES, 11);
resultCode = res; try {
if (res < 0) { byte[] kcv = ByteUtil.hexStr2Bytes(TriDes.getKcv(encryptedPIK));
flag = false; LogUtil.d(TAG, "Encrypted PIK:" + ByteUtil.bytes2HexStr(encryptedPIK));
LogUtil.d(TAG, "Fail PIK result code:" + res); LogUtil.d(TAG, "KCV:" + ByteUtil.bytes2HexStr(kcv));
} else { int tmkIndex = 0;
flag = true; if (!TextUtils.equals(SystemParamsOperation.getInstance().getTMKIndex(), "")) {
LogUtil.d(TAG, "Success PIK result code:" + res); tmkIndex = Integer.parseInt(SystemParamsOperation.getInstance().getTMKIndex());
}
LogUtil.d(TAG, "TMK Index:" + tmkIndex);
int res = PayLibsUtils.getInstance().securityOptV2.saveCiphertextKey(AidlConstantsV2.Security.KEY_TYPE_PIK, encryptedPIK, null, tmkIndex, AidlConstantsV2.Security.KEY_ALG_TYPE_3DES, 11);
resultCode = res;
if (res < 0) {
flag = false;
LogUtil.d(TAG, "Fail PIK result code:" + res);
} else {
flag = true;
LogUtil.d(TAG, "Success PIK result code:" + res);
}
} catch (RemoteException | GeneralSecurityException e) {
e.printStackTrace();
} }
} catch (RemoteException | GeneralSecurityException e) {
e.printStackTrace();
} }
} else if (responseMap.get("F053") != null) { } else if (responseMap.get("F053") != null) {
byte[] field53 = Objects.requireNonNull(responseMap.get("F053")).getDataBytes(); byte[] field53 = Objects.requireNonNull(responseMap.get("F053")).getDataBytes();
byte[] encryptedPIK = new byte[16]; byte[] encryptedPIK = new byte[16];

View File

@ -44,7 +44,7 @@ public class BitmapConfig {
/*-----------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------------------*/
/* BPC HOST*/ /* BPC HOST*/
public static final String BPC_SIGN_ON = "2220010000C00000"; public static final String BPC_SIGN_ON = "2220010000C00000";
public static final String CZ_SIGN_ON = "2220010000C00000"; public static final String CZ_SIGN_ON = "2020010000C00000";
// public static final String BPC_ECHO_TEST = "2220010000800000"; // only TID // public static final String BPC_ECHO_TEST = "2220010000800000"; // only TID
public static final String BPC_ECHO_TEST = "2220010000C00000"; // TID,MID public static final String BPC_ECHO_TEST = "2220010000C00000"; // TID,MID
@ -192,7 +192,7 @@ public class BitmapConfig {
public static final String MPU_NEW_CASH_ADVANCE="7020058020C09000"; public static final String MPU_NEW_CASH_ADVANCE="7020058020C09000";
public static final String CZ_SALE="703C058020C09200"; public static final String CZ_SALE="7020058020C09000";
public static final String UPI_SALE = "7020058020C09200"; public static final String UPI_SALE = "7020058020C09200";

View File

@ -259,9 +259,9 @@ public class FieldUtils {
int fieldPos = field.getFieldPos(); int fieldPos = field.getFieldPos();
switch (fieldPos) { switch (fieldPos) {
case 2: //PAN case 2: //PAN
String cardNumber = payDetail.getCardNo();
if (!cardNumber.isEmpty()) { //manual entry
if (payDetail.getCardType() == -1) { //manual entry
String cardNumber = payDetail.getCardNo();
field.setDataStr(cardNumber); field.setDataStr(cardNumber);
} else { } else {
iterator.remove(); iterator.remove();
@ -363,8 +363,8 @@ public class FieldUtils {
break; break;
case 24: //Network International Identifier NII case 24: //Network International Identifier NII
String nii = processField24(payDetail); // String nii = processField24(payDetail);
field.setDataStr(nii); field.setDataStr("609");
break; break;
case 25: //POS Service Condition case 25: //POS Service Condition

View File

@ -106,8 +106,8 @@ public class Params {
// mock tid,mid // mock tid,mid
payDetail.setTerminalNo("00000001"); payDetail.setTerminalNo("00000003");
payDetail.setMerchantNo("100000122234567"); payDetail.setMerchantNo("777031200000001");
// 4, Nov ,2024 // 4, Nov ,2024
payDetail.setTransCVM(TransCVM.NO_CVM); payDetail.setTransCVM(TransCVM.NO_CVM);

View File

@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDYTCCAkmgAwIBAgIETeycDjANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJt
eTELMAkGA1UECBMCa2wxDDAKBgNVBAcTA2trbDERMA8GA1UEChMIY2FyZHpvbmUx
ETAPBgNVBAsTCGNhcmR6b25lMREwDwYDVQQDEwhjYXJkem9uZTAeFw0yMTA3MDcw
ODU5MzlaFw0zMTA3MDUwODU5MzlaMGExCzAJBgNVBAYTAm15MQswCQYDVQQIEwJr
bDEMMAoGA1UEBxMDa2tsMREwDwYDVQQKEwhjYXJkem9uZTERMA8GA1UECxMIY2Fy
ZHpvbmUxETAPBgNVBAMTCGNhcmR6b25lMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
MIIBCgKCAQEA2v7WJjmr0b9WpbcsTtk6llJDA5XeReWc3in0sirutMQi+9jLUdgJ
0Kdr0Cro0vbJAcVWTBYnMqnqh7oJQYs6vpIFKJA175ZhclQFAcL2jth+Tsqx9Av1
DxbuuB7yxU7ErkhXe+/B0R8zOag866R3Xg7u09GG4mlQMx5zmo1Hn3lqMU0lxEXM
vhkzVXLUMLhVwu/oJk98u+6pPXoCzXPjBCgy3iR+BaGIR6aiflz8Bi1Rn3XgfnMi
PzOzxKRZu5mNBRijs7ztcjA8Pc2uNI0ux3+jUJTgu2JRIBJs+7BkNcJeLzpW5psz
qfFdwxTKkgfqU9gJwuPaEbdnP0j7Rv2MBwIDAQABoyEwHzAdBgNVHQ4EFgQUOF7s
btNCxmv9HSAkSAPVAHpDXY4wDQYJKoZIhvcNAQELBQADggEBADOJaUnRiVucIb8q
jxplpSE0gOHMng+BMq2gKcqqc+QRc/mgM3n0J8F1A3rzj3udbzen3/9TnOiH17uy
FGLH12sJ7dJWMGAJ2p15N307ckrCab3+3Y1w6OQJLZ8t3eeXFGPVWQJtiOUbyX73
3Fv+TpNl6X1uEdQ0zNDiAvWZQ/e6ynYGF/tSgZLJvgV+8UY5ShCA0Ypousm6sPqb
KQXPCs3kRn1eMgMy8PcmUlZK/5qhD+xZswWgNiQ6EyCWmwpB4O0N9wQbLBTFZkGA
bDke78LVS1nUam9czcNvSDYyjWsk9ud8mo9JfF21qmwCR68btqDgeU0hM9W6lEQo
ezrrz9k=
-----END CERTIFICATE-----

View File

@ -0,0 +1,7 @@
package android.text;
public class TextUtils {
public static boolean isEmpty(CharSequence str) {
return str == null || str.length() == 0;
}
}

View File

@ -0,0 +1,30 @@
package android.util;
public class Log {
public static int d(String tag, String msg) {
System.out.println("DEBUG: " + tag + ": " + msg);
return 0;
}
public static int i(String tag, String msg) {
System.out.println("INFO: " + tag + ": " + msg);
return 0;
}
public static int w(String tag, String msg) {
System.out.println("WARN: " + tag + ": " + msg);
return 0;
}
public static int e(String tag, String msg) {
System.out.println("ERROR: " + tag + ": " + msg);
return 0;
}
public static int v(String tag, String msg) {
System.out.println("VERBOSE: " + tag + ": " + msg);
return 0;
}
// add other methods if required...
}

View File

@ -4,8 +4,12 @@ import org.junit.Test;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import com.utsmyanmar.paylibs.isobuilder.ISOMode;
import com.utsmyanmar.paylibs.isobuilder.builderx.ISOMsgX;
import com.utsmyanmar.paylibs.isobuilder.builderx.ISOVersion;
import com.utsmyanmar.paylibs.print.PrintUtils; import com.utsmyanmar.paylibs.print.PrintUtils;
import com.utsmyanmar.paylibs.utils.POSUtil; import com.utsmyanmar.paylibs.utils.POSUtil;
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
import com.utsmyanmar.paylibs.utils.enums.HostName; import com.utsmyanmar.paylibs.utils.enums.HostName;
import com.utsmyanmar.paylibs.utils.enums.HostType; import com.utsmyanmar.paylibs.utils.enums.HostType;
import com.utsmyanmar.paylibs.utils.secure.TripleDes; import com.utsmyanmar.paylibs.utils.secure.TripleDes;
@ -28,6 +32,16 @@ public class ExampleUnitTest {
System.out.println("Host Type string: "+hostType.getDisplayName()); System.out.println("Host Type string: "+hostType.getDisplayName());
} }
@Test
public void testISOResponse() {
ISOMsgX isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.ONLY_HEADER,HostName.CARDZONE)
.build();
byte[] response = ByteUtil.hexStr2Bytes("004E0810203801000AC0000492000000005721022405290609363134393231303030303537303030303030303030333737373033313230303030303030310016B82AE6E3F108EB2F6243A684DAB8A3F2");
isoMsgX.parseISOPackets(response,response.length);
}
@Test @Test
public void testRemoveTag() { public void testRemoveTag() {
String exampleString = "72279F180430303031860E04DA9F58090364245F18E62D9482860E04DA9F590908C88B9BF11052A901910865238848008600008A023030"; String exampleString = "72279F180430303031860E04DA9F58090364245F18E62D9482860E04DA9F590908C88B9BF11052A901910865238848008600008A023030";