Update InjectKeyFragment.java
This commit is contained in:
parent
3cb8fe218e
commit
4f28f7a118
@ -37,6 +37,7 @@ public class InjectKeyFragment extends DataBindingFragment {
|
|||||||
private DownloadFlow mDownloadFlow;
|
private DownloadFlow mDownloadFlow;
|
||||||
private int keyIndexTmp = 8; // Default key index
|
private int keyIndexTmp = 8; // Default key index
|
||||||
private final List<HostSelectionItem> hostSelectionItems = new ArrayList<>();
|
private final List<HostSelectionItem> hostSelectionItems = new ArrayList<>();
|
||||||
|
private HostSelectionItem selectedHostSelectionItem;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initViewModel() {
|
protected void initViewModel() {
|
||||||
@ -128,6 +129,7 @@ public class InjectKeyFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void applyHostSelection(@NonNull HostSelectionItem selectionItem) {
|
private void applyHostSelection(@NonNull HostSelectionItem selectionItem) {
|
||||||
|
selectedHostSelectionItem = selectionItem;
|
||||||
binding.terminalIdValue.setText(getDisplayValue(selectionItem.terminalId));
|
binding.terminalIdValue.setText(getDisplayValue(selectionItem.terminalId));
|
||||||
binding.merchantIdValue.setText(getDisplayValue(selectionItem.merchantId));
|
binding.merchantIdValue.setText(getDisplayValue(selectionItem.merchantId));
|
||||||
}
|
}
|
||||||
@ -156,14 +158,14 @@ public class InjectKeyFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
mDownloadFlow = DownloadFlow.getInstance();
|
mDownloadFlow = DownloadFlow.getInstance();
|
||||||
|
|
||||||
String terminalId = SystemParamsOperation.getInstance().getTerminalId();
|
String terminalId = selectedHostSelectionItem != null ? selectedHostSelectionItem.terminalId : null;
|
||||||
String merchantId = SystemParamsOperation.getInstance().getMerchantId();
|
String merchantId = selectedHostSelectionItem != null ? selectedHostSelectionItem.merchantId : null;
|
||||||
String serialNo = TMSUtil.getInstance().getSerialNumber();
|
String serialNo = TMSUtil.getInstance().getSerialNumber();
|
||||||
|
|
||||||
// Validate configuration
|
// Validate configuration
|
||||||
if (TextUtils.isEmpty(terminalId) || TextUtils.isEmpty(merchantId) || TextUtils.isEmpty(serialNo)) {
|
if (TextUtils.isEmpty(terminalId) || TextUtils.isEmpty(merchantId) || TextUtils.isEmpty(serialNo)) {
|
||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
showDeclineDialog("Please configure Terminal ID, Merchant ID first in TMS Configuration");
|
showDeclineDialog("Please configure the selected Terminal ID and Merchant ID first in TMS Configuration");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user