auto settlement completed
This commit is contained in:
parent
b5f174ff54
commit
dd265c1fa8
@ -4,6 +4,7 @@ import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.NavController;
|
||||
import androidx.navigation.NavDestination;
|
||||
@ -453,27 +454,59 @@ public class MainActivity extends AppCompatActivity implements
|
||||
private void handleAutoSettlementIntent(Intent intent) {
|
||||
if (intent == null) return;
|
||||
|
||||
// Handle regular auto settlement
|
||||
boolean auto = intent.getBooleanExtra("AUTO_SETTLEMENT", false);
|
||||
if (auto) {
|
||||
boolean hasPOS = intent.getBooleanExtra("AUTO_SETTLEMENT", false);
|
||||
boolean hasQR = intent.getBooleanExtra("AUTO_QR_SETTLEMENT", false);
|
||||
|
||||
if (hasPOS) {
|
||||
PayDetail payDetail = (PayDetail) intent.getSerializableExtra("EXTRA_PAY_DETAIL");
|
||||
if (payDetail != null) {
|
||||
|
||||
sharedViewModel.payDetail.setValue(payDetail);
|
||||
sharedViewModel.transactionsType.setValue(TransactionsType.SETTLEMENT);
|
||||
sharedViewModel.setAmount(POSUtil.getInstance().getDecimalAmountSeparatorFormat(payDetail.getAmount()));
|
||||
|
||||
try {
|
||||
navController.navigate(R.id.transactionResultFragment);
|
||||
} catch (Exception e) {
|
||||
LogUtil.e(TAG, "Navigation error: " + e.getMessage());
|
||||
}
|
||||
|
||||
// If QR also exists, trigger it AFTER POS result is done
|
||||
if (hasQR) {
|
||||
navigateToQRSettlementAfterPOS(intent);
|
||||
}
|
||||
} else {
|
||||
// POS had no data, go straight to QR if available
|
||||
if (hasQR) {
|
||||
handleQRSettlement(intent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle QR auto settlement
|
||||
boolean autoQR = intent.getBooleanExtra("AUTO_QR_SETTLEMENT", false);
|
||||
if (autoQR) {
|
||||
} else if (hasQR) {
|
||||
// Only QR settlement, no POS
|
||||
handleQRSettlement(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private void navigateToQRSettlementAfterPOS(Intent intent) {
|
||||
// Observe transactionResultFragment's completion via ViewModel
|
||||
// When POS result screen signals "done" (print complete / user dismissed),
|
||||
// then navigate to QR result
|
||||
sharedViewModel.onSettlementResultDone.observe(this, new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onChanged(Boolean done) {
|
||||
if (done != null && done) {
|
||||
// Remove observer so it only fires once
|
||||
sharedViewModel.onSettlementResultDone.removeObserver(this);
|
||||
// Reset flag
|
||||
sharedViewModel.onSettlementResultDone.postValue(false);
|
||||
// Now navigate to QR
|
||||
handleQRSettlement(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleQRSettlement(Intent intent) {
|
||||
int qrSaleCount = intent.getIntExtra("QR_SALE_COUNT", 0);
|
||||
long qrSaleAmount = intent.getLongExtra("QR_SALE_AMOUNT", 0L);
|
||||
int qrRefundCount = intent.getIntExtra("QR_REFUND_COUNT", 0);
|
||||
@ -481,7 +514,6 @@ public class MainActivity extends AppCompatActivity implements
|
||||
long totalAmount = intent.getLongExtra("QR_TOTAL_AMOUNT", 0L);
|
||||
List<PayDetail> qrTransList = (List<PayDetail>) intent.getSerializableExtra("QR_TRANS_LIST");
|
||||
|
||||
// Create QR settlement PayDetail
|
||||
SettleData settleData = new SettleData(
|
||||
qrSaleCount, qrSaleAmount, 0, 0L, qrRefundCount, qrRefundAmount, 0, 0L);
|
||||
|
||||
@ -493,7 +525,6 @@ public class MainActivity extends AppCompatActivity implements
|
||||
payDetail.setAmount(totalAmount);
|
||||
payDetail.setTradeAnswerCode("000");
|
||||
|
||||
|
||||
sharedViewModel.setAmount(POSUtil.getInstance().getDecimalAmountSeparatorFormat(totalAmount));
|
||||
sharedViewModel.payDetails.setValue(qrTransList);
|
||||
sharedViewModel.payDetail.setValue(payDetail);
|
||||
@ -505,7 +536,6 @@ public class MainActivity extends AppCompatActivity implements
|
||||
LogUtil.e(TAG, "QR Auto Settlement navigation error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
@ -20,6 +20,7 @@ import com.google.gson.Gson;
|
||||
import com.utsmm.kbz.MainActivity;
|
||||
|
||||
import com.utsmm.kbz.util.EReceiptUtil;
|
||||
import com.utsmm.kbz.util.enums.TransactionStatus;
|
||||
import com.utsmyanmar.baselib.network.model.e_receipt.EReceiptRequest;
|
||||
import com.utsmyanmar.baselib.repo.Repository;
|
||||
import com.utsmm.kbz.BuildConfig;
|
||||
@ -34,6 +35,8 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import retrofit2.HttpException;
|
||||
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.batch_upload.BatchListener;
|
||||
import com.utsmyanmar.paylibs.batch_upload.BatchUploadProcess;
|
||||
import com.utsmyanmar.paylibs.isobuilder.ISOMode;
|
||||
import com.utsmyanmar.paylibs.isobuilder.builderx.ISOMsgX;
|
||||
import com.utsmyanmar.paylibs.isobuilder.builderx.ISOVersion;
|
||||
@ -44,6 +47,8 @@ import com.utsmyanmar.paylibs.model.SettleData;
|
||||
import com.utsmyanmar.paylibs.model.TradeData;
|
||||
import com.utsmyanmar.paylibs.network.ISOCallback;
|
||||
import com.utsmyanmar.paylibs.network.ISOSocket;
|
||||
import com.utsmyanmar.paylibs.sign_on.EchoTestProcess;
|
||||
import com.utsmyanmar.paylibs.sign_on.SignOnListener;
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
import com.utsmyanmar.paylibs.utils.MessageType;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
@ -74,14 +79,25 @@ public class AutoSettleService extends Service {
|
||||
private boolean regularSettlementCompleted = false;
|
||||
private boolean qrSettlementCompleted = false;
|
||||
|
||||
// Observers to keep reference for cleanup
|
||||
private Observer<java.util.List<com.utsmyanmar.paylibs.model.PayDetail>> regularSettlementObserver;
|
||||
private Observer<java.util.List<com.utsmyanmar.paylibs.model.PayDetail>> qrSettlementObserver;
|
||||
private boolean posHasData = false; // true = POS actually ran and has result
|
||||
private boolean qrHasData = false; // true = QR actually ran and has result
|
||||
|
||||
// Observers to keep reference for cleanup
|
||||
private Observer<List<PayDetail>> regularSettlementObserver;
|
||||
private Observer<List<PayDetail>> qrSettlementObserver;
|
||||
|
||||
private int i = 0;
|
||||
|
||||
private boolean flag = false;
|
||||
@Inject
|
||||
Repository repository;
|
||||
|
||||
private PayDetail pendingPayDetail = null;
|
||||
private Bundle pendingQrData = null;
|
||||
|
||||
private boolean posSettlementReady = false;
|
||||
private boolean qrSettlementReady = false;
|
||||
ArrayList<PayDetail> payDetails = new ArrayList<>();
|
||||
|
||||
public static final String NOTIFICATION_CHANNEL_ID = "10001";
|
||||
private final static String default_notification_channel_id = "default";
|
||||
@ -188,6 +204,10 @@ public class AutoSettleService extends Service {
|
||||
if (regularSettlementCompleted) {
|
||||
return;
|
||||
}
|
||||
|
||||
payDetails.clear();
|
||||
payDetails.addAll(list);
|
||||
|
||||
regularSettlementCompleted = true;
|
||||
|
||||
repository.getSettlementPOS().removeObserver(this);
|
||||
@ -225,7 +245,13 @@ public class AutoSettleService extends Service {
|
||||
String bitmap = BitmapConfig.BPC_SETTLEMENT;
|
||||
payDetail.setTransType(TransactionsType.SETTLEMENT.name);
|
||||
payDetail.setTransactionType(TransactionType.SETTLEMENT);
|
||||
if(!flag) {
|
||||
payDetail.setProcessCode(TransactionsType.SETTLEMENT.processCode);
|
||||
} else {
|
||||
bitmap = BitmapConfig.BPC_SETTLEMENT_TRAILER;
|
||||
payDetail.setProcessCode("910000");
|
||||
}
|
||||
|
||||
payDetail.setBatchNo(SystemParamsOperation.getInstance().getCurrentBatchNum());
|
||||
|
||||
SettleData settleData = new SettleData(
|
||||
@ -245,6 +271,14 @@ public class AutoSettleService extends Service {
|
||||
} else {
|
||||
settlementData = "C" + String.format(Locale.getDefault(), "%012d", totalAmount);
|
||||
}
|
||||
|
||||
if(totalAmount == 0 && (saleCount == 0 || preCount == 0 || refundCount == 0 || caCount == 0)) {
|
||||
posSettlementReady = true;
|
||||
posHasData = false;
|
||||
checkAndLaunch();
|
||||
checkIfBothSettlementsComplete();
|
||||
return;
|
||||
}
|
||||
payDetail.setSettleData(settlementData);
|
||||
payDetail.setAmount(totalAmount);
|
||||
|
||||
@ -269,7 +303,7 @@ public class AutoSettleService extends Service {
|
||||
if (TextUtils.equals(resultStr, Constant.ANSWER_CODE_ACCEPT) || TextUtils.equals(resultStr, Constant.ANSWER_CODE_APPROVED)) {
|
||||
payDetail.setIsNeedReversal(false);
|
||||
} else if (TextUtils.equals(resultStr, "95") || TextUtils.equals(resultStr, "095")) {
|
||||
payDetail.setIsNeedReversal(true);
|
||||
payDetail.setIsNeedReversal(!flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -284,34 +318,25 @@ public class AutoSettleService extends Service {
|
||||
public void onComplete() {
|
||||
LogUtil.d(TAG, "Auto settlement transaction completed successfully");
|
||||
|
||||
if (list != null && !list.isEmpty()) {
|
||||
if(payDetail.getIsNeedReversal()) {
|
||||
flag = true;
|
||||
batchUploadProcess();
|
||||
} else {
|
||||
|
||||
flag = false;
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
for (PayDetail p : list) {
|
||||
repository.deletePayDetail(p);
|
||||
}
|
||||
}
|
||||
repository.insertPayDetail(payDetail);
|
||||
|
||||
try {
|
||||
PayDetail cleanPayDetail = new PayDetail();
|
||||
cleanPayDetail.setTransType(payDetail.getTransType());
|
||||
cleanPayDetail.setTransactionType(payDetail.getTransactionType());
|
||||
cleanPayDetail.setProcessCode(payDetail.getProcessCode());
|
||||
cleanPayDetail.setBatchNo(payDetail.getBatchNo());
|
||||
cleanPayDetail.setSettleData(payDetail.getSettleData());
|
||||
cleanPayDetail.setAmount(payDetail.getAmount());
|
||||
cleanPayDetail.setTradeAnswerCode(payDetail.getTradeAnswerCode());
|
||||
cleanPayDetail.setIsNeedReversal(payDetail.getIsNeedReversal());
|
||||
networkCutOver(payDetail);
|
||||
|
||||
// Use notification-based approach to reliably launch the app
|
||||
launchAppWithSettlementResult("AUTO_SETTLEMENT", cleanPayDetail, null);
|
||||
|
||||
} catch (Exception e) {
|
||||
LogUtil.e(TAG, "Error launching app with settlement result: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
checkIfBothSettlementsComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -319,6 +344,41 @@ public class AutoSettleService extends Service {
|
||||
repository.getSettlementPOS().observeForever(regularSettlementObserver);
|
||||
}
|
||||
|
||||
private void batchUploadProcess() {
|
||||
|
||||
if(payDetails == null || payDetails.isEmpty()){
|
||||
regularSettlementCompleted = false;
|
||||
performSettlement();
|
||||
return;
|
||||
}
|
||||
|
||||
PayDetail payDetail = payDetails.get(i);
|
||||
TradeData tradeData = new TradeData();
|
||||
tradeData.setPayDetail(payDetail);
|
||||
BatchUploadProcess.getInstance().enqueue(tradeData).startBatchUpload(new BatchListener() {
|
||||
@Override
|
||||
public void onSuccessBatch() {
|
||||
|
||||
if (i < payDetails.size() - 1) {
|
||||
LogUtil.d(TAG, "Pay detail Size:" + payDetails.size());
|
||||
LogUtil.d(TAG, "Count value:" + i);
|
||||
i++;
|
||||
batchUploadProcess();
|
||||
} else {
|
||||
regularSettlementCompleted = false;
|
||||
performSettlement();
|
||||
}
|
||||
|
||||
LogUtil.e(TAG, "Batch Upload Success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailBatch() {
|
||||
LogUtil.e(TAG, "Batch Upload Fail");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void performQRSettlement() {
|
||||
if (qrSettlementCompleted) {
|
||||
return;
|
||||
@ -365,6 +425,9 @@ public class AutoSettleService extends Service {
|
||||
}
|
||||
} catch (IllegalStateException e) {
|
||||
LogUtil.e(TAG, "QR Auto Settlement: Database cursor error - likely due to large data size: " + e);
|
||||
qrSettlementReady = true;
|
||||
qrHasData = false;
|
||||
checkAndLaunch();
|
||||
checkIfBothSettlementsComplete();
|
||||
return;
|
||||
}
|
||||
@ -422,19 +485,24 @@ public class AutoSettleService extends Service {
|
||||
qrData.putLong("QR_TOTAL_AMOUNT", totalAmount);
|
||||
qrData.putSerializable("QR_TRANS_LIST", qrTransactionsList);
|
||||
// Use notification-based approach to reliably launch the app
|
||||
launchAppWithSettlementResult("AUTO_QR_SETTLEMENT", null, qrData);
|
||||
pendingQrData = qrData;
|
||||
qrHasData = true;
|
||||
// launchAppWithSettlementResult("AUTO_QR_SETTLEMENT", null, qrData,false);
|
||||
|
||||
} catch (Exception e) {
|
||||
LogUtil.e(TAG, "Error launching app for QR settlement: " + e.getMessage());
|
||||
qrHasData = false;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
LogUtil.d(TAG, "QR Auto Settlement completed successfully");
|
||||
} else {
|
||||
LogUtil.d(TAG, "No QR transactions found for auto settlement");
|
||||
qrHasData = false;
|
||||
}
|
||||
}
|
||||
|
||||
qrSettlementReady = true;
|
||||
checkAndLaunch();
|
||||
checkIfBothSettlementsComplete();
|
||||
}
|
||||
};
|
||||
@ -480,19 +548,75 @@ public class AutoSettleService extends Service {
|
||||
|
||||
}
|
||||
|
||||
private void launchAppWithSettlementResult(String settlementType,
|
||||
PayDetail payDetail,
|
||||
Bundle qrData) {
|
||||
private void networkCutOver(PayDetail payDetail) {
|
||||
EchoTestProcess.getInstance().enqueueCutOver().startSignOn(new SignOnListener() {
|
||||
@Override
|
||||
public void onSuccessSignOn() {
|
||||
|
||||
pendingPayDetail = payDetail;
|
||||
posHasData = true;
|
||||
posSettlementReady = true;
|
||||
checkAndLaunch();
|
||||
checkIfBothSettlementsComplete();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailureSignOn(Integer resultCode) {
|
||||
LogUtil.d(TAG,"Failure Cut Over message: "+resultCode);
|
||||
// POS done but cutover failed — still mark ready
|
||||
posSettlementReady = true;
|
||||
posHasData = false;
|
||||
checkAndLaunch();
|
||||
checkIfBothSettlementsComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetworkFailSignOn(String message) {
|
||||
LogUtil.d(TAG,"Network Fail Cut Over message: "+message);
|
||||
posSettlementReady = true;
|
||||
posHasData = false;
|
||||
checkAndLaunch();
|
||||
checkIfBothSettlementsComplete();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void checkAndLaunch() {
|
||||
// !!!! need to add flag, if don't want both at once
|
||||
if (!posSettlementReady || !qrSettlementReady) {
|
||||
LogUtil.d(TAG, "Waiting for both settlements... POS=" + posSettlementReady + " QR=" + qrSettlementReady);
|
||||
return;
|
||||
}
|
||||
|
||||
LogUtil.d(TAG, "Both settlements ready. POS has data=" + posHasData + ", QR has data=" + qrHasData);
|
||||
|
||||
if (!posHasData && !qrHasData) {
|
||||
LogUtil.d(TAG, "No settlement data to display");
|
||||
return;
|
||||
}
|
||||
|
||||
launchMainActivity();
|
||||
}
|
||||
|
||||
private void launchMainActivity() {
|
||||
try {
|
||||
Intent launchIntent = new Intent(this, MainActivity.class);
|
||||
launchIntent.putExtra(settlementType, true);
|
||||
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
|
||||
Intent.FLAG_ACTIVITY_CLEAR_TOP |
|
||||
Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
||||
if ("AUTO_SETTLEMENT".equals(settlementType) && payDetail != null) {
|
||||
if (posHasData && pendingPayDetail != null) {
|
||||
launchIntent.putExtra("AUTO_SETTLEMENT", true);
|
||||
launchIntent.putExtra("EXTRA_TRANSACTION_TYPE", TransactionsType.SETTLEMENT.value);
|
||||
launchIntent.putExtra("EXTRA_PAY_DETAIL", payDetail);
|
||||
} else if ("AUTO_QR_SETTLEMENT".equals(settlementType) && qrData != null) {
|
||||
launchIntent.putExtra("EXTRA_TRANSACTION_TYPE", TransactionsType.MMQR_SETTLEMENT.value);
|
||||
launchIntent.putExtras(qrData);
|
||||
launchIntent.putExtra("EXTRA_PAY_DETAIL", pendingPayDetail);
|
||||
}
|
||||
|
||||
if (qrHasData && pendingQrData != null) {
|
||||
launchIntent.putExtra("AUTO_QR_SETTLEMENT", true);
|
||||
launchIntent.putExtra("EXTRA_QR_TRANSACTION_TYPE", TransactionsType.MMQR_SETTLEMENT.value);
|
||||
launchIntent.putExtras(pendingQrData);
|
||||
}
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(
|
||||
@ -503,13 +627,9 @@ public class AutoSettleService extends Service {
|
||||
);
|
||||
|
||||
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
"SETTLEMENT_COMPLETE",
|
||||
"Settlement Complete",
|
||||
NotificationManager.IMPORTANCE_HIGH
|
||||
);
|
||||
"SETTLEMENT_COMPLETE", "Settlement Complete", NotificationManager.IMPORTANCE_HIGH);
|
||||
channel.setDescription("Auto settlement completion notifications");
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
@ -524,25 +644,24 @@ public class AutoSettleService extends Service {
|
||||
.setFullScreenIntent(pendingIntent, true);
|
||||
notificationManager.notify(2001, builder.build());
|
||||
|
||||
LogUtil.d(TAG, " Settlement complete notification created - will launch app when tapped");
|
||||
// Reset state
|
||||
pendingPayDetail = null;
|
||||
pendingQrData = null;
|
||||
posSettlementReady = false;
|
||||
qrSettlementReady = false;
|
||||
posHasData = false;
|
||||
qrHasData = false;
|
||||
|
||||
try {
|
||||
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
|
||||
Intent.FLAG_ACTIVITY_CLEAR_TOP |
|
||||
Intent.FLAG_ACTIVITY_SINGLE_TOP |
|
||||
Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT |
|
||||
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
startActivity(launchIntent);
|
||||
} catch (Exception directException) {
|
||||
LogUtil.d(TAG, "Direct launch failed (expected on modern Android), notification approach will handle it");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
LogUtil.e(TAG, "Error creating settlement notification: " + e.getMessage());
|
||||
LogUtil.e(TAG, "Error launching MainActivity: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sendEReceipt(EReceiptRequest request) {
|
||||
try {
|
||||
LogUtil.d(TAG, "Sending e-receipt: " + new Gson().toJson(request));
|
||||
|
||||
@ -331,6 +331,7 @@ public class TransactionResultFragment extends DataBindingFragment implements Da
|
||||
sharedViewModel.startPrintSettlement(new PrintXStatus() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
sharedViewModel.onSettlementResultDone.postValue(true);
|
||||
isCardInside();
|
||||
}
|
||||
|
||||
|
||||
@ -73,7 +73,8 @@ public class SharedViewModel extends ViewModel {
|
||||
|
||||
public SingleLiveEvent<String> transactionName = new SingleLiveEvent<>();
|
||||
|
||||
|
||||
// In SharedViewModel
|
||||
public MutableLiveData<Boolean> onSettlementResultDone = new MutableLiveData<>(false);
|
||||
/*May 16 2022*/
|
||||
public SingleLiveEvent<Boolean> isEcr = new SingleLiveEvent<>();
|
||||
|
||||
|
||||
@ -462,11 +462,7 @@ public class SettlementViewModel extends ViewModel {
|
||||
} else if (TextUtils.equals(resultStr, "95") || TextUtils.equals(resultStr, "095")) {
|
||||
//reversal
|
||||
// if (!flag && isNoData.getValue()) {
|
||||
if (!flag ) {
|
||||
payDetail.setIsNeedReversal(true);
|
||||
} else {
|
||||
payDetail.setIsNeedReversal(false);
|
||||
}
|
||||
payDetail.setIsNeedReversal(!flag);
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -349,7 +349,7 @@ public class EmvParamHelper {
|
||||
private AidEntity convertContactlessAIDNex(ContactlessAid contactlessAid) {
|
||||
AidEntity aidV2 = new AidEntity();
|
||||
|
||||
aidV2.setTransType("FF");
|
||||
aidV2.setTransType("00"); // FF
|
||||
aidV2.setOnlinePinCap(1);
|
||||
aidV2.setAsi(0);
|
||||
aidV2.setThreshold(0);
|
||||
|
||||
@ -308,7 +308,7 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
public void setEmvAppSelect(int position ) {
|
||||
public void setEmvAppSelect(int position) {
|
||||
if (emvHandler == null) {
|
||||
LogUtil.e(TAG, "Cannot set EMV app selection - emvHandler is null");
|
||||
emvResultStatus.postValue(EmvResultStatus.ERROR);
|
||||
@ -316,8 +316,8 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
LogUtil.d(TAG, "Selected :" + position + 1);
|
||||
emvHandler.onSetSelAppResponse(position + 1);
|
||||
LogUtil.d(TAG, "Selected :" + position);
|
||||
emvHandler.onSetSelAppResponse(position);
|
||||
} catch (Exception e) {
|
||||
LogUtil.e(TAG, "Exception during app selection: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
@ -579,21 +579,6 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
||||
private OnEmvProcessListener2 emvProcessListener = new OnEmvProcessListener2() {
|
||||
@Override
|
||||
public void onSelApp(List<String> list, List<CandidateAppInfoEntity> list1, boolean b) {
|
||||
LogUtil.d(TAG, "list" + list);
|
||||
LogUtil.d(TAG, "list2" + list1);
|
||||
for (String item: list){
|
||||
LogUtil.d(TAG, "list " + item);
|
||||
}
|
||||
for(CandidateAppInfoEntity item: list1) {
|
||||
LogUtil.d(TAG,"aid :"+ByteUtil.bytes2HexStr(item.getAid()));
|
||||
LogUtil.d(TAG,"app label :"+ByteUtil.bytes2HexStr(item.getAppLabel()));
|
||||
if(item.getPreferName() == null){
|
||||
LogUtil.d(TAG,"prefer name :"+ "is Null");
|
||||
}else{
|
||||
LogUtil.d(TAG,"prefer name :"+ByteUtil.bytes2HexStr(item.getPreferName()));
|
||||
}
|
||||
LogUtil.d(TAG,"priority :"+ByteUtil.byte2HexStr(item.getPriority()));
|
||||
}
|
||||
mProcessStep = EMV_APP_SELECT;
|
||||
LogUtil.d(TAG, "onWaitAppSelect :");
|
||||
String[] candidateNames = getCandidateNames(list);
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
package com.utsmyanmar.paylibs.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CardSettleData {
|
||||
public class CardSettleData implements Serializable {
|
||||
|
||||
private String cardType;
|
||||
private String cardNum;
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
package com.utsmyanmar.paylibs.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class QRSettleData {
|
||||
public class QRSettleData implements Serializable {
|
||||
|
||||
private String transId;
|
||||
private String date;
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.utsmyanmar.paylibs.model;
|
||||
|
||||
public class SettleData {
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SettleData implements Serializable {
|
||||
|
||||
private int saleCount;
|
||||
private long saleAmount;
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.utsmyanmar.paylibs.model.enums;
|
||||
|
||||
public enum TransCVM {
|
||||
import java.io.Serializable;
|
||||
|
||||
public enum TransCVM implements Serializable {
|
||||
OFFLINE_PIN("Offline PIN"),
|
||||
ONLINE_PIN("Online PIN"),
|
||||
SIGNATURE("Signature"),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user