Compare commits

..

No commits in common. "5bb07df9e36fa2ac14af3e8e31eb88b64dfab873" and "f8066d50fbb1aa71dfbed6b65dc13d1f7e8cc953" have entirely different histories.

16 changed files with 214 additions and 231 deletions

View File

@ -8,13 +8,7 @@
* fixed recent transaction only working for top 3
* routed to dashboard after printing receipt
* receipt printing animation re-scale
*
### version 3.4
* disable display always on
* auto-settlement
* show expiry date as "`**`/`**`"
* align the customer name, in paper slip
* settlement fixed in both UI and system
* amount, date, time fixed in Void Preview
* show reversal status in trans records

View File

@ -50,6 +50,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
@ -523,3 +524,26 @@ fun Item(
}
}
}
val previewTransactions = listOf(
TrnxRecord(
1L, "Sale", "MMK 10,000", "**** 1234", "06/10 14:32",
isVoided = false, isApproved = true
),
TrnxRecord(
2L, "Void", "MMK 5,500", "**** 5678", "06/10 13:10",
isVoided = true, isApproved = false
),
TrnxRecord(
3L, "Refund", "MMK 2,000", "**** 9012", "06/09 09:45",
isVoided = false, isApproved = true
),
TrnxRecord(
4L, "Sale", "MMK 30,000", "**** 3456", "06/09 08:00",
isVoided = false, isApproved = true
),
TrnxRecord(
5L, "Settlement", "MMK 0", "----", "06/08 18:00",
isVoided = false, isApproved = true
),
)

View File

@ -55,6 +55,8 @@ import com.mob.utsmyanmar.BuildConfig
import com.mob.utsmyanmar.R
import com.mob.utsmyanmar.ui.components.appbar.AppBar
import com.mob.utsmyanmar.ui.device_info.DeviceInfoUiState
import com.mob.utsmyanmar.ui.preview.P2Preview
import com.mob.utsmyanmar.ui.preview.P3Preview
import com.mob.utsmyanmar.ui.theme.Color
import com.utsmyanmar.paylibs.sign_on.EchoTestProcess
import com.utsmyanmar.paylibs.sign_on.SignOnListener
@ -445,3 +447,11 @@ fun DashboardScreen2(
}
}
}
@RequiresApi(Build.VERSION_CODES.N)
@P3Preview
@P2Preview
@Composable
fun PreviewDashboardScreen2() {
DashboardScreen2(dashboardUiState = DashboardUiState(previewTransactions))
}

View File

