This commit is contained in:
MooN 2025-12-01 15:58:06 +06:30
parent a0ffff71c4
commit ff68ee6a1f
14 changed files with 254 additions and 15 deletions

View File

@ -11,7 +11,7 @@ android {
compileSdk 34
defaultConfig {
applicationId "com.utsmm.kbz" //mpu
applicationId "com.utsmm.kbz.uat" //mpu
minSdk 24
targetSdk 33
versionCode 10

View File

@ -325,7 +325,7 @@ public class QRTransactionFragment extends DataBindingFragment implements DataBi
if(payDetail.getQrTransStatus() != -1) {
payDetail.setQrTransStatus(2);
}
sharedViewModel.pushReceipt(buildEReceiptQRReceipt(payDetail, false, "QR Expired!"));
sharedViewModel.payDetail.postValue(payDetail);
safeNavigateToRouteId();
@ -333,6 +333,7 @@ public class QRTransactionFragment extends DataBindingFragment implements DataBi
} catch (Exception e) {
LogUtil.d(TAG, "On Exception::");
sharedViewModel.pushReceipt(buildEReceiptQRReceipt(payDetail, false, "QR Failed! :" + e.getMessage()));
e.printStackTrace();
if (count == totalCount) {

View File

@ -2,8 +2,20 @@ package com.utsmm.kbz.ui.navigation;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
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.GrayLevelEnum;
import com.nexgo.oaf.apiv3.device.printer.LineOptionEntity;
import com.nexgo.oaf.apiv3.device.printer.Printer;
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
import com.utsmyanmar.baselib.network.model.sirius.SiriusHost;
import com.utsmyanmar.baselib.network.model.sirius.SiriusMerchant;
import com.utsmyanmar.baselib.network.model.sirius.SiriusResponse;
import com.utsmyanmar.baselib.util.DataBindingConfig;
import com.utsmyanmar.paylibs.Constant;
import com.utsmyanmar.paylibs.sign_on.EchoTestProcess;
@ -13,6 +25,8 @@ import com.utsmm.kbz.BR;
import com.utsmm.kbz.R;
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
import java.util.List;
public class NaviMainFragment extends DataBindingFragment {
private OnFragmentInteractionListener mListener;
@ -137,6 +151,7 @@ public class NaviMainFragment extends DataBindingFragment {
});
}
public void onClickLogOff() {
showLoadingDialog("Sending LogOff!");
@ -176,6 +191,148 @@ public class NaviMainFragment extends DataBindingFragment {
mListener.onClickFunction();
}
private GrayLevelEnum getGrayLevel() {
int gray = 2;
GrayLevelEnum grayLevelEnum = GrayLevelEnum.LEVEL_1;
switch (gray) {
case 0:
grayLevelEnum = GrayLevelEnum.LEVEL_0;
break;
case 1:
grayLevelEnum = GrayLevelEnum.LEVEL_1;
break;
case 2:
grayLevelEnum = GrayLevelEnum.LEVEL_2;
break;
case 3:
grayLevelEnum = GrayLevelEnum.LEVEL_3;
break;
case 4:
grayLevelEnum = GrayLevelEnum.LEVEL_4;
break;
default:
grayLevelEnum = GrayLevelEnum.LEVEL_1;
break;
}
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(){
mListener.onClickVersion();
}
@ -184,7 +341,6 @@ public class NaviMainFragment extends DataBindingFragment {
mListener.onClickExit();
}
}
public interface OnFragmentInteractionListener {
@ -195,5 +351,6 @@ public class NaviMainFragment extends DataBindingFragment {
void onClickVersion();
void onClickExit();
}
}

View File

@ -150,7 +150,6 @@ public class QRRefundProcessFragment extends DataBindingFragment {
} else {
LogUtil.d(TAG, "Refund failed!");
payDetail.setQrTransStatus(-1);
payDetail.setQrReferNo(referenceNo);
payDetail.setReferNo(referenceNo);
@ -160,7 +159,8 @@ public class QRRefundProcessFragment extends DataBindingFragment {
errorMsg = response.getResponse().getMsg();
}
payDetail.setTradeResultDes(errorMsg);
sharedViewModel.pushReceipt(buildEReceiptQRReceipt(payDetail, false, "Refund Failed! "+errorMsg));
sharedViewModel.payDetail.setValue(payDetail);
navigateToNext();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -266,8 +266,7 @@
<ImageView
android:layout_width="46dp"
android:layout_height="46dp"
android:src="@drawable/ic_qr_pay"
app:tint="@color/colorPrimary"
android:src="@drawable/ic_mmqr"
android:layout_marginBottom="6dp" />
<TextView

View File

@ -377,6 +377,81 @@
android:textStyle="bold"
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 -->
<androidx.cardview.widget.CardView
android:id="@+id/tv_function"

View File

@ -1,5 +1,5 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="app_name">KBZ</string>
<string name="app_name">KBZ UAT</string>
<string name="app_name_sit">SMILE-SIT</string>
<string name="app_name_uat">SMILE-UAT</string>
<string name="app_name_plus">SMILE-PLUS</string>

View File

@ -14,6 +14,8 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
buildConfigField "String", "ERECEIPT_SECRET", "\"${ERECEIPT_SECRET}\""
// Room compiler options
javaCompileOptions {

View File

@ -285,8 +285,8 @@ public class NetworkModule {
tmsAddress = getTMSUrlFromNative();
}
String baseUrl = tmsAddress.trim() + "/api/v1/";
// String baseUrl = tmsAddress.trim() + "/";
// String baseUrl = tmsAddress.trim() + "/api/v1/";
String baseUrl = tmsAddress.trim() + "/";
final Gson gson =
@ -398,9 +398,11 @@ public class NetworkModule {
OkHttpClient client = new OkHttpClient.Builder()
.addInterceptor(interceptor)
.build();
// String baseUrl = "http://receipt-nest.utsmyanmar.com/";
String baseUrl = "https://api-tms-uat.kbzbank.com:8443/receipt/";
return new Retrofit.Builder()
.baseUrl("http://receipt-nest.utsmyanmar.com/") // base URL
.baseUrl(baseUrl)
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.client(client)

View File

@ -6,6 +6,7 @@ import androidx.lifecycle.LiveData;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.utsmyanmar.baselib.BuildConfig;
import com.utsmyanmar.baselib.db.dao.EmvDetailDao;
import com.utsmyanmar.baselib.db.dao.PayDetailDao;
import com.utsmyanmar.baselib.db.model.EmvDetail;
@ -106,7 +107,8 @@ public class Repository {
return siriusApiService.getParams(siriusRequest);
}
public Observable<EReceiptResponse> sendReceipt(Object body){
String apiSecret = "8f4df38d1001bcc4620b5c736c66a03eef4653eb3ba31105faa2f2ee294c4a46";
// String apiSecret = "y812J21lhha11OS";
String apiSecret = BuildConfig.ERECEIPT_SECRET;
String timestamp = String.valueOf(System.currentTimeMillis());
String bodyString = new Gson().toJson(body);
String dataToHash = bodyString + apiSecret + timestamp;

View File

@ -28,4 +28,5 @@ android.useAndroidX=true
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
# Disable Android Studio's Jetifier to avoid conflicts
android.enableJetifier=false
android.enableJetifier=false
ERECEIPT_SECRET=y812J21lhha11OS

View File

@ -42,8 +42,8 @@ public class SystemParamsSettings implements Serializable {
// private String tmsAddress = "https://tms.smile-mm.com";
// private String tmsAddress = "http://128.199.170.203";
private String tmsAddress = "http://sirius-nest.utsmyanmar.com";
// private String tmsAddress = "https://api-tms-uat.kbzbank.com:8443/sirius";
// private String tmsAddress = "http://sirius-nest.utsmyanmar.com";
private String tmsAddress = "https://api-tms-uat.kbzbank.com:8443/sirius";
private String terminalCapability = "E0E8C8";