fixed for magstripe not allowed

This commit is contained in:
kizzy 2026-03-06 16:40:43 +07:00
parent 89252a6732
commit 620620e138
6 changed files with 43 additions and 7 deletions

View File

@ -151,6 +151,9 @@ public class CardWaitingFragment extends DataBindingFragment implements DataBind
}else if(sharedViewModel.getIsSeePhone().getValue() != null && sharedViewModel.getIsSeePhone().getValue()) {
cardReadViewModel.setCheckCardAlertMsg("Please Tap!",false);
setupCardReadProcess(true);
} else if(sharedViewModel.getIsCardAppBlock().getValue() != null && sharedViewModel.getIsCardAppBlock().getValue()) {
cardReadViewModel.setCheckCardAlertMsg("Magstripe not allowed!",false);
setupCardReadProcess(true);
} else {
setupCardReadProcess(false);
}

View File

@ -249,7 +249,25 @@ public class EmvTransactionFragment extends DataBindingFragment {
}
});
}
break;
case CARD_APP_BLOCKED:
if(cardReadViewModel.cardTypeData.getValue()!= null && cardReadViewModel.cardTypeData.getValue() == CardTypeX.IC.value) {
isCardInserted(new CardDetectCallback() {
@Override
public void onComplete() {
sharedViewModel.setIsCardAppBlock(true);
navigateToCheckCard();
}
});
} else if(cardReadViewModel.cardTypeData.getValue() != null && cardReadViewModel.cardTypeData.getValue() == CardTypeX.NFC.value) {
isCardTaped("Please try again",new CardDetectCallback() {
@Override
public void onComplete() {
sharedViewModel.setIsCardAppBlock(true);
navigateToCheckCard();
}
});
}
// sharedViewModel.set_errorFragmentMsg("Interface not found!");
// navigateToError();
break;

View File

@ -164,6 +164,9 @@ public class EmvTransactionProcessViewModel extends EmvBaseViewModel implements
case EMV_TRY_AGAIN:
emvResultStatus.postValue(EmvResultStatus.READ_CARD_RETRY);
break;
case EMV_CARD_BLOCK:
emvResultStatus.postValue(EmvResultStatus.CARD_APP_BLOCKED);
break;
case EMV_CONFIRM_CODE_VERIFY:
emvResultStatus.postValue(EmvResultStatus.CONFIRM_CODE_VERIFY);
break;

View File

@ -164,6 +164,7 @@ public class SharedViewModel extends ViewModel {
private SingleLiveEvent<Boolean> isFallback = new SingleLiveEvent<>();
private SingleLiveEvent<Boolean> isSeePhone = new SingleLiveEvent<>();
private SingleLiveEvent<Boolean> isCardAppBlock = new SingleLiveEvent<>();
private SingleLiveEvent<Boolean> _isCardDataExist = new SingleLiveEvent<>();
@ -233,6 +234,10 @@ public class SharedViewModel extends ViewModel {
public SingleLiveEvent<Boolean> getIsFallback() { return isFallback;}
public void setIsCardAppBlock(boolean status) { isCardAppBlock.setValue(status);}
public SingleLiveEvent<Boolean> getIsCardAppBlock() {return isCardAppBlock;}
public void setIsSeePhone(boolean status) { isSeePhone.setValue(status);}
public SingleLiveEvent<Boolean> getIsSeePhone() { return isSeePhone;}

View File

@ -30,5 +30,6 @@ public enum EmvResultStatus {
CONFIRM_CODE_VERIFY,
MPU_CARD,
SEE_PHONE,
OTHER_INTERFACE
OTHER_INTERFACE,
CARD_APP_BLOCKED
}

View File

@ -153,6 +153,8 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
protected static final int EMV_ONLINE_PROCESS = 11;
protected static final int EMV_ERROR = 12;
protected static final int EMV_TRY_AGAIN = 13;
protected static final int EMV_CARD_BLOCK = 23;
protected static final int EMV_CTLS_TRY_AGAIN = 13;
protected static final int EMV_CONFIRM_CODE_VERIFY = 14;
@ -674,11 +676,11 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
}
} else {
//contact terminal capability ; if different card brand(depend on aid) have different terminal capability
if (ByteUtils.byteArray2HexString(aid).toUpperCase().contains("A000000004")) {
emvHandler.setTlv(new byte[]{(byte) 0x9F, (byte) 0x33}, new byte[]{(byte) 0xE0, (byte) 0x28, (byte) 0xC8});
emvHandler.setTlv(new byte[]{(byte) 0x9F, (byte) 0x1D}, ByteUtils.hexString2ByteArray("6C00800000000000"));//terminal risk
}
// if (ByteUtils.byteArray2HexString(aid).toUpperCase().contains("A000000004")) {
// emvHandler.setTlv(new byte[]{(byte) 0x9F, (byte) 0x33}, new byte[]{(byte) 0xE0, (byte) 0x28, (byte) 0xC8});
// emvHandler.setTlv(new byte[]{(byte) 0x9F, (byte) 0x1D}, ByteUtils.hexString2ByteArray("6C00800000000000"));//terminal risk
//
// }
}
emvHandler.onSetTransInitBeforeGPOResponse(true);
@ -825,6 +827,10 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
case SdkResult.Emv_Qpboc_Online://EMV Contactless: Online Process for union pay
//union pay online contactless--application should go online
break;
case SdkResult.Emv_Card_Block:
case SdkResult.Emv_App_Block:
mHandler.sendEmptyMessage(EMV_CARD_BLOCK);
break;
case SdkResult.Emv_Candidatelist_Empty:// Application have no aid list
case SdkResult.Emv_FallBack:// FallBack ,chip card reset failed