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 request = when (activeHostAction) {
"Echo Test" -> signOnProcess.enqueue(false)
"Log-Off" -> signOnProcess.enqueueLogOff()
"Sign-Off" -> signOnProcess.enqueueLogOff()
else -> signOnProcess.enqueueLogOn()
}
request.startSignOn(object : SignOnListener {
@ -262,40 +262,10 @@ fun DashboardScreen2(
)
Item(
title = "Echo Test", subTitle = "Test Connection Status",
title = "Sign-Off", subTitle = "Sign off from System",
onClick = {
scope.launch { drawerState.close() }
openHostActionDialog("Echo Test")
},
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")
openHostActionDialog("Sign-Off")
},
leadingIcon = {
Icon(

View File

@ -353,40 +353,45 @@ public class DecodePackage {
// Get the value of the variable length part
if (outField.getLengthType() > 0) {
int varLen;
if( hostName == HostName.BPC) {
if (hostName == HostName.BPC) {
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 {
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];
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);
// Length of data length
tmpLen += varLen; //tmp len 54
tmpLen += varLen;
// Number of bytes of variable length data
int datLen;
int bcdLength = 0;
if( hostName == HostName.BPC) {
bcdLength = Integer.parseInt(new String(varValue)); //31
if (hostName == HostName.BPC) {
bcdLength = Integer.parseInt(new String(varValue));
} else {
bcdLength = Utils.bcdToint(varValue); //31
// bcdLength = Integer.parseInt(new String(varValue)); //31
bcdLength = Utils.bcdToint(varValue);
}
// Determine the data type (binary type data is not processed)
if (outField.getDataType() == FieldConfig.SDK_8583_DATA_BCD) {
if( hostName == HostName.BPC) {
datLen = bcdLength ;
if (hostName == HostName.BPC) {
datLen = bcdLength;
} else {
datLen = (bcdLength / 2) + (bcdLength % 2);
}
@ -403,20 +408,14 @@ public class DecodePackage {
// Take the value of the variable length part。
nextData = new byte[datLen];
//tmp len 55
try {
if(hostName == HostName.BPC) {
System.arraycopy(body, tmpLen, nextData, 0, datLen);
} else {
// System.arraycopy(body, tmpLen, nextData, 0, body.length-tmpLen);
System.arraycopy(body, tmpLen, nextData, 0, datLen);
}
//
} catch (IndexOutOfBoundsException e){
e.printStackTrace();
System.arraycopy(body, tmpLen, nextData, 0, datLen);
int available = Math.max(0, body.length - tmpLen);
int copyLen = Math.min(datLen, available);
if (copyLen < datLen && printLog) {
LogUtil.e(TAG, "field pos:" + i + " data truncated. need="
+ datLen + " available=" + available + " tmpLen=" + tmpLen);
}
if (copyLen > 0) {
System.arraycopy(body, tmpLen, nextData, 0, copyLen);
}
// Data length

View File

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

View File

@ -264,10 +264,14 @@ public class EchoTestProcess {
LogUtil.d(TAG, "Starting TX LOG OFF");
PayDetail payDetail = tradeData.getPayDetail();
tradeData.setField60("00000028002");
payDetail.setSettleData("001");
payDetail.setProcessCode(TransactionsType.LOG_OFF.processCode);
payDetail.setTransType(TransactionsType.LOG_OFF.name);
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() {
@Override

View File

@ -7,6 +7,8 @@ public enum MessageType {
REVERSAL,
CZ_REVERSAL,
NETWORK_MANAGEMENT,
CZ_SIGN_OFF,
TC_ADVICE,
BATCH_UPLOAD,
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_COMP="703805802CC08000";
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 FINEXUS_BATCH_UPLOAD="703C078008C00200";