Compare commits
No commits in common. "ccebba6ba7dcd0ce0aa0b091fc2f82287e0ac9a3" and "adbd0724af63d9942dc62d80d2c19fe6aeea43db" have entirely different histories.
ccebba6ba7
...
adbd0724af
@ -26,8 +26,6 @@ import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
|||||||
import com.utsmm.kbz.util.DecimalDigitsInputFilter;
|
import com.utsmm.kbz.util.DecimalDigitsInputFilter;
|
||||||
import com.utsmm.kbz.util.TransactionUtil;
|
import com.utsmm.kbz.util.TransactionUtil;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
|
|
||||||
|
|
||||||
public class QRRefundDetailFragment extends DataBindingFragment {
|
public class QRRefundDetailFragment extends DataBindingFragment {
|
||||||
|
|
||||||
@ -45,8 +43,6 @@ public class QRRefundDetailFragment extends DataBindingFragment {
|
|||||||
private EditText etReferenceNo, etOriginalAmount, etRefundAmount, etRefundReason;
|
private EditText etReferenceNo, etOriginalAmount, etRefundAmount, etRefundReason;
|
||||||
private LinearLayout originalAmountLayout, refundAmountLayout;
|
private LinearLayout originalAmountLayout, refundAmountLayout;
|
||||||
|
|
||||||
private String originalRefundAmount;
|
|
||||||
|
|
||||||
private boolean isPartialRefund = false;
|
private boolean isPartialRefund = false;
|
||||||
|
|
||||||
|
|
||||||
@ -126,10 +122,6 @@ public class QRRefundDetailFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initData() {
|
private void initData() {
|
||||||
double realAmount = payDetail.getAmount() / 100.0;
|
|
||||||
DecimalFormat df = new DecimalFormat("0.00");
|
|
||||||
originalRefundAmount = df.format(realAmount);
|
|
||||||
|
|
||||||
payDetail = TransactionUtil.getInstance().initWalletTransaction(TransactionsType.MMQR_REFUND);
|
payDetail = TransactionUtil.getInstance().initWalletTransaction(TransactionsType.MMQR_REFUND);
|
||||||
payDetail.setInvoiceNo(SystemParamsOperation.getInstance().getIncrementInvoiceNum());
|
payDetail.setInvoiceNo(SystemParamsOperation.getInstance().getIncrementInvoiceNum());
|
||||||
|
|
||||||
@ -152,8 +144,8 @@ public class QRRefundDetailFragment extends DataBindingFragment {
|
|||||||
} else {
|
} else {
|
||||||
// Hide amount fields for original refund
|
// Hide amount fields for original refund
|
||||||
isPartialRefund = false;
|
isPartialRefund = false;
|
||||||
originalAmountLayout.setVisibility(View.VISIBLE);
|
originalAmountLayout.setVisibility(View.GONE);
|
||||||
refundAmountLayout.setVisibility(View.VISIBLE);
|
refundAmountLayout.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -170,8 +162,6 @@ public class QRRefundDetailFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
String referenceNo = etReferenceNo.getText().toString().trim();
|
String referenceNo = etReferenceNo.getText().toString().trim();
|
||||||
String refundReason = etRefundReason.getText().toString().trim();
|
String refundReason = etRefundReason.getText().toString().trim();
|
||||||
String originalAmountStr = etOriginalAmount.getText().toString().trim();
|
|
||||||
String refundAmountStr = etRefundAmount.getText().toString().trim();
|
|
||||||
|
|
||||||
// Validate reference number
|
// Validate reference number
|
||||||
if (referenceNo.isEmpty()) {
|
if (referenceNo.isEmpty()) {
|
||||||
@ -181,8 +171,8 @@ public class QRRefundDetailFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
if (isPartialRefund) {
|
if (isPartialRefund) {
|
||||||
// Partial refund validation
|
// Partial refund validation
|
||||||
// String originalAmountStr = etOriginalAmount.getText().toString().trim();
|
String originalAmountStr = etOriginalAmount.getText().toString().trim();
|
||||||
// String refundAmountStr = etRefundAmount.getText().toString().trim();
|
String refundAmountStr = etRefundAmount.getText().toString().trim();
|
||||||
|
|
||||||
if (originalAmountStr.isEmpty()) {
|
if (originalAmountStr.isEmpty()) {
|
||||||
kPayViewModel.invalidAmountMsg.setValue("Enter original amount");
|
kPayViewModel.invalidAmountMsg.setValue("Enter original amount");
|
||||||
@ -217,16 +207,12 @@ public class QRRefundDetailFragment extends DataBindingFragment {
|
|||||||
kPayViewModel.setQrRefund(qrRefund);
|
kPayViewModel.setQrRefund(qrRefund);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// String originalAmountStr = etOriginalAmount.getText().toString().trim();
|
QRRefund qrRefund = new QRRefund(referenceNo, "0", etOriginalAmount.getText().toString().trim(), refundReason);
|
||||||
// String refundAmountStr = etRefundAmount.getText().toString().trim();
|
|
||||||
|
|
||||||
QRRefund qrRefund = new QRRefund(referenceNo, refundAmountStr, originalRefundAmount, refundReason);
|
|
||||||
|
|
||||||
kPayViewModel.setQrRefund(qrRefund);
|
kPayViewModel.setQrRefund(qrRefund);
|
||||||
}
|
}
|
||||||
sharedViewModel.transactionsType.setValue(TransactionsType.MMQR_REFUND);
|
sharedViewModel.transactionsType.setValue(TransactionsType.MMQR_REFUND);
|
||||||
kPayViewModel.setPayDetail(payDetail);
|
kPayViewModel.setPayDetail(payDetail);
|
||||||
// sharedViewModel.amount.setValue(refundAmountStr);
|
|
||||||
routeId = R.id.action_qrRefundDetail_inputPasswordFragment;
|
routeId = R.id.action_qrRefundDetail_inputPasswordFragment;
|
||||||
safeNavigateToRouteId();
|
safeNavigateToRouteId();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -127,7 +127,7 @@ public class QRRefundProcessFragment extends DataBindingFragment {
|
|||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(
|
.subscribe(
|
||||||
response -> {
|
response -> {
|
||||||
handleRefundResponse(response, referenceNo, originalAmount);
|
handleRefundResponse(response, referenceNo);
|
||||||
},
|
},
|
||||||
throwable -> {
|
throwable -> {
|
||||||
LogUtil.e(TAG, "Refund error: " + throwable.getMessage());
|
LogUtil.e(TAG, "Refund error: " + throwable.getMessage());
|
||||||
@ -141,12 +141,14 @@ public class QRRefundProcessFragment extends DataBindingFragment {
|
|||||||
refundDisposable.add(refundDi);
|
refundDisposable.add(refundDi);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRefundResponse(KPayRefund.RefundResponse response, String referenceNo, String orgAmount) {
|
private void handleRefundResponse(KPayRefund.RefundResponse response, String referenceNo) {
|
||||||
if (response != null && response.getResponse() != null && "REFUND_SUCCESS".equalsIgnoreCase(response.getResponse().getRefundStatus())) {
|
if (response != null && response.getResponse() != null && "REFUND_SUCCESS".equalsIgnoreCase(response.getResponse().getRefundStatus())) {
|
||||||
LogUtil.d(TAG, "Refund successful!");
|
LogUtil.d(TAG, "Refund successful!");
|
||||||
|
|
||||||
String refundAmount = response.getResponse().getRefundAmount();
|
String refundAmount = response.getResponse().getRefundAmount();
|
||||||
|
Log.d(TAG, "refund amount -> " + refundAmount);
|
||||||
long text = POSUtil.getInstance().convertAmount(refundAmount);
|
long text = POSUtil.getInstance().convertAmount(refundAmount);
|
||||||
|
Log.d(TAG, "refund amount but long -> " + text);
|
||||||
|
|
||||||
String dateTime = SystemDateTime.getTodayDateFormat() + " " + SystemDateTime.getTodayTimeFormat();
|
String dateTime = SystemDateTime.getTodayDateFormat() + " " + SystemDateTime.getTodayTimeFormat();
|
||||||
payDetail.setTC(response.getResponse().getRefundStatus());
|
payDetail.setTC(response.getResponse().getRefundStatus());
|
||||||
@ -183,7 +185,6 @@ public class QRRefundProcessFragment extends DataBindingFragment {
|
|||||||
if (response != null && response.getResponse() != null && response.getResponse().getMsg() != null) {
|
if (response != null && response.getResponse() != null && response.getResponse().getMsg() != null) {
|
||||||
errorMsg = response.getResponse().getMsg();
|
errorMsg = response.getResponse().getMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
payDetail.setTradeResultDes(errorMsg);
|
payDetail.setTradeResultDes(errorMsg);
|
||||||
EReceiptRequest request = EReceiptUtil.getInstance().generateQRRefundReceipt(
|
EReceiptRequest request = EReceiptUtil.getInstance().generateQRRefundReceipt(
|
||||||
"0",
|
"0",
|
||||||
@ -195,7 +196,7 @@ public class QRRefundProcessFragment extends DataBindingFragment {
|
|||||||
TransResultStatus.FAIL
|
TransResultStatus.FAIL
|
||||||
);
|
);
|
||||||
sharedViewModel.pushReceipt(request);
|
sharedViewModel.pushReceipt(request);
|
||||||
sharedViewModel.amount.setValue(orgAmount);
|
|
||||||
sharedViewModel.payDetail.setValue(payDetail);
|
sharedViewModel.payDetail.setValue(payDetail);
|
||||||
navigateToNext();
|
navigateToNext();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -819,8 +819,6 @@ public abstract class BaseXPrint {
|
|||||||
print2ColumnsString("Refund Total:MMK", PrintUtils.getInstance().getSeparatorOnlyNumberFormat(refundTotal));
|
print2ColumnsString("Refund Total:MMK", PrintUtils.getInstance().getSeparatorOnlyNumberFormat(refundTotal));
|
||||||
dashBreak();
|
dashBreak();
|
||||||
print2ColumnsString("Sale Total :MMK", PrintUtils.getInstance().getSeparatorOnlyNumberFormat(totalAmount));
|
print2ColumnsString("Sale Total :MMK", PrintUtils.getInstance().getSeparatorOnlyNumberFormat(totalAmount));
|
||||||
dashBreak();
|
|
||||||
print2ColumnsString("Grand Total :MMK", PrintUtils.getInstance().getSeparatorOnlyNumberFormat(totalAmount - refundTotal));
|
|
||||||
dashBreakEnding();
|
dashBreakEnding();
|
||||||
// emptyLine(2);
|
// emptyLine(2);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user