Compare commits
3 Commits
22d6066933
...
b8bfd5d1a7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8bfd5d1a7 | ||
|
|
ed304217ec | ||
|
|
b87f987466 |
32
AGENT.MD
Normal file
32
AGENT.MD
Normal file
@ -0,0 +1,32 @@
|
||||
# Ponytail, lazy senior dev mode
|
||||
|
||||
You are a lazy senior developer. Lazy means efficient, not careless. The best code is the code never written.
|
||||
|
||||
Before writing any code, stop at the first rung that holds:
|
||||
|
||||
1. Does this need to be built at all? (YAGNI)
|
||||
2. Does it already exist in this codebase? Reuse the helper, util, or pattern that's already here, don't re-write it.
|
||||
3. Does the standard library already do this? Use it.
|
||||
4. Does a native platform feature cover it? Use it.
|
||||
5. Does an already-installed dependency solve it? Use it.
|
||||
6. Can this be one line? Make it one line.
|
||||
7. Only then: write the minimum code that works.
|
||||
|
||||
The ladder runs after you understand the problem, not instead of it: read the task and the code it touches, trace the real flow end to end, then climb.
|
||||
|
||||
Bug fix = root cause, not symptom: a report names a symptom. Grep every caller of the function you touch and fix the shared function once — one guard there is a smaller diff than one per caller, and patching only the path the ticket names leaves a sibling caller still broken.
|
||||
|
||||
Rules:
|
||||
|
||||
- No abstractions that weren't explicitly requested.
|
||||
- No new dependency if it can be avoided.
|
||||
- No boilerplate nobody asked for.
|
||||
- Deletion over addition. Boring over clever. Fewest files possible.
|
||||
- Shortest working diff wins, but only once you understand the problem. The smallest change in the wrong place isn't lazy, it's a second bug.
|
||||
- Question complex requests: "Do you actually need X, or does Y cover it?"
|
||||
- Pick the edge-case-correct option when two stdlib approaches are the same size, lazy means less code, not the flimsier algorithm.
|
||||
- Mark intentional simplifications with a `ponytail:` comment. If the shortcut has a known ceiling (global lock, O(n²) scan, naive heuristic), the comment names the ceiling and the upgrade path.
|
||||
|
||||
Not lazy about: understanding the problem (read it fully and trace the real flow before picking a rung, a small diff you don't understand is just laziness dressed up as efficiency), input validation at trust boundaries, error handling that prevents data loss, security, accessibility, the calibration real hardware needs (the platform is never the spec ideal, a clock drifts, a sensor reads off), anything explicitly requested. Lazy code without its check is unfinished: non-trivial logic leaves ONE runnable check behind, the smallest thing that fails if the logic breaks (an assert-based demo/self-check or one small test file; no frameworks, no fixtures). Trivial one-liners need no test.
|
||||
|
||||
(Yes, this file also applies to agents working on the ponytail repo itself. Especially to them.)
|
||||
18
CHANGELOG.md
18
CHANGELOG.md
@ -16,3 +16,21 @@
|
||||
- But can auto enable when password is correct in function tab
|
||||
- **Void Fixed**
|
||||
- Void transaction fixed
|
||||
|
||||
## [2.34] - 29-05-2026
|
||||
- **General**
|
||||
- Settlement fix for qr records missing after Card settlement run
|
||||
- fixed receipt printing loop for auto settlement
|
||||
-
|
||||
- **MMQR Refund**
|
||||
- new auto-retry when MMQR status is "REFUNDING" in response
|
||||
- no more fail records on refund list if "DUPLICATED" response
|
||||
- removed "CANCEL" records in MMQR History
|
||||
-
|
||||
- **CARD Payments**
|
||||
- signature saved in pos device
|
||||
- signature re-show on re-printing receipt
|
||||
- signature re-show on void
|
||||
- signature re-show on refund
|
||||
- pre-auth, pre-auth can, pre-auth com s' manual entry flow are changed
|
||||
- can show/hide manual entry in all transactions
|
||||
@ -14,8 +14,8 @@ android {
|
||||
applicationId "com.utsmm.kbz"
|
||||
minSdk 24
|
||||
targetSdk 33
|
||||
versionCode 36
|
||||
versionName "2.31"
|
||||
versionCode 41
|
||||
versionName "2.36"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
||||
@ -162,6 +162,7 @@ public class MainActivity extends AppCompatActivity implements
|
||||
// SystemParamsOperation.getInstance().setEReceiptAddress("https://api-tms-uat.kbzbank.com:8443/receipt");
|
||||
SystemParamsOperation.getInstance().setTmsAddress("https://sirius-nest.utsmyanmar.com/api/v1");
|
||||
SystemParamsOperation.getInstance().setEReceiptAddress("https://receipt-nest.utsmyanmar.com");
|
||||
// SystemParamsOperation.getInstance().setEReceiptAddress("https://receipt-nest.utsmyanmar.com");
|
||||
|
||||
PinPad pinPad = MyApplication.getInstance().deviceEngine.getPinPad();
|
||||
byte[] encryptedPIK = SystemParamsOperation.getInstance().getPIK();
|
||||
|
||||
@ -345,6 +345,8 @@ public class ProcessingFragment extends DataBindingFragment {
|
||||
handleAfterTransaction();
|
||||
break;
|
||||
case SUCCESS:
|
||||
// sharedViewModel.pushReceipt(buildEReceiptCardReceipt(payDetail, true, BaseErrorCode.getCode(payDetail.getTradeAnswerCode())));
|
||||
// handleAfterTransaction();
|
||||
if(requiresSignature()){
|
||||
handleAfterTransaction();
|
||||
}else{
|
||||
|
||||
@ -7,6 +7,7 @@ import android.util.Log;
|
||||
import android.widget.ListView;
|
||||
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
@ -196,12 +197,13 @@ public class SharedViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setEmvTrans(boolean status) {
|
||||
isEmv.setValue(status);
|
||||
}
|
||||
|
||||
public SingleLiveEvent<Boolean> isEmvTrans() { return isEmv;}
|
||||
public SingleLiveEvent<Boolean> isEmvTrans() {
|
||||
return isEmv;
|
||||
}
|
||||
|
||||
private PayDetail getPayDetail() {
|
||||
return mPayDetail;
|
||||
@ -231,8 +233,14 @@ public class SharedViewModel extends ViewModel {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setPrintReceiptMsg(String msg) { this.printReceiptMsg.setValue(msg);}
|
||||
public void postPrintReceiptMsg(String msg) { this.printReceiptMsg.postValue(msg);}
|
||||
public void setPrintReceiptMsg(String msg) {
|
||||
this.printReceiptMsg.setValue(msg);
|
||||
}
|
||||
|
||||
public void postPrintReceiptMsg(String msg) {
|
||||
this.printReceiptMsg.postValue(msg);
|
||||
}
|
||||
|
||||
public void setPrintStatus(PrintStatus printStatus) {
|
||||
// this.printStatus.postValue(printStatus);
|
||||
if (Looper.myLooper() == Looper.getMainLooper()) {
|
||||
@ -242,36 +250,67 @@ public class SharedViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
}
|
||||
public void postPrintStatus(PrintStatus printStatus) { this.printStatus.postValue(printStatus); }
|
||||
|
||||
public SingleLiveEvent<PrintStatus> getPrintStatus() { return this.printStatus; }
|
||||
public void postPrintStatus(PrintStatus printStatus) {
|
||||
this.printStatus.postValue(printStatus);
|
||||
}
|
||||
|
||||
public void setIsFallback(boolean status) { isFallback.setValue(status);}
|
||||
public SingleLiveEvent<PrintStatus> getPrintStatus() {
|
||||
return this.printStatus;
|
||||
}
|
||||
|
||||
public SingleLiveEvent<Boolean> getIsFallback() { return isFallback;}
|
||||
public void setIsFallback(boolean status) {
|
||||
isFallback.setValue(status);
|
||||
}
|
||||
|
||||
public void setIsCardAppBlock(boolean status) { isCardAppBlock.setValue(status);}
|
||||
public SingleLiveEvent<Boolean> getIsFallback() {
|
||||
return isFallback;
|
||||
}
|
||||
|
||||
public SingleLiveEvent<Boolean> getIsCardAppBlock() {return isCardAppBlock;}
|
||||
public void setIsCardAppBlock(boolean status) {
|
||||
isCardAppBlock.setValue(status);
|
||||
}
|
||||
|
||||
public void setIsSeePhone(boolean status) { isSeePhone.setValue(status);}
|
||||
public SingleLiveEvent<Boolean> getIsCardAppBlock() {
|
||||
return isCardAppBlock;
|
||||
}
|
||||
|
||||
public SingleLiveEvent<Boolean> getIsSeePhone() { return isSeePhone;}
|
||||
public void setIsSeePhone(boolean status) {
|
||||
isSeePhone.setValue(status);
|
||||
}
|
||||
|
||||
public void setIsContactlessRestricted(boolean status) { isContactlessRestricted.setValue(status);}
|
||||
public SingleLiveEvent<Boolean> getIsSeePhone() {
|
||||
return isSeePhone;
|
||||
}
|
||||
|
||||
public SingleLiveEvent<Boolean> getIsContactlessRestricted() {return isContactlessRestricted;}
|
||||
public void setIsContactlessRestricted(boolean status) {
|
||||
isContactlessRestricted.setValue(status);
|
||||
}
|
||||
|
||||
public void setCardDataExist(boolean exist) { _isCardDataExist.setValue(exist);}
|
||||
public SingleLiveEvent<Boolean> getIsContactlessRestricted() {
|
||||
return isContactlessRestricted;
|
||||
}
|
||||
|
||||
public SingleLiveEvent<Boolean> getCardDataExist() { return _isCardDataExist; }
|
||||
public void setCardDataExist(boolean exist) {
|
||||
_isCardDataExist.setValue(exist);
|
||||
}
|
||||
|
||||
public void setAmountExist(boolean exist) { _isAmountExist.setValue(exist);}
|
||||
public SingleLiveEvent<Boolean> getCardDataExist() {
|
||||
return _isCardDataExist;
|
||||
}
|
||||
|
||||
public SingleLiveEvent<Boolean> getAmountExist() { return _isAmountExist; }
|
||||
public void setAmountExist(boolean exist) {
|
||||
_isAmountExist.setValue(exist);
|
||||
}
|
||||
|
||||
public SingleLiveEvent<Boolean> getAmountExist() {
|
||||
return _isAmountExist;
|
||||
}
|
||||
|
||||
|
||||
public MutableLiveData<Boolean> getManualEntryStatus() { return _manualEntryStatus;}
|
||||
public MutableLiveData<Boolean> getManualEntryStatus() {
|
||||
return _manualEntryStatus;
|
||||
}
|
||||
|
||||
public void setManualEntryStatus(boolean status) {
|
||||
_manualEntryStatus.setValue(status);
|
||||
@ -289,11 +328,18 @@ public class SharedViewModel extends ViewModel {
|
||||
return _successFragmentMsg;
|
||||
}
|
||||
|
||||
public void set_currencyText(String msg) { this._currencyText.setValue(msg);}
|
||||
public void set_currencyText(String msg) {
|
||||
this._currencyText.setValue(msg);
|
||||
}
|
||||
|
||||
public SingleLiveEvent<String> get_currencyText() { return _currencyText; }
|
||||
public SingleLiveEvent<String> get_currencyText() {
|
||||
return _currencyText;
|
||||
}
|
||||
|
||||
public void set_successFragmentMsg(String msg) {
|
||||
this._successFragmentMsg.setValue(msg);
|
||||
}
|
||||
|
||||
public void set_successFragmentMsg(String msg) { this._successFragmentMsg.setValue(msg);}
|
||||
public SingleLiveEvent<TransMenu> getTransMenu() {
|
||||
return _transMenu;
|
||||
}
|
||||
@ -331,10 +377,10 @@ public class SharedViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
if(isMerchantCopy) {
|
||||
if (isMerchantCopy) {
|
||||
|
||||
if(!SystemParamsOperation.getInstance().getDemoStatus()) {
|
||||
if(SystemParamsOperation.getInstance().getPrintISOStatus()) {
|
||||
if (!SystemParamsOperation.getInstance().getDemoStatus()) {
|
||||
if (SystemParamsOperation.getInstance().getPrintISOStatus()) {
|
||||
PrintXReceipt.getInstance().printSmileISoReceipt(payDetail.getValue());
|
||||
}
|
||||
}
|
||||
@ -348,7 +394,7 @@ public class SharedViewModel extends ViewModel {
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
LogUtil.d(TAG,"Print Status Result Failure!");
|
||||
LogUtil.d(TAG, "Print Status Result Failure!");
|
||||
printXStatus.postValue(PrintStatus.EMPTY_PAPER_ROLL);
|
||||
printReceiptButtons.postValue(0);
|
||||
}
|
||||
@ -356,36 +402,34 @@ public class SharedViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void startPrintReceipt(boolean isFirstPrint) {
|
||||
/*
|
||||
* First Print is Merchant Copy..
|
||||
* */
|
||||
|
||||
if(payDetail.getValue() != null) {
|
||||
if (payDetail.getValue() != null) {
|
||||
setPayDetail(payDetail.getValue());
|
||||
}
|
||||
|
||||
LogUtil.d(TAG,"PayDetail trade Answer Code :"+getPayDetail().getTradeAnswerCode());
|
||||
LogUtil.d(TAG, "PayDetail trade Answer Code :" + getPayDetail().getTradeAnswerCode());
|
||||
|
||||
LogUtil.d(TAG,"PayDetail trade Answer Code :"+payDetail.getValue().getTradeAnswerCode());
|
||||
LogUtil.d(TAG, "PayDetail trade Answer Code :" + payDetail.getValue().getTradeAnswerCode());
|
||||
|
||||
PrintXReceipt.getInstance().printSmileReceipt(getPayDetail(), isFirstPrint, new PrintXStatus() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
if(isFirstPrint) {
|
||||
if (isFirstPrint) {
|
||||
|
||||
if(!SystemParamsOperation.getInstance().getDemoStatus()) {
|
||||
if(SystemParamsOperation.getInstance().getPrintISOStatus()) {
|
||||
if (!SystemParamsOperation.getInstance().getDemoStatus()) {
|
||||
if (SystemParamsOperation.getInstance().getPrintISOStatus()) {
|
||||
PrintXReceipt.getInstance().printSmileISoReceipt(getPayDetail());
|
||||
}
|
||||
}
|
||||
|
||||
postPrintStatus(PrintStatus.FIRST_PRINT_DONE);
|
||||
|
||||
if(isEcr.getValue() != null &&
|
||||
if (isEcr.getValue() != null &&
|
||||
isEcr.getValue() &&
|
||||
SystemParamsOperation.getInstance().isAutoPrintCustomerCopy()) {
|
||||
printReceiptButtons.postValue(8);
|
||||
@ -400,7 +444,7 @@ public class SharedViewModel extends ViewModel {
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
LogUtil.d(TAG,"Print Status Result Failure!");
|
||||
LogUtil.d(TAG, "Print Status Result Failure!");
|
||||
if (isFirstPrint) {
|
||||
setPrintStatus(PrintStatus.EMPTY_PAPER_ROLL_FIRST);
|
||||
} else {
|
||||
@ -412,10 +456,9 @@ public class SharedViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public void startPrintProcess() {
|
||||
LogUtil.d(TAG,"Print status :"+getPrintStatus().getValue());
|
||||
LogUtil.d(TAG, "Print status :" + getPrintStatus().getValue());
|
||||
switch (getPrintStatus().getValue()) {
|
||||
case FIRST_PRINT:
|
||||
|
||||
@ -439,8 +482,8 @@ public class SharedViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
public void startPrintSettlement(PrintXStatus printXStatus) {
|
||||
if(payDetail.getValue() == null) return;
|
||||
if(payDetail.getValue().getTransactionType() == TransactionsType.SETTLEMENT.value) {
|
||||
if (payDetail.getValue() == null) return;
|
||||
if (payDetail.getValue().getTransactionType() == TransactionsType.SETTLEMENT.value) {
|
||||
startPrintProcessSettlement(printXStatus);
|
||||
} else {
|
||||
startPrintProcessQRSettlement(printXStatus);
|
||||
@ -449,16 +492,15 @@ public class SharedViewModel extends ViewModel {
|
||||
|
||||
public void startPrintProcessSettlement(PrintXStatus printXStatus) {
|
||||
|
||||
if(payDetail.getValue() == null) return;
|
||||
if (payDetail.getValue() == null) return;
|
||||
|
||||
PrintXReceipt.getInstance().printSmileSettlementReport(payDetail.getValue(),printXStatus);
|
||||
PrintXReceipt.getInstance().printSmileSettlementReport(payDetail.getValue(), printXStatus);
|
||||
}
|
||||
|
||||
private void startPrintProcessQRSettlement(PrintXStatus printXStatus) {
|
||||
|
||||
|
||||
|
||||
if(payDetail.getValue() == null && payDetails.getValue() == null) return;
|
||||
if (payDetail.getValue() == null && payDetails.getValue() == null) return;
|
||||
|
||||
PrintXReceipt.getInstance().printQRSettlementReport(payDetail.getValue(), QRSettleData.convertFromPayDetail(payDetails.getValue()), printXStatus);
|
||||
}
|
||||
@ -469,7 +511,6 @@ public class SharedViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public LiveData<PayDetail> getReversalTransaction(String voucherNo) {
|
||||
return repository.getReversalTransaction(voucherNo);
|
||||
}
|
||||
@ -482,7 +523,7 @@ public class SharedViewModel extends ViewModel {
|
||||
return repository.getAllReversalTransactions();
|
||||
}
|
||||
|
||||
public void updatePayDetail(PayDetail payDetail){
|
||||
public void updatePayDetail(PayDetail payDetail) {
|
||||
repository.updatePayDetail(payDetail);
|
||||
}
|
||||
|
||||
@ -490,10 +531,12 @@ public class SharedViewModel extends ViewModel {
|
||||
repository.updateESignBlob(voucherNo, blob);
|
||||
}
|
||||
|
||||
public void insertPayDetail(PayDetail payDetail) { repository.insertPayDetail(payDetail); }
|
||||
public void insertPayDetail(PayDetail payDetail) {
|
||||
repository.insertPayDetail(payDetail);
|
||||
}
|
||||
|
||||
|
||||
public void enableCardStatusIcon(boolean tapCard,boolean tapDevice,boolean insertCard, boolean swipeCard) {
|
||||
public void enableCardStatusIcon(boolean tapCard, boolean tapDevice, boolean insertCard, boolean swipeCard) {
|
||||
tapCardStatus.setValue(tapCard ? 1 : 0);
|
||||
tapDeviceStatus.setValue(tapDevice ? 1 : 0);
|
||||
insertCardStatus.setValue(insertCard ? 1 : 0);
|
||||
@ -502,14 +545,14 @@ public class SharedViewModel extends ViewModel {
|
||||
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void pushReceipt(Object body){
|
||||
public void pushReceipt(Object body) {
|
||||
Log.d("push receipt", new Gson().toJson(body));
|
||||
repository.sendReceipt(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
response -> {
|
||||
Log.d("E-Receipt", "Success =>"+ response.getMessage());
|
||||
Log.d("E-Receipt", "Success =>" + response.getMessage());
|
||||
postToastMsg("E-Receipt saved successfully");
|
||||
},
|
||||
error -> {
|
||||
@ -569,7 +612,7 @@ public class SharedViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void printTerminalHostConfigs(){
|
||||
public void printTerminalHostConfigs() {
|
||||
PrintXReceipt.getInstance().printTerminalHostConfig(new PrintXStatus() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
@ -328,7 +328,6 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
settlementViewModel.pre_breakdown.setValue(buildBreakdownText(mmkBucket.preCount, mmkBucket.preAmount, usdBucket.preCount, usdBucket.preAmount));
|
||||
settlementViewModel.refund_breakdown.setValue(buildBreakdownText(mmkBucket.refundCount, mmkBucket.refundAmount, usdBucket.refundCount, usdBucket.refundAmount));
|
||||
settlementViewModel.ca_breakdown.setValue(buildBreakdownText(mmkBucket.caCount, mmkBucket.caAmount, usdBucket.caCount, usdBucket.caAmount));
|
||||
|
||||
if(sharedViewModel.getTransMenu().getValue() == TransMenu.REVIEW_BATCH) {
|
||||
SettleData settleData = new SettleData(saleCount,saleAmount,preCount,preAmount,refundCount,refundAmount,caCount,caAmount);
|
||||
TradeData tradeData = Params.newTrade(false);
|
||||
@ -384,6 +383,11 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
}
|
||||
}
|
||||
|
||||
private String buildBreakdownText(int mmkCount, long mmkAmount, int usdCount, long usdAmount) {
|
||||
return "MMK " + mmkCount + " / " + POSUtil.getInstance().getDecimalAmountSeparatorFormat(mmkAmount)
|
||||
+ " USD " + usdCount + " / " + POSUtil.getInstance().getDecimalAmountSeparatorFormat(usdAmount);
|
||||
}
|
||||
|
||||
private CurrencyBucket getCurrencyBucket(String currencyCode) {
|
||||
return "USD".equals(normalizeCurrency(currencyCode)) ? usdBucket : mmkBucket;
|
||||
}
|
||||
@ -431,11 +435,6 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
}
|
||||
}
|
||||
|
||||
private String buildBreakdownText(int mmkCount, long mmkAmount, int usdCount, long usdAmount) {
|
||||
return "MMK " + mmkCount + " / " + POSUtil.getInstance().getDecimalAmountSeparatorFormat(mmkAmount)
|
||||
+ " USD " + usdCount + " / " + POSUtil.getInstance().getDecimalAmountSeparatorFormat(usdAmount);
|
||||
}
|
||||
|
||||
private String normalizeCurrency(String currencyCode) {
|
||||
if (currencyCode == null) {
|
||||
return "MMK";
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
<domain includeSubdomains="true">api-uat.kbzpay.com</domain>
|
||||
<domain includeSubdomains="true">sirius-nest.utsmyanmar.com</domain>
|
||||
<domain includeSubdomains="true">192.168.10.105</domain>
|
||||
<domain includeSubdomains="true">192.168.10.104</domain>
|
||||
</domain-config>
|
||||
|
||||
<domain-config cleartextTrafficPermitted="true">
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 33,
|
||||
"versionName": "2.13-uat",
|
||||
"versionCode": 41,
|
||||
"versionName": "2.36-uat",
|
||||
"outputFile": "app-uat-release.apk"
|
||||
}
|
||||
],
|
||||
|
||||
@ -327,11 +327,11 @@ public class DatabaseModule {
|
||||
}
|
||||
};
|
||||
|
||||
static final Migration MIGRATION_13_14 = new Migration(14, 15) {
|
||||
static final Migration MIGRATION_13_14 = new Migration(13, 14) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase database) {
|
||||
database.execSQL("ALTER TABLE paydetail "
|
||||
+ " ADD COLUMN eSignBlob BLOB");
|
||||
database.execSQL("ALTER TABLE paydetail ADD COLUMN eSignBlob BLOB");
|
||||
database.execSQL("ALTER TABLE paydetail ADD COLUMN eSignBase64 TEXT");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ public class EmvParamOperation extends ParamOperation{
|
||||
processPayWave();
|
||||
processPayPass();
|
||||
processQuickPass();
|
||||
processJSpeedy();
|
||||
// processJSpeedy();
|
||||
processMPUCtls();
|
||||
processChips();
|
||||
processRids();
|
||||
|
||||
@ -44,8 +44,10 @@ import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
@ -137,10 +139,9 @@ public class Repository {
|
||||
public Observable<EReceiptResponse> sendReceiptWithImage(EReceiptCardRequest request, byte[] imageBytes) {
|
||||
String apiSecret = BuildConfig.ERECEIPT_SECRET;
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
request.setDE115(null);
|
||||
String bodyString = new Gson().toJson(request);
|
||||
String bodyString = buildMultipartSignaturePayload(request);
|
||||
String dataToHash = bodyString + apiSecret + timestamp;
|
||||
LogUtil.d("HTTP", dataToHash);
|
||||
// LogUtil.d("HTTP", dataToHash);
|
||||
String apiKey = EReceiptHelper.sha256(dataToHash);
|
||||
|
||||
Map<String, RequestBody> fields = buildFormFields(request);
|
||||
@ -153,6 +154,40 @@ public class Repository {
|
||||
return eReceiptApiService.sendReceiptMultipart(timestamp, apiKey, fields, imagePart);
|
||||
}
|
||||
|
||||
private String buildMultipartSignaturePayload(EReceiptCardRequest request) {
|
||||
Map<String, String> flatBody = new LinkedHashMap<>();
|
||||
putIfNotEmpty(flatBody, "DE2", request.getDE2());
|
||||
putIfNotEmpty(flatBody, "DE3", request.getDE3());
|
||||
putIfNotEmpty(flatBody, "DE4", request.getDE4());
|
||||
putIfNotEmpty(flatBody, "DE7", request.getDE7());
|
||||
putIfNotEmpty(flatBody, "DE11", request.getDE11());
|
||||
putIfNotEmpty(flatBody, "DE14", request.getDE14());
|
||||
putIfNotEmpty(flatBody, "DE22", request.getDE22());
|
||||
putIfNotEmpty(flatBody, "DE37", request.getDE37());
|
||||
putIfNotEmpty(flatBody, "DE38", request.getDE38());
|
||||
putIfNotEmpty(flatBody, "DE39", request.getDE39());
|
||||
putIfNotEmpty(flatBody, "DE41", request.getDE41());
|
||||
putIfNotEmpty(flatBody, "DE42", request.getDE42());
|
||||
putIfNotEmpty(flatBody, "DE43", request.getDE43());
|
||||
putIfNotEmpty(flatBody, "DE48", request.getDE48());
|
||||
putIfNotEmpty(flatBody, "DE49", request.getDE49());
|
||||
putIfNotEmpty(flatBody, "DE55", request.getDE55());
|
||||
putIfNotEmpty(flatBody, "appId", request.getAppId());
|
||||
putIfNotEmpty(flatBody, "batchNumber", request.getBatchNumber());
|
||||
putIfNotEmpty(flatBody, "cardLabel", request.getCardLabel());
|
||||
putIfNotEmpty(flatBody, "description", request.getDescription());
|
||||
putIfNotEmpty(flatBody, "invoiceNumber", request.getInvoiceNumber());
|
||||
putIfNotEmpty(flatBody, "serial", request.getSerial());
|
||||
|
||||
return new Gson().toJson(new TreeMap<>(flatBody));
|
||||
}
|
||||
|
||||
private void putIfNotEmpty(Map<String, String> map, String key, String value) {
|
||||
if (value != null && !value.trim().isEmpty()) {
|
||||
map.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, RequestBody> buildFormFields(EReceiptCardRequest request) {
|
||||
Map<String, RequestBody> map = new HashMap<>();
|
||||
putField(map, "DE2", request.getDE2());
|
||||
|
||||
@ -530,7 +530,7 @@
|
||||
"currencyCode": "0104"
|
||||
},
|
||||
{
|
||||
"aidEnable": true,
|
||||
"aidEnable": false,
|
||||
"aid": "A00000006510",
|
||||
"cardScheme": "JCB",
|
||||
"applicationVersion": "0200",
|
||||
@ -553,7 +553,7 @@
|
||||
"currencyCode": "0104"
|
||||
},
|
||||
{
|
||||
"aidEnable": true,
|
||||
"aidEnable": false,
|
||||
"aid": "A0000000651010",
|
||||
"cardScheme": "JCB",
|
||||
"applicationVersion": "0200",
|
||||
@ -576,7 +576,7 @@
|
||||
"currencyCode": "0104"
|
||||
},
|
||||
{
|
||||
"aidEnable": true,
|
||||
"aidEnable": false,
|
||||
"aid": "A0000001570040",
|
||||
"cardScheme": "JCB",
|
||||
"applicationVersion": "0200",
|
||||
|
||||
@ -214,31 +214,16 @@ public abstract class BaseXPrint {
|
||||
|
||||
protected void printTransDetailSettlement(PayDetail payDetail) {
|
||||
SettleData settleData = payDetail.getSettleDataObj();
|
||||
List<CardSettleData> cardSettleDataList = payDetail.getCardSettleData();
|
||||
CurrencySettlementSummary mmkSummary = new CurrencySettlementSummary();
|
||||
CurrencySettlementSummary usdSummary = new CurrencySettlementSummary();
|
||||
|
||||
if (cardSettleDataList != null && !cardSettleDataList.isEmpty()) {
|
||||
for (CardSettleData cardSettleData : cardSettleDataList) {
|
||||
CurrencySettlementSummary summary = "USD".equals(normalizeSettlementCurrency(cardSettleData.getCurrencyCode())) ? usdSummary : mmkSummary;
|
||||
applyCardSettlementSummary(summary, cardSettleData);
|
||||
}
|
||||
} else {
|
||||
mmkSummary.saleCount = settleData.getSaleCount();
|
||||
mmkSummary.saleAmount = settleData.getSaleAmount();
|
||||
mmkSummary.preAuthCompCount = settleData.getPreAuthCompCount();
|
||||
mmkSummary.preAuthCompAmount = settleData.getPreAuthCompAmount();
|
||||
mmkSummary.refundCount = settleData.getRefundCount();
|
||||
mmkSummary.refundAmount = settleData.getRefundAmount();
|
||||
mmkSummary.cashAdvanceCount = settleData.getCashAdvanceCount();
|
||||
mmkSummary.cashAdvanceAmount = settleData.getCashAdvanceAmount();
|
||||
}
|
||||
|
||||
printSettlementCurrencySection("MMK", mmkSummary);
|
||||
if (usdSummary.hasAnyValue()) {
|
||||
emptyLine(1);
|
||||
printSettlementCurrencySection("USD", usdSummary);
|
||||
}
|
||||
print3ColumnsString("TRX TYPE ", "CNT", "AMOUNT");
|
||||
print3ColumnsString("SALE ", countStringFormat(settleData.getSaleCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getSaleAmount(), SystemParamsOperation.getInstance().getDecimalEnable()));
|
||||
print3ColumnsString("VOID SALE ", countStringFormat(settleData.getVoidSaleCount()), "- " + PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getVoidSaleAmount(), SystemParamsOperation.getInstance().getDecimalEnable()));
|
||||
print3ColumnsString("PREAUTH COMP ", countStringFormat(settleData.getPreAuthCompCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getPreAuthCompAmount(), SystemParamsOperation.getInstance().getDecimalEnable()));
|
||||
print3ColumnsString("CASH ADV ", countStringFormat(settleData.getCashAdvanceCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getCashAdvanceAmount(), SystemParamsOperation.getInstance().getDecimalEnable()));
|
||||
print3ColumnsString("REFUND ", countStringFormat(settleData.getRefundCount()), "- " + PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getRefundAmount(), SystemParamsOperation.getInstance().getDecimalEnable()));
|
||||
dotBreak();
|
||||
long totalAmount = settleData.getSaleAmount() + settleData.getPreAuthCompAmount() + settleData.getCashAdvanceAmount()
|
||||
- settleData.getVoidSaleAmount() - settleData.getRefundAmount();
|
||||
print3ColumnsString("TOTAL ", "", PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, SystemParamsOperation.getInstance().getDecimalEnable()));
|
||||
|
||||
emptyLine(2);
|
||||
}
|
||||
|
||||
@ -192,12 +192,7 @@ public class PrintXImpl extends BaseXPrint implements PrintX {
|
||||
printLogo();
|
||||
printMerchantHeader();
|
||||
printTransHeader(payDetail);
|
||||
List<com.utsmyanmar.paylibs.model.CardSettleData> cardSettleDataList = payDetail.getCardSettleData();
|
||||
if (cardSettleDataList != null && !cardSettleDataList.isEmpty()) {
|
||||
printTransDetailSettlement(payDetail, cardSettleDataList);
|
||||
} else {
|
||||
printTransDetailSettlement(payDetail);
|
||||
}
|
||||
printTransDetailSettlement(payDetail);
|
||||
// printTransFooterSummary();
|
||||
printTransFooterForSettlement();
|
||||
|
||||
|
||||
@ -46,6 +46,7 @@ public class SystemParamsSettings implements Serializable {
|
||||
// private String ereceiptAddress = "https://api-tms-uat.kbzbank.com:8443/receipt";
|
||||
private String tmsAddress = "https://sirius-nest.utsmyanmar.com/api/v1";
|
||||
private String ereceiptAddress = "https://receipt-nest.utsmyanmar.com";
|
||||
// private String ereceiptAddress = "http://192.168.10.104:3003";
|
||||
|
||||
private String binValues = "";
|
||||
private String restrictedBinValues = "";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user