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