fix receipt for duel host
This commit is contained in:
parent
df025bce34
commit
2c87ee5828
@ -44,6 +44,8 @@ public class HostConfigViewModel extends ViewModel {
|
|||||||
|
|
||||||
// Third Host
|
// Third Host
|
||||||
public MutableLiveData<String> thirdHostName = new MutableLiveData<>();
|
public MutableLiveData<String> thirdHostName = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> thirdHostTid = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> thirdHostMid = new MutableLiveData<>();
|
||||||
public MutableLiveData<String> thirdHostShortCode = new MutableLiveData<>();
|
public MutableLiveData<String> thirdHostShortCode = new MutableLiveData<>();
|
||||||
public MutableLiveData<String> thirdHostPrimaryIp = new MutableLiveData<>();
|
public MutableLiveData<String> thirdHostPrimaryIp = new MutableLiveData<>();
|
||||||
public MutableLiveData<String> thirdHostPrimaryPort = new MutableLiveData<>();
|
public MutableLiveData<String> thirdHostPrimaryPort = new MutableLiveData<>();
|
||||||
@ -96,6 +98,8 @@ public class HostConfigViewModel extends ViewModel {
|
|||||||
|
|
||||||
if (sp.getThirdHostName() != null && !sp.getThirdHostName().isEmpty()) {
|
if (sp.getThirdHostName() != null && !sp.getThirdHostName().isEmpty()) {
|
||||||
thirdHostName.setValue(sp.getThirdHostName());
|
thirdHostName.setValue(sp.getThirdHostName());
|
||||||
|
thirdHostTid.setValue(sp.getThirdHostTerminalId());
|
||||||
|
thirdHostMid.setValue(sp.getThirdHostMerchantId());
|
||||||
thirdHostShortCode.setValue(sp.getThirdHostShortCode());
|
thirdHostShortCode.setValue(sp.getThirdHostShortCode());
|
||||||
|
|
||||||
String[] thp = split(sp.getThirdHostIpAddress());
|
String[] thp = split(sp.getThirdHostIpAddress());
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
<import type="android.view.View"/>
|
|
||||||
<import type="android.text.TextUtils"/>
|
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="viewModel"
|
name="viewModel"
|
||||||
type="com.utsmm.kbz.ui.settings.HostConfigViewModel"/>
|
type="com.utsmm.kbz.ui.settings.HostConfigViewModel"/>
|
||||||
@ -99,9 +96,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:visibility='@{!TextUtils.isEmpty(viewModel.hostName) ? View.VISIBLE : View.GONE}'
|
|
||||||
tools:visibility="visible">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:text="PRIMARY HOST"
|
android:text="PRIMARY HOST"
|
||||||
@ -121,42 +116,42 @@
|
|||||||
android:text='@{": " + viewModel.hostName}'/>
|
android:text='@{": " + viewModel.hostName}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.tid) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="TID"/>
|
<TextView style="@style/HostLabelStyle" android:text="TID"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.tid}'/>
|
android:text='@{": " + viewModel.tid}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.mid) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="MID"/>
|
<TextView style="@style/HostLabelStyle" android:text="MID"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.mid}'/>
|
android:text='@{": " + viewModel.mid}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.primaryIp) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Primary IP"/>
|
<TextView style="@style/HostLabelStyle" android:text="Primary IP"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.primaryIp}'/>
|
android:text='@{": " + viewModel.primaryIp}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.primaryPort) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Primary Port"/>
|
<TextView style="@style/HostLabelStyle" android:text="Primary Port"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.primaryPort}'/>
|
android:text='@{": " + viewModel.primaryPort}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secondaryIp) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Secondary IP"/>
|
<TextView style="@style/HostLabelStyle" android:text="Secondary IP"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.secondaryIp}'/>
|
android:text='@{": " + viewModel.secondaryIp}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secondaryPort) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Secondary Port"/>
|
<TextView style="@style/HostLabelStyle" android:text="Secondary Port"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.secondaryPort}'/>
|
android:text='@{": " + viewModel.secondaryPort}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.currencyCode) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Currency"/>
|
<TextView style="@style/HostLabelStyle" android:text="Currency"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.currencyCode}'/>
|
android:text='@{": " + viewModel.currencyCode}'/>
|
||||||
@ -175,9 +170,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostName) ? View.VISIBLE : View.GONE}'
|
|
||||||
tools:visibility="gone">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:text="SECONDARY HOST"
|
android:text="SECONDARY HOST"
|
||||||
@ -200,37 +193,43 @@
|
|||||||
android:text='@{": " + viewModel.thirdHostName}'/>
|
android:text='@{": " + viewModel.thirdHostName}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostShortCode) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Short Code"/>
|
<TextView style="@style/HostLabelStyle" android:text="TID"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.thirdHostShortCode}'/>
|
android:text='@{": " + viewModel.thirdHostTid}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostPrimaryIp) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
|
<TextView style="@style/HostLabelStyle" android:text="MID"/>
|
||||||
|
<TextView style="@style/HostValueStyle"
|
||||||
|
android:text='@{": " + viewModel.thirdHostMid}'/>
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Primary IP"/>
|
<TextView style="@style/HostLabelStyle" android:text="Primary IP"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.thirdHostPrimaryIp}'/>
|
android:text='@{": " + viewModel.thirdHostPrimaryIp}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostPrimaryPort) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Primary Port"/>
|
<TextView style="@style/HostLabelStyle" android:text="Primary Port"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.thirdHostPrimaryPort}'/>
|
android:text='@{": " + viewModel.thirdHostPrimaryPort}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostSecondaryIp) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Secondary IP"/>
|
<TextView style="@style/HostLabelStyle" android:text="Secondary IP"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.thirdHostSecondaryIp}'/>
|
android:text='@{": " + viewModel.thirdHostSecondaryIp}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostSecondaryPort) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Secondary Port"/>
|
<TextView style="@style/HostLabelStyle" android:text="Secondary Port"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.thirdHostSecondaryPort}'/>
|
android:text='@{": " + viewModel.thirdHostSecondaryPort}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.thirdHostCurrency) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Currency"/>
|
<TextView style="@style/HostLabelStyle" android:text="Currency"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.thirdHostCurrency}'/>
|
android:text='@{": " + viewModel.thirdHostCurrency}'/>
|
||||||
@ -249,9 +248,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:visibility='@{!TextUtils.isEmpty(viewModel.secHostName) ? View.VISIBLE : View.GONE}'
|
|
||||||
tools:visibility="visible">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:text="QR HOST"
|
android:text="QR HOST"
|
||||||
@ -274,37 +271,37 @@
|
|||||||
android:text='@{": " + viewModel.secHostName}'/>
|
android:text='@{": " + viewModel.secHostName}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.shortCode) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Short Code"/>
|
<TextView style="@style/HostLabelStyle" android:text="Short Code"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.shortCode}'/>
|
android:text='@{": " + viewModel.shortCode}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secHostPrimaryIp) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Primary IP"/>
|
<TextView style="@style/HostLabelStyle" android:text="Primary IP"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.secHostPrimaryIp}'/>
|
android:text='@{": " + viewModel.secHostPrimaryIp}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secHostPrimaryPort) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Primary Port"/>
|
<TextView style="@style/HostLabelStyle" android:text="Primary Port"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.secHostPrimaryPort}'/>
|
android:text='@{": " + viewModel.secHostPrimaryPort}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secHostSecondaryIp) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Secondary IP"/>
|
<TextView style="@style/HostLabelStyle" android:text="Secondary IP"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.secHostSecondaryIp}'/>
|
android:text='@{": " + viewModel.secHostSecondaryIp}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secHostSecondaryPort) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Secondary Port"/>
|
<TextView style="@style/HostLabelStyle" android:text="Secondary Port"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.secHostSecondaryPort}'/>
|
android:text='@{": " + viewModel.secHostSecondaryPort}'/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow android:visibility='@{!TextUtils.isEmpty(viewModel.secHostCurrency) ? View.VISIBLE : View.GONE}'>
|
<TableRow>
|
||||||
<TextView style="@style/HostLabelStyle" android:text="Currency"/>
|
<TextView style="@style/HostLabelStyle" android:text="Currency"/>
|
||||||
<TextView style="@style/HostValueStyle"
|
<TextView style="@style/HostValueStyle"
|
||||||
android:text='@{": " + viewModel.secHostCurrency}'/>
|
android:text='@{": " + viewModel.secHostCurrency}'/>
|
||||||
@ -339,7 +336,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:visibility="@{sharedViewModel.printerDisabled ? View.GONE : View.VISIBLE}"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
|||||||
@ -1315,49 +1315,77 @@ public abstract class BaseXPrint {
|
|||||||
protected void printTerminalConfiguration() {
|
protected void printTerminalConfiguration() {
|
||||||
|
|
||||||
SystemParamsOperation sp = SystemParamsOperation.getInstance();
|
SystemParamsOperation sp = SystemParamsOperation.getInstance();
|
||||||
|
|
||||||
// ---------- PRIMARY HOST ----------
|
// ---------- PRIMARY HOST ----------
|
||||||
printer.appendPrnStr("PRIMARY HOST", fontNormal, AlignEnum.LEFT, true);
|
printer.appendPrnStr("PRIMARY HOST", fontNormal, AlignEnum.LEFT, true);
|
||||||
printer.appendPrnStr("Name : " + sp.getHostName(), fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("Name : " + safe(sp.getHostName()), fontNormal, AlignEnum.LEFT, false);
|
||||||
printer.appendPrnStr("TID : " + sp.getTerminalId(), fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("TID : " + safe(sp.getTerminalId()), fontNormal, AlignEnum.LEFT, false);
|
||||||
printer.appendPrnStr("MID : " + sp.getMerchantId(), fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("MID : " + safe(sp.getMerchantId()), fontNormal, AlignEnum.LEFT, false);
|
||||||
String[] ipPort = splitIpAndPort(sp.getIpAddress());
|
String[] ipPort = splitIpAndPort(sp.getIpAddress());
|
||||||
printer.appendPrnStr("Primary Ip : " + ipPort[0], fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("Primary IP : " + ipPort[0], fontNormal, AlignEnum.LEFT, false);
|
||||||
printer.appendPrnStr("Primary Port : " + ipPort[1], fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("Primary Port : " + ipPort[1], fontNormal, AlignEnum.LEFT, false);
|
||||||
String[] secIpPort = splitIpAndPort(sp.getSecIpAddress());
|
String[] secIpPort = splitIpAndPort(sp.getSecIpAddress());
|
||||||
printer.appendPrnStr("Secondary Ip : " + secIpPort[0], fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("Secondary IP : " + secIpPort[0], fontNormal, AlignEnum.LEFT, false);
|
||||||
printer.appendPrnStr("Secondary Port: " + secIpPort[1], fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("Secondary Port: " + secIpPort[1], fontNormal, AlignEnum.LEFT, false);
|
||||||
printer.appendPrnStr("Currency Code : " + sp.getCurrencyType(), fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("Currency : " + normalizeHostCurrency(sp.getCurrencyType() == null ? "" : sp.getCurrencyType().toString()), fontNormal, AlignEnum.LEFT, false);
|
||||||
dotBreak();
|
dotBreak();
|
||||||
// ---------- SECONDARY HOST (optional) ----------
|
|
||||||
if (!TextUtils.isEmpty(sp.getSecHostName())) {
|
// ---------- SECONDARY HOST ----------
|
||||||
|
printer.appendPrnStr("SECONDARY HOST", fontNormal, AlignEnum.LEFT, true);
|
||||||
|
printer.appendPrnStr("Name : " + safe(sp.getThirdHostName()), fontNormal, AlignEnum.LEFT, false);
|
||||||
|
printer.appendPrnStr("TID : " + safe(sp.getThirdHostTerminalId()), fontNormal, AlignEnum.LEFT, false);
|
||||||
|
printer.appendPrnStr("MID : " + safe(sp.getThirdHostMerchantId()), 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 : " + normalizeHostCurrency(safe(sp.getThirdHostCurrency())), fontNormal, AlignEnum.LEFT, false);
|
||||||
|
dotBreak();
|
||||||
|
|
||||||
|
// ---------- QR HOST ----------
|
||||||
printer.appendPrnStr("QR HOST", fontNormal, AlignEnum.LEFT, true);
|
printer.appendPrnStr("QR HOST", fontNormal, AlignEnum.LEFT, true);
|
||||||
printer.appendPrnStr("Name : " + sp.getSecHostName(), fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("Name : " + safe(sp.getSecHostName()), fontNormal, AlignEnum.LEFT, false);
|
||||||
printer.appendPrnStr("SHORT CODE : " + sp.getShortCode(), fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("Short Code : " + safe(sp.getShortCode()), fontNormal, AlignEnum.LEFT, false);
|
||||||
String[] secHostIp = splitIpAndPort(sp.getSecHostIpAddress());
|
String[] qrHostIp = splitIpAndPort(sp.getSecHostIpAddress());
|
||||||
printer.appendPrnStr("Primary Ip : " + secHostIp[0], fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("Primary IP : " + qrHostIp[0], fontNormal, AlignEnum.LEFT, false);
|
||||||
printer.appendPrnStr("Primary Port : " + secHostIp[1], fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("Primary Port : " + qrHostIp[1], fontNormal, AlignEnum.LEFT, false);
|
||||||
String[] secHostSecIp = splitIpAndPort(sp.getSecHostSecIpAddress());
|
String[] qrHostSecIp = splitIpAndPort(sp.getSecHostSecIpAddress());
|
||||||
printer.appendPrnStr("Secondary Ip : " + secHostSecIp[0], fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("Secondary IP : " + qrHostSecIp[0], fontNormal, AlignEnum.LEFT, false);
|
||||||
printer.appendPrnStr("Secondary Port: " + secHostSecIp[1], fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("Secondary Port: " + qrHostSecIp[1], fontNormal, AlignEnum.LEFT, false);
|
||||||
String qrHostCurrency = TextUtils.isEmpty(sp.getSecHostCurrency()) ? String.valueOf(sp.getCurrencyType()) : sp.getSecHostCurrency();
|
printer.appendPrnStr("Currency : " + normalizeHostCurrency(safe(sp.getSecHostCurrency())), fontNormal, AlignEnum.LEFT, false);
|
||||||
printer.appendPrnStr("Currency Code : " + qrHostCurrency, fontNormal, AlignEnum.LEFT, false);
|
|
||||||
dotBreak();
|
dotBreak();
|
||||||
|
|
||||||
printer.appendPrnStr("App Version : " + getAppVersion(), fontNormal, AlignEnum.LEFT, false);
|
printer.appendPrnStr("App Version : " + getAppVersion(), fontNormal, AlignEnum.LEFT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- THIRD HOST (optional) ----------
|
private String safe(String value) {
|
||||||
if (!TextUtils.isEmpty(sp.getThirdHostName())) {
|
return value == null ? "" : value;
|
||||||
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);
|
private String normalizeHostCurrency(String raw) {
|
||||||
String[] thirdHostIp = splitIpAndPort(sp.getThirdHostIpAddress());
|
if (TextUtils.isEmpty(raw)) return "";
|
||||||
printer.appendPrnStr("Primary Ip : " + thirdHostIp[0], fontNormal, AlignEnum.LEFT, false);
|
String value = raw.trim().toUpperCase();
|
||||||
printer.appendPrnStr("Primary Port : " + thirdHostIp[1], fontNormal, AlignEnum.LEFT, false);
|
switch (value) {
|
||||||
String[] thirdHostSecIp = splitIpAndPort(sp.getThirdHostSecIpAddress());
|
case "104":
|
||||||
printer.appendPrnStr("Secondary Ip : " + thirdHostSecIp[0], fontNormal, AlignEnum.LEFT, false);
|
case "MMK":
|
||||||
printer.appendPrnStr("Secondary Port: " + thirdHostSecIp[1], fontNormal, AlignEnum.LEFT, false);
|
return "MMK";
|
||||||
printer.appendPrnStr("Currency Code : " + sp.getThirdHostCurrency(), fontNormal, AlignEnum.LEFT, false);
|
case "840":
|
||||||
dotBreak();
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user