This commit is contained in:
MooN 2026-02-23 23:16:06 +06:30
parent 999b26de2b
commit e4bb3df554
8 changed files with 466 additions and 177 deletions

View File

@ -149,7 +149,7 @@ public class HostConfigFragment extends DataBindingFragment {
float offScreenDistance = cardTop + cardHeight + 80f;
rollUpAnimator = ObjectAnimator.ofFloat(hostCardView, View.TRANSLATION_Y, 0f, -offScreenDistance);
rollUpAnimator.setDuration(2500);
rollUpAnimator.setDuration(3000);
rollUpAnimator.setInterpolator(new LinearInterpolator());
rollUpAnimator.setRepeatMode(ValueAnimator.RESTART);
rollUpAnimator.setRepeatCount(ValueAnimator.INFINITE);

View File

@ -40,6 +40,16 @@ public class HostConfigViewModel extends ViewModel {
public MutableLiveData<String> secHostPrimaryPort = new MutableLiveData<>();
public MutableLiveData<String> secHostSecondaryIp = new MutableLiveData<>();
public MutableLiveData<String> secHostSecondaryPort = new MutableLiveData<>();
public MutableLiveData<String> secHostCurrency = new MutableLiveData<>();
// Third Host
public MutableLiveData<String> thirdHostName = new MutableLiveData<>();
public MutableLiveData<String> thirdHostShortCode = new MutableLiveData<>();
public MutableLiveData<String> thirdHostPrimaryIp = new MutableLiveData<>();
public MutableLiveData<String> thirdHostPrimaryPort = new MutableLiveData<>();
public MutableLiveData<String> thirdHostSecondaryIp = new MutableLiveData<>();
public MutableLiveData<String> thirdHostSecondaryPort = new MutableLiveData<>();
public MutableLiveData<String> thirdHostCurrency = new MutableLiveData<>();
public MutableLiveData<String> terminalName = new MutableLiveData<>();
@ -49,7 +59,7 @@ public class HostConfigViewModel extends ViewModel {
merchantName.setValue(sp.getMerchantName());
merchantPhone.setValue(sp.getMerchantPhoneNo());
merchantAddress1.setValue(wrapMerchantAddress(sp.getMerchantAddress()));
terminalName.setValue(sp.getTerminalName());
terminalName.setValue(wrapTerminalName(sp.getTerminalName()));
// PRIMARY HOST
hostName.setValue(sp.getHostName());
@ -64,7 +74,7 @@ public class HostConfigViewModel extends ViewModel {
secondaryIp.setValue(sec[0]);
secondaryPort.setValue(sec[1]);
currencyCode.setValue(sp.getCurrencyType() != null ? sp.getCurrencyType().toString() : "");
currencyCode.setValue(normalizeCurrency(sp.getCurrencyType() != null ? sp.getCurrencyType().toString() : ""));
if (sp.getSecHostName() != null && !sp.getSecHostName().isEmpty()) {
@ -81,6 +91,46 @@ public class HostConfigViewModel extends ViewModel {
String[] shs = split(sp.getSecHostSecIpAddress());
secHostSecondaryIp.setValue(shs[0]);
secHostSecondaryPort.setValue(shs[1]);
secHostCurrency.setValue(normalizeCurrency(sp.getSecHostCurrency()));
}
if (sp.getThirdHostName() != null && !sp.getThirdHostName().isEmpty()) {
thirdHostName.setValue(sp.getThirdHostName());
thirdHostShortCode.setValue(sp.getThirdHostShortCode());
String[] thp = split(sp.getThirdHostIpAddress());
thirdHostPrimaryIp.setValue(thp[0]);
thirdHostPrimaryPort.setValue(thp[1]);
String[] ths = split(sp.getThirdHostSecIpAddress());
thirdHostSecondaryIp.setValue(ths[0]);
thirdHostSecondaryPort.setValue(ths[1]);
thirdHostCurrency.setValue(normalizeCurrency(sp.getThirdHostCurrency()));
}
}
private String normalizeCurrency(String raw) {
if (TextUtils.isEmpty(raw)) return "";
String value = raw.trim().toUpperCase();
switch (value) {
case "104":
case "MMK":
return "MMK";
case "840":
case "USD":
return "USD";
case "156":
case "CNY":
case "RMB":
return "CNY";
case "764":
case "THB":
return "THB";
case "643":
case "RUB":
return "RUB";
default:
return value;
}
}
@ -100,6 +150,20 @@ public class HostConfigViewModel extends ViewModel {
return TextUtils.join("\n", lines);
}
private String wrapTerminalName(String name) {
if (TextUtils.isEmpty(name)) return "";
String formattedName = name
.replace("\\r\\n", "\n")
.replace("\\n", "\n")
.replace("\r\n", "\n")
.trim();
List<String> lines = wrapAddressText(formattedName, 29);
return TextUtils.join("\n", lines);
}
private String[] split(String raw) {
if (raw == null || raw.trim().isEmpty()) {
return new String[]{"", ""};

View File

@ -103,6 +103,14 @@ public class TMSSetupsImpl implements TMSSetups{
SystemParamsOperation.getInstance().setIpAddress("");
SystemParamsOperation.getInstance().setSecIpAddress("");
SystemParamsOperation.getInstance().setThirdHostName("");
SystemParamsOperation.getInstance().setThirdHostTerminalId("");
SystemParamsOperation.getInstance().setThirdHostMerchantId("");
SystemParamsOperation.getInstance().setThirdHostIpAddress("");
SystemParamsOperation.getInstance().setThirdHostSecIpAddress("");
SystemParamsOperation.getInstance().setThirdHostShortCode("");
SystemParamsOperation.getInstance().setThirdHostCurrency("");
SystemParamsOperation.getInstance().setSecHostName("");
SystemParamsOperation.getInstance().setSecHostTerminalId("");
SystemParamsOperation.getInstance().setSecHostMerchantId("");
@ -187,120 +195,96 @@ public class TMSSetupsImpl implements TMSSetups{
}
if(!siriusHosts.isEmpty()) {
SiriusHost qrHost = null;
ArrayList<SiriusHost> cardHosts = new ArrayList<>();
for (SiriusHost siriusHost: siriusHosts) {
if ("QR".equalsIgnoreCase(siriusHost.getTyp())) {
if (qrHost == null) qrHost = siriusHost;
} else {
cardHosts.add(siriusHost);
}
}
if( siriusHost.getTyp().equals("QR")) {
// For dual-currency card flow, prefer MMK as PRIMARY HOST.
if (cardHosts.size() >= 2) {
SiriusHost first = cardHosts.get(0);
SiriusHost second = cardHosts.get(1);
boolean firstIsMMK = "MMK".equalsIgnoreCase(first.getCurrency());
boolean secondIsMMK = "MMK".equalsIgnoreCase(second.getCurrency());
if (!firstIsMMK && secondIsMMK) {
cardHosts.set(0, second);
cardHosts.set(1, first);
}
}
SystemParamsOperation.getInstance().setSecHostId(siriusHost.getId());
SystemParamsOperation.getInstance().setSecHostName(siriusHost.getName());
SystemParamsOperation.getInstance().setSecHostTerminalId(siriusHost.getTid());
SystemParamsOperation.getInstance().setSecHostMerchantId(extractDigits(siriusHost.getMid()));
SystemParamsOperation.getInstance().setShortCode(siriusHost.getShortCode());
// PRIMARY HOST (Card #1)
if (!cardHosts.isEmpty()) {
SiriusHost primaryCard = cardHosts.get(0);
SystemParamsOperation.getInstance().setHostName(primaryCard.getName() == null ? "" : primaryCard.getName());
SystemParamsOperation.getInstance().setTerminalId(primaryCard.getTid() == null ? "" : primaryCard.getTid());
SystemParamsOperation.getInstance().setMerchantId(primaryCard.getMid() == null ? "" : primaryCard.getMid());
String primaryIp = primaryCard.getPrimaryIP();
SystemParamsOperation.getInstance().setIpAddress(primaryIp != null && primaryIp.contains(":") ? primaryIp.trim() : "");
if (siriusHost.getPrimaryIP().contains(":")) {
String secondaryIp = primaryCard.getSecondaryIP();
SystemParamsOperation.getInstance().setSecIpAddress(secondaryIp != null && secondaryIp.contains(":") ? secondaryIp.trim() : "");
SystemParamsOperation.getInstance().setSecHostIpAddress(siriusHost.getPrimaryIP().trim()+"/");
if (!TextUtils.isEmpty(primaryCard.getCurrency())) {
SystemParamsOperation.getInstance().setCurrencyType(currencyTextToCurrencyType(primaryCard.getCurrency()));
}
}
} else if(siriusHost.getPrimaryIP().trim().isEmpty()) {
// SECONDARY HOST (Card #2)
if (cardHosts.size() > 1) {
SiriusHost secondaryCard = cardHosts.get(1);
SystemParamsOperation.getInstance().setThirdHostName(secondaryCard.getName() == null ? "" : secondaryCard.getName());
SystemParamsOperation.getInstance().setThirdHostTerminalId(secondaryCard.getTid() == null ? "" : secondaryCard.getTid());
SystemParamsOperation.getInstance().setThirdHostMerchantId(secondaryCard.getMid() == null ? "" : secondaryCard.getMid());
SystemParamsOperation.getInstance().setThirdHostShortCode(secondaryCard.getShortCode() == null ? "" : secondaryCard.getShortCode());
String thirdPrimaryIp = secondaryCard.getPrimaryIP();
SystemParamsOperation.getInstance().setThirdHostIpAddress(thirdPrimaryIp != null && thirdPrimaryIp.contains(":") ? thirdPrimaryIp.trim() : "");
String thirdSecondaryIp = secondaryCard.getSecondaryIP();
SystemParamsOperation.getInstance().setThirdHostSecIpAddress(thirdSecondaryIp != null && thirdSecondaryIp.contains(":") ? thirdSecondaryIp.trim() : "");
if (!TextUtils.isEmpty(secondaryCard.getCurrency())) {
SystemParamsOperation.getInstance().setThirdHostCurrency(currencyTextToCode(secondaryCard.getCurrency()));
}
}
// QR HOST
if (qrHost != null) {
SystemParamsOperation.getInstance().setSecHostId(qrHost.getId());
SystemParamsOperation.getInstance().setSecHostName(qrHost.getName());
SystemParamsOperation.getInstance().setSecHostTerminalId(qrHost.getTid() == null ? "" : qrHost.getTid());
SystemParamsOperation.getInstance().setSecHostMerchantId(qrHost.getMid() == null ? "" : extractDigits(qrHost.getMid()));
SystemParamsOperation.getInstance().setShortCode(qrHost.getShortCode());
String qrPrimaryIp = qrHost.getPrimaryIP();
if (qrPrimaryIp != null && qrPrimaryIp.contains(":")) {
SystemParamsOperation.getInstance().setSecHostIpAddress(qrPrimaryIp.trim()+"/");
} else {
SystemParamsOperation.getInstance().setSecHostIpAddress("");
}
if (siriusHost.getSecondaryIP().contains(":")) {
SystemParamsOperation.getInstance().setSecHostSecIpAddress(siriusHost.getSecondaryIP().trim()+"/");
} else if(siriusHost.getSecondaryIP().trim().isEmpty()) {
String qrSecondaryIp = qrHost.getSecondaryIP();
if (qrSecondaryIp != null && qrSecondaryIp.contains(":")) {
SystemParamsOperation.getInstance().setSecHostSecIpAddress(qrSecondaryIp.trim()+"/");
} else {
SystemParamsOperation.getInstance().setSecHostSecIpAddress("");
}
if (!siriusHost.getCurrency().isEmpty()) {
SystemParamsOperation.getInstance().setSecHostCurrency(currencyTextToCode(siriusHost.getCurrency()));
// if(tmsUpdate == TMSUpdate.CHECK){
// if(SystemParamsOperation.getInstance().getSecHostCurrency() != null) {
// if(!currencyCodeToText(SystemParamsOperation.getInstance().getSecHostCurrency()).equals(siriusHost.getCurrency())) {
// SystemParamsOperation.getInstance().setNeedSettlement(true);
// } else {
//// SystemParamsOperation.getInstance().setCurrencyType(currencyTextToCurrencyType(siriusHost.getCurrency()));
// SystemParamsOperation.getInstance().setSecHostCurrency(currencyTextToCode(siriusHost.getCurrency()));
// }
// }
//
// } else if(tmsUpdate == TMSUpdate.UPDATE){
//
// SystemParamsOperation.getInstance().setSecHostCurrency(currencyTextToCode(siriusHost.getCurrency()));
// }
if (!TextUtils.isEmpty(qrHost.getCurrency())) {
SystemParamsOperation.getInstance().setSecHostCurrency(currencyTextToCode(qrHost.getCurrency()));
}
if (siriusHost.getShortCode() == null || siriusHost.getShortCode().isEmpty()) {
if (qrHost.getShortCode() == null || qrHost.getShortCode().isEmpty()) {
SystemParamsOperation.getInstance().setShortCode("");
}
} else {
SystemParamsOperation.getInstance().setHostName(siriusHost.getName());
SystemParamsOperation.getInstance().setTerminalId(siriusHost.getTid());
SystemParamsOperation.getInstance().setMerchantId(siriusHost.getMid());
if (siriusHost.getPrimaryIP().contains(":")) {
SystemParamsOperation.getInstance().setIpAddress(siriusHost.getPrimaryIP().trim());
} else if(siriusHost.getPrimaryIP().trim().isEmpty()) {
SystemParamsOperation.getInstance().setIpAddress("");
}
String secondaryIp = siriusHost.getSecondaryIP();
if(secondaryIp == null || secondaryIp.trim().isEmpty()){
SystemParamsOperation.getInstance().setSecIpAddress("");
}else if(secondaryIp.contains(":")){
SystemParamsOperation.getInstance().setSecIpAddress(secondaryIp.trim());
}
// if (siriusHost.getSecondaryIP().contains(":")) {
//
// SystemParamsOperation.getInstance().setSecIpAddress(siriusHost.getSecondaryIP().trim());
//
// } else if(siriusHost.getSecondaryIP().trim().isEmpty()){
// SystemParamsOperation.getInstance().setSecIpAddress("");
// }
if (!siriusHost.getCurrency().isEmpty()) {
SystemParamsOperation.getInstance().setCurrencyType(currencyTextToCurrencyType(siriusHost.getCurrency()));
// if(tmsUpdate == TMSUpdate.CHECK){
// if(SystemParamsOperation.getInstance().getCurrencyCode() != null) {
// if(!currencyCodeToText(SystemParamsOperation.getInstance().getCurrencyCode()).equals(siriusHost.getCurrency())) {
// SystemParamsOperation.getInstance().setNeedSettlement(true);
// } else {
//
// SystemParamsOperation.getInstance().setCurrencyType(currencyTextToCurrencyType(siriusHost.getCurrency()));
//// SystemParamsOperation.getInstance().setCurrencyCode(currencyTextToCode(siriusHost.getCurrency()));
// }
// }
//
// } else if(tmsUpdate == TMSUpdate.UPDATE){
// SystemParamsOperation.getInstance().setCurrencyType(currencyTextToCurrencyType(siriusHost.getCurrency()));
//// SystemParamsOperation.getInstance().setCurrencyCode(currencyTextToCode(siriusHost.getCurrency()));
// }
}
if (siriusHost.getTid().isEmpty() || siriusHost.getMid().isEmpty() ) {
if(siriusHost.getTid().isEmpty()) {
SystemParamsOperation.getInstance().setTerminalId("");
}
if(siriusHost.getMid().isEmpty()) {
SystemParamsOperation.getInstance().setMerchantId("");
}
}
}
}
}

View File

@ -96,6 +96,13 @@
android:layout_width="match_parent"/>
<!-- ===== PRIMARY HOST ===== -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility='@{!TextUtils.isEmpty(viewModel.hostName) ? View.VISIBLE : View.GONE}'
tools:visibility="visible">
<TextView
android:text="PRIMARY HOST"
android:paddingBottom="4dp"
@ -114,47 +121,48 @@
android:text='@{": " + viewModel.hostName}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.tid) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="TID"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.tid}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.mid) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="MID"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.mid}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.primaryIp) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Primary IP"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.primaryIp}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.primaryPort) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Primary Port"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.primaryPort}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secondaryIp) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Secondary IP"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.secondaryIp}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secondaryPort) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Secondary Port"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.secondaryPort}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.currencyCode) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Currency"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.currencyCode}'/>
</TableRow>
</TableLayout>
</LinearLayout>
<TextView
android:text="--------------------------------------------------------------------------"
@ -168,8 +176,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility='@{!TextUtils.isEmpty(viewModel.secHostName) ? View.VISIBLE : View.GONE}'
tools:visibility="visible">
android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostName) ? View.VISIBLE : View.GONE}'
tools:visibility="gone">
<TextView
android:text="SECONDARY HOST"
@ -181,6 +189,80 @@
android:layout_height="wrap_content"
android:layout_width="match_parent"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="1">
<TableRow>
<TextView style="@style/HostLabelStyle" android:text="Name"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.thirdHostName}'/>
</TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostShortCode) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Short Code"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.thirdHostShortCode}'/>
</TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostPrimaryIp) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Primary IP"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.thirdHostPrimaryIp}'/>
</TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostPrimaryPort) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Primary Port"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.thirdHostPrimaryPort}'/>
</TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostSecondaryIp) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Secondary IP"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.thirdHostSecondaryIp}'/>
</TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostSecondaryPort) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Secondary Port"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.thirdHostSecondaryPort}'/>
</TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostCurrency) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Currency"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.thirdHostCurrency}'/>
</TableRow>
</TableLayout>
<TextView
android:text="--------------------------------------------------------------------------"
android:gravity="left"
android:paddingVertical="8dp"
android:layout_height="wrap_content"
android:layout_width="match_parent"/>
</LinearLayout>
<!-- ===== QR HOST ===== -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility='@{!TextUtils.isEmpty(viewModel.secHostName) ? View.VISIBLE : View.GONE}'
tools:visibility="visible">
<TextView
android:text="QR HOST"
android:textSize="14sp"
style="@style/HostLabelStyle"
android:textStyle="bold"
android:fontFamily="@font/rubik_regular"
android:paddingTop="8dp"
android:layout_height="wrap_content"
android:layout_width="match_parent"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -192,40 +274,40 @@
android:text='@{": " + viewModel.secHostName}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.shortCode) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Short Code"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.shortCode}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secHostPrimaryIp) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Primary IP"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.secHostPrimaryIp}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secHostPrimaryPort) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Primary Port"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.secHostPrimaryPort}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secHostSecondaryIp) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Secondary IP"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.secHostSecondaryIp}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secHostSecondaryPort) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Secondary Port"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.secHostSecondaryPort}'/>
</TableRow>
<TableRow>
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secHostCurrency) ? View.VISIBLE : View.GONE}'>
<TextView style="@style/HostLabelStyle" android:text="Currency"/>
<TextView style="@style/HostValueStyle"
android:text='@{": " + viewModel.currencyCode}'/>
android:text='@{": " + viewModel.secHostCurrency}'/>
</TableRow>
</TableLayout>

