Compare commits
3 Commits
f958dfe572
...
eafbecafbd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eafbecafbd | ||
|
|
009ff28954 | ||
|
|
4fffc9990e |
@ -36,6 +36,7 @@ import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.platform.LocalInspectionMode
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.mob.utsmyanmar.ui.components.appbar.AppBar
|
||||
@ -52,6 +53,7 @@ import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
||||
import com.utsmyanmar.paylibs.model.PayDetail
|
||||
import com.utsmyanmar.paylibs.utils.POSUtil
|
||||
import com.utsmyanmar.paylibs.utils.PrintStatus
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@ -249,26 +251,50 @@ fun ReceiptPreview(
|
||||
.padding(20.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(
|
||||
text = "MOB POS",
|
||||
style = MaterialTheme.typography.headlineLarge
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
val merchantPhoneNo = SystemParamsOperation.getInstance()
|
||||
.merchantPhoneNo
|
||||
?.takeIf { it.isNotBlank() }
|
||||
val merchantMobileNo = SystemParamsOperation.getInstance()
|
||||
.merchantMobileNo
|
||||
?.takeIf { it.isNotBlank() }
|
||||
|
||||
Text(
|
||||
text = "Transaction Receipt",
|
||||
style = MaterialTheme.typography.bodyMedium
|
||||
)
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Text(
|
||||
text = copyLabel,
|
||||
text = "MOB POS",
|
||||
style = MaterialTheme.typography.headlineLarge
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = state.payDetail?.merchantName.toString(),
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
textAlign = TextAlign.Center,
|
||||
color = Color.Gray
|
||||
)
|
||||
merchantPhoneNo?.let { phoneNo ->
|
||||
Text(
|
||||
text = phoneNo,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
textAlign = TextAlign.Center,
|
||||
color = Color.Gray
|
||||
)
|
||||
}
|
||||
merchantMobileNo?.let { mobileNo ->
|
||||
Text(
|
||||
text = mobileNo,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
textAlign = TextAlign.Center,
|
||||
color = Color.Gray
|
||||
)
|
||||
}
|
||||
// Spacer(modifier = Modifier.height(4.dp))
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
ReceiptDivider()
|
||||
ReceiptRow("Date", convertDateString(state.payDetail?.transDate.toString()))
|
||||
ReceiptRow("Time", state.payDetail?.transTime.toString())
|
||||
ReceiptRow("Merchant Name", state.payDetail?.merchantName.toString())
|
||||
ReceiptRow("TID", state.payDetail?.terminalNo.toString())
|
||||
ReceiptRow("Trace No", state.payDetail?.voucherNo.toString())
|
||||
ReceiptRow("Ref No", state.payDetail?.referNo.toString())
|
||||
@ -279,17 +305,21 @@ fun ReceiptPreview(
|
||||
if (prefix.isEmpty() && (state.payDetail?.transactionType ?: 0) == TransactionsType.CASH_OUT.value) "-$amt" else "$prefix$amt"
|
||||
})
|
||||
ReceiptRow("Card Type", state.payDetail?.accountType.toString())
|
||||
ReceiptRow("Card No", state.payDetail?.cardNo.toString())
|
||||
ReceiptRow("Card No", maskCardNumber(state.payDetail?.cardNo.orEmpty()))
|
||||
ReceiptRow("Status", if (isPreview) "SUCCESS" else state.payDetail?.let(::displayTransactionStatus).orEmpty())
|
||||
ReceiptDivider()
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = copyLabel,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = Color.Gray
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = "Thank You",
|
||||
style = MaterialTheme.typography.titleMedium
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
|
||||
Text(
|
||||
text = "Please keep this receipt",
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
@ -297,6 +327,11 @@ fun ReceiptPreview(
|
||||
}
|
||||
}
|
||||
|
||||
private fun maskCardNumber(cardNumber: String): String {
|
||||
if (cardNumber.length <= 10) return cardNumber
|
||||
return cardNumber.take(6) + "*".repeat(cardNumber.length - 10) + cardNumber.takeLast(4)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ReceiptRow(
|
||||
label: String,
|
||||
|
||||
@ -88,6 +88,7 @@ class TMSSetupsImpl : TMSSetups {
|
||||
ops.merchantName = m.name
|
||||
ops.merchantAddress = m.address
|
||||
ops.merchantPhoneNo = m.phone
|
||||
ops.merchantMobileNo = m.mobile_phone
|
||||
}
|
||||
|
||||
siriusResponse.address.takeIf { it.isNotEmpty() }?.let { ops.merchantAddress = it }
|
||||
|
||||
@ -16,6 +16,8 @@ public class SiriusMerchant {
|
||||
|
||||
private String mobile;
|
||||
|
||||
private String mobile_phone;
|
||||
|
||||
public SiriusMerchant(String id, String name, String description, String address,String address2,String phone,String mobile) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
@ -50,6 +52,14 @@ public class SiriusMerchant {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public String getMobile_phone() {
|
||||
return mobile_phone;
|
||||
}
|
||||
|
||||
public void setMobile_phone(String mobile_phone) {
|
||||
this.mobile_phone = mobile_phone;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ -176,11 +176,13 @@ public class PrintReceipt {
|
||||
String merchantAddress = "";
|
||||
String merchantAddress2 = "";
|
||||
String merchantPhoneNo = "";
|
||||
String merchantMobileNo = "";
|
||||
|
||||
merchantName = SystemParamsOperation.getInstance().getMerchantName();
|
||||
merchantAddress = SystemParamsOperation.getInstance().getMerchantAddress();
|
||||
merchantAddress2 = SystemParamsOperation.getInstance().getMerchantAddress2();
|
||||
merchantPhoneNo = SystemParamsOperation.getInstance().getMerchantPhoneNo();
|
||||
merchantMobileNo = SystemParamsOperation.getInstance().getMerchantMobileNo();
|
||||
|
||||
if (TextUtils.equals(merchantName, "") || merchantName == null) {
|
||||
merchantName = "MERCHANT NAME";
|
||||
@ -207,6 +209,9 @@ public class PrintReceipt {
|
||||
sunmiPrinterService.printText(merchantAddress + "\n", innerResultCallback);
|
||||
sunmiPrinterService.printText(merchantAddress2 + "\n", innerResultCallback);
|
||||
sunmiPrinterService.printText(merchantPhoneNo + "\n", innerResultCallback);
|
||||
if (merchantMobileNo != null && !merchantMobileNo.trim().isEmpty()) {
|
||||
sunmiPrinterService.printText(merchantMobileNo + "\n", innerResultCallback);
|
||||
}
|
||||
sunmiPrinterService.lineWrap(1, innerResultCallback);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@ -817,12 +817,14 @@ public abstract class BaseXPrint {
|
||||
String merchantName = "";
|
||||
String merchantAddress = "";
|
||||
String merchantPhoneNo = "";
|
||||
String merchantMobileNo = "";
|
||||
List<String> wrappedAddressText = new ArrayList<>();
|
||||
|
||||
merchantName = SystemParamsOperation.getInstance().getMerchantName();
|
||||
receiptHeader = SystemParamsOperation.getInstance().getReceiptHeader();
|
||||
merchantAddress = SystemParamsOperation.getInstance().getMerchantAddress();
|
||||
merchantPhoneNo = SystemParamsOperation.getInstance().getMerchantPhoneNo();
|
||||
merchantMobileNo = SystemParamsOperation.getInstance().getMerchantMobileNo();
|
||||
|
||||
if (receiptHeader == null || TextUtils.equals(receiptHeader, "") || receiptHeader.trim().isEmpty()) {
|
||||
receiptHeader = merchantName;
|
||||
@ -852,6 +854,9 @@ public abstract class BaseXPrint {
|
||||
sunmiPrinterService.printText(addressLine + "\n", innerResultCallback);
|
||||
}
|
||||
sunmiPrinterService.printText(merchantPhoneNo + "\n", innerResultCallback);
|
||||
if (merchantMobileNo != null && !merchantMobileNo.trim().isEmpty()) {
|
||||
sunmiPrinterService.printText(merchantMobileNo + "\n", innerResultCallback);
|
||||
}
|
||||
sunmiPrinterService.lineWrap(1, innerResultCallback);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@ -707,6 +707,11 @@ public class SystemParamsOperation {
|
||||
return paramsSettings.getMerchantPhoneNo();
|
||||
}
|
||||
|
||||
public String getMerchantMobileNo() {
|
||||
SystemParamsSettings paramsSettings = getSystemParamsSettings();
|
||||
return paramsSettings.getMerchantMobileNo();
|
||||
}
|
||||
|
||||
public String getMerchantAddress2() {
|
||||
SystemParamsSettings paramsSettings = getSystemParamsSettings();
|
||||
return paramsSettings.getMerchantAddress2();
|
||||
@ -955,6 +960,12 @@ public class SystemParamsOperation {
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
public void setMerchantMobileNo(String merchantMobileNo) {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
params.setMerchantMobileNo(merchantMobileNo);
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
public void setIpAddress(String ipAddress){
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
params.setIpAddress(ipAddress);
|
||||
|
||||
@ -64,6 +64,8 @@ public class SystemParamsSettings implements Serializable {
|
||||
|
||||
private String merchantPhoneNo = "";
|
||||
|
||||
private String merchantMobileNo = "";
|
||||
|
||||
private String systemPassword = "";
|
||||
|
||||
private String settlementPassword = "";
|
||||
@ -819,6 +821,14 @@ public class SystemParamsSettings implements Serializable {
|
||||
return merchantPhoneNo;
|
||||
}
|
||||
|
||||
protected void setMerchantMobileNo(String merchantMobileNo) {
|
||||
this.merchantMobileNo = merchantMobileNo;
|
||||
}
|
||||
|
||||
protected String getMerchantMobileNo() {
|
||||
return merchantMobileNo;
|
||||
}
|
||||
|
||||
protected void setSystemPassword(String systemPassword) {
|
||||
this.systemPassword = systemPassword;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user