cardzone sign on got approved
This commit is contained in:
parent
f95208aa9d
commit
000c48bf6b
@ -128,7 +128,7 @@ fun AppNavGraph(
|
||||
|
||||
SettlementScreen(
|
||||
sharedViewModel = sharedViewModel,
|
||||
onBack = { navController.popBackStack() },
|
||||
onBack = { navController.popBackStack(Routes.Dashboard.route,false) },
|
||||
onStartSettlement = {
|
||||
sharedViewModel.transactionsType.value = com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType.SETTLEMENT
|
||||
navController.navigate(Routes.Processing.route) {
|
||||
|
||||
@ -15,6 +15,7 @@ import java.util.Locale;
|
||||
|
||||
import sunmi.sunmiui.utils.LogUtil;
|
||||
|
||||
|
||||
public class DecodePackage {
|
||||
|
||||
public final static String TAG = "DecodePackage";
|
||||
@ -24,9 +25,208 @@ public class DecodePackage {
|
||||
}
|
||||
|
||||
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) {
|
||||
HashMap<String, MsgField> resMap = new HashMap<>();
|
||||
|
||||
@ -152,11 +352,19 @@ public class DecodePackage {
|
||||
|
||||
// Get the value of the variable length part
|
||||
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
|
||||
// int varLen = (outField.getLengthType() + 1) / 2;
|
||||
int varLen = outField.getLengthType();
|
||||
// varLen = outField.getLengthType();
|
||||
|
||||
byte[] varValue = new byte[varLen];
|
||||
if(i==62){
|
||||
if(i==62 || i==63){
|
||||
tmpLen++;
|
||||
}
|
||||
|
||||
@ -172,6 +380,7 @@ public class DecodePackage {
|
||||
bcdLength = Integer.parseInt(new String(varValue)); //31
|
||||
} else {
|
||||
bcdLength = Utils.bcdToint(varValue); //31
|
||||
// bcdLength = Integer.parseInt(new String(varValue)); //31
|
||||
}
|
||||
|
||||
// Determine the data type (binary type data is not processed)
|
||||
@ -197,10 +406,16 @@ public class DecodePackage {
|
||||
//tmp len 55
|
||||
|
||||
try {
|
||||
// System.arraycopy(body, tmpLen, nextData, 0, datLen); 25/May/2026
|
||||
if(hostName == HostName.BPC) {
|
||||
System.arraycopy(body, tmpLen, nextData, 0, datLen);
|
||||
} else {
|
||||
System.arraycopy(body, tmpLen, nextData, 0, body.length-tmpLen);
|
||||
}
|
||||
|
||||
//
|
||||
} catch (IndexOutOfBoundsException e){
|
||||
e.printStackTrace();
|
||||
System.arraycopy(body, tmpLen, nextData, 0, datLen);
|
||||
}
|
||||
|
||||
// Data length
|
||||
|
||||
@ -17,14 +17,15 @@ public abstract class BaseISOMsgX {
|
||||
|
||||
byte[] newSendBytes = EncodePackage.assembly(map, msgIdentifier, 0, "0000000000",hostName);
|
||||
|
||||
String BPCTPDU = "6003550000";
|
||||
// String BPCTPDU = "6003550000";
|
||||
String MOBTPDU = "6030303030";
|
||||
|
||||
if(isoMode == ISOMode.BOTH_HEADER_TPDU) {
|
||||
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 tpdu :" + ByteUtil.bytes2HexStr(tpdu));
|
||||
@ -48,7 +49,8 @@ public abstract class BaseISOMsgX {
|
||||
int low = (outBytes.length - 2) % 256;
|
||||
outBytes[0] = (byte) hig;
|
||||
outBytes[1] = (byte) low;
|
||||
|
||||
// outBytes[0] = (byte) 0x00;
|
||||
// outBytes[1] = (byte) 0x00;
|
||||
String str = "HexString:" + ByteUtil.bytes2HexStr(outBytes);
|
||||
LogUtil.d(Constant.TAG, str);
|
||||
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 tpdu :" + ByteUtil.bytes2HexStr(tpdu));
|
||||
@ -122,17 +124,14 @@ public abstract class BaseISOMsgX {
|
||||
return newBytes;
|
||||
} 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(headBytes, 0, outBytes, 7, headBytes.length);
|
||||
System.arraycopy(receiveBytes, 7, outBytes, 13, receiveBytes.length - 7);
|
||||
|
||||
log = "HexString:" + ByteUtil.bytes2HexStr(outBytes);
|
||||
System.arraycopy(receiveBytes, 0, outBytes, 0, 2);
|
||||
System.arraycopy(headBytes, 0, outBytes, 2, headBytes.length);
|
||||
System.arraycopy(receiveBytes, 2, outBytes, 7, receiveBytes.length-2);
|
||||
LogUtil.d(Constant.TAG, log);
|
||||
|
||||
return outBytes;
|
||||
|
||||
} else {
|
||||
|
||||
@ -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.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);
|
||||
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.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);
|
||||
caInput.close();
|
||||
@ -329,8 +329,10 @@ public class ISOSocket {
|
||||
|
||||
public void switchIp() {
|
||||
isSwitchIp = true;
|
||||
serverIP = "192.168.0.107";
|
||||
serverPort = 5001;
|
||||
serverIP = "posuat.myanmarorientalbank.com";
|
||||
serverPort = 5033;
|
||||
// serverIP = "192.168.0.107";
|
||||
// serverPort = 5001;
|
||||
// serverIP = getSecondaryIp();
|
||||
// serverPort = getSecondaryPort();
|
||||
}
|
||||
@ -351,10 +353,11 @@ public class ISOSocket {
|
||||
if (!isSwitchIp) {
|
||||
// serverIP = getIp();
|
||||
// serverPort = getPort();
|
||||
// serverIP = "posuat.myanmarorientalbank.com";
|
||||
// serverPort = 5033;
|
||||
serverIP = "192.168.0.107";
|
||||
serverPort = 5001;
|
||||
// serverIP = "192.168.0.107";
|
||||
// serverPort = 5001;
|
||||
SystemParamsOperation.getInstance().setSslSwitchStatus(true);
|
||||
serverIP = "posuat.myanmarorientalbank.com";
|
||||
serverPort = 5033;
|
||||
} else {
|
||||
isSwitchIp = false;
|
||||
}
|
||||
|
||||
@ -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.CARDZONE)
|
||||
isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.ONLY_HEADER,HostName.CARDZONE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ public class SignOnProcess {
|
||||
flag = false;
|
||||
return listener -> {
|
||||
// LogUtil.d(TAG, "Starting TX SignOn");
|
||||
HostName hostName = HostName.BPC;
|
||||
HostName hostName = HostName.CARDZONE;
|
||||
PayDetail payDetail = tradeData.getPayDetail();
|
||||
|
||||
payDetail.setProcessCode(TransactionsType.SIGN_ON.processCode);
|
||||
@ -87,6 +87,36 @@ public class SignOnProcess {
|
||||
LogUtil.d(TAG, "SIGN ON SUCCESS!");
|
||||
|
||||
if (responseMap.get("F062") != null) {
|
||||
|
||||
if(hostName == HostName.CARDZONE) {
|
||||
byte[] field62 = Objects.requireNonNull(responseMap.get("F062")).getDataBytes();
|
||||
byte[] encryptedPIK = new byte[16];
|
||||
|
||||
System.arraycopy(field62, 0, encryptedPIK, 0, 8);
|
||||
System.arraycopy(field62, 0, encryptedPIK, 8, 8);
|
||||
try {
|
||||
byte[] kcv = ByteUtil.hexStr2Bytes(TriDes.getKcv(encryptedPIK));
|
||||
LogUtil.d(TAG, "Encrypted PIK:" + ByteUtil.bytes2HexStr(encryptedPIK));
|
||||
LogUtil.d(TAG, "KCV:" + ByteUtil.bytes2HexStr(kcv));
|
||||
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];
|
||||
|
||||
@ -114,6 +144,8 @@ public class SignOnProcess {
|
||||
} catch (RemoteException | GeneralSecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} else if (responseMap.get("F053") != null) {
|
||||
byte[] field53 = Objects.requireNonNull(responseMap.get("F053")).getDataBytes();
|
||||
byte[] encryptedPIK = new byte[16];
|
||||
|
||||
@ -44,7 +44,7 @@ public class BitmapConfig {
|
||||
/*-----------------------------------------------------------------------------------------------------*/
|
||||
/* BPC HOST*/
|
||||
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 = "2220010000C00000"; // TID,MID
|
||||
@ -192,7 +192,7 @@ public class BitmapConfig {
|
||||
|
||||
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";
|
||||
|
||||
|
||||
@ -259,9 +259,9 @@ public class FieldUtils {
|
||||
int fieldPos = field.getFieldPos();
|
||||
switch (fieldPos) {
|
||||
case 2: //PAN
|
||||
|
||||
if (payDetail.getCardType() == -1) { //manual entry
|
||||
String cardNumber = payDetail.getCardNo();
|
||||
if (!cardNumber.isEmpty()) { //manual entry
|
||||
|
||||
field.setDataStr(cardNumber);
|
||||
} else {
|
||||
iterator.remove();
|
||||
@ -363,8 +363,8 @@ public class FieldUtils {
|
||||
break;
|
||||
case 24: //Network International Identifier NII
|
||||
|
||||
String nii = processField24(payDetail);
|
||||
field.setDataStr(nii);
|
||||
// String nii = processField24(payDetail);
|
||||
field.setDataStr("609");
|
||||
|
||||
break;
|
||||
case 25: //POS Service Condition
|
||||
|
||||
@ -106,8 +106,8 @@ public class Params {
|
||||
|
||||
// mock tid,mid
|
||||
|
||||
payDetail.setTerminalNo("00000001");
|
||||
payDetail.setMerchantNo("100000122234567");
|
||||
payDetail.setTerminalNo("00000003");
|
||||
payDetail.setMerchantNo("777031200000001");
|
||||
|
||||
// 4, Nov ,2024
|
||||
payDetail.setTransCVM(TransCVM.NO_CVM);
|
||||
|
||||
21
paylibs/src/main/res/raw/mob_uat.crt
Normal file
21
paylibs/src/main/res/raw/mob_uat.crt
Normal 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-----
|
||||
7
paylibs/src/test/java/android/text/TextUtils.java
Normal file
7
paylibs/src/test/java/android/text/TextUtils.java
Normal file
@ -0,0 +1,7 @@
|
||||
package android.text;
|
||||
|
||||
public class TextUtils {
|
||||
public static boolean isEmpty(CharSequence str) {
|
||||
return str == null || str.length() == 0;
|
||||
}
|
||||
}
|
||||
30
paylibs/src/test/java/android/util/Log.java
Normal file
30
paylibs/src/test/java/android/util/Log.java
Normal 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...
|
||||
}
|
||||
@ -4,8 +4,12 @@ import org.junit.Test;
|
||||
|
||||
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.utils.POSUtil;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||
import com.utsmyanmar.paylibs.utils.enums.HostName;
|
||||
import com.utsmyanmar.paylibs.utils.enums.HostType;
|
||||
import com.utsmyanmar.paylibs.utils.secure.TripleDes;
|
||||
@ -28,6 +32,16 @@ public class ExampleUnitTest {
|
||||
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
|
||||
public void testRemoveTag() {
|
||||
String exampleString = "72279F180430303031860E04DA9F58090364245F18E62D9482860E04DA9F590908C88B9BF11052A901910865238848008600008A023030";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user