@ -88,12 +88,7 @@ class DashboardViewModel @Inject constructor(
private fun PayDetail.toRecord(): TrnxRecord {
val baseType = transType?.takeIf { it.isNotBlank() }?.let { formatTypeLabel(it) } ?: "Transaction"
val type = when {
transactionType == TransactionsType.REVERSAL.value && !baseType.equals("Reversal", ignoreCase = true) ->
"$baseType (Reversal)"
isCanceled -> "Void"
else -> baseType
}
val type = if (isCanceled) "Void" else baseType
val displayAmount = displayAmount()
val amountText = "MMK ${formatAmount(displayAmount)}"
val card = CardNo?.takeIf { it.length >= 4 }?.let { "**** ${it.takeLast(4)}" } ?: "----"

View File

@ -49,7 +49,7 @@ internal fun HistoryTransactionCard(
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
text = displayTransactionTitle(payDetail),
text = payDetail.transType.ifBlank { "UNKNOWN" },
color = Color.LegacyRed,
style = MaterialTheme.typography.titleSmall
)
@ -81,7 +81,7 @@ internal fun HistoryTransactionDetailCard(payDetail: PayDetail) {
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(
text = displayTransactionTitle(payDetail),
text = payDetail.transType.ifBlank { "Transaction" },
color = Color.LegacyRed,
style = MaterialTheme.typography.titleMedium
)
@ -92,7 +92,7 @@ internal fun HistoryTransactionDetailCard(payDetail: PayDetail) {
SummaryLine("Approval", payDetail.approvalCode.orEmpty())
SummaryLine("Date", payDetail.tradeDate)
SummaryLine("Time", payDetail.tradeTime)
SummaryLine("Status", displayTransactionStatus(payDetail))
SummaryLine("Status", payDetail.tradeAnswerCode.orEmpty())
}
}
}

View File

@ -26,22 +26,6 @@ internal fun prepareReprintPayDetail(payDetail: PayDetail): PayDetail {
return payDetail
}
internal fun displayTransactionStatus(payDetail: PayDetail): String {
if (payDetail.transactionType == TransactionsType.REVERSAL.value) {
return if (payDetail.isNeedReversal) "REVERSAL FAILED" else "REVERSAL SUCCESS"
}
return POSUtil.getInstance().getResponse(payDetail.tradeAnswerCode.orEmpty().ifBlank { "-" })
}
internal fun displayTransactionTitle(payDetail: PayDetail): String {
val title = payDetail.transType.ifBlank { "TRANSACTION" }
return if (payDetail.transactionType == TransactionsType.REVERSAL.value) {
"$title (REVERSAL)"
} else {
title
}
}
internal fun isValidForReprint(payDetail: PayDetail): Boolean {
if (payDetail.transactionType == TransactionsType.SETTLEMENT.value) return false
if (payDetail.transactionType == TransactionsType.WAVEPAY.value && payDetail.qrTransStatus != 1) {

View File

@ -38,8 +38,6 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.mob.utsmyanmar.ui.components.appbar.AppBar
import com.mob.utsmyanmar.ui.history_functions.displayTransactionStatus
import com.mob.utsmyanmar.ui.history_functions.displayTransactionTitle
import com.mob.utsmyanmar.ui.theme.Color
import com.mob.utsmyanmar.ui.transaction_result.TransactionResultState
import com.mob.utsmyanmar.ui.transaction_result.TransactionResultViewModel
@ -242,11 +240,11 @@ fun ReceiptPreview(
ReceiptRow("Merchant", state.payDetail?.merchantName.toString() )
ReceiptRow("Terminal ID", state.payDetail?.terminalNo.toString() )
ReceiptRow("Trace No", state.payDetail?.voucherNo.toString() )
ReceiptRow("Transaction", state.payDetail?.let(::displayTransactionTitle).orEmpty())
ReceiptRow("Transaction", state.payDetail?.transType.toString())
ReceiptRow("Amount", POSUtil.getInstance().getDecimalAmountSeparatorFormat(state.payDetail?.amount?:0))
ReceiptRow("Card Type", state.payDetail?.accountType.toString())
ReceiptRow("Card No", state.payDetail?.cardNo.toString())
ReceiptRow("Status", state.payDetail?.let(::displayTransactionStatus).orEmpty())
ReceiptRow("Status", POSUtil.getInstance().getResponse(state.payDetail?.tradeAnswerCode?: "-"))
ReceiptRow("Date", state.payDetail?.transDate.toString() )
ReceiptRow("Time", state.payDetail?.transTime.toString())
ReceiptRow("Ref No", state.payDetail?.referNo.toString())

View File

@ -1,5 +1,6 @@
package com.mob.utsmyanmar.ui.sale_void
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@ -137,8 +138,8 @@ private fun TransactionDetailsCard(transaction: PayDetail) {
DetailRow("Card No", transaction.cardNo)
DetailRow("Reference", transaction.referNo)
DetailRow("Approval", transaction.approvalCode.orEmpty())
DetailRow("Date", transaction.transDate)
DetailRow("Time", transaction.transTime)
DetailRow("Date", transaction.tradeDate)
DetailRow("Time", transaction.tradeTime)
}
}
}

View File

@ -125,9 +125,7 @@ class TransactionResultViewModel @Inject constructor(
when {
isNonApprovedTrade(payDetail) &&
isNonWavepayTransaction(transactionType) -> {
if (SystemParamsOperation.getInstance().isPrintErrorSlip) {
startPrintProcess(sharedViewModel, false)
}
isCardInside()
}

View File

@ -174,7 +174,6 @@ class TMSSetupsImpl : TMSSetups {
"clear_batch_time" -> ops.clearBatchTime = data
"alert_sound_enable" -> ops.isAlertSound = parseBoolean(data)
"auto_print_enable" -> ops.isAutoPrintCustomerCopy = parseBoolean(data)
"print_error_slip" -> ops.setPrintErrorSlip(parseBoolean(data))
"ecr_enable" -> ops.ecrStatus = parseBoolean(data)
"manual_entry_enable" -> ops.setManualEntyrStatus(parseBoolean(data))
"mmqr_interval_waiting_time" -> ops.waveIntervalTime = data

View File

@ -6,6 +6,7 @@ import android.graphics.BitmapFactory;
import android.os.RemoteException;
import android.text.TextUtils;
import com.sunmi.peripheral.printer.InnerPrinterCallback;
import com.sunmi.peripheral.printer.InnerResultCallback;
import com.sunmi.peripheral.printer.SunmiPrinterService;
import com.utsmyanmar.paylibs.Constant;
@ -16,6 +17,7 @@ import com.utsmyanmar.paylibs.model.SettleData;
import com.utsmyanmar.paylibs.model.TradeData;
import com.utsmyanmar.paylibs.system.BaseErrorCode;
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsSettings;
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionType;
import com.utsmyanmar.paylibs.utils.params.Params;
import com.utsmyanmar.paylibs.utils.print_utils.BitmapUtils;
@ -300,8 +302,7 @@ public class PrintReceipt {
if (!secondLineName.equals("")) {
sunmiPrinterService.printColumnsString(new String[]{secondLineName, ""}, new int[]{2, 2}, new int[]{0, 1}, null);
}
// sunmiPrinterService.printColumnsString(new String[]{"ENTRY MODE:" + PrintUtils.getInstance().getEntryType(payDetail.getCardType()), "EXPIRY DATE:" + PrintUtils.getInstance().getFormatExpDate(payDetail.getEXPDate())}, new int[]{2, 2}, new int[]{0, 2}, null);
sunmiPrinterService.printColumnsString(new String[]{"ENTRY MODE:" + PrintUtils.getInstance().getEntryType(payDetail.getCardType()), "EXPIRY DATE:" + "**/**"}, new int[]{2, 2}, new int[]{0, 2}, null);
sunmiPrinterService.printColumnsString(new String[]{"ENTRY MODE:" + PrintUtils.getInstance().getEntryType(payDetail.getCardType()), "EXPIRY DATE:" + PrintUtils.getInstance().getFormatExpDate(payDetail.getEXPDate())}, new int[]{2, 2}, new int[]{0, 2}, null);
if (payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_ACCEPT) || payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_APPROVED)) {
sunmiPrinterService.printColumnsString(new String[]{"CARD TYPE:" + payDetail.getAccountType(), "APPRCODE:" + payDetail.getApprovalCode()}, new int[]{2, 2}, new int[]{0, 2}, null);
} else {

View File

@ -233,7 +233,7 @@ public abstract class BaseXPrint {
sunmiPrinterService.printText("CARD NUMBER : "+ PrintUtils.getInstance().cardNumMasking(payDetail.getCardNo()) + "\n", innerResultCallback);
if(!firstLineName.isEmpty()) {
sunmiPrinterService.printText("CARD HOLDER : " + firstLineName + "\n", innerResultCallback);
sunmiPrinterService.printText("CARD HOLDER NAME: " + firstLineName + "\n", innerResultCallback);
// sunmiPrinterService.printColumnsString(new String[]{"CARD HOLDER NAME:", firstLineName}, new int[]{2, 2}, new int[]{0, 1}, innerResultCallback);
}
if(!secondLineName.isEmpty()) {
@ -241,8 +241,7 @@ public abstract class BaseXPrint {
// sunmiPrinterService.printColumnsString(new String[]{secondLineName, ""}, new int[]{2, 2}, new int[]{0, 1}, innerResultCallback);
}
sunmiPrinterService.printText("ENTRY MODE : " + PrintUtils.getInstance().getEntryType(payDetail.getCardType()) + "\n", innerResultCallback);
// sunmiPrinterService.printText("EXPIRY DATE : " + PrintUtils.getInstance().getFormatExpDate(payDetail.getEXPDate()) + "\n", innerResultCallback);
sunmiPrinterService.printText("EXPIRY DATE : " + "**/**" + "\n", innerResultCallback);
sunmiPrinterService.printText("EXPIRY DATE : " + PrintUtils.getInstance().getFormatExpDate(payDetail.getEXPDate()) + "\n", innerResultCallback);
// sunmiPrinterService.printColumnsString(new String[]{"ENTRY MODE:" + PrintUtils.getInstance().getEntryType(payDetail.getCardType()), "EXPIRY DATE:" + PrintUtils.getInstance().getFormatExpDate(payDetail.getEXPDate())}, new int[]{2, 2}, new int[]{0, 2}, innerResultCallback);
if (payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_ACCEPT) || payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_APPROVED)) {
sunmiPrinterService.printText("CARD TYPE : " + cardType + "\n", innerResultCallback);

View File

@ -57,12 +57,13 @@ public class ReversalAction {
public ReversalAction setData(TradeData tradeData) {
this.tradeData = tradeData;
payDetail = tradeData.getPayDetail();
payDetail.setTransactionType(TransactionsType.REVERSAL.value);
// payDetail.setTransType(REVERSAL);
if (TextUtils.equals(payDetail.getAccountType(), MPU)) {
BITMAP = getBitmapMPU(payDetail);
} else {
BITMAP = getBitmapUPI(payDetail);
}
payDetail.setTransactionType(TransactionsType.REVERSAL.value);
return INSTANCE;
}

View File

@ -38,33 +38,32 @@ public class POSUtil {
return instance;
}
public POSUtil() {
public POSUtil(){
}
public long convertAmount(String amount) {
long amountValue = 0;
if (amount != null) {
if (amount.contains(",")) {
amount = amount.replace(",", "");
if (amount != null ) {
if(amount.contains(",")) {
amount = amount.replace(",","");
}
if (amount.contains(".")) {
if(amount.contains(".")) {
int index = amount.indexOf('.');
int len = amount.substring(index + 1).length();
int len = amount.substring(index+1).length();
String amt = amount.replace(".", "");
if (len == 0) {
amountValue = Long.parseLong(amt + "00");
} else if (len == 1) {
amountValue = Long.parseLong(amt + "0");
String amt = amount.replace(".","");
if(len == 0){
amountValue = Long.parseLong(amt+"00");
} else if(len == 1){
amountValue = Long.parseLong(amt+"0");
} else {
amountValue = Long.parseLong(amt);
}
} else {
amountValue = Long.parseLong(amount + "00");
amountValue = Long.parseLong(amount+"00");
}
}
@ -73,15 +72,15 @@ public class POSUtil {
public long convertAmountQR(String amount) {
long amountValue = 0;
if (amount != null) {
if (amount.contains(",")) {
amount = amount.replace(",", "");
if (amount != null ) {
if(amount.contains(",")) {
amount = amount.replace(",","");
}
if (amount.contains(".")) {
if(amount.contains(".")) {
int index = amount.indexOf('.');
amount = amount.substring(0, index);
amount = amount.substring(0,index);
amountValue = Long.parseLong(amount);
} else {
@ -102,21 +101,21 @@ public class POSUtil {
SimpleDateFormat dfm = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss", Locale.getDefault());
String currentTime = dfm.format(new Date());
return currentTime.substring(0, 10) + " " + currentTime.substring(11, 19);
return currentTime.substring(0,10)+" "+currentTime.substring(11,19);
}
public String getCurrentDateTimeForQR() {
SimpleDateFormat dfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
String currentTime = dfm.format(new Date());
return currentTime.substring(0, 10) + " " + currentTime.substring(11, 19);
return currentTime.substring(0,10)+" "+currentTime.substring(11,19);
}
public String getCardNumMasking(String pan) {
if (pan != null) {
if(pan != null){
StringBuilder PAN = new StringBuilder(pan);
if (pan.length() > 12) {
PAN.replace(6, 12, "******");
PAN.replace(6,12,"******");
} else {
// PAN.append("*********");
PAN.append(" ");
@ -135,7 +134,7 @@ public class POSUtil {
public String getDecimalAmountFormat(long number) {
double decimalNumber = number / 100.0; // Divide by 100 to move decimal point two places to the left
return String.format(Locale.getDefault(), "%.2f", decimalNumber);
return String.format(Locale.getDefault(),"%.2f", decimalNumber);
// DecimalFormat formatter = new DecimalFormat("#,###.##");
// return formatter.format(amt);
}
@ -171,11 +170,7 @@ public class POSUtil {
}
public String formatAmount(long amount) {
return String.format(
Locale.US,
"%,.2f",
amount / 100.0
);
return String.format("%012d", amount);
}
public String responseCodeConverter(String responseCode) {
@ -189,13 +184,13 @@ public class POSUtil {
public String getCardType(PayDetail payDetail) {
int value = 0;
if (payDetail.getAccountType().equals(CardScheme.VISA.name)) {
if(payDetail.getAccountType().equals(CardScheme.VISA.name)) {
value = CardScheme.VISA.value;
} else if (payDetail.getAccountType().equals(CardScheme.MASTERCARD.name)) {
} else if(payDetail.getAccountType().equals(CardScheme.MASTERCARD.name)) {
value = CardScheme.MASTERCARD.value;
} else if (payDetail.getAccountType().equals(CardScheme.UPI.name)) {
} else if(payDetail.getAccountType().equals(CardScheme.UPI.name)) {
value = CardScheme.UPI.value;
} else if (payDetail.getAccountType().equals(CardScheme.MPU.name)) {
} else if(payDetail.getAccountType().equals(CardScheme.MPU.name)) {
value = CardScheme.MPU.value;
}
return String.valueOf(value);
@ -209,14 +204,14 @@ public class POSUtil {
value = "07";
} else if (AidlConstants.CardType.IC.getValue() == payDetail.getCardType()) { // IC
value = "05";
} else if (-9 == payDetail.getCardType()) { // Fallback
} else if (-9 == payDetail.getCardType()){ // Fallback
value = "08";
} else { // Hand-in card number
value = "01";
}
if (payDetail.getTransCVM() == TransCVM.OFFLINE_PIN) {
if(payDetail.getTransCVM() == TransCVM.OFFLINE_PIN) {
value += "9";
} else {
if (payDetail.getPINCipher() != null && !payDetail.getPINCipher().trim().isEmpty()) {
@ -238,7 +233,7 @@ public class POSUtil {
}
public String checkMinusSign(int transType) {
return (transType == TransactionsType.VOID.value || transType == TransactionsType.REFUND.value || transType == TransactionsType.PRE_AUTH_VOID.value || transType == TransactionsType.PRE_AUTH_COMPLETE_VOID.value) ? "-" : "";
return (transType == TransactionsType.VOID.value || transType == TransactionsType.REFUND.value || transType == TransactionsType.PRE_AUTH_VOID.value || transType == TransactionsType.PRE_AUTH_COMPLETE_VOID.value) ? "-":"";
}
public String getDecimalAmountVoidFormat(PayDetail payDetail) {
@ -247,23 +242,23 @@ public class POSUtil {
BigDecimal unscaled = new BigDecimal(payDetail.amount);
BigDecimal scaled = unscaled.scaleByPowerOfTen(-x);
double amounts = Double.parseDouble(scaled.toString());
return payDetail.getTransactionType() == TransactionsType.VOID.value || payDetail.getTransactionType() == TransactionsType.REFUND.value || payDetail.getTransactionType() == TransactionsType.WAVEPAY_REFUND.value ? "-" + formatter.format(amounts) : "" + formatter.format(amounts);
return payDetail.getTransactionType() == TransactionsType.VOID.value || payDetail.getTransactionType() == TransactionsType.REFUND.value || payDetail.getTransactionType() == TransactionsType.WAVEPAY_REFUND.value ? "-"+formatter.format(amounts) : ""+formatter.format(amounts);
}
public String getTransName(PayDetail payDetail) {
String name = "";
if (payDetail.getTransactionType() == 10) {
name = payDetail.transType.replace('_', ' ') + "(Reversal)";
if(payDetail.getTransactionType() == 10) {
name = payDetail.transType.replace('_',' ') + "(Reversal)";
} else {
name = payDetail.transType.replace('_', ' ');
name = payDetail.transType.replace('_',' ');
}
return name;
}
public int checkQRFailureTransaction(PayDetail payDetail) {
// return R.color.colorPrimarySmile;
if (payDetail.getTransactionType() == TransactionsType.WAVEPAY.value) {
if (payDetail.getQrTransStatus() == -1) {
if(payDetail.getTransactionType() == TransactionsType.WAVEPAY.value) {
if(payDetail.getQrTransStatus() == -1) {
return R.color.colorPrimarySmile;
} else {
return R.color.black;
@ -276,9 +271,9 @@ public class POSUtil {
public String getEntryType(int cardType) {
String entryType = "-";
if (AidlConstants.CardType.IC.getValue() == cardType) {
if(AidlConstants.CardType.IC.getValue() == cardType) {
entryType = "Chip";
} else if (AidlConstants.CardType.MAGNETIC.getValue() == cardType) {
} else if(AidlConstants.CardType.MAGNETIC.getValue() == cardType) {
entryType = "MagStripe";
} else if (AidlConstants.CardType.NFC.getValue() == cardType) {
entryType = "Wave";
@ -291,29 +286,29 @@ public class POSUtil {
public String interceptCardNo(String cardNo) {
if (cardNo != null) {
if (cardNo.isEmpty()) {
if(cardNo != null){
if(cardNo.isEmpty()) {
return "";
}
StringBuilder PAN = new StringBuilder(cardNo);
if (cardNo.length() > 12) {
PAN.replace(6, 12, "******");
PAN.replace(6,12,"******");
} else {
PAN.append("*********");
}
return PAN.toString();
} else {
}else {
return "";
}
}
public String checkStringViewBatch(TransMenu transMenu) {
return transMenu == TransMenu.SETTLEMENT ? "Confirm" : "Print Receipt";
return transMenu == TransMenu.SETTLEMENT ? "Confirm":"Print Receipt";
}
public boolean checkMerchantNameLength(String merchantName) {
if (!TextUtils.equals(merchantName, "")) {
if(!TextUtils.equals(merchantName,"")){
return merchantName.length() >= 15;
} else {
return false;
@ -329,29 +324,29 @@ public class POSUtil {
}
public String getFormatExpDate(String exp) {
if (exp != null) {
if(exp != null){
String EXP = "";
try {
EXP = exp.substring(2, 4) + "/";
EXP = EXP + exp.substring(0, 2);
try{
EXP = exp.substring(2,4)+"/";
EXP = EXP + exp.substring(0,2);
return EXP;
} catch (Exception e) {
}catch (Exception e){
e.printStackTrace();
return EXP;
}
} else {
}else {
return "";
}
}
public String checkCardName(PayDetail payDetail) {
if (payDetail != null) {
if(payDetail != null) {
if (payDetail.getTransactionType() == TransactionsType.WAVEPAY.value) {
if(payDetail.getTransactionType() == TransactionsType.WAVEPAY.value) {
return payDetail.getCustomerMobile().toUpperCase();
} else if (payDetail.getTransactionType() == TransactionsType.WAVEPAY_REFUND.value) {
} else if(payDetail.getTransactionType() == TransactionsType.WAVEPAY_REFUND.value) {
return "QR PAYMENT";
} else {
return payDetail.getAccountType();
@ -362,12 +357,12 @@ public class POSUtil {
}
public String checkRRNorTrnxId(PayDetail payDetail) {
if (payDetail != null) {
if(payDetail != null) {
if (payDetail.getTransactionType() == TransactionsType.WAVEPAY.value) {
if(payDetail.getTransactionType() == TransactionsType.WAVEPAY.value) {
return payDetail.getQrTransId();
} else if (payDetail.getTransactionType() == TransactionsType.WAVEPAY_REFUND.value) {
return payDetail.getReferNo() + "(RRN)";
} else if(payDetail.getTransactionType() == TransactionsType.WAVEPAY_REFUND.value) {
return payDetail.getReferNo()+"(RRN)";
} else {
return payDetail.getReferNo();
}
@ -377,9 +372,9 @@ public class POSUtil {
}
public String checkTraceOrInvoice(PayDetail payDetail) {
if (payDetail != null) {
if(payDetail != null) {
if (payDetail.getTransactionType() == TransactionsType.WAVEPAY.value || payDetail.getTransactionType() == TransactionsType.WAVEPAY_REFUND.value) {
if(payDetail.getTransactionType() == TransactionsType.WAVEPAY.value || payDetail.getTransactionType() == TransactionsType.WAVEPAY_REFUND.value) {
return payDetail.getInvoiceNo();
} else {
return payDetail.getVoucherNo();
@ -390,31 +385,31 @@ public class POSUtil {
}
public String getFormatExpDateDR(String exp) {
if (exp != null && !exp.isEmpty()) {
if(exp != null && !exp.isEmpty()){
String EXP = "";
try {
EXP = exp.substring(2, 4) + "/";
EXP = EXP + exp.substring(0, 2);
try{
EXP = exp.substring(2,4)+"/";
EXP = EXP + exp.substring(0,2);
return EXP;
} catch (Exception e) {
}catch (Exception e){
e.printStackTrace();
return EXP;
}
} else {
}else {
return "**/**";
}
}
public String getISOFormatExpDate(String exp) {
if (exp != null && !exp.isEmpty()) {
if (exp.length() != 5) {
if(exp != null && !exp.isEmpty()) {
if(exp.length() != 5 ) {
return "";
}
String expDate = "";
expDate = exp.substring(3, 5) + exp.substring(0, 2);
expDate = exp.substring(3,5)+exp.substring(0,2);
return expDate;
} else {
@ -423,7 +418,7 @@ public class POSUtil {
}
private String checkResultCode(String code) {
if (code.equals(Constant.ANSWER_CODE_ACCEPT) || code.equals(Constant.ANSWER_CODE_APPROVED)) {
if(code.equals(Constant.ANSWER_CODE_ACCEPT) || code.equals(Constant.ANSWER_CODE_APPROVED)){
return "Success";
} else {
return BaseErrorCode.getErrorMessage(code);
@ -432,10 +427,10 @@ public class POSUtil {
@SuppressLint("DefaultLocale")
public String checkResult(PayDetail payDetail) {
try {
if (payDetail.getTradeAnswerCode().equals("00") || payDetail.getTradeAnswerCode().equals("000")) {
try{
if(payDetail.getTradeAnswerCode().equals("00") || payDetail.getTradeAnswerCode().equals("000")){
if (payDetail.getTransactionType() == TransactionsType.SETTLEMENT.value) {
if(payDetail.getTransactionType() == TransactionsType.SETTLEMENT.value) {
return "Success";
}
/* if(payDetail.getAmount() != 0) {
@ -456,31 +451,32 @@ public class POSUtil {
String currencySign = SystemParamsOperation.getInstance().getCurrencyType().name;
if (payDetail.getTransactionType() == TransactionsType.VOID.value) {
return "Transaction for Amount \n" + getDecimalAmountFormat(payDetail.getAmount()) + " " + currencySign + " Voided.";
} else if (payDetail.getTransactionType() == TransactionsType.REFUND.value) {
return "Transaction for Amount \n" + getDecimalAmountFormat(payDetail.getAmount()) + " " + currencySign + " Refunded.";
} else if (payDetail.getTransactionType() == TransactionsType.PRE_AUTH_SALE.value) {
return "PreAuth for Amount \n" + getDecimalAmountFormat(payDetail.getAmount()) + " " + currencySign + " Approved.";
} else if (payDetail.getTransactionType() == TransactionsType.PRE_AUTH_VOID.value) {
return "PreAuth Cancel for Amount \n" + getDecimalAmountFormat(payDetail.getAmount()) + " " + currencySign + " Approved.";
} else if (payDetail.getTransactionType() == TransactionsType.PRE_AUTH_COMPLETE.value) {
return "PreAuth Complete for Amount \n" + getDecimalAmountFormat(payDetail.getAmount()) + " " + currencySign + " Approved.";
} else if (payDetail.getTransactionType() == TransactionsType.PRE_AUTH_COMPLETE_VOID.value) {
return "PreAuth Complete Cancel for Amount \n" + getDecimalAmountFormat(payDetail.getAmount()) + " " + currencySign + " Approved.";
} else if (payDetail.getTransactionType() == TransactionsType.CASH_OUT.value) {
if(payDetail.getTransactionType() == TransactionsType.VOID.value ) {
return "Transaction for Amount \n"+getDecimalAmountFormat(payDetail.getAmount()) +" "+currencySign+" Voided.";
} else if(payDetail.getTransactionType() == TransactionsType.REFUND.value) {
return "Transaction for Amount \n"+getDecimalAmountFormat(payDetail.getAmount()) +" "+currencySign+" Refunded.";
} else if(payDetail.getTransactionType() == TransactionsType.PRE_AUTH_SALE.value) {
return "PreAuth for Amount \n"+getDecimalAmountFormat(payDetail.getAmount()) +" "+currencySign+" Approved.";
} else if(payDetail.getTransactionType() == TransactionsType.PRE_AUTH_VOID.value) {
return "PreAuth Cancel for Amount \n"+getDecimalAmountFormat(payDetail.getAmount()) +" "+currencySign+" Approved.";
} else if(payDetail.getTransactionType() == TransactionsType.PRE_AUTH_COMPLETE.value) {
return "PreAuth Complete for Amount \n"+getDecimalAmountFormat(payDetail.getAmount()) +" "+currencySign+" Approved.";
} else if(payDetail.getTransactionType() == TransactionsType.PRE_AUTH_COMPLETE_VOID.value) {
return "PreAuth Complete Cancel for Amount \n"+getDecimalAmountFormat(payDetail.getAmount()) +" "+currencySign+" Approved.";
} else if(payDetail.getTransactionType() == TransactionsType.CASH_OUT.value) {
long totalAmount = payDetail.getAmount() + payDetail.getAdditionalAmount();
return "Transaction for Amount \n" + getDecimalAmountFormat(totalAmount) + " " + currencySign + " Received.";
} else {
return "Transaction for Amount \n" + getDecimalAmountFormat(payDetail.getAmount()) + " " + currencySign + " Received.";
return "Transaction for Amount \n"+getDecimalAmountFormat(totalAmount) +" "+currencySign+" Received.";
}
} else if (TextUtils.equals(payDetail.getAccountType(), "WALLET")) {
if (payDetail.getQrTransStatus() == 1) {
return "Transaction for Amount \n" + getDecimalAmountFormat(payDetail.getAmount()) + " MMK Received.";
} else if (payDetail.getQrTransStatus() == 3) {
else {
return "Transaction for Amount \n"+getDecimalAmountFormat(payDetail.getAmount()) +" "+currencySign+" Received.";
}
} else if(TextUtils.equals(payDetail.getAccountType(),"WALLET")) {
if(payDetail.getQrTransStatus() == 1) {
return "Transaction for Amount \n"+getDecimalAmountFormat(payDetail.getAmount()) +" MMK Received.";
} else if(payDetail.getQrTransStatus() == 3){
return "Declined \n COMMUNICATION ERROR";
} else if (payDetail.getQrTransStatus() == 2) {
if (isCurrentDateTimePassed(payDetail.getTransDate(), payDetail.getTransTime())) {
} else if(payDetail.getQrTransStatus() == 2) {
if(isCurrentDateTimePassed(payDetail.getTransDate(),payDetail.getTransTime())) {
return "Declined \n expire";
} else {
return "Declined \n payment credit in-progress";
@ -488,9 +484,9 @@ public class POSUtil {
} else {
// return "Transaction failed";
if (payDetail.getTransactionType() == TransactionsType.WAVEPAY_REFUND.value) {
if (payDetail.getTradeResultDes() != null && !payDetail.getTradeResultDes().isEmpty()) {
return "Declined \n " + payDetail.getTradeResultDes();
if(payDetail.getTransactionType() == TransactionsType.WAVEPAY_REFUND.value) {
if(payDetail.getTradeResultDes() != null && !payDetail.getTradeResultDes().isEmpty()) {
return "Declined \n "+payDetail.getTradeResultDes();
} else {
return "Declined \n transaction fail";
}
@ -500,19 +496,20 @@ public class POSUtil {
}
}
} else {
}
else {
return checkResultCode(payDetail.getTradeAnswerCode());
}
} catch (Exception e) {
} catch (Exception e){
e.printStackTrace();
return checkResultCode("");
}
}
public boolean checkBooleanResult(PayDetail payDetail) {
public boolean checkBooleanResult(PayDetail payDetail){
try {
return TextUtils.equals("00", payDetail.getTradeAnswerCode()) || TextUtils.equals("000", payDetail.getTradeAnswerCode()) || payDetail.getQrTransStatus() == 1;
return TextUtils.equals("00",payDetail.getTradeAnswerCode()) || TextUtils.equals("000",payDetail.getTradeAnswerCode()) || payDetail.getQrTransStatus() == 1;
} catch (Exception e) {
e.printStackTrace();
return false;
@ -522,7 +519,7 @@ public class POSUtil {
public Date getCurrentDate() {
String dateFormatPattern = "dd/MM/yy";
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern, Locale.getDefault());
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern,Locale.getDefault());
Date today = new Date();
String to = formatter.format(today);
@ -538,7 +535,7 @@ public class POSUtil {
public String getCurrentDateString() {
String dateFormatPattern = "dd/MM/yy";
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern, Locale.getDefault());
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern,Locale.getDefault());
Date today = new Date();
String to = formatter.format(today);
@ -549,7 +546,7 @@ public class POSUtil {
public Date getYesterdayDate() {
String dateFormatPattern = "dd/MM/yy";
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern, Locale.getDefault());
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern,Locale.getDefault());
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_YEAR, -1); // Subtract one day
@ -567,7 +564,7 @@ public class POSUtil {
public Date getLastInputDay(int num) {
String dateFormatPattern = "dd/MM/yy";
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern, Locale.getDefault());
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern,Locale.getDefault());
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_YEAR, -num); // Subtract one day
@ -585,7 +582,7 @@ public class POSUtil {
public Date getDateByString(String date) {
String dateFormatPattern = "dd/MM/yy";
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern, Locale.getDefault());
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern,Locale.getDefault());
Date outDate;
try {
@ -603,8 +600,8 @@ public class POSUtil {
public String convertDateFormatByDateString(String date) {
String dateFormatPattern = "dd/MM/yy";
String convertedDateFormat = "yyyy-MM-dd";
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern, Locale.getDefault());
SimpleDateFormat convertedFormatter = new SimpleDateFormat(convertedDateFormat, Locale.getDefault());
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern,Locale.getDefault());
SimpleDateFormat convertedFormatter = new SimpleDateFormat(convertedDateFormat,Locale.getDefault());
Date outDate;
try {
@ -612,7 +609,7 @@ public class POSUtil {
} catch (ParseException e) {
throw new RuntimeException(e);
}
if (outDate != null) {
if(outDate != null) {
return convertedFormatter.format(outDate);
} else {
return convertedDateFormat;
@ -620,13 +617,13 @@ public class POSUtil {
}
public Date getDateByTransDateTime(String transDate, String transTime) {
public Date getDateByTransDateTime(String transDate,String transTime) {
String dateFormatPattern = "dd/MM/yy HH:mm";
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern, Locale.getDefault());
SimpleDateFormat formatter = new SimpleDateFormat(dateFormatPattern,Locale.getDefault());
Date outDate;
try {
outDate = formatter.parse(transDate + " " + transTime);
outDate = formatter.parse(transDate+" "+transTime);
} catch (ParseException e) {
throw new RuntimeException(e);
}
@ -667,13 +664,13 @@ public class POSUtil {
// calendar.add(Calendar.DAY_OF_MONTH, 1);
// }
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yy HH:mm", Locale.getDefault());
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yy", Locale.getDefault());
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yy HH:mm",Locale.getDefault());
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yy",Locale.getDefault());
String formattedDateTime = format.format(calendar.getTime());
Date date;
try {
date = formatter.parse(formattedDateTime + " " + time);
date = formatter.parse(formattedDateTime+" "+time);
} catch (ParseException e) {
throw new RuntimeException(e);
}
@ -694,8 +691,8 @@ public class POSUtil {
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1; // Months are 0-based
int day = calendar.get(Calendar.DAY_OF_MONTH);
int hour = Integer.parseInt(time.substring(0, 2));
int minute = Integer.parseInt(time.substring(3, 5));
int hour = Integer.parseInt(time.substring(0,2));
int minute = Integer.parseInt(time.substring(3,5));
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month - 1);
@ -718,18 +715,17 @@ public class POSUtil {
}
return date;
}
public boolean checkBooleanCardNo(String cardNo) {
return !cardNo.equals("-");
}
public boolean checkNumberField(String amount) {
LogUtil.d(TAG, "checkNumberField :" + amount);
LogUtil.d(TAG,"checkNumberField :"+amount);
// String regex = "\\d+";
String regex = "^-?\\d+$";
LogUtil.d(TAG, "checkNumberField regex :" + amount.matches(regex));
LogUtil.d(TAG,"checkNumberField regex :"+amount.matches(regex));
return amount.equals(" ") || amount.equals("0") || amount.equals("") || !amount.matches(regex);
}
@ -737,10 +733,10 @@ public class POSUtil {
return approvalCode.equals(" ") || approvalCode.length() != 6;
}
public int checkVisibilityForConfirm(TransactionsType transactionsType) {
if (transactionsType == TransactionsType.REFUND) {
public int checkVisibilityForConfirm(TransactionsType transactionsType){
if(transactionsType == TransactionsType.REFUND) {
return 0;
} else if (transactionsType == TransactionsType.VOID) {
} else if(transactionsType == TransactionsType.VOID) {
return 8;
} else {
return 8;
@ -749,11 +745,11 @@ public class POSUtil {
public String formatTrace(String inputValue) {
int traceNo = 0;
if (!inputValue.equals("") && !inputValue.equals(" ")) {
if(!inputValue.equals("") && !inputValue.equals(" ")){
traceNo = Integer.parseInt(inputValue);
}
return String.format(Locale.getDefault(), "%06d", traceNo);
return String.format(Locale.getDefault(),"%06d",traceNo);
}
private boolean isOnlyDigit(String input) {
@ -765,8 +761,8 @@ public class POSUtil {
long convertedAmount = 0;
// need to check is contain decimal or not
if (amount != null && !amount.isEmpty() && isOnlyDigit(amount)) {
convertedAmount = Long.parseLong(amount + "00");
if(amount != null && !amount.isEmpty() && isOnlyDigit(amount)) {
convertedAmount = Long.parseLong(amount+"00");
}
return convertedAmount;
}
@ -776,22 +772,22 @@ public class POSUtil {
long minAmount = convertStringToLong(minAmountStr);
long maxAmount = convertStringToLong(maxAmountStr);
LogUtil.d(TAG, "Min amount :" + minAmountStr + " - " + minAmount);
LogUtil.d(TAG, "Max amount :" + maxAmountStr + " - " + maxAmount);
LogUtil.d(TAG, "Input amount :" + inputAmount + " - " + input);
LogUtil.d(TAG,"Min amount :"+minAmountStr+" - "+minAmount);
LogUtil.d(TAG,"Max amount :"+maxAmountStr+" - "+maxAmount);
LogUtil.d(TAG,"Input amount :"+inputAmount+" - "+input);
if (minAmount > input) {
if(minAmount > input) {
return InvalidAmount.BELOW;
} else if (maxAmount <= input) {
} else if(maxAmount <= input) {
return InvalidAmount.EXCEEDED;
} else {
return InvalidAmount.OKAY;
}
}
public boolean checkVoid(String configTime, String date, String time) {
public boolean checkVoid(String configTime,String date,String time) {
Date yesterday = POSUtil.getInstance().getYesterdayConfigDateTime(configTime);
Date transDateTime = POSUtil.getInstance().getDateByTransDateTime(date, time);
Date transDateTime = POSUtil.getInstance().getDateByTransDateTime(date,time);
Date configDate = POSUtil.getInstance().getDateTime(configTime);
@ -800,10 +796,10 @@ public class POSUtil {
Date current = new Date(System.currentTimeMillis());
if (transDate.compareTo(today) == 0) {
if(transDate.compareTo(today) == 0 ) {
// trans is today
if (current.compareTo(configDate) > 0) {
if(current.compareTo(configDate) > 0) {
// Trans is today ! config time is passed yet! can't do void!
// return transDateTime.compareTo(configDate) < 0;
return configDate.compareTo(transDateTime) < 0;
@ -816,7 +812,7 @@ public class POSUtil {
} else {
Date yest;
if (configTime.equals("00:00")) {
if(configTime.equals("00:00")) {
yest = configDate;
} else {
yest = yesterday;

View File

@ -781,11 +781,6 @@ public class SystemParamsOperation {
return params.isAutoPrintCustomerCopy();
}
public boolean isPrintErrorSlip() {
SystemParamsSettings params = getSystemParamsSettings();
return params.isPrintErrorSlip();
}
public boolean getManualEntryStatus() {
SystemParamsSettings params = getSystemParamsSettings();
return params.getManualEntryStatus();
@ -902,12 +897,6 @@ public class SystemParamsOperation {
saveSystemParamsSettings(params);
}
public void setPrintErrorSlip(boolean printErrorSlip) {
SystemParamsSettings params = getSystemParamsSettings();
params.setPrintErrorSlip(printErrorSlip);
saveSystemParamsSettings(params);
}
public void setReceiptHeader(String receiptHeader) {
SystemParamsSettings params = getSystemParamsSettings();
params.setReceiptHeader(receiptHeader);

View File

@ -172,8 +172,6 @@ public class SystemParamsSettings implements Serializable {
private boolean isAutoPrintCustomerCopy = false;
private boolean isPrintErrorSlip = false;
private boolean isRandomPinPad = false;
private boolean auto_update_status = true;
@ -422,10 +420,6 @@ public class SystemParamsSettings implements Serializable {
protected void setAutoPrintCustomerCopy(boolean flag) { this.isAutoPrintCustomerCopy = flag; }
protected boolean isPrintErrorSlip() { return isPrintErrorSlip; }
protected void setPrintErrorSlip(boolean flag) { this.isPrintErrorSlip = flag; }
protected boolean getWavePayInquiryStatus() {
return wave_pay_inquiry_status;
}