View File

@ -1,5 +1,7 @@
package com.utsmyanmar.baselib.network.model.sirius;
import com.google.gson.annotations.SerializedName;
public class SiriusHost {
private String id;
@ -9,6 +11,8 @@ public class SiriusHost {
private String primaryIP;
private String secondaryIP;
@SerializedName(value = "thirdIP", alternate = {"thirdIp", "tertiaryIP", "tertiaryIp"})
private String thirdIP;
private String currency;
@ -53,6 +57,10 @@ public class SiriusHost {
this.secondaryIP = secondaryIP;
}
public void setThirdIP(String thirdIP) {
this.thirdIP = thirdIP;
}
public void setCurrency(String currency) {
this.currency = currency;
}
@ -89,6 +97,10 @@ public class SiriusHost {
return secondaryIP;
}
public String getThirdIP() {
return thirdIP;
}
public String getCurrency() {
return currency;
}

View File

@ -1069,15 +1069,28 @@ public abstract class BaseXPrint {
receiptHeader = SystemParamsOperation.getInstance().getReceiptHeader();
merchantAddress = SystemParamsOperation.getInstance().getMerchantAddress();
if(merchantAddress != null){
//this step is needed for manually line break with \n in the Address
merchantAddress = merchantAddress.replace("\\n", "\n");
if (merchantAddress != null) {
// Support manual line breaks entered as escaped/newline sequences.
merchantAddress = merchantAddress
.replace("\\r\\n", "\n")
.replace("\\n", "\n")
.replace("\r\n", "\n");
}
terminalName = SystemParamsOperation.getInstance().getTerminalName();
if (terminalName != null) {
// Keep behavior aligned with address wrapping for printed slips.
terminalName = terminalName
.replace("\\r\\n", "\n")
.replace("\\n", "\n")
.replace("\r\n", "\n");
}
assert merchantAddress != null;
List<String> result = wrapAddressText(merchantAddress, 29);
List<String> terminalLines = TextUtils.isEmpty(terminalName)
? new ArrayList<>()
: wrapAddressText(terminalName.trim(), 29);
if (receiptHeader == null || TextUtils.equals(receiptHeader, "") || receiptHeader.trim().isEmpty()) {
receiptHeader = merchantName;
@ -1085,11 +1098,13 @@ public abstract class BaseXPrint {
if (TextUtils.equals(merchantAddress, "")) {
merchantAddress = "";
}
if(TextUtils.equals(terminalName, "") || terminalName == null){
if (TextUtils.equals(terminalName, "") || terminalName == null) {
terminalName = "";
}
printer.appendPrnStr(terminalName, fontNormal, AlignEnum.CENTER, true);
for (String line : terminalLines) {
printer.appendPrnStr(line, fontNormal, AlignEnum.CENTER, true);
}
for (String line : result) {
//result get the List of text from auto/manually break the address
@ -1316,7 +1331,7 @@ public abstract class BaseXPrint {
dotBreak();
// ---------- SECONDARY HOST (optional) ----------
if (!TextUtils.isEmpty(sp.getSecHostName())) {
printer.appendPrnStr("SECONDARY HOST", fontNormal, AlignEnum.LEFT, true);
printer.appendPrnStr("QR HOST", fontNormal, AlignEnum.LEFT, true);
printer.appendPrnStr("Name : " + sp.getSecHostName(), fontNormal, AlignEnum.LEFT, false);
printer.appendPrnStr("SHORT CODE : " + sp.getShortCode(), fontNormal, AlignEnum.LEFT, false);
String[] secHostIp = splitIpAndPort(sp.getSecHostIpAddress());
@ -1325,10 +1340,26 @@ public abstract class BaseXPrint {
String[] secHostSecIp = splitIpAndPort(sp.getSecHostSecIpAddress());
printer.appendPrnStr("Secondary Ip : " + secHostSecIp[0], fontNormal, AlignEnum.LEFT, false);
printer.appendPrnStr("Secondary Port: " + secHostSecIp[1], fontNormal, AlignEnum.LEFT, false);
printer.appendPrnStr("Currency Code : " + sp.getCurrencyType(), fontNormal, AlignEnum.LEFT, false);
String qrHostCurrency = TextUtils.isEmpty(sp.getSecHostCurrency()) ? String.valueOf(sp.getCurrencyType()) : sp.getSecHostCurrency();
printer.appendPrnStr("Currency Code : " + qrHostCurrency, fontNormal, AlignEnum.LEFT, false);
dotBreak();
printer.appendPrnStr("App Version : " + getAppVersion(), fontNormal, AlignEnum.LEFT, false);
}
// ---------- THIRD HOST (optional) ----------
if (!TextUtils.isEmpty(sp.getThirdHostName())) {
printer.appendPrnStr("SECONDARY HOST", fontNormal, AlignEnum.LEFT, true);
printer.appendPrnStr("Name : " + sp.getThirdHostName(), fontNormal, AlignEnum.LEFT, false);
printer.appendPrnStr("SHORT CODE : " + sp.getThirdHostShortCode(), fontNormal, AlignEnum.LEFT, false);
String[] thirdHostIp = splitIpAndPort(sp.getThirdHostIpAddress());
printer.appendPrnStr("Primary Ip : " + thirdHostIp[0], fontNormal, AlignEnum.LEFT, false);
printer.appendPrnStr("Primary Port : " + thirdHostIp[1], fontNormal, AlignEnum.LEFT, false);
String[] thirdHostSecIp = splitIpAndPort(sp.getThirdHostSecIpAddress());
printer.appendPrnStr("Secondary Ip : " + thirdHostSecIp[0], fontNormal, AlignEnum.LEFT, false);
printer.appendPrnStr("Secondary Port: " + thirdHostSecIp[1], fontNormal, AlignEnum.LEFT, false);
printer.appendPrnStr("Currency Code : " + sp.getThirdHostCurrency(), fontNormal, AlignEnum.LEFT, false);
dotBreak();
}
}
private String getAppVersion() {

View File

@ -1014,6 +1014,7 @@ public class SystemParamsOperation {
saveSystemParamsSettings(params);
}
public void setTmsAddress(String tmsAddress){
SystemParamsSettings params = getSystemParamsSettings();
params.setTmsAddress(tmsAddress);
@ -1036,6 +1037,7 @@ public class SystemParamsOperation {
return params.getSecIpAddress();
}
public int getPortAddress(){
SystemParamsSettings params = getSystemParamsSettings();
return params.getPortAddress();
@ -1344,22 +1346,44 @@ public class SystemParamsOperation {
saveSystemParamsSettings(params);
}
public void setThirdHostName(String hostName) {
SystemParamsSettings params = getSystemParamsSettings();
params.setThirdHostName(hostName);
saveSystemParamsSettings(params);
}
public String getSecHostName() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getSecHostName();
}
public String getThirdHostName() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getThirdHostName();
}
public void setSecHostIpAddress(String ipAddress) {
SystemParamsSettings params = getSystemParamsSettings();
params.setSecHostIpAddress(ipAddress);
saveSystemParamsSettings(params);
}
public void setThirdHostIpAddress(String ipAddress) {
SystemParamsSettings params = getSystemParamsSettings();
params.setThirdHostIpAddress(ipAddress);
saveSystemParamsSettings(params);
}
public String getSecHostIpAddress() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getSecHostIpAddress();
}
public String getThirdHostIpAddress() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getThirdHostIpAddress();
}
public void setTokenHostAddress(String tokenHostAddress) {
SystemParamsSettings params = getSystemParamsSettings();
params.setTokenHostAddress(tokenHostAddress);
@ -1387,39 +1411,78 @@ public class SystemParamsOperation {
saveSystemParamsSettings(params);
}
public void setThirdHostSecIpAddress(String ipAddress) {
SystemParamsSettings params = getSystemParamsSettings();
params.setThirdHostSecIpAddress(ipAddress);
saveSystemParamsSettings(params);
}
public String getSecHostSecIpAddress() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getSecHostSecIpAddress();
}
public String getThirdHostSecIpAddress() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getThirdHostSecIpAddress();
}
public void setSecHostTerminalId(String terminalId) {
SystemParamsSettings params = getSystemParamsSettings();
params.setSecHostTerminalId(terminalId);
saveSystemParamsSettings(params);
}
public void setThirdHostTerminalId(String terminalId) {
SystemParamsSettings params = getSystemParamsSettings();
params.setThirdHostTerminalId(terminalId);
saveSystemParamsSettings(params);
}
public String getSecHostTerminalId() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getSecHostTerminalId();
}
public String getThirdHostTerminalId() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getThirdHostTerminalId();
}
public void setSecHostMerchantId(String merchantId) {
SystemParamsSettings params = getSystemParamsSettings();
params.setSecHostMerchantId(merchantId);
saveSystemParamsSettings(params);
}
public void setThirdHostMerchantId(String merchantId) {
SystemParamsSettings params = getSystemParamsSettings();
params.setThirdHostMerchantId(merchantId);
saveSystemParamsSettings(params);
}
public void setShortCode(String shortCode) {
SystemParamsSettings params = getSystemParamsSettings();
params.setShortCode(shortCode);
saveSystemParamsSettings(params);
}
public void setThirdHostShortCode(String shortCode) {
SystemParamsSettings params = getSystemParamsSettings();
params.setThirdHostShortCode(shortCode);
saveSystemParamsSettings(params);
}
public String getShortCode() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getShortCode();
}
public String getThirdHostShortCode() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getThirdHostShortCode();
}
public void setBinValue(String value) {
SystemParamsSettings params = getSystemParamsSettings();
params.setBinValues(value);
@ -1437,6 +1500,11 @@ public class SystemParamsOperation {
return params.getSecHostMerchantId();
}
public String getThirdHostMerchantId() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getThirdHostMerchantId();
}
public void setLastSuccessTrnx(String lastSuccessTrnx) {
SystemParamsSettings params = getSystemParamsSettings();
params.setLastSuccessTranx(lastSuccessTrnx);
@ -1454,11 +1522,22 @@ public class SystemParamsOperation {
saveSystemParamsSettings(params);
}
public void setThirdHostCurrency(String currency) {
SystemParamsSettings params = getSystemParamsSettings();
params.setThirdHostCurrency(currency);
saveSystemParamsSettings(params);
}
public String getSecHostCurrency() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getSecHostCurrency();
}
public String getThirdHostCurrency() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getThirdHostCurrency();
}
public String getCurrentSerialNum() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getCurrentSerialNum();

View File

@ -102,22 +102,29 @@ public class SystemParamsSettings implements Serializable {
private String secHostId = "";
private String secHostName = "";
private String thirdHostName = "";
private String secHostIpAddress = "";
private String thirdHostIpAddress = "";
private String tokenHostAddress = "";
private String grantType = "";
private String secHostSecIpAddress = "";
private String thirdHostSecIpAddress = "";
private String secHostTerminalId = "";
private String thirdHostTerminalId = "";
private String secHostMerchantId = "";
private String thirdHostMerchantId = "";
private String shortCode = "";
private String thirdHostShortCode = "";
private String secHostCurrency = "";
private String thirdHostCurrency = "";
private String disabledMessage = "";
@ -278,26 +285,38 @@ public class SystemParamsSettings implements Serializable {
return secHostName;
}
protected String getThirdHostName() { return thirdHostName; }
protected String getSecHostIpAddress() {
return secHostIpAddress;
}
protected String getThirdHostIpAddress() { return thirdHostIpAddress; }
protected String getSecHostSecIpAddress() {
return secHostSecIpAddress;
}
protected String getThirdHostSecIpAddress() { return thirdHostSecIpAddress; }
protected String getSecHostTerminalId() {
return secHostTerminalId;
}
protected String getThirdHostTerminalId() { return thirdHostTerminalId; }
protected String getSecHostMerchantId() {
return secHostMerchantId;
}
protected String getThirdHostMerchantId() { return thirdHostMerchantId; }
protected String getSecHostCurrency() {
return secHostCurrency;
}
protected String getThirdHostCurrency() { return thirdHostCurrency; }
protected String getAuthToken() { return authToken;}
protected String getEreceiptAddress() { return ereceiptAddress; }
@ -323,10 +342,14 @@ public class SystemParamsSettings implements Serializable {
this.secHostName = secHostName;
}
protected void setThirdHostName(String thirdHostName) { this.thirdHostName = thirdHostName; }
protected void setSecHostIpAddress(String secHostIpAddress) {
this.secHostIpAddress = secHostIpAddress;
}
protected void setThirdHostIpAddress(String thirdHostIpAddress) { this.thirdHostIpAddress = thirdHostIpAddress; }
protected void setBinValues(String binValues) {
this.binValues = binValues;
}
@ -379,10 +402,14 @@ public class SystemParamsSettings implements Serializable {
this.shortCode = shortCode;
}
protected void setThirdHostShortCode(String thirdHostShortCode) { this.thirdHostShortCode = thirdHostShortCode; }
protected String getShortCode() {
return this.shortCode;
}
protected String getThirdHostShortCode() { return this.thirdHostShortCode; }
protected long getuPiCvMLimit() {
return this.uPiCvMLimit;
}
@ -415,10 +442,14 @@ public class SystemParamsSettings implements Serializable {
this.secHostSecIpAddress = secHostSecIpAddress;
}
protected void setThirdHostSecIpAddress(String thirdHostSecIpAddress) { this.thirdHostSecIpAddress = thirdHostSecIpAddress; }
protected void setSecHostTerminalId(String secHostTerminalId) {
this.secHostTerminalId = secHostTerminalId;
}
protected void setThirdHostTerminalId(String thirdHostTerminalId) { this.thirdHostTerminalId = thirdHostTerminalId; }
protected void setLastSuccessTranx(String lastSuccessTranx) {
this.lastSuccessTranx = lastSuccessTranx;
}
@ -431,10 +462,14 @@ public class SystemParamsSettings implements Serializable {
this.secHostMerchantId = secHostMerchantId;
}
protected void setThirdHostMerchantId(String thirdHostMerchantId) { this.thirdHostMerchantId = thirdHostMerchantId; }
protected void setSecHostCurrency(String secHostCurrency) {
this.secHostCurrency = secHostCurrency;
}
protected void setThirdHostCurrency(String thirdHostCurrency) { this.thirdHostCurrency = thirdHostCurrency; }
protected void setNeedSettlement(boolean needSettlement) {
this.isNeedSettlement = needSettlement;
}
@ -670,6 +705,7 @@ public class SystemParamsSettings implements Serializable {
protected void setSecIpAddress(String secIpAddress){ this.secIpAddress = secIpAddress;}
protected void setHostReadTimeout(String hostReadTimeout){ this.hostReadTimeout = hostReadTimeout;}
protected void setReversalDelay(String reversalDelay) { this.reversalDelay = reversalDelay; }
@ -684,6 +720,7 @@ public class SystemParamsSettings implements Serializable {
protected String getSecIpAddress(){ return secIpAddress;}
protected String getComp1() {
return comp1;
}