amount, date, time fixed in Void Preview
This commit is contained in:
parent
46bf866de7
commit
66c969873e
@ -11,6 +11,9 @@
|
||||
|
||||
### version 3.4
|
||||
* disable display always on
|
||||
* auto-settlement
|
||||
* show expiry date as "**/**"
|
||||
*
|
||||
|
||||
[//]: # (* 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
|
||||
@ -50,7 +50,6 @@ 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
|
||||
@ -524,26 +523,3 @@ 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
|
||||
),
|
||||
)
|
||||
|
||||
@ -55,8 +55,6 @@ 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
|
||||
@ -447,11 +445,3 @@ fun DashboardScreen2(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
@P3Preview
|
||||
@P2Preview
|
||||
@Composable
|
||||
fun PreviewDashboardScreen2() {
|
||||
DashboardScreen2(dashboardUiState = DashboardUiState(previewTransactions))
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
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
|
||||
@ -138,8 +137,8 @@ private fun TransactionDetailsCard(transaction: PayDetail) {
|
||||
DetailRow("Card No", transaction.cardNo)
|
||||
DetailRow("Reference", transaction.referNo)
|
||||
DetailRow("Approval", transaction.approvalCode.orEmpty())
|
||||
DetailRow("Date", transaction.tradeDate)
|
||||
DetailRow("Time", transaction.tradeTime)
|
||||
DetailRow("Date", transaction.transDate)
|
||||
DetailRow("Time", transaction.transTime)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 NAME: " + firstLineName + "\n", innerResultCallback);
|
||||
sunmiPrinterService.printText("CARD HOLDER : " + firstLineName + "\n", innerResultCallback);
|
||||
// sunmiPrinterService.printColumnsString(new String[]{"CARD HOLDER NAME:", firstLineName}, new int[]{2, 2}, new int[]{0, 1}, innerResultCallback);
|
||||
}
|
||||
if(!secondLineName.isEmpty()) {
|
||||
|
||||
@ -38,32 +38,33 @@ 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");
|
||||
}
|
||||
|
||||
}
|
||||
@ -72,15 +73,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 {
|
||||
@ -101,21 +102,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(" ");
|
||||
@ -134,7 +135,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);
|
||||
}
|
||||
@ -170,7 +171,11 @@ public class POSUtil {
|
||||
}
|
||||
|
||||
public String formatAmount(long amount) {
|
||||
return String.format("%012d", amount);
|
||||
return String.format(
|
||||
Locale.US,
|
||||
"%,.2f",
|
||||
amount / 100.0
|
||||
);
|
||||
}
|
||||
|
||||
public String responseCodeConverter(String responseCode) {
|
||||
@ -184,13 +189,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);
|
||||
@ -204,14 +209,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()) {
|
||||
@ -233,7 +238,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) {
|
||||
@ -242,23 +247,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;
|
||||
@ -271,9 +276,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";
|
||||
@ -286,29 +291,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;
|
||||
@ -324,29 +329,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();
|
||||
@ -357,12 +362,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();
|
||||
}
|
||||
@ -372,9 +377,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();
|
||||
@ -385,31 +390,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 {
|
||||
@ -418,7 +423,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);
|
||||
@ -427,10 +432,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) {
|
||||
@ -451,32 +456,31 @@ 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.";
|
||||
return "Transaction for Amount \n" + getDecimalAmountFormat(totalAmount) + " " + currencySign + " Received.";
|
||||
} else {
|
||||
return "Transaction for Amount \n" + getDecimalAmountFormat(payDetail.getAmount()) + " " + currencySign + " Received.";
|
||||
}
|
||||
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){
|
||||
} 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";
|
||||
@ -484,9 +488,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";
|
||||
}
|
||||
@ -496,20 +500,19 @@ 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;
|
||||
@ -519,7 +522,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);
|
||||
@ -535,7 +538,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);
|
||||
@ -546,7 +549,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
|
||||
@ -564,7 +567,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
|
||||
@ -582,7 +585,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 {
|
||||
@ -600,8 +603,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 {
|
||||
@ -609,7 +612,7 @@ public class POSUtil {
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if(outDate != null) {
|
||||
if (outDate != null) {
|
||||
return convertedFormatter.format(outDate);
|
||||
} else {
|
||||
return convertedDateFormat;
|
||||
@ -617,13 +620,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);
|
||||
}
|
||||
@ -664,13 +667,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);
|
||||
}
|
||||
@ -691,8 +694,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);
|
||||
@ -715,17 +718,18 @@ 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);
|
||||
}
|
||||
|
||||
@ -733,10 +737,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;
|
||||
@ -745,11 +749,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) {
|
||||
@ -761,8 +765,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;
|
||||
}
|
||||
@ -772,22 +776,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);
|
||||
|
||||
@ -796,10 +800,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;
|
||||
@ -812,7 +816,7 @@ public class POSUtil {
|
||||
|
||||
} else {
|
||||
Date yest;
|
||||
if(configTime.equals("00:00")) {
|
||||
if (configTime.equals("00:00")) {
|
||||
yest = configDate;
|
||||
} else {
|
||||
yest = yesterday;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user