qr_partial_enable/disable fixed
This commit is contained in:
parent
4d5124fc64
commit
0d796ab20f
@ -58,6 +58,7 @@ public class MainViewModel extends ViewModel {
|
|||||||
|
|
||||||
public MutableLiveData<Boolean> kPayStatus = new MutableLiveData<>();
|
public MutableLiveData<Boolean> kPayStatus = new MutableLiveData<>();
|
||||||
|
|
||||||
|
|
||||||
public SingleLiveEvent<String> disabledMsg = new SingleLiveEvent<>();
|
public SingleLiveEvent<String> disabledMsg = new SingleLiveEvent<>();
|
||||||
|
|
||||||
public SingleLiveEvent<List<PayDetail>> settlementPOS = new SingleLiveEvent<>();
|
public SingleLiveEvent<List<PayDetail>> settlementPOS = new SingleLiveEvent<>();
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import androidx.navigation.Navigation;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.stream.MalformedJsonException;
|
import com.google.gson.stream.MalformedJsonException;
|
||||||
|
import com.utsmm.kbz.config.Constants;
|
||||||
import com.utsmyanmar.baselib.emv.EmvParamOperation;
|
import com.utsmyanmar.baselib.emv.EmvParamOperation;
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
import com.utsmyanmar.baselib.network.model.sirius.SiriusError;
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusError;
|
||||||
@ -50,6 +51,7 @@ public class SettingsFragment extends DataBindingFragment {
|
|||||||
private MainViewModel mainViewModel;
|
private MainViewModel mainViewModel;
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
|
|
||||||
// Data binding will handle view access automatically
|
// Data binding will handle view access automatically
|
||||||
private FragmentSettingsModernBinding binding;
|
private FragmentSettingsModernBinding binding;
|
||||||
|
|
||||||
@ -182,6 +184,12 @@ public class SettingsFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
// ClickEvent class for data binding - this is the proper pattern
|
// ClickEvent class for data binding - this is the proper pattern
|
||||||
public class ClickEvent {
|
public class ClickEvent {
|
||||||
|
public void onHostConfigClick(){
|
||||||
|
int routeId = R.id.action_nav_settings_to_hostConfigFragment;
|
||||||
|
int currentId = R.id.nav_settings;
|
||||||
|
int hostId = Constants.NAV_HOST_ID;
|
||||||
|
safeRouteTo(currentId, routeId, hostId);
|
||||||
|
}
|
||||||
|
|
||||||
public void onVersionClick() {
|
public void onVersionClick() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -67,10 +67,7 @@ public class KPayViewModel extends ViewModel {
|
|||||||
private static final String NONCE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
private static final String NONCE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
private static final int NONCE_LENGTH = 32;
|
private static final int NONCE_LENGTH = 32;
|
||||||
private final SecureRandom secureRandom = new SecureRandom();
|
private final SecureRandom secureRandom = new SecureRandom();
|
||||||
|
public MutableLiveData<Boolean> partialRefundEnabled = new MutableLiveData<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String generateRandomTwoChars() {
|
private String generateRandomTwoChars() {
|
||||||
// You can reuse the existing character set and SecureRandom instance
|
// You can reuse the existing character set and SecureRandom instance
|
||||||
@ -293,6 +290,9 @@ public class KPayViewModel extends ViewModel {
|
|||||||
@Inject
|
@Inject
|
||||||
public KPayViewModel(Repository repository) {
|
public KPayViewModel(Repository repository) {
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
|
|
||||||
|
boolean enabled = SystemParamsOperation.getInstance().isQrPartialRefundEnable();
|
||||||
|
partialRefundEnabled.setValue(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TradeData tradeData;
|
private TradeData tradeData;
|
||||||
|
|||||||
@ -219,120 +219,6 @@ public class NaviMainFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
return grayLevelEnum;
|
return grayLevelEnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClickPrintConfig() {
|
|
||||||
|
|
||||||
DeviceEngine deviceEngine = APIProxy.getDeviceEngine(requireContext());
|
|
||||||
Printer printer = deviceEngine.getPrinter();
|
|
||||||
DeviceInfo deviceInfo = deviceEngine.getDeviceInfo();
|
|
||||||
|
|
||||||
int FONT_NORMAL = 24;
|
|
||||||
int FONT_HEADER = 32;
|
|
||||||
|
|
||||||
int status = printer.getStatus();
|
|
||||||
if (status != SdkResult.Success) {
|
|
||||||
Log.d("Printer", "Printer error: " + status);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SystemParamsOperation sp = SystemParamsOperation.getInstance();
|
|
||||||
|
|
||||||
String addr1 = sp.getMerchantAddress();
|
|
||||||
String addr2 = sp.getMerchantAddress2();
|
|
||||||
String phone = sp.getMerchantPhoneNo();
|
|
||||||
if (addr2 == null) addr2 = "";
|
|
||||||
if (phone == null || phone.trim().isEmpty()) phone = "";
|
|
||||||
|
|
||||||
printer.setGray(getGrayLevel());
|
|
||||||
|
|
||||||
// ================== Header ==================
|
|
||||||
printer.appendPrnStr("==== Device Configs ====", FONT_HEADER, AlignEnum.CENTER, true);
|
|
||||||
printer.appendPrnStr(" ", FONT_NORMAL, AlignEnum.CENTER, false);
|
|
||||||
|
|
||||||
if(!TextUtils.isEmpty(addr1))
|
|
||||||
printer.appendPrnStr(addr1, FONT_NORMAL, AlignEnum.CENTER, true);
|
|
||||||
if(!TextUtils.isEmpty(addr2))
|
|
||||||
printer.appendPrnStr(addr2, FONT_NORMAL, AlignEnum.CENTER, true);
|
|
||||||
if(!TextUtils.isEmpty(phone))
|
|
||||||
printer.appendPrnStr(phone, FONT_NORMAL, AlignEnum.CENTER, true);
|
|
||||||
|
|
||||||
printer.appendPrnStr(" ", FONT_NORMAL, AlignEnum.CENTER, false);
|
|
||||||
|
|
||||||
|
|
||||||
// ================== Device Info ==================
|
|
||||||
printer.appendPrnStr("Device S/N", deviceInfo.getSn(), FONT_NORMAL, true);
|
|
||||||
printer.appendPrnStr(" ", FONT_NORMAL, AlignEnum.CENTER, false);
|
|
||||||
|
|
||||||
|
|
||||||
// ================== Host Section ==================
|
|
||||||
printer.appendPrnStr("HOSTS", FONT_HEADER, AlignEnum.LEFT, true);
|
|
||||||
printer.appendPrnStr(" ", FONT_NORMAL, AlignEnum.CENTER, false);
|
|
||||||
|
|
||||||
// ---- Primary Host ----
|
|
||||||
printer.appendPrnStr("Name :", sp.getHostName(), FONT_NORMAL, false);
|
|
||||||
printTwoColWrapped(printer, "IP :", sp.getIpAddress(), FONT_NORMAL, false);
|
|
||||||
printTwoColWrapped(printer, "Sec IP :", sp.getSecIpAddress(), FONT_NORMAL, false);
|
|
||||||
printer.appendPrnStr("MID :", sp.getMerchantId(), FONT_NORMAL, false);
|
|
||||||
printer.appendPrnStr("TID :", sp.getTerminalId(), FONT_NORMAL, false);
|
|
||||||
|
|
||||||
printer.appendPrnStr("--------------------------------", FONT_NORMAL, AlignEnum.LEFT, false);
|
|
||||||
|
|
||||||
// ---- Secondary Host ----
|
|
||||||
if (!TextUtils.isEmpty(sp.getSecHostName())) {
|
|
||||||
|
|
||||||
printer.appendPrnStr("Name :", sp.getSecHostName(), FONT_NORMAL, false);
|
|
||||||
printTwoColWrapped(printer, "IP :", sp.getSecHostIpAddress(), FONT_NORMAL, false);
|
|
||||||
printTwoColWrapped(printer, "Sec IP :", sp.getSecHostSecIpAddress(), FONT_NORMAL, false);
|
|
||||||
printer.appendPrnStr("MID :", sp.getSecHostMerchantId(), FONT_NORMAL, false);
|
|
||||||
printer.appendPrnStr("TID :", sp.getSecHostTerminalId(), FONT_NORMAL, false);
|
|
||||||
|
|
||||||
printer.appendPrnStr("--------------------------------", FONT_NORMAL, AlignEnum.LEFT, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================== Start Printing ==================
|
|
||||||
printer.startPrint(true, ret -> {
|
|
||||||
if(ret == SdkResult.Success){
|
|
||||||
Log.d("Printer", "Print success");
|
|
||||||
} else {
|
|
||||||
Log.d("Printer", "Print failed: " + ret);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void printTwoColWrapped(Printer p, String left, String right, int font, Boolean isBold) {
|
|
||||||
|
|
||||||
if (right == null) right = "";
|
|
||||||
|
|
||||||
int maxRight = 24; // recommended width for right column
|
|
||||||
|
|
||||||
// If right text fits → print normally
|
|
||||||
if (right.length() <= maxRight) {
|
|
||||||
p.appendPrnStr(left, right, font, isBold);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise wrap it
|
|
||||||
int start = 0;
|
|
||||||
boolean firstLine = true;
|
|
||||||
|
|
||||||
while (start < right.length()) {
|
|
||||||
int end = Math.min(start + maxRight, right.length());
|
|
||||||
String part = right.substring(start, end);
|
|
||||||
|
|
||||||
if (firstLine) {
|
|
||||||
p.appendPrnStr(left, part, font, isBold);
|
|
||||||
firstLine = false;
|
|
||||||
} else {
|
|
||||||
// subsequent lines: blank left column
|
|
||||||
p.appendPrnStr(" ", part, font, isBold);
|
|
||||||
}
|
|
||||||
|
|
||||||
start += maxRight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void onClickVersion(){
|
public void onClickVersion(){
|
||||||
mListener.onClickVersion();
|
mListener.onClickVersion();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,46 @@
|
|||||||
|
package com.utsmm.kbz.ui.settings;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.utsmm.kbz.databinding.ItemHostConfigBinding;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class HostConfigAdapter extends RecyclerView.Adapter<HostConfigAdapter.Holder> {
|
||||||
|
private List<HostConfigItem> list = new ArrayList<>();
|
||||||
|
|
||||||
|
public void setList(List<HostConfigItem> newList){
|
||||||
|
this.list = newList;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public HostConfigAdapter.Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
ItemHostConfigBinding binding = ItemHostConfigBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new Holder(binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull HostConfigAdapter.Holder holder, int position) {
|
||||||
|
holder.binding.setItem(list.get(position));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Holder extends RecyclerView.ViewHolder {
|
||||||
|
ItemHostConfigBinding binding;
|
||||||
|
Holder(ItemHostConfigBinding bind){
|
||||||
|
super(bind.getRoot());
|
||||||
|
binding = bind;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,197 @@
|
|||||||
|
package com.utsmm.kbz.ui.settings;
|
||||||
|
|
||||||
|
import static androidx.databinding.DataBindingUtil.getBinding;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.nexgo.oaf.apiv3.APIProxy;
|
||||||
|
import com.nexgo.oaf.apiv3.DeviceEngine;
|
||||||
|
import com.nexgo.oaf.apiv3.DeviceInfo;
|
||||||
|
import com.nexgo.oaf.apiv3.SdkResult;
|
||||||
|
import com.nexgo.oaf.apiv3.device.printer.AlignEnum;
|
||||||
|
import com.nexgo.oaf.apiv3.device.printer.Printer;
|
||||||
|
import com.utsmm.kbz.BR;
|
||||||
|
import com.utsmm.kbz.R;
|
||||||
|
import com.utsmm.kbz.config.Constants;
|
||||||
|
import com.utsmm.kbz.databinding.FragmentHostConfigBinding;
|
||||||
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
|
||||||
|
public class HostConfigFragment extends DataBindingFragment {
|
||||||
|
|
||||||
|
private HostConfigViewModel viewModel;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initViewModel() {
|
||||||
|
viewModel = new ViewModelProvider(this).get(HostConfigViewModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DataBindingConfig getDataBindingConfig() {
|
||||||
|
return new DataBindingConfig(R.layout.fragment_host_config, BR.viewModel, viewModel)
|
||||||
|
.addBindingParam(BR.click, new ClickHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState){
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
FragmentHostConfigBinding binding = (FragmentHostConfigBinding) this.binding;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume(){
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
setToolBarTitleWithBackIcon("Host Configs");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int currentId() {
|
||||||
|
return R.id.hostConfigFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int hostId() {
|
||||||
|
return Constants.NAV_HOST_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int routeId() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ClickHandler {
|
||||||
|
public void onCancel(){
|
||||||
|
safePopBack(R.id.hostConfigFragment, Constants.NAV_HOST_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPrint(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//public void onClickPrintConfig() {
|
||||||
|
//
|
||||||
|
// DeviceEngine deviceEngine = APIProxy.getDeviceEngine(requireContext());
|
||||||
|
// Printer printer = deviceEngine.getPrinter();
|
||||||
|
// DeviceInfo deviceInfo = deviceEngine.getDeviceInfo();
|
||||||
|
//
|
||||||
|
// int FONT_NORMAL = 24;
|
||||||
|
// int FONT_HEADER = 32;
|
||||||
|
//
|
||||||
|
// int status = printer.getStatus();
|
||||||
|
// if (status != SdkResult.Success) {
|
||||||
|
// Log.d("Printer", "Printer error: " + status);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// SystemParamsOperation sp = SystemParamsOperation.getInstance();
|
||||||
|
//
|
||||||
|
// String addr1 = sp.getMerchantAddress();
|
||||||
|
// String addr2 = sp.getMerchantAddress2();
|
||||||
|
// String phone = sp.getMerchantPhoneNo();
|
||||||
|
// if (addr2 == null) addr2 = "";
|
||||||
|
// if (phone == null || phone.trim().isEmpty()) phone = "";
|
||||||
|
//
|
||||||
|
// printer.setGray(getGrayLevel());
|
||||||
|
//
|
||||||
|
// // ================== Header ==================
|
||||||
|
// printer.appendPrnStr("==== Device Configs ====", FONT_HEADER, AlignEnum.CENTER, true);
|
||||||
|
// printer.appendPrnStr(" ", FONT_NORMAL, AlignEnum.CENTER, false);
|
||||||
|
//
|
||||||
|
// if(!TextUtils.isEmpty(addr1))
|
||||||
|
// printer.appendPrnStr(addr1, FONT_NORMAL, AlignEnum.CENTER, true);
|
||||||
|
// if(!TextUtils.isEmpty(addr2))
|
||||||
|
// printer.appendPrnStr(addr2, FONT_NORMAL, AlignEnum.CENTER, true);
|
||||||
|
// if(!TextUtils.isEmpty(phone))
|
||||||
|
// printer.appendPrnStr(phone, FONT_NORMAL, AlignEnum.CENTER, true);
|
||||||
|
//
|
||||||
|
// printer.appendPrnStr(" ", FONT_NORMAL, AlignEnum.CENTER, false);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // ================== Device Info ==================
|
||||||
|
// printer.appendPrnStr("Device S/N", deviceInfo.getSn(), FONT_NORMAL, true);
|
||||||
|
// printer.appendPrnStr(" ", FONT_NORMAL, AlignEnum.CENTER, false);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // ================== Host Section ==================
|
||||||
|
// printer.appendPrnStr("HOSTS", FONT_HEADER, AlignEnum.LEFT, true);
|
||||||
|
// printer.appendPrnStr(" ", FONT_NORMAL, AlignEnum.CENTER, false);
|
||||||
|
//
|
||||||
|
// // ---- Primary Host ----
|
||||||
|
// printer.appendPrnStr("Name :", sp.getHostName(), FONT_NORMAL, false);
|
||||||
|
// printTwoColWrapped(printer, "IP :", sp.getIpAddress(), FONT_NORMAL, false);
|
||||||
|
// printTwoColWrapped(printer, "Sec IP :", sp.getSecIpAddress(), FONT_NORMAL, false);
|
||||||
|
// printer.appendPrnStr("MID :", sp.getMerchantId(), FONT_NORMAL, false);
|
||||||
|
// printer.appendPrnStr("TID :", sp.getTerminalId(), FONT_NORMAL, false);
|
||||||
|
//
|
||||||
|
// printer.appendPrnStr("--------------------------------", FONT_NORMAL, AlignEnum.LEFT, false);
|
||||||
|
//
|
||||||
|
// // ---- Secondary Host ----
|
||||||
|
// if (!TextUtils.isEmpty(sp.getSecHostName())) {
|
||||||
|
//
|
||||||
|
// printer.appendPrnStr("Name :", sp.getSecHostName(), FONT_NORMAL, false);
|
||||||
|
// printTwoColWrapped(printer, "IP :", sp.getSecHostIpAddress(), FONT_NORMAL, false);
|
||||||
|
// printTwoColWrapped(printer, "Sec IP :", sp.getSecHostSecIpAddress(), FONT_NORMAL, false);
|
||||||
|
// printer.appendPrnStr("MID :", sp.getSecHostMerchantId(), FONT_NORMAL, false);
|
||||||
|
// printer.appendPrnStr("TID :", sp.getSecHostTerminalId(), FONT_NORMAL, false);
|
||||||
|
//
|
||||||
|
// printer.appendPrnStr("--------------------------------", FONT_NORMAL, AlignEnum.LEFT, false);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // ================== Start Printing ==================
|
||||||
|
// printer.startPrint(true, ret -> {
|
||||||
|
// if(ret == SdkResult.Success){
|
||||||
|
// Log.d("Printer", "Print success");
|
||||||
|
// } else {
|
||||||
|
// Log.d("Printer", "Print failed: " + ret);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//private void printTwoColWrapped(Printer p, String left, String right, int font, Boolean isBold) {
|
||||||
|
//
|
||||||
|
// if (right == null) right = "";
|
||||||
|
//
|
||||||
|
// int maxRight = 24; // recommended width for right column
|
||||||
|
//
|
||||||
|
// // If right text fits → print normally
|
||||||
|
// if (right.length() <= maxRight) {
|
||||||
|
// p.appendPrnStr(left, right, font, isBold);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Otherwise wrap it
|
||||||
|
// int start = 0;
|
||||||
|
// boolean firstLine = true;
|
||||||
|
//
|
||||||
|
// while (start < right.length()) {
|
||||||
|
// int end = Math.min(start + maxRight, right.length());
|
||||||
|
// String part = right.substring(start, end);
|
||||||
|
//
|
||||||
|
// if (firstLine) {
|
||||||
|
// p.appendPrnStr(left, part, font, isBold);
|
||||||
|
// firstLine = false;
|
||||||
|
// } else {
|
||||||
|
// // subsequent lines: blank left column
|
||||||
|
// p.appendPrnStr(" ", part, font, isBold);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// start += maxRight;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.utsmm.kbz.ui.settings;
|
||||||
|
|
||||||
|
public class HostConfigItem {
|
||||||
|
public String name;
|
||||||
|
public String ip;
|
||||||
|
public String mid;
|
||||||
|
public String tid;
|
||||||
|
public String secHostName;
|
||||||
|
public String secHostIp;
|
||||||
|
public String secHostMid;
|
||||||
|
public String secHostTid;
|
||||||
|
|
||||||
|
public HostConfigItem(
|
||||||
|
String name,
|
||||||
|
String ip,
|
||||||
|
String mid,
|
||||||
|
String tid,
|
||||||
|
String secHostName,
|
||||||
|
String secHostIp,
|
||||||
|
String secHostMid,
|
||||||
|
String secHostTid
|
||||||
|
){
|
||||||
|
this.name = name;
|
||||||
|
this.ip = ip;
|
||||||
|
this.mid = mid;
|
||||||
|
this.tid = tid;
|
||||||
|
this.secHostName = secHostName;
|
||||||
|
this.secHostIp = secHostIp;
|
||||||
|
this.secHostMid = secHostMid;
|
||||||
|
this.secHostTid = secHostTid;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.utsmm.kbz.ui.settings;
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
|
||||||
|
public class HostConfigViewModel extends ViewModel {
|
||||||
|
|
||||||
|
public String merchantAddress1;
|
||||||
|
public String merchantAddress2;
|
||||||
|
public String merchantPhoneNumber;
|
||||||
|
public String merchantName;
|
||||||
|
public String merchantPhone;
|
||||||
|
|
||||||
|
public HostConfigViewModel(){
|
||||||
|
SystemParamsOperation sp = SystemParamsOperation.getInstance();
|
||||||
|
merchantAddress1 = sp.getMerchantAddress();
|
||||||
|
merchantAddress2 = sp.getMerchantAddress2();
|
||||||
|
merchantPhoneNumber = sp.getMerchantPhoneNo();
|
||||||
|
merchantName = sp.getMerchantName();
|
||||||
|
merchantPhone = sp.getMerchantPhoneNo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String saftString(String s){
|
||||||
|
return s == null ? "" : s;
|
||||||
|
}
|
||||||
|
}
|
||||||
124
app/src/main/res/layout/fragment_host_config.xml
Normal file
124
app/src/main/res/layout/fragment_host_config.xml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:bind="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<import type="android.view.View"/>
|
||||||
|
<variable
|
||||||
|
name="viewModel"
|
||||||
|
type="com.utsmm.kbz.ui.settings.HostConfigViewModel" />
|
||||||
|
<variable
|
||||||
|
name="click"
|
||||||
|
type="com.utsmm.kbz.ui.settings.HostConfigFragment.ClickHandler" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<!-- CARD SECTION -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/hostCard"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="0dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/actionButtons"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/bg_edittext_primary_border"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:scrollbars="none">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="TERMINAL CONFIGURATION"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="TERMINAL CONFIGURATION"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="Merchant Name"
|
||||||
|
android:text='@{viewModel.merchantName}'
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="Phone"
|
||||||
|
android:text='@{viewModel.merchantPhone}'
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="Address1"
|
||||||
|
android:text="@{viewModel.merchantAddress1}"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="Address2"
|
||||||
|
android:text="@{viewModel.merchantAddress2}"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ACTION BUTTONS -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/actionButtons"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="52dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:text="Cancel"
|
||||||
|
android:onClick="@{()-> click.onCancel()}"
|
||||||
|
android:background="@drawable/bg_rounded_btn_cancel_cv"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textStyle="bold"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="52dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:text="Print"
|
||||||
|
android:onClick="@{()-> click.onPrint()}"
|
||||||
|
android:background="@drawable/bg_rounded_btn_cv"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textStyle="bold"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</layout>
|
||||||
@ -69,6 +69,8 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Partial Amount"
|
android:text="Partial Amount"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
|
android:visibility="@{kPayViewModel.partialRefundEnabled ? View.VISIBLE : View.GONE}"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|||||||
@ -234,6 +234,81 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
<!-- Host Config -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/hostConfigCard"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:onClick="@{()->click.onHostConfigClick()}"
|
||||||
|
app:cardBackgroundColor="@color/white"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="2dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="20dp">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
app:cardBackgroundColor="@color/colorPrimary"
|
||||||
|
app:cardCornerRadius="24dp"
|
||||||
|
app:cardElevation="0dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/ic_device_info"
|
||||||
|
app:tint="@color/white" />
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:text="Hosts Config"
|
||||||
|
android:textColor="@color/colorTextTitle"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/hostConfigSummary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:fontFamily="@font/rubik_regular"
|
||||||
|
android:text="Detail for binded hosts configs"
|
||||||
|
android:textColor="@color/colorTextContent"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:fontFamily="sans-serif" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:src="@drawable/ic_right_arrow"
|
||||||
|
app:tint="@color/colorPrimary" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
38
app/src/main/res/layout/item_host_config.xml
Normal file
38
app/src/main/res/layout/item_host_config.xml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<data>
|
||||||
|
<variable name="item" type="com.utsmm.kbz.ui.settings.HostConfigItem"/>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="12dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text="@{item.name}"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text='@{"IP: " + item.ip}'
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text='@{"MID: " + item.mid}'
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text='@{"TID: " + item.tid}'
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</layout>
|
||||||
@ -377,81 +377,6 @@
|
|||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
tools:fontFamily="sans-serif-medium" />
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
<!-- Print Config Card -->
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:id="@+id/print_config"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="12dp"
|
|
||||||
android:clickable="true"
|
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
|
||||||
android:onClick="@{()->click.onClickPrintConfig()}"
|
|
||||||
app:cardBackgroundColor="@color/white"
|
|
||||||
app:cardCornerRadius="16dp"
|
|
||||||
app:cardElevation="2dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="20dp">
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:layout_width="48dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
app:cardBackgroundColor="@color/colorPrimary"
|
|
||||||
app:cardCornerRadius="24dp"
|
|
||||||
app:cardElevation="0dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="24dp"
|
|
||||||
android:layout_height="24dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:src="@drawable/ic_config"
|
|
||||||
app:tint="@color/white" />
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:fontFamily="@font/rubik_medium"
|
|
||||||
android:text="Print Config"
|
|
||||||
android:textColor="@color/colorTextTitle"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
tools:fontFamily="sans-serif-medium" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="2dp"
|
|
||||||
android:fontFamily="@font/rubik_regular"
|
|
||||||
android:text="Print device configs"
|
|
||||||
android:textColor="@color/colorTextContent"
|
|
||||||
android:textSize="14sp"
|
|
||||||
tools:fontFamily="sans-serif" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="20dp"
|
|
||||||
android:layout_height="20dp"
|
|
||||||
android:src="@drawable/ic_right_arrow"
|
|
||||||
app:tint="@color/colorPrimary" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<!-- Function Card -->
|
<!-- Function Card -->
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/tv_function"
|
android:id="@+id/tv_function"
|
||||||
|
|||||||
@ -62,8 +62,17 @@
|
|||||||
<action
|
<action
|
||||||
android:id="@+id/action_nav_settings_to_deleteKeyFragment"
|
android:id="@+id/action_nav_settings_to_deleteKeyFragment"
|
||||||
app:destination="@id/deleteKeyFragment" />
|
app:destination="@id/deleteKeyFragment" />
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_nav_settings_to_hostConfigFragment"
|
||||||
|
app:destination="@id/hostConfigFragment"/>
|
||||||
|
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/hostConfigFragment"
|
||||||
|
android:name="com.utsmm.kbz.ui.settings.HostConfigFragment"
|
||||||
|
/>
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
tools:layout="@layout/fragment_trans_result_screen"
|
tools:layout="@layout/fragment_trans_result_screen"
|
||||||
android:id="@+id/transactionResultFragment"
|
android:id="@+id/transactionResultFragment"
|
||||||
|
|||||||
@ -444,7 +444,7 @@
|
|||||||
<string name="txt_disconnect">Disconnect</string>
|
<string name="txt_disconnect">Disconnect</string>
|
||||||
<string name="txt_sending_third_reversal">Trying reversal last time!</string>
|
<string name="txt_sending_third_reversal">Trying reversal last time!</string>
|
||||||
<string name="txt_trans_voided">Transaction Voided</string>
|
<string name="txt_trans_voided">Transaction Voided</string>
|
||||||
<!-- <string name="txt_void_not_found">Void Failed,01- No Transaction Details Found</string>-->
|
<!-- <string name="txt_void_not_found">Void Failed,01- No Transaction Details Found</string>-->
|
||||||
<string name="txt_void_not_found">Void Failed 914-ORIGINAL TRANSACTION NOT FOUND</string>
|
<string name="txt_void_not_found">Void Failed 914-ORIGINAL TRANSACTION NOT FOUND</string>
|
||||||
<string name="txt_qr_generate_failed">QR Generation Failed!</string>
|
<string name="txt_qr_generate_failed">QR Generation Failed!</string>
|
||||||
<string name="txt_qr_auth_failed">Auth Failed!</string>
|
<string name="txt_qr_auth_failed">Auth Failed!</string>
|
||||||
@ -598,5 +598,7 @@
|
|||||||
<item>PhaYaSa</item>
|
<item>PhaYaSa</item>
|
||||||
<item>YaTaNa</item>
|
<item>YaTaNa</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<!-- TODO: Remove or change this placeholder text -->
|
||||||
|
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@ -285,8 +285,8 @@ public class NetworkModule {
|
|||||||
tmsAddress = getTMSUrlFromNative();
|
tmsAddress = getTMSUrlFromNative();
|
||||||
}
|
}
|
||||||
|
|
||||||
String baseUrl = tmsAddress.trim() + "/api/v1/";
|
// String baseUrl = tmsAddress.trim() + "/api/v1/";
|
||||||
// String baseUrl = tmsAddress.trim() + "/";
|
String baseUrl = tmsAddress.trim() + "/";
|
||||||
|
|
||||||
final Gson gson =
|
final Gson gson =
|
||||||
new GsonBuilder().create();
|
new GsonBuilder().create();
|
||||||
@ -397,8 +397,8 @@ public class NetworkModule {
|
|||||||
OkHttpClient client = new OkHttpClient.Builder()
|
OkHttpClient client = new OkHttpClient.Builder()
|
||||||
.addInterceptor(interceptor)
|
.addInterceptor(interceptor)
|
||||||
.build();
|
.build();
|
||||||
String baseUrl = "http://receipt-nest.utsmyanmar.com/";
|
// String baseUrl = "http://receipt-nest.utsmyanmar.com/";
|
||||||
// String baseUrl = "https://api-tms-uat.kbzbank.com:8443/receipt/";
|
String baseUrl = "https://api-tms-uat.kbzbank.com:8443/receipt/";
|
||||||
|
|
||||||
return new Retrofit.Builder()
|
return new Retrofit.Builder()
|
||||||
.baseUrl(baseUrl)
|
.baseUrl(baseUrl)
|
||||||
|
|||||||
@ -42,8 +42,8 @@ public class SystemParamsSettings implements Serializable {
|
|||||||
|
|
||||||
// private String tmsAddress = "https://tms.smile-mm.com";
|
// private String tmsAddress = "https://tms.smile-mm.com";
|
||||||
// private String tmsAddress = "http://128.199.170.203";
|
// private String tmsAddress = "http://128.199.170.203";
|
||||||
private String tmsAddress = "http://sirius-nest.utsmyanmar.com";
|
// private String tmsAddress = "http://sirius-nest.utsmyanmar.com";
|
||||||
// private String tmsAddress = "https://api-tms-uat.kbzbank.com:8443/sirius";
|
private String tmsAddress = "https://api-tms-uat.kbzbank.com:8443/sirius";
|
||||||
private String ereceiptAddress = "http://receipt-nest.utsmyanmar.com";
|
private String ereceiptAddress = "http://receipt-nest.utsmyanmar.com";
|
||||||
|
|
||||||
private String terminalCapability = "E0E8C8";
|
private String terminalCapability = "E0E8C8";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user