Merge remote-tracking branch 'origin/merge_latest_SIT' into merge_latest_SIT

# Conflicts:
#	paylibs/src/main/java/com/utsmyanmar/paylibs/print/printx/BaseXPrint.java
This commit is contained in:
kizzy 2025-12-15 23:13:14 +07:00
commit 83d7f44561
9 changed files with 278 additions and 103 deletions

View File

@ -112,7 +112,7 @@ public class HostConfigFragment extends DataBindingFragment {
Log.e("Print Config", "Printer Error: " + printerStatus);
return;
}
printer.setGray(GrayLevelEnum.LEVEL_2);
printer.setGray(GrayLevelEnum.LEVEL_1);
Typeface typeface = ResourcesCompat.getFont(requireContext(), R.font.consolas_bold);
printer.setTypeface(typeface);
SystemParamsOperation sp = SystemParamsOperation.getInstance();
@ -147,8 +147,9 @@ public class HostConfigFragment extends DataBindingFragment {
if (!TextUtils.isEmpty(sp.getSecHostName())) {
printer.appendPrnStr("SECONDARY HOST", FONT_NORMAL, AlignEnum.LEFT, true);
printer.appendPrnStr("Name : " + sp.getSecHostName(), FONT_NORMAL, AlignEnum.LEFT, false);
printer.appendPrnStr("TID : " + sp.getSecHostTerminalId(), FONT_NORMAL, AlignEnum.LEFT, false);
printer.appendPrnStr("MID : " + sp.getSecHostMerchantId(), FONT_NORMAL, AlignEnum.LEFT, false);
// printer.appendPrnStr("TID : " + sp.getSecHostTerminalId(), FONT_NORMAL, AlignEnum.LEFT, false);
// printer.appendPrnStr("MID : " + sp.getSecHostMerchantId(), FONT_NORMAL, AlignEnum.LEFT, false);
printer.appendPrnStr("SHORT CODE : " + sp.getShortCode(), FONT_NORMAL, AlignEnum.LEFT, false);
String secHostIpAddress = sp.getSecHostIpAddress();
String[] secHostIpAndPort = splitIpAndPort(secHostIpAddress);
String secHostIp = secHostIpAndPort[0];

View File

@ -23,13 +23,16 @@ public class HostConfigViewModel extends ViewModel {
// Secondary Host
public MutableLiveData<String> secHostName = new MutableLiveData<>();
public MutableLiveData<String> secHostTid = new MutableLiveData<>();
public MutableLiveData<String> secHostMid = new MutableLiveData<>();
// public MutableLiveData<String> secHostTid = new MutableLiveData<>();
// public MutableLiveData<String> secHostMid = new MutableLiveData<>();
public MutableLiveData<String> shortCode = new MutableLiveData<>();
public MutableLiveData<String> secHostPrimaryIp = new MutableLiveData<>();
public MutableLiveData<String> secHostPrimaryPort = new MutableLiveData<>();
public MutableLiveData<String> secHostSecondaryIp = new MutableLiveData<>();
public MutableLiveData<String> secHostSecondaryPort = new MutableLiveData<>();
public MutableLiveData<String> terminalName = new MutableLiveData<>();
public void loadConfig() {
@ -40,6 +43,7 @@ public class HostConfigViewModel extends ViewModel {
merchantPhone.setValue(sp.getMerchantPhoneNo());
merchantAddress1.setValue(sp.getMerchantAddress());
merchantAddress2.setValue(sp.getMerchantAddress2());
terminalName.setValue(sp.getTerminalName());
// PRIMARY HOST
hostName.setValue(sp.getHostName());
@ -60,8 +64,9 @@ public class HostConfigViewModel extends ViewModel {
if (sp.getSecHostName() != null && !sp.getSecHostName().isEmpty()) {
secHostName.setValue(sp.getSecHostName());
secHostTid.setValue(sp.getSecHostTerminalId());
secHostMid.setValue(sp.getSecHostMerchantId());
// secHostTid.setValue(sp.getSecHostTerminalId());
// secHostMid.setValue(sp.getSecHostMerchantId());
shortCode.setValue(sp.getShortCode());
String[] shp = split(sp.getSecHostIpAddress());
secHostPrimaryIp.setValue(shp[0]);

View File

@ -108,6 +108,7 @@ public class EReceiptUtil {
double realAmount = amt / 100.0;
DecimalFormat df = new DecimalFormat("0.00");
String amount = df.format(realAmount);
String terminalIdForEreceipt = SystemParamsOperation.getInstance().getTerminalIdForEreceipt();
String currentTimeStamp = new java.text.SimpleDateFormat("MMddHHmmss", java.util.Locale.getDefault())
.format(new java.util.Date());
@ -122,6 +123,8 @@ public class EReceiptUtil {
request.setAppId(packageName);
request.setDE41(qrTerminalId);
request.setDE42(qrMerchantId);
request.setTerminalId(terminalIdForEreceipt);
request.setShortCode(qrMerchantId);
request.setInvoiceNumber(invoiceNo != null ? invoiceNo : "");
request.setDE11(voucherNo != null ? voucherNo : "");

View File

@ -157,6 +157,7 @@ public class TMSSetupsImpl implements TMSSetups{
SystemParamsOperation.getInstance().setMerchantAddress(siriusMerchant.getAddress());
SystemParamsOperation.getInstance().setMerchantAddress2(siriusMerchant.getAddress2());
SystemParamsOperation.getInstance().setMerchantPhoneNo(siriusMerchant.getMobile());
SystemParamsOperation.getInstance().setTerminalName(siriusMerchant.getDescription());
}

View File

@ -6,7 +6,7 @@
<data>
<import type="android.view.View"/>
<import type="android.text.TextUtils" />
<import type="android.text.TextUtils"/>
<variable
name="viewModel"
type="com.utsmm.kbz.ui.settings.HostConfigViewModel" />
@ -46,129 +46,270 @@
android:scrollbars="none">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- HEADER -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TERMINAL CONFIGURATION"
android:gravity="center"
android:fontFamily="@font/rubik_regular"
android:textSize="16sp"
android:textStyle="bold"
android:textSize="18sp"
android:paddingBottom="12dp"/>
android:textAlignment="center"
android:paddingBottom="12dp"
tools:text="TERMINAL CONFIGURATION"/>
<!-- Merchant Info -->
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text="@{viewModel.merchantName}" />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text="@{viewModel.merchantPhone}" />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text="@{viewModel.merchantAddress1}" />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text="@{viewModel.merchantAddress2}" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{viewModel.merchantName}"
android:fontFamily="@font/rubik_regular"
android:textSize="16sp"
android:textStyle="bold"
android:textAlignment="center"
tools:text="Someone Mart"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="--------------------------------"
android:text="@{viewModel.merchantAddress1}"
android:fontFamily="@font/rubik_regular"
android:textSize="16sp"
android:textStyle="bold"
android:textAlignment="center"
tools:text="Corner of Bogyoke and Botahtaung Pagoda Street"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{viewModel.merchantAddress2}"
android:fontFamily="@font/rubik_regular"
android:textSize="16sp"
android:textStyle="bold"
android:textAlignment="center"
tools:text="Yangon"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{viewModel.terminalName}"
android:fontFamily="@font/rubik_regular"
android:textSize="16sp"
android:textStyle="bold"
tools:text="Yangon"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="--------------------------------------------------------------------------"
android:paddingTop="8dp"
android:paddingBottom="8dp"/>
android:paddingBottom="8dp"
tools:text="--------------------------------------------------------------------------"/>
<!-- PRIMARY HOST -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="PRIMARY HOST"
android:textStyle="bold" />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"Name : " + viewModel.hostName}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"TID : " + viewModel.tid}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"MID : " + viewModel.mid}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"Primary Ip : " + viewModel.primaryIp}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"Primary Port : " + viewModel.primaryPort}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"Secondary Ip : " + viewModel.secondaryIp}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"Secondary Port : " + viewModel.secondaryPort}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"Currency Code : " + viewModel.currencyCode}' />
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="PRIMARY HOST"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="--------------------------------"
android:paddingTop="8dp"
android:paddingBottom="8dp"/>
android:text='@{"Name : " + viewModel.hostName}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="Name : Card Host"/>
<!-- SECONDARY HOST (only if exists) -->
<LinearLayout
android:orientation="vertical"
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility='@{!viewModel.secHostName.isEmpty() ? View.VISIBLE : View.GONE}'>
android:text='@{"TID : " + viewModel.tid}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="TID : 12345678"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{"MID : " + viewModel.mid}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="MID : 123456789876543"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{"PRIMARY IP : " + viewModel.primaryIp}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="PRIMARY IP : primaryidport.com"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{"PRIMARY PORT : " + viewModel.primaryPort}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="PRIMARY PORT : 8080"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{"SECONDARY IP : " + viewModel.secondaryIp}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="SECONDARY IP : secondaryidport.com"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{"SECONDARY PORT : " + viewModel.secondaryPort}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="SECONDARY PORT : 8080"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{"CURRENCY CODE : " + viewModel.currencyCode}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="CURRENCY CODE : MMK"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="--------------------------------------------------------------------------"
android:paddingTop="8dp"
android:paddingBottom="8dp"
tools:text="--------------------------------------------------------------------------"/>
<!-- SECONDARY HOST -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility='@{!viewModel.secHostName.isEmpty() ? View.VISIBLE : View.GONE}'
tools:visibility="visible">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="SECONDARY HOST"
android:textStyle="bold" />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"Name : " + viewModel.secHostName}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"TID : " + viewModel.secHostTid}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"MID : " + viewModel.secHostMid}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"Primary Ip : " + viewModel.secHostPrimaryIp}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"Primary Port : " + viewModel.secHostPrimaryPort}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"Secondary Ip : " + viewModel.secHostSecondaryIp}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"Secondary Port : " + viewModel.secHostSecondaryPort}' />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text='@{"Currency Code : " + viewModel.currencyCode}' />
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="SECONDARY HOST"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="--------------------------------"
android:text='@{"Name : " + viewModel.secHostName}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="Name : QR Host"/>
<!-- <TextView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text='@{"TID : " + viewModel.secHostTid}'-->
<!-- android:fontFamily="@font/rubik_regular"-->
<!-- android:textSize="14sp"-->
<!-- android:textStyle="bold"-->
<!-- tools:text="TID : 87654321"/>-->
<!-- <TextView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text='@{"MID : " + viewModel.secHostMid}'-->
<!-- android:fontFamily="@font/rubik_regular"-->
<!-- android:textSize="14sp"-->
<!-- android:textStyle="bold"-->
<!-- tools:text="MID : 987654321012345"/>-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{"SHORT CODE : " + viewModel.shortCode}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="SHORT CODE : 12345678987"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{"Primary Ip : " + viewModel.secHostPrimaryIp}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="Primary Ip : 10.10.10.10"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{"Primary Port : " + viewModel.secHostPrimaryPort}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="Primary Port : 5000"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{"Secondary Ip : " + viewModel.secHostSecondaryIp}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="Secondary Ip : 10.10.10.11"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{"Secondary Port : " + viewModel.secHostSecondaryPort}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="Secondary Port : 5001"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{"Currency Code : " + viewModel.currencyCode}'
android:fontFamily="@font/rubik_regular"
android:textSize="14sp"
android:textStyle="bold"
tools:text="Currency Code : MMK"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="--------------------------------------------------------------------------"
android:paddingTop="8dp"
android:paddingBottom="8dp"/>
android:paddingBottom="8dp"
tools:text="--------------------------------------------------------------------------"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>
</androidx.cardview.widget.CardView>
<!-- ACTION BUTTONS -->
<LinearLayout
android:id="@+id/actionButtons"
@ -187,7 +328,8 @@
android:onClick="@{()-> click.onCancel()}"
android:background="@drawable/bg_rounded_btn_cancel_cv"
android:textColor="@color/colorPrimary"
android:textStyle="bold"/>
android:textStyle="bold"
tools:text="Cancel"/>
<Button
android:layout_width="0dp"
@ -198,9 +340,9 @@
android:onClick="@{()-> click.onPrint()}"
android:background="@drawable/bg_rounded_btn_cv"
android:textColor="@color/white"
android:textStyle="bold"/>
android:textStyle="bold"
tools:text="Print"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@ -82,8 +82,9 @@ public abstract class BaseXPrint {
protected final int FONT_SIZE_BIG = 24;
protected int fontSmall = 16;
// protected FontEntity fontSmall = new FontEntity(DotMatrixFontEnum.CH_SONG_20X20, DotMatrixFontEnum.ASC_SONG_8X16);
protected int fontNormal = 20;
protected int fontNormal = 21;
// protected FontEntity fontNormal = new FontEntity(DotMatrixFontEnum.CH_SONG_24X24, DotMatrixFontEnum.ASC_SONG_12X24);
protected FontEntity fontBold = new FontEntity(DotMatrixFontEnum.CH_SONG_24X24, DotMatrixFontEnum.ASC_SONG_BOLD_16X24);
@ -116,7 +117,7 @@ public abstract class BaseXPrint {
Resources resources = PayLibsUtils.getInstance().context.getResources();
// Typeface typeface = ResourcesCompat.getFont(PayLibsUtils.getInstance().context, R.font.consolas);
// printer.setTypeface(typeface);
printer.setTypeface(Typeface.createFromAsset(PayLibsUtils.getInstance().context.getAssets(), "fonts/victor_mono.ttf"));
printer.setTypeface(Typeface.createFromAsset(PayLibsUtils.getInstance().context.getAssets(), "fonts/consolab.ttf"));
printer.setGray(getGrayLevel());
}
@ -858,18 +859,16 @@ public abstract class BaseXPrint {
if (TextUtils.equals(merchantAddress2, "") || merchantAddress2 == null) {
merchantAddress2 = "MERCHANT ADDRESS2";
}
if (TextUtils.equals(merchantPhoneNo, "") || merchantPhoneNo == null) {
merchantPhoneNo = "MERCHANT PHONENO";
}
// if (TextUtils.equals(merchantPhoneNo, "") || merchantPhoneNo == null) {
// merchantPhoneNo = "MERCHANT PHONENO";
// }
printer.appendPrnStr(receiptHeader, fontNormal, AlignEnum.CENTER,false);
printer.appendPrnStr(merchantAddress, fontNormal, AlignEnum.CENTER,false);
printer.appendPrnStr(merchantAddress2, fontNormal, AlignEnum.CENTER,false);
printer.appendPrnStr(merchantPhoneNo, fontNormal, AlignEnum.CENTER,false);
emptyLine(2);
// printer.appendPrnStr(merchantPhoneNo, fontNormal, AlignEnum.CENTER,false);
emptyLine(1);
}
protected void printKeyInfo() {
@ -936,15 +935,19 @@ public abstract class BaseXPrint {
/* 17 Sept 2024 Yoma requested to changed slip design for QR*/
// printer.printColumnsString(new String[]{"MID :" + payDetail.getMerchantNo(), ""}, new int[]{3, 1}, new int[]{0, 2}, innerResultCallback);
// printer.printColumnsString(new String[]{"TID :" + payDetail.getTerminalNo(), ""}, new int[]{3, 1}, new int[]{0, 2}, innerResultCallback);
printer.appendPrnStr("MID :" + payDetail.getMerchantNo(), fontNormal, AlignEnum.LEFT,false);
printer.appendPrnStr("TID :" + payDetail.getTerminalNo(), fontNormal, AlignEnum.LEFT,false);
if (payDetail.getTransactionType() == TransactionsType.MMQR.value){
printer.appendPrnStr("SHORT CODE:" + payDetail.getMerchantNo(), fontNormal, AlignEnum.LEFT,false);
}else{
printer.appendPrnStr("MID :" + payDetail.getMerchantNo(), fontNormal, AlignEnum.LEFT,false);
printer.appendPrnStr("TID :" + payDetail.getTerminalNo(), fontNormal, AlignEnum.LEFT,false);
}
emptyLine(1);
printer.appendPrnStr(transType.replace("_", " "),fontNormal, AlignEnum.CENTER,true);
if (!(payDetail.getQrTransStatus() != 1 && (payDetail.getTransactionType() == TransactionsType.MMQR_REFUND.value || payDetail.getTransactionType() == TransactionsType.MMQR.value))) {
printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
// printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
}
}

View File

@ -336,7 +336,7 @@ public class PrintXImpl extends BaseXPrint implements PrintX {
if (!(payDetail.getQrTransStatus() != 1 && (payDetail.getTransactionType() == TransactionsType.MMQR_REFUND.value || payDetail.getTransactionType() == TransactionsType.MMQR.value))) {
emptyLine(2);
emptyLine(1);
}
// check is pin change

View File

@ -1665,4 +1665,15 @@ public class SystemParamsOperation {
SystemParamsSettings params = getSystemParamsSettings();
return params.getTerminalIdForEreceipt();
}
public String getTerminalName() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getTerminalName();
}
public void setTerminalName(String description) {
SystemParamsSettings params = getSystemParamsSettings();
params.setTerminalName(description);
saveSystemParamsSettings(params);
}
}

View File

@ -47,6 +47,7 @@ public class SystemParamsSettings implements Serializable {
private String ereceiptAddress = "http://receipt-nest.utsmyanmar.com"; //for on prime
// private String ereceiptAddress = "https://api-tms-uat.kbzbank.com:8443/receipt"; //for uat
private String terminalName = "";
private String terminalCapability = "E0E8C8";
@ -1009,6 +1010,14 @@ public class SystemParamsSettings implements Serializable {
this.terminalIdForEreceipt = data;
}
public String getTerminalName() {
return terminalName;
}
public void setTerminalName(String terminalName) {
this.terminalName = terminalName;
}
/* // 流水号起始
private String serialNum = Configs.getInstance().SERIAL_NUM();
// 批次号起始