settlement fixed for e-receipt
This commit is contained in:
parent
6cd27b6482
commit
4a2a7fca67
@ -491,6 +491,7 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
showLoadingDialog("Sending Batch Upload...");
|
||||
break;
|
||||
case ON_SUCCESS:
|
||||
updateData();
|
||||
dismissLoadingDialog();
|
||||
networkCutOver();
|
||||
break;
|
||||
|
||||
@ -392,6 +392,12 @@ public class SettlementViewModel extends ViewModel {
|
||||
|
||||
}
|
||||
|
||||
if(isLast) {
|
||||
payDetail.setCurrencyCode("104");
|
||||
} else {
|
||||
payDetail.setCurrencyCode("840");
|
||||
}
|
||||
|
||||
// CA:CA - CD - FT
|
||||
payDetail.setBatchNo(SystemParamsOperation.getInstance().getCurrentBatchNum()); //for print receipt
|
||||
|
||||
|
||||
@ -160,11 +160,16 @@ public class EReceiptUtil {
|
||||
return request;
|
||||
}
|
||||
|
||||
private String getDecimalAmount(long amount) {
|
||||
double realAmount = amount / 100.0;
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
return df.format(realAmount);
|
||||
}
|
||||
|
||||
public EReceiptRequest generateMPUReceipt(PayDetail payDetail) {
|
||||
|
||||
double realAmount = payDetail.getAmount() / 100.0;
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
String amount = df.format(realAmount);
|
||||
|
||||
String amount = getDecimalAmount(payDetail.getAmount());
|
||||
|
||||
String currentTimeStamp = new java.text.SimpleDateFormat("MMddHHmmss", java.util.Locale.getDefault())
|
||||
.format(new java.util.Date());
|
||||
@ -178,26 +183,27 @@ public class EReceiptUtil {
|
||||
SettleData settleData = payDetail.getSettleDataObj();
|
||||
|
||||
long totalAmt = settleData.getSaleAmount() + settleData.getRefundAmount() + settleData.getPreAuthCompAmount() + settleData.getCashAdvanceAmount();
|
||||
double realTotalAmount = totalAmt / 100.0;
|
||||
String totalAmount = df.format(realTotalAmount);
|
||||
request.setDE4(totalAmount);
|
||||
|
||||
request.setDE4(getDecimalAmount(totalAmt));
|
||||
|
||||
|
||||
request.setDE63_01(settleData.getSaleCount() + "");
|
||||
request.setDE63_02(settleData.getSaleAmount() + "");
|
||||
request.setDE63_02(getDecimalAmount(settleData.getSaleAmount()));
|
||||
request.setDE63_03(settleData.getRefundCount() + "");
|
||||
request.setDE63_04(settleData.getRefundAmount() + "");
|
||||
request.setDE63_04(getDecimalAmount(settleData.getRefundAmount()));
|
||||
request.setDE63_05(settleData.getPreAuthCompCount() + "");
|
||||
request.setDE63_06(settleData.getPreAuthCompAmount() + "");
|
||||
request.setDE63_06(getDecimalAmount(settleData.getPreAuthCompAmount()));
|
||||
request.setDE63_07(settleData.getCashAdvanceCount() + "");
|
||||
request.setDE63_08(settleData.getCashAdvanceAmount() + "");
|
||||
request.setDE63_08(getDecimalAmount(settleData.getCashAdvanceAmount()));
|
||||
invoiceNo = SystemParamsOperation.getInstance().getIncrementInvoiceNum();
|
||||
request.setBatchNumber(batchNumber);
|
||||
request.setInvoiceNumber(invoiceNo);
|
||||
request.setDescription("success");
|
||||
request.setDE39("A");
|
||||
request.setDE37("0000");
|
||||
request.setDE49("MMK");
|
||||
request.setDE49(currencyCodeToText(payDetail.getCurrencyCode()));
|
||||
|
||||
|
||||
} else {
|
||||
request.setDE2(POSUtil.getInstance().getCardNumMasking(payDetail.getCardNo()));
|
||||
|
||||
@ -207,9 +213,9 @@ public class EReceiptUtil {
|
||||
request.setDE37(payDetail.getReferNo());
|
||||
request.setDE38(payDetail.getApprovalCode());
|
||||
// will check it later for currency code
|
||||
request.setDE49("MMK");
|
||||
request.setDE49(currencyCodeToText(payDetail.getCurrencyCode()));
|
||||
request.setInvoiceNumber(payDetail.getInvoiceNo());
|
||||
request.setCardLabel("MPU");
|
||||
request.setCardLabel(payDetail.getAccountType());
|
||||
|
||||
if (payDetail.getTradeAnswerCode().equals("000") || payDetail.getTradeAnswerCode().equals("00")) {
|
||||
|
||||
@ -279,6 +285,28 @@ public class EReceiptUtil {
|
||||
return request;
|
||||
}
|
||||
|
||||
private String currencyCodeToText(String currencyCode) {
|
||||
String currencyText = "MMK";
|
||||
switch (currencyCode) {
|
||||
case "840":
|
||||
currencyCode = "USD";
|
||||
break;
|
||||
case "156":
|
||||
currencyCode = "RMB";
|
||||
break;
|
||||
case "764":
|
||||
currencyCode = "THB";
|
||||
break;
|
||||
case "643":
|
||||
currencyCode = "RUB";
|
||||
break;
|
||||
default:
|
||||
currencyCode = "MMK";
|
||||
break;
|
||||
}
|
||||
return currencyCode;
|
||||
}
|
||||
|
||||
private static List<Transaction> buildTransactions(List<QRSettleData> qrSettleData) {
|
||||
List<Transaction> list = new ArrayList<>();
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import com.utsmyanmar.baselib.util.EReceiptHelper;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -21,6 +22,19 @@ public class GeneralTest {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecimalAmount() {
|
||||
long amount = 0L;
|
||||
String decimalAmount = getDecimalAmount(amount);
|
||||
System.out.println("amount :"+decimalAmount);
|
||||
}
|
||||
|
||||
private String getDecimalAmount(long amount) {
|
||||
double realAmount = amount / 100.0;
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
return df.format(realAmount);
|
||||
}
|
||||
|
||||
private static String generateSignature(String timestamp) {
|
||||
String secret = "y812J21lhha11OS";
|
||||
String bodyString = "{}";
|
||||
|
||||
@ -1,4 +1,27 @@
|
||||
[
|
||||
{
|
||||
"aidEnable": true,
|
||||
"aid": "A000000003",
|
||||
"cardScheme": "VISA",
|
||||
"applicationVersion": "0020",
|
||||
"emvDDOL": "9F3704",
|
||||
"emvTDOL": "9F3704",
|
||||
"partialAidSelection": false,
|
||||
"targetPercent": "99",
|
||||
"maxTargetPercent": "99",
|
||||
"threshold": "00000040",
|
||||
"tacDefault": "D84000A800",
|
||||
"tacOnline": "DC4004F800",
|
||||
"tacDenial": "0010000000",
|
||||
"floorLimit": "000000000000",
|
||||
"cvmLimit": 75000,
|
||||
"transLimit": "999999999999",
|
||||
"transLimitCDV": "999999999999",
|
||||
"terminalCapability": "0000000000000000",
|
||||
"riskManageData": "01",
|
||||
"cateCode": "2701",
|
||||
"currencyCode": "0104"
|
||||
},
|
||||
{
|
||||
"aidEnable": true,
|
||||
"aid": "A0000000031010",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user