replaced sign-off instead of log-off, removed echo test/log on

This commit is contained in:
kizzy 2026-07-21 14:41:51 +07:00
parent 4884152faa
commit 4ae46e9e99
6 changed files with 42 additions and 64 deletions

View File

@ -131,7 +131,7 @@ fun DashboardScreen2(
val signOnProcess = EchoTestProcess.getInstance() val signOnProcess = EchoTestProcess.getInstance()
val request = when (activeHostAction) { val request = when (activeHostAction) {
"Echo Test" -> signOnProcess.enqueue(false) "Echo Test" -> signOnProcess.enqueue(false)
"Log-Off" -> signOnProcess.enqueueLogOff() "Sign-Off" -> signOnProcess.enqueueLogOff()
else -> signOnProcess.enqueueLogOn() else -> signOnProcess.enqueueLogOn()
} }
request.startSignOn(object : SignOnListener { request.startSignOn(object : SignOnListener {
@ -262,40 +262,10 @@ fun DashboardScreen2(
) )
Item( Item(
title = "Echo Test", subTitle = "Test Connection Status", title = "Sign-Off", subTitle = "Sign off from System",
onClick = { onClick = {
scope.launch { drawerState.close() } scope.launch { drawerState.close() }
openHostActionDialog("Echo Test") openHostActionDialog("Sign-Off")
},
leadingIcon = {
Icon(
painterResource(R.drawable.ic_up_down_arrow),
contentDescription = "icon",
tint = Color.LegacyRed
)
},
trailingIcon = {},
)
Item(
title = "Log-On", subTitle = "Log on to System",
onClick = {
scope.launch { drawerState.close() }
openHostActionDialog("Log-On")
},
leadingIcon = {
Icon(
painterResource(R.drawable.ic_lock),
contentDescription = "icon",
tint = Color.LegacyRed
)
},
trailingIcon = {},
)
Item(
title = "Log-Off", subTitle = "Log off from System",
onClick = {
scope.launch { drawerState.close() }
openHostActionDialog("Log-Off")
}, },
leadingIcon = { leadingIcon = {
Icon( Icon(

View File

@ -353,40 +353,45 @@ 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; int varLen;
if( hostName == HostName.BPC) { if (hostName == HostName.BPC) {
varLen = outField.getLengthType(); varLen = outField.getLengthType();
} else if (outField.getDataType() == FieldConfig.SDK_8583_DATA_ASC
&& outField.getLengthType() == 2) {
// Mirror EncodePackage MPU ASC packing (F60/F62/F63):
// FieldUtils prepends a 4-digit ASCII length, and encode
// BCD-encodes those 4 digits as a 2-byte length prefix.
varLen = 2;
} else { } else {
varLen = (outField.getLengthType() + 1) / 2; varLen = (outField.getLengthType() + 1) / 2;
} }
// Get the length of the byte array
// int varLen = (outField.getLengthType() + 1) / 2;
// varLen = outField.getLengthType();
byte[] varValue = new byte[varLen]; byte[] varValue = new byte[varLen];
if(i==62 || i==63){
tmpLen++;
}
if (tmpLen + varLen > body.length) {
if (printLog) {
LogUtil.e(TAG, "field pos:" + i + " length prefix truncated. tmpLen="
+ tmpLen + " need=" + varLen + " bodyLen=" + body.length);
}
break;
}
System.arraycopy(body, tmpLen, varValue, 0, varValue.length); System.arraycopy(body, tmpLen, varValue, 0, varValue.length);
// Length of data length // Length of data length
tmpLen += varLen; //tmp len 54 tmpLen += varLen;
// Number of bytes of variable length data // Number of bytes of variable length data
int datLen; int datLen;
int bcdLength = 0; int bcdLength = 0;
if( hostName == HostName.BPC) { if (hostName == HostName.BPC) {
bcdLength = Integer.parseInt(new String(varValue)); //31 bcdLength = Integer.parseInt(new String(varValue));
} else { } else {
bcdLength = Utils.bcdToint(varValue); //31 bcdLength = Utils.bcdToint(varValue);
// 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)
if (outField.getDataType() == FieldConfig.SDK_8583_DATA_BCD) { if (outField.getDataType() == FieldConfig.SDK_8583_DATA_BCD) {
if( hostName == HostName.BPC) { if (hostName == HostName.BPC) {
datLen = bcdLength ; datLen = bcdLength;
} else { } else {
datLen = (bcdLength / 2) + (bcdLength % 2); datLen = (bcdLength / 2) + (bcdLength % 2);
} }
@ -403,20 +408,14 @@ public class DecodePackage {
// Take the value of the variable length part。 // Take the value of the variable length part。
nextData = new byte[datLen]; nextData = new byte[datLen];
//tmp len 55 int available = Math.max(0, body.length - tmpLen);
int copyLen = Math.min(datLen, available);
try { if (copyLen < datLen && printLog) {
if(hostName == HostName.BPC) { LogUtil.e(TAG, "field pos:" + i + " data truncated. need="
System.arraycopy(body, tmpLen, nextData, 0, datLen); + datLen + " available=" + available + " tmpLen=" + tmpLen);
} else { }
// System.arraycopy(body, tmpLen, nextData, 0, body.length-tmpLen); if (copyLen > 0) {
System.arraycopy(body, tmpLen, nextData, 0, datLen); System.arraycopy(body, tmpLen, nextData, 0, copyLen);
}
//
} catch (IndexOutOfBoundsException e){
e.printStackTrace();
System.arraycopy(body, tmpLen, nextData, 0, datLen);
} }
// Data length // Data length

View File

@ -121,6 +121,9 @@ public class ISOMsgX extends BaseISOMsgX{
case AUTHORIZATION_COMPLETE: case AUTHORIZATION_COMPLETE:
MTI = "0220"; MTI = "0220";
break; break;
case CZ_SIGN_OFF:
MTI = "0820";
break;
} }
Map<String, MsgField> rm = EncodePackage.preAssemblyBase(bitmap,hostName); Map<String, MsgField> rm = EncodePackage.preAssemblyBase(bitmap,hostName);

View File

@ -264,10 +264,14 @@ public class EchoTestProcess {
LogUtil.d(TAG, "Starting TX LOG OFF"); LogUtil.d(TAG, "Starting TX LOG OFF");
PayDetail payDetail = tradeData.getPayDetail(); PayDetail payDetail = tradeData.getPayDetail();
tradeData.setField60("00000028002");
payDetail.setSettleData("001");
payDetail.setProcessCode(TransactionsType.LOG_OFF.processCode); payDetail.setProcessCode(TransactionsType.LOG_OFF.processCode);
payDetail.setTransType(TransactionsType.LOG_OFF.name); payDetail.setTransType(TransactionsType.LOG_OFF.name);
payDetail.setTransactionType(TransactionsType.LOG_OFF.value); payDetail.setTransactionType(TransactionsType.LOG_OFF.value);
byte[] sendBytes = isoMsgX.buildISOPackets(tradeData, BitmapConfig.BPC_ECHO_TEST, MessageType.NETWORK_MANAGEMENT);
byte[] sendBytes = isoMsgX.buildISOPackets(tradeData, BitmapConfig.CZ_LOG_OFF, MessageType.CZ_SIGN_OFF);
ISOSocket.getInstance().enqueue(sendBytes, sendBytes.length,false, new ISOCallback() { ISOSocket.getInstance().enqueue(sendBytes, sendBytes.length,false, new ISOCallback() {
@Override @Override

View File

@ -7,6 +7,8 @@ public enum MessageType {
REVERSAL, REVERSAL,
CZ_REVERSAL, CZ_REVERSAL,
NETWORK_MANAGEMENT, NETWORK_MANAGEMENT,
CZ_SIGN_OFF,
TC_ADVICE, TC_ADVICE,
BATCH_UPLOAD, BATCH_UPLOAD,
SETTLEMENT, SETTLEMENT,

View File

@ -202,7 +202,7 @@ public class BitmapConfig {
public static final String CZ_PRE_AUTH_VOID="703C058008C08000"; public static final String CZ_PRE_AUTH_VOID="703C058008C08000";
public static final String CZ_PRE_AUTH_COMP="703805802CC08000"; public static final String CZ_PRE_AUTH_COMP="703805802CC08000";
public static final String CZ_PRE_AUTH_COMP_VOID="7038058008C00000"; public static final String CZ_PRE_AUTH_COMP_VOID="7038058008C00000";
public static final String CZ_LOG_OFF = "0020010000C00012";
public static final String UPI_SALE = "7020058020C09200"; public static final String UPI_SALE = "7020058020C09200";
public static final String FINEXUS_BATCH_UPLOAD="703C078008C00200"; public static final String FINEXUS_BATCH_UPLOAD="703C078008C00200";