modification for upi certification cases

This commit is contained in:
moon 2026-05-05 19:05:22 +06:30
parent 8c151e3136
commit 20be06c7db
5 changed files with 40 additions and 7 deletions

View File

@ -495,6 +495,7 @@ public class MainActivity extends AppCompatActivity implements
navigateToQRSettlementAfterPOS(intent);
}
} else {
// POS had no data, go straight to QR if available
if (hasQR) {
handleQRSettlement(intent);

View File

@ -256,9 +256,20 @@ public class CardWaitingFragment extends DataBindingFragment implements DataBind
HashSet<CardSlotTypeEnum> allType = new HashSet<>();
allType.clear();
// if(sharedViewModel.getIsSeePhone().getValue() != null && sharedViewModel.getIsSeePhone().getValue()) {
// allType.add(CardSlotTypeEnum.RF);
// waitTimeout = 20;
// } else {
// allType.add(CardSlotTypeEnum.ICC1);
// allType.add(CardSlotTypeEnum.RF);
// allType.add(CardSlotTypeEnum.SWIPE);
// }
if(sharedViewModel.getIsSeePhone().getValue() != null && sharedViewModel.getIsSeePhone().getValue()) {
allType.add(CardSlotTypeEnum.RF);
waitTimeout = 20;
} else if(!SystemParamsOperation.getInstance().isNfcEnabled()) {
allType.add(CardSlotTypeEnum.ICC1);
allType.add(CardSlotTypeEnum.SWIPE);
} else {
allType.add(CardSlotTypeEnum.ICC1);
allType.add(CardSlotTypeEnum.RF);

View File

@ -78,13 +78,21 @@ public class EmvTransactionProcessViewModel extends EmvBaseViewModel implements
break;
}
try {
if (mPayDetail.PINCipher != null && !mPayDetail.PINCipher.isEmpty()) {
LogUtil.d("EmvTransactionProcessViewModel", "mPayDetail" + mPayDetail.PINCipher);
LogUtil.d("EmvTransactionProcessViewModel", "is offline pin entered " + isOfflinePinEntered);
if ((mPayDetail.PINCipher != null && !mPayDetail.PINCipher.isEmpty())) {
LogUtil.d("EmvTransactionProcessViewModel", "condition 1");
emvHandler.onSetPinInputResponse(true, false);
} else if (isOfflinePinEntered) {
} else if(isOfflinePinEntered){
LogUtil.d("EmvTransactionProcessViewModel", "condition 2");
emvHandler.onSetPinInputResponse(true, false);
} else {
}else {
LogUtil.d("EmvTransactionProcessViewModel", "condition 3");
emvHandler.onSetPinInputResponse(true, true);
}
if (transType.getValue() == TransactionsType.PRE_AUTH_COMPLETE || transType.getValue() == TransactionsType.PRE_AUTH_VOID || transType.getValue() == TransactionsType.REFUND) {
emvResultStatus.postValue(EmvResultStatus.ON_NEXT_SCREEN);
}

View File

@ -212,6 +212,7 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
}
public void startProcess() {
isOfflinePinEntered = false;
initData();
// Check if initialization was successful
@ -489,7 +490,14 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
if (retCode == SdkResult.Success) {
LogUtil.d(TAG, "Success");
if(isOnlinePin) {
mPayDetail.setPINCipher(ByteUtil.bytes2HexStr(data));
if(ByteUtil.bytes2HexStr(data).equals("0000000000000000")) {
mPayDetail.setPINCipher("");
} else {
mPayDetail.setPINCipher(ByteUtil.bytes2HexStr(data));
}
// mPayDetail.setPINCipher(ByteUtil.bytes2HexStr(data));
} else {
isOfflinePinEntered = true;
}
mHandler.obtainMessage(PIN_CLICK_CONFIRM).sendToTarget();
} else if (retCode == SdkResult.Fail) {
@ -519,8 +527,9 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
LogUtil.d(TAG, "on click cancel");
mHandler.obtainMessage(PIN_CLICK_CANCEL).sendToTarget();
} else if (keyCode == PinPadKeyCode.KEYCODE_CONFIRM) {
LogUtil.d(TAG, "on click confirm");
mHandler.obtainMessage(PIN_CLICK_CONFIRM).sendToTarget();
// Wait for onInputResult() so the PIN cipher / offline PIN state is ready
// before EmvTransactionProcessViewModel handles PIN confirmation.
LogUtil.d(TAG, "on click confirm - waiting for input result");
} else {
LogUtil.d(TAG, "on click number");
mHandler.obtainMessage(PIN_CLICK_NUMBER, pinEnterCount, 0).sendToTarget();

View File

@ -52,7 +52,11 @@ public class AuthorizationProcessUtil {
if(field39 != null && field39.getDataStr() != null ) {
LogUtil.d(TAG,"Field 39:"+field39.getDataStr());
emvOnlineResult.setRejCode(field39.getDataStr());
if(field39.getDataStr().equals("000")){
emvOnlineResult.setRejCode("00");
}else{
emvOnlineResult.setRejCode(field39.getDataStr());
}
}
if(field55 != null && field55.getDataStr() != null) {