fixed for pinpad retry
This commit is contained in:
parent
ffc3908446
commit
e60985b2ec
@ -290,7 +290,7 @@ public class CardWaitingFragment extends DataBindingFragment implements DataBind
|
|||||||
|
|
||||||
} else if (isFallback && cardType == CardTypeX.MAG) {
|
} else if (isFallback && cardType == CardTypeX.MAG) {
|
||||||
/* do fallback transactions */
|
/* do fallback transactions */
|
||||||
sharedViewModel.isEmv.setValue(false);
|
sharedViewModel.isEmv.postValue(false);
|
||||||
cardReadViewModel.setCardTransactionType(CardTransactionType.FALLBACK);
|
cardReadViewModel.setCardTransactionType(CardTransactionType.FALLBACK);
|
||||||
|
|
||||||
} else if (cardType == CardTypeX.IC || cardType == CardTypeX.NFC) {
|
} else if (cardType == CardTypeX.IC || cardType == CardTypeX.NFC) {
|
||||||
|
|||||||
@ -244,7 +244,7 @@ public class EmvTransactionFragment extends DataBindingFragment {
|
|||||||
isCardTaped("Please try again",new CardDetectCallback() {
|
isCardTaped("Please try again",new CardDetectCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
sharedViewModel.setIsSeePhone(true);
|
sharedViewModel.setIsSeePhone(false);
|
||||||
navigateToCheckCard();
|
navigateToCheckCard();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -413,6 +413,7 @@ public class EmvParamHelper {
|
|||||||
aidV2.setTransType("FF");
|
aidV2.setTransType("FF");
|
||||||
aidV2.setOnlinePinCap(1);
|
aidV2.setOnlinePinCap(1);
|
||||||
aidV2.setAsi(1);
|
aidV2.setAsi(1);
|
||||||
|
aidV2.setThreshold(99);
|
||||||
|
|
||||||
if (!(contactAid.getCvmLimit() < 0)) {
|
if (!(contactAid.getCvmLimit() < 0)) {
|
||||||
aidV2.setContactlessCvmLimit(contactAid.getCvmLimit());
|
aidV2.setContactlessCvmLimit(contactAid.getCvmLimit());
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import android.os.Looper;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -260,7 +261,8 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
|||||||
unionPayTransDataEntity.setSupportCDCVM(true);
|
unionPayTransDataEntity.setSupportCDCVM(true);
|
||||||
//if support QPS, please enable below lines
|
//if support QPS, please enable below lines
|
||||||
unionPayTransDataEntity.setSupportContactlessQps(true);
|
unionPayTransDataEntity.setSupportContactlessQps(true);
|
||||||
unionPayTransDataEntity.setContactlessQpsLimit("000090000000");
|
unionPayTransDataEntity.setContactlessQpsLimit("000000030000");
|
||||||
|
|
||||||
transData.setUnionPayTransDataEntity(unionPayTransDataEntity);
|
transData.setUnionPayTransDataEntity(unionPayTransDataEntity);
|
||||||
|
|
||||||
|
|
||||||
@ -425,126 +427,49 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
|||||||
initKeyboard(isOnlinePin == 1);
|
initKeyboard(isOnlinePin == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void initKeyboard(boolean isOnlinePin) {
|
private void initKeyboard(boolean isOnlinePin) {
|
||||||
|
|
||||||
LogUtil.d(TAG, "init keyboard!");
|
LogUtil.d(TAG, "init keyboard!");
|
||||||
pinPadVisibility.setValue(0);
|
pinPadVisibility.setValue(0);
|
||||||
LogUtil.d(TAG, "pin pad is visible now!");
|
LogUtil.d(TAG, "pin pad is visible now!");
|
||||||
|
|
||||||
|
// Check if the view is already laid out
|
||||||
|
if (customPinPadKeyboard.getWidth() > 0 && customPinPadKeyboard.getHeight() > 0) {
|
||||||
|
// View already laid out — call setup directly
|
||||||
|
setupPinPadLayout(isOnlinePin);
|
||||||
|
} else {
|
||||||
|
// View not yet laid out — wait for layout
|
||||||
customPinPadKeyboard.getViewTreeObserver().addOnGlobalLayoutListener(
|
customPinPadKeyboard.getViewTreeObserver().addOnGlobalLayoutListener(
|
||||||
new ViewTreeObserver.OnGlobalLayoutListener() {
|
new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
|
if (customPinPadKeyboard.getWidth() > 0 && customPinPadKeyboard.getHeight() > 0) {
|
||||||
customPinPadKeyboard.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
customPinPadKeyboard.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||||
|
setupPinPadLayout(isOnlinePin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupPinPadLayout(boolean isOnlinePin) {
|
||||||
LogUtil.d(TAG, "inside the global layout!");
|
LogUtil.d(TAG, "inside the global layout!");
|
||||||
PinpadLayoutEntity pinpadLayout = new PinpadLayoutEntity();
|
PinpadLayoutEntity pinpadLayout = new PinpadLayoutEntity();
|
||||||
int[] location = new int[2];
|
|
||||||
Rect r;
|
|
||||||
customPinPadKeyboard.getKey_1().getLocationOnScreen(location);
|
|
||||||
r = new Rect();
|
|
||||||
r.left = location[0];
|
|
||||||
r.top = location[1];
|
|
||||||
r.right = customPinPadKeyboard.getKey_1().getWidth() + r.left;
|
|
||||||
r.bottom = customPinPadKeyboard.getKey_1().getHeight() + r.top;
|
|
||||||
pinpadLayout.setKey1(r);
|
|
||||||
|
|
||||||
customPinPadKeyboard.getKey_2().getLocationOnScreen(location);
|
// Helper to avoid repetition
|
||||||
r = new Rect();
|
pinpadLayout.setKey1(getRectForView(customPinPadKeyboard.getKey_1()));
|
||||||
r.left = location[0];
|
pinpadLayout.setKey2(getRectForView(customPinPadKeyboard.getKey_2()));
|
||||||
r.top = location[1];
|
pinpadLayout.setKey3(getRectForView(customPinPadKeyboard.getKey_3()));
|
||||||
r.right = customPinPadKeyboard.getKey_2().getWidth() + r.left;
|
pinpadLayout.setKey4(getRectForView(customPinPadKeyboard.getKey_4()));
|
||||||
r.bottom = customPinPadKeyboard.getKey_2().getHeight() + r.top;
|
pinpadLayout.setKey5(getRectForView(customPinPadKeyboard.getKey_5()));
|
||||||
pinpadLayout.setKey2(r);
|
pinpadLayout.setKey6(getRectForView(customPinPadKeyboard.getKey_6()));
|
||||||
|
pinpadLayout.setKey7(getRectForView(customPinPadKeyboard.getKey_7()));
|
||||||
customPinPadKeyboard.getKey_3().getLocationOnScreen(location);
|
pinpadLayout.setKey8(getRectForView(customPinPadKeyboard.getKey_8()));
|
||||||
r = new Rect();
|
pinpadLayout.setKey9(getRectForView(customPinPadKeyboard.getKey_9()));
|
||||||
r.left = location[0];
|
pinpadLayout.setKey10(getRectForView(customPinPadKeyboard.getKey_0()));
|
||||||
r.top = location[1];
|
pinpadLayout.setKeyCancel(getRectForView(customPinPadKeyboard.getKey_cancel()));
|
||||||
r.right = customPinPadKeyboard.getKey_3().getWidth() + r.left;
|
pinpadLayout.setKeyClear(getRectForView(customPinPadKeyboard.getKey_clear()));
|
||||||
r.bottom = customPinPadKeyboard.getKey_3().getHeight() + r.top;
|
pinpadLayout.setKeyConfirm(getRectForView(customPinPadKeyboard.getKey_ok()));
|
||||||
pinpadLayout.setKey3(r);
|
|
||||||
|
|
||||||
customPinPadKeyboard.getKey_4().getLocationOnScreen(location);
|
|
||||||
r = new Rect();
|
|
||||||
r.left = location[0];
|
|
||||||
r.top = location[1];
|
|
||||||
r.right = customPinPadKeyboard.getKey_4().getWidth() + r.left;
|
|
||||||
r.bottom = customPinPadKeyboard.getKey_4().getHeight() + r.top;
|
|
||||||
pinpadLayout.setKey4(r);
|
|
||||||
|
|
||||||
customPinPadKeyboard.getKey_5().getLocationOnScreen(location);
|
|
||||||
r = new Rect();
|
|
||||||
r.left = location[0];
|
|
||||||
r.top = location[1];
|
|
||||||
r.right = customPinPadKeyboard.getKey_5().getWidth() + r.left;
|
|
||||||
r.bottom = customPinPadKeyboard.getKey_5().getHeight() + r.top;
|
|
||||||
pinpadLayout.setKey5(r);
|
|
||||||
|
|
||||||
customPinPadKeyboard.getKey_6().getLocationOnScreen(location);
|
|
||||||
r = new Rect();
|
|
||||||
r.left = location[0];
|
|
||||||
r.top = location[1];
|
|
||||||
r.right = customPinPadKeyboard.getKey_6().getWidth() + r.left;
|
|
||||||
r.bottom = customPinPadKeyboard.getKey_6().getHeight() + r.top;
|
|
||||||
pinpadLayout.setKey6(r);
|
|
||||||
|
|
||||||
customPinPadKeyboard.getKey_7().getLocationOnScreen(location);
|
|
||||||
r = new Rect();
|
|
||||||
r.left = location[0];
|
|
||||||
r.top = location[1];
|
|
||||||
r.right = customPinPadKeyboard.getKey_7().getWidth() + r.left;
|
|
||||||
r.bottom = customPinPadKeyboard.getKey_7().getHeight() + r.top;
|
|
||||||
pinpadLayout.setKey7(r);
|
|
||||||
|
|
||||||
customPinPadKeyboard.getKey_8().getLocationOnScreen(location);
|
|
||||||
r = new Rect();
|
|
||||||
r.left = location[0];
|
|
||||||
r.top = location[1];
|
|
||||||
r.right = customPinPadKeyboard.getKey_8().getWidth() + r.left;
|
|
||||||
r.bottom = customPinPadKeyboard.getKey_8().getHeight() + r.top;
|
|
||||||
pinpadLayout.setKey8(r);
|
|
||||||
|
|
||||||
customPinPadKeyboard.getKey_9().getLocationOnScreen(location);
|
|
||||||
r = new Rect();
|
|
||||||
r.left = location[0];
|
|
||||||
r.top = location[1];
|
|
||||||
r.right = customPinPadKeyboard.getKey_9().getWidth() + r.left;
|
|
||||||
r.bottom = customPinPadKeyboard.getKey_9().getHeight() + r.top;
|
|
||||||
pinpadLayout.setKey9(r);
|
|
||||||
|
|
||||||
customPinPadKeyboard.getKey_0().getLocationOnScreen(location);
|
|
||||||
r = new Rect();
|
|
||||||
r.left = location[0];
|
|
||||||
r.top = location[1];
|
|
||||||
r.right = customPinPadKeyboard.getKey_0().getWidth() + r.left;
|
|
||||||
r.bottom = customPinPadKeyboard.getKey_0().getHeight() + r.top;
|
|
||||||
pinpadLayout.setKey10(r);
|
|
||||||
|
|
||||||
customPinPadKeyboard.getKey_cancel().getLocationOnScreen(location);
|
|
||||||
r = new Rect();
|
|
||||||
r.left = location[0];
|
|
||||||
r.top = location[1];
|
|
||||||
r.right = customPinPadKeyboard.getKey_cancel().getWidth() + r.left;
|
|
||||||
r.bottom = customPinPadKeyboard.getKey_cancel().getHeight() + r.top;
|
|
||||||
pinpadLayout.setKeyCancel(r);
|
|
||||||
|
|
||||||
customPinPadKeyboard.getKey_clear().getLocationOnScreen(location);
|
|
||||||
r = new Rect();
|
|
||||||
r.left = location[0];
|
|
||||||
r.top = location[1];
|
|
||||||
r.right = customPinPadKeyboard.getKey_clear().getWidth() + r.left;
|
|
||||||
r.bottom = customPinPadKeyboard.getKey_clear().getHeight() + r.top;
|
|
||||||
pinpadLayout.setKeyClear(r);
|
|
||||||
|
|
||||||
customPinPadKeyboard.getKey_ok().getLocationOnScreen(location);
|
|
||||||
r = new Rect();
|
|
||||||
r.left = location[0];
|
|
||||||
r.top = location[1];
|
|
||||||
r.right = customPinPadKeyboard.getKey_ok().getWidth() + r.left;
|
|
||||||
r.bottom = customPinPadKeyboard.getKey_ok().getHeight() + r.top;
|
|
||||||
pinpadLayout.setKeyConfirm(r);
|
|
||||||
|
|
||||||
|
|
||||||
byte[] number = pinPad.setPinpadLayout(pinpadLayout);
|
byte[] number = pinPad.setPinpadLayout(pinpadLayout);
|
||||||
@ -628,10 +553,16 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
// Reusable rect helper
|
||||||
);
|
private Rect getRectForView(View view) {
|
||||||
|
int[] location = new int[2];
|
||||||
|
view.getLocationOnScreen(location);
|
||||||
|
Rect r = new Rect();
|
||||||
|
r.left = location[0];
|
||||||
|
r.top = location[1];
|
||||||
|
r.right = view.getWidth() + r.left;
|
||||||
|
r.bottom = view.getHeight() + r.top;
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void increaseCount() {
|
private void increaseCount() {
|
||||||
@ -676,11 +607,11 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//contact terminal capability ; if different card brand(depend on aid) have different terminal capability
|
//contact terminal capability ; if different card brand(depend on aid) have different terminal capability
|
||||||
if (ByteUtils.byteArray2HexString(aid).toUpperCase().contains("A000000004")) {
|
// if (ByteUtils.byteArray2HexString(aid).toUpperCase().contains("A000000004")) {
|
||||||
emvHandler.setTlv(new byte[]{(byte) 0x9F, (byte) 0x33}, ByteUtil.hexStr2Bytes(terminalCapability));
|
// emvHandler.setTlv(new byte[]{(byte) 0x9F, (byte) 0x33}, ByteUtil.hexStr2Bytes(terminalCapability));
|
||||||
emvHandler.setTlv(new byte[]{(byte) 0xE0, (byte) 0x1D}, ByteUtils.hexString2ByteArray("6C00800000000000"));//terminal risk
|
// emvHandler.setTlv(new byte[]{(byte) 0xE0, (byte) 0x1D}, ByteUtils.hexString2ByteArray("6C00800000000000"));//terminal risk
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
emvHandler.onSetTransInitBeforeGPOResponse(true);
|
emvHandler.onSetTransInitBeforeGPOResponse(true);
|
||||||
@ -743,9 +674,14 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
|||||||
@Override
|
@Override
|
||||||
public void onPrompt(PromptEnum promptEnum) {
|
public void onPrompt(PromptEnum promptEnum) {
|
||||||
LogUtil.d(TAG, "onPrompt->" + promptEnum);
|
LogUtil.d(TAG, "onPrompt->" + promptEnum);
|
||||||
|
if( promptEnum == PromptEnum.OFFLINE_PIN_INCORRECT_TRY_AGAIN) {
|
||||||
|
emvHandler.onSetPromptResponse(false);
|
||||||
|
} else {
|
||||||
emvHandler.onSetPromptResponse(true);
|
emvHandler.onSetPromptResponse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemoveCard() {
|
public void onRemoveCard() {
|
||||||
LogUtil.d(TAG, "onRemoveCard");
|
LogUtil.d(TAG, "onRemoveCard");
|
||||||
|
|||||||
@ -341,7 +341,8 @@ public class FieldUtils {
|
|||||||
} else if (BaseCardType.IC.getValue() == cardType) { // IC
|
} else if (BaseCardType.IC.getValue() == cardType) { // IC
|
||||||
value = "05";
|
value = "05";
|
||||||
} else if (FALLBACK == cardType){ // Fallback
|
} else if (FALLBACK == cardType){ // Fallback
|
||||||
value = "08";
|
value = "72";
|
||||||
|
// value = "08";
|
||||||
} else { // Hand-in card number
|
} else { // Hand-in card number
|
||||||
value = "01";
|
value = "01";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user