Compare commits
No commits in common. "37a3fb27bcb71f8552612c77fafbdcf9ee9f4eac" and "0faaf36fde343a7d2e8f7ef0721fe87977a83e70" have entirely different histories.
37a3fb27bc
...
0faaf36fde
@ -4,7 +4,7 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2026-01-08T07:42:32.649681Z">
|
||||
<DropdownSelection timestamp="2025-12-11T11:35:06.715134Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=0123456789ABCDEF" />
|
||||
|
||||
@ -14,11 +14,11 @@
|
||||
<option value="$PROJECT_DIR$/baselib" />
|
||||
<option value="$PROJECT_DIR$/ecr" />
|
||||
<option value="$PROJECT_DIR$/ecr-service-lib" />
|
||||
<option value="$PROJECT_DIR$/link-service-lib" />
|
||||
<option value="$PROJECT_DIR$/mpulib" />
|
||||
<option value="$PROJECT_DIR$/nexdlkey-lib" />
|
||||
<option value="$PROJECT_DIR$/nexsdk-lib" />
|
||||
<option value="$PROJECT_DIR$/paylibs" />
|
||||
<option value="$PROJECT_DIR$/paysdk-lib" />
|
||||
<option value="$PROJECT_DIR$/qrgen-lib" />
|
||||
<option value="$PROJECT_DIR$/xpay" />
|
||||
</set>
|
||||
|
||||
@ -222,7 +222,7 @@ dependencies {
|
||||
implementation project(path: ':paylibs')
|
||||
implementation project(path: ':mpulib')
|
||||
implementation project(path: ':baselib')
|
||||
// implementation project(path: ':paysdk-lib')
|
||||
implementation project(path: ':paysdk-lib')
|
||||
implementation project(path: ':nexsdk-lib')
|
||||
implementation project(path: ':qrgen-lib')
|
||||
implementation project(path: ':xpay')
|
||||
|
||||
@ -20,8 +20,6 @@ import androidx.lifecycle.Observer;
|
||||
import com.denzcoskun.imageslider.ImageSlider;
|
||||
import com.denzcoskun.imageslider.constants.ScaleTypes;
|
||||
import com.denzcoskun.imageslider.models.SlideModel;
|
||||
import com.nexgo.oaf.apiv3.emv.AidEntity;
|
||||
import com.nexgo.oaf.apiv3.emv.CapkEntity;
|
||||
import com.pos.connection.bridge.binder.ECRConstant;
|
||||
|
||||
import com.utsmm.kbz.util.MockData;
|
||||
@ -49,6 +47,7 @@ import com.utsmyanmar.paylibs.utils.enums.TransMenu;
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||
|
||||
|
||||
|
||||
import com.utsmm.kbz.config.Constants;
|
||||
import com.utsmm.kbz.config.data.model.ValidityStatus;
|
||||
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||
@ -143,34 +142,33 @@ public class MainFragment extends DataBindingFragment {
|
||||
|
||||
delayFunctionCall(this::checkTerminalStatus);
|
||||
|
||||
delayFunctionCall(() -> {
|
||||
delayFunctionCall(()-> {
|
||||
NexGoSDK.getInstance().cancelCheckCard();
|
||||
NexGoSDK.getInstance().closeReader();
|
||||
enableHomeButton();
|
||||
disableTaskButton();
|
||||
// BaseApplication.getInstance().deviceEngine.getPlatform().hideNavigationBar();
|
||||
BaseApplication.getInstance().deviceEngine.getPlatform().showNavigationBar();
|
||||
BaseApplication.getInstance().deviceEngine.getPlatform().hideNavigationBar();
|
||||
});
|
||||
}
|
||||
|
||||
private void disableHomeButton() {
|
||||
private void disableHomeButton(){
|
||||
int result = BaseApplication.getInstance().deviceEngine.getPlatform().disableHomeButton();
|
||||
LogUtil.d(TAG, "Disable Home Button Result:" + result);
|
||||
LogUtil.d(TAG,"Disable Home Button Result:"+result);
|
||||
}
|
||||
|
||||
private void disableTaskButton() {
|
||||
private void disableTaskButton(){
|
||||
int result = BaseApplication.getInstance().deviceEngine.getPlatform().disableTaskButton();
|
||||
LogUtil.d(TAG, "Disable Task Button Result:" + result);
|
||||
LogUtil.d(TAG,"Disable Task Button Result:"+result);
|
||||
}
|
||||
|
||||
private void enableHomeButton() {
|
||||
private void enableHomeButton(){
|
||||
int result = BaseApplication.getInstance().deviceEngine.getPlatform().enableHomeButton();
|
||||
LogUtil.d(TAG, "Enable Home Button Result:" + result);
|
||||
LogUtil.d(TAG,"Enable Home Button Result:"+result);
|
||||
}
|
||||
|
||||
private void enableTaskButton() {
|
||||
private void enableTaskButton(){
|
||||
int result = BaseApplication.getInstance().deviceEngine.getPlatform().enableTaskButton();
|
||||
LogUtil.d(TAG, "Disable Task Button Result:" + result);
|
||||
LogUtil.d(TAG,"Disable Task Button Result:"+result);
|
||||
}
|
||||
|
||||
|
||||
@ -186,7 +184,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (SystemParamsOperation.getInstance().isAlertSound()) {
|
||||
if(SystemParamsOperation.getInstance().isAlertSound()) {
|
||||
delayFunctionCall(this::checkPrinter);
|
||||
}
|
||||
|
||||
@ -195,6 +193,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
mainViewModel.observeSettlementPOS();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void checkDownload() {
|
||||
@ -233,7 +232,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
|
||||
setUpCarouselImages();
|
||||
|
||||
if (TextUtils.equals(SystemParamsOperation.getInstance().getCurrentSerialNum(), "000001")) {
|
||||
if(TextUtils.equals(SystemParamsOperation.getInstance().getCurrentSerialNum(),"000001")) {
|
||||
setPreviousTraceNum();
|
||||
}
|
||||
sharedViewModel.setManualEntryStatus(SystemParamsOperation.getInstance().getManualEntryStatus());
|
||||
@ -247,18 +246,22 @@ public class MainFragment extends DataBindingFragment {
|
||||
*
|
||||
* value - 0 = AID, 1 = CAPK
|
||||
* */
|
||||
private void queryAidCAPKList() {
|
||||
private void queryAidCAPKList(int value) {
|
||||
List<String> aidlist = new ArrayList<>();
|
||||
List<CapkEntity> capkList = MyApplication.getInstance().deviceEngine.getEmvHandler2("app2").getCapkList();
|
||||
List<AidEntity> aidList = MyApplication.getInstance().deviceEngine.getEmvHandler2("app2").getAidList();
|
||||
for (CapkEntity capkEntity : capkList) {
|
||||
LogUtil.d(TAG, "CAPK Entity :" + capkEntity.getRid());
|
||||
}
|
||||
for (AidEntity aidEntity : aidList) {
|
||||
LogUtil.d(TAG, "AID Entity :" + aidEntity.getAid());
|
||||
}
|
||||
try {
|
||||
int result = MyApplication.getInstance().mEMVOptV2.queryAidCapkList(value,aidlist);
|
||||
LogUtil.d(TAG,"Query "+(value == 0?"AID":"CAPK")+" List result:"+result);
|
||||
|
||||
if(result == 0) {
|
||||
|
||||
for (String aid : aidlist) {
|
||||
LogUtil.d(TAG,(value == 0?"AID:":"CAPK:")+aid);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void setPreviousTraceNum() {
|
||||
@ -266,7 +269,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
mainViewModel.lastTrans.observe(getViewLifecycleOwner(), new Observer<PayDetail>() {
|
||||
@Override
|
||||
public void onChanged(PayDetail payDetail) {
|
||||
if (payDetail == null) {
|
||||
if(payDetail == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -282,7 +285,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
if (checkECRServiceAppExistOrNot()) {
|
||||
|
||||
|
||||
if (!SystemParamsOperation.getInstance().isSetupEcr()) {
|
||||
if(!SystemParamsOperation.getInstance().isSetupEcr()){
|
||||
initECR();
|
||||
delayFunctionCall(this::createECRInstance);
|
||||
SystemParamsOperation.getInstance().setSetupEcr(true);
|
||||
@ -300,7 +303,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
//
|
||||
// currently will test with Bluetooth , afterward will switch to VSP mode
|
||||
|
||||
if (SystemParamsOperation.getInstance().isBluetoothMode()) {
|
||||
if(SystemParamsOperation.getInstance().isBluetoothMode()) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(ECRConstant.Configuration.MODE, ECRConstant.Mode.Bluetooth);
|
||||
bundle.putString(ECRConstant.Configuration.TYPE, ECRConstant.Type.MASTER);
|
||||
@ -329,16 +332,16 @@ public class MainFragment extends DataBindingFragment {
|
||||
|
||||
imgList.clear();
|
||||
|
||||
if (imgUrls == null || imgUrls.isEmpty()) {
|
||||
if(imgUrls == null || imgUrls.isEmpty() ) {
|
||||
String defaultUrl = getResourceString(R.string.txt_default_carousel_img_url);
|
||||
imgList.add(new SlideModel(defaultUrl, "", ScaleTypes.CENTER_CROP));
|
||||
imgList.add(new SlideModel(defaultUrl,"", ScaleTypes.CENTER_CROP));
|
||||
imgSlider.setImageList(imgList);
|
||||
return;
|
||||
}
|
||||
ArrayList<String> urls = TMSUtil.getInstance().convertToArray(imgUrls);
|
||||
|
||||
for (String url : urls) {
|
||||
imgList.add(new SlideModel(url.trim(), "", ScaleTypes.CENTER_CROP));
|
||||
for(String url : urls) {
|
||||
imgList.add(new SlideModel(url.trim(),"", ScaleTypes.CENTER_CROP));
|
||||
|
||||
}
|
||||
|
||||
@ -346,6 +349,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private boolean checkECRServiceAppExistOrNot() {
|
||||
PackageInfo packageInfo;
|
||||
try {
|
||||
@ -359,6 +363,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected DataBindingConfig getDataBindingConfig() {
|
||||
|
||||
@ -368,9 +373,11 @@ public class MainFragment extends DataBindingFragment {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void checkPrinter() {
|
||||
if (PrintHelper.getInstance().paperRollStatus() == 2) {
|
||||
} else if (PrintHelper.getInstance().paperRollStatus() == 4) {
|
||||
}
|
||||
else if (PrintHelper.getInstance().paperRollStatus() == 4) {
|
||||
|
||||
mainViewModel.playAtOnce.setValue(false);
|
||||
showPrinterAlertDialog(getResourceString(R.string.txt_paper_roll_not_ready), new DialogCallback() {
|
||||
@ -386,20 +393,21 @@ public class MainFragment extends DataBindingFragment {
|
||||
}
|
||||
});
|
||||
// startSound(getResourceString(R.string.txt_audio_printer_alert));
|
||||
} else if (PrintHelper.getInstance().paperRollStatus() == 1) {
|
||||
} else if (PrintHelper.getInstance().paperRollStatus() == 1) {
|
||||
|
||||
if (mainViewModel.playAtOnce.getValue() != null && !mainViewModel.playAtOnce.getValue()) {
|
||||
if( mainViewModel.playAtOnce.getValue() != null && !mainViewModel.playAtOnce.getValue()) {
|
||||
startSound(getResourceString(R.string.txt_audio_paper_ready_alert));
|
||||
mainViewModel.playAtOnce.setValue(true);
|
||||
}
|
||||
|
||||
} else if (PrintHelper.getInstance().paperRollStatus() == 0) {
|
||||
LogUtil.d(TAG, "Printer not found! ");
|
||||
LogUtil.d(TAG,"Printer not found! ");
|
||||
// showDeclineDialog(getResourceString(R.string.txt_alert_printer_not_found));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void isRouteValidAndNavigateToRoute(int routeId) {
|
||||
if (Objects.requireNonNull(getNavController(Constants.NAV_HOST_ID).getCurrentDestination()).getId() == R.id.nav_main) {
|
||||
getNavController(Constants.NAV_HOST_ID).navigate(routeId);
|
||||
@ -443,7 +451,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
|
||||
ECRHelper.INSTANCE.bindECRService();
|
||||
|
||||
LogUtil.d(TAG, "Bind ECR Service successfully!");
|
||||
LogUtil.d(TAG,"Bind ECR Service successfully!");
|
||||
}
|
||||
|
||||
private void onReceivedEcrCommand() {
|
||||
@ -474,7 +482,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
String pkgName = BuildConfig.APPLICATION_ID;
|
||||
String serialNo = TerminalUtil.getInstance().getSerialNo();
|
||||
|
||||
ResultOf<Transactions> result = ECRProcess.INSTANCE.parseECRRequest(ecrKey, pkgName, serialNo, msg);
|
||||
ResultOf<Transactions> result = ECRProcess.INSTANCE.parseECRRequest(ecrKey,pkgName,serialNo,msg);
|
||||
|
||||
if (result instanceof ResultOf.Success) {
|
||||
Transactions trans = ((ResultOf.Success<Transactions>) result).getValue();
|
||||
@ -495,13 +503,13 @@ public class MainFragment extends DataBindingFragment {
|
||||
}
|
||||
break;
|
||||
case VOID:
|
||||
if (!SystemParamsOperation.getInstance().getVoidStatus()) {
|
||||
CoreUtils.getInstance(sharedViewModel).responseRejectMsg(trans, "Void is disabled!");
|
||||
if(!SystemParamsOperation.getInstance().getVoidStatus()) {
|
||||
CoreUtils.getInstance(sharedViewModel).responseRejectMsg(trans,"Void is disabled!");
|
||||
return;
|
||||
}
|
||||
if (CoreUtils.getInstance(sharedViewModel).setUpECRVoid(trans)) {
|
||||
delayFunctionCall(() -> {
|
||||
if (Objects.requireNonNull(getNavController(Constants.NAV_HOST_ID).getCurrentDestination()).getId() == R.id.nav_main) {
|
||||
if(Objects.requireNonNull(getNavController(Constants.NAV_HOST_ID).getCurrentDestination()).getId() == R.id.nav_main) {
|
||||
setToolBarTitle(getResourceString(R.string.menu_sale_void));
|
||||
}
|
||||
|
||||
@ -526,8 +534,8 @@ public class MainFragment extends DataBindingFragment {
|
||||
}
|
||||
|
||||
case SETTLEMENT: {
|
||||
if (!SystemParamsOperation.getInstance().getSettlementStatus()) {
|
||||
CoreUtils.getInstance(sharedViewModel).responseRejectMsg(trans, "Settlement is disabled!");
|
||||
if(!SystemParamsOperation.getInstance().getSettlementStatus()) {
|
||||
CoreUtils.getInstance(sharedViewModel).responseRejectMsg(trans,"Settlement is disabled!");
|
||||
return;
|
||||
}
|
||||
CoreUtils.getInstance(sharedViewModel).setUpECRSettlement();
|
||||
@ -561,25 +569,25 @@ public class MainFragment extends DataBindingFragment {
|
||||
mainViewModel.observeSettlementPOS();
|
||||
observeLastTrans = payDetail -> {
|
||||
|
||||
if (payDetail == null) {
|
||||
if(payDetail == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// SystemParamsOperation.getInstance().saveSerialNumber(payDetail.getVoucherNo());
|
||||
// SystemParamsOperation.getInstance().saveInvoiceNumber(payDetail.getInvoiceNo());
|
||||
|
||||
if (lastPay != null) {
|
||||
if(lastPay != null) {
|
||||
Date lastPayDate = POSUtil.getInstance().getDateByString(lastPay.getTransDate());
|
||||
Date observePayDate = POSUtil.getInstance().getDateByString(payDetail.getTransDate());
|
||||
|
||||
if (lastPayDate.compareTo(observePayDate) < 0) {
|
||||
if(lastPayDate.compareTo(observePayDate) < 0) {
|
||||
payDetail = lastPay;
|
||||
}
|
||||
}
|
||||
|
||||
// LogUtil.d(TAG,"TransDetail :"+payDetail.getTransType() + "- Trans Time :"+payDetail.getTransDate());
|
||||
|
||||
if (payDetail.getTransactionType() == TransactionsType.SETTLEMENT.value) {
|
||||
if(payDetail.getTransactionType() == TransactionsType.SETTLEMENT.value){
|
||||
return;
|
||||
}
|
||||
|
||||
@ -603,7 +611,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
|
||||
String configRawDay = SystemParamsOperation.getInstance().getClearBatchDay();
|
||||
|
||||
if (configRawDay != null && !configRawDay.trim().isEmpty()) {
|
||||
if(configRawDay != null && !configRawDay.trim().isEmpty()) {
|
||||
try {
|
||||
configDay = Integer.parseInt(configRawDay);
|
||||
} catch (Exception e) {
|
||||
@ -613,7 +621,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
}
|
||||
|
||||
|
||||
if (configTimer != null && !configTimer.trim().isEmpty() && checkValidTime(configTimer.trim())) {
|
||||
if(configTimer != null && !configTimer.trim().isEmpty() && checkValidTime(configTimer.trim())) {
|
||||
configTime = configTimer.trim();
|
||||
}
|
||||
Date configDateTime = POSUtil.getInstance().getDateTime(configTime);
|
||||
@ -623,22 +631,22 @@ public class MainFragment extends DataBindingFragment {
|
||||
|
||||
Date yesterdayDate = POSUtil.getInstance().getYesterdayDate();
|
||||
|
||||
if (today.compareTo(transDate) == 0) {
|
||||
if(today.compareTo(transDate) == 0) {
|
||||
|
||||
// LogUtil.d(TAG,"Last Trans is Today!");
|
||||
// LogUtil.d(TAG,"date current :!"+current);
|
||||
// LogUtil.d(TAG,"date config :!"+configDateTime);
|
||||
|
||||
// Today
|
||||
if (current.compareTo(configDateTime) > 0) {
|
||||
if(current.compareTo(configDateTime) > 0) {
|
||||
// clear batch and force update param
|
||||
|
||||
// LogUtil.d(TAG,"Last Trans is Today! Config time is passed!");
|
||||
// if (!SystemParamsOperation.getInstance().isClearBatch()) {
|
||||
if (checkSyncTrans() || !SystemParamsOperation.getInstance().isClearBatch()) {
|
||||
if (checkSyncTrans() || !SystemParamsOperation.getInstance().isClearBatch() ) {
|
||||
// LogUtil.d(TAG,"Clearing....");
|
||||
if (!SystemParamsOperation.getInstance().getSettlementStatus()) {
|
||||
clearBatchAndDownload(configDay, payDetail);
|
||||
if(!SystemParamsOperation.getInstance().getSettlementStatus()) {
|
||||
clearBatchAndDownload(configDay,payDetail);
|
||||
}
|
||||
}
|
||||
|
||||
@ -651,35 +659,36 @@ public class MainFragment extends DataBindingFragment {
|
||||
} else {
|
||||
// LogUtil.d(TAG,"Last Trans is Before Today!");
|
||||
Date yest;
|
||||
if (configTime.equals("00:00")) {
|
||||
if(configTime.equals("00:00")) {
|
||||
yest = configDateTime;
|
||||
} else {
|
||||
yest = yesterdayConfigDateTime;
|
||||
}
|
||||
|
||||
|
||||
Date lastTransDateTime = POSUtil.getInstance().getDateByTransDateTime(lastTransDate, lastTransTime);
|
||||
Date lastTransDateTime = POSUtil.getInstance().getDateByTransDateTime(lastTransDate,lastTransTime);
|
||||
// LogUtil.d(TAG,"Compare Result : "+lastTransDateTime.compareTo(yest));
|
||||
|
||||
if (yest.compareTo(lastTransDateTime) < 0) {
|
||||
if(yest.compareTo(lastTransDateTime) < 0) {
|
||||
// LogUtil.d(TAG,"Trans is yesterday, but after config time, no action!");
|
||||
} else {
|
||||
// LogUtil.d(TAG,"Trans is yesterday, before config time,");
|
||||
// if(!checkSyncTrans()) {
|
||||
// LogUtil.d(TAG,"Clearing....");
|
||||
if (!SystemParamsOperation.getInstance().getSettlementStatus()) {
|
||||
clearBatchAndDownload(configDay, payDetail);
|
||||
if(!SystemParamsOperation.getInstance().getSettlementStatus()) {
|
||||
clearBatchAndDownload(configDay,payDetail);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
if (mainViewModel.lastTrans.hasActiveObservers()) {
|
||||
if(mainViewModel.lastTrans.hasActiveObservers()) {
|
||||
mainViewModel.lastTrans.removeObserver(observeLastTrans);
|
||||
}
|
||||
mainViewModel.lastTrans.observe(getViewLifecycleOwner(), observeLastTrans);
|
||||
mainViewModel.lastTrans.observe(getViewLifecycleOwner(),observeLastTrans);
|
||||
|
||||
|
||||
}
|
||||
@ -688,16 +697,16 @@ public class MainFragment extends DataBindingFragment {
|
||||
mainViewModel.allTrans.observe(getViewLifecycleOwner(), new Observer<List<PayDetail>>() {
|
||||
@Override
|
||||
public void onChanged(List<PayDetail> payDetails) {
|
||||
if (payDetails == null || payDetails.isEmpty()) {
|
||||
if(payDetails == null || payDetails.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
PayDetail tempPay = payDetails.get(0);
|
||||
for (int i = 0; i < payDetails.size(); i++) {
|
||||
for (int i = 0; i < payDetails.size() ; i++) {
|
||||
|
||||
Date tempDate = POSUtil.getInstance().getDateByString(tempPay.getTransDate());
|
||||
Date indexDate = POSUtil.getInstance().getDateByString(payDetails.get(i).getTransDate());
|
||||
|
||||
if (tempDate.compareTo(indexDate) > 0) {
|
||||
if(tempDate.compareTo(indexDate) > 0) {
|
||||
// if before
|
||||
tempPay = payDetails.get(i);
|
||||
}
|
||||
@ -720,7 +729,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
private boolean checkSyncTrans() {
|
||||
String transDateString = SystemParamsOperation.getInstance().getSyncTransDate();
|
||||
Date today = POSUtil.getInstance().getCurrentDate();
|
||||
if (transDateString == null || transDateString.isEmpty()) {
|
||||
if(transDateString == null || transDateString.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
Date transDate = POSUtil.getInstance().getDateByString(transDateString);
|
||||
@ -729,7 +738,8 @@ public class MainFragment extends DataBindingFragment {
|
||||
}
|
||||
|
||||
|
||||
private void clearBatchAndDownload(int configDay, PayDetail payDetail) {
|
||||
|
||||
private void clearBatchAndDownload(int configDay,PayDetail payDetail) {
|
||||
|
||||
|
||||
Date yesterday = POSUtil.getInstance().getYesterdayDate();
|
||||
@ -738,11 +748,11 @@ public class MainFragment extends DataBindingFragment {
|
||||
|
||||
Date transDate;
|
||||
|
||||
if (list == null || list.size() == 0) {
|
||||
if(list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (PayDetail pay : list) {
|
||||
for (PayDetail pay:list) {
|
||||
/*
|
||||
* To Hold One day transaction!
|
||||
* */
|
||||
@ -750,11 +760,11 @@ public class MainFragment extends DataBindingFragment {
|
||||
transDate = POSUtil.getInstance().getDateByString(pay.getTransDate());
|
||||
|
||||
if (pay.getTransactionType() == TransactionsType.SALE.value) {
|
||||
if (lastInputDay.compareTo(transDate) > 0) {
|
||||
if(lastInputDay.compareTo(transDate) > 0) {
|
||||
mainViewModel.deletePayDetail(pay);
|
||||
}
|
||||
} else {
|
||||
if (yesterday.compareTo(transDate) > 0) {
|
||||
if(yesterday.compareTo(transDate) > 0 ) {
|
||||
mainViewModel.deletePayDetail(pay);
|
||||
}
|
||||
}
|
||||
@ -766,11 +776,11 @@ public class MainFragment extends DataBindingFragment {
|
||||
|
||||
mainViewModel.deleteTrans.observe(getViewLifecycleOwner(), lists -> {
|
||||
Date transDate;
|
||||
if (lists == null || lists.size() == 0) {
|
||||
if(lists == null || lists.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (PayDetail pay : lists) {
|
||||
for (PayDetail pay:lists) {
|
||||
/*
|
||||
* To Hold One day transaction!
|
||||
* */
|
||||
@ -780,7 +790,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
// LogUtil.d(TAG,"Yesterday Date: "+yesterday.toString());
|
||||
// LogUtil.d(TAG,"Compare result :"+yesterday.compareTo(transDate));
|
||||
|
||||
if (yesterday.compareTo(transDate) > 0) {
|
||||
if(yesterday.compareTo(transDate) > 0) {
|
||||
mainViewModel.deletePayDetail(pay);
|
||||
}
|
||||
|
||||
@ -789,11 +799,11 @@ public class MainFragment extends DataBindingFragment {
|
||||
|
||||
mainViewModel.preAuthTrans.observe(getViewLifecycleOwner(), lists -> {
|
||||
Date transDate;
|
||||
if (lists == null || lists.size() == 0) {
|
||||
if(lists == null || lists.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (PayDetail pay : lists) {
|
||||
for (PayDetail pay:lists) {
|
||||
|
||||
transDate = POSUtil.getInstance().getDateByString(pay.getTransDate());
|
||||
|
||||
@ -809,7 +819,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
*
|
||||
* Need to think about his problem .... Nov 7, 2024
|
||||
* */
|
||||
if (!SystemParamsOperation.getInstance().isClearBatch()) {
|
||||
if(!SystemParamsOperation.getInstance().isClearBatch()) {
|
||||
// downloadParams(payDetail.getTransType(),String.valueOf(payDetail.getTransNum()),TMSUpdate.UPDATE,false);
|
||||
}
|
||||
|
||||
@ -818,11 +828,11 @@ public class MainFragment extends DataBindingFragment {
|
||||
private void generateMockQR() {
|
||||
String transDate = "24/12/25";
|
||||
String transTime = "12:06:30";
|
||||
TradeData tradeData = MockData.getInstance().generateMockDataWithTime(TransactionsType.MMQR, 1, transDate, transTime);
|
||||
TradeData tradeData = MockData.getInstance().generateMockDataWithTime(TransactionsType.MMQR, 1,transDate,transTime);
|
||||
PayDetail payDetail = tradeData.getPayDetail();
|
||||
sharedViewModel.insertPayDetail(payDetail);
|
||||
LogUtil.d(TAG, "------------------- Inserted Mocked Data ------------------");
|
||||
LogUtil.d(TAG, "trans date : " + payDetail.getTransDate() + "- Trans Time: " + payDetail.getTransTime());
|
||||
LogUtil.d(TAG,"------------------- Inserted Mocked Data ------------------");
|
||||
LogUtil.d(TAG,"trans date : "+payDetail.getTransDate() +"- Trans Time: "+payDetail.getTransTime());
|
||||
}
|
||||
|
||||
|
||||
@ -833,16 +843,16 @@ public class MainFragment extends DataBindingFragment {
|
||||
if (!Connectivity.isConnectedWifi(getContext()) && !Connectivity.isConnectedMobile(getContext())) {
|
||||
showSingleInfoDialog(getResourceString(R.string.txt_please_enable_internet));
|
||||
} else if (TMSUtil.getInstance().checkParams().isStatus() == ValidityStatus.FAILURE) {
|
||||
showDeclineDialog(getResourceString(R.string.txt_please_download_config) + "\n" + TMSUtil.getInstance().checkParams().getMessage());
|
||||
} else if (SystemParamsOperation.getInstance().isNeedSettlement()) {
|
||||
showDeclineDialog(getResourceString(R.string.txt_please_download_config)+"\n"+TMSUtil.getInstance().checkParams().getMessage());
|
||||
} else if(SystemParamsOperation.getInstance().isNeedSettlement()) {
|
||||
AlertXDialog.getInstance().showDialog(requireContext(), getResourceString(R.string.title_need_settle), getResourceString(R.string.txt_do_you_want_to_continue), () -> {
|
||||
int mainToDashboard = R.id.action_nav_main_to_dashboardTransFragment;
|
||||
safeRouteTo(R.id.nav_main, mainToDashboard, Constants.NAV_HOST_ID);
|
||||
safeRouteTo(R.id.nav_main,mainToDashboard,Constants.NAV_HOST_ID);
|
||||
});
|
||||
} else {
|
||||
|
||||
int mainToDashboard = R.id.action_nav_main_to_dashboardTransFragment;
|
||||
safeRouteTo(R.id.nav_main, mainToDashboard, Constants.NAV_HOST_ID);
|
||||
safeRouteTo(R.id.nav_main,mainToDashboard,Constants.NAV_HOST_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@ -851,10 +861,10 @@ public class MainFragment extends DataBindingFragment {
|
||||
if (mainViewModel.payDetailSingle.getValue() != null) {
|
||||
mainViewModel.startReversal(mainViewModel.payDetailSingle.getValue());
|
||||
} else if (TMSUtil.getInstance().checkParams().isStatus() == ValidityStatus.FAILURE) {
|
||||
showDeclineDialog(getResourceString(R.string.txt_please_download_config) + "\n" + TMSUtil.getInstance().checkParams().getMessage());
|
||||
showDeclineDialog(getResourceString(R.string.txt_please_download_config)+"\n"+TMSUtil.getInstance().checkParams().getMessage());
|
||||
} else if (!Connectivity.isConnectedWifi(getContext()) && !Connectivity.isConnectedMobile(getContext())) {
|
||||
showSingleInfoDialog(getResourceString(R.string.txt_please_enable_internet));
|
||||
} else if (SystemParamsOperation.getInstance().isNeedSettlement()) {
|
||||
} else if(SystemParamsOperation.getInstance().isNeedSettlement()) {
|
||||
AlertXDialog.getInstance().showDialog(requireContext(), getResourceString(R.string.title_need_settle), getResourceString(R.string.txt_do_you_want_to_continue), () -> {
|
||||
processBatch();
|
||||
sharedViewModel.transactionsType.setValue(TransactionsType.SALE);
|
||||
@ -871,10 +881,10 @@ public class MainFragment extends DataBindingFragment {
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickQR() {
|
||||
public void onClickQR(){
|
||||
|
||||
if (TMSUtil.getInstance().checkQRParams().isStatus() == ValidityStatus.FAILURE) {
|
||||
showDeclineDialog(getResourceString(R.string.txt_please_download_config) + "\n" + TMSUtil.getInstance().checkQRParams().getMessage());
|
||||
if(TMSUtil.getInstance().checkQRParams().isStatus() == ValidityStatus.FAILURE) {
|
||||
showDeclineDialog(getResourceString(R.string.txt_please_download_config)+"\n"+TMSUtil.getInstance().checkQRParams().getMessage());
|
||||
} else {
|
||||
routeId = R.id.action_nav_main_to_qrFragment;
|
||||
safeNavigateToRouteId();
|
||||
@ -958,7 +968,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickVoid() {
|
||||
public void onClickVoid(){
|
||||
if (mainViewModel.payDetailSingle.getValue() != null) {
|
||||
mainViewModel.startReversal(mainViewModel.payDetailSingle.getValue());
|
||||
} else if (checkTid()) {
|
||||
@ -968,11 +978,11 @@ public class MainFragment extends DataBindingFragment {
|
||||
// sharedViewModel.transMenu.postValue(TransMenu.TRANSACTIONS);
|
||||
sharedViewModel.setTransMenu(TransMenu.TRANSACTIONS);
|
||||
routeId = R.id.action_nav_main_to_inputPasswordFragment;
|
||||
safeRouteTo(currentId(), routeId, hostId());
|
||||
safeRouteTo(currentId(),routeId, hostId());
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickReport() {
|
||||
public void onClickReport(){
|
||||
routeId = R.id.action_nav_main_to_manageFunctionFragment;
|
||||
safeRouteTo(currentId(), routeId, hostId());
|
||||
}
|
||||
|
||||
@ -0,0 +1,295 @@
|
||||
package com.utsmm.kbz.ui.core_ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.EMVCandidateV2;
|
||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||
import com.utsmyanmar.baselib.ui.ListDialog;
|
||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.model.TradeData;
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||
import com.utsmyanmar.paylibs.utils.params.Params;
|
||||
import com.utsmm.kbz.BR;
|
||||
import com.utsmm.kbz.R;
|
||||
import com.utsmm.kbz.config.Constants;
|
||||
import com.utsmm.kbz.ui.core_viewmodel.EmvReadCardViewModel;
|
||||
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||
import com.utsmm.kbz.ui.core_viewmodel.TransProcessViewModel;
|
||||
import com.utsmm.kbz.ui.pre_auth.PreAuthCompViewModel;
|
||||
import com.utsmm.kbz.util.enums.EmvReadStatus;
|
||||
import com.utsmm.kbz.util.ecr.CoreUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
|
||||
/**
|
||||
* Currently this class is not used
|
||||
*/
|
||||
public class EmvReadCardFragment extends DataBindingFragment {
|
||||
|
||||
private EmvReadCardViewModel emvReadCardViewModel;
|
||||
|
||||
private SharedViewModel sharedViewModel;
|
||||
|
||||
private PreAuthCompViewModel preAuthCompViewModel;
|
||||
|
||||
private TransProcessViewModel transProcessViewModel;
|
||||
|
||||
private ListDialog mListDialog;
|
||||
|
||||
private static final String TAG = EmvReadCardFragment.class.getSimpleName();
|
||||
|
||||
private int routeID;
|
||||
|
||||
private int popBackID;
|
||||
|
||||
private List<PayDetail> lists = new ArrayList<>();
|
||||
|
||||
private String currentCardNo = "";
|
||||
|
||||
@Override
|
||||
protected void initViewModel() {
|
||||
emvReadCardViewModel = getFragmentScopeViewModel(EmvReadCardViewModel.class);
|
||||
sharedViewModel = getFragmentScopeViewModel(SharedViewModel.class);
|
||||
preAuthCompViewModel = getFragmentScopeViewModel(PreAuthCompViewModel.class);
|
||||
transProcessViewModel = getFragmentScopeViewModel(TransProcessViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DataBindingConfig getDataBindingConfig() {
|
||||
return new DataBindingConfig(R.layout.fragment_emv_card_read, BR.emv,emvReadCardViewModel)
|
||||
.addBindingParam(BR.click,new ClickEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int currentId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int hostId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int routeId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
observeData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
emvReadCardViewModel.terminateTrans();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
|
||||
emvReadCardViewModel.startProcess();
|
||||
|
||||
emvReadCardViewModel.resultStatus.observe(getViewLifecycleOwner(), new Observer<EmvReadStatus>() {
|
||||
@Override
|
||||
public void onChanged(EmvReadStatus emvReadStatus) {
|
||||
switch (emvReadStatus){
|
||||
case SUCCESS: emvReadCardViewModel.isButtonVisible.postValue(true);
|
||||
currentCardNo = emvReadCardViewModel.cardNum.getValue();
|
||||
break;
|
||||
case FAIL: cardReadFailAction(emvReadCardViewModel.errorCode.getValue()); break;
|
||||
case SELECT_APP: observeList();break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void cardReadFailAction(String message){
|
||||
try{
|
||||
if(message == null){
|
||||
message = getResourceString(R.string.txt_card_read_fail);
|
||||
}else if(message.contains(":")){
|
||||
message = message.split(":")[1];
|
||||
}
|
||||
getNavController(Constants.NAV_HOST_ID).navigate(popBackID);
|
||||
|
||||
showSingleInfoDialog(message);
|
||||
|
||||
if(sharedViewModel.isEcr.getValue() != null){
|
||||
if(sharedViewModel.isEcr.getValue()){
|
||||
sharedViewModel.isEcr.postValue(false);
|
||||
sharedViewModel.isEcrFinished.postValue(true);
|
||||
CoreUtils.getInstance(sharedViewModel).responseRejectMsg(message);
|
||||
// ECRHelper.INSTANCE.send(message.getBytes());
|
||||
}
|
||||
}
|
||||
}catch (IllegalArgumentException e){
|
||||
e.printStackTrace();
|
||||
getNavController(Constants.NAV_HOST_ID).navigate(popBackID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void observeData(){
|
||||
|
||||
switch (sharedViewModel.transactionsType.getValue()){
|
||||
|
||||
case PRE_AUTH_COMPLETE:
|
||||
observePreAuthComp();
|
||||
routeID = R.id.action_emvReadCardFragment_to_inputRRNFragment;
|
||||
popBackID = R.id.action_emvReadCardFragment_to_nav_main;
|
||||
break;
|
||||
case PRE_AUTH_VOID:
|
||||
routeID = R.id.action_emvReadCardFragment_to_inputRRNFragment;
|
||||
popBackID = R.id.action_emvReadCardFragment_to_nav_main;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void observePreAuthComp() {
|
||||
preAuthCompViewModel.getPreAuthComData().observe(getViewLifecycleOwner(), new Observer<List<PayDetail>>() {
|
||||
@Override
|
||||
public void onChanged(List<PayDetail> payDetails) {
|
||||
if(payDetails.size() > 0) {
|
||||
LogUtil.d(TAG,"Pre Auth Comp size :"+payDetails.size());
|
||||
lists.addAll(payDetails);
|
||||
// sharedViewModel.payDetailList.postValue(payDetails);
|
||||
} else {
|
||||
LogUtil.d(TAG,"Pre Auth Comp data not found!");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean checkPreAuthCardNo() {
|
||||
if(sharedViewModel.transactionsType.getValue() == TransactionsType.PRE_AUTH_VOID) {
|
||||
|
||||
return sharedViewModel.payDetail.getValue().getCardNo().equals(currentCardNo);
|
||||
|
||||
} else if (sharedViewModel.transactionsType.getValue() == TransactionsType.PRE_AUTH_COMPLETE) {
|
||||
|
||||
for(PayDetail payDetail: lists) {
|
||||
if(payDetail.getCardNo().equals(currentCardNo)){
|
||||
sharedViewModel.cardNo.postValue(currentCardNo);
|
||||
return true;
|
||||
}else{
|
||||
LogUtil.d(TAG,"not found 1!");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void observeList(){
|
||||
emvReadCardViewModel.emvList.observe(getViewLifecycleOwner(), new Observer<List<EMVCandidateV2>>() {
|
||||
@Override
|
||||
public void onChanged(List<EMVCandidateV2> emvCandidateV2s) {
|
||||
showListDialog(emvCandidateV2s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showListDialog(List<EMVCandidateV2> list) {
|
||||
if (mListDialog == null) {
|
||||
mListDialog = new ListDialog(getContext());
|
||||
mListDialog.setTitleText(R.string.index_select_app);
|
||||
mListDialog.setCancelable(true);
|
||||
mListDialog.setCanceledOnTouchOutside(true);
|
||||
}
|
||||
List<String> tempList = new ArrayList<>();
|
||||
for (EMVCandidateV2 emvCandidateV2 : list) {
|
||||
tempList.add(emvCandidateV2.appLabel);
|
||||
}
|
||||
mListDialog.setData(tempList);
|
||||
mListDialog.setOnItemClickListener(
|
||||
position -> {
|
||||
emvReadCardViewModel.setEmvAppSelect(position);
|
||||
}
|
||||
);
|
||||
try {
|
||||
mListDialog.show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void buildCardData(){
|
||||
TradeData tradeData = Params.newTrade(false);
|
||||
PayDetail payDetails = tradeData.getPayDetail();
|
||||
payDetails.setCardNo(emvReadCardViewModel.cardNum.getValue());
|
||||
payDetails.setEXPDate(emvReadCardViewModel.expDate.getValue());
|
||||
payDetails.setCardType(1);
|
||||
payDetails.setAccountType("VISA");
|
||||
payDetails.setCardHolderName("card holder");
|
||||
// payDetails.setCardInfo();
|
||||
|
||||
transProcessViewModel.setTradeData(tradeData);
|
||||
transProcessViewModel.transType.postValue(sharedViewModel.transactionsType.getValue());
|
||||
}
|
||||
|
||||
private void checkRoute(){
|
||||
|
||||
buildCardData();
|
||||
|
||||
if(checkPreAuthCardNo()){
|
||||
getNavController(Constants.NAV_HOST_ID).navigate(routeID);
|
||||
}else{
|
||||
showDeclineDialog("Mismatch Card No!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class ClickEvent {
|
||||
public void onConfirm() {
|
||||
checkRoute();
|
||||
}
|
||||
|
||||
public void onCancel() {
|
||||
if(sharedViewModel.isEcr.getValue() != null){
|
||||
if(sharedViewModel.isEcr.getValue()){
|
||||
sharedViewModel.isEcr.postValue(false);
|
||||
sharedViewModel.isEcrFinished.postValue(true);
|
||||
CoreUtils.getInstance(sharedViewModel).responseRejectMsg("Canceled Transactions!");
|
||||
// ECRHelper.INSTANCE.send("Canceled Transactions!".getBytes());
|
||||
}
|
||||
}
|
||||
|
||||
getNavController(Constants.NAV_HOST_ID).navigate(popBackID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17,6 +17,7 @@ import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.print.PaperRollStatusCallback;
|
||||
import com.utsmyanmar.paylibs.print.PrintHelper;
|
||||
import com.utsmyanmar.paylibs.print.PrintReceipt;
|
||||
import com.utsmyanmar.paylibs.utils.PrintStatus;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||
@ -27,7 +28,7 @@ import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||
|
||||
public class PrintReceiptFragment extends DataBindingFragment implements DataBindingFragment.BackPressCallback {
|
||||
private SharedViewModel sharedViewModel;
|
||||
private static final String TAG = PrintReceiptFragment.class.getSimpleName();
|
||||
private static final String TAG = PrintReceipt.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected int currentId() {
|
||||
|
||||
@ -0,0 +1,460 @@
|
||||
package com.utsmm.kbz.ui.core_viewmodel;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.RemoteException;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.sunmi.pay.hardware.aidl.bean.CardInfo;
|
||||
import com.sunmi.pay.hardware.aidlv2.AidlConstantsV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.EMVCandidateV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.EMVTransDataV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.emv.EMVListenerV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.emv.EMVOptV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.pinpad.PinPadOptV2;
|
||||
import com.utsmyanmar.baselib.repo.Repository;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.model.TradeData;
|
||||
import com.utsmyanmar.paylibs.system.SingleLiveEvent;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.KernelDataProcessUtil;
|
||||
import com.utsmm.kbz.MyApplication;
|
||||
import com.utsmm.kbz.util.enums.EmvReadStatus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel;
|
||||
|
||||
/*
|
||||
* Currently this class is not used
|
||||
* */
|
||||
@HiltViewModel
|
||||
public class EmvReadCardViewModel extends ViewModel {
|
||||
|
||||
private static final String TAG = EmvReadCardViewModel.class.getSimpleName();
|
||||
|
||||
private final Repository repository;
|
||||
|
||||
public SingleLiveEvent<String> cardNum = new SingleLiveEvent<>();
|
||||
|
||||
public SingleLiveEvent<String> expDate = new SingleLiveEvent<>();
|
||||
|
||||
public SingleLiveEvent<EmvReadStatus> resultStatus = new SingleLiveEvent<>();
|
||||
|
||||
public SingleLiveEvent<List<EMVCandidateV2>> emvList = new SingleLiveEvent<>();
|
||||
|
||||
public SingleLiveEvent<Boolean> isButtonVisible = new SingleLiveEvent<>();
|
||||
|
||||
public SingleLiveEvent<String> emvCardType = new SingleLiveEvent<>();
|
||||
|
||||
public SingleLiveEvent<String> errorCode = new SingleLiveEvent<>();
|
||||
|
||||
private String mTag9F06Value;
|
||||
|
||||
public TradeData mTradeData;
|
||||
public PayDetail mPayDetail;
|
||||
|
||||
private EMVOptV2 mEMVOptV2;
|
||||
private PinPadOptV2 mPinPadOptV2;
|
||||
|
||||
private static final int CHECK_CARD_FAIL = 1;
|
||||
private static final int CHECK_CARD_SUCCESS = 2;
|
||||
private static final int CHECK_CARD_MAG = 3;
|
||||
private static final int CHECK_CARD_NFC = 4;
|
||||
private static final int CHECK_CARD_IC = 5;
|
||||
private static final int EMV_APP_SELECT = 6;
|
||||
private static final int EMV_CONFIRM_CARD_NO = 7;
|
||||
|
||||
private Looper mLooper = Looper.getMainLooper();
|
||||
private final Handler mHandler = new Handler(mLooper) {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case CHECK_CARD_FAIL:
|
||||
String hint = (String) msg.obj;
|
||||
resultStatus.postValue(EmvReadStatus.FAIL);
|
||||
// checkCardFail(msg.arg1, hint);
|
||||
break;
|
||||
case EMV_APP_SELECT:
|
||||
List<EMVCandidateV2> list = ( List<EMVCandidateV2> ) msg.obj;
|
||||
emvList.postValue(list);
|
||||
resultStatus.postValue(EmvReadStatus.SELECT_APP);
|
||||
case CHECK_CARD_SUCCESS:
|
||||
getCardInfo();
|
||||
getF055Data();
|
||||
terminateTrans();
|
||||
resultStatus.postValue(EmvReadStatus.SUCCESS);
|
||||
break;
|
||||
case EMV_CONFIRM_CARD_NO:
|
||||
getCardInfo();
|
||||
getF055Data();
|
||||
terminateTrans();
|
||||
resultStatus.postValue(EmvReadStatus.SUCCESS);
|
||||
try {
|
||||
mEMVOptV2.importCardNoStatus(0);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case CHECK_CARD_MAG:
|
||||
Bundle bundle = (Bundle) msg.obj;
|
||||
// handleMagCard(bundle);
|
||||
break;
|
||||
case CHECK_CARD_NFC:
|
||||
// handleNFCCard();
|
||||
break;
|
||||
case CHECK_CARD_IC:
|
||||
// handleICCard();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public void terminateTrans(){
|
||||
try {
|
||||
mEMVOptV2.abortTransactProcess();
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void setEmvAppSelect(int position){
|
||||
try {
|
||||
mEMVOptV2.importAppSelect(position);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
public EmvReadCardViewModel(Repository repository){
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
public void setTradeData(TradeData tradeData){
|
||||
this.mTradeData = tradeData;
|
||||
mPayDetail = mTradeData.getPayDetail();
|
||||
}
|
||||
|
||||
public TradeData getTradeData(){
|
||||
return mTradeData;
|
||||
}
|
||||
|
||||
public void startProcess(){
|
||||
initView();
|
||||
initEmvTlvData();
|
||||
transactProcess();
|
||||
}
|
||||
|
||||
private void initView(){
|
||||
mEMVOptV2 = MyApplication.getInstance().mEMVOptV2;
|
||||
mPinPadOptV2 = MyApplication.getInstance().mPinPadOptV2;
|
||||
|
||||
}
|
||||
|
||||
private void initEmvTlvData() {
|
||||
try {
|
||||
|
||||
// set PayWave(Visa) tlv data
|
||||
String[] tagsPayWave = {"DF8124", "DF8125", "DF8126"};
|
||||
String[] valuesPayWave = {"999999999999", "999999999999", "000000000000"};
|
||||
mEMVOptV2.setTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_PAYWAVE, tagsPayWave, valuesPayWave);
|
||||
|
||||
|
||||
// set JCB Wave tlv data
|
||||
String[] tagsJCB = {"9F53", "DF8161"};
|
||||
String[] valuesJCB = {"708000", "7F00"};
|
||||
mEMVOptV2.setTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_JCB, tagsJCB, valuesJCB);
|
||||
|
||||
// set PayPass(MasterCard) tlv data
|
||||
String[] tagsPayPass = {"DF8117", "DF8118", "DF8119", "DF811F", "DF811E", "DF812C",
|
||||
"DF8123", "DF8124", "DF8125", "DF8126",
|
||||
"DF811B", "DF811D", "DF8122", "DF8120", "DF8121"};
|
||||
String[] valuesPayPass = {"E0", "F8", "F8", "E8", "00", "00",
|
||||
"000000000000", "000000100000", "999999999999", "000000100000",
|
||||
"30", "02", "0000000000", "000000000000", "000000000000"};
|
||||
mEMVOptV2.setTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_PAYPASS, tagsPayPass, valuesPayPass);
|
||||
|
||||
// set AMEX(AmericanExpress) tlv data
|
||||
String[] tagsAE = {"9F6D", "9F6E", "9F33", "9F35", "DF8168", "DF8167", "DF8169", "DF8170"};
|
||||
String[] valuesAE = {"C0", "D8E00000", "E0E888", "22", "00", "00", "00", "60"};
|
||||
mEMVOptV2.setTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_AE, tagsAE, valuesAE);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void transactProcess() {
|
||||
// LogUtil.e(TAG, "***************************************************************");
|
||||
// LogUtil.e(TAG, "****************************Start Process**********************");
|
||||
// LogUtil.e(TAG, "***************************************************************");
|
||||
//
|
||||
// LogUtil.e(TAG, "transactProcess");
|
||||
try {
|
||||
|
||||
mEMVOptV2.initEmvProcess();
|
||||
|
||||
EMVTransDataV2 emvTransData = new EMVTransDataV2();
|
||||
emvTransData.amount = "1000";
|
||||
// if(mPayDetail.cardType == AidlConstantsV2.CardType.NFC.getValue()){
|
||||
// emvTransData.flowType = AidlConstantsV2.EMV.FlowType.TYPE_NFC_SPEEDUP;
|
||||
// }else{
|
||||
// emvTransData.flowType = AidlConstantsV2.EMV.FlowType.TYPE_EMV_STANDARD;
|
||||
// }
|
||||
emvTransData.flowType = 2;
|
||||
emvTransData.cardType = mPayDetail.cardType;
|
||||
|
||||
mEMVOptV2.transactProcess(emvTransData, mEMVListener);
|
||||
} catch (Exception e) {
|
||||
resultStatus.postValue(EmvReadStatus.FAIL);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void initEmvProcess() {
|
||||
try {
|
||||
// Set normal TLV data
|
||||
String[] tags = {"5F2A", "5F36"};
|
||||
String[] values = {"0104", "00"};
|
||||
mEMVOptV2.setTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_NORMAL, tags, values);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private EMVListenerV2 mEMVListener = new EMVListenerV2.Stub() {
|
||||
|
||||
@Override
|
||||
public void onWaitAppSelect(List<EMVCandidateV2> appNameList, boolean isFirstSelect) throws RemoteException {
|
||||
// LogUtil.e(TAG, "onWaitAppSelect isFirstSelect:" + isFirstSelect);
|
||||
mHandler.obtainMessage(EMV_APP_SELECT, appNameList).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAppFinalSelect(String tag9F06Value) throws RemoteException {
|
||||
// LogUtil.d(TAG, "tag9F06Value:" + tag9F06Value);
|
||||
mTag9F06Value = tag9F06Value;
|
||||
initEmvProcess();
|
||||
|
||||
/* if (tag9F06Value != null && tag9F06Value.length() > 0) {
|
||||
boolean visa = tag9F06Value.startsWith("A000000003");
|
||||
boolean master = tag9F06Value.startsWith("A000000004");
|
||||
boolean unionPay = tag9F06Value.startsWith("A000000333");
|
||||
boolean jcb = tag9F06Value.startsWith("A000000065");
|
||||
if (visa) {
|
||||
emvCardType.postValue("VISA");
|
||||
// VISA - PayWave
|
||||
mPayDetail.setAccountType("Visa");
|
||||
LogUtil.d(TAG, "detect VISA card");
|
||||
String[] tagsPayWave = {
|
||||
// "DF8124", "DF8125", "DF8126"
|
||||
"9F33"
|
||||
|
||||
};
|
||||
String[] valuesPayWave = {
|
||||
// "999999999999", "999999999999", "000000000000"
|
||||
"002888"
|
||||
|
||||
};
|
||||
mEMVOptV2.setTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_NORMAL, tagsPayWave, valuesPayWave);
|
||||
} else if (master) {
|
||||
|
||||
emvCardType.postValue("MASTER");
|
||||
// MasterCard - PayPass
|
||||
mPayDetail.setAccountType("Master");
|
||||
LogUtil.d(TAG, "detect MasterCard card");
|
||||
// String[] tagsPayPass = {
|
||||
// "DF8118", "DF8119", "DF811F", "DF811E",
|
||||
// "DF8123", "DF8124", "DF8125", "DF8126",
|
||||
// "DF811B", "DF811D", "DF8122", "DF8120", "DF8121"
|
||||
// };
|
||||
// String[] valuesPayPass = {
|
||||
// "28", "08", "08", "10",
|
||||
// "000000010000", "000000030000", "000000050000", "000000001000",
|
||||
// "00", "00", "0000000000", "0000000000", "0000000000"
|
||||
// };
|
||||
String[] tagsPayPass = {
|
||||
"DF8117", "DF8118", "DF8119", "DF811F", "DF811E", "DF812C",
|
||||
"DF8123", "DF8124", "DF8125", "DF8126",
|
||||
"DF811B", "DF811D", "DF8122", "DF8120", "DF8121"
|
||||
};
|
||||
String[] valuesPayPass = {
|
||||
"E0", "F8", "F8", "E8", "00", "00",
|
||||
"999999999999", "000000001000", "000000001000", "000000001000",
|
||||
"30", "02", "0000000000", "000000000000", "000000000000"
|
||||
};
|
||||
mEMVOptV2.setTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_PAYPASS, tagsPayPass, valuesPayPass);
|
||||
} else if (unionPay) {
|
||||
emvCardType.postValue("UnionPay");
|
||||
mPayDetail.setAccountType("UPI");
|
||||
// UnionPay
|
||||
LogUtil.d(TAG, "detect UnionPay card");
|
||||
String[] tagsPayPass = {
|
||||
"DF8120", "DF8121", "DF8122"
|
||||
};
|
||||
String[] valuesPayPass = {
|
||||
"D84000A800", "DC4004F800", "0100000000"
|
||||
};
|
||||
mEMVOptV2.setTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_NORMAL, tagsPayPass, valuesPayPass);
|
||||
} else if(jcb) {
|
||||
emvCardType.postValue("JCB");
|
||||
mPayDetail.setAccountType("JCB");
|
||||
// UnionPay
|
||||
LogUtil.d(TAG, "detect JCB card");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (AidlConstants.CardType.IC.getValue() == mPayDetail.cardType) {
|
||||
String[] tags = {
|
||||
"9F33", "9F09", "DF81FF"
|
||||
};
|
||||
String[] values = {
|
||||
"6060C8", "0111", "01"
|
||||
// "0008C8", "0111", "01"
|
||||
};
|
||||
mEMVOptV2.setTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_NORMAL, tags, values);
|
||||
}*/
|
||||
|
||||
mEMVOptV2.importAppFinalSelectStatus(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmCardNo(String cardNo) {
|
||||
// LogUtil.e(TAG, "onConfirmCardNo cardNo:" + cardNo);
|
||||
|
||||
mHandler.sendEmptyMessage(EMV_CONFIRM_CARD_NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestShowPinPad(int type, int remainTime) throws RemoteException {
|
||||
// LogUtil.e(TAG, "requestShowPinPad type:" + type + " remainTime:" + remainTime);
|
||||
mHandler.sendEmptyMessage(CHECK_CARD_SUCCESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestSignature() throws RemoteException {
|
||||
// LogUtil.e(TAG, "signatureStatus");
|
||||
mEMVOptV2.importSignatureStatus(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCertVerify(int certType, String certInfo) throws RemoteException {
|
||||
// LogUtil.e(TAG, "onCertVerify certType:" + certType + " certInfo:" + certInfo);
|
||||
mEMVOptV2.importCertStatus(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOnlineProc() throws RemoteException {
|
||||
// LogUtil.e(TAG, "onProcessEnd");
|
||||
mHandler.sendEmptyMessage(CHECK_CARD_SUCCESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCardDataExchangeComplete() throws RemoteException {
|
||||
// LogUtil.e(TAG, "onCardDataExchangeComplete");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmationCodeVerified() throws RemoteException {
|
||||
// LogUtil.e(TAG, "onConfirmationCodeVerified");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestDataExchange(String s) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTermRiskManagement() throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPreFirstGenAC() throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransResult(int code, String desc) throws RemoteException {
|
||||
|
||||
/*
|
||||
* Temporary Error Message
|
||||
* */
|
||||
|
||||
String errorMsg = "Card read failed!";
|
||||
|
||||
errorCode.postValue(code+":"+errorMsg);
|
||||
if (code != 0) {
|
||||
if( code == -50011) {
|
||||
mHandler.sendEmptyMessage(CHECK_CARD_SUCCESS);
|
||||
} else {
|
||||
mHandler.obtainMessage(CHECK_CARD_FAIL, code, code, desc).sendToTarget();
|
||||
}
|
||||
|
||||
} else {
|
||||
mHandler.sendEmptyMessage(CHECK_CARD_SUCCESS);
|
||||
}
|
||||
// LogUtil.e(TAG, "onTransResult code:" + code + " desc:" + desc);
|
||||
// LogUtil.e(TAG, "***************************************************************");
|
||||
// LogUtil.e(TAG, "****************************End Process************************");
|
||||
// LogUtil.e(TAG, "***************************************************************");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private void getCardInfo() {
|
||||
String[] tagList = {"5A", "5F24", "57", "5F34", "9F6B"};
|
||||
byte[] outData = new byte[1024];
|
||||
try {
|
||||
int len = mEMVOptV2.getTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_NORMAL, tagList, outData);
|
||||
if (len > 0) {
|
||||
byte[] data = new byte[len];
|
||||
System.arraycopy(outData, 0, data, 0, len);
|
||||
CardInfo cardInfo = KernelDataProcessUtil.getCardInfo(mPayDetail.cardType, data);
|
||||
mTradeData = KernelDataProcessUtil.fillTradeDataInfo(cardInfo, mTradeData);
|
||||
|
||||
//display card data in layout
|
||||
cardNum.postValue(mPayDetail.getCardNo());
|
||||
expDate.postValue(mPayDetail.getEXPDate());
|
||||
} else {
|
||||
// LogUtil.e(Constant.TAG, "The data length of the card information is negative = " + len);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void getF055Data() {
|
||||
/* For Yoma */
|
||||
/*Jun 6 Added 9F2A*/
|
||||
String[] tagList={
|
||||
"9F2A","9F26","9F27","9F10","9F37","9F36","95","9A","9C","9F02","5F2A","5F34","82","9F1A", //field 55 tag
|
||||
"9F03","9F33","4F","9F08","9F34","9F35","9F1E","9F53","84","9F09","9F41", //field55 tag
|
||||
"9F5B","8A","9B","9F6E","9F7C","9F4C","50","9F12","DF01","9F63","5F20","9F0B","9F42"
|
||||
|
||||
};
|
||||
byte[] outData = new byte[2048];
|
||||
try {
|
||||
int len = mEMVOptV2.getTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_NORMAL, tagList, outData);
|
||||
if (len > 0) {
|
||||
byte[] data = new byte[len];
|
||||
System.arraycopy(outData, 0, data, 0, len);
|
||||
mTradeData = KernelDataProcessUtil.readKernelData(data, mTradeData);
|
||||
} else {
|
||||
// LogUtil.e(Constant.TAG, "Get the data length of the 55 field as a negative number = " + len);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,6 @@ import com.utsmyanmar.baselib.emv.EmvParamOperation;
|
||||
import com.utsmyanmar.baselib.repo.Repository;
|
||||
import com.utsmyanmar.baselib.util.enums.EmvResultStatus;
|
||||
import com.utsmyanmar.baselib.viewModel.EmvBaseViewModel;
|
||||
import com.utsmyanmar.checkxread.util.CardTypeX;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.model.TradeData;
|
||||
import com.utsmyanmar.paylibs.model.enums.TransCVM;
|
||||
@ -289,8 +288,6 @@ public class EmvTransactionProcessViewModel extends EmvBaseViewModel implements
|
||||
|
||||
if(isCardLessTrans()) {
|
||||
transResult.setValue(TransResultStatus.SUCCESS);
|
||||
} else if(payDetailRes.getCardType() == CardTypeX.MANUAL.value) {
|
||||
transResult.setValue(TransResultStatus.SUCCESS);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -298,8 +295,6 @@ public class EmvTransactionProcessViewModel extends EmvBaseViewModel implements
|
||||
|
||||
if(isCardLessTrans()) {
|
||||
transResult.setValue(TransResultStatus.FAIL);
|
||||
} else if(payDetailRes.getCardType() == CardTypeX.MANUAL.value) {
|
||||
transResult.setValue(TransResultStatus.FAIL);
|
||||
}
|
||||
/*
|
||||
* @Note
|
||||
|
||||
@ -7,6 +7,7 @@ import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.EMVCandidateV2;
|
||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||
import com.utsmyanmar.baselib.ui.ListDialog;
|
||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||
@ -67,6 +68,20 @@ public class TestFragment extends DataBindingFragment {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private String[] getCandidateNames(List<EMVCandidateV2> candiList) {
|
||||
if (candiList == null || candiList.size() == 0) return new String[0];
|
||||
String[] result = new String[candiList.size()];
|
||||
for (int i = 0; i < candiList.size(); i++) {
|
||||
EMVCandidateV2 candi = candiList.get(i);
|
||||
String name = candi.appPreName;
|
||||
name = TextUtils.isEmpty(name) ? candi.appLabel : name;
|
||||
name = TextUtils.isEmpty(name) ? candi.appName : name;
|
||||
name = TextUtils.isEmpty(name) ? "" : name;
|
||||
result[i] = name;
|
||||
LogUtil.e(Constant.TAG, "EMVCandidateV2: " + name);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void showCandiListDialog(String[] list) {
|
||||
if (mListDialog == null) {
|
||||
|
||||
@ -15,6 +15,7 @@ import com.utsmyanmar.baselib.util.DialogCallback;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.model.QRSettleData;
|
||||
import com.utsmyanmar.paylibs.print.PrintHelper;
|
||||
import com.utsmyanmar.paylibs.print.PrintReceipt;
|
||||
import com.utsmyanmar.paylibs.print.printx.PrintXReceipt;
|
||||
import com.utsmyanmar.paylibs.print.printx.PrintXStatus;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
@ -35,7 +36,7 @@ public class ReprintReceiptFragment extends DataBindingFragment {
|
||||
private ManagementViewModel managementViewModel;
|
||||
private SharedViewModel sharedViewModel;
|
||||
|
||||
private static final String TAG = ReprintReceiptFragment.class.getSimpleName();
|
||||
private static final String TAG = PrintReceipt.class.getSimpleName();
|
||||
|
||||
private PayDetail payDetail;
|
||||
|
||||
|
||||
@ -1,13 +1,17 @@
|
||||
package com.utsmm.kbz.ui.navigation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.RemoteException;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.nexgo.oaf.apiv3.APIProxy;
|
||||
import com.nexgo.oaf.apiv3.DeviceEngine;
|
||||
import com.nexgo.oaf.apiv3.DeviceInfo;
|
||||
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||
import com.utsmyanmar.paylibs.system.SingleLiveEvent;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
import com.utsmm.kbz.MyApplication;
|
||||
|
||||
public class VersionViewModel extends ViewModel {
|
||||
|
||||
@ -32,6 +36,29 @@ public class VersionViewModel extends ViewModel {
|
||||
// loadDeviceInfo();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
String txtHardwareVersion = getParams(AidlConstants.SysParam.HARDWARE_VERSION);
|
||||
hardwareVersion.setValue(txtHardwareVersion);
|
||||
String txtFirmwareVersion = getParams(AidlConstants.SysParam.FIRMWARE_VERSION);
|
||||
firmwareVersion.setValue(txtFirmwareVersion);
|
||||
String txtSerialNo = getParams(AidlConstants.SysParam.SN);
|
||||
serialNumber.setValue(txtSerialNo);
|
||||
String txtDeviceModel = getParams(AidlConstants.SysParam.DEVICE_MODEL);
|
||||
deviceModel.setValue(txtDeviceModel);
|
||||
|
||||
swFinalVersion.setValue(SystemParamsOperation.getInstance().getFinalVersion());
|
||||
|
||||
}
|
||||
|
||||
private String getParams(String name) {
|
||||
String value = "";
|
||||
try {
|
||||
value = MyApplication.getInstance().basicOptBinder.getSysParam(name);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public void loadDeviceInfo(Context context){
|
||||
try{
|
||||
|
||||
@ -18,6 +18,7 @@ import com.nexgo.oaf.apiv3.device.pinpad.PinKeyboardViewModeEnum;
|
||||
import com.nexgo.oaf.apiv3.device.pinpad.PinPad;
|
||||
import com.nexgo.oaf.apiv3.device.pinpad.PinPadKeyCode;
|
||||
import com.nexgo.oaf.apiv3.device.pinpad.PinpadLayoutEntity;
|
||||
import com.sunmi.pay.hardware.aidlv2.pinpad.PinPadOptV2;
|
||||
import com.utsmyanmar.baselib.BaseApplication;
|
||||
import com.utsmyanmar.baselib.ui.CustomPinPadKeyboard;
|
||||
|
||||
@ -37,6 +38,7 @@ public class PinPadViewModel extends ViewModel {
|
||||
|
||||
private static final String TAG = PinPadViewModel.class.getSimpleName();
|
||||
|
||||
private PinPadOptV2 mPinPadOptV2;
|
||||
|
||||
public SingleLiveEvent<String> pinText = new SingleLiveEvent<>();
|
||||
public SingleLiveEvent<String> alertMsg = new SingleLiveEvent<>();
|
||||
@ -172,13 +174,13 @@ public class PinPadViewModel extends ViewModel {
|
||||
|
||||
}
|
||||
|
||||
// public void cancelPinPad() {
|
||||
// try {
|
||||
// mPinPadOptV2.cancelInputPin();
|
||||
// } catch (RemoteException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
public void cancelPinPad() {
|
||||
try {
|
||||
mPinPadOptV2.cancelInputPin();
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void increasedKSN() {
|
||||
pinPad.dukptKsnIncrease(pinIndex); //3
|
||||
|
||||
@ -2,6 +2,8 @@ package com.utsmm.kbz.ui.settings;
|
||||
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.sunmi.pay.hardware.aidlv2.AidlConstantsV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.security.SecurityOptV2;
|
||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||
import com.utsmm.kbz.BR;
|
||||
@ -17,7 +19,7 @@ public class DeleteKeyFragment extends DataBindingFragment {
|
||||
|
||||
private InputKeyViewModel inputKeyViewModel;
|
||||
|
||||
// private final SecurityOptV2 securityOptV2 = MyApplication.getInstance().mSecurityOptV2;
|
||||
private final SecurityOptV2 securityOptV2 = MyApplication.getInstance().mSecurityOptV2;
|
||||
|
||||
@Override
|
||||
protected void initViewModel() {
|
||||
@ -63,9 +65,9 @@ public class DeleteKeyFragment extends DataBindingFragment {
|
||||
|
||||
int keyIndex = Integer.parseInt(inputKeyViewModel.keyIndex.getValue());
|
||||
|
||||
// int result = securityOptV2.deleteKey(AidlConstantsV2.Security.SEC_MKSK,keyIndex);
|
||||
try {
|
||||
int result = securityOptV2.deleteKey(AidlConstantsV2.Security.SEC_MKSK,keyIndex);
|
||||
|
||||
int result = -1;
|
||||
LogUtil.d(TAG,"Delete Key result :"+ result);
|
||||
if( result == 0) {
|
||||
showSuccessDialog(keyIndex + " was deleted successfully!");
|
||||
@ -75,6 +77,9 @@ public class DeleteKeyFragment extends DataBindingFragment {
|
||||
showDeclineDialog(keyIndex + " delete process failure \nError Code : "+result);
|
||||
inputKeyViewModel.keyIndex.setValue("");
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void onCancel() {
|
||||
|
||||
@ -16,7 +16,6 @@ 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;
|
||||
import com.utsmyanmar.paylibs.model.CardSettleData;
|
||||
import com.utsmyanmar.paylibs.model.MsgField;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.model.SettleData;
|
||||
@ -403,8 +402,6 @@ public class SettlementViewModel extends ViewModel {
|
||||
SettleData settleData = new SettleData(saleCount,saleAmount,preAuthCount,preAuthAmount,refundCount,refundAmount,caCount,caAmount);
|
||||
payDetail.setSettleDataObj(settleData);
|
||||
|
||||
payDetail.setCardSettleData(CardSettleData.convertFromPayDetail(payDetails));
|
||||
|
||||
if(hostName == HostName.BPC) {
|
||||
long totalAmount = saleAmount + preAuthAmount + refundAmount + caAmount;
|
||||
|
||||
|
||||
@ -222,7 +222,7 @@ public class TMSProcessFragment extends DataBindingFragment {
|
||||
}
|
||||
CurrencyType currencyType = SystemParamsOperation.getInstance().getCurrencyType();
|
||||
sharedViewModel.set_currencyText(currencyType.name);
|
||||
tmsProcessViewModel.loadEmvParameters();
|
||||
// tmsProcessViewModel.loadEmvParameters();
|
||||
|
||||
// Check and request battery optimization exemption before scheduling alarm
|
||||
requestBatteryOptimizationExemption();
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.utsmm.kbz.util;
|
||||
|
||||
import com.sunmi.pay.hardware.aidlv2.AidlConstantsV2;
|
||||
import com.utsmyanmar.checkxread.model.CardDataX;
|
||||
import com.utsmyanmar.paylibs.model.CardInfo;
|
||||
import com.utsmyanmar.paylibs.model.ICCardInfo;
|
||||
@ -9,7 +10,6 @@ import com.utsmyanmar.paylibs.model.TradeData;
|
||||
import com.utsmyanmar.paylibs.model.enums.TransCVM;
|
||||
import com.utsmyanmar.paylibs.system.SystemDateTime;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
import com.utsmyanmar.paylibs.utils.enums.BaseCardType;
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||
import com.utsmm.kbz.config.Constants;
|
||||
|
||||
@ -52,22 +52,14 @@ public class MockData {
|
||||
// .cardScheme("MPU")
|
||||
// .cardHolderName("KBZ Debit")
|
||||
// .iccData("9503051034047056=30021015930000000000")
|
||||
// .build();
|
||||
// 9505050178841157=28111011310000000000
|
||||
// mockCardData = new MockCardData.Builder()
|
||||
// .cardNo("9505050161133125")
|
||||
// .expDate("2701")
|
||||
// .cardScheme("MPU")
|
||||
// .cardHolderName("KBZ Credit")
|
||||
// .iccData("9505050161133125=27011017250000000000")
|
||||
// .build();
|
||||
|
||||
mockCardData = new MockCardData.Builder()
|
||||
.cardNo("9505050178841157")
|
||||
.expDate("2811")
|
||||
.cardNo("9505050161133125")
|
||||
.expDate("2701")
|
||||
.cardScheme("MPU")
|
||||
.cardHolderName("KBZ Preprod")
|
||||
.iccData("9505050178841157=28111011310000000000")
|
||||
.cardHolderName("KBZ Credit")
|
||||
.iccData("9505050161133125=27011017250000000000")
|
||||
.build();
|
||||
|
||||
// mockCardData = new MockCardData.Builder()
|
||||
@ -351,7 +343,7 @@ public class MockData {
|
||||
String refundAmount = "1000";
|
||||
int caCount = 0;
|
||||
String caAmount = "0";
|
||||
int cardInputType = BaseCardType.IC.getValue();
|
||||
int cardInputType = AidlConstantsV2.CardType.IC.getValue();
|
||||
TradeData tradeData = generateMockData(TransactionsType.SETTLEMENT,cardInputType);
|
||||
PayDetail payDetail = tradeData.getPayDetail();
|
||||
int totalAmount = Integer.parseInt(saleAmount) + Integer.parseInt(preAuthAmount) + Integer.parseInt(refundAmount);
|
||||
|
||||
95
app/src/main/res/layout/emv_card_read_template.xml
Normal file
95
app/src/main/res/layout/emv_card_read_template.xml
Normal file
@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
<import type="com.utsmyanmar.paylibs.utils.POSUtil"/>
|
||||
<variable
|
||||
name="emv"
|
||||
type="com.utsmm.kbz.ui.core_viewmodel.EmvReadCardViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:bind="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_margin="22dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="184dp"
|
||||
android:background="@drawable/payment_card"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_pan"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{POSUtil.getInstance().interceptCardNo(emv.cardNum)}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/pan_size"
|
||||
bind:text="5031 3300 1333 5858"
|
||||
android:fontFamily="@font/rubik_medium"
|
||||
android:layout_marginStart="22dp"
|
||||
android:layout_marginBottom="18dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/text_exp"
|
||||
android:textColor="@color/white"
|
||||
android:fontFamily="@font/rubik_medium"
|
||||
android:textSize="@dimen/sub_text_size"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/guideline_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{POSUtil.getInstance().getFormatExpDate(emv.expDate)}"
|
||||
android:textColor="@color/white"
|
||||
android:fontFamily="@font/rubik_medium"
|
||||
android:textSize="@dimen/sub_text_size"
|
||||
bind:text="22/33"
|
||||
android:layout_marginStart="@dimen/margin_button"
|
||||
app:layout_constraintStart_toEndOf="@+id/textView8"
|
||||
app:layout_constraintTop_toTopOf="@+id/guideline_horizontal" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_margin="@dimen/margin_button"
|
||||
bind:imgLogo="@{emv.emvCardType}"
|
||||
bind:src="@drawable/logo_visa_transparent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
71
app/src/main/res/layout/fragment_emv_card_read.xml
Normal file
71
app/src/main/res/layout/fragment_emv_card_read.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout>
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="emv"
|
||||
type="com.utsmm.kbz.ui.core_viewmodel.EmvReadCardViewModel" />
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.utsmm.kbz.ui.core_ui.EmvReadCardFragment.ClickEvent" />
|
||||
|
||||
</data>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:bind="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include
|
||||
bind:emv="@{emv}"
|
||||
layout="@layout/emv_card_read_template"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_rounded_btn_cancel"
|
||||
android:text="@string/layout_cancel"
|
||||
android:fontFamily="@font/rubik_medium"
|
||||
android:onClick="@{()->click.onCancel()}"
|
||||
android:textColor="@color/light_grey_text"
|
||||
android:layout_margin="@dimen/margin_button"
|
||||
android:visibility="@{emv.isButtonVisible ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline_middle"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline_middle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_confirm"
|
||||
android:onClick="@{()->click.onConfirm() }"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_button"
|
||||
android:visibility="@{emv.isButtonVisible ? View.VISIBLE : View.GONE}"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@drawable/bg_rounded_btn"
|
||||
android:text="@string/layout_confirm"
|
||||
android:fontFamily="@font/rubik_medium"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/guideline_middle" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
@ -521,7 +521,24 @@
|
||||
app:destination="@id/timeoutFragment" />
|
||||
</fragment>
|
||||
|
||||
|
||||
<fragment
|
||||
tools:layout="@layout/fragment_emv_card_read"
|
||||
android:id="@+id/emvReadCardFragment"
|
||||
android:name="com.utsmm.kbz.ui.core_ui.EmvReadCardFragment"
|
||||
android:label="EmvReadCardFragment" >
|
||||
<action
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@+id/mobile_navigation"
|
||||
app:popUpToInclusive="true"
|
||||
android:id="@+id/action_emvReadCardFragment_to_nav_main"
|
||||
app:destination="@id/nav_main" />
|
||||
<action
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@+id/cardWaitingFragment"
|
||||
app:popUpToInclusive="true"
|
||||
android:id="@+id/action_emvReadCardFragment_to_inputRRNFragment"
|
||||
app:destination="@id/inputRRNFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
tools:layout="@layout/fragment_transaction_detail"
|
||||
android:id="@+id/transactionDetailFragment"
|
||||
|
||||
@ -83,7 +83,7 @@ dependencies {
|
||||
// implementation 'com.sunmi:sunmiui:1.1.27'
|
||||
|
||||
// implementation project(path: ':PayLib-release-1.4.58')
|
||||
// implementation project(path: ':paysdk-lib')
|
||||
implementation project(path: ':paysdk-lib')
|
||||
implementation project(path: ':nexsdk-lib')
|
||||
implementation project(path: ':xpay')
|
||||
implementation project(path: ':nexdlkey-lib')
|
||||
|
||||
@ -6,6 +6,16 @@ import com.kizzy.xpay.XPay;
|
||||
import com.nexgo.oaf.apiv3.APIProxy;
|
||||
import com.nexgo.oaf.apiv3.DeviceEngine;
|
||||
import com.nexgo.oaf.apiv3.device.reader.CardSlotTypeEnum;
|
||||
import com.sunmi.pay.hardware.aidl.emv.EMVOpt;
|
||||
import com.sunmi.pay.hardware.aidl.pinpad.PinPadOpt;
|
||||
import com.sunmi.pay.hardware.aidl.readcard.ReadCardOpt;
|
||||
import com.sunmi.pay.hardware.aidl.security.SecurityOpt;
|
||||
import com.sunmi.pay.hardware.aidl.system.BasicOpt;
|
||||
import com.sunmi.pay.hardware.aidlv2.emv.EMVOptV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.pinpad.PinPadOptV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.readcard.ReadCardOptV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.security.SecurityOptV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.system.BasicOptV2;
|
||||
import com.sunmi.peripheral.printer.InnerPrinterCallback;
|
||||
import com.sunmi.peripheral.printer.InnerPrinterException;
|
||||
import com.sunmi.peripheral.printer.InnerPrinterManager;
|
||||
@ -15,7 +25,9 @@ import com.utsmyanmar.baselib.emv.TerminalParamOperation;
|
||||
import com.utsmyanmar.checkxread.sdk.NexGoSDK;
|
||||
//import com.utsmyanmar.ecr.ECRUtil;
|
||||
|
||||
import com.utsmyanmar.checkxread.sdk.SunmiSDK;
|
||||
import com.utsmyanmar.paylibs.PayLibNex;
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
import com.utsmyanmar.paylibs.network.ISOSocket;
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
@ -25,6 +37,7 @@ import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import sunmi.paylib.SunmiPayKernel;
|
||||
|
||||
|
||||
//@HiltAndroidApp
|
||||
@ -32,6 +45,19 @@ public class BaseApplication extends Application {
|
||||
|
||||
public DeviceEngine deviceEngine;
|
||||
private static BaseApplication app;
|
||||
|
||||
public SunmiPayKernel sunmiPayKernel;
|
||||
|
||||
public EMVOpt emvOpt;
|
||||
public PinPadOpt pinPadOpt;
|
||||
public ReadCardOpt readCardOpt;
|
||||
public static BasicOptV2 basicOptV2;
|
||||
public BasicOpt basicOptBinder;
|
||||
public SecurityOpt securityOpt;
|
||||
public EMVOptV2 mEMVOptV2;
|
||||
public PinPadOptV2 mPinPadOptV2;
|
||||
public SecurityOptV2 mSecurityOptV2;
|
||||
public ReadCardOptV2 mReadCardOptV2;
|
||||
public static SunmiPrinterService sunmiPrinterService;
|
||||
|
||||
private Map<String, String> configMap;
|
||||
@ -52,9 +78,8 @@ public class BaseApplication extends Application {
|
||||
app = this;
|
||||
|
||||
// bindSDKServices();
|
||||
// PayLibsUtils.getInstance().initLib(app);;
|
||||
PayLibsUtils.getInstance().initLib(app);;
|
||||
// ECRUtil.INSTANCE.setContext(app);
|
||||
PayLibNex.getInstance().initContext(app);
|
||||
ISOSocket.getInstance().initContext(getApplicationContext());
|
||||
|
||||
initNexGo();
|
||||
@ -73,7 +98,7 @@ public class BaseApplication extends Application {
|
||||
deviceEngine.getEmvHandler2("app2");
|
||||
|
||||
NexGoSDK.getInstance().initSDK(deviceEngine.getCardReader(), deviceEngine.getBeeper(), deviceEngine.getCPUCardHandler(CardSlotTypeEnum.ICC1));
|
||||
PayLibNex.getInstance().initSDK(deviceEngine);
|
||||
PayLibNex.getInstance().initDeviceEngine(deviceEngine);
|
||||
TerminalKeyUtil.initNexKey();
|
||||
emvParamOperation.loadAidRids();
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
@ -112,7 +137,7 @@ public class BaseApplication extends Application {
|
||||
@Override
|
||||
protected void onConnected(SunmiPrinterService service) {
|
||||
sunmiPrinterService = service;
|
||||
// PayLibsUtils.getInstance().initLib(sunmiPrinterService);
|
||||
PayLibsUtils.getInstance().initLib(sunmiPrinterService);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
package com.utsmyanmar.baselib;
|
||||
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.AidV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.CapkV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.EmvTermParamV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.emv.EMVOptV2;
|
||||
import com.utsmyanmar.baselib.repo.Repository;
|
||||
import com.utsmyanmar.paylibs.model.AidConfig;
|
||||
import com.utsmyanmar.paylibs.utils.TLV;
|
||||
@ -83,5 +87,489 @@ public final class EmvUtil {
|
||||
|
||||
|
||||
|
||||
public static void setTerminalParam(Map<String, String> map) {
|
||||
try {
|
||||
EMVOptV2 emvOptV2 = BaseApplication.getInstance().mEMVOptV2;
|
||||
|
||||
EmvTermParamV2 emvTermParam = new EmvTermParamV2();
|
||||
emvTermParam.countryCode = map.get("countryCode");
|
||||
emvTermParam.capability = map.get("capability");
|
||||
emvTermParam.addCapability = map.get("addCapability");
|
||||
emvTermParam.currencyCode = map.get("5F2A");
|
||||
emvTermParam.currencyExp = map.get("5F36");
|
||||
emvTermParam.bypassPin = true;
|
||||
emvTermParam.scriptMode = true;
|
||||
emvTermParam.TTQ = map.get("ttq");
|
||||
|
||||
|
||||
|
||||
|
||||
int result = emvOptV2.setTerminalParam(emvTermParam);
|
||||
LogUtil.d(TAG, "setTerminalParam result:" + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.d(TAG, "setTerminalParam fail");
|
||||
}
|
||||
}
|
||||
|
||||
public static void initAidAndRid() {
|
||||
try {
|
||||
EMVOptV2 emvOptV2 = BaseApplication.getInstance().mEMVOptV2;
|
||||
// emvOptV2.deleteAid(null);//clear SDK built-in AIDs
|
||||
// clear SDK built-in AIDs and CAPKs
|
||||
emvOptV2.deleteAid(null);
|
||||
emvOptV2.deleteCapk(null, null);
|
||||
// Normal AIDs
|
||||
AidV2 aid = EmvUtil.hexStr2Aid("9F0608A000000333010101DF0101009F08020020DF1105D84000A800DF1205D84004F800DF130500100000009F1B040000C350DF150400000000DF160199DF170199DF14039F3704DF1801019F7B06100000000000DF1906100000000000DF2006100000000000DF21061000000000005F2A020643");
|
||||
emvOptV2.addAid(aid);
|
||||
aid = EmvUtil.hexStr2Aid("9F0608A000000333010102DF0101009F08020020DF1105D84000A800DF1205D84004F800DF130500100000009F1B040000C350DF150400000000DF160199DF170199DF14039F3704DF1801019F7B06100000000000DF1906000001000000DF2006100000000000DF21060000000700005F2A020643");
|
||||
emvOptV2.addAid(aid);
|
||||
aid = EmvUtil.hexStr2Aid("9F0608A000000333010103DF0101009F08020020DF1105D84000A800DF1205D84004F800DF130500100000009F1B040000C350DF150400000000DF160199DF170199DF14039F3704DF1801019F7B06100000000000DF1906100000000000DF2006100000000000DF21061000000000005F2A020643");
|
||||
emvOptV2.addAid(aid);
|
||||
aid = EmvUtil.hexStr2Aid("9F0608A000000333010106DF0101009F08020020DF1105D84000A800DF1205D84004F800DF130500100000009F1B040000C350DF150400000000DF160199DF170199DF14039F3704DF1801019F7B06100000000000DF1906100000000000DF2006100000000000DF21061000000000005F2A020643");
|
||||
emvOptV2.addAid(aid);
|
||||
// Russia AIDs
|
||||
aid = EmvUtil.hexStr2Aid("9F0607A00000000410109F09020000DF11050000000000DF12050000000000DF130500000000009F1B0400000000DF150400000000DF160100DF170100DF140b9F37049F47018F019F32019F3C0206439F3D0102DF1906000000000000DF2006999999999999DF21060000000700009F4E009F150211119F160c746573746D65726368616E74");
|
||||
emvOptV2.addAid(aid);
|
||||
aid = EmvUtil.hexStr2Aid("9F0607A00000000310109F09020000DF11050000000000DF12050000000000DF130500000000009F1B0400000000DF150400000000DF160100DF170100DF14039F37049F3C0206439F3D0102DF1906000000000000DF2006999999999999DF21060000000700009F4E009F150211119F160c746573746D65726368616E74");
|
||||
emvOptV2.addAid(aid);
|
||||
// India AIDs
|
||||
aid = EmvUtil.hexStr2Aid("9F0607A00000052410109F09020064DF1105FFFFFFFFFFDF1205FFFFFFFFFFDF130500000000009F1B0400000000DF150400000000DF160100DF170100DF14039F37049F3C0203569F3D0102DF1906000000000000DF2006999999999999DF21060000000030009F4E009F15009F1600");
|
||||
emvOptV2.addAid(aid);
|
||||
aid = EmvUtil.hexStr2Aid("9F0607A00000015230109F09020001DF1105FFFFFFFFFFDF1205FFFFFFFFFFDF130500000000009F1B0400000000DF150400000000DF160100DF170100DF14039F37049F3C0203569F3D0102DF1906000000000000DF2006999999999999DF21060000000000009F4E009F15009F1600");
|
||||
emvOptV2.addAid(aid);
|
||||
aid = EmvUtil.hexStr2Aid("9F0607A00000006510109F09020200DF1105FFFFFFFFFFDF1205FFFFFFFFFFDF130500000000009F1B0400000000DF150400000000DF160100DF170100DF14039F37049F3C0203569F3D0102DF1906000000000000DF2006999999999999DF21060000000700009F4E009F15009F1600");
|
||||
emvOptV2.addAid(aid);
|
||||
aid = EmvUtil.hexStr2Aid("9F0608A0000003330101019F09020200DF1105FFFFFFFFFFDF1205FFFFFFFFFFDF130500000000009F1B0400000000DF150400000000DF160100DF170100DF14039F37049F3C0203569F3D0102DF1906000000000000DF2006999999999999DF21060000000000009F4E009F15009F1600");
|
||||
emvOptV2.addAid(aid);
|
||||
// aid = EmvUtil.hexStr2Aid("9F0608A0000003330101029F09020200DF1105FFFFFFFFFFDF1205FFFFFFFFFFDF130500000000009F1B0400000000DF150400000000DF160100DF170100DF14039F37049F3C0203569F3D0102DF1906000001000000DF2006999999999999DF21060000000000009F4E009F15009F1600");
|
||||
// emvOptV2.addAid(aid);
|
||||
aid = EmvUtil.hexStr2Aid("9F0608A0000003330101039F09020200DF1105FFFFFFFFFFDF1205FFFFFFFFFFDF130500000000009F1B0400000000DF150400000000DF160100DF170100DF14039F37049F3C0203569F3D0102DF1906000000000000DF2006999999999999DF21060000000000009F4E009F15009F1600");
|
||||
emvOptV2.addAid(aid);
|
||||
//AE
|
||||
aid = EmvUtil.hexStr2Aid("9F0606A00000002501DF010100DF11050000000000DF12050000000000DF12050000000000DF14039F3704DF150400000000DF160199DF1701009F1B04000027109F090200019F150241129F16063132333435369F4E105261696C776179204F70657261746F729F1C063030303030309F1D0200019F3C020000DF81010200009F3D0102DF8102039F37049F7B060000000100009F01051234567890DF1906000000010000DF2006000000015000DF2106000000005000");
|
||||
emvOptV2.addAid(aid);
|
||||
//添加 MCCS的AID
|
||||
aid = hexStr2Aid("9F01060111111111119F0607A00000061500019F090200019F150211119F160c746573746D65726368616E749F1B04000000009F3C0206439F3D01029F4E009F7B06000000000000DF010100DF1105F45084800CDF1205F45084800CDF13050000000000DF14039F3704DF150400000000DF160100DF170100DF1906000000000000DF2006999999999999DF2106000000025001");
|
||||
emvOptV2.addAid(aid);
|
||||
//添加 JCB的AID
|
||||
aid = EmvUtil.hexStr2Aid("9F0605A0000000659F09020200DF1105FFFFFFFFFFDF1205FFFFFFFFFFDF130500000000009F1B0400000000DF150400000000DF160100DF170100DF14039F37049F3C0203569F3D0102DF1906000000000000DF2006999999999999DF21060000000000009F4E009F15009F1600");
|
||||
emvOptV2.addAid(aid);
|
||||
//添加 JCB的AID
|
||||
// aid = EmvUtil.hexStr2Aid("9F0607A00000006510109F09020200DF1105FFFFFFFFFFDF1205FFFFFFFFFFDF130500000000009F1B0400000000DF150400000000DF160100DF170100DF14039F37049F3C0203569F3D0102DF1906000000000000DF2006999999999999DF21060000000000009F4E009F15009F1600");
|
||||
// emvOptV2.addAid(aid);
|
||||
|
||||
// Normal RIDs
|
||||
CapkV2 capkV2 = EmvUtil.hexStr2Rid("9F0605A0000003339F220104DF05083230323531323331DF060101DF070101DF0281F8BC853E6B5365E89E7EE9317C94B02D0ABB0DBD91C05A224A2554AA29ED9FCB9D86EB9CCBB322A57811F86188AAC7351C72BD9EF196C5A01ACEF7A4EB0D2AD63D9E6AC2E7836547CB1595C68BCBAFD0F6728760F3A7CA7B97301B7E0220184EFC4F653008D93CE098C0D93B45201096D1ADFF4CF1F9FC02AF759DA27CD6DFD6D789B099F16F378B6100334E63F3D35F3251A5EC78693731F5233519CDB380F5AB8C0F02728E91D469ABD0EAE0D93B1CC66CE127B29C7D77441A49D09FCA5D6D9762FC74C31BB506C8BAE3C79AD6C2578775B95956B5370D1D0519E37906B384736233251E8F09AD79DFBE2C6ABFADAC8E4D8624318C27DAF1DF040103DF0314F527081CF371DD7E1FD4FA414A665036E0F5E6E5");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000003339F220103DF05083230323431323331DF060101DF070101DF0281B0B0627DEE87864F9C18C13B9A1F025448BF13C58380C91F4CEBA9F9BCB214FF8414E9B59D6ABA10F941C7331768F47B2127907D857FA39AAF8CE02045DD01619D689EE731C551159BE7EB2D51A372FF56B556E5CB2FDE36E23073A44CA215D6C26CA68847B388E39520E0026E62294B557D6470440CA0AEFC9438C923AEC9B2098D6D3A1AF5E8B1DE36F4B53040109D89B77CAFAF70C26C601ABDF59EEC0FDC8A99089140CD2E817E335175B03B7AA33DDF040103DF031487F0CD7C0E86F38F89A66F8C47071A8B88586F26");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000003339F220102DF05083230323131323331DF060101DF070101DF028190A3767ABD1B6AA69D7F3FBF28C092DE9ED1E658BA5F0909AF7A1CCD907373B7210FDEB16287BA8E78E1529F443976FD27F991EC67D95E5F4E96B127CAB2396A94D6E45CDA44CA4C4867570D6B07542F8D4BF9FF97975DB9891515E66F525D2B3CBEB6D662BFB6C3F338E93B02142BFC44173A3764C56AADD202075B26DC2F9F7D7AE74BD7D00FD05EE430032663D27A57DF040103DF031403BB335A8549A03B87AB089D006F60852E4B8060");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000003339F220101DF05083230313431323331DF060101DF070101DF028180BBE9066D2517511D239C7BFA77884144AE20C7372F515147E8CE6537C54C0A6A4D45F8CA4D290870CDA59F1344EF71D17D3F35D92F3F06778D0D511EC2A7DC4FFEADF4FB1253CE37A7B2B5A3741227BEF72524DA7A2B7B1CB426BEE27BC513B0CB11AB99BC1BC61DF5AC6CC4D831D0848788CD74F6D543AD37C5A2B4C5D5A93BDF040103DF0314E881E390675D44C2DD81234DCE29C3F5AB2297A0");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
// Russia RIDs
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F2201FADF0503202001DF060101DF070101DF028190A90FCD55AA2D5D9963E35ED0F440177699832F49C6BAB15CDAE5794BE93F934D4462D5D12762E48C38BA83D8445DEAA74195A301A102B2F114EADA0D180EE5E7A5C73E0C4E11F67A43DDAB5D55683B1474CC0627F44B8D3088A492FFAADAD4F42422D0E7013536C3C49AD3D0FAE96459B0F6B1B6056538A3D6D44640F94467B108867DEC40FAAECD740C00E2B7A8852DDF040103DF03145BED4068D96EA16D2D77E03D6036FC7A160EA99C");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F2201F1DF0503202001DF060101DF070101DF0281b0A0DCF4BDE19C3546B4B6F0414D174DDE294AABBB828C5A834D73AAE27C99B0B053A90278007239B6459FF0BBCD7B4B9C6C50AC02CE91368DA1BD21AAEADBC65347337D89B68F5C99A09D05BE02DD1F8C5BA20E2F13FB2A27C41D3F85CAD5CF6668E75851EC66EDBF98851FD4E42C44C1D59F5984703B27D5B9F21B8FA0D93279FBBF69E090642909C9EA27F898959541AA6757F5F624104F6E1D3A9532F2A6E51515AEAD1B43B3D7835088A2FAFA7BE7DF040103DF0314D8E68DA167AB5A85D8C3D55ECB9B0517A1A5B4BB");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F2201EFDF0503202001DF060101DF070101DF0281f8A191CB87473F29349B5D60A88B3EAEE0973AA6F1A082F358D849FDDFF9C091F899EDA9792CAF09EF28F5D22404B88A2293EEBBC1949C43BEA4D60CFD879A1539544E09E0F09F60F065B2BF2A13ECC705F3D468B9D33AE77AD9D3F19CA40F23DCF5EB7C04DC8F69EBA565B1EBCB4686CD274785530FF6F6E9EE43AA43FDB02CE00DAEC15C7B8FD6A9B394BABA419D3F6DC85E16569BE8E76989688EFEA2DF22FF7D35C043338DEAA982A02B866DE5328519EBBCD6F03CDD686673847F84DB651AB86C28CF1462562C577B853564A290C8556D818531268D25CC98A4CC6A0BDFFFDA2DCCA3A94C998559E307FDDF915006D9A987B07DDAEB3BDF040103DF031421766EBB0EE122AFB65D7845B73DB46BAB65427A");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F220147DF0503202001DF060101DF070101DF028190F562B594C911C0310AEFB002BDFE01CC8C2F1351CAEDD12C5210F4C3507BC106E01BBF94362392F3A66496079CBC8EAD09D5D942B195CA12A8A1AABAEF1D5545AF1693484764DEB625100E15F630510F3E2FB9E00D81F86D4C6F099307182E30F67FBE9C3D91F557BA5AAA1ACFBB625ABFA0176D4CEF3DFE1892BA1EC49F57B5DB6C53147F1DC9FD844298E238A94FEBDF040103DF03146304B43BAF1342F914ABD4B55EE817CEF1FA557F");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F2201F5DF0503202001DF060101DF070101DF0281f8A6E6FB72179506F860CCCA8C27F99CECD94C7D4F3191D303BBEE37481C7AA15F233BA755E9E4376345A9A67E7994BDC1C680BB3522D8C93EB0CCC91AD31AD450DA30D337662D19AC03E2B4EF5F6EC18282D491E19767D7B24542DFDEFF6F62185503532069BBB369E3BB9FB19AC6F1C30B97D249EEE764E0BAC97F25C873D973953E5153A42064BBFABFD06A4BB486860BF6637406C9FC36813A4A75F75C31CCA9F69F8DE59ADECEF6BDE7E07800FCBE035D3176AF8473E23E9AA3DFEE221196D1148302677C720CFE2544A03DB553E7F1B8427BA1CC72B0F29B12DFEF4C081D076D353E71880AADFF386352AF0AB7B28ED49E1E672D11F9DF0403010001DF0314C2239804C8098170BE52D6D5D4159E81CE8466BF");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F2201F7DF0503202001DF060101DF070101DF0281f8B8C5759F96676BEF1FE2DE8AAD8C54B08E919FD1B8C516D70931435E41A306A64A5F73E4542B46BFBDC8EB32E973737406C0DE7AF80FDE023B5F256EF4D120EEB537171D1ADA4D83C307961AF8DB13B63828EE2EE036FAF2C41D5EE250ED2A4AF317511411EDD39CD52F2A10CA17F4FE652FD7E79BC031C36AD26DFB54CFC562551793B04A47ED1A21E96D2E4CA29EB9A4FE6524E6CF69DE5CA5C0BEDFA624AE6BC78FEFE3993564D59B67DED46455040FB3BFD2B6447D111C83C0E29C72C00142BAB87EBCFC54BE58EAEE78292B05F358175DC67F3916CCB08907A41EF0785DAA4D21B279B9A386AB7F6624B2144E3E35C1BF29954B2D7BDF040103DF031486803714DF3BDE4C19F62E1FF01CE96D3C1D1706");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F220105DF0503202001DF060101DF070101DF0281b0B8048ABC30C90D976336543E3FD7091C8FE4800DF820ED55E7E94813ED00555B573FECA3D84AF6131A651D66CFF4284FB13B635EDD0EE40176D8BF04B7FD1C7BACF9AC7327DFAA8AA72D10DB3B8E70B2DDD811CB4196525EA386ACC33C0D9D4575916469C4E4F53E8E1C912CC618CB22DDE7C3568E90022E6BBA770202E4522A2DD623D180E215BD1D1507FE3DC90CA310D27B3EFCCD8F83DE3052CAD1E48938C68D095AAC91B5F37E28BB49EC7ED597DF040103DF0314EBFA0D5D06D8CE702DA3EAE890701D45E274C845");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000039F220195DF0503202001DF060101DF070101DF028190BE9E1FA5E9A803852999C4AB432DB28600DCD9DAB76DFAAA47355A0FE37B1508AC6BF38860D3C6C2E5B12A3CAAF2A7005A7241EBAA7771112C74CF9A0634652FBCA0E5980C54A64761EA101A114E0F0B5572ADD57D010B7C9C887E104CA4EE1272DA66D997B9A90B5A6D624AB6C57E73C8F919000EB5F684898EF8C3DBEFB330C62660BED88EA78E909AFF05F6DA627BDF040103DF0314EE1511CEC71020A9B90443B37B1D5F6E703030F6");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000039F220199DF0503202001DF060101DF070101DF028180AB79FCC9520896967E776E64444E5DCDD6E13611874F3985722520425295EEA4BD0C2781DE7F31CD3D041F565F747306EED62954B17EDABA3A6C5B85A1DE1BEB9A34141AF38FCF8279C9DEA0D5A6710D08DB4124F041945587E20359BAB47B7575AD94262D4B25F264AF33DEDCF28E09615E937DE32EDC03C54445FE7E382777DF040103DF03144ABFFD6B1C51212D05552E431C5B17007D2F5E6D");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000039F220150DF0503202001DF060101DF070101DF028180D11197590057B84196C2F4D11A8F3C05408F422A35D702F90106EA5B019BB28AE607AA9CDEBCD0D81A38D48C7EBB0062D287369EC0C42124246AC30D80CD602AB7238D51084DED4698162C59D25EAC1E66255B4DB2352526EF0982C3B8AD3D1CCE85B01DB5788E75E09F44BE7361366DEF9D1E1317B05E5D0FF5290F88A0DB47DF040103DF03145765295089960938BAAA4431506E424295F98BD0");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000039F220192DF0503202001DF060101DF070101DF0281b0996AF56F569187D09293C14810450ED8EE3357397B18A2458EFAA92DA3B6DF6514EC060195318FD43BE9B8F0CC669E3F844057CBDDF8BDA191BB64473BC8DC9A730DB8F6B4EDE3924186FFD9B8C7735789C23A36BA0B8AF65372EB57EA5D89E7D14E9C7B6B557460F10885DA16AC923F15AF3758F0F03EBD3C5C2C949CBA306DB44E6A2C076C5F67E281D7EF56785DC4D75945E491F01918800A9E2DC66F60080566CE0DAF8D17EAD46AD8E30A247C9FDF040103DF0314429C954A3859CEF91295F663C963E582ED6EB253");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000039F220194DF0503202001DF060101DF070101DF0281f8ACD2B12302EE644F3F835ABD1FC7A6F62CCE48FFEC622AA8EF062BEF6FB8BA8BC68BBF6AB5870EED579BC3973E121303D34841A796D6DCBC41DBF9E52C4609795C0CCF7EE86FA1D5CB041071ED2C51D2202F63F1156C58A92D38BC60BDF424E1776E2BC9648078A03B36FB554375FC53D57C73F5160EA59F3AFC5398EC7B67758D65C9BFF7828B6B82D4BE124A416AB7301914311EA462C19F771F31B3B57336000DFF732D3B83DE07052D730354D297BEC72871DCCF0E193F171ABA27EE464C6A97690943D59BDABB2A27EB71CEEBDAFA1176046478FD62FEC452D5CA393296530AA3F41927ADFE434A2DF2AE3054F8840657A26E0FC617DF040103DF0314C4A3C43CCF87327D136B804160E47D43B60E6E0F");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
// India RIDs
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000005249F22016BDF028190C9DFDB625ADA4B5E86049F85A0237627B59524F52BD499B4C5482C1EE012D61A1446E9383CC0B7EE2922D323A5ECDA12941EA8177CFA512DA6B5B7663A89B793B10D314CBB776EB96D0B1734EDE7E1591713915E9991B7B4E8A017A6901279AEBDD6136C9FE7E0C6CBF94C77FA606B629D00B1F890473905EB4DAD1AD93B29C2C1829A82F880B08986B9387611EE409DDF040103DF060101DF070101DF03149602428A46271C63CCC6DD99477CDB70435D6D5BDF0503201231");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000005249F22016ADF02818092795EAA4FE39EB30441FE952D5423778E02F86783B89DD7C587AE80A69F4D6DC55EAFB6604040D875C72002425EE529CE4EA26FD864BAD760160C2AA0C5AF92381894A5CBBC8AB3AF2641606C379B927A397CB1E9B9EA2EF8C0A9C0DDEBB81B0F8913A118F7044156EA7D23AF626EAF30C2C9ECE8534D3563EF5FE95DE76249DF040103DF060101DF070101DF031451ED4570323CD41A0348BDFEA81CCC0B8D9BAB3FDF0503201231");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000005249F22016CDF0281b0C76259FF785ABD5FF613223C01F5BDA0F36F9342CF336B66C32D4B2CD5096E094D8E04DFA11A9B2E3BC78DA63B5C10148D8ED79EBA685D5D0EFE1C58B3F929D861B40FF3AAA3B527148D0C24921EE42DA048E01E38F6A3A49DFA67DD1CD5DD2091412DD36D3269FAF7D2E0FFB1A3E028969CB6BA5A9303A6FF65540F421B069A31B553398EE525EFA5C2CE26BCB81C5345018D5E3E9B7130F72F598C0EAA4682D4DA2F2204518780A8108F82DDC9CF1FDF040103DF060101DF070101DF03143B18A21BF34F781208145D7567982513D1CE8C92DF0503201231");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000005249F22016DDF0281f8B747E8CB3615E8D26231355488F3C76C4746F7BB1C381E6C6E6ABF0A6D7CD93CFC6B2C310288CA8BE7EE1730DE621A59D1BB2D8C02C9148FA06E5D1F5E672EEFCE8AECBAD4A1C18F3175F1BEA1AEF539376592366B46A5044E32E59B3F35F50E85F843BA01851E5386B7EBE27367D3D483C5472D3020AF42116DDDA32341557EBABB043EBC6006B99A652009045BFA50C527028586E05942E1D594223B49FE8566931C31FBE8C903ABD4F283E1FAB03D758247EC4B728A85A9897601B753293263ADBD10BE988D0C52FE0091C2721DC02C5130FC7663E95739A70EE2F84DFD2E50C88A1A26587EF7CC047FCA2D03C2CF0CE4B524B4EC3F07DF040103DF060101DF070101DF0314411008F9921B89C62E2160F6D0358614115ECD4ADF0503201231");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
//AE Capk
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000259F220197DF028190E178FFE834B4B767AF3C9A511F973D8E8505C5FCB2D3768075AB7CC946A955789955879AAF737407151521996DFA43C58E6B130EB1D863B85DC9FFB4050947A2676AA6A061A4A7AE1EDB0E36A697E87E037517EB8923136875BA2CA1087CBA7EC7653E5E28A0C261A033AF27E3A67B64BBA26956307EC47E674E3F8B722B3AE0498DB16C7985310D9F3D117300D32B09DF0314EBDA522B631B3EB4F4CBFC0679C450139D2B69CDDF040103DF060100DF070101DF050420481231");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
//JCB Capk
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000659F220114DF0803000000DF050420201231DF060101DF070100DF0281F8AEED55B9EE00E1ECEB045F61D2DA9A66AB637B43FB5CDBDB22A2FBB25BE061E937E38244EE5132F530144A3F268907D8FD648863F5A96FED7E42089E93457ADC0E1BC89C58A0DB72675FBC47FEE9FF33C16ADE6D341936B06B6A6F5EF6F66A4EDD981DF75DA8399C3053F430ECA342437C23AF423A211AC9F58EAF09B0F837DE9D86C7109DB1646561AA5AF0289AF5514AC64BC2D9D36A179BB8A7971E2BFA03A9E4B847FD3D63524D43A0E8003547B94A8A75E519DF3177D0A60BC0B4BAB1EA59A2CBB4D2D62354E926E9C7D3BE4181E81BA60F8285A896D17DA8C3242481B6C405769A39D547C74ED9FF95A70A796046B5EFF36682DC29DF040103DF031443A3151513B7ADCEB92DBEA2A262CEB336D26C83");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000659F220111DF0803000000DF050420201231DF060101DF0281B0A2583AA40746E3A63C22478F576D1EFC5FB046135A6FC739E82B55035F71B09BEB566EDB9968DD649B94B6DEDC033899884E908C27BE1CD291E5436F762553297763DAA3B890D778C0F01E3344CECDFB3BA70D7E055B8C760D0179A403D6B55F2B3B083912B183ADB7927441BED3395A199EEFE0DEBD1F5FC3264033DA856F4A8B93916885BD42F9C1F456AAB8CFA83AC574833EB5E87BB9D4C006A4B5346BD9E17E139AB6552D9C58BC041195336485DF040103DF0314D9FD62C9DD4E6DE7741E9A17FB1FF2C5DB948BCBDF070100");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
LogUtil.e(TAG, "init AID and CAPKs success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.e(TAG, "initAIDAndRid fail");
|
||||
}
|
||||
}
|
||||
|
||||
public static void initNFCSpeedupAidAndRid() {
|
||||
try {
|
||||
EMVOptV2 emvOptV2 = BaseApplication.getInstance().mEMVOptV2;
|
||||
// clea Aid and Capk
|
||||
emvOptV2.deleteAid(null);
|
||||
emvOptV2.deleteCapk(null, null);
|
||||
|
||||
AidConfig aidConfig = new AidConfig("A000000333010101","UPI","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01","36800000");
|
||||
AidV2 aid = aidConfig.loadAid();
|
||||
emvOptV2.addAid(aid);
|
||||
aidConfig = new AidConfig("A000000333010102","UPI","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01");
|
||||
aid = aidConfig.loadAid();
|
||||
emvOptV2.addAid(aid);
|
||||
aidConfig = new AidConfig("A000000333010103","UPI","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01","36800000");
|
||||
aid = aidConfig.loadAid();
|
||||
emvOptV2.addAid(aid);
|
||||
aidConfig = new AidConfig("A000000333010106","UPI","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01","36800000");
|
||||
aid = aidConfig.loadAid();
|
||||
emvOptV2.addAid(aid);
|
||||
aidConfig = new AidConfig("A000000333010108","UPI","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01","36800000");
|
||||
aid = aidConfig.loadAid();
|
||||
emvOptV2.addAid(aid);
|
||||
|
||||
|
||||
// 23004000
|
||||
|
||||
aidConfig = new AidConfig("A0000000651010","JCB","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01","A7004000");
|
||||
aid = aidConfig.loadAid();
|
||||
emvOptV2.addAid(aid);
|
||||
|
||||
// aidConfig = new AidConfig("A0000000031010","VISA","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","00","36804000","01","","");
|
||||
aidConfig = new AidConfig("A0000000031010","VISA","01","D84000A800","0010000000","DC4004F800","9F3704","00000000","00","00","00000000","0020","3030","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0104","0104","02","9F1A0295059A039C01","1234567891","000000000000","","","000007500001","00","","01","00","");
|
||||
aid = aidConfig.loadAid();
|
||||
emvOptV2.addAid(aid);
|
||||
|
||||
aidConfig = new AidConfig("A0000000031010","VISA","01","D84000A800","0010000000","DC4004F800","9F3704","00000000","00","00","00000000","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0104","0104","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01","36800000","02","","");
|
||||
aid = aidConfig.loadAid();
|
||||
emvOptV2.addAid(aid);
|
||||
// aidConfig = new AidConfig("A0000000031010","VISA","01","D84000A800","0010000000","DC4004F800","9F3704","00000000","00","00","00000000","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0104","0104","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01","36800000","00","","");
|
||||
// aid = aidConfig.loadAid();
|
||||
// emvOptV2.addAid(aid);
|
||||
|
||||
/*****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
|
||||
// aidConfig = new AidConfig("A0000000032010","VISA","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01","36804000");
|
||||
// aid = aidConfig.loadAid();
|
||||
// emvOptV2.addAid(aid);
|
||||
// aidConfig = new AidConfig("A0000000032020","VISA","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01","36804000");
|
||||
// aid = aidConfig.loadAid();
|
||||
// emvOptV2.addAid(aid);
|
||||
// aidConfig = new AidConfig("A0000000038010","VISA","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01","36804000");
|
||||
// aid = aidConfig.loadAid();
|
||||
// emvOptV2.addAid(aid);
|
||||
|
||||
aidConfig = new AidConfig("A0000000041010","MASTERCARD","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01","36800000");
|
||||
aid = aidConfig.loadAid();
|
||||
emvOptV2.addAid(aid);
|
||||
|
||||
aidConfig = new AidConfig("A0000000046000","MASTERCARD","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000007500001","01","36800000");
|
||||
aid = aidConfig.loadAid();
|
||||
emvOptV2.addAid(aid);
|
||||
|
||||
aidConfig = new AidConfig("A0000008890101","MPU","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0104","0104","02","9F3704","1234567891","000000000000","000000000000","999999999999","000010000000","01","36800000","02","02",null); //36804000
|
||||
aid = aidConfig.loadAid();
|
||||
emvOptV2.addAid(aid);
|
||||
|
||||
|
||||
// aidConfig = new AidConfig("A0000000040000","MASTERCARD","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000000070001","01","36800000");
|
||||
// aid = EmvUtil.hexStr2Aid(aidConfig.getConfigString());
|
||||
// emvOptV2.addAid(aid);
|
||||
|
||||
/*Not Working*/
|
||||
// aidConfig = new AidConfig("A0000000041010BB5449435301","MASTERCARD","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000000030000","01","36800000");
|
||||
// aid = EmvUtil.hexStr2Aid(aidConfig.getConfigString());
|
||||
// emvOptV2.addAid(aid);
|
||||
|
||||
/*Not Working*/
|
||||
// aidConfig = new AidConfig("B012345678","MASTERCARD","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000000070001","01","36800000");
|
||||
// aid = EmvUtil.hexStr2Aid(aidConfig.getConfigString());
|
||||
// emvOptV2.addAid(aid);
|
||||
//
|
||||
// /*Not Working*/
|
||||
// aidConfig = new AidConfig("A00000000410101215","MASTERCARD","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000000070001","01","36800000");
|
||||
// aid = EmvUtil.hexStr2Aid(aidConfig.getConfigString());
|
||||
// emvOptV2.addAid(aid);
|
||||
//
|
||||
// /*Not Working*/
|
||||
// aidConfig = new AidConfig("A0000000042010","MASTERCARD","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000000070001","01","36800000");
|
||||
// aid = EmvUtil.hexStr2Aid(aidConfig.getConfigString());
|
||||
// emvOptV2.addAid(aid);
|
||||
//
|
||||
// /*Not Working*/
|
||||
// aidConfig = new AidConfig("A0000000042203","MASTERCARD","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000000070001","01","36800000");
|
||||
// aid = EmvUtil.hexStr2Aid(aidConfig.getConfigString());
|
||||
// emvOptV2.addAid(aid);
|
||||
//
|
||||
// /*Not Working*/
|
||||
// aidConfig = new AidConfig("A0000000043010","MASTERCARD","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000000070001","01","36800000");
|
||||
// aid = EmvUtil.hexStr2Aid(aidConfig.getConfigString());
|
||||
// emvOptV2.addAid(aid);
|
||||
|
||||
// aidConfig = new AidConfig("A0000000045555","MASTERCARD","01","D84000A800","DC4004F800","0000000000","9F3704","00000040","50","20","00002710","0020","2701","303030303030303030303030303030","5465726D696E616C","4261636B39363132","01","0840","0840","02","9F3704","1234567891","000000000000","000000000000","999999999999","000000070001","01","36800000");
|
||||
// aid = EmvUtil.hexStr2Aid(aidConfig.getConfigString());
|
||||
// emvOptV2.addAid(aid);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* UPI Certification
|
||||
*/
|
||||
//UPI index 9
|
||||
/* CapkV2 capkV2 = EmvUtil.hexStr2Rid("9F0605A0000003339F220109DF0803121232DF050420201231DF060101DF070100DF0281B0EB374DFC5A96B71D2863875EDA2EAFB96B1B439D3ECE0B1826A2672EEEFA7990286776F8BD989A15141A75C384DFC14FEF9243AAB32707659BE9E4797A247C2F0B6D99372F384AF62FE23BC54BCDC57A9ACD1D5585C303F201EF4E8B806AFB809DB1A3DB1CD112AC884F164A67B99C7D6E5A8A6DF1D3CAE6D7ED3D5BE725B2DE4ADE23FA679BF4EB15A93D8A6E29C7FFA1A70DE2E54F593D908A3BF9EBBD760BBFDC8DB8B54497E6C5BE0E4A4DAC29E5DF040103DF0314A075306EAB0045BAF72CDD33B3B678779DE1F527");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
// UPI index 8
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000003339F220108DF0803121232DF050420201231DF060101DF070100DF028190B61645EDFD5498FB246444037A0FA18C0F101EBD8EFA54573CE6E6A7FBF63ED21D66340852B0211CF5EEF6A1CD989F66AF21A8EB19DBD8DBC3706D135363A0D683D046304F5A836BC1BC632821AFE7A2F75DA3C50AC74C545A754562204137169663CFCC0B06E67E2109EBA41BC67FF20CC8AC80D7B6EE1A95465B3B2657533EA56D92D539E5064360EA4850FED2D1BFDF040103DF0314EE23B616C95C02652AD18860E48787C079E8E85A");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
// UPI index 0B
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000003339F22010BDF040103DF0803121232DF050420201231DF060101DF070100DF0281F8CF9FDF46B356378E9AF311B0F981B21A1F22F250FB11F55C958709E3C7241918293483289EAE688A094C02C344E2999F315A72841F489E24B1BA0056CFAB3B479D0E826452375DCDBB67E97EC2AA66F4601D774FEAEF775ACCC621BFEB65FB0053FC5F392AA5E1D4C41A4DE9FFDFDF1327C4BB874F1F63A599EE3902FE95E729FD78D4234DC7E6CF1ABABAA3F6DB29B7F05D1D901D2E76A606A8CBFFFFECBD918FA2D278BDB43B0434F5D45134BE1C2781D157D501FF43E5F1C470967CD57CE53B64D82974C8275937C5D8502A1252A8A5D6088A259B694F98648D9AF2CB0EFD9D943C69F896D49FA39702162ACB5AF29B90BADE005BC157DF0314BD331F9996A490B33C13441066A09AD3FEB5F66C");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
// UPI index 0A
|
||||
// B2AB1B6E9AC55A75ADFD5BBC34490E53C4C3381F34E60E7FAC21CC2B26DD34462B64A6FAE2495ED1DD383B8138BEA100FF9B7A111817E7B9869A9742B19E5C9DAC56F8B8827F11B05A08ECCF9E8D5E85B0F7CFA644EFF3E9B796688F38E006DEB21E101C01028903A06023AC5AAB8635F8E307A53AC742BDCE6A283F585F48EF
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000003339F22010ADF0803121232DF050420201231DF060101DF070100DF028180B2AB1B6E9AC55A75ADFD5BBC34490E53C4C3381F34E60E7FAC21CC2B26DD34462B64A6FAE2495ED1DD383B8138BEA100FF9B7A111817E7B9869A9742B19E5C9DAC56F8B8827F11B05A08ECCF9E8D5E85B0F7CFA644EFF3E9B796688F38E006DEB21E101C01028903A06023AC5AAB8635F8E307A53AC742BDCE6A283F585F48EFDF0314C88BE6B2417C4F941C9371EA35A377158767E4E3");
|
||||
emvOptV2.addCapk(capkV2);*/
|
||||
|
||||
|
||||
/**
|
||||
* Sunmi SDK
|
||||
*/
|
||||
CapkV2 capkV2 = EmvUtil.hexStr2Rid("9F0605A0000003339F220104DF05083230323531323331DF060101DF070101DF0281F8BC853E6B5365E89E7EE9317C94B02D0ABB0DBD91C05A224A2554AA29ED9FCB9D86EB9CCBB322A57811F86188AAC7351C72BD9EF196C5A01ACEF7A4EB0D2AD63D9E6AC2E7836547CB1595C68BCBAFD0F6728760F3A7CA7B97301B7E0220184EFC4F653008D93CE098C0D93B45201096D1ADFF4CF1F9FC02AF759DA27CD6DFD6D789B099F16F378B6100334E63F3D35F3251A5EC78693731F5233519CDB380F5AB8C0F02728E91D469ABD0EAE0D93B1CC66CE127B29C7D77441A49D09FCA5D6D9762FC74C31BB506C8BAE3C79AD6C2578775B95956B5370D1D0519E37906B384736233251E8F09AD79DFBE2C6ABFADAC8E4D8624318C27DAF1DF040103DF0314F527081CF371DD7E1FD4FA414A665036E0F5E6E5");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000003339F220103DF05083230323431323331DF060101DF070101DF0281B0B0627DEE87864F9C18C13B9A1F025448BF13C58380C91F4CEBA9F9BCB214FF8414E9B59D6ABA10F941C7331768F47B2127907D857FA39AAF8CE02045DD01619D689EE731C551159BE7EB2D51A372FF56B556E5CB2FDE36E23073A44CA215D6C26CA68847B388E39520E0026E62294B557D6470440CA0AEFC9438C923AEC9B2098D6D3A1AF5E8B1DE36F4B53040109D89B77CAFAF70C26C601ABDF59EEC0FDC8A99089140CD2E817E335175B03B7AA33DDF040103DF031487F0CD7C0E86F38F89A66F8C47071A8B88586F26");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000003339F220102DF05083230323131323331DF060101DF070101DF028190A3767ABD1B6AA69D7F3FBF28C092DE9ED1E658BA5F0909AF7A1CCD907373B7210FDEB16287BA8E78E1529F443976FD27F991EC67D95E5F4E96B127CAB2396A94D6E45CDA44CA4C4867570D6B07542F8D4BF9FF97975DB9891515E66F525D2B3CBEB6D662BFB6C3F338E93B02142BFC44173A3764C56AADD202075B26DC2F9F7D7AE74BD7D00FD05EE430032663D27A57DF040103DF031403BB335A8549A03B87AB089D006F60852E4B8060");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000003339F220101DF05083230313431323331DF060101DF070101DF028180BBE9066D2517511D239C7BFA77884144AE20C7372F515147E8CE6537C54C0A6A4D45F8CA4D290870CDA59F1344EF71D17D3F35D92F3F06778D0D511EC2A7DC4FFEADF4FB1253CE37A7B2B5A3741227BEF72524DA7A2B7B1CB426BEE27BC513B0CB11AB99BC1BC61DF5AC6CC4D831D0848788CD74F6D543AD37C5A2B4C5D5A93BDF040103DF0314E881E390675D44C2DD81234DCE29C3F5AB2297A0");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
// Russia RIDs
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F2201FADF0503202001DF060101DF070101DF028190A90FCD55AA2D5D9963E35ED0F440177699832F49C6BAB15CDAE5794BE93F934D4462D5D12762E48C38BA83D8445DEAA74195A301A102B2F114EADA0D180EE5E7A5C73E0C4E11F67A43DDAB5D55683B1474CC0627F44B8D3088A492FFAADAD4F42422D0E7013536C3C49AD3D0FAE96459B0F6B1B6056538A3D6D44640F94467B108867DEC40FAAECD740C00E2B7A8852DDF040103DF03145BED4068D96EA16D2D77E03D6036FC7A160EA99C");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F2201F1DF0503202001DF060101DF070101DF0281b0A0DCF4BDE19C3546B4B6F0414D174DDE294AABBB828C5A834D73AAE27C99B0B053A90278007239B6459FF0BBCD7B4B9C6C50AC02CE91368DA1BD21AAEADBC65347337D89B68F5C99A09D05BE02DD1F8C5BA20E2F13FB2A27C41D3F85CAD5CF6668E75851EC66EDBF98851FD4E42C44C1D59F5984703B27D5B9F21B8FA0D93279FBBF69E090642909C9EA27F898959541AA6757F5F624104F6E1D3A9532F2A6E51515AEAD1B43B3D7835088A2FAFA7BE7DF040103DF0314D8E68DA167AB5A85D8C3D55ECB9B0517A1A5B4BB");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F2201EFDF0503202001DF060101DF070101DF0281f8A191CB87473F29349B5D60A88B3EAEE0973AA6F1A082F358D849FDDFF9C091F899EDA9792CAF09EF28F5D22404B88A2293EEBBC1949C43BEA4D60CFD879A1539544E09E0F09F60F065B2BF2A13ECC705F3D468B9D33AE77AD9D3F19CA40F23DCF5EB7C04DC8F69EBA565B1EBCB4686CD274785530FF6F6E9EE43AA43FDB02CE00DAEC15C7B8FD6A9B394BABA419D3F6DC85E16569BE8E76989688EFEA2DF22FF7D35C043338DEAA982A02B866DE5328519EBBCD6F03CDD686673847F84DB651AB86C28CF1462562C577B853564A290C8556D818531268D25CC98A4CC6A0BDFFFDA2DCCA3A94C998559E307FDDF915006D9A987B07DDAEB3BDF040103DF031421766EBB0EE122AFB65D7845B73DB46BAB65427A");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F220147DF0503202001DF060101DF070101DF028190F562B594C911C0310AEFB002BDFE01CC8C2F1351CAEDD12C5210F4C3507BC106E01BBF94362392F3A66496079CBC8EAD09D5D942B195CA12A8A1AABAEF1D5545AF1693484764DEB625100E15F630510F3E2FB9E00D81F86D4C6F099307182E30F67FBE9C3D91F557BA5AAA1ACFBB625ABFA0176D4CEF3DFE1892BA1EC49F57B5DB6C53147F1DC9FD844298E238A94FEBDF040103DF03146304B43BAF1342F914ABD4B55EE817CEF1FA557F");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F2201F5DF0503202001DF060101DF070101DF0281f8A6E6FB72179506F860CCCA8C27F99CECD94C7D4F3191D303BBEE37481C7AA15F233BA755E9E4376345A9A67E7994BDC1C680BB3522D8C93EB0CCC91AD31AD450DA30D337662D19AC03E2B4EF5F6EC18282D491E19767D7B24542DFDEFF6F62185503532069BBB369E3BB9FB19AC6F1C30B97D249EEE764E0BAC97F25C873D973953E5153A42064BBFABFD06A4BB486860BF6637406C9FC36813A4A75F75C31CCA9F69F8DE59ADECEF6BDE7E07800FCBE035D3176AF8473E23E9AA3DFEE221196D1148302677C720CFE2544A03DB553E7F1B8427BA1CC72B0F29B12DFEF4C081D076D353E71880AADFF386352AF0AB7B28ED49E1E672D11F9DF0403010001DF0314C2239804C8098170BE52D6D5D4159E81CE8466BF");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F2201F7DF0503202001DF060101DF070101DF0281f8B8C5759F96676BEF1FE2DE8AAD8C54B08E919FD1B8C516D70931435E41A306A64A5F73E4542B46BFBDC8EB32E973737406C0DE7AF80FDE023B5F256EF4D120EEB537171D1ADA4D83C307961AF8DB13B63828EE2EE036FAF2C41D5EE250ED2A4AF317511411EDD39CD52F2A10CA17F4FE652FD7E79BC031C36AD26DFB54CFC562551793B04A47ED1A21E96D2E4CA29EB9A4FE6524E6CF69DE5CA5C0BEDFA624AE6BC78FEFE3993564D59B67DED46455040FB3BFD2B6447D111C83C0E29C72C00142BAB87EBCFC54BE58EAEE78292B05F358175DC67F3916CCB08907A41EF0785DAA4D21B279B9A386AB7F6624B2144E3E35C1BF29954B2D7BDF040103DF031486803714DF3BDE4C19F62E1FF01CE96D3C1D1706");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000049F220105DF0503202001DF060101DF070101DF0281b0B8048ABC30C90D976336543E3FD7091C8FE4800DF820ED55E7E94813ED00555B573FECA3D84AF6131A651D66CFF4284FB13B635EDD0EE40176D8BF04B7FD1C7BACF9AC7327DFAA8AA72D10DB3B8E70B2DDD811CB4196525EA386ACC33C0D9D4575916469C4E4F53E8E1C912CC618CB22DDE7C3568E90022E6BBA770202E4522A2DD623D180E215BD1D1507FE3DC90CA310D27B3EFCCD8F83DE3052CAD1E48938C68D095AAC91B5F37E28BB49EC7ED597DF040103DF0314EBFA0D5D06D8CE702DA3EAE890701D45E274C845");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000039F220195DF0503202001DF060101DF070101DF028190BE9E1FA5E9A803852999C4AB432DB28600DCD9DAB76DFAAA47355A0FE37B1508AC6BF38860D3C6C2E5B12A3CAAF2A7005A7241EBAA7771112C74CF9A0634652FBCA0E5980C54A64761EA101A114E0F0B5572ADD57D010B7C9C887E104CA4EE1272DA66D997B9A90B5A6D624AB6C57E73C8F919000EB5F684898EF8C3DBEFB330C62660BED88EA78E909AFF05F6DA627BDF040103DF0314EE1511CEC71020A9B90443B37B1D5F6E703030F6");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000039F220199DF0503202001DF060101DF070101DF028180AB79FCC9520896967E776E64444E5DCDD6E13611874F3985722520425295EEA4BD0C2781DE7F31CD3D041F565F747306EED62954B17EDABA3A6C5B85A1DE1BEB9A34141AF38FCF8279C9DEA0D5A6710D08DB4124F041945587E20359BAB47B7575AD94262D4B25F264AF33DEDCF28E09615E937DE32EDC03C54445FE7E382777DF040103DF03144ABFFD6B1C51212D05552E431C5B17007D2F5E6D");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000039F220150DF0503202001DF060101DF070101DF028180D11197590057B84196C2F4D11A8F3C05408F422A35D702F90106EA5B019BB28AE607AA9CDEBCD0D81A38D48C7EBB0062D287369EC0C42124246AC30D80CD602AB7238D51084DED4698162C59D25EAC1E66255B4DB2352526EF0982C3B8AD3D1CCE85B01DB5788E75E09F44BE7361366DEF9D1E1317B05E5D0FF5290F88A0DB47DF040103DF03145765295089960938BAAA4431506E424295F98BD0");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000039F220192DF0503202001DF060101DF070101DF0281b0996AF56F569187D09293C14810450ED8EE3357397B18A2458EFAA92DA3B6DF6514EC060195318FD43BE9B8F0CC669E3F844057CBDDF8BDA191BB64473BC8DC9A730DB8F6B4EDE3924186FFD9B8C7735789C23A36BA0B8AF65372EB57EA5D89E7D14E9C7B6B557460F10885DA16AC923F15AF3758F0F03EBD3C5C2C949CBA306DB44E6A2C076C5F67E281D7EF56785DC4D75945E491F01918800A9E2DC66F60080566CE0DAF8D17EAD46AD8E30A247C9FDF040103DF0314429C954A3859CEF91295F663C963E582ED6EB253");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000039F220194DF0503202001DF060101DF070101DF0281f8ACD2B12302EE644F3F835ABD1FC7A6F62CCE48FFEC622AA8EF062BEF6FB8BA8BC68BBF6AB5870EED579BC3973E121303D34841A796D6DCBC41DBF9E52C4609795C0CCF7EE86FA1D5CB041071ED2C51D2202F63F1156C58A92D38BC60BDF424E1776E2BC9648078A03B36FB554375FC53D57C73F5160EA59F3AFC5398EC7B67758D65C9BFF7828B6B82D4BE124A416AB7301914311EA462C19F771F31B3B57336000DFF732D3B83DE07052D730354D297BEC72871DCCF0E193F171ABA27EE464C6A97690943D59BDABB2A27EB71CEEBDAFA1176046478FD62FEC452D5CA393296530AA3F41927ADFE434A2DF2AE3054F8840657A26E0FC617DF040103DF0314C4A3C43CCF87327D136B804160E47D43B60E6E0F");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
// India RIDs
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000005249F22016BDF028190C9DFDB625ADA4B5E86049F85A0237627B59524F52BD499B4C5482C1EE012D61A1446E9383CC0B7EE2922D323A5ECDA12941EA8177CFA512DA6B5B7663A89B793B10D314CBB776EB96D0B1734EDE7E1591713915E9991B7B4E8A017A6901279AEBDD6136C9FE7E0C6CBF94C77FA606B629D00B1F890473905EB4DAD1AD93B29C2C1829A82F880B08986B9387611EE409DDF040103DF060101DF070101DF03149602428A46271C63CCC6DD99477CDB70435D6D5BDF0503201231");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000005249F22016ADF02818092795EAA4FE39EB30441FE952D5423778E02F86783B89DD7C587AE80A69F4D6DC55EAFB6604040D875C72002425EE529CE4EA26FD864BAD760160C2AA0C5AF92381894A5CBBC8AB3AF2641606C379B927A397CB1E9B9EA2EF8C0A9C0DDEBB81B0F8913A118F7044156EA7D23AF626EAF30C2C9ECE8534D3563EF5FE95DE76249DF040103DF060101DF070101DF031451ED4570323CD41A0348BDFEA81CCC0B8D9BAB3FDF0503201231");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000005249F22016CDF0281b0C76259FF785ABD5FF613223C01F5BDA0F36F9342CF336B66C32D4B2CD5096E094D8E04DFA11A9B2E3BC78DA63B5C10148D8ED79EBA685D5D0EFE1C58B3F929D861B40FF3AAA3B527148D0C24921EE42DA048E01E38F6A3A49DFA67DD1CD5DD2091412DD36D3269FAF7D2E0FFB1A3E028969CB6BA5A9303A6FF65540F421B069A31B553398EE525EFA5C2CE26BCB81C5345018D5E3E9B7130F72F598C0EAA4682D4DA2F2204518780A8108F82DDC9CF1FDF040103DF060101DF070101DF03143B18A21BF34F781208145D7567982513D1CE8C92DF0503201231");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000005249F22016DDF0281f8B747E8CB3615E8D26231355488F3C76C4746F7BB1C381E6C6E6ABF0A6D7CD93CFC6B2C310288CA8BE7EE1730DE621A59D1BB2D8C02C9148FA06E5D1F5E672EEFCE8AECBAD4A1C18F3175F1BEA1AEF539376592366B46A5044E32E59B3F35F50E85F843BA01851E5386B7EBE27367D3D483C5472D3020AF42116DDDA32341557EBABB043EBC6006B99A652009045BFA50C527028586E05942E1D594223B49FE8566931C31FBE8C903ABD4F283E1FAB03D758247EC4B728A85A9897601B753293263ADBD10BE988D0C52FE0091C2721DC02C5130FC7663E95739A70EE2F84DFD2E50C88A1A26587EF7CC047FCA2D03C2CF0CE4B524B4EC3F07DF040103DF060101DF070101DF0314411008F9921B89C62E2160F6D0358614115ECD4ADF0503201231");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
//AE Capk
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000259F220197DF028190E178FFE834B4B767AF3C9A511F973D8E8505C5FCB2D3768075AB7CC946A955789955879AAF737407151521996DFA43C58E6B130EB1D863B85DC9FFB4050947A2676AA6A061A4A7AE1EDB0E36A697E87E037517EB8923136875BA2CA1087CBA7EC7653E5E28A0C261A033AF27E3A67B64BBA26956307EC47E674E3F8B722B3AE0498DB16C7985310D9F3D117300D32B09DF0314EBDA522B631B3EB4F4CBFC0679C450139D2B69CDDF040103DF060100DF070101DF050420481231");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
//JCB Capk
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000659F220114DF0803000000DF050420201231DF060101DF070100DF0281F8AEED55B9EE00E1ECEB045F61D2DA9A66AB637B43FB5CDBDB22A2FBB25BE061E937E38244EE5132F530144A3F268907D8FD648863F5A96FED7E42089E93457ADC0E1BC89C58A0DB72675FBC47FEE9FF33C16ADE6D341936B06B6A6F5EF6F66A4EDD981DF75DA8399C3053F430ECA342437C23AF423A211AC9F58EAF09B0F837DE9D86C7109DB1646561AA5AF0289AF5514AC64BC2D9D36A179BB8A7971E2BFA03A9E4B847FD3D63524D43A0E8003547B94A8A75E519DF3177D0A60BC0B4BAB1EA59A2CBB4D2D62354E926E9C7D3BE4181E81BA60F8285A896D17DA8C3242481B6C405769A39D547C74ED9FF95A70A796046B5EFF36682DC29DF040103DF031443A3151513B7ADCEB92DBEA2A262CEB336D26C83");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000659F220111DF0803000000DF050420201231DF060101DF0281B0A2583AA40746E3A63C22478F576D1EFC5FB046135A6FC739E82B55035F71B09BEB566EDB9968DD649B94B6DEDC033899884E908C27BE1CD291E5436F762553297763DAA3B890D778C0F01E3344CECDFB3BA70D7E055B8C760D0179A403D6B55F2B3B083912B183ADB7927441BED3395A199EEFE0DEBD1F5FC3264033DA856F4A8B93916885BD42F9C1F456AAB8CFA83AC574833EB5E87BB9D4C006A4B5346BD9E17E139AB6552D9C58BC041195336485DF040103DF0314D9FD62C9DD4E6DE7741E9A17FB1FF2C5DB948BCBDF070100");
|
||||
emvOptV2.addCapk(capkV2);
|
||||
|
||||
//JCB Test CAPK
|
||||
// capkV2 = EmvUtil.hexStr2Rid("9F0605A0000000659F220111DF05083230323431323331DF060101DF070101DF040103DF0281A2583AA40746E3A63C22478F576D1EFC5FB046135A6FC739E82B55035F71B09BEB566EDB9968DD649B94B6DEDC033899884E908C27BE1CD291E5436F762553297763DAA3B890D778C0F01E3344CECDFB3BA70D7E055B8C760D0179A403D6B55F2B3B083912B183ADB7927441BED3395A199EEFE0DEBD1F5FC3264033DA856F4A8B93916885BD42F9C1F456AAB8CFA83AC574833EB5E87BB9D4C006A4B5346BD9E17E139AB6552D9C58BC041195336485DF0314D9FD62C9DD4E6DE7741E9A17FB1FF2C5DB948BCB");
|
||||
// emvOptV2.addCapk(capkV2);
|
||||
LogUtil.d(TAG, "init AID and CAPKs success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.d(TAG, "initAIDAndRid fail");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Convert Hex string AID to AidV2 */
|
||||
public static AidV2 hexStr2Aid(String hexStr) {
|
||||
AidV2 aidV2 = new AidV2();
|
||||
Map<String, TLV> map = TLVUtil.buildTLVMap(hexStr);
|
||||
TLV tlv = map.get("DF21");
|
||||
if (tlv != null) {
|
||||
aidV2.cvmLmt = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF20");
|
||||
if (tlv != null) {
|
||||
aidV2.termClssLmt = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF19");
|
||||
if (tlv != null) {
|
||||
aidV2.termClssOfflineFloorLmt = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F7B");
|
||||
if (tlv != null) {
|
||||
aidV2.termOfflineFloorLmt = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F06");
|
||||
if (tlv != null) {
|
||||
aidV2.aid = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF01");
|
||||
if (tlv != null) {
|
||||
aidV2.selFlag = ByteUtil.hexStr2Byte(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF17");
|
||||
if (tlv != null) {
|
||||
aidV2.targetPer = ByteUtil.hexStr2Byte(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF16");
|
||||
if (tlv != null) {
|
||||
aidV2.maxTargetPer = ByteUtil.hexStr2Byte(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F1B");
|
||||
if (tlv != null) {
|
||||
aidV2.floorLimit = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF15");
|
||||
if (tlv != null) {
|
||||
aidV2.threshold = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF13");
|
||||
if (tlv != null) {
|
||||
aidV2.TACDenial = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF12");
|
||||
if (tlv != null) {
|
||||
aidV2.TACOnline = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF11");
|
||||
if (tlv != null) {
|
||||
aidV2.TACDefault = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F01");
|
||||
if (tlv != null) {
|
||||
aidV2.AcquierId = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF14");
|
||||
if (tlv != null) {
|
||||
aidV2.dDOL = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F09");
|
||||
if (tlv != null) {
|
||||
aidV2.version = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F4E");
|
||||
if (tlv != null) {
|
||||
aidV2.merchName = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F15");
|
||||
if (tlv != null) {
|
||||
aidV2.merchCateCode = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F16");
|
||||
if (tlv != null) {
|
||||
aidV2.merchId = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F3C");
|
||||
if (tlv != null) {
|
||||
aidV2.referCurrCode = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F3D");
|
||||
if (tlv != null) {
|
||||
aidV2.referCurrExp = ByteUtil.hexStr2Byte(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DFC108");
|
||||
if (tlv != null) {
|
||||
aidV2.clsStatusCheck = ByteUtil.hexStr2Byte(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DFC109");
|
||||
if (tlv != null) {
|
||||
aidV2.zeroCheck = ByteUtil.hexStr2Byte(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DFC10A");
|
||||
if (tlv != null) {
|
||||
aidV2.kernelType = ByteUtil.hexStr2Byte(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DFC10B");
|
||||
if (tlv != null) {
|
||||
aidV2.paramType = ByteUtil.hexStr2Byte(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F66");
|
||||
if (tlv != null) {
|
||||
aidV2.ttq = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F1C");
|
||||
if (tlv != null) {
|
||||
aidV2.termId = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F1D");
|
||||
if (tlv != null) {
|
||||
aidV2.riskManData = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF8101");
|
||||
if (tlv != null) {
|
||||
aidV2.referCurrCon = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF8102");
|
||||
if (tlv != null) {
|
||||
aidV2.tDOL = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
return aidV2;
|
||||
}
|
||||
|
||||
/** Convert Hex string RID to CapkV2 */
|
||||
public static CapkV2 hexStr2Rid(String hexStr) {
|
||||
CapkV2 capkV2 = new CapkV2();
|
||||
Map<String, TLV> map = TLVUtil.buildTLVMap(hexStr);
|
||||
TLV tlv = map.get("9F06"); //CAPK RID
|
||||
if (tlv != null) {
|
||||
capkV2.rid = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("9F22"); //CAPK key id
|
||||
if (tlv != null) {
|
||||
capkV2.index = ByteUtil.hexStr2Byte(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF06"); // CAPK hash algorithm indicator
|
||||
if (tlv != null) {
|
||||
capkV2.hashInd = ByteUtil.hexStr2Byte(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF07"); //CAPK RSA algorithm indicator
|
||||
if (tlv != null) {
|
||||
capkV2.arithInd = ByteUtil.hexStr2Byte(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF02"); // CAPK modulus
|
||||
if (tlv != null) {
|
||||
capkV2.modul = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF04"); // CAPK Exponent
|
||||
if (tlv != null) {
|
||||
capkV2.exponent = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF05"); // CAPK Expiry Date(YYMMDD)
|
||||
if (tlv != null) {
|
||||
capkV2.expDate = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
tlv = map.get("DF03"); // CAPK CheckSum
|
||||
if (tlv != null) {
|
||||
capkV2.checkSum = ByteUtil.hexStr2Bytes(tlv.getValue());
|
||||
}
|
||||
return capkV2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,9 @@ import com.nexgo.oaf.apiv3.device.pinpad.CalcModeEnum;
|
||||
import com.nexgo.oaf.apiv3.device.pinpad.DukptKeyTypeEnum;
|
||||
import com.nexgo.oaf.apiv3.device.pinpad.PinPad;
|
||||
import com.nexgo.oaf.apiv3.device.pinpad.WorkKeyTypeEnum;
|
||||
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||
import com.sunmi.pay.hardware.aidlv2.AidlConstantsV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.security.SecurityOptV2;
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.PayLibNex;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||
@ -61,5 +64,50 @@ public final class TerminalKeyUtil {
|
||||
// LogUtil.d(TAG, "save tek key result: "+resultTEK);
|
||||
|
||||
// LogUtil.d(TAG, "calcByWKey TDKEY: "+ByteUtil.bytes2HexStr(results));
|
||||
}
|
||||
public static void initKey() {
|
||||
|
||||
LogUtil.d(TAG, "Init Key Process is Starting.....");
|
||||
byte[] pik_value;
|
||||
byte[] pik_kcv;
|
||||
|
||||
SecurityOptV2 mSecurityOptV2 = BaseApplication.getInstance().mSecurityOptV2;
|
||||
byte[] cvByte = ByteUtil.hexStr2Bytes("60430856F15FAE51");
|
||||
byte[] dataByte = ByteUtil.hexStr2Bytes("170003A44E7D5366FECD4731D9BD4E49");
|
||||
|
||||
byte[] makBytes = ByteUtil.hexStr2Bytes("250738083EC15BD3BA67D66B8A7AA13B");
|
||||
// byte[] makCvBytes = ByteUtil.hexStr2Bytes("204E449B97");
|
||||
|
||||
byte[] BDKByte = ByteUtil.hexStr2Bytes("1282DB1D55637B69F98E7D50C5AC7284");
|
||||
byte[] IPEKByte = ByteUtil.hexStr2Bytes("5A4CFF6DE93F0488926166F3317EFD2F"); // IPEK
|
||||
byte[] IPEKKCVByte = ByteUtil.hexStr2Bytes("1F0C18");
|
||||
byte[] KSNByte = ByteUtil.hexStr2Bytes("FFFF9876543210E00001");
|
||||
|
||||
byte[] tmkByte;
|
||||
byte[] kcvByte = new byte[8];
|
||||
|
||||
|
||||
|
||||
int result = 0;
|
||||
|
||||
if(!SystemParamsOperation.getInstance().isInjectOnce()) {
|
||||
try {
|
||||
result = mSecurityOptV2.saveKeyDukpt(AidlConstantsV2.Security.KEY_TYPE_DUPKT_IPEK,IPEKByte,IPEKKCVByte,KSNByte,AidlConstantsV2.Security.KEY_ALG_TYPE_3DES,9);
|
||||
LogUtil.d(ContentValues.TAG, "save IPEK result:" + result);
|
||||
if (result != 0) {
|
||||
LogUtil.d(TAG, "save IPEK fail");
|
||||
} else {
|
||||
SystemParamsOperation.getInstance().setInjectOnce(true);
|
||||
}
|
||||
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@ import androidx.room.RoomDatabase;
|
||||
import androidx.room.TypeConverters;
|
||||
|
||||
import com.utsmyanmar.baselib.db.converter.CardSchemeConverter;
|
||||
import com.utsmyanmar.baselib.db.converter.CardSettleDataConverter;
|
||||
import com.utsmyanmar.baselib.db.converter.QRSettleDataConverter;
|
||||
import com.utsmyanmar.baselib.db.converter.SettleDataConverter;
|
||||
import com.utsmyanmar.baselib.db.converter.TransCVMConverter;
|
||||
@ -45,10 +44,10 @@ import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
MPUCtlsEntity.class,
|
||||
BinEntity.class
|
||||
},
|
||||
version = 13,
|
||||
version = 12,
|
||||
exportSchema = false
|
||||
)
|
||||
@TypeConverters({SettleDataConverter.class, TransCVMConverter.class, CardSchemeConverter.class, QRSettleDataConverter.class, CardSettleDataConverter.class})
|
||||
@TypeConverters({SettleDataConverter.class, TransCVMConverter.class, CardSchemeConverter.class, QRSettleDataConverter.class})
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
|
||||
public abstract PayDetailDao payDetailDao();
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
package com.utsmyanmar.baselib.db.converter;
|
||||
|
||||
import androidx.room.TypeConverter;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.utsmyanmar.paylibs.model.CardSettleData;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.List;
|
||||
|
||||
public class CardSettleDataConverter {
|
||||
private static final Gson gson = new Gson();
|
||||
|
||||
@TypeConverter
|
||||
public static List<CardSettleData> fromString(String value) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Type listType = new TypeToken<List<CardSettleData>>(){}.getType();
|
||||
return gson.fromJson(value, listType);
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
public static String toString(List<CardSettleData> cardSettleDataList) {
|
||||
if (cardSettleDataList == null) {
|
||||
return null;
|
||||
}
|
||||
return gson.toJson(cardSettleDataList);
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ import androidx.room.Entity;
|
||||
import androidx.room.Ignore;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.AidV2;
|
||||
import com.utsmyanmar.paylibs.model.AidConfig;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||
|
||||
@ -407,108 +408,108 @@ public class EmvDetail {
|
||||
return ttq;
|
||||
}
|
||||
|
||||
// public AidV2 loadAid() {
|
||||
// AidV2 aidV2 = new AidV2();
|
||||
//
|
||||
// if (ctsCvmLimit != null) {
|
||||
// aidV2.cvmLmt = ByteUtil.hexStr2Bytes(ctsCvmLimit);
|
||||
// }
|
||||
// if (ctsTransLimit != null) {
|
||||
// aidV2.termClssLmt = ByteUtil.hexStr2Bytes(ctsTransLimit);
|
||||
// }
|
||||
//
|
||||
// if (termCtsOfflineFloorLmt != null) {
|
||||
// aidV2.termClssOfflineFloorLmt = ByteUtil.hexStr2Bytes(termCtsOfflineFloorLmt);
|
||||
// }
|
||||
//
|
||||
// if (termOfflineFloorLmt != null) {
|
||||
// aidV2.termOfflineFloorLmt = ByteUtil.hexStr2Bytes(termOfflineFloorLmt);
|
||||
// }
|
||||
//
|
||||
// if (aid != null) {
|
||||
// aidV2.aid = ByteUtil.hexStr2Bytes(aid);
|
||||
// }
|
||||
// if (selFlag != null) {
|
||||
// aidV2.selFlag = ByteUtil.hexStr2Byte(selFlag);
|
||||
// }
|
||||
//
|
||||
// if (targetPercent != null) {
|
||||
// aidV2.targetPer = ByteUtil.hexStr2Byte(targetPercent);
|
||||
// }
|
||||
// if (maxTargetPercent != null) {
|
||||
// aidV2.maxTargetPer = ByteUtil.hexStr2Byte(maxTargetPercent);
|
||||
// }
|
||||
// if (floorLimit != null) {
|
||||
// aidV2.floorLimit = ByteUtil.hexStr2Bytes(floorLimit);
|
||||
// }
|
||||
//
|
||||
// if (threshold != null) {
|
||||
// aidV2.threshold = ByteUtil.hexStr2Bytes(threshold);
|
||||
// }
|
||||
//
|
||||
// if (tacDenial != null) {
|
||||
// aidV2.TACDenial = ByteUtil.hexStr2Bytes(tacDenial);
|
||||
// }
|
||||
// if (tacOnline != null) {
|
||||
// aidV2.TACOnline = ByteUtil.hexStr2Bytes(tacOnline);
|
||||
// }
|
||||
//
|
||||
// if (tacDefault != null) {
|
||||
// aidV2.TACDefault = ByteUtil.hexStr2Bytes(tacDefault);
|
||||
// }
|
||||
// if (acquirerId != null) {
|
||||
// aidV2.AcquierId = ByteUtil.hexStr2Bytes(acquirerId);
|
||||
// }
|
||||
// if (dDol != null) {
|
||||
// aidV2.dDOL = ByteUtil.hexStr2Bytes(dDol);
|
||||
// }
|
||||
// if (applicationVersion != null) {
|
||||
// aidV2.version = ByteUtil.hexStr2Bytes(applicationVersion);
|
||||
// }
|
||||
// if (merchantName != null) {
|
||||
// aidV2.merchName = ByteUtil.hexStr2Bytes(merchantName);
|
||||
// }
|
||||
// if (merchantCateCode != null) {
|
||||
// aidV2.merchCateCode = ByteUtil.hexStr2Bytes(merchantCateCode);
|
||||
// }
|
||||
// if (merchantId != null) {
|
||||
// aidV2.merchId = ByteUtil.hexStr2Bytes(merchantId);
|
||||
// }
|
||||
// if (referCurrCode != null) {
|
||||
// aidV2.referCurrCode = ByteUtil.hexStr2Bytes(referCurrCode);
|
||||
// }
|
||||
// if (referCurrExp != null) {
|
||||
// aidV2.referCurrExp = ByteUtil.hexStr2Byte(referCurrExp);
|
||||
// }
|
||||
// if (ctsStatusCheck != null) {
|
||||
// aidV2.clsStatusCheck = ByteUtil.hexStr2Byte(ctsStatusCheck);
|
||||
// }
|
||||
// if (zeroCheck != null) {
|
||||
// aidV2.zeroCheck = ByteUtil.hexStr2Byte(zeroCheck);
|
||||
// }
|
||||
// if (kernelType != null) {
|
||||
// aidV2.kernelType = ByteUtil.hexStr2Byte(kernelType);
|
||||
// }
|
||||
// if (paramType != null) {
|
||||
// aidV2.paramType = ByteUtil.hexStr2Byte(paramType);
|
||||
// }
|
||||
// if (ttq != null) {
|
||||
// aidV2.ttq = ByteUtil.hexStr2Bytes(ttq);
|
||||
// }
|
||||
// if (termId != null) {
|
||||
// aidV2.termId = ByteUtil.hexStr2Bytes(termId);
|
||||
// }
|
||||
// if (riskManageData != null) {
|
||||
// aidV2.riskManData = ByteUtil.hexStr2Bytes(riskManageData);
|
||||
// }
|
||||
// if (referCurrCon != null) {
|
||||
// aidV2.referCurrCon = ByteUtil.hexStr2Bytes(referCurrCon);
|
||||
// }
|
||||
// if (tDol != null) {
|
||||
// aidV2.tDOL = ByteUtil.hexStr2Bytes(tDol);
|
||||
// }
|
||||
// return aidV2;
|
||||
// }
|
||||
public AidV2 loadAid() {
|
||||
AidV2 aidV2 = new AidV2();
|
||||
|
||||
if (ctsCvmLimit != null) {
|
||||
aidV2.cvmLmt = ByteUtil.hexStr2Bytes(ctsCvmLimit);
|
||||
}
|
||||
if (ctsTransLimit != null) {
|
||||
aidV2.termClssLmt = ByteUtil.hexStr2Bytes(ctsTransLimit);
|
||||
}
|
||||
|
||||
if (termCtsOfflineFloorLmt != null) {
|
||||
aidV2.termClssOfflineFloorLmt = ByteUtil.hexStr2Bytes(termCtsOfflineFloorLmt);
|
||||
}
|
||||
|
||||
if (termOfflineFloorLmt != null) {
|
||||
aidV2.termOfflineFloorLmt = ByteUtil.hexStr2Bytes(termOfflineFloorLmt);
|
||||
}
|
||||
|
||||
if (aid != null) {
|
||||
aidV2.aid = ByteUtil.hexStr2Bytes(aid);
|
||||
}
|
||||
if (selFlag != null) {
|
||||
aidV2.selFlag = ByteUtil.hexStr2Byte(selFlag);
|
||||
}
|
||||
|
||||
if (targetPercent != null) {
|
||||
aidV2.targetPer = ByteUtil.hexStr2Byte(targetPercent);
|
||||
}
|
||||
if (maxTargetPercent != null) {
|
||||
aidV2.maxTargetPer = ByteUtil.hexStr2Byte(maxTargetPercent);
|
||||
}
|
||||
if (floorLimit != null) {
|
||||
aidV2.floorLimit = ByteUtil.hexStr2Bytes(floorLimit);
|
||||
}
|
||||
|
||||
if (threshold != null) {
|
||||
aidV2.threshold = ByteUtil.hexStr2Bytes(threshold);
|
||||
}
|
||||
|
||||
if (tacDenial != null) {
|
||||
aidV2.TACDenial = ByteUtil.hexStr2Bytes(tacDenial);
|
||||
}
|
||||
if (tacOnline != null) {
|
||||
aidV2.TACOnline = ByteUtil.hexStr2Bytes(tacOnline);
|
||||
}
|
||||
|
||||
if (tacDefault != null) {
|
||||
aidV2.TACDefault = ByteUtil.hexStr2Bytes(tacDefault);
|
||||
}
|
||||
if (acquirerId != null) {
|
||||
aidV2.AcquierId = ByteUtil.hexStr2Bytes(acquirerId);
|
||||
}
|
||||
if (dDol != null) {
|
||||
aidV2.dDOL = ByteUtil.hexStr2Bytes(dDol);
|
||||
}
|
||||
if (applicationVersion != null) {
|
||||
aidV2.version = ByteUtil.hexStr2Bytes(applicationVersion);
|
||||
}
|
||||
if (merchantName != null) {
|
||||
aidV2.merchName = ByteUtil.hexStr2Bytes(merchantName);
|
||||
}
|
||||
if (merchantCateCode != null) {
|
||||
aidV2.merchCateCode = ByteUtil.hexStr2Bytes(merchantCateCode);
|
||||
}
|
||||
if (merchantId != null) {
|
||||
aidV2.merchId = ByteUtil.hexStr2Bytes(merchantId);
|
||||
}
|
||||
if (referCurrCode != null) {
|
||||
aidV2.referCurrCode = ByteUtil.hexStr2Bytes(referCurrCode);
|
||||
}
|
||||
if (referCurrExp != null) {
|
||||
aidV2.referCurrExp = ByteUtil.hexStr2Byte(referCurrExp);
|
||||
}
|
||||
if (ctsStatusCheck != null) {
|
||||
aidV2.clsStatusCheck = ByteUtil.hexStr2Byte(ctsStatusCheck);
|
||||
}
|
||||
if (zeroCheck != null) {
|
||||
aidV2.zeroCheck = ByteUtil.hexStr2Byte(zeroCheck);
|
||||
}
|
||||
if (kernelType != null) {
|
||||
aidV2.kernelType = ByteUtil.hexStr2Byte(kernelType);
|
||||
}
|
||||
if (paramType != null) {
|
||||
aidV2.paramType = ByteUtil.hexStr2Byte(paramType);
|
||||
}
|
||||
if (ttq != null) {
|
||||
aidV2.ttq = ByteUtil.hexStr2Bytes(ttq);
|
||||
}
|
||||
if (termId != null) {
|
||||
aidV2.termId = ByteUtil.hexStr2Bytes(termId);
|
||||
}
|
||||
if (riskManageData != null) {
|
||||
aidV2.riskManData = ByteUtil.hexStr2Bytes(riskManageData);
|
||||
}
|
||||
if (referCurrCon != null) {
|
||||
aidV2.referCurrCon = ByteUtil.hexStr2Bytes(referCurrCon);
|
||||
}
|
||||
if (tDol != null) {
|
||||
aidV2.tDOL = ByteUtil.hexStr2Bytes(tDol);
|
||||
}
|
||||
return aidV2;
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getConfigString(){
|
||||
|
||||
@ -317,16 +317,6 @@ public class DatabaseModule {
|
||||
}
|
||||
};
|
||||
|
||||
static final Migration MIGRATION_12_13 = new Migration(12, 13) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase database) {
|
||||
|
||||
database.execSQL("ALTER TABLE paydetail "
|
||||
+ " ADD COLUMN cardSettleData TEXT");
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@ -338,7 +328,6 @@ public class DatabaseModule {
|
||||
.addMigrations(MIGRATION_9_10)
|
||||
.addMigrations(MIGRATION_10_11)
|
||||
.addMigrations(MIGRATION_11_12)
|
||||
.addMigrations(MIGRATION_12_13)
|
||||
.allowMainThreadQueries()
|
||||
.addCallback(new RoomDatabase.Callback() {
|
||||
@Override
|
||||
|
||||
@ -7,6 +7,10 @@ import com.nexgo.oaf.apiv3.emv.AidEntity;
|
||||
import com.nexgo.oaf.apiv3.emv.AidEntryModeEnum;
|
||||
import com.nexgo.oaf.apiv3.emv.CapkEntity;
|
||||
import com.nexgo.oaf.apiv3.emv.EmvHandler2;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.AidV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.CapkV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.EMVCandidateV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.emv.EMVOptV2;
|
||||
import com.utsmyanmar.baselib.BaseApplication;
|
||||
import com.utsmyanmar.baselib.db.model.ChipAidEntity;
|
||||
import com.utsmyanmar.baselib.db.model.ContactAid;
|
||||
@ -25,7 +29,7 @@ public class EmvParamHelper {
|
||||
|
||||
private static final String TAG = EmvParamHelper.class.getSimpleName();
|
||||
|
||||
// private EMVOptV2 emvOptV2;
|
||||
private EMVOptV2 emvOptV2;
|
||||
private EmvHandler2 emvHandler2;
|
||||
|
||||
public static EmvParamHelper getInstance() {
|
||||
@ -36,14 +40,28 @@ public class EmvParamHelper {
|
||||
}
|
||||
|
||||
private EmvParamHelper() {
|
||||
this.emvOptV2 = BaseApplication.getInstance().mEMVOptV2;
|
||||
this.emvHandler2 = BaseApplication.getInstance().deviceEngine.getEmvHandler2("app2");
|
||||
}
|
||||
|
||||
private void initEmvCandidate() {
|
||||
EMVCandidateV2 emvCandidateV2 = new EMVCandidateV2();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void deleteAllAids() {
|
||||
try {
|
||||
LogUtil.d(TAG, "Deleting all the AIDs...");
|
||||
int result = emvOptV2.deleteAid(null);
|
||||
if (result == 0) {
|
||||
LogUtil.d(TAG, "Deleted all AIDs");
|
||||
}
|
||||
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteAllAidsNex() {
|
||||
|
||||
@ -61,34 +79,46 @@ public class EmvParamHelper {
|
||||
|
||||
}
|
||||
|
||||
public void deleteAllRids() {
|
||||
try {
|
||||
LogUtil.d(TAG, "Deleting all the RIDs...");
|
||||
int result = emvOptV2.deleteCapk(null, null);
|
||||
if (result == 0) {
|
||||
LogUtil.d(TAG, "Deleted all RIDs");
|
||||
}
|
||||
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public void initializeContactlessAid(ContactlessAid contactlessAid) {
|
||||
// AidV2 aidV2 = convertContactlessAID(contactlessAid);
|
||||
// try {
|
||||
// emvOptV2.addAid(aidV2);
|
||||
// } catch (RemoteException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void initializeContactAid(ContactAid contactAid) {
|
||||
// AidV2 aidV2 = convertContactAID(contactAid);
|
||||
// try {
|
||||
// emvOptV2.addAid(aidV2);
|
||||
// } catch (RemoteException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
public void initializeContactlessAid(ContactlessAid contactlessAid) {
|
||||
AidV2 aidV2 = convertContactlessAID(contactlessAid);
|
||||
try {
|
||||
emvOptV2.addAid(aidV2);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// public void initializeRids(RidEntity entity) {
|
||||
// CapkV2 capkV2 = convertRid(entity);
|
||||
// try {
|
||||
// emvOptV2.addCapk(capkV2);
|
||||
// } catch (RemoteException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
public void initializeContactAid(ContactAid contactAid) {
|
||||
AidV2 aidV2 = convertContactAID(contactAid);
|
||||
try {
|
||||
emvOptV2.addAid(aidV2);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void initializeRids(RidEntity entity) {
|
||||
CapkV2 capkV2 = convertRid(entity);
|
||||
try {
|
||||
emvOptV2.addCapk(capkV2);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void initializeContactlessAidNex(List<? extends ContactlessAid> aids) {
|
||||
List<AidEntity> aidEntityList = new ArrayList<>();
|
||||
@ -128,223 +158,223 @@ public class EmvParamHelper {
|
||||
}
|
||||
|
||||
|
||||
// private AidV2 convertContactlessAID(ContactlessAid contactlessAid) {
|
||||
// AidV2 aidV2 = new AidV2();
|
||||
//
|
||||
// if (!(contactlessAid.getCvmLimit() < 0)) {
|
||||
// aidV2.cvmLmt = ByteUtil.hexStr2Bytes(ParamHelper.getInstance().convertPaddedString(contactlessAid.getCvmLimit()));
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getTransLimit() != null && !contactlessAid.getTransLimit().isEmpty()) {
|
||||
// aidV2.termClssLmt = ByteUtil.hexStr2Bytes(contactlessAid.getTransLimit());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getFloorLimit() != null && !contactlessAid.getFloorLimit().isEmpty()) {
|
||||
// aidV2.termClssOfflineFloorLmt = ByteUtil.hexStr2Bytes(contactlessAid.getFloorLimit());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getFloorLimit() != null && !contactlessAid.getFloorLimit().isEmpty()) {
|
||||
// aidV2.termOfflineFloorLmt = ByteUtil.hexStr2Bytes(contactlessAid.getFloorLimit());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getFloorLimit() != null && !contactlessAid.getFloorLimit().isEmpty()) {
|
||||
// aidV2.floorLimit = ByteUtil.hexStr2Bytes(contactlessAid.getFloorLimit().substring(4, 12));
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getAid() != null && !contactlessAid.getAid().isEmpty()) {
|
||||
// aidV2.aid = ByteUtil.hexStr2Bytes(contactlessAid.getAid());
|
||||
// }
|
||||
//
|
||||
// aidV2.selFlag = ByteUtil.hexStr2Byte("01");
|
||||
// aidV2.clsStatusCheck = ByteUtil.hexStr2Byte("01");
|
||||
//
|
||||
// /*
|
||||
// * 00 - default - both
|
||||
// * 01 - chip
|
||||
// * 02 - contactless
|
||||
// * */
|
||||
// aidV2.paramType = ByteUtil.hexStr2Byte("02");
|
||||
//
|
||||
// if (contactlessAid.getTargetPercent() != null && !contactlessAid.getTargetPercent().isEmpty()) {
|
||||
// aidV2.targetPer = ByteUtil.hexStr2Byte(contactlessAid.getTargetPercent());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getMaxTargetPercent() != null && !contactlessAid.getMaxTargetPercent().isEmpty()) {
|
||||
// aidV2.maxTargetPer = ByteUtil.hexStr2Byte(contactlessAid.getMaxTargetPercent());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getThreshold() != null && !contactlessAid.getThreshold().isEmpty()) {
|
||||
// aidV2.threshold = ByteUtil.hexStr2Bytes(contactlessAid.getThreshold());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getTacDenial() != null && !contactlessAid.getTacDenial().isEmpty()) {
|
||||
// aidV2.TACDenial = ByteUtil.hexStr2Bytes(contactlessAid.getTacDenial());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getTacOnline() != null && !contactlessAid.getTacOnline().isEmpty()) {
|
||||
// aidV2.TACOnline = ByteUtil.hexStr2Bytes(contactlessAid.getTacOnline());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getTacDefault() != null && !contactlessAid.getTacDefault().isEmpty()) {
|
||||
// aidV2.TACDefault = ByteUtil.hexStr2Bytes(contactlessAid.getTacDefault());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getEmvDDOL() != null && !contactlessAid.getEmvDDOL().isEmpty()) {
|
||||
// aidV2.dDOL = ByteUtil.hexStr2Bytes(contactlessAid.getEmvDDOL());
|
||||
// }
|
||||
// if (contactlessAid.getApplicationVersion() != null && !contactlessAid.getApplicationVersion().isEmpty()) {
|
||||
// aidV2.version = ByteUtil.hexStr2Bytes(contactlessAid.getApplicationVersion());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getKernelType() != null && !contactlessAid.getKernelType().isEmpty()) {
|
||||
// aidV2.kernelType = ByteUtil.hexStr2Byte(contactlessAid.getKernelType());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getTtq() != null && !contactlessAid.getTtq().isEmpty()) {
|
||||
// aidV2.ttq = ByteUtil.hexStr2Bytes(contactlessAid.getTtq());
|
||||
// }
|
||||
// if (contactlessAid.getRiskManageData() != null && !contactlessAid.getRiskManageData().isEmpty()) {
|
||||
// aidV2.riskManData = ByteUtil.hexStr2Bytes(contactlessAid.getRiskManageData());
|
||||
// aidV2.rMDLen = 0x08;
|
||||
// LogUtil.d(TAG, "Risk Management data is added! for " + contactlessAid.getAid());
|
||||
// }
|
||||
// if (contactlessAid.getEmvTDOL() != null && !contactlessAid.getEmvTDOL().isEmpty()) {
|
||||
// aidV2.tDOL = ByteUtil.hexStr2Bytes(contactlessAid.getEmvTDOL());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getCateCode() != null && !contactlessAid.getCateCode().isEmpty()) {
|
||||
// aidV2.merchCateCode = ByteUtil.hexStr2Bytes(contactlessAid.getCateCode());
|
||||
// }
|
||||
//
|
||||
// if (contactlessAid.getCurrencyCode() != null && !contactlessAid.getCurrencyCode().isEmpty()) {
|
||||
// aidV2.referCurrCode = ByteUtil.hexStr2Bytes(contactlessAid.getCurrencyCode());
|
||||
// aidV2.referCurrCon = ByteUtil.hexStr2Bytes(contactlessAid.getCurrencyCode());
|
||||
// aidV2.referCurrExp = ByteUtil.hexStr2Byte("02");
|
||||
// }
|
||||
//
|
||||
// aidV2.AcquierId = ByteUtil.hexStr2Bytes("1234567891");
|
||||
// aidV2.merchName = ByteUtil.hexStr2Bytes("5465726D696E616C");
|
||||
// aidV2.merchId = ByteUtil.hexStr2Bytes("303030303030303030303030303030");
|
||||
// aidV2.termId = ByteUtil.hexStr2Bytes("4261636B39363132");
|
||||
//
|
||||
// return aidV2;
|
||||
// }
|
||||
private AidV2 convertContactlessAID(ContactlessAid contactlessAid) {
|
||||
AidV2 aidV2 = new AidV2();
|
||||
|
||||
if (!(contactlessAid.getCvmLimit() < 0)) {
|
||||
aidV2.cvmLmt = ByteUtil.hexStr2Bytes(ParamHelper.getInstance().convertPaddedString(contactlessAid.getCvmLimit()));
|
||||
}
|
||||
|
||||
if (contactlessAid.getTransLimit() != null && !contactlessAid.getTransLimit().isEmpty()) {
|
||||
aidV2.termClssLmt = ByteUtil.hexStr2Bytes(contactlessAid.getTransLimit());
|
||||
}
|
||||
|
||||
if (contactlessAid.getFloorLimit() != null && !contactlessAid.getFloorLimit().isEmpty()) {
|
||||
aidV2.termClssOfflineFloorLmt = ByteUtil.hexStr2Bytes(contactlessAid.getFloorLimit());
|
||||
}
|
||||
|
||||
if (contactlessAid.getFloorLimit() != null && !contactlessAid.getFloorLimit().isEmpty()) {
|
||||
aidV2.termOfflineFloorLmt = ByteUtil.hexStr2Bytes(contactlessAid.getFloorLimit());
|
||||
}
|
||||
|
||||
if (contactlessAid.getFloorLimit() != null && !contactlessAid.getFloorLimit().isEmpty()) {
|
||||
aidV2.floorLimit = ByteUtil.hexStr2Bytes(contactlessAid.getFloorLimit().substring(4, 12));
|
||||
}
|
||||
|
||||
if (contactlessAid.getAid() != null && !contactlessAid.getAid().isEmpty()) {
|
||||
aidV2.aid = ByteUtil.hexStr2Bytes(contactlessAid.getAid());
|
||||
}
|
||||
|
||||
aidV2.selFlag = ByteUtil.hexStr2Byte("01");
|
||||
aidV2.clsStatusCheck = ByteUtil.hexStr2Byte("01");
|
||||
|
||||
/*
|
||||
* 00 - default - both
|
||||
* 01 - chip
|
||||
* 02 - contactless
|
||||
* */
|
||||
aidV2.paramType = ByteUtil.hexStr2Byte("02");
|
||||
|
||||
if (contactlessAid.getTargetPercent() != null && !contactlessAid.getTargetPercent().isEmpty()) {
|
||||
aidV2.targetPer = ByteUtil.hexStr2Byte(contactlessAid.getTargetPercent());
|
||||
}
|
||||
|
||||
if (contactlessAid.getMaxTargetPercent() != null && !contactlessAid.getMaxTargetPercent().isEmpty()) {
|
||||
aidV2.maxTargetPer = ByteUtil.hexStr2Byte(contactlessAid.getMaxTargetPercent());
|
||||
}
|
||||
|
||||
if (contactlessAid.getThreshold() != null && !contactlessAid.getThreshold().isEmpty()) {
|
||||
aidV2.threshold = ByteUtil.hexStr2Bytes(contactlessAid.getThreshold());
|
||||
}
|
||||
|
||||
if (contactlessAid.getTacDenial() != null && !contactlessAid.getTacDenial().isEmpty()) {
|
||||
aidV2.TACDenial = ByteUtil.hexStr2Bytes(contactlessAid.getTacDenial());
|
||||
}
|
||||
|
||||
if (contactlessAid.getTacOnline() != null && !contactlessAid.getTacOnline().isEmpty()) {
|
||||
aidV2.TACOnline = ByteUtil.hexStr2Bytes(contactlessAid.getTacOnline());
|
||||
}
|
||||
|
||||
if (contactlessAid.getTacDefault() != null && !contactlessAid.getTacDefault().isEmpty()) {
|
||||
aidV2.TACDefault = ByteUtil.hexStr2Bytes(contactlessAid.getTacDefault());
|
||||
}
|
||||
|
||||
if (contactlessAid.getEmvDDOL() != null && !contactlessAid.getEmvDDOL().isEmpty()) {
|
||||
aidV2.dDOL = ByteUtil.hexStr2Bytes(contactlessAid.getEmvDDOL());
|
||||
}
|
||||
if (contactlessAid.getApplicationVersion() != null && !contactlessAid.getApplicationVersion().isEmpty()) {
|
||||
aidV2.version = ByteUtil.hexStr2Bytes(contactlessAid.getApplicationVersion());
|
||||
}
|
||||
|
||||
if (contactlessAid.getKernelType() != null && !contactlessAid.getKernelType().isEmpty()) {
|
||||
aidV2.kernelType = ByteUtil.hexStr2Byte(contactlessAid.getKernelType());
|
||||
}
|
||||
|
||||
if (contactlessAid.getTtq() != null && !contactlessAid.getTtq().isEmpty()) {
|
||||
aidV2.ttq = ByteUtil.hexStr2Bytes(contactlessAid.getTtq());
|
||||
}
|
||||
if (contactlessAid.getRiskManageData() != null && !contactlessAid.getRiskManageData().isEmpty()) {
|
||||
aidV2.riskManData = ByteUtil.hexStr2Bytes(contactlessAid.getRiskManageData());
|
||||
aidV2.rMDLen = 0x08;
|
||||
LogUtil.d(TAG, "Risk Management data is added! for " + contactlessAid.getAid());
|
||||
}
|
||||
if (contactlessAid.getEmvTDOL() != null && !contactlessAid.getEmvTDOL().isEmpty()) {
|
||||
aidV2.tDOL = ByteUtil.hexStr2Bytes(contactlessAid.getEmvTDOL());
|
||||
}
|
||||
|
||||
if (contactlessAid.getCateCode() != null && !contactlessAid.getCateCode().isEmpty()) {
|
||||
aidV2.merchCateCode = ByteUtil.hexStr2Bytes(contactlessAid.getCateCode());
|
||||
}
|
||||
|
||||
if (contactlessAid.getCurrencyCode() != null && !contactlessAid.getCurrencyCode().isEmpty()) {
|
||||
aidV2.referCurrCode = ByteUtil.hexStr2Bytes(contactlessAid.getCurrencyCode());
|
||||
aidV2.referCurrCon = ByteUtil.hexStr2Bytes(contactlessAid.getCurrencyCode());
|
||||
aidV2.referCurrExp = ByteUtil.hexStr2Byte("02");
|
||||
}
|
||||
|
||||
aidV2.AcquierId = ByteUtil.hexStr2Bytes("1234567891");
|
||||
aidV2.merchName = ByteUtil.hexStr2Bytes("5465726D696E616C");
|
||||
aidV2.merchId = ByteUtil.hexStr2Bytes("303030303030303030303030303030");
|
||||
aidV2.termId = ByteUtil.hexStr2Bytes("4261636B39363132");
|
||||
|
||||
return aidV2;
|
||||
}
|
||||
|
||||
|
||||
// private AidV2 convertContactAID(ContactAid contactAid) {
|
||||
// AidV2 aidV2 = new AidV2();
|
||||
//
|
||||
// if (!(contactAid.getCvmLimit() < 0)) {
|
||||
// aidV2.cvmLmt = ByteUtil.hexStr2Bytes(ParamHelper.getInstance().convertPaddedString(contactAid.getCvmLimit()));
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getTransLimit() != null && !contactAid.getTransLimit().isEmpty()) {
|
||||
// aidV2.termClssLmt = ByteUtil.hexStr2Bytes(contactAid.getTransLimit());
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getFloorLimit() != null && !contactAid.getFloorLimit().isEmpty()) {
|
||||
// aidV2.termOfflineFloorLmt = ByteUtil.hexStr2Bytes(contactAid.getFloorLimit());
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getFloorLimit() != null && !contactAid.getFloorLimit().isEmpty()) {
|
||||
// ;
|
||||
// aidV2.floorLimit = ByteUtil.hexStr2Bytes(contactAid.getFloorLimit().substring(4, 12));
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getAid() != null && !contactAid.getAid().isEmpty()) {
|
||||
// aidV2.aid = ByteUtil.hexStr2Bytes(contactAid.getAid());
|
||||
// }
|
||||
//
|
||||
// aidV2.selFlag = ByteUtil.hexStr2Byte("01");
|
||||
//
|
||||
// /*
|
||||
// * 00 - default - both
|
||||
// * 01 - chip
|
||||
// * 02 - contactless
|
||||
// * */
|
||||
// aidV2.paramType = ByteUtil.hexStr2Byte("01");
|
||||
//
|
||||
// if (contactAid.getTargetPercent() != null && !contactAid.getTargetPercent().isEmpty()) {
|
||||
// aidV2.targetPer = ByteUtil.hexStr2Byte(contactAid.getTargetPercent());
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getMaxTargetPercent() != null && !contactAid.getMaxTargetPercent().isEmpty()) {
|
||||
// aidV2.maxTargetPer = ByteUtil.hexStr2Byte(contactAid.getMaxTargetPercent());
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getThreshold() != null && !contactAid.getThreshold().isEmpty()) {
|
||||
// aidV2.threshold = ByteUtil.hexStr2Bytes(contactAid.getThreshold());
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getTacDenial() != null && !contactAid.getTacDenial().isEmpty()) {
|
||||
// aidV2.TACDenial = ByteUtil.hexStr2Bytes(contactAid.getTacDenial());
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getTacOnline() != null && !contactAid.getTacOnline().isEmpty()) {
|
||||
// aidV2.TACOnline = ByteUtil.hexStr2Bytes(contactAid.getTacOnline());
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getTacDefault() != null && !contactAid.getTacDefault().isEmpty()) {
|
||||
// aidV2.TACDefault = ByteUtil.hexStr2Bytes(contactAid.getTacDefault());
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getEmvDDOL() != null && !contactAid.getEmvDDOL().isEmpty()) {
|
||||
// aidV2.dDOL = ByteUtil.hexStr2Bytes(contactAid.getEmvDDOL());
|
||||
// }
|
||||
// if (contactAid.getApplicationVersion() != null && !contactAid.getApplicationVersion().isEmpty()) {
|
||||
// aidV2.version = ByteUtil.hexStr2Bytes(contactAid.getApplicationVersion());
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getRiskManageData() != null && !contactAid.getRiskManageData().isEmpty()) {
|
||||
// aidV2.riskManData = ByteUtil.hexStr2Bytes(contactAid.getRiskManageData());
|
||||
// }
|
||||
// if (contactAid.getEmvTDOL() != null && !contactAid.getEmvTDOL().isEmpty()) {
|
||||
// aidV2.tDOL = ByteUtil.hexStr2Bytes(contactAid.getEmvTDOL());
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getCateCode() != null && !contactAid.getCateCode().isEmpty()) {
|
||||
// aidV2.merchCateCode = ByteUtil.hexStr2Bytes(contactAid.getCateCode());
|
||||
// }
|
||||
//
|
||||
// if (contactAid.getCurrencyCode() != null && !contactAid.getCurrencyCode().isEmpty()) {
|
||||
// aidV2.referCurrCode = ByteUtil.hexStr2Bytes(contactAid.getCurrencyCode());
|
||||
// aidV2.referCurrCon = ByteUtil.hexStr2Bytes(contactAid.getCurrencyCode());
|
||||
// aidV2.referCurrExp = ByteUtil.hexStr2Byte("02");
|
||||
// }
|
||||
//
|
||||
// return aidV2;
|
||||
// }
|
||||
private AidV2 convertContactAID(ContactAid contactAid) {
|
||||
AidV2 aidV2 = new AidV2();
|
||||
|
||||
// private CapkV2 convertRid(RidEntity ridEntity) {
|
||||
// CapkV2 capkV2 = new CapkV2();
|
||||
//
|
||||
// if (ridEntity.getRid() != null && !ridEntity.getRid().isEmpty()) {
|
||||
// capkV2.rid = ByteUtil.hexStr2Bytes(ridEntity.getRid());
|
||||
// }
|
||||
// if (ridEntity.getIndx() != null && !ridEntity.getIndx().isEmpty()) {
|
||||
// capkV2.index = ByteUtil.hexStr2Byte(ridEntity.getIndx());
|
||||
// }
|
||||
// if (ridEntity.getHashInd() != null && !ridEntity.getHashInd().isEmpty()) {
|
||||
// capkV2.hashInd = ByteUtil.hexStr2Byte(ridEntity.getHashInd());
|
||||
// }
|
||||
// if (ridEntity.getArithInd() != null && !ridEntity.getArithInd().isEmpty()) {
|
||||
// capkV2.arithInd = ByteUtil.hexStr2Byte(ridEntity.getArithInd());
|
||||
// }
|
||||
// if (ridEntity.getModul() != null && !ridEntity.getModul().isEmpty()) {
|
||||
// capkV2.modul = ByteUtil.hexStr2Bytes(ridEntity.getModul());
|
||||
// }
|
||||
// if (ridEntity.getExponent() != null && !ridEntity.getExponent().isEmpty()) {
|
||||
// capkV2.exponent = ByteUtil.hexStr2Bytes(ridEntity.getExponent());
|
||||
// }
|
||||
// if (ridEntity.getExpDate() != null && !ridEntity.getExpDate().isEmpty()) {
|
||||
// capkV2.expDate = ByteUtil.hexStr2Bytes(ridEntity.getExpDate());
|
||||
// }
|
||||
// if (ridEntity.getCheckSum() != null && !ridEntity.getCheckSum().isEmpty()) {
|
||||
// capkV2.checkSum = ByteUtil.hexStr2Bytes(ridEntity.getCheckSum());
|
||||
// }
|
||||
//
|
||||
// return capkV2;
|
||||
// }
|
||||
if (!(contactAid.getCvmLimit() < 0)) {
|
||||
aidV2.cvmLmt = ByteUtil.hexStr2Bytes(ParamHelper.getInstance().convertPaddedString(contactAid.getCvmLimit()));
|
||||
}
|
||||
|
||||
if (contactAid.getTransLimit() != null && !contactAid.getTransLimit().isEmpty()) {
|
||||
aidV2.termClssLmt = ByteUtil.hexStr2Bytes(contactAid.getTransLimit());
|
||||
}
|
||||
|
||||
if (contactAid.getFloorLimit() != null && !contactAid.getFloorLimit().isEmpty()) {
|
||||
aidV2.termOfflineFloorLmt = ByteUtil.hexStr2Bytes(contactAid.getFloorLimit());
|
||||
}
|
||||
|
||||
if (contactAid.getFloorLimit() != null && !contactAid.getFloorLimit().isEmpty()) {
|
||||
;
|
||||
aidV2.floorLimit = ByteUtil.hexStr2Bytes(contactAid.getFloorLimit().substring(4, 12));
|
||||
}
|
||||
|
||||
if (contactAid.getAid() != null && !contactAid.getAid().isEmpty()) {
|
||||
aidV2.aid = ByteUtil.hexStr2Bytes(contactAid.getAid());
|
||||
}
|
||||
|
||||
aidV2.selFlag = ByteUtil.hexStr2Byte("01");
|
||||
|
||||
/*
|
||||
* 00 - default - both
|
||||
* 01 - chip
|
||||
* 02 - contactless
|
||||
* */
|
||||
aidV2.paramType = ByteUtil.hexStr2Byte("01");
|
||||
|
||||
if (contactAid.getTargetPercent() != null && !contactAid.getTargetPercent().isEmpty()) {
|
||||
aidV2.targetPer = ByteUtil.hexStr2Byte(contactAid.getTargetPercent());
|
||||
}
|
||||
|
||||
if (contactAid.getMaxTargetPercent() != null && !contactAid.getMaxTargetPercent().isEmpty()) {
|
||||
aidV2.maxTargetPer = ByteUtil.hexStr2Byte(contactAid.getMaxTargetPercent());
|
||||
}
|
||||
|
||||
if (contactAid.getThreshold() != null && !contactAid.getThreshold().isEmpty()) {
|
||||
aidV2.threshold = ByteUtil.hexStr2Bytes(contactAid.getThreshold());
|
||||
}
|
||||
|
||||
if (contactAid.getTacDenial() != null && !contactAid.getTacDenial().isEmpty()) {
|
||||
aidV2.TACDenial = ByteUtil.hexStr2Bytes(contactAid.getTacDenial());
|
||||
}
|
||||
|
||||
if (contactAid.getTacOnline() != null && !contactAid.getTacOnline().isEmpty()) {
|
||||
aidV2.TACOnline = ByteUtil.hexStr2Bytes(contactAid.getTacOnline());
|
||||
}
|
||||
|
||||
if (contactAid.getTacDefault() != null && !contactAid.getTacDefault().isEmpty()) {
|
||||
aidV2.TACDefault = ByteUtil.hexStr2Bytes(contactAid.getTacDefault());
|
||||
}
|
||||
|
||||
if (contactAid.getEmvDDOL() != null && !contactAid.getEmvDDOL().isEmpty()) {
|
||||
aidV2.dDOL = ByteUtil.hexStr2Bytes(contactAid.getEmvDDOL());
|
||||
}
|
||||
if (contactAid.getApplicationVersion() != null && !contactAid.getApplicationVersion().isEmpty()) {
|
||||
aidV2.version = ByteUtil.hexStr2Bytes(contactAid.getApplicationVersion());
|
||||
}
|
||||
|
||||
if (contactAid.getRiskManageData() != null && !contactAid.getRiskManageData().isEmpty()) {
|
||||
aidV2.riskManData = ByteUtil.hexStr2Bytes(contactAid.getRiskManageData());
|
||||
}
|
||||
if (contactAid.getEmvTDOL() != null && !contactAid.getEmvTDOL().isEmpty()) {
|
||||
aidV2.tDOL = ByteUtil.hexStr2Bytes(contactAid.getEmvTDOL());
|
||||
}
|
||||
|
||||
if (contactAid.getCateCode() != null && !contactAid.getCateCode().isEmpty()) {
|
||||
aidV2.merchCateCode = ByteUtil.hexStr2Bytes(contactAid.getCateCode());
|
||||
}
|
||||
|
||||
if (contactAid.getCurrencyCode() != null && !contactAid.getCurrencyCode().isEmpty()) {
|
||||
aidV2.referCurrCode = ByteUtil.hexStr2Bytes(contactAid.getCurrencyCode());
|
||||
aidV2.referCurrCon = ByteUtil.hexStr2Bytes(contactAid.getCurrencyCode());
|
||||
aidV2.referCurrExp = ByteUtil.hexStr2Byte("02");
|
||||
}
|
||||
|
||||
return aidV2;
|
||||
}
|
||||
|
||||
private CapkV2 convertRid(RidEntity ridEntity) {
|
||||
CapkV2 capkV2 = new CapkV2();
|
||||
|
||||
if (ridEntity.getRid() != null && !ridEntity.getRid().isEmpty()) {
|
||||
capkV2.rid = ByteUtil.hexStr2Bytes(ridEntity.getRid());
|
||||
}
|
||||
if (ridEntity.getIndx() != null && !ridEntity.getIndx().isEmpty()) {
|
||||
capkV2.index = ByteUtil.hexStr2Byte(ridEntity.getIndx());
|
||||
}
|
||||
if (ridEntity.getHashInd() != null && !ridEntity.getHashInd().isEmpty()) {
|
||||
capkV2.hashInd = ByteUtil.hexStr2Byte(ridEntity.getHashInd());
|
||||
}
|
||||
if (ridEntity.getArithInd() != null && !ridEntity.getArithInd().isEmpty()) {
|
||||
capkV2.arithInd = ByteUtil.hexStr2Byte(ridEntity.getArithInd());
|
||||
}
|
||||
if (ridEntity.getModul() != null && !ridEntity.getModul().isEmpty()) {
|
||||
capkV2.modul = ByteUtil.hexStr2Bytes(ridEntity.getModul());
|
||||
}
|
||||
if (ridEntity.getExponent() != null && !ridEntity.getExponent().isEmpty()) {
|
||||
capkV2.exponent = ByteUtil.hexStr2Bytes(ridEntity.getExponent());
|
||||
}
|
||||
if (ridEntity.getExpDate() != null && !ridEntity.getExpDate().isEmpty()) {
|
||||
capkV2.expDate = ByteUtil.hexStr2Bytes(ridEntity.getExpDate());
|
||||
}
|
||||
if (ridEntity.getCheckSum() != null && !ridEntity.getCheckSum().isEmpty()) {
|
||||
capkV2.checkSum = ByteUtil.hexStr2Bytes(ridEntity.getCheckSum());
|
||||
}
|
||||
|
||||
return capkV2;
|
||||
}
|
||||
|
||||
private AidEntity convertContactlessAIDNex(ContactlessAid contactlessAid) {
|
||||
AidEntity aidV2 = new AidEntity();
|
||||
|
||||
@ -5,6 +5,8 @@ import android.content.Context;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nexgo.oaf.apiv3.emv.AidEntity;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.EmvTermParamV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.emv.EMVOptV2;
|
||||
import com.utsmyanmar.baselib.BaseApplication;
|
||||
import com.utsmyanmar.baselib.R;
|
||||
import com.utsmyanmar.baselib.db.model.BinEntity;
|
||||
@ -128,37 +130,37 @@ public class EmvParamOperation extends ParamOperation{
|
||||
loadAidRids();
|
||||
}
|
||||
|
||||
// private void initEmvTerminalParam() {
|
||||
// try {
|
||||
// EMVOptV2 emvOptV2 = BaseApplication.getInstance().mEMVOptV2;
|
||||
//
|
||||
// String currencyCode = SystemParamsOperation.getInstance().getCurrencyType().code;
|
||||
//
|
||||
// String terminalCapability = SystemParamsOperation.getInstance().getTerminalCapability();
|
||||
//
|
||||
// EmvTermParamV2 emvTermParam = new EmvTermParamV2();
|
||||
// emvTermParam.countryCode = "0104";
|
||||
//// emvTermParam.terminalType = "22";
|
||||
// emvTermParam.capability = terminalCapability;
|
||||
//// emvTermParam.capability = "E0E8C8"; //online / offline / signature/ no cvm
|
||||
//// emvTermParam.capability = "E0A8C8"; // offline / signature/ no cvm
|
||||
//// emvTermParam.addCapability = "F000F0A001";
|
||||
// emvTermParam.addCapability = "E000F0F001"; // updated on DEC 3 , 2024
|
||||
// emvTermParam.currencyCode = currencyCode;
|
||||
// emvTermParam.currencyExp = "00";
|
||||
// emvTermParam.bypassPin = true;
|
||||
// emvTermParam.scriptMode = true;
|
||||
//// emvTermParam.TTQ = "32004000";
|
||||
//// emvTermParam.TTQ = "34800000";
|
||||
//
|
||||
//
|
||||
// int result = emvOptV2.setTerminalParam(emvTermParam);
|
||||
// LogUtil.d(TAG, "setTerminalParam result:" + result);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// LogUtil.d(TAG, "setTerminalParam fail");
|
||||
// }
|
||||
// }
|
||||
private void initEmvTerminalParam() {
|
||||
try {
|
||||
EMVOptV2 emvOptV2 = BaseApplication.getInstance().mEMVOptV2;
|
||||
|
||||
String currencyCode = SystemParamsOperation.getInstance().getCurrencyType().code;
|
||||
|
||||
String terminalCapability = SystemParamsOperation.getInstance().getTerminalCapability();
|
||||
|
||||
EmvTermParamV2 emvTermParam = new EmvTermParamV2();
|
||||
emvTermParam.countryCode = "0104";
|
||||
// emvTermParam.terminalType = "22";
|
||||
emvTermParam.capability = terminalCapability;
|
||||
// emvTermParam.capability = "E0E8C8"; //online / offline / signature/ no cvm
|
||||
// emvTermParam.capability = "E0A8C8"; // offline / signature/ no cvm
|
||||
// emvTermParam.addCapability = "F000F0A001";
|
||||
emvTermParam.addCapability = "E000F0F001"; // updated on DEC 3 , 2024
|
||||
emvTermParam.currencyCode = currencyCode;
|
||||
emvTermParam.currencyExp = "00";
|
||||
emvTermParam.bypassPin = true;
|
||||
emvTermParam.scriptMode = true;
|
||||
// emvTermParam.TTQ = "32004000";
|
||||
// emvTermParam.TTQ = "34800000";
|
||||
|
||||
|
||||
int result = emvOptV2.setTerminalParam(emvTermParam);
|
||||
LogUtil.d(TAG, "setTerminalParam result:" + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.d(TAG, "setTerminalParam fail");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void updateChipCVM(String scheme,long cvmLimit) {
|
||||
@ -473,26 +475,26 @@ public class EmvParamOperation extends ParamOperation{
|
||||
|
||||
|
||||
|
||||
// public static void setTerminalParam(Map<String, String> map) {
|
||||
// try {
|
||||
// EMVOptV2 emvOptV2 = BaseApplication.getInstance().mEMVOptV2;
|
||||
//
|
||||
// EmvTermParamV2 emvTermParam = new EmvTermParamV2();
|
||||
// emvTermParam.countryCode = map.get("countryCode");
|
||||
// emvTermParam.capability = map.get("capability");
|
||||
// emvTermParam.addCapability = map.get("addCapability");
|
||||
// emvTermParam.currencyCode = map.get("5F2A");
|
||||
// emvTermParam.currencyExp = map.get("5F36");
|
||||
// emvTermParam.bypassPin = false;
|
||||
// emvTermParam.scriptMode = true;
|
||||
//
|
||||
// int result = emvOptV2.setTerminalParam(emvTermParam);
|
||||
// LogUtil.d(TAG, "setTerminalParam result:" + result);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// LogUtil.d(TAG, "setTerminalParam fail");
|
||||
// }
|
||||
// }
|
||||
public static void setTerminalParam(Map<String, String> map) {
|
||||
try {
|
||||
EMVOptV2 emvOptV2 = BaseApplication.getInstance().mEMVOptV2;
|
||||
|
||||
EmvTermParamV2 emvTermParam = new EmvTermParamV2();
|
||||
emvTermParam.countryCode = map.get("countryCode");
|
||||
emvTermParam.capability = map.get("capability");
|
||||
emvTermParam.addCapability = map.get("addCapability");
|
||||
emvTermParam.currencyCode = map.get("5F2A");
|
||||
emvTermParam.currencyExp = map.get("5F36");
|
||||
emvTermParam.bypassPin = false;
|
||||
emvTermParam.scriptMode = true;
|
||||
|
||||
int result = emvOptV2.setTerminalParam(emvTermParam);
|
||||
LogUtil.d(TAG, "setTerminalParam result:" + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.d(TAG, "setTerminalParam fail");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -35,7 +35,6 @@ import com.utsmyanmar.baselib.util.DelayCaller;
|
||||
import com.utsmyanmar.baselib.util.TerminalUtil;
|
||||
import com.utsmyanmar.baselib.util.TimeoutCallback;
|
||||
|
||||
import com.utsmyanmar.checkxread.sdk.NexGoSDK;
|
||||
import com.utsmyanmar.checkxread.sdk.SunmiSDK;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
|
||||
@ -119,7 +118,7 @@ public abstract class DataBindingActivity extends AppCompatActivity {
|
||||
|
||||
try {
|
||||
|
||||
while (NexGoSDK.getInstance().checkCardExist() == 2) {
|
||||
while (SunmiSDK.getInstance().checkCardExist() == 2) {
|
||||
emitter.onNext(true);
|
||||
}
|
||||
emitter.onComplete();
|
||||
@ -143,7 +142,7 @@ public abstract class DataBindingActivity extends AppCompatActivity {
|
||||
|
||||
dismissAnimationDialog();
|
||||
try {
|
||||
TerminalUtil.getInstance().makeBuzzer(1);
|
||||
BaseApplication.basicOptV2.buzzerOnDevice(1, 2000, 1000, 1000);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -62,7 +62,6 @@ import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
|
||||
public abstract class DataBindingFragment extends Fragment {
|
||||
@ -93,11 +92,11 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
|
||||
BackPressCallback backPressCallback;
|
||||
|
||||
protected abstract int currentId();
|
||||
protected abstract int currentId();
|
||||
protected abstract int hostId();
|
||||
protected abstract int routeId();
|
||||
|
||||
protected abstract int hostId();
|
||||
|
||||
protected abstract int routeId();
|
||||
|
||||
|
||||
@Override
|
||||
@ -130,6 +129,7 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void setBackPressCallback(BackPressCallback backPressCallback) {
|
||||
this.backPressCallback = backPressCallback;
|
||||
}
|
||||
@ -179,7 +179,7 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
}
|
||||
|
||||
protected void cancelTimeout() {
|
||||
if (countDownTimer != null) {
|
||||
if(countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
}
|
||||
|
||||
@ -188,26 +188,26 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
protected void isCardInserted(CardDetectCallback cardDetectCallback) {
|
||||
Observable<Boolean> alertObservable = Observable.create((ObservableOnSubscribe<Boolean>) emitter -> {
|
||||
|
||||
try {
|
||||
try {
|
||||
|
||||
int result = NexGoSDK.getInstance().checkCardExist();
|
||||
LogUtil.d(TAG, "check card exists result:" + result);
|
||||
while (result == -10107) {
|
||||
result = NexGoSDK.getInstance().checkCardExist();
|
||||
}
|
||||
int result = NexGoSDK.getInstance().checkCardExist();
|
||||
LogUtil.d(TAG,"check card exists result:"+result);
|
||||
while(result == -10107){
|
||||
result = NexGoSDK.getInstance().checkCardExist();
|
||||
}
|
||||
|
||||
while (NexGoSDK.getInstance().checkCardExist() == 2) {
|
||||
emitter.onNext(true);
|
||||
}
|
||||
while (NexGoSDK.getInstance().checkCardExist() == 2) {
|
||||
emitter.onNext(true);
|
||||
}
|
||||
|
||||
|
||||
// LogUtil.d("DATA BINDING FRAGMENT","Card exist status : "+SunmiSDK.getInstance().checkCardExist());
|
||||
emitter.onComplete();
|
||||
emitter.onComplete();
|
||||
|
||||
} catch (Exception e) {
|
||||
emitter.onError(e);
|
||||
}
|
||||
})
|
||||
} catch (Exception e) {
|
||||
emitter.onError(e);
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.throttleLast(2, TimeUnit.SECONDS);
|
||||
@ -244,14 +244,14 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
});
|
||||
}
|
||||
|
||||
protected void isCardTaped(String alertMsg, CardDetectCallback cardDetectCallback) {
|
||||
protected void isCardTaped(String alertMsg,CardDetectCallback cardDetectCallback) {
|
||||
Observable<Boolean> alertObservable = Observable.create((ObservableOnSubscribe<Boolean>) emitter -> {
|
||||
|
||||
try {
|
||||
|
||||
int result = NexGoSDK.getInstance().checkCardTap();
|
||||
|
||||
while (result == -10107) {
|
||||
while(result == -10107){
|
||||
result = NexGoSDK.getInstance().checkCardTap();
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
emitter.onNext(true);
|
||||
}
|
||||
|
||||
LogUtil.d(TAG, "Card exist status : " + NexGoSDK.getInstance().checkCardTap());
|
||||
LogUtil.d(TAG,"Card exist status : "+NexGoSDK.getInstance().checkCardTap());
|
||||
emitter.onComplete();
|
||||
|
||||
} catch (Exception e) {
|
||||
@ -298,14 +298,20 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
});
|
||||
}
|
||||
|
||||
protected void hideNavigationBar() {
|
||||
BaseApplication.getInstance().deviceEngine.getPlatform().hideNavigationBar();
|
||||
|
||||
protected void disableNavigationBar() {
|
||||
try {
|
||||
int result = BaseApplication.getInstance().basicOptBinder.setScreenMode(1);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void showNavigationBar() {
|
||||
BaseApplication.getInstance().deviceEngine.getPlatform().showNavigationBar();
|
||||
|
||||
protected void enableNavigationBar() {
|
||||
try {
|
||||
int result = BaseApplication.getInstance().basicOptBinder.setScreenMode(-1);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -355,6 +361,7 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void callBuzzer() {
|
||||
try {
|
||||
TerminalUtil.getInstance().makeBuzzer(3);
|
||||
@ -365,7 +372,7 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
|
||||
protected String getResourceString(int resId) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && isAdded()) {
|
||||
if(activity != null && isAdded()) {
|
||||
return activity.getString(resId);
|
||||
} else {
|
||||
return "";
|
||||
@ -376,9 +383,9 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
getNavController(hostId()).popBackStack();
|
||||
}
|
||||
|
||||
protected void safeNavigateToRouteId() {
|
||||
protected void safeNavigateToRouteId(){
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && isAdded()) {
|
||||
if(activity != null && isAdded()) {
|
||||
NavDestination currentDestination = getNavController(hostId()).getCurrentDestination();
|
||||
|
||||
if (currentDestination == null) {
|
||||
@ -394,7 +401,7 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
|
||||
protected void safeRouteTo(int currentRouteId, int destinationRouteId, int hostId) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && isAdded()) {
|
||||
if(activity != null && isAdded()) {
|
||||
NavDestination currentDestination = getNavController(hostId).getCurrentDestination();
|
||||
|
||||
if (currentDestination == null) {
|
||||
@ -411,7 +418,7 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
|
||||
protected void safePopBackStack() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && isAdded()) {
|
||||
if(activity != null && isAdded()) {
|
||||
NavDestination currentDestination = getNavController(hostId()).getCurrentDestination();
|
||||
|
||||
if (currentDestination == null) {
|
||||
@ -427,7 +434,7 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
|
||||
protected void safePopBack(int currentRouteId, int hostId) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && isAdded()) {
|
||||
if(activity != null && isAdded()) {
|
||||
NavDestination currentDestination = getNavController(hostId).getCurrentDestination();
|
||||
|
||||
if (currentDestination == null) {
|
||||
@ -444,7 +451,7 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
|
||||
protected void safeRouteToRemoveStack(int currentRouteId, int destinationRouteId, int hostId) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && isAdded()) {
|
||||
if(activity != null && isAdded()) {
|
||||
NavDestination currentDestination = getNavController(hostId).getCurrentDestination();
|
||||
|
||||
if (currentDestination == null) {
|
||||
@ -490,12 +497,14 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
handler.postDelayed(handlerMethod::onCall, 100);
|
||||
}
|
||||
|
||||
protected void delayFunctionCall(DelayCaller handlerMethod, long delayTime) {
|
||||
protected void delayFunctionCall(DelayCaller handlerMethod,long delayTime) {
|
||||
final Handler handler = new Handler(Looper.getMainLooper());
|
||||
handler.postDelayed(handlerMethod::onCall, delayTime);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected void dismissLoadingDialog() {
|
||||
Activity activity = getActivity();
|
||||
if (isAdded() && activity != null) {
|
||||
@ -526,9 +535,9 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
declineDialog.show();
|
||||
}
|
||||
|
||||
delayFunctionCall(() -> {
|
||||
delayFunctionCall(()-> {
|
||||
declineDialog.hide();
|
||||
}, 3000);
|
||||
},3000);
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -699,6 +708,7 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void showInfoDialog(String code, String msg) {
|
||||
@ -805,9 +815,9 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
successDialog.show();
|
||||
}
|
||||
|
||||
delayFunctionCall(() -> {
|
||||
delayFunctionCall(()-> {
|
||||
successDialog.hide();
|
||||
}, 3000);
|
||||
},3000);
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -827,9 +837,9 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
singleInfoDialog.show();
|
||||
}
|
||||
|
||||
delayFunctionCall(() -> {
|
||||
delayFunctionCall(()-> {
|
||||
singleInfoDialog.hide();
|
||||
}, 1500);
|
||||
},1500);
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -842,9 +852,9 @@ public abstract class DataBindingFragment extends Fragment {
|
||||
requireActivity().runOnUiThread(
|
||||
() -> {
|
||||
if (printerAlertDialog == null) {
|
||||
printerAlertDialog = new PrinterAlertDialog(getContext(), msg, dialogCallback);
|
||||
printerAlertDialog = new PrinterAlertDialog(getContext(), msg,dialogCallback);
|
||||
} else {
|
||||
printerAlertDialog.setMessage(msg, dialogCallback);
|
||||
printerAlertDialog.setMessage(msg,dialogCallback);
|
||||
}
|
||||
if (!printerAlertDialog.isShowing()) {
|
||||
printerAlertDialog.show();
|
||||
|
||||
@ -2,10 +2,15 @@ package com.utsmyanmar.baselib.util;
|
||||
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.nexgo.oaf.apiv3.device.beeper.Beeper;
|
||||
import com.sunmi.pay.hardware.aidlv2.system.BasicOptV2;
|
||||
import com.utsmyanmar.baselib.BaseApplication;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
|
||||
public class TerminalUtil {
|
||||
|
||||
@ -14,8 +19,7 @@ public class TerminalUtil {
|
||||
|
||||
private TerminalUtils terminalUtils;
|
||||
|
||||
private Beeper beeper;
|
||||
|
||||
BasicOptV2 basicOptV2;
|
||||
|
||||
public static TerminalUtil getInstance(){
|
||||
if(app == null){
|
||||
@ -27,15 +31,21 @@ public class TerminalUtil {
|
||||
|
||||
TerminalUtil(){
|
||||
|
||||
beeper = BaseApplication.getInstance().deviceEngine.getBeeper();
|
||||
basicOptV2 = BaseApplication.basicOptV2;
|
||||
terminalUtils = new TerminalUtilsImpl();
|
||||
}
|
||||
|
||||
public void makeBuzzer(int count) throws RemoteException {
|
||||
beeper.beep(Short.parseShort(String.valueOf(count*1000)));
|
||||
basicOptV2.buzzerOnDevice(count,7,3000,1000);
|
||||
}
|
||||
|
||||
public void shortBuzzer(int count) throws RemoteException {
|
||||
basicOptV2.buzzerOnDevice(1, 2750, 200, 0);
|
||||
}
|
||||
|
||||
public void makeBuzzerParam(int count,int frequency,int duration,int interval) throws RemoteException {
|
||||
basicOptV2.buzzerOnDevice(3,7,2000,1000);
|
||||
}
|
||||
|
||||
public String generateHashedString(String random) throws NoSuchAlgorithmException {
|
||||
return terminalUtils.generateHashString(random);
|
||||
|
||||
@ -1,13 +1,16 @@
|
||||
package com.utsmyanmar.baselib.util;
|
||||
|
||||
import com.sunmi.pay.hardware.aidlv2.system.BasicOptV2;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public interface TerminalUtils {
|
||||
|
||||
String generateHashString(String random) throws NoSuchAlgorithmException ;
|
||||
String generateHashString(String random,BasicOptV2 basicOptV2) throws NoSuchAlgorithmException;
|
||||
|
||||
String generateRandom();
|
||||
String getSerialNumber(BasicOptV2 basicOptV2);
|
||||
|
||||
String getSerialNumber();
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.utsmyanmar.baselib.util;
|
||||
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.sunmi.pay.hardware.aidlv2.system.BasicOptV2;
|
||||
import com.utsmyanmar.baselib.BaseApplication;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||
|
||||
@ -38,6 +40,20 @@ public class TerminalUtilsImpl implements TerminalUtils{
|
||||
return ByteUtil.bytes2HexStr(hash);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateHashString(String random,BasicOptV2 basicOptV2) throws NoSuchAlgorithmException {
|
||||
String sn = getSerialNumber(basicOptV2);
|
||||
String snPN = BaseApplication.getInstance().getPackageName();
|
||||
String nonce = random;
|
||||
String text = sn + snPN + nonce;
|
||||
// LogUtil.d(TAG,"Plain Text: "+text);
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
||||
byte[] hash = digest.digest(text.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
|
||||
return ByteUtil.bytes2HexStr(hash);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateRandom() {
|
||||
|
||||
@ -51,6 +67,21 @@ public class TerminalUtilsImpl implements TerminalUtils{
|
||||
// return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSerialNumber(BasicOptV2 basicOptV2){
|
||||
String data = "";
|
||||
try {
|
||||
// data = basicOptV2.getSysParam(getEncryptedFromNative());
|
||||
data = basicOptV2.getSysParam("SN");
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return data;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSerialNumber() {
|
||||
String data = "";
|
||||
|
||||
@ -37,6 +37,10 @@ import com.nexgo.oaf.apiv3.emv.OnEmvProcessListener2;
|
||||
import com.nexgo.oaf.apiv3.emv.PromptEnum;
|
||||
import com.nexgo.oaf.apiv3.emv.UnionPayTransDataEntity;
|
||||
import com.nexgo.oaf.apiv3.emv.VisaTransDataEntity;
|
||||
import com.sunmi.pay.hardware.aidl.bean.CardInfo;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.EMVCandidateV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.PinPadDataV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.pinpad.PinPadOptV2;
|
||||
import com.utsmyanmar.baselib.BaseApplication;
|
||||
import com.utsmyanmar.baselib.db.model.PayPassEntity;
|
||||
import com.utsmyanmar.baselib.emv.EmvParamOperation;
|
||||
@ -48,7 +52,6 @@ import com.utsmyanmar.baselib.util.enums.PinUtil;
|
||||
import com.utsmyanmar.baselib.util.rx_helper.ProcessSingleDataResult;
|
||||
import com.utsmyanmar.checkxread.util.CardTypeX;
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.model.BaseCardInfo;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.model.TradeData;
|
||||
import com.utsmyanmar.paylibs.model.enums.TransCVM;
|
||||
@ -90,6 +93,7 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
||||
public SingleLiveEvent<String> cardNum = new SingleLiveEvent<>();
|
||||
|
||||
public SingleLiveEvent<String> expDate = new SingleLiveEvent<>();
|
||||
public SingleLiveEvent<List<EMVCandidateV2>> emvList = new SingleLiveEvent<>();
|
||||
public SingleLiveEvent<String[]> candiList = new SingleLiveEvent<>();
|
||||
public SingleLiveEvent<PayDetail> payDetailResult = new SingleLiveEvent<>();
|
||||
public SingleLiveEvent<String> emvCardType = new SingleLiveEvent<>();
|
||||
@ -118,6 +122,7 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
||||
public PayDetail oldTransPayDetail;
|
||||
|
||||
// private EMVOptV2 mEMVOptV2;
|
||||
private PinPadOptV2 mPinPadOptV2;
|
||||
|
||||
protected EmvHandler2 emvHandler;
|
||||
|
||||
@ -408,6 +413,20 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
||||
initKeyboard(isOnlinePin == 1);
|
||||
}
|
||||
|
||||
private void setAntiExhaustiveProtection() {
|
||||
mPinPadOptV2 = BaseApplication.getInstance().mPinPadOptV2;
|
||||
try {
|
||||
int result = mPinPadOptV2.setAntiExhaustiveProtectionMode(3); //3
|
||||
if (result >= 0) {
|
||||
LogUtil.d(TAG, "Pin anti exhaustive result:" + result);
|
||||
} else {
|
||||
LogUtil.d(TAG, "Pin Anti Exhaustive failed");
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void initKeyboard(boolean isOnlinePin) {
|
||||
@ -931,7 +950,7 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
||||
addStartTime("getCardInfo()");
|
||||
String data = emvHandler.getTlvByTags(tagList);
|
||||
LogUtil.d(TAG, "getTlvByTags :" + data);
|
||||
BaseCardInfo cardInfo = KernelDataProcessUtil.getCardInfo(mPayDetail.cardType, ByteUtil.hexStr2Bytes(data));
|
||||
CardInfo cardInfo = KernelDataProcessUtil.getCardInfo(mPayDetail.cardType, ByteUtil.hexStr2Bytes(data));
|
||||
KernelDataProcessUtil.fillTradeDataInfo(cardInfo, mTradeData);
|
||||
cardNum.postValue(mPayDetail.getCardNo());
|
||||
expDate.postValue(mPayDetail.getEXPDate());
|
||||
|
||||
@ -1,3 +1,2 @@
|
||||
configurations.maybeCreate("default")
|
||||
artifacts.add("default", file('ecr-service-lib-1.1.11.aar'))
|
||||
//artifacts.add("default", file('Link_POS_Library_V1.9.aar'))
|
||||
artifacts.add("default", file('ecr-service-lib-1.1.11.aar'))
|
||||
@ -32,7 +32,7 @@ dependencies {
|
||||
// implementation files('../app/libs/PayLib-release-1.4.37.aar')
|
||||
|
||||
// implementation files('libs/PayLib-release-1.4.64.aar')
|
||||
// implementation project(path: ':paysdk-lib')
|
||||
implementation project(path: ':paysdk-lib')
|
||||
implementation project(path: ':nexsdk-lib')
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.utsmyanmar.checkxread;
|
||||
|
||||
import com.nexgo.oaf.apiv3.device.reader.CardSlotTypeEnum;
|
||||
import com.sunmi.pay.hardware.aidlv2.readcard.ReadCardOptV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.system.BasicOptV2;
|
||||
import com.utsmyanmar.checkxread.checkcard.CheckCardResultX;
|
||||
import com.utsmyanmar.checkxread.checkcard.CheckCardX;
|
||||
import com.utsmyanmar.checkxread.readcard.ReadCardResultX;
|
||||
@ -15,8 +17,8 @@ import java.util.HashSet;
|
||||
public class CheckXRead {
|
||||
|
||||
private static CheckXRead instance;
|
||||
// public static ReadCardOptV2 readCardOptV2;
|
||||
// public static BasicOptV2 basicOptV2;
|
||||
public static ReadCardOptV2 readCardOptV2;
|
||||
public static BasicOptV2 basicOptV2;
|
||||
|
||||
private CheckXRead(){
|
||||
|
||||
@ -35,7 +37,7 @@ public class CheckXRead {
|
||||
}
|
||||
|
||||
public void startCheckXProcess(int allType, int timer, CheckCardResultX checkCardResultX) {
|
||||
// CheckCardX.getInstance().startCheckProcess(allType,timer,checkCardResultX);
|
||||
CheckCardX.getInstance().startCheckProcess(allType,timer,checkCardResultX);
|
||||
}
|
||||
|
||||
public void startCheckXProcessNex(HashSet<CardSlotTypeEnum> allType, int timer, CheckCardResultX checkCardResultX) {
|
||||
@ -50,11 +52,11 @@ public class CheckXRead {
|
||||
sdkFeatures.buzzSound();
|
||||
}
|
||||
|
||||
// public void makeDoubleBuzzSound() {
|
||||
// SunmiSDK.getInstance().doubleBuzzSound();
|
||||
// }
|
||||
public void makeDoubleBuzzSound() {
|
||||
SunmiSDK.getInstance().doubleBuzzSound();
|
||||
}
|
||||
|
||||
// public void initSDKService(ReadCardOptV2 readCardOptV2,BasicOptV2 basicOptV2){
|
||||
// SunmiSDK.getInstance().initSDK(readCardOptV2,basicOptV2);
|
||||
// }
|
||||
public void initSDKService(ReadCardOptV2 readCardOptV2,BasicOptV2 basicOptV2){
|
||||
SunmiSDK.getInstance().initSDK(readCardOptV2,basicOptV2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,14 +10,14 @@ import com.nexgo.oaf.apiv3.SdkResult;
|
||||
import com.nexgo.oaf.apiv3.device.reader.CardInfoEntity;
|
||||
import com.nexgo.oaf.apiv3.device.reader.CardSlotTypeEnum;
|
||||
import com.nexgo.oaf.apiv3.device.reader.OnCardInfoListener;
|
||||
//import com.sunmi.pay.hardware.aidlv2.readcard.CheckCardCallbackV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.readcard.CheckCardCallbackV2;
|
||||
import com.utsmyanmar.checkxread.readcard.MAGXReadCard;
|
||||
import com.utsmyanmar.checkxread.sdk.NexGoSDK;
|
||||
import com.utsmyanmar.checkxread.sdk.SunmiSDK;
|
||||
import com.utsmyanmar.checkxread.util.CardTypeX;
|
||||
import com.utsmyanmar.checkxread.CheckXRead;
|
||||
import com.utsmyanmar.checkxread.readcard.MPUXReadCard;
|
||||
//import com.utsmyanmar.checkxread.util.CheckCardCallbackV2Wrapper;
|
||||
import com.utsmyanmar.checkxread.util.CheckCardCallbackV2Wrapper;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@ -41,15 +41,15 @@ public class CheckCardX {
|
||||
return instance;
|
||||
}
|
||||
|
||||
// public void startCheckProcess(int allType,int timer,CheckCardResultX checkCardResultX) {
|
||||
// this.checkCardResultX = checkCardResultX;
|
||||
//
|
||||
// try {
|
||||
// SunmiSDK.getInstance().readCardOptV2.checkCard(allType,checkCardCallBack,timer);
|
||||
// } catch (RemoteException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
public void startCheckProcess(int allType,int timer,CheckCardResultX checkCardResultX) {
|
||||
this.checkCardResultX = checkCardResultX;
|
||||
|
||||
try {
|
||||
SunmiSDK.getInstance().readCardOptV2.checkCard(allType,checkCardCallBack,timer);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void startCheckProcessNex(HashSet<CardSlotTypeEnum> allType, int timer, CheckCardResultX checkCardResultX) {
|
||||
this.checkCardResultX = checkCardResultX;
|
||||
@ -127,14 +127,71 @@ public class CheckCardX {
|
||||
};
|
||||
|
||||
|
||||
// private final CheckCardCallbackV2 checkCardCallBack = new CheckCardCallbackV2Wrapper() {
|
||||
//
|
||||
private final CheckCardCallbackV2 checkCardCallBack = new CheckCardCallbackV2Wrapper() {
|
||||
|
||||
@Override
|
||||
public void findICCard(String atr) throws RemoteException {
|
||||
super.findICCard(atr);
|
||||
|
||||
CheckXRead.getInstance().makeBuzzSound(SunmiSDK.getInstance());
|
||||
|
||||
MPUXReadCard.getInstance().isMPUCard(SunmiSDK.getInstance(),new CheckMPUX() {
|
||||
@Override
|
||||
public void onDetectMPU() {
|
||||
mainThreadHandler.post(()->{
|
||||
checkCardResultX.onSuccess(CardTypeX.IC,true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetectOther() {
|
||||
mainThreadHandler.post(()->{
|
||||
checkCardResultX.onSuccess(CardTypeX.IC,false);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetectError(int code, String msg) {
|
||||
mainThreadHandler.post(()->{
|
||||
checkCardResultX.onError(code,msg);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Log.d(TAG, "Find IC");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findMagCard(Bundle info) throws RemoteException {
|
||||
super.findMagCard(info);
|
||||
|
||||
MAGXReadCard.getInstance().setBundle(info);
|
||||
CheckXRead.getInstance().makeBuzzSound(SunmiSDK.getInstance());
|
||||
|
||||
mainThreadHandler.post(()->{
|
||||
checkCardResultX.onSuccess(CardTypeX.MAG,false);
|
||||
});
|
||||
Log.d(TAG, "Find MAG");
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void findICCard(String atr) throws RemoteException {
|
||||
// super.findICCard(atr);
|
||||
// public void findRFCardEx(Bundle info) throws RemoteException {
|
||||
// super.findRFCardEx(info);
|
||||
//
|
||||
// int cardType = info.getInt("cardType");
|
||||
// String uuid = info.getString("uuid");
|
||||
// String ats = info.getString("ats");
|
||||
// int category = info.getInt("cardCategory");
|
||||
// byte[] atqa = info.getByteArray("atqa");
|
||||
//
|
||||
// CheckXRead.getInstance().makeBuzzSound(SunmiSDK.getInstance());
|
||||
//
|
||||
// Log.d("TAG", "cardType: "+cardType);
|
||||
// Log.d("TAG", "uuid: "+uuid);
|
||||
// Log.d("TAG", "ats: "+ats);
|
||||
// Log.d("TAG", "category: "+category);
|
||||
// Log.d("TAG", "atqa: "+ ByteUtil.bytes2HexStr(atqa));
|
||||
//
|
||||
// MPUXReadCard.getInstance().isMPUCard(SunmiSDK.getInstance(),new CheckMPUX() {
|
||||
// @Override
|
||||
// public void onDetectMPU() {
|
||||
@ -157,52 +214,37 @@ public class CheckCardX {
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// Log.d(TAG, "Find IC");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void findMagCard(Bundle info) throws RemoteException {
|
||||
// super.findMagCard(info);
|
||||
//
|
||||
// MAGXReadCard.getInstance().setBundle(info);
|
||||
// CheckXRead.getInstance().makeBuzzSound(SunmiSDK.getInstance());
|
||||
//
|
||||
// mainThreadHandler.post(()->{
|
||||
// checkCardResultX.onSuccess(CardTypeX.MAG,false);
|
||||
// });
|
||||
// Log.d(TAG, "Find MAG");
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public void findRFCard(String uuid) throws RemoteException {
|
||||
// super.findRFCard(uuid);
|
||||
//
|
||||
// CheckXRead.getInstance().makeBuzzSound(SunmiSDK.getInstance());
|
||||
// mainThreadHandler.post(()->{
|
||||
// checkCardResultX.onSuccess(CardTypeX.NFC,false);
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(int code, String message) throws RemoteException {
|
||||
// super.onError(code, message);
|
||||
//
|
||||
//// CheckXRead.getInstance().makeDoubleBuzzSound();
|
||||
//
|
||||
// if(code == -2801) {
|
||||
// mainThreadHandler.post(()->{
|
||||
// checkCardResultX.onCommError();
|
||||
// });
|
||||
// } else {
|
||||
// mainThreadHandler.post(()->{
|
||||
// checkCardResultX.onError(code,message);
|
||||
// });
|
||||
// }
|
||||
// Log.e(TAG, "On Error " + code + ":" + message);
|
||||
//
|
||||
// }
|
||||
// };
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void findRFCard(String uuid) throws RemoteException {
|
||||
super.findRFCard(uuid);
|
||||
|
||||
CheckXRead.getInstance().makeBuzzSound(SunmiSDK.getInstance());
|
||||
mainThreadHandler.post(()->{
|
||||
checkCardResultX.onSuccess(CardTypeX.NFC,false);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String message) throws RemoteException {
|
||||
super.onError(code, message);
|
||||
|
||||
// CheckXRead.getInstance().makeDoubleBuzzSound();
|
||||
|
||||
if(code == -2801) {
|
||||
mainThreadHandler.post(()->{
|
||||
checkCardResultX.onCommError();
|
||||
});
|
||||
} else {
|
||||
mainThreadHandler.post(()->{
|
||||
checkCardResultX.onError(code,message);
|
||||
});
|
||||
}
|
||||
Log.e(TAG, "On Error " + code + ":" + message);
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.utsmyanmar.checkxread.model;
|
||||
|
||||
import com.nexgo.oaf.apiv3.card.cpu.APDUEntity;
|
||||
//import com.sunmi.pay.hardware.aidlv2.bean.ApduSendV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.ApduSendV2;
|
||||
|
||||
public class APDUXRequest {
|
||||
|
||||
@ -20,15 +20,15 @@ public class APDUXRequest {
|
||||
this.data = data;
|
||||
this.le = le;
|
||||
}
|
||||
//
|
||||
// public ApduSendV2 convertForSUNMI() {
|
||||
// ApduSendV2 send = new ApduSendV2();
|
||||
// send.command = this.command;
|
||||
// send.lc = this.lc;
|
||||
// send.dataIn = this.data;
|
||||
// send.le = this.le;
|
||||
// return send;
|
||||
// }
|
||||
|
||||
public ApduSendV2 convertForSUNMI() {
|
||||
ApduSendV2 send = new ApduSendV2();
|
||||
send.command = this.command;
|
||||
send.lc = this.lc;
|
||||
send.dataIn = this.data;
|
||||
send.le = this.le;
|
||||
return send;
|
||||
}
|
||||
|
||||
public APDUEntity convertForNexGo() {
|
||||
APDUEntity apduEntity = new APDUEntity();
|
||||
|
||||
@ -1,23 +1,23 @@
|
||||
package com.utsmyanmar.checkxread.sdk;
|
||||
|
||||
import android.os.RemoteException;
|
||||
//
|
||||
//import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||
//import com.sunmi.pay.hardware.aidlv2.bean.ApduRecvV2;
|
||||
//import com.sunmi.pay.hardware.aidlv2.bean.ApduSendV2;
|
||||
//import com.sunmi.pay.hardware.aidlv2.readcard.ReadCardOptV2;
|
||||
//import com.sunmi.pay.hardware.aidlv2.system.BasicOptV2;
|
||||
|
||||
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.ApduRecvV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.ApduSendV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.readcard.ReadCardOptV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.system.BasicOptV2;
|
||||
import com.utsmyanmar.checkxread.model.APDUXRequest;
|
||||
import com.utsmyanmar.checkxread.model.APDUXResponse;
|
||||
import com.utsmyanmar.checkxread.util.CardTypeX;
|
||||
|
||||
public class SunmiSDK {
|
||||
public class SunmiSDK implements SDKFeatures{
|
||||
|
||||
private static SunmiSDK instance;
|
||||
|
||||
// public ReadCardOptV2 readCardOptV2;
|
||||
//
|
||||
// public BasicOptV2 basicOptV2;
|
||||
public ReadCardOptV2 readCardOptV2;
|
||||
|
||||
public BasicOptV2 basicOptV2;
|
||||
|
||||
public static SunmiSDK getInstance() {
|
||||
if(instance == null) {
|
||||
@ -28,84 +28,84 @@ public class SunmiSDK {
|
||||
|
||||
|
||||
|
||||
// public void initSDK(ReadCardOptV2 readCardOptV2,BasicOptV2 basicOptV2) {
|
||||
// this.readCardOptV2 = readCardOptV2;
|
||||
// this.basicOptV2 = basicOptV2;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public int sendAPDU(APDUXRequest apduxRequest, APDUXResponse apduxResponse) {
|
||||
// ApduRecvV2 recv = new ApduRecvV2();
|
||||
// ApduSendV2 send = apduxRequest.convertForSUNMI();
|
||||
//
|
||||
// try {
|
||||
// int result = readCardOptV2.apduCommand(CardTypeX.IC.value, send, recv);
|
||||
// apduxResponse.setData(recv.outData);
|
||||
// apduxResponse.setSwa(recv.swa);
|
||||
// apduxResponse.setSwb(recv.swb);
|
||||
// apduxResponse.setDataLen(recv.outlen);
|
||||
// return result;
|
||||
//
|
||||
// } catch (RemoteException e) {
|
||||
// e.printStackTrace();
|
||||
// return -1;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void buzzSound() {
|
||||
// try {
|
||||
// basicOptV2.buzzerOnDevice(1, 2750, 200, 0);
|
||||
// } catch (RemoteException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void doubleBuzzSound() {
|
||||
// try {
|
||||
// basicOptV2.buzzerOnDevice(2, 2750, 200, 0);
|
||||
// } catch (RemoteException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void cancelCheckCard() {
|
||||
// try {
|
||||
// readCardOptV2.cancelCheckCard();
|
||||
// } catch (RemoteException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int checkCardExist() {
|
||||
// int result = 0;
|
||||
// try {
|
||||
// result = readCardOptV2.getCardExistStatus(2);
|
||||
// } catch (RemoteException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int checkCardTap() {
|
||||
// int result = 0;
|
||||
// try {
|
||||
// result = readCardOptV2.getCardExistStatus(AidlConstants.CardType.NFC.getValue());
|
||||
// } catch (RemoteException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void closeReader() {
|
||||
//
|
||||
// }
|
||||
public void initSDK(ReadCardOptV2 readCardOptV2,BasicOptV2 basicOptV2) {
|
||||
this.readCardOptV2 = readCardOptV2;
|
||||
this.basicOptV2 = basicOptV2;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int sendAPDU(APDUXRequest apduxRequest, APDUXResponse apduxResponse) {
|
||||
ApduRecvV2 recv = new ApduRecvV2();
|
||||
ApduSendV2 send = apduxRequest.convertForSUNMI();
|
||||
|
||||
try {
|
||||
int result = readCardOptV2.apduCommand(CardTypeX.IC.value, send, recv);
|
||||
apduxResponse.setData(recv.outData);
|
||||
apduxResponse.setSwa(recv.swa);
|
||||
apduxResponse.setSwb(recv.swb);
|
||||
apduxResponse.setDataLen(recv.outlen);
|
||||
return result;
|
||||
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buzzSound() {
|
||||
try {
|
||||
basicOptV2.buzzerOnDevice(1, 2750, 200, 0);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doubleBuzzSound() {
|
||||
try {
|
||||
basicOptV2.buzzerOnDevice(2, 2750, 200, 0);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelCheckCard() {
|
||||
try {
|
||||
readCardOptV2.cancelCheckCard();
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkCardExist() {
|
||||
int result = 0;
|
||||
try {
|
||||
result = readCardOptV2.getCardExistStatus(2);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkCardTap() {
|
||||
int result = 0;
|
||||
try {
|
||||
result = readCardOptV2.getCardExistStatus(AidlConstants.CardType.NFC.getValue());
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeReader() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.utsmyanmar.checkxread.util;
|
||||
|
||||
//import com.sunmi.pay.hardware.aidlv2.bean.ApduSendV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.ApduSendV2;
|
||||
import com.utsmyanmar.checkxread.model.APDUXRequest;
|
||||
|
||||
public class APDUHelper {
|
||||
@ -42,23 +42,23 @@ public class APDUHelper {
|
||||
return send;
|
||||
}
|
||||
|
||||
// public ApduSendV2 buildMPUTrackCommand(int id) {
|
||||
// String command = "";
|
||||
// switch (id) {
|
||||
// case 1 :
|
||||
// command = Constants.TRACK1_COMMAND;
|
||||
// break;
|
||||
// case 2:
|
||||
// command = Constants.TRACK2_COMMAND;
|
||||
// break;
|
||||
// case 3:
|
||||
// command = Constants.TRACK3_COMMAND;
|
||||
// break;
|
||||
// }
|
||||
// ApduSendV2 send = new ApduSendV2();
|
||||
// send.command = ByteUtil.hexStr2Bytes(command);
|
||||
// send.le = Short.parseShort(Constants.TRACK_LE, 16);
|
||||
//
|
||||
// return send;
|
||||
// }
|
||||
public ApduSendV2 buildMPUTrackCommand(int id) {
|
||||
String command = "";
|
||||
switch (id) {
|
||||
case 1 :
|
||||
command = Constants.TRACK1_COMMAND;
|
||||
break;
|
||||
case 2:
|
||||
command = Constants.TRACK2_COMMAND;
|
||||
break;
|
||||
case 3:
|
||||
command = Constants.TRACK3_COMMAND;
|
||||
break;
|
||||
}
|
||||
ApduSendV2 send = new ApduSendV2();
|
||||
send.command = ByteUtil.hexStr2Bytes(command);
|
||||
send.le = Short.parseShort(Constants.TRACK_LE, 16);
|
||||
|
||||
return send;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
package com.utsmyanmar.checkxread.util;
|
||||
|
||||
public class BaseCardInfo {
|
||||
|
||||
public int cardType;
|
||||
public String cardNo;
|
||||
public String track1;
|
||||
public String track2;
|
||||
public String track3;
|
||||
public String expireDate;
|
||||
public String serviceCode;
|
||||
public String countryCode;
|
||||
public boolean isCardSerialNo;
|
||||
public String cardSerialNo;
|
||||
public String uuid;
|
||||
public String atr;
|
||||
|
||||
|
||||
public BaseCardInfo() {
|
||||
|
||||
}
|
||||
public BaseCardInfo(int cardType, String cardNo, String track1, String track2, String track3, String expireDate, String serviceCode, String countryCode, boolean isCardSerialNo, String cardSerialNo, String uuid, String atr) {
|
||||
this.cardType = cardType;
|
||||
this.cardNo = cardNo;
|
||||
this.track1 = track1;
|
||||
this.track2 = track2;
|
||||
this.track3 = track3;
|
||||
this.expireDate = expireDate;
|
||||
this.serviceCode = serviceCode;
|
||||
this.countryCode = countryCode;
|
||||
this.isCardSerialNo = isCardSerialNo;
|
||||
this.cardSerialNo = cardSerialNo;
|
||||
this.uuid = uuid;
|
||||
this.atr = atr;
|
||||
}
|
||||
}
|
||||
@ -1,43 +1,43 @@
|
||||
package com.utsmyanmar.checkxread.util;
|
||||
|
||||
import android.os.Bundle;
|
||||
//import android.os.RemoteException;
|
||||
import android.os.RemoteException;
|
||||
|
||||
//import com.sunmi.pay.hardware.aidlv2.readcard.CheckCardCallbackV2;
|
||||
//
|
||||
//public class CheckCardCallbackV2Wrapper extends CheckCardCallbackV2.Stub {
|
||||
// @Override
|
||||
// public void findMagCard(Bundle info) throws RemoteException {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void findICCard(String atr) throws RemoteException {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void findRFCard(String uuid) throws RemoteException {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(int code, String message) throws RemoteException {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void findICCardEx(Bundle info) throws RemoteException {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void findRFCardEx(Bundle info) throws RemoteException {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onErrorEx(Bundle info) throws RemoteException {
|
||||
//
|
||||
// }
|
||||
//}
|
||||
import com.sunmi.pay.hardware.aidlv2.readcard.CheckCardCallbackV2;
|
||||
|
||||
public class CheckCardCallbackV2Wrapper extends CheckCardCallbackV2.Stub {
|
||||
@Override
|
||||
public void findMagCard(Bundle info) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findICCard(String atr) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findRFCard(String uuid) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String message) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findICCardEx(Bundle info) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findRFCardEx(Bundle info) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onErrorEx(Bundle info) throws RemoteException {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ package com.utsmyanmar.checkxread.util;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
//import com.sunmi.pay.hardware.aidl.bean.CardInfo;
|
||||
import com.sunmi.pay.hardware.aidl.bean.CardInfo;
|
||||
import com.utsmyanmar.checkxread.model.CardDataX;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
@ -12,17 +12,17 @@ public class Track2Util {
|
||||
|
||||
private static String TAG = Track2Util.class.getSimpleName();
|
||||
|
||||
public static BaseCardInfo parseTrack2(String track2) {
|
||||
public static com.sunmi.pay.hardware.aidl.bean.CardInfo parseTrack2(String track2) {
|
||||
Log.d(TAG, "track2:" + track2);
|
||||
if (track2 == null || track2.trim().length() < 13) {
|
||||
return new BaseCardInfo();
|
||||
return new com.sunmi.pay.hardware.aidl.bean.CardInfo();
|
||||
}
|
||||
track2 = stringFilter(track2);
|
||||
int index = track2.indexOf("=");
|
||||
if (index == -1) {
|
||||
index = track2.indexOf("D");
|
||||
}
|
||||
BaseCardInfo cardInfo = new BaseCardInfo();
|
||||
com.sunmi.pay.hardware.aidl.bean.CardInfo cardInfo = new CardInfo();
|
||||
if (index == -1) {
|
||||
return cardInfo;
|
||||
}
|
||||
@ -56,7 +56,7 @@ public class Track2Util {
|
||||
if (index == -1) {
|
||||
index = track2.indexOf("D");
|
||||
}
|
||||
BaseCardInfo cardInfo = new BaseCardInfo();
|
||||
com.sunmi.pay.hardware.aidl.bean.CardInfo cardInfo = new CardInfo();
|
||||
if (index == -1) {
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ dependencies {
|
||||
//paySDK
|
||||
// implementation project(path:':PayLib-release-1.4.58')
|
||||
implementation project(path: ':nexsdk-lib')
|
||||
// implementation project(path: ':paysdk-lib')
|
||||
implementation project(path: ':paysdk-lib')
|
||||
implementation project(path: ':nexdlkey-lib')
|
||||
// implementation project(path: ':sunmiui-lib')
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package com.utsmyanmar.paylibs;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.nexgo.oaf.apiv3.DeviceEngine;
|
||||
|
||||
public class PayLibNex {
|
||||
@ -9,9 +7,6 @@ public class PayLibNex {
|
||||
private static PayLibNex instance;
|
||||
|
||||
public DeviceEngine deviceEngine;
|
||||
|
||||
public Context context;
|
||||
|
||||
public static PayLibNex getInstance() {
|
||||
if(instance == null) {
|
||||
instance = new PayLibNex();
|
||||
@ -19,11 +14,7 @@ public class PayLibNex {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void initContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void initSDK(DeviceEngine deviceEngine) {
|
||||
public void initDeviceEngine(DeviceEngine deviceEngine) {
|
||||
this.deviceEngine = deviceEngine;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
package com.utsmyanmar.paylibs;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.sunmi.pay.hardware.aidl.security.SecurityOpt;
|
||||
import com.sunmi.pay.hardware.aidlv2.emv.EMVOptV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.readcard.ReadCardOptV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.security.SecurityOptV2;
|
||||
import com.sunmi.peripheral.printer.SunmiPrinterService;
|
||||
|
||||
public class PayLibsUtils {
|
||||
|
||||
private static PayLibsUtils instance;
|
||||
|
||||
public Context context;
|
||||
|
||||
public SunmiPrinterService sunmiPrinterService;
|
||||
|
||||
public SecurityOptV2 securityOptV2;
|
||||
|
||||
public EMVOptV2 emvOptV2;
|
||||
|
||||
public SecurityOpt securityOpt;
|
||||
|
||||
public ReadCardOptV2 readCardOptV2;
|
||||
|
||||
private PayLibsUtils(){}
|
||||
|
||||
public static PayLibsUtils getInstance(){
|
||||
if (instance == null) {
|
||||
instance = new PayLibsUtils();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void initLib(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void initLib(SunmiPrinterService sunmiPrinterService){
|
||||
this.sunmiPrinterService = sunmiPrinterService;
|
||||
}
|
||||
|
||||
public void initLib(SecurityOptV2 securityOptV2, EMVOptV2 emvOptV2, SecurityOpt securityOpt, ReadCardOptV2 readCardOptV2) {
|
||||
this.securityOptV2 = securityOptV2;
|
||||
this.emvOptV2 = emvOptV2;
|
||||
this.securityOpt = securityOpt;
|
||||
this.readCardOptV2 = readCardOptV2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,5 +1,12 @@
|
||||
package com.utsmyanmar.paylibs.emv;
|
||||
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.ApduRecvV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.ApduSendV2;
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||
|
||||
public class EmvProcess {
|
||||
|
||||
|
||||
@ -13,46 +20,46 @@ public class EmvProcess {
|
||||
return instance;
|
||||
}
|
||||
|
||||
// private ApduSendV2 getSendV2(String command,String dataIn,String lc,String le) {
|
||||
// ApduSendV2 send = new ApduSendV2();
|
||||
//
|
||||
// send.command = ByteUtil.hexStr2Bytes(command);
|
||||
// send.lc = Short.parseShort(lc, 16);
|
||||
// send.dataIn = ByteUtil.hexStr2Bytes(dataIn);
|
||||
// send.le = Short.parseShort(le, 16);
|
||||
//
|
||||
// return send;
|
||||
// }
|
||||
//
|
||||
// public EmvProcessResult selectFile(int cardType) throws RemoteException {
|
||||
// String cla = "00";
|
||||
// String ins = "A4";
|
||||
// String p1 = "04";
|
||||
// String p2 = "00";
|
||||
//
|
||||
// String lc = "0E";
|
||||
// String dataIn = "325041592E5359532E4444463031";
|
||||
// String le = "00";
|
||||
// String command = cla + ins + p1 + p2;
|
||||
//
|
||||
// ApduSendV2 sendV2 = getSendV2(command,dataIn,lc,le);
|
||||
// ApduRecvV2 recvV2 = new ApduRecvV2();
|
||||
//
|
||||
//
|
||||
// int result = PayLibsUtils.getInstance().readCardOptV2.apduCommand(cardType,sendV2,recvV2);
|
||||
//
|
||||
// if(result < 0) {
|
||||
// EmvProcessResult.FAILURE.value = String.valueOf(result);
|
||||
//
|
||||
// return EmvProcessResult.FAILURE;
|
||||
// } else {
|
||||
// EmvProcessResult.OK.value = ByteUtil.bytes2HexStr(recvV2.outData);
|
||||
//
|
||||
// return EmvProcessResult.OK;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// }
|
||||
private ApduSendV2 getSendV2(String command,String dataIn,String lc,String le) {
|
||||
ApduSendV2 send = new ApduSendV2();
|
||||
|
||||
send.command = ByteUtil.hexStr2Bytes(command);
|
||||
send.lc = Short.parseShort(lc, 16);
|
||||
send.dataIn = ByteUtil.hexStr2Bytes(dataIn);
|
||||
send.le = Short.parseShort(le, 16);
|
||||
|
||||
return send;
|
||||
}
|
||||
|
||||
public EmvProcessResult selectFile(int cardType) throws RemoteException {
|
||||
String cla = "00";
|
||||
String ins = "A4";
|
||||
String p1 = "04";
|
||||
String p2 = "00";
|
||||
|
||||
String lc = "0E";
|
||||
String dataIn = "325041592E5359532E4444463031";
|
||||
String le = "00";
|
||||
String command = cla + ins + p1 + p2;
|
||||
|
||||
ApduSendV2 sendV2 = getSendV2(command,dataIn,lc,le);
|
||||
ApduRecvV2 recvV2 = new ApduRecvV2();
|
||||
|
||||
|
||||
int result = PayLibsUtils.getInstance().readCardOptV2.apduCommand(cardType,sendV2,recvV2);
|
||||
|
||||
if(result < 0) {
|
||||
EmvProcessResult.FAILURE.value = String.valueOf(result);
|
||||
|
||||
return EmvProcessResult.FAILURE;
|
||||
} else {
|
||||
EmvProcessResult.OK.value = ByteUtil.bytes2HexStr(recvV2.outData);
|
||||
|
||||
return EmvProcessResult.OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.utsmyanmar.paylibs.model;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import com.sunmi.pay.hardware.aidlv2.bean.AidV2;
|
||||
import com.utsmyanmar.paylibs.utils.TLV;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.TLVUtil;
|
||||
@ -185,109 +186,109 @@ public class AidConfig {
|
||||
this.selFlag = selFlag;
|
||||
}
|
||||
|
||||
// public AidV2 loadAid() {
|
||||
// AidV2 aidV2 = new AidV2();
|
||||
//
|
||||
// if (ctsCvmLimit != null && !ctsCvmLimit.isEmpty()) {
|
||||
// aidV2.cvmLmt = ByteUtil.hexStr2Bytes(ctsCvmLimit);
|
||||
// }
|
||||
//
|
||||
// if (ctsTransLimit != null && !ctsTransLimit.isEmpty() ) {
|
||||
// aidV2.termClssLmt = ByteUtil.hexStr2Bytes(ctsTransLimit);
|
||||
// }
|
||||
//
|
||||
// if (termCtsOfflineFloorLmt != null && !termCtsOfflineFloorLmt.isEmpty() ) {
|
||||
// aidV2.termClssOfflineFloorLmt = ByteUtil.hexStr2Bytes(termCtsOfflineFloorLmt);
|
||||
// }
|
||||
//
|
||||
// if (termOfflineFloorLmt != null && !termOfflineFloorLmt.isEmpty() ) {
|
||||
// aidV2.termOfflineFloorLmt = ByteUtil.hexStr2Bytes(termOfflineFloorLmt);
|
||||
// }
|
||||
//
|
||||
// if (aid != null && !aid.isEmpty() ) {
|
||||
// aidV2.aid = ByteUtil.hexStr2Bytes(aid);
|
||||
// }
|
||||
// if (selFlag != null && !selFlag.isEmpty() ) {
|
||||
// aidV2.selFlag = ByteUtil.hexStr2Byte(selFlag);
|
||||
// }
|
||||
//
|
||||
// if (targetPercent != null && !targetPercent.isEmpty() ) {
|
||||
// aidV2.targetPer = ByteUtil.hexStr2Byte(targetPercent);
|
||||
// }
|
||||
// if (maxTargetPercent != null && !maxTargetPercent.isEmpty() ) {
|
||||
// aidV2.maxTargetPer = ByteUtil.hexStr2Byte(maxTargetPercent);
|
||||
// }
|
||||
// if (floorLimit != null && !floorLimit.isEmpty() ) {
|
||||
// aidV2.floorLimit = ByteUtil.hexStr2Bytes(floorLimit);
|
||||
// }
|
||||
//
|
||||
// if (threshold != null && !threshold.isEmpty() ) {
|
||||
// aidV2.threshold = ByteUtil.hexStr2Bytes(threshold);
|
||||
// }
|
||||
//
|
||||
// if (tacDenial != null && !tacDenial.isEmpty() ) {
|
||||
// aidV2.TACDenial = ByteUtil.hexStr2Bytes(tacDenial);
|
||||
// }
|
||||
// if (tacOnline != null && !tacOnline.isEmpty() ) {
|
||||
// aidV2.TACOnline = ByteUtil.hexStr2Bytes(tacOnline);
|
||||
// }
|
||||
//
|
||||
// if (tacDefault != null && !tacDefault.isEmpty() ) {
|
||||
// aidV2.TACDefault = ByteUtil.hexStr2Bytes(tacDefault);
|
||||
// }
|
||||
// if (acquirerId != null && !acquirerId.isEmpty() ) {
|
||||
// aidV2.AcquierId = ByteUtil.hexStr2Bytes(acquirerId);
|
||||
// }
|
||||
// if (dDol != null && !dDol.isEmpty() ) {
|
||||
// aidV2.dDOL = ByteUtil.hexStr2Bytes(dDol);
|
||||
// }
|
||||
// if (applicationVersion != null && !applicationVersion.isEmpty() ) {
|
||||
// aidV2.version = ByteUtil.hexStr2Bytes(applicationVersion);
|
||||
// }
|
||||
// if (merchantName != null && !merchantName.isEmpty() ) {
|
||||
// aidV2.merchName = ByteUtil.hexStr2Bytes(merchantName);
|
||||
// }
|
||||
// if (merchantCateCode != null && !merchantCateCode.isEmpty() ) {
|
||||
// aidV2.merchCateCode = ByteUtil.hexStr2Bytes(merchantCateCode);
|
||||
// }
|
||||
// if (merchantId != null && !merchantId.isEmpty() ) {
|
||||
// aidV2.merchId = ByteUtil.hexStr2Bytes(merchantId);
|
||||
// }
|
||||
// if (referCurrCode != null && !referCurrCode.isEmpty() ) {
|
||||
// aidV2.referCurrCode = ByteUtil.hexStr2Bytes(referCurrCode);
|
||||
// }
|
||||
// if (referCurrExp != null && !referCurrExp.isEmpty() ) {
|
||||
// aidV2.referCurrExp = ByteUtil.hexStr2Byte(referCurrExp);
|
||||
// }
|
||||
// if (ctsStatusCheck != null && !ctsStatusCheck.isEmpty() ) {
|
||||
// aidV2.clsStatusCheck = ByteUtil.hexStr2Byte(ctsStatusCheck);
|
||||
// }
|
||||
// if (zeroCheck != null && !zeroCheck.isEmpty() ) {
|
||||
// aidV2.zeroCheck = ByteUtil.hexStr2Byte(zeroCheck);
|
||||
// }
|
||||
// if (kernelType != null && !kernelType.isEmpty() ) {
|
||||
// aidV2.kernelType = ByteUtil.hexStr2Byte(kernelType);
|
||||
// }
|
||||
// if (paramType != null && !paramType.isEmpty() ) {
|
||||
// aidV2.paramType = ByteUtil.hexStr2Byte(paramType);
|
||||
// }
|
||||
// if (ttq != null && !ttq.isEmpty() ) {
|
||||
// aidV2.ttq = ByteUtil.hexStr2Bytes(ttq);
|
||||
// }
|
||||
// if (termId != null && !termId.isEmpty() ) {
|
||||
// aidV2.termId = ByteUtil.hexStr2Bytes(termId);
|
||||
// }
|
||||
// if (riskManageData != null && !riskManageData.isEmpty() ) {
|
||||
// aidV2.riskManData = ByteUtil.hexStr2Bytes(riskManageData);
|
||||
// }
|
||||
// if (referCurrCon != null && !referCurrCon.isEmpty() ) {
|
||||
// aidV2.referCurrCon = ByteUtil.hexStr2Bytes(referCurrCon);
|
||||
// }
|
||||
// if (tDol != null && !tDol.isEmpty() ) {
|
||||
// aidV2.tDOL = ByteUtil.hexStr2Bytes(tDol);
|
||||
// }
|
||||
// return aidV2;
|
||||
// }
|
||||
public AidV2 loadAid() {
|
||||
AidV2 aidV2 = new AidV2();
|
||||
|
||||
if (ctsCvmLimit != null && !ctsCvmLimit.isEmpty()) {
|
||||
aidV2.cvmLmt = ByteUtil.hexStr2Bytes(ctsCvmLimit);
|
||||
}
|
||||
|
||||
if (ctsTransLimit != null && !ctsTransLimit.isEmpty() ) {
|
||||
aidV2.termClssLmt = ByteUtil.hexStr2Bytes(ctsTransLimit);
|
||||
}
|
||||
|
||||
if (termCtsOfflineFloorLmt != null && !termCtsOfflineFloorLmt.isEmpty() ) {
|
||||
aidV2.termClssOfflineFloorLmt = ByteUtil.hexStr2Bytes(termCtsOfflineFloorLmt);
|
||||
}
|
||||
|
||||
if (termOfflineFloorLmt != null && !termOfflineFloorLmt.isEmpty() ) {
|
||||
aidV2.termOfflineFloorLmt = ByteUtil.hexStr2Bytes(termOfflineFloorLmt);
|
||||
}
|
||||
|
||||
if (aid != null && !aid.isEmpty() ) {
|
||||
aidV2.aid = ByteUtil.hexStr2Bytes(aid);
|
||||
}
|
||||
if (selFlag != null && !selFlag.isEmpty() ) {
|
||||
aidV2.selFlag = ByteUtil.hexStr2Byte(selFlag);
|
||||
}
|
||||
|
||||
if (targetPercent != null && !targetPercent.isEmpty() ) {
|
||||
aidV2.targetPer = ByteUtil.hexStr2Byte(targetPercent);
|
||||
}
|
||||
if (maxTargetPercent != null && !maxTargetPercent.isEmpty() ) {
|
||||
aidV2.maxTargetPer = ByteUtil.hexStr2Byte(maxTargetPercent);
|
||||
}
|
||||
if (floorLimit != null && !floorLimit.isEmpty() ) {
|
||||
aidV2.floorLimit = ByteUtil.hexStr2Bytes(floorLimit);
|
||||
}
|
||||
|
||||
if (threshold != null && !threshold.isEmpty() ) {
|
||||
aidV2.threshold = ByteUtil.hexStr2Bytes(threshold);
|
||||
}
|
||||
|
||||
if (tacDenial != null && !tacDenial.isEmpty() ) {
|
||||
aidV2.TACDenial = ByteUtil.hexStr2Bytes(tacDenial);
|
||||
}
|
||||
if (tacOnline != null && !tacOnline.isEmpty() ) {
|
||||
aidV2.TACOnline = ByteUtil.hexStr2Bytes(tacOnline);
|
||||
}
|
||||
|
||||
if (tacDefault != null && !tacDefault.isEmpty() ) {
|
||||
aidV2.TACDefault = ByteUtil.hexStr2Bytes(tacDefault);
|
||||
}
|
||||
if (acquirerId != null && !acquirerId.isEmpty() ) {
|
||||
aidV2.AcquierId = ByteUtil.hexStr2Bytes(acquirerId);
|
||||
}
|
||||
if (dDol != null && !dDol.isEmpty() ) {
|
||||
aidV2.dDOL = ByteUtil.hexStr2Bytes(dDol);
|
||||
}
|
||||
if (applicationVersion != null && !applicationVersion.isEmpty() ) {
|
||||
aidV2.version = ByteUtil.hexStr2Bytes(applicationVersion);
|
||||
}
|
||||
if (merchantName != null && !merchantName.isEmpty() ) {
|
||||
aidV2.merchName = ByteUtil.hexStr2Bytes(merchantName);
|
||||
}
|
||||
if (merchantCateCode != null && !merchantCateCode.isEmpty() ) {
|
||||
aidV2.merchCateCode = ByteUtil.hexStr2Bytes(merchantCateCode);
|
||||
}
|
||||
if (merchantId != null && !merchantId.isEmpty() ) {
|
||||
aidV2.merchId = ByteUtil.hexStr2Bytes(merchantId);
|
||||
}
|
||||
if (referCurrCode != null && !referCurrCode.isEmpty() ) {
|
||||
aidV2.referCurrCode = ByteUtil.hexStr2Bytes(referCurrCode);
|
||||
}
|
||||
if (referCurrExp != null && !referCurrExp.isEmpty() ) {
|
||||
aidV2.referCurrExp = ByteUtil.hexStr2Byte(referCurrExp);
|
||||
}
|
||||
if (ctsStatusCheck != null && !ctsStatusCheck.isEmpty() ) {
|
||||
aidV2.clsStatusCheck = ByteUtil.hexStr2Byte(ctsStatusCheck);
|
||||
}
|
||||
if (zeroCheck != null && !zeroCheck.isEmpty() ) {
|
||||
aidV2.zeroCheck = ByteUtil.hexStr2Byte(zeroCheck);
|
||||
}
|
||||
if (kernelType != null && !kernelType.isEmpty() ) {
|
||||
aidV2.kernelType = ByteUtil.hexStr2Byte(kernelType);
|
||||
}
|
||||
if (paramType != null && !paramType.isEmpty() ) {
|
||||
aidV2.paramType = ByteUtil.hexStr2Byte(paramType);
|
||||
}
|
||||
if (ttq != null && !ttq.isEmpty() ) {
|
||||
aidV2.ttq = ByteUtil.hexStr2Bytes(ttq);
|
||||
}
|
||||
if (termId != null && !termId.isEmpty() ) {
|
||||
aidV2.termId = ByteUtil.hexStr2Bytes(termId);
|
||||
}
|
||||
if (riskManageData != null && !riskManageData.isEmpty() ) {
|
||||
aidV2.riskManData = ByteUtil.hexStr2Bytes(riskManageData);
|
||||
}
|
||||
if (referCurrCon != null && !referCurrCon.isEmpty() ) {
|
||||
aidV2.referCurrCon = ByteUtil.hexStr2Bytes(referCurrCon);
|
||||
}
|
||||
if (tDol != null && !tDol.isEmpty() ) {
|
||||
aidV2.tDOL = ByteUtil.hexStr2Bytes(tDol);
|
||||
}
|
||||
return aidV2;
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getConfigString(){
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
package com.utsmyanmar.paylibs.model;
|
||||
|
||||
public class BaseCardInfo {
|
||||
|
||||
public int cardType;
|
||||
public String cardNo;
|
||||
public String track1;
|
||||
public String track2;
|
||||
public String track3;
|
||||
public String expireDate;
|
||||
public String serviceCode;
|
||||
public String countryCode;
|
||||
public boolean isCardSerialNo;
|
||||
public String cardSerialNo;
|
||||
public String uuid;
|
||||
public String atr;
|
||||
|
||||
|
||||
public BaseCardInfo() {
|
||||
|
||||
}
|
||||
public BaseCardInfo(int cardType, String cardNo, String track1, String track2, String track3, String expireDate, String serviceCode, String countryCode, boolean isCardSerialNo, String cardSerialNo, String uuid, String atr) {
|
||||
this.cardType = cardType;
|
||||
this.cardNo = cardNo;
|
||||
this.track1 = track1;
|
||||
this.track2 = track2;
|
||||
this.track3 = track3;
|
||||
this.expireDate = expireDate;
|
||||
this.serviceCode = serviceCode;
|
||||
this.countryCode = countryCode;
|
||||
this.isCardSerialNo = isCardSerialNo;
|
||||
this.cardSerialNo = cardSerialNo;
|
||||
this.uuid = uuid;
|
||||
this.atr = atr;
|
||||
}
|
||||
}
|
||||
@ -1,125 +0,0 @@
|
||||
package com.utsmyanmar.paylibs.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CardSettleData {
|
||||
|
||||
private String cardType;
|
||||
private String cardNum;
|
||||
private String expDate;
|
||||
private String invoiceNum;
|
||||
private String transType;
|
||||
|
||||
private long amount;
|
||||
|
||||
private String transDate;
|
||||
private String transTime;
|
||||
|
||||
private String approvalCode;
|
||||
|
||||
public CardSettleData() {
|
||||
|
||||
}
|
||||
public CardSettleData(String cardType, String cardNum, String expDate, String invoiceNum, String transType, long amount, String transDate, String transTime, String approvalCode) {
|
||||
this.cardType = cardType;
|
||||
this.cardNum = cardNum;
|
||||
this.expDate = expDate;
|
||||
this.invoiceNum = invoiceNum;
|
||||
this.transType = transType;
|
||||
this.amount = amount;
|
||||
this.transDate = transDate;
|
||||
this.transTime = transTime;
|
||||
this.approvalCode = approvalCode;
|
||||
}
|
||||
|
||||
public void setCardType(String cardType) {
|
||||
this.cardType = cardType;
|
||||
}
|
||||
|
||||
public void setCardNum(String cardNum) {
|
||||
this.cardNum = cardNum;
|
||||
}
|
||||
|
||||
public void setExpDate(String expDate) {
|
||||
this.expDate = expDate;
|
||||
}
|
||||
|
||||
public void setInvoiceNum(String invoiceNum) {
|
||||
this.invoiceNum = invoiceNum;
|
||||
}
|
||||
|
||||
public void setTransType(String transType) {
|
||||
this.transType = transType;
|
||||
}
|
||||
|
||||
public void setAmount(long amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public void setTransDate(String transDate) {
|
||||
this.transDate = transDate;
|
||||
}
|
||||
|
||||
public void setTransTime(String transTime) {
|
||||
this.transTime = transTime;
|
||||
}
|
||||
|
||||
public String getCardType() {
|
||||
return cardType;
|
||||
}
|
||||
|
||||
public String getCardNum() {
|
||||
return cardNum;
|
||||
}
|
||||
|
||||
public String getExpDate() {
|
||||
return expDate;
|
||||
}
|
||||
|
||||
public String getInvoiceNum() {
|
||||
return invoiceNum;
|
||||
}
|
||||
|
||||
public String getTransType() {
|
||||
return transType;
|
||||
}
|
||||
|
||||
public long getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public String getTransDate() {
|
||||
return transDate;
|
||||
}
|
||||
|
||||
public String getTransTime() {
|
||||
return transTime;
|
||||
}
|
||||
|
||||
public void setApprovalCode(String approvalCode) {
|
||||
this.approvalCode = approvalCode;
|
||||
}
|
||||
|
||||
public String getApprovalCode() {
|
||||
return approvalCode;
|
||||
}
|
||||
|
||||
public static List<CardSettleData> convertFromPayDetail(List<PayDetail> payDetails) {
|
||||
List<CardSettleData> cardSettleDataList = new ArrayList<>();
|
||||
for (PayDetail pay : payDetails) {
|
||||
CardSettleData cardSettleData = new CardSettleData();
|
||||
cardSettleData.setCardType(pay.getAccountType());
|
||||
cardSettleData.setCardNum(pay.getCardNo());
|
||||
cardSettleData.setExpDate(pay.getEXPDate());
|
||||
cardSettleData.setInvoiceNum(pay.getInvoiceNo());
|
||||
cardSettleData.setTransType(pay.getTransType());
|
||||
cardSettleData.setAmount(pay.getAmount());
|
||||
cardSettleData.setTransDate(pay.getTransDate());
|
||||
cardSettleData.setTransTime(pay.getTransTime());
|
||||
cardSettleData.setApprovalCode(pay.getApprovalCode());
|
||||
cardSettleDataList.add(cardSettleData);
|
||||
}
|
||||
return cardSettleDataList;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.utsmyanmar.paylibs.model;
|
||||
|
||||
public class Office {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private int staffCount;
|
||||
private String salary;
|
||||
|
||||
public Office(){}
|
||||
|
||||
public Office(int id, String name, int staffCount, String salary) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.staffCount = staffCount;
|
||||
this.salary = salary;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getStaffCount() {
|
||||
return staffCount;
|
||||
}
|
||||
|
||||
public String getSalary() {
|
||||
return salary;
|
||||
}
|
||||
}
|
||||
@ -163,7 +163,6 @@ public class PayDetail implements Serializable {
|
||||
public SettleData settleDataObj;
|
||||
public TransCVM transCVM;
|
||||
public List<QRSettleData> qrSettleData;
|
||||
public List<CardSettleData> cardSettleData;
|
||||
|
||||
|
||||
|
||||
@ -188,7 +187,7 @@ public class PayDetail implements Serializable {
|
||||
boolean isPrinted, boolean eSignIsUploaded, boolean isFreePWD, boolean isFreeSign, String tempKSN, String tempMerchantNo,
|
||||
String tempMerchantName, String tempTerminalNo, long transNum, String customOrderNo, String approvalCode, boolean isSettle,
|
||||
String settleData, String settleList, String otherCardNo, String tradeDateAndTime, String tradeDateTime, String hostName,
|
||||
String transDate, String transTime, String invoiceNo, String transId, String qrReferNo, String customerMobile, SettleData settleDataObj,boolean isSettlementEnabled,TransCVM transCVM,List<QRSettleData> qrSettleData,List<CardSettleData> cardSettleData) {
|
||||
String transDate, String transTime, String invoiceNo, String transId, String qrReferNo, String customerMobile, SettleData settleDataObj,boolean isSettlementEnabled,TransCVM transCVM,List<QRSettleData> qrSettleData) {
|
||||
this.PID = PID;
|
||||
this.sendBag = sendBag;
|
||||
this.receiverBag = receiverBag;
|
||||
@ -303,7 +302,6 @@ public class PayDetail implements Serializable {
|
||||
this.settleDataObj = settleDataObj;
|
||||
this.isSettlementEnabled = isSettlementEnabled;
|
||||
this.qrSettleData = qrSettleData;
|
||||
this.cardSettleData = cardSettleData;
|
||||
}
|
||||
|
||||
public boolean isSettle() {
|
||||
@ -1376,10 +1374,4 @@ public class PayDetail implements Serializable {
|
||||
this.qrSettleData = qrSettleData;
|
||||
}
|
||||
|
||||
public List<CardSettleData> getCardSettleData() {return cardSettleData;}
|
||||
|
||||
public void setCardSettleData(List<CardSettleData> cardSettleData) {
|
||||
this.cardSettleData = cardSettleData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import com.nexgo.oaf.apiv3.SdkResult;
|
||||
import com.nexgo.oaf.apiv3.device.printer.Printer;
|
||||
import com.sunmi.peripheral.printer.SunmiPrinterService;
|
||||
import com.utsmyanmar.paylibs.PayLibNex;
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
|
||||
public class PrintHelper {
|
||||
|
||||
|
||||
1260
paylibs/src/main/java/com/utsmyanmar/paylibs/print/PrintReceipt.java
Normal file
1260
paylibs/src/main/java/com/utsmyanmar/paylibs/print/PrintReceipt.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,7 @@ import android.text.TextUtils;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
@ -17,7 +18,6 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
import com.utsmyanmar.paylibs.utils.enums.BaseCardType;
|
||||
|
||||
public class PrintUtils {
|
||||
|
||||
@ -170,12 +170,12 @@ public class PrintUtils {
|
||||
public String getEntryType(int cardType) {
|
||||
|
||||
String entryType = "-";
|
||||
if (BaseCardType.IC.getValue() == cardType) {
|
||||
if (AidlConstants.CardType.IC.getValue() == cardType) {
|
||||
entryType = "CHIP";
|
||||
} else if (BaseCardType.MAGNETIC.getValue() == cardType) {
|
||||
} else if (AidlConstants.CardType.MAGNETIC.getValue() == cardType) {
|
||||
entryType = "MAG";
|
||||
} else if (BaseCardType.NFC.getValue() == cardType) {
|
||||
entryType = "CONTACTLESS";
|
||||
} else if (AidlConstants.CardType.NFC.getValue() == cardType) {
|
||||
entryType = "CTLS";
|
||||
} else if ( 0 == cardType ) {
|
||||
entryType = "QR";
|
||||
} else if( -1 == cardType) {
|
||||
|
||||
@ -2,26 +2,30 @@ package com.utsmyanmar.paylibs.print.printx;
|
||||
|
||||
import static com.utsmyanmar.paylibs.utils.enums.CurrencyType.MMK;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Typeface;
|
||||
import android.icu.util.LocaleData;
|
||||
import android.os.Build;
|
||||
import android.os.RemoteException;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.nexgo.oaf.apiv3.SdkResult;
|
||||
import com.nexgo.oaf.apiv3.device.printer.AlignEnum;
|
||||
import com.nexgo.oaf.apiv3.device.printer.DotMatrixFontEnum;
|
||||
import com.nexgo.oaf.apiv3.device.printer.FontEntity;
|
||||
import com.nexgo.oaf.apiv3.device.printer.GrayLevelEnum;
|
||||
import com.nexgo.oaf.apiv3.device.printer.LineOptionEntity;
|
||||
import com.nexgo.oaf.apiv3.device.printer.OnPrintListener;
|
||||
import com.nexgo.oaf.apiv3.device.printer.Printer;
|
||||
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||
import com.sunmi.peripheral.printer.InnerResultCallback;
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.PayLibNex;
|
||||
import com.utsmyanmar.paylibs.model.CardSettleData;
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
import com.utsmyanmar.paylibs.R;
|
||||
import com.utsmyanmar.paylibs.model.MsgField;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.model.QRSettleData;
|
||||
@ -31,14 +35,17 @@ import com.utsmyanmar.paylibs.system.BaseErrorCode;
|
||||
import com.utsmyanmar.paylibs.utils.POSUtil;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
import com.utsmyanmar.paylibs.utils.enums.BaseCardType;
|
||||
import com.utsmyanmar.paylibs.utils.enums.CardScheme;
|
||||
import com.utsmyanmar.paylibs.utils.enums.HostType;
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionType;
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||
import com.utsmyanmar.paylibs.utils.print_utils.BitmapUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -115,8 +122,13 @@ public abstract class BaseXPrint {
|
||||
returnText[0] = 0x1B;
|
||||
returnText[1] = 0x33;
|
||||
returnText[2] = (byte) height;
|
||||
Resources resources = PayLibNex.getInstance().context.getResources();
|
||||
printer.setTypeface(Typeface.createFromAsset(PayLibNex.getInstance().context.getAssets(), "fonts/fira_code_medium.ttf"));
|
||||
// LogUtil.d(TAG, Arrays.toString(returnText));
|
||||
// printer.setTypeface(Typeface.DEFAULT);
|
||||
Resources resources = PayLibsUtils.getInstance().context.getResources();
|
||||
// Typeface typeface = ResourcesCompat.getFont(PayLibsUtils.getInstance().context, R.font.consolas);
|
||||
// printer.setTypeface(typeface);
|
||||
// printer.setTypeface(Typeface.createFromAsset(PayLibsUtils.getInstance().context.getAssets(), "fonts/firacode_regular.ttf"));
|
||||
printer.setTypeface(Typeface.createFromAsset(PayLibsUtils.getInstance().context.getAssets(), "fonts/fira_code_medium.ttf"));
|
||||
printer.setGray(getGrayLevel());
|
||||
|
||||
}
|
||||
@ -189,6 +201,10 @@ public abstract class BaseXPrint {
|
||||
|
||||
}
|
||||
|
||||
protected void dotBreak(){
|
||||
printer.appendPrnStr(new String(new char[29]).replace("\0", "."), fontNormal, AlignEnum.LEFT, false);
|
||||
}
|
||||
|
||||
protected void dashBreak() {
|
||||
printer.appendPrnStr("-----------------------------", fontNormal, AlignEnum.LEFT,false);
|
||||
|
||||
@ -222,51 +238,6 @@ public abstract class BaseXPrint {
|
||||
emptyLine(2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void printTransDetailSettlement(PayDetail payDetail, List<CardSettleData> cardSettleDataList) {
|
||||
|
||||
lineBreak();
|
||||
print2SideStringMargin("CARD TYPE ","CARD NUMBER");
|
||||
print2SideStringMargin("EXP DATE ","INVOICE NUM");
|
||||
print2SideStringMargin("TRANSACTION ","AMOUNT");
|
||||
print2SideStringMargin("APPR CODE ","DATE/TIME");
|
||||
lineBreak();
|
||||
|
||||
for (CardSettleData cardSettleData:cardSettleDataList) {
|
||||
print2SideStringMargin(cardSettleData.getCardType(),PrintUtils.getInstance().maskCardNumberPciDss(cardSettleData.getCardNum()));
|
||||
print2SideStringMargin("XX/XX",cardSettleData.getInvoiceNum());
|
||||
print2SideStringMargin(cardSettleData.getTransType(),"MMK "+PrintUtils.getInstance().getSeparatorNumberFormat(payDetail.getAmount(),true));
|
||||
print2SideStringMargin(cardSettleData.getApprovalCode(),cardSettleData.getTransDate() + " " + cardSettleData.getTransTime() );
|
||||
emptyLine(1);
|
||||
}
|
||||
|
||||
lineBreak();
|
||||
SettleData settleData = payDetail.getSettleDataObj();
|
||||
int totalCount = settleData.getSaleCount() + settleData.getPreAuthCompCount() + settleData.getRefundCount() + settleData.getCashAdvanceCount();
|
||||
long totalAmount = settleData.getSaleAmount() + settleData.getPreAuthCompAmount() + settleData.getCashAdvanceAmount();
|
||||
|
||||
print3ColumnsString("TRX TYPE ", "CNT", "AMOUNT");
|
||||
print3ColumnsString("SALE ", countStringFormat(settleData.getSaleCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getSaleAmount()));
|
||||
print3ColumnsString("VOID SALE ", countStringFormat(settleData.getVoidSaleCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getVoidSaleAmount()));
|
||||
print3ColumnsString("PREAUTH COMP ", countStringFormat(settleData.getPreAuthCompCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getPreAuthCompAmount()));
|
||||
if (settleData.getCashAdvanceCount() != 0)
|
||||
print3ColumnsString("CASH ADV ", countStringFormat(settleData.getCashAdvanceCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getCashAdvanceAmount()));
|
||||
print3ColumnsString("REFUND ", countStringFormat(settleData.getRefundCount()), "- " + PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getRefundAmount()));
|
||||
emptyLine(1);
|
||||
printer.appendPrnStr("GRAND TOTAL", fontLarge, AlignEnum.LEFT,true);
|
||||
emptyLine(1);
|
||||
// print3ColumnsString("TOTAL(MMK) ", countStringFormat(totalCount), PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount));
|
||||
print3ColumnsString("TRX TYPE ", "CNT", "AMOUNT");
|
||||
print3ColumnsString("SALE ", countStringFormat(settleData.getSaleCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getSaleAmount()));
|
||||
print3ColumnsString("VOID SALE ", countStringFormat(settleData.getVoidSaleCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getVoidSaleAmount()));
|
||||
print3ColumnsString("PREAUTH COMP ", countStringFormat(settleData.getPreAuthCompCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getPreAuthCompAmount()));
|
||||
if (settleData.getCashAdvanceCount() != 0)
|
||||
print3ColumnsString("CASH ADV ", countStringFormat(settleData.getCashAdvanceCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getCashAdvanceAmount()));
|
||||
print3ColumnsString("REFUND ", countStringFormat(settleData.getRefundCount()), "- " + PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getRefundAmount()));
|
||||
emptyLine(2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -314,34 +285,29 @@ public abstract class BaseXPrint {
|
||||
String firsLineName = PrintUtils.getInstance().processNameSpaceFirstLine(PrintUtils.getInstance().getCardHolderName(payDetail.getCardHolderName()), secondLineName);
|
||||
|
||||
print2ColumnsStringNoSpace("CARD NUM :", PrintUtils.getInstance().maskCardNumberPciDss(payDetail.getCardNo()));
|
||||
print2ColumnsStringNoSpace("ENTRY MODE:", PrintUtils.getInstance().getEntryType(payDetail.getCardType()));
|
||||
print2ColumnsStringNoSpace("EXP DATE :",PrintUtils.getInstance().getFormatExpDate(payDetail.getEXPDate()));
|
||||
print2ColumnsStringNoSpace("CARD TYPE :", payDetail.getAccountType());
|
||||
print2ColumnsStringNoSpace("TRACE NUM :", payDetail.getVoucherNo());
|
||||
|
||||
if (payDetail.getCardType() != BaseCardType.MAGNETIC.getValue()) {
|
||||
print2ColumnsStringNoSpace("CARD HOLDER:", firsLineName);
|
||||
if (!secondLineName.isEmpty()) {
|
||||
if (payDetail.getCardType() != AidlConstants.CardType.MAGNETIC.getValue()) {
|
||||
print2ColumnsStringNoSpace("CARD HOLDER NAME:", firsLineName);
|
||||
if (!secondLineName.equals("")) {
|
||||
print2ColumnsString(secondLineName, "");
|
||||
}
|
||||
}
|
||||
print2ColumnsStringNoSpace("ENTRY MODE:" + PrintUtils.getInstance().getEntryType(payDetail.getCardType()), "EXPIRY DATE:" + PrintUtils.getInstance().getFormatExpDate(payDetail.getEXPDate()));
|
||||
|
||||
if (payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_ACCEPT) || payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_APPROVED)) {
|
||||
print2ColumnsStringNoSpace( "APPR CODE :" ,payDetail.getApprovalCode());
|
||||
print2ColumnsStringNoSpace("CARD TYPE:" + payDetail.getAccountType(), "APPRCODE:" + payDetail.getApprovalCode());
|
||||
} else {
|
||||
print2ColumnsStringNoSpace("CARD TYPE:" + payDetail.getAccountType(), "");
|
||||
}
|
||||
if (payDetail.getCardType() != AidlConstants.CardType.MAGNETIC.getValue()) {
|
||||
print2ColumnsStringNoSpace("AID", ":" + MPU_AID);
|
||||
}
|
||||
|
||||
print2ColumnsStringNoSpace("TRANS REF :", payDetail.getReferNo());
|
||||
|
||||
|
||||
// if (payDetail.getCardType() != BaseCardType.MAGNETIC.getValue()) {
|
||||
// print2ColumnsStringNoSpace("AID :", MPU_AID);
|
||||
// }
|
||||
|
||||
if (payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_ACCEPT) || payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_APPROVED)) {
|
||||
print2ColumnsStringNoSpace("TXN ID :",payDetail.getReferNo());
|
||||
print2ColumnsStringNoSpace("TXN ID", ":" + payDetail.getReferNo());
|
||||
}
|
||||
|
||||
|
||||
print2ColumnsStringNoSpace("REF NUM", ":" + payDetail.getReferNo());
|
||||
print2ColumnsStringNoSpace("TRACE No", ":" + payDetail.getVoucherNo());
|
||||
|
||||
if (payDetail.getTradeAnswerCode().equals("00") || payDetail.getTradeAnswerCode().equals("000")) {
|
||||
if (payDetail.getTransactionType() == TransactionType.CASH_ADVANCE) {
|
||||
@ -349,8 +315,7 @@ public abstract class BaseXPrint {
|
||||
print2ColumnsStringNoSpace("TXN FEES", ":" + PrintUtils.getInstance().getSeparatorNumberFormat(payDetail.getAdditionalAmount()));
|
||||
}
|
||||
}
|
||||
// emptyLine(2);
|
||||
lineBreak();
|
||||
emptyLine(2);
|
||||
// check is pin change
|
||||
|
||||
if (payDetail.getTradeAnswerCode().equals("00") || payDetail.getTradeAnswerCode().equals("000")) {
|
||||
@ -359,14 +324,13 @@ public abstract class BaseXPrint {
|
||||
printer.appendPrnStr("MMK " + PrintUtils.getInstance().getBalanceInquiryNumberFormat(payDetail.getAmount()), fontNormal, AlignEnum.LEFT,false);
|
||||
|
||||
} else if (payDetail.getTransactionType() == TransactionType.VOID || payDetail.getTransactionType() == TransactionType.REFUND || payDetail.getTransactionType() == TransactionType.PRE_SALE_CANCEL || payDetail.getTransactionType() == TransactionType.PRE_SALE_COMPLETE_VOID) {
|
||||
print2SideString("AMOUNT:" + currencySign, "- " + PrintUtils.getInstance().getSeparatorNumberFormat(payDetail.getAmount()));
|
||||
print2ColumnsStringNoSpace("TOTAL " + currencySign, "- " + PrintUtils.getInstance().getSeparatorNumberFormat(payDetail.getAmount()));
|
||||
} else if (payDetail.getTransactionType() == TransactionType.CASH_ADVANCE) {
|
||||
long totalAmount = payDetail.getAmount() + payDetail.getAdditionalAmount();
|
||||
print2SideString("AMOUNT:" + currencySign, PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount));
|
||||
print2ColumnsStringNoSpace("TOTAL " + currencySign, PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount));
|
||||
} else {
|
||||
print2SideString("AMOUNT:" + currencySign, PrintUtils.getInstance().getSeparatorNumberFormat(payDetail.getAmount()));
|
||||
print2ColumnsStringNoSpace("TOTAL " + currencySign, PrintUtils.getInstance().getSeparatorNumberFormat(payDetail.getAmount()));
|
||||
}
|
||||
lineBreak();
|
||||
} else {
|
||||
|
||||
lineBreak();
|
||||
@ -378,6 +342,12 @@ public abstract class BaseXPrint {
|
||||
lineBreak();
|
||||
}
|
||||
|
||||
|
||||
if (payDetail.getTradeAnswerCode().equals("00") || payDetail.getTradeAnswerCode().equals("000")) {
|
||||
emptyLine(2);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void printParsedField(Map<String, MsgField> msgField) {
|
||||
@ -463,59 +433,37 @@ public abstract class BaseXPrint {
|
||||
String schemeName = "";
|
||||
schemeName = payDetail.getAccountType() == null ? "" : payDetail.getAccountType();
|
||||
|
||||
String secondLineName = PrintUtils.getInstance().processNameSpaceSecondLine(PrintUtils.getInstance().getCardHolderName(payDetail.getCardHolderName()));
|
||||
String firsLineName = PrintUtils.getInstance().processNameSpaceFirstLine(PrintUtils.getInstance().getCardHolderName(payDetail.getCardHolderName()), secondLineName);
|
||||
// printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr(PrintUtils.getInstance().maskCardNumberPciDss(payDetail.getCardNo()), fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr(PrintUtils.getInstance().getFormatExpDateWithSlash(payDetail.getEXPDate()), fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr(PrintUtils.getInstance().getEntryType(payDetail.getCardType()) + " ENTRY", fontNormal, AlignEnum.LEFT,false);
|
||||
|
||||
// if (payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_APPROVED) || payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_ACCEPT)) {
|
||||
// printer.appendPrnStr("APPR CODE:" + payDetail.getApprovalCode(), fontNormal, AlignEnum.LEFT,false);
|
||||
//
|
||||
// // manual entry or refund
|
||||
// if (payDetail.getCardType() == -1 || payDetail.getTransactionType() == TransactionsType.REFUND.value) {
|
||||
// printer.appendPrnStr("RRN:" + payDetail.getReferNo(), fontNormal, AlignEnum.LEFT,false);
|
||||
// } else {
|
||||
// printer.appendPrnStr("RRN:" + payDetail.getReferNo() + " TVR:" + payDetail.getTVR(), fontNormal, AlignEnum.LEFT,false);
|
||||
// printer.appendPrnStr("TSI :" + payDetail.getTSI(), fontNormal, AlignEnum.LEFT,false);
|
||||
// printer.appendPrnStr("TC :" + payDetail.getArqC(), fontNormal, AlignEnum.LEFT,false);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
|
||||
// printer.appendPrnStr("TVR :" + payDetail.getTVR(), fontNormal, AlignEnum.LEFT,false);
|
||||
// }
|
||||
if (payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_APPROVED) || payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_ACCEPT)) {
|
||||
printer.appendPrnStr("APPR CODE:" + payDetail.getApprovalCode(), fontNormal, AlignEnum.LEFT,false);
|
||||
|
||||
// manual entry or refund
|
||||
if (payDetail.getCardType() == -1 || payDetail.getTransactionType() == TransactionsType.REFUND.value) {
|
||||
printer.appendPrnStr("RRN:" + payDetail.getReferNo(), fontNormal, AlignEnum.LEFT,false);
|
||||
} else {
|
||||
printer.appendPrnStr("RRN:" + payDetail.getReferNo() + " TVR:" + payDetail.getTVR(), fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("TSI :" + payDetail.getTSI(), fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("TC :" + payDetail.getArqC(), fontNormal, AlignEnum.LEFT,false);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("TVR :" + payDetail.getTVR(), fontNormal, AlignEnum.LEFT,false);
|
||||
}
|
||||
|
||||
//actually we can remove
|
||||
|
||||
|
||||
print2ColumnsStringNoSpace("CARD NUM :", PrintUtils.getInstance().maskCardNumberPciDss(payDetail.getCardNo()));
|
||||
if (payDetail.getCardType() != -1 || payDetail.getTransactionType() != TransactionsType.REFUND.value) {
|
||||
// printer.appendPrnStr("AID :" + payDetail.getAID(), fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("APP LABEL :" + payDetail.getAppLabel(), fontNormal, AlignEnum.LEFT,false);
|
||||
}
|
||||
print2ColumnsStringNoSpace("ENTRY MODE:", PrintUtils.getInstance().getEntryType(payDetail.getCardType()));
|
||||
print2ColumnsStringNoSpace("EXP DATE :",PrintUtils.getInstance().getFormatExpDate(payDetail.getEXPDate()));
|
||||
print2ColumnsStringNoSpace("CARD TYPE :", payDetail.getAccountType());
|
||||
print2ColumnsStringNoSpace("TRACE NUM :", payDetail.getVoucherNo());
|
||||
|
||||
if (payDetail.getCardType() != BaseCardType.MAGNETIC.getValue()) {
|
||||
print2ColumnsStringNoSpace("CARD HOLDER:", firsLineName);
|
||||
if (!secondLineName.isEmpty()) {
|
||||
print2ColumnsString(secondLineName, "");
|
||||
}
|
||||
}
|
||||
|
||||
if (payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_ACCEPT) || payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_APPROVED)) {
|
||||
print2ColumnsStringNoSpace( "APPR CODE :" ,payDetail.getApprovalCode());
|
||||
printer.appendPrnStr("AID :" + payDetail.getAID(), fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("APP NAME :" + payDetail.getAppLabel(), fontNormal, AlignEnum.LEFT,false);
|
||||
}
|
||||
|
||||
|
||||
if (payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_ACCEPT) || payDetail.getTradeAnswerCode().equals(Constant.ANSWER_CODE_APPROVED)) {
|
||||
print2ColumnsStringNoSpace("TRANS REF :", payDetail.getReferNo());
|
||||
}
|
||||
|
||||
print2ColumnsStringNoSpace("AID :", payDetail.getAID());
|
||||
|
||||
lineBreak();
|
||||
printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
|
||||
// check is pin change
|
||||
if (payDetail.getTradeAnswerCode().equals("00") || payDetail.getTradeAnswerCode().equals("000")) {
|
||||
|
||||
@ -524,20 +472,18 @@ public abstract class BaseXPrint {
|
||||
if (payDetail.getTransactionType() == TransactionType.BALANCE_INQUIRY) {
|
||||
printer.appendPrnStr("MMK " + PrintUtils.getInstance().getBalanceInquiryNumberFormat(payDetail.getAmount()), fontNormal, AlignEnum.LEFT,true);
|
||||
} else {
|
||||
print2SideString("AMOUNT:" + currencySign, PrintUtils.getInstance().getSeparatorNumberFormat(payDetail.getAmount()));
|
||||
// printer.appendPrnStr("AMOUNT:" + currencySign + " " + PrintUtils.getInstance().getSeparatorNumberFormat(payDetail.getAmount()), fontNormal, AlignEnum.LEFT,true);
|
||||
printer.appendPrnStr("TOTAL " + currencySign + " " + PrintUtils.getInstance().getSeparatorNumberFormat(payDetail.getAmount()), fontNormal, AlignEnum.LEFT,true);
|
||||
}
|
||||
lineBreak();
|
||||
} else {
|
||||
|
||||
lineBreak();
|
||||
emptyLine(1);
|
||||
emptyLine(3);
|
||||
printer.appendPrnStr(BaseErrorCode.getCode(payDetail.getTradeAnswerCode()), fontNormal, AlignEnum.CENTER,true);
|
||||
emptyLine(1);
|
||||
emptyLine(3);
|
||||
lineBreak();
|
||||
}
|
||||
|
||||
emptyLine(1);
|
||||
emptyLine(2);
|
||||
|
||||
|
||||
}
|
||||
@ -555,7 +501,6 @@ public abstract class BaseXPrint {
|
||||
|
||||
protected void printTransDetailSummary(PayDetail payDetail) {
|
||||
|
||||
|
||||
String MMK = "MMK";
|
||||
SettleData settleData = payDetail.getSettleDataObj();
|
||||
boolean isQrDecimalEnabled = SystemParamsOperation.getInstance().isQrDecimalEnable();
|
||||
@ -570,49 +515,19 @@ public abstract class BaseXPrint {
|
||||
return;
|
||||
}
|
||||
if (payDetail.getAccountType().equals("WALLET")) {
|
||||
printer.appendPrnStr("PAYMENT NAME: QR", fontNormal, AlignEnum.LEFT,false);
|
||||
// printer.appendPrnStr("PAYMENT NAME: PAY BY QR", fontNormal, AlignEnum.LEFT,false);
|
||||
printString("TYPE : " + "PAY BY QR");
|
||||
} else {
|
||||
printer.appendPrnStr("CARD NAME:" + payDetail.getAccountType(), fontNormal, AlignEnum.LEFT,false);
|
||||
}
|
||||
// printer.appendPrnStr(" " + "COUNT " + " " + " TOTAL", fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("COUNT", "TOTAL", fontNormal, false);
|
||||
// printer.appendPrnStr("COUNT", "TOTAL", fontNormal, false);
|
||||
// printer.printColumnsString(new String[]{"", "COUNT", "TOTAL"}, new int[]{2,1, 1}, new int[]{ 2,1, 2}, innerResultCallback);
|
||||
// emptyLine(1);
|
||||
if (settleData.getSaleCount() > 0)
|
||||
printColumnString("SALES", settleData.getSaleCount(), settleData.getSaleAmount(), false);
|
||||
// printer.appendPrnStr("SALES "+ countStringFormat(settleData.getSaleCount())+MMK+" "+ PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getSaleAmount()), fontNormal, AlignEnum.LEFT,false);
|
||||
if (settleData.getVoidSaleCount() > 0)
|
||||
printColumnString("VOID SALES", settleData.getVoidSaleCount(), settleData.getVoidSaleAmount(), true);
|
||||
if (settleData.getCashAdvanceCount() > 0)
|
||||
printColumnString("CASH OUT", settleData.getCashAdvanceCount(), settleData.getCashAdvanceAmount(), false);
|
||||
if (settleData.getPreAuthCount() > 0)
|
||||
printColumnString("PRE AUTH", settleData.getPreAuthCount(), settleData.getPreAuthAmount(), false);
|
||||
if (settleData.getPreAuthVoidCount() > 0)
|
||||
printColumnString("VOID PREAUTH", settleData.getPreAuthVoidCount(), settleData.getPreAuthVoidAmount(), true);
|
||||
if (settleData.getRefundCount() > 0)
|
||||
printColumnString("REFUND", settleData.getRefundCount(), settleData.getRefundAmount(), true);
|
||||
if (settleData.getPreAuthCompCount() > 0)
|
||||
printColumnString("PREAUTH COMP", settleData.getPreAuthCompCount(), settleData.getPreAuthCompAmount(), false);
|
||||
if (settleData.getPreAuthCompVoidCount() > 0)
|
||||
printColumnString("VOID PREAUTH COMPLETE", settleData.getPreAuthCompVoidCount(), settleData.getPreAuthCompVoidAmount(), true);
|
||||
if (settleData.getWavePayCount() > 0){
|
||||
// printColumnString("QR PAY", settleData.getWavePayCount(), settleData.getWavePayAmount(), false);
|
||||
printer.appendPrnStr( "QR PAY " + countStringFormat(settleData.getWavePayCount()) + " " + "MMK" , PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getWavePayAmount(), isQrDecimalEnabled) , fontNormal, false);
|
||||
}
|
||||
if (settleData.getWaveRefundCount() > 0) {
|
||||
// printColumnString("QR REFUND", settleData.getWaveRefundCount(), settleData.getWaveRefundAmount(), true);
|
||||
printer.appendPrnStr( "QR REFUND " + countStringFormat(settleData.getWaveRefundCount()) + " " + "MMK" , PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getWaveRefundAmount(), isQrDecimalEnabled) , fontNormal, false);
|
||||
}
|
||||
dashBreak();
|
||||
// printColumnString("TOTAL", totalCount, totalAmount, false);
|
||||
printer.appendPrnStr( "TOTAL " + countStringFormat(totalCount) + " " + "MMK", PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, isQrDecimalEnabled) , fontNormal, false);
|
||||
emptyLine(1);
|
||||
|
||||
printer.appendPrnStr("(COUNT)TRANS", "AMOUNT(MMK)", fontNormal, false);
|
||||
|
||||
printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("GRAND TOTAL", fontNormal, AlignEnum.LEFT,false);
|
||||
// printer.appendPrnStr(" " + "COUNT " + " " + " TOTAL", fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("COUNT", "TOTAL", fontNormal, false);
|
||||
// printer.printColumnsString(new String[]{"", "COUNT", "TOTAL"}, new int[]{2,1, 1}, new int[]{ 2,1, 2}, innerResultCallback);
|
||||
// emptyLine(1);
|
||||
if (settleData.getSaleCount() > 0)
|
||||
printColumnString("SALES", settleData.getSaleCount(), settleData.getSaleAmount(), false);
|
||||
// printer.appendPrnStr("SALES "+ countStringFormat(settleData.getSaleCount())+MMK+" "+ PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getSaleAmount()), fontNormal, AlignEnum.LEFT,false);
|
||||
@ -630,17 +545,56 @@ public abstract class BaseXPrint {
|
||||
printColumnString("PREAUTH COMP", settleData.getPreAuthCompCount(), settleData.getPreAuthCompAmount(), false);
|
||||
if (settleData.getPreAuthCompVoidCount() > 0)
|
||||
printColumnString("VOID PREAUTH COMPLETE", settleData.getPreAuthCompVoidCount(), settleData.getPreAuthCompVoidAmount(), true);
|
||||
if (settleData.getWavePayCount() > 0) {
|
||||
if (settleData.getWavePayCount() >= 0){
|
||||
// printColumnString("QR PAY", settleData.getWavePayCount(), settleData.getWavePayAmount(), false);
|
||||
printer.appendPrnStr( "QR PAY " + countStringFormat(settleData.getWavePayCount()) + " " + "MMK" , PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getWavePayAmount(), isQrDecimalEnabled) , fontNormal, false);
|
||||
// printer.appendPrnStr( "QR PAY " + countStringFormat(settleData.getWavePayCount()) + " " + "MMK" , PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getWavePayAmount(), isQrDecimalEnabled) , fontNormal, false);
|
||||
printer.appendPrnStr( "(" + settleData.getWavePayCount() + ")" + "QR PAY" , PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getWavePayAmount(), isQrDecimalEnabled) , fontNormal, false);
|
||||
}
|
||||
if (settleData.getWaveRefundCount() > 0){
|
||||
if (settleData.getWaveRefundCount() >= 0) {
|
||||
// printColumnString("QR REFUND", settleData.getWaveRefundCount(), settleData.getWaveRefundAmount(), true);
|
||||
printer.appendPrnStr( "QR REFUND " + countStringFormat(settleData.getWaveRefundCount()) + " " + "MMK" , PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getWaveRefundAmount(), isQrDecimalEnabled) , fontNormal, false);
|
||||
// printer.appendPrnStr( "QR REFUND " + countStringFormat(settleData.getWaveRefundCount()) + " " + "MMK" , PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getWaveRefundAmount(), isQrDecimalEnabled) , fontNormal, false);
|
||||
printer.appendPrnStr( "(" + settleData.getWaveRefundCount() + ")" + "QR REFUND", "- " + PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getWaveRefundAmount(), isQrDecimalEnabled) , fontNormal, false);
|
||||
}
|
||||
dashBreak();
|
||||
// dashBreak();
|
||||
dotBreak();
|
||||
// printColumnString("TOTAL", totalCount, totalAmount, false);
|
||||
printer.appendPrnStr( "TOTAL " + countStringFormat(totalCount) + " " + "MMK", PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, isQrDecimalEnabled) , fontNormal, false);
|
||||
// printer.appendPrnStr( "TOTAL " + countStringFormat(totalCount) + " " + "MMK", PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, isQrDecimalEnabled) , fontNormal, false);
|
||||
printer.appendPrnStr( "TOTAL", PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, isQrDecimalEnabled) , fontNormal, false);
|
||||
|
||||
// printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
|
||||
// printer.appendPrnStr("GRAND TOTAL", fontNormal, AlignEnum.LEFT,false);
|
||||
//// printer.appendPrnStr(" " + "COUNT " + " " + " TOTAL", fontNormal, AlignEnum.LEFT,false);
|
||||
// printer.appendPrnStr("COUNT", "TOTAL", fontNormal, false);
|
||||
//// printer.printColumnsString(new String[]{"", "COUNT", "TOTAL"}, new int[]{2,1, 1}, new int[]{ 2,1, 2}, innerResultCallback);
|
||||
//// emptyLine(1);
|
||||
// if (settleData.getSaleCount() > 0)
|
||||
// printColumnString("SALES", settleData.getSaleCount(), settleData.getSaleAmount(), false);
|
||||
//// printer.appendPrnStr("SALES "+ countStringFormat(settleData.getSaleCount())+MMK+" "+ PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getSaleAmount()), fontNormal, AlignEnum.LEFT,false);
|
||||
// if (settleData.getVoidSaleCount() > 0)
|
||||
// printColumnString("VOID SALES", settleData.getVoidSaleCount(), settleData.getVoidSaleAmount(), true);
|
||||
// if (settleData.getCashAdvanceCount() > 0)
|
||||
// printColumnString("CASH OUT", settleData.getCashAdvanceCount(), settleData.getCashAdvanceAmount(), false);
|
||||
// if (settleData.getPreAuthCount() > 0)
|
||||
// printColumnString("PRE AUTH", settleData.getPreAuthCount(), settleData.getPreAuthAmount(), false);
|
||||
// if (settleData.getPreAuthVoidCount() > 0)
|
||||
// printColumnString("VOID PREAUTH", settleData.getPreAuthVoidCount(), settleData.getPreAuthVoidAmount(), true);
|
||||
// if (settleData.getRefundCount() > 0)
|
||||
// printColumnString("REFUND", settleData.getRefundCount(), settleData.getRefundAmount(), true);
|
||||
// if (settleData.getPreAuthCompCount() > 0)
|
||||
// printColumnString("PREAUTH COMP", settleData.getPreAuthCompCount(), settleData.getPreAuthCompAmount(), false);
|
||||
// if (settleData.getPreAuthCompVoidCount() > 0)
|
||||
// printColumnString("VOID PREAUTH COMPLETE", settleData.getPreAuthCompVoidCount(), settleData.getPreAuthCompVoidAmount(), true);
|
||||
// if (settleData.getWavePayCount() > 0) {
|
||||
//// printColumnString("QR PAY", settleData.getWavePayCount(), settleData.getWavePayAmount(), false);
|
||||
// printer.appendPrnStr( "QR PAY " + countStringFormat(settleData.getWavePayCount()) + " " + "MMK" , PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getWavePayAmount(), isQrDecimalEnabled) , fontNormal, false);
|
||||
// }
|
||||
// if (settleData.getWaveRefundCount() > 0){
|
||||
//// printColumnString("QR REFUND", settleData.getWaveRefundCount(), settleData.getWaveRefundAmount(), true);
|
||||
// printer.appendPrnStr( "QR REFUND " + countStringFormat(settleData.getWaveRefundCount()) + " " + "MMK" , PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getWaveRefundAmount(), isQrDecimalEnabled) , fontNormal, false);
|
||||
// }
|
||||
// dashBreak();
|
||||
//// printColumnString("TOTAL", totalCount, totalAmount, false);
|
||||
// printer.appendPrnStr( "TOTAL " + countStringFormat(totalCount) + " " + "MMK", PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, isQrDecimalEnabled) , fontNormal, false);
|
||||
|
||||
|
||||
// printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
|
||||
@ -699,17 +653,6 @@ public abstract class BaseXPrint {
|
||||
printer.appendPrnStr(first + " " + second, fontNormal, AlignEnum.LEFT,false);
|
||||
}
|
||||
|
||||
protected void print2SideString(String first, String second) {
|
||||
printer.appendPrnStr(first,second, fontLarge,true);
|
||||
}
|
||||
|
||||
protected void print2SideStringMargin(String first, String second) {
|
||||
LineOptionEntity lineOption = new LineOptionEntity();
|
||||
lineOption.setMarginLeft(2);
|
||||
lineOption.setUnderline(false);
|
||||
printer.appendPrnStr(first,second, fontNormal, lineOption);
|
||||
}
|
||||
|
||||
protected void print2ColumnsStringNoSpace(String first, String second) {
|
||||
printer.appendPrnStr(first + " " + second, fontNormal, AlignEnum.LEFT,false);
|
||||
}
|
||||
@ -727,9 +670,11 @@ public abstract class BaseXPrint {
|
||||
}
|
||||
|
||||
protected void print2ColumnsStringBoldCenter(String first, String second, int fontSize, AlignEnum align) {
|
||||
printer.appendPrnStr(first + " " + second, fontSize, align,true);
|
||||
printer.appendPrnStr(first + " " + second, fontSize, align,true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void print3ColumnsString(String first, String second, String third) {
|
||||
// printer.appendPrnStr(first + " " + second + " " + third, fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr(first + " " + second + " " + third, fontNormal, AlignEnum.LEFT,false);
|
||||
@ -750,23 +695,22 @@ public abstract class BaseXPrint {
|
||||
print2ColumnsString("AMOUNT", "");
|
||||
print2ColumnsString("REF NUM", "");
|
||||
} else if (hostType == HostType.QR) {
|
||||
print2ColumnsString("PAYMENT NAME", "");
|
||||
print2ColumnsString("DATE", "TIME");
|
||||
print2ColumnsString("TRANSACTION", "TRACE NO");
|
||||
print2ColumnsString("TRXN ID", "");
|
||||
print2ColumnsString("AMOUNT", "");
|
||||
// print2ColumnsString("PAYMENT NAME", "");
|
||||
// print2ColumnsString("DATE", "TIME");
|
||||
// print2ColumnsString("TRANSACTION", "TRACE NO");
|
||||
// print2ColumnsString("TRXN ID", "");
|
||||
// print2ColumnsString("AMOUNT", "");
|
||||
}
|
||||
|
||||
|
||||
// breakingLine();
|
||||
lineBreak();
|
||||
|
||||
long totalAmount = 0;
|
||||
|
||||
for (PayDetail pay : lists) {
|
||||
|
||||
boolean isNeedMinusSign = pay.getTransactionType() == TransactionsType.VOID.value || pay.getTransactionType() == TransactionsType.REFUND.value || pay.getTransactionType() == TransactionsType.MMQR_REFUND.value;
|
||||
boolean isDecimalEnabled = SystemParamsOperation.getInstance().isQrDecimalEnable();
|
||||
|
||||
if (hostType == HostType.MPU || hostType == HostType.VISA_MASTER) {
|
||||
print2ColumnsString(pay.getAccountType(), PrintUtils.getInstance().maskCardNumberPciDss(pay.getCardNo()));
|
||||
print2ColumnsString("**/**", pay.getVoucherNo());
|
||||
@ -774,20 +718,43 @@ public abstract class BaseXPrint {
|
||||
print2ColumnsString(pay.getReferNo(), "");
|
||||
|
||||
} else if (hostType == HostType.QR) {
|
||||
|
||||
printString("TRANS ID:" + pay.getQrTransId());
|
||||
printString("STATUS :" + pay.getTC());
|
||||
printString("SOURCE :" +
|
||||
(pay.getTransactionType() == TransactionsType.MMQR_REFUND.value
|
||||
? "QR PAYMENT"
|
||||
: pay.getCustomerMobile())
|
||||
);
|
||||
// printString("TXN NAME:" + pay.getTransType().replace("_", " "));
|
||||
printString("DATE :" + POSUtil.getInstance().formatDisplayDate(pay.getTransDate()) + " " + pay.getTransTime());
|
||||
printString("TRACE NO:" + pay.getVoucherNo());
|
||||
if (pay.getTransactionType() == TransactionsType.MMQR_REFUND.value) {
|
||||
print2ColumnsString("QR PAYMENT", "");
|
||||
} else {
|
||||
print2ColumnsString(pay.getCustomerMobile(), "");
|
||||
}
|
||||
print2ColumnsString(pay.getTransDate(), pay.getTransTime());
|
||||
print2ColumnsString(pay.getTransType().replace("_", " "), pay.getVoucherNo());
|
||||
if (pay.getTransactionType() == TransactionsType.MMQR_REFUND.value) {
|
||||
print2ColumnsString(pay.getReferNo() + "(RRN)", "");
|
||||
print2ColumnsString(isNeedMinusSign ? "-" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled) : "" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled), "");
|
||||
} else {
|
||||
print2ColumnsString(pay.getQrTransId(), "");
|
||||
print2ColumnsString(isNeedMinusSign ? "-" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled) : "" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled) , "");
|
||||
printString("RRN :" + pay.getReferNo());
|
||||
}
|
||||
printString("AMOUNT :" +
|
||||
(isNeedMinusSign
|
||||
? "-" + PrintUtils.getInstance()
|
||||
.getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled)
|
||||
: PrintUtils.getInstance()
|
||||
.getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled))
|
||||
+ " " +"MMK");
|
||||
dotBreak();
|
||||
|
||||
// if (pay.getTransactionType() == TransactionsType.MMQR_REFUND.value) {
|
||||
// print2ColumnsString("QR PAYMENT", "");
|
||||
// } else {
|
||||
// print2ColumnsString(pay.getCustomerMobile(), "");
|
||||
// }
|
||||
// print2ColumnsString(pay.getTransDate(), pay.getTransTime());
|
||||
// print2ColumnsString(pay.getTransType().replace("_", " "), pay.getVoucherNo());
|
||||
// if (pay.getTransactionType() == TransactionsType.MMQR_REFUND.value) {
|
||||
// print2ColumnsString(pay.getReferNo() + "(RRN)", "");
|
||||
// print2ColumnsString(isNeedMinusSign ? "-" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled) : "" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled), "");
|
||||
// } else {
|
||||
// print2ColumnsString(pay.getQrTransId(), "");
|
||||
// print2ColumnsString(isNeedMinusSign ? "-" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled) : "" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled) , "");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -852,6 +819,8 @@ public abstract class BaseXPrint {
|
||||
print2ColumnsString("Refund Total:MMK", PrintUtils.getInstance().getSeparatorOnlyNumberFormat(refundTotal));
|
||||
dashBreak();
|
||||
print2ColumnsString("Sale Total :MMK", PrintUtils.getInstance().getSeparatorOnlyNumberFormat(totalAmount));
|
||||
dashBreak();
|
||||
print2ColumnsString("Grand Total :MMK", PrintUtils.getInstance().getSeparatorOnlyNumberFormat(totalAmount - refundTotal));
|
||||
dashBreakEnding();
|
||||
// emptyLine(2);
|
||||
|
||||
@ -995,7 +964,7 @@ public abstract class BaseXPrint {
|
||||
// merchantPhoneNo = "MERCHANT PHONENO";
|
||||
// }
|
||||
if(TextUtils.equals(terminalName, "") || terminalName == null){
|
||||
terminalName = "Terminal Name";
|
||||
terminalName = "";
|
||||
}
|
||||
// emptyLine(1);
|
||||
// printer.appendPrnStr(receiptHeader, fontNormal, AlignEnum.CENTER,false);
|
||||
@ -1005,14 +974,14 @@ public abstract class BaseXPrint {
|
||||
printer.appendPrnStr(merchantAddress3, fontNormal, AlignEnum.CENTER,false);
|
||||
// printer.appendPrnStr(merchantPhoneNo, fontNormal, AlignEnum.CENTER,false);
|
||||
// emptyLine(1);
|
||||
// dashBreak();
|
||||
lineBreak();
|
||||
dotBreak();
|
||||
}
|
||||
|
||||
protected void printKeyInfo() {
|
||||
try {
|
||||
String keyIndex = SystemParamsOperation.getInstance().getTMKIndex();
|
||||
byte[] ksnData = new byte[10];
|
||||
int result = PayLibNex.getInstance().deviceEngine.getPinPad().getRandomNum(ksnData);
|
||||
int result = PayLibsUtils.getInstance().securityOptV2.dukptCurrentKSN(Integer.parseInt(keyIndex), ksnData);
|
||||
|
||||
String ksn = ByteUtil.bytes2HexStr(ksnData);
|
||||
|
||||
@ -1025,7 +994,9 @@ public abstract class BaseXPrint {
|
||||
lineBreak();
|
||||
emptyLine(4);
|
||||
|
||||
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1057,57 +1028,34 @@ public abstract class BaseXPrint {
|
||||
String transType = payDetail.getTransType();
|
||||
String batchNum = "";
|
||||
String traceNum = payDetail.getVoucherNo();
|
||||
|
||||
String currencySign = currencyCodeToText(payDetail.getCurrencyCode());
|
||||
boolean isSettlement = payDetail.getTransactionType() == TransactionsType.SETTLEMENT.value;
|
||||
boolean isCardTransaction = !payDetail.getTransType().equals(SETTLEMENT) && !payDetail.getTransType().equals(SUMMARY) && payDetail.getTransactionType() != TransactionsType.MMQR_REFUND.value && payDetail.getTransactionType() != TransactionsType.MMQR.value;
|
||||
// String traceNum = SystemParamsOperation.getInstance().getCurrentSerialNum();
|
||||
|
||||
|
||||
|
||||
batchNum = payDetail.getBatchNo();
|
||||
|
||||
if(isCardTransaction) {
|
||||
printer.appendPrnStr("DATE :" + payDetail.getTransDate() + " TIME:" + payDetail.getTransTime(), fontNormal, AlignEnum.LEFT,false);
|
||||
} else {
|
||||
printer.appendPrnStr("DATE :" + POSUtil.getInstance().formatDisplayDate(payDetail.getTransDate()), fontNormal, AlignEnum.LEFT, false);
|
||||
printer.appendPrnStr("TIME :" + payDetail.getTransTime(), fontNormal, AlignEnum.LEFT, false);
|
||||
}
|
||||
|
||||
|
||||
// printer.appendPrnStr("DATE :" + payDetail.getTransDate() + " TIME:" + payDetail.getTransTime(), fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("DATE :" + POSUtil.getInstance().formatDisplayDate(payDetail.getTransDate()), fontNormal, AlignEnum.LEFT, false);
|
||||
printer.appendPrnStr("TIME :" + payDetail.getTransTime(), fontNormal, AlignEnum.LEFT, false);
|
||||
if (payDetail.getTransactionType() == TransactionsType.MMQR.value && payDetail.getQrTransStatus() == 1) {
|
||||
// printer.appendPrnStr("TRACE NO:" + traceNum + " INV NO:" + invoiceNo, fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("INV NO :" + invoiceNo , fontNormal, AlignEnum.LEFT,false);
|
||||
} else if (isCardTransaction) {
|
||||
printer.appendPrnStr("BTH NO :" + batchNum + " INV NO:" + invoiceNo, fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("INV NO :" + invoiceNo , fontNormal, AlignEnum.LEFT,false);
|
||||
} else if (!payDetail.getTransType().equals(SETTLEMENT) && !payDetail.getTransType().equals(SUMMARY) && payDetail.getTransactionType() != TransactionsType.MMQR_REFUND.value && payDetail.getTransactionType() != TransactionsType.MMQR.value) {
|
||||
printer.appendPrnStr("BTH NO :" + batchNum + " INV NO:" + invoiceNo, fontNormal, AlignEnum.LEFT,false);
|
||||
} else if (payDetail.getTransType().equals(SUMMARY)) {
|
||||
printer.appendPrnStr("HOST :" + HOST_NAME_MPU + "", fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("HOST :" + HOST_NAME_MPU + "", fontNormal, AlignEnum.LEFT,false);
|
||||
}
|
||||
/* 17 Sept 2024 Yoma requested to changed slip design for QR*/
|
||||
// printer.printColumnsString(new String[]{"MID :" + payDetail.getMerchantNo(), ""}, new int[]{3, 1}, new int[]{0, 2}, innerResultCallback);
|
||||
// printer.printColumnsString(new String[]{"TID :" + payDetail.getTerminalNo(), ""}, new int[]{3, 1}, new int[]{0, 2}, innerResultCallback);
|
||||
if (payDetail.getTransactionType() == TransactionsType.MMQR.value || payDetail.getTransactionType() == TransactionsType.MMQR_REFUND.value){
|
||||
printer.appendPrnStr("SHORT CODE:" + payDetail.getMerchantNo(), fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("SHORT CODE :" + payDetail.getMerchantNo(), fontNormal, AlignEnum.LEFT,false);
|
||||
}else{
|
||||
printer.appendPrnStr("TID :" + payDetail.getTerminalNo(), fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("MID :" + payDetail.getMerchantNo(), fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("MID :" + payDetail.getMerchantNo(), fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("TID :" + payDetail.getTerminalNo(), fontNormal, AlignEnum.LEFT,false);
|
||||
}
|
||||
|
||||
if(isSettlement) {
|
||||
|
||||
printer.appendPrnStr("BATCH :" + batchNum, fontNormal, AlignEnum.LEFT,false);
|
||||
printer.appendPrnStr("HOST :" + "KBZ Bank "+currencySign, fontNormal, AlignEnum.LEFT,false);
|
||||
|
||||
}
|
||||
|
||||
if(isCardTransaction) {
|
||||
lineBreak();
|
||||
} else {
|
||||
emptyLine(1);
|
||||
}
|
||||
|
||||
|
||||
emptyLine(1);
|
||||
printer.appendPrnStr(transType.replace("_", " "),fontNormal, AlignEnum.CENTER,true);
|
||||
// printer.appendPrnStr("TRAN TYPE :" + transType.replace("_", " "),fontNormal, AlignEnum.LEFT,false);
|
||||
|
||||
if (!(payDetail.getQrTransStatus() != 1 && (payDetail.getTransactionType() == TransactionsType.MMQR_REFUND.value || payDetail.getTransactionType() == TransactionsType.MMQR.value))) {
|
||||
// printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
|
||||
@ -1115,6 +1063,36 @@ public abstract class BaseXPrint {
|
||||
|
||||
}
|
||||
|
||||
protected void printDetailReportHeader(){
|
||||
SimpleDateFormat date = new SimpleDateFormat("dd MMM yyyy", Locale.getDefault());
|
||||
String printedDate = date.format(new Date());
|
||||
|
||||
SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
|
||||
String printedTime = time.format(new Date());
|
||||
|
||||
printer.appendPrnStr("PRINTED DATE", printedDate, fontNormal, false);
|
||||
printer.appendPrnStr("", printedTime, fontNormal, false);
|
||||
printer.appendPrnStr("DETAIL REPORT", fontNormal , AlignEnum.CENTER, false);
|
||||
dotBreak();
|
||||
}
|
||||
|
||||
protected void printTranHeader(String title){
|
||||
SimpleDateFormat date = new SimpleDateFormat("dd MMM yyyy", Locale.getDefault());
|
||||
String printedDate = date.format(new Date());
|
||||
|
||||
SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
|
||||
String printedTime = time.format(new Date());
|
||||
|
||||
printer.appendPrnStr("PRINTED DATE", printedDate, fontNormal, false);
|
||||
printer.appendPrnStr("", printedTime, fontNormal, false);
|
||||
printer.appendPrnStr(title, fontNormal , AlignEnum.CENTER, false);
|
||||
|
||||
// if (payDetail.getTransactionType() == TransactionsType.MMQR.value && payDetail.getQrTransStatus() == 1) {
|
||||
//// printer.appendPrnStr("TRACE NO:" + traceNum + " INV NO:" + invoiceNo, fontNormal, AlignEnum.LEFT,false);
|
||||
// printer.appendPrnStr("INV NO :" + invoiceNo , fontNormal, AlignEnum.LEFT,false);
|
||||
// }
|
||||
dotBreak();
|
||||
}
|
||||
protected void printTransHeader(PayDetail payDetail, HostType hostType) {
|
||||
String invoiceNo = payDetail.getInvoiceNo().isEmpty() ? SystemParamsOperation.getInstance().getCurrentInvoiceNum() : payDetail.getInvoiceNo();
|
||||
String transType = payDetail.getTransType();
|
||||
@ -1205,11 +1183,11 @@ public abstract class BaseXPrint {
|
||||
printer.appendPrnStr("Secondary Ip : " + secIpPort[0], fontNormal, AlignEnum.LEFT, false);
|
||||
printer.appendPrnStr("Secondary Port: " + secIpPort[1], fontNormal, AlignEnum.LEFT, false);
|
||||
printer.appendPrnStr("Currency Code : " + sp.getCurrencyType(), fontNormal, AlignEnum.LEFT, false);
|
||||
lineBreak();
|
||||
dotBreak();
|
||||
// ---------- SECONDARY HOST (optional) ----------
|
||||
if (!TextUtils.isEmpty(sp.getSecHostName())) {
|
||||
printer.appendPrnStr("SECONDARY HOST", fontNormal, AlignEnum.LEFT, true);
|
||||
printer.appendPrnStr("Name : " + sp.getSecHostName(), fontNormal, AlignEnum.LEFT, false);
|
||||
printer.appendPrnStr("Name : " + sp.getSecHostName(), fontNormal, AlignEnum.LEFT, false);
|
||||
printer.appendPrnStr("SHORT CODE : " + sp.getShortCode(), fontNormal, AlignEnum.LEFT, false);
|
||||
String[] secHostIp = splitIpAndPort(sp.getSecHostIpAddress());
|
||||
printer.appendPrnStr("Primary Ip : " + secHostIp[0], fontNormal, AlignEnum.LEFT, false);
|
||||
@ -1218,17 +1196,17 @@ public abstract class BaseXPrint {
|
||||
printer.appendPrnStr("Secondary Ip : " + secHostSecIp[0], fontNormal, AlignEnum.LEFT, false);
|
||||
printer.appendPrnStr("Secondary Port: " + secHostSecIp[1], fontNormal, AlignEnum.LEFT, false);
|
||||
printer.appendPrnStr("Currency Code : " + sp.getCurrencyType(), fontNormal, AlignEnum.LEFT, false);
|
||||
lineBreak();
|
||||
dotBreak();
|
||||
printer.appendPrnStr("App Version : " + getAppVersion(), fontNormal, AlignEnum.LEFT, false);
|
||||
}
|
||||
}
|
||||
|
||||
private String getAppVersion() {
|
||||
try {
|
||||
return PayLibNex.getInstance().context
|
||||
return PayLibsUtils.getInstance().context
|
||||
.getPackageManager()
|
||||
.getPackageInfo(
|
||||
PayLibNex.getInstance().context.getPackageName(),
|
||||
PayLibsUtils.getInstance().context.getPackageName(),
|
||||
0
|
||||
)
|
||||
.versionName;
|
||||
|
||||
@ -7,6 +7,7 @@ import android.os.RemoteException;
|
||||
import com.nexgo.oaf.apiv3.device.printer.AlignEnum;
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.PayLibNex;
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
import com.utsmyanmar.paylibs.R;
|
||||
import com.utsmyanmar.paylibs.isobuilder.ISOMode;
|
||||
import com.utsmyanmar.paylibs.isobuilder.builderx.ISOMsgX;
|
||||
@ -35,7 +36,7 @@ public class PrintXImpl extends BaseXPrint implements PrintX {
|
||||
private static final String TAG = PrintXImpl.class.getSimpleName();
|
||||
|
||||
PrintXImpl() {
|
||||
Resources resources = PayLibNex.getInstance().context.getResources();
|
||||
Resources resources = PayLibsUtils.getInstance().context.getResources();
|
||||
printer = PayLibNex.getInstance().deviceEngine.getPrinter();
|
||||
SimpleDateFormat dfm = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss", Locale.getDefault());
|
||||
currentTime = dfm.format(new Date());
|
||||
@ -192,8 +193,7 @@ public class PrintXImpl extends BaseXPrint implements PrintX {
|
||||
printLogo();
|
||||
printMerchantHeader();
|
||||
printTransHeader(payDetail);
|
||||
// printTransDetailSettlement(payDetail);
|
||||
printTransDetailSettlement(payDetail,payDetail.getCardSettleData());
|
||||
printTransDetailSettlement(payDetail);
|
||||
printTransFooterSummary();
|
||||
|
||||
emptyLine(1);
|
||||
@ -261,6 +261,7 @@ public class PrintXImpl extends BaseXPrint implements PrintX {
|
||||
|
||||
setHeight(0x12);
|
||||
printLogo();
|
||||
|
||||
printMerchantHeader();
|
||||
printTransHeader(payDetail);
|
||||
printTransDetail(payDetail);
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
package com.utsmyanmar.paylibs.sign_on;
|
||||
|
||||
import android.os.RemoteException;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.nexgo.oaf.apiv3.device.pinpad.WorkKeyTypeEnum;
|
||||
import com.sunmi.pay.hardware.aidlv2.AidlConstantsV2;
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.PayLibNex;
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
import com.utsmyanmar.paylibs.isobuilder.ISOMode;
|
||||
import com.utsmyanmar.paylibs.isobuilder.ISOMsgBuilder;
|
||||
import com.utsmyanmar.paylibs.isobuilder.builderx.ISOMsgX;
|
||||
import com.utsmyanmar.paylibs.isobuilder.builderx.ISOVersion;
|
||||
import com.utsmyanmar.paylibs.model.MsgField;
|
||||
|
||||
@ -2,6 +2,7 @@ package com.utsmyanmar.paylibs.sign_on;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||
import com.utsmyanmar.paylibs.batch_upload.BatchListener;
|
||||
import com.utsmyanmar.paylibs.batch_upload.BatchUploadProcess;
|
||||
import com.utsmyanmar.paylibs.isobuilder.ISOMsgBuilder;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.utsmyanmar.paylibs.system;
|
||||
|
||||
|
||||
import com.utsmyanmar.paylibs.PayLibNex;
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
import com.utsmyanmar.paylibs.R;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -49,7 +49,7 @@ public class BaseErrorCode {
|
||||
private Map<String, String> errorCode = new HashMap<>();
|
||||
|
||||
private static String getString(int id) {
|
||||
return PayLibNex.getInstance().context.getString(id);
|
||||
return PayLibsUtils.getInstance().context.getString(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
|
||||
|
||||
public class NetworkHelper {
|
||||
|
||||
@ -5,8 +5,10 @@ import android.text.TextUtils;
|
||||
|
||||
import com.nexgo.oaf.apiv3.SdkResult;
|
||||
import com.nexgo.oaf.apiv3.emv.EmvOnlineResultEntity;
|
||||
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.PayLibNex;
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
import com.utsmyanmar.paylibs.isobuilder.ISOMode;
|
||||
import com.utsmyanmar.paylibs.isobuilder.builderx.ISOMsgX;
|
||||
import com.utsmyanmar.paylibs.isobuilder.builderx.ISOVersion;
|
||||
@ -16,12 +18,12 @@ import com.utsmyanmar.paylibs.model.TradeData;
|
||||
import com.utsmyanmar.paylibs.model.enums.TransCVM;
|
||||
import com.utsmyanmar.paylibs.network.ISOCallback;
|
||||
import com.utsmyanmar.paylibs.network.ISOSocket;
|
||||
import com.utsmyanmar.paylibs.network.exception.ReversalException;
|
||||
import com.utsmyanmar.paylibs.system.SystemDateTime;
|
||||
import com.utsmyanmar.paylibs.utils.AuthorizationProcessUtil;
|
||||
import com.utsmyanmar.paylibs.utils.MessageType;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
import com.utsmyanmar.paylibs.utils.enums.BaseCardType;
|
||||
import com.utsmyanmar.paylibs.utils.enums.HostName;
|
||||
import com.utsmyanmar.paylibs.utils.host_utils.HostUtils;
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||
@ -392,7 +394,7 @@ public class TransactionsOperation {
|
||||
|
||||
/*
|
||||
* new requirements */
|
||||
newPay.setCardType(BaseCardType.IC.getValue());
|
||||
newPay.setCardType(AidlConstants.CardType.IC.getValue());
|
||||
newPay.setPINCipher("55");
|
||||
newPay.setTransCVM(TransCVM.SIGNATURE);
|
||||
}
|
||||
@ -430,7 +432,7 @@ public class TransactionsOperation {
|
||||
HashMap<String, MsgField> resp = (responseMap instanceof HashMap) ? (HashMap<String, MsgField>) responseMap
|
||||
: new HashMap<>(responseMap);
|
||||
|
||||
if(BaseCardType.IC.getValue() == payDetail.getCardType() && responseMap.get("F055") != null) {
|
||||
if(AidlConstants.CardType.IC.getValue() == payDetail.getCardType() && responseMap.get("F055") != null) {
|
||||
AuthorizationProcessUtil.authorizationProcess(resp, payDetail);
|
||||
} else {
|
||||
boolean equals = TextUtils.equals(resultStr, Constant.ANSWER_CODE_ACCEPT) || TextUtils.equals(resultStr, Constant.ANSWER_CODE_APPROVED);
|
||||
|
||||
@ -4,8 +4,10 @@ import android.text.TextUtils;
|
||||
|
||||
import com.nexgo.oaf.apiv3.SdkResult;
|
||||
import com.nexgo.oaf.apiv3.emv.EmvOnlineResultEntity;
|
||||
import com.sunmi.pay.hardware.aidlv2.AidlConstantsV2;
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.PayLibNex;
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
import com.utsmyanmar.paylibs.model.MsgField;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||
@ -16,6 +18,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
|
||||
public class AuthorizationProcessUtil {
|
||||
|
||||
private static final String TAG = AuthorizationProcessUtil.class.getSimpleName();
|
||||
|
||||
@ -3,12 +3,12 @@ package com.utsmyanmar.paylibs.utils;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.R;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.system.BaseErrorCode;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
import com.utsmyanmar.paylibs.utils.enums.BaseCardType;
|
||||
import com.utsmyanmar.paylibs.utils.enums.InvalidAmount;
|
||||
import com.utsmyanmar.paylibs.utils.enums.TransMenu;
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||
@ -207,11 +207,11 @@ public class POSUtil {
|
||||
public String getEntryType(int cardType) {
|
||||
|
||||
String entryType = "-";
|
||||
if(BaseCardType.IC.getValue() == cardType) {
|
||||
if(AidlConstants.CardType.IC.getValue() == cardType) {
|
||||
entryType = "Chip";
|
||||
} else if(BaseCardType.MAGNETIC.getValue() == cardType) {
|
||||
} else if(AidlConstants.CardType.MAGNETIC.getValue() == cardType) {
|
||||
entryType = "MagStripe";
|
||||
} else if (BaseCardType.NFC.getValue() == cardType) {
|
||||
} else if (AidlConstants.CardType.NFC.getValue() == cardType) {
|
||||
entryType = "Wave";
|
||||
} else if (-1 == cardType) {
|
||||
entryType = "Manual";
|
||||
|
||||
@ -2,8 +2,10 @@ package com.utsmyanmar.paylibs.utils.core_utils;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||
import com.sunmi.pay.hardware.aidlv2.AidlConstantsV2;
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.model.BaseCardInfo;
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
import com.utsmyanmar.paylibs.model.CardInfo;
|
||||
import com.utsmyanmar.paylibs.model.ICCardInfo;
|
||||
import com.utsmyanmar.paylibs.model.MAGCardInfo;
|
||||
@ -12,10 +14,12 @@ import com.utsmyanmar.paylibs.model.TradeData;
|
||||
import com.utsmyanmar.paylibs.utils.CardSchemeUtils;
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
import com.utsmyanmar.paylibs.utils.TLV;
|
||||
import com.utsmyanmar.paylibs.utils.enums.BaseCardType;
|
||||
import com.utsmyanmar.paylibs.utils.enums.CardScheme;
|
||||
|
||||
import org.bouncycastle.pqc.math.linearalgebra.ByteUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@ -25,9 +29,9 @@ public class KernelDataProcessUtil {
|
||||
private static final String TAG = KernelDataProcessUtil.class.getSimpleName();
|
||||
|
||||
private static CardScheme cardScheme;
|
||||
public static BaseCardInfo getCardInfo(int cardType, byte[] data) {
|
||||
public static com.sunmi.pay.hardware.aidl.bean.CardInfo getCardInfo(int cardType, byte[] data) {
|
||||
Map<String, TLV> tlvMap = TLVUtil.buildTLVMap(data);
|
||||
BaseCardInfo cardInfo = new BaseCardInfo();
|
||||
com.sunmi.pay.hardware.aidl.bean.CardInfo cardInfo = new com.sunmi.pay.hardware.aidl.bean.CardInfo();
|
||||
|
||||
LogUtil.d(TAG, "EMV Track data : " + ByteUtil.bytes2HexStr(data));
|
||||
|
||||
@ -43,7 +47,7 @@ public class KernelDataProcessUtil {
|
||||
LogUtil.d(TAG, "57 track:" + cardInfo.track2);
|
||||
}
|
||||
// IC card obtains the card number and expiration date through 5A and 5F24
|
||||
if (BaseCardType.IC.getValue() == cardType) {
|
||||
if (AidlConstants.CardType.IC.getValue() == cardType) {
|
||||
|
||||
// card number
|
||||
tlv = tlvMap.get("5A");
|
||||
@ -97,7 +101,7 @@ public class KernelDataProcessUtil {
|
||||
return cardInfo;
|
||||
}
|
||||
|
||||
public static TradeData fillTradeDataInfo(BaseCardInfo cardInfo, TradeData tradeData) {
|
||||
public static TradeData fillTradeDataInfo(com.sunmi.pay.hardware.aidl.bean.CardInfo cardInfo, TradeData tradeData) {
|
||||
PayDetail payDetail = tradeData.getPayDetail();
|
||||
if (cardInfo.expireDate != null && cardInfo.expireDate.length() > 4) {
|
||||
cardInfo.expireDate = cardInfo.expireDate.substring(0, 4);
|
||||
@ -135,7 +139,7 @@ public class KernelDataProcessUtil {
|
||||
String track3Encrypt = TrackEncrypt.trackEncrypt(track3);
|
||||
magCardInfo.setTrack3Cipher(track3Encrypt);
|
||||
}
|
||||
if (BaseCardType.IC.getValue() == cardInfo.cardType) {
|
||||
if (AidlConstants.CardType.IC.getValue() == cardInfo.cardType) {
|
||||
magCardInfo.setIccCard(true);
|
||||
}
|
||||
magCardInfo.setExpireDate(cardInfo.expireDate);
|
||||
@ -252,7 +256,7 @@ public class KernelDataProcessUtil {
|
||||
// TVR Terminal verification result
|
||||
tlv = tlvMap.get("95");
|
||||
if (tlv != null && tlv.getValue() != null && tlv.getValue().length() > 0) {
|
||||
if (BaseCardType.NFC.getValue() == cardType) {
|
||||
if (AidlConstants.CardType.NFC.getValue() == cardType) {
|
||||
icCardInfo.setTVR("0000000000");
|
||||
payDetail.setTVR("0000000000");
|
||||
} else {
|
||||
@ -650,7 +654,7 @@ public class KernelDataProcessUtil {
|
||||
String len = getHexLen(length);
|
||||
f55DataStr += "9F08" + len + value;
|
||||
}*/
|
||||
if (cardType == BaseCardType.IC.getValue()) {
|
||||
if (cardType == AidlConstants.CardType.IC.getValue()) {
|
||||
icCardInfo.setICC55(f55DataStr);
|
||||
payDetail.setICC55(f55DataStr);
|
||||
LogUtil.d(TAG, "DE55 IC: " + f55DataStr);
|
||||
|
||||
@ -4,7 +4,7 @@ import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.utsmyanmar.paylibs.PayLibNex;
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
@ -27,7 +27,7 @@ public final class SharedPreferencesUtil {
|
||||
/** Read the saved object */
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends Serializable> T readObj(String key) {
|
||||
SharedPreferences spf = PayLibNex.getInstance().context.getSharedPreferences(
|
||||
SharedPreferences spf = PayLibsUtils.getInstance().context.getSharedPreferences(
|
||||
PREFERENCE_FILE_NAME, Context.MODE_PRIVATE);
|
||||
String replyBase64 = spf.getString(key, "");
|
||||
if (TextUtils.isEmpty(replyBase64)) {
|
||||
@ -55,7 +55,7 @@ public final class SharedPreferencesUtil {
|
||||
|
||||
/** Save an object */
|
||||
public static void saveObj(Serializable obj, String key) {
|
||||
SharedPreferences spf = PayLibNex.getInstance().context.getSharedPreferences(
|
||||
SharedPreferences spf = PayLibsUtils.getInstance().context.getSharedPreferences(
|
||||
PREFERENCE_FILE_NAME, Context.MODE_PRIVATE);
|
||||
ObjectOutputStream oos = null;
|
||||
try {
|
||||
@ -82,7 +82,7 @@ public final class SharedPreferencesUtil {
|
||||
* Clear the cache corresponding to a key
|
||||
*/
|
||||
public static void clearByKey(String key) {
|
||||
SharedPreferences pre = PayLibNex.getInstance().context.getSharedPreferences(
|
||||
SharedPreferences pre = PayLibsUtils.getInstance().context.getSharedPreferences(
|
||||
PREFERENCE_FILE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = pre.edit();
|
||||
editor.putString(key, "");
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package com.utsmyanmar.paylibs.utils.core_utils;
|
||||
|
||||
import com.sunmi.pay.hardware.aidl.bean.CardInfo;
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.utsmyanmar.paylibs.model.BaseCardInfo;
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
|
||||
public class Track2Util {
|
||||
@ -13,17 +13,17 @@ public class Track2Util {
|
||||
/**
|
||||
* Analyze two magnetic data
|
||||
*/
|
||||
public static BaseCardInfo parseTrack2(String track2) {
|
||||
public static CardInfo parseTrack2(String track2) {
|
||||
LogUtil.d(Constant.TAG, "track2:" + track2);
|
||||
if (track2 == null || track2.trim().length() < 13) {
|
||||
return new BaseCardInfo();
|
||||
return new CardInfo();
|
||||
}
|
||||
track2 = stringFilter(track2);
|
||||
int index = track2.indexOf("=");
|
||||
if (index == -1) {
|
||||
index = track2.indexOf("D");
|
||||
}
|
||||
BaseCardInfo cardInfo = new BaseCardInfo();
|
||||
CardInfo cardInfo = new CardInfo();
|
||||
if (index == -1) {
|
||||
return cardInfo;
|
||||
}
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
package com.utsmyanmar.paylibs.utils.enums;
|
||||
|
||||
public enum BaseCardType {
|
||||
|
||||
MAGNETIC(1),
|
||||
NFC(4),
|
||||
IC(2);
|
||||
|
||||
|
||||
|
||||
public final int value;
|
||||
private BaseCardType(int value){
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {return this.value; }
|
||||
}
|
||||
@ -2,12 +2,12 @@ package com.utsmyanmar.paylibs.utils.iso_utils;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.model.MsgField;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.model.TradeData;
|
||||
import com.utsmyanmar.paylibs.model.enums.TransCVM;
|
||||
import com.utsmyanmar.paylibs.utils.enums.BaseCardType;
|
||||
import com.utsmyanmar.paylibs.utils.enums.CardScheme;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
@ -334,11 +334,11 @@ public class FieldUtils {
|
||||
case 22: //POS Service Entry Mode
|
||||
|
||||
String value;
|
||||
if (BaseCardType.MAGNETIC.getValue() == cardType) { // 磁条
|
||||
if (AidlConstants.CardType.MAGNETIC.getValue() == cardType) { // 磁条
|
||||
value = "02";
|
||||
} else if (BaseCardType.NFC.getValue() == cardType) { // NFC
|
||||
} else if (AidlConstants.CardType.NFC.getValue() == cardType) { // NFC
|
||||
value = "07";
|
||||
} else if (BaseCardType.IC.getValue() == cardType) { // IC
|
||||
} else if (AidlConstants.CardType.IC.getValue() == cardType) { // IC
|
||||
value = "05";
|
||||
} else if (FALLBACK == cardType){ // Fallback
|
||||
value = "08";
|
||||
|
||||
@ -5,15 +5,15 @@ import java.io.Serializable;
|
||||
|
||||
public class TerminalKeyManagementBean implements Serializable {
|
||||
|
||||
|
||||
// 文件无变化
|
||||
private static final long serialVersionUID = 983318039413888606L;
|
||||
/**
|
||||
* Terminal key setting key
|
||||
* 终端密钥设置的key
|
||||
**/
|
||||
public final static String TERMINAL_KEY = "terminalKeySettings";
|
||||
|
||||
/**
|
||||
* Single DES
|
||||
* 单DES
|
||||
**/
|
||||
public final static String SINGLE_DES = "DES";
|
||||
|
||||
@ -22,14 +22,14 @@ public class TerminalKeyManagementBean implements Serializable {
|
||||
**/
|
||||
public final static String THREE_DES = "3DES";
|
||||
|
||||
public final static int IC_IMPORT_KEY1 = 1; // Universal
|
||||
public final static int IC_IMPORT_KEY2 = 2; // Shenzhen UnionPay
|
||||
public final static int IC_IMPORT_KEY1 = 1; // 通用
|
||||
public final static int IC_IMPORT_KEY2 = 2; // 深银联
|
||||
|
||||
private String terminalKeyIndex = "0"; // Terminal key index (default 0)
|
||||
private String terminalKeyIndex = "0"; // 终端密钥索引 默认0
|
||||
private String KEK; // KEK
|
||||
private String des = THREE_DES; // DES algorithm
|
||||
private int icImportKey; // 1. General 2. Import Key for Shenzhen UnionPay IC Card
|
||||
private boolean hasDownloadTMK = false; // Did you download TMK?
|
||||
private String des = THREE_DES; // DES算法
|
||||
private int icImportKey; // 1.通用2.深银联 IC卡导入密钥
|
||||
private boolean hasDownloadTMK = false; // 是否下载了TMK
|
||||
|
||||
public String getTerminalKeyIndex() {
|
||||
return terminalKeyIndex;
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
package com.utsmyanmar.paylibs.utils.secure;
|
||||
|
||||
import com.nexgo.oaf.apiv3.device.pinpad.MacAlgorithmModeEnum;
|
||||
import com.nexgo.oaf.apiv3.device.pinpad.PinPad;
|
||||
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||
import com.sunmi.pay.hardware.aidl.security.SecurityOpt;
|
||||
import com.sunmi.pay.hardware.aidlv2.AidlConstantsV2;
|
||||
import com.sunmi.pay.hardware.aidlv2.security.SecurityOptV2;
|
||||
import com.utsmyanmar.paylibs.Constant;
|
||||
import com.utsmyanmar.paylibs.PayLibNex;
|
||||
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
|
||||
import static com.sunmi.pay.hardware.aidl.AidlConstants.Security.KEY_ALG_TYPE_3DES;
|
||||
|
||||
public class TerminalSecure {
|
||||
|
||||
@ -33,17 +36,17 @@ public class TerminalSecure {
|
||||
+ "\n encryption type:3 \n \n" +
|
||||
"TMK cipher text:" + Arrays.toString(masterKeyEncrypted)
|
||||
+ "\n length:" + masterKeyEncrypted.length);
|
||||
// SecurityOpt securityOpt = PayLibsUtils.getInstance().securityOpt;
|
||||
SecurityOpt securityOpt = PayLibsUtils.getInstance().securityOpt;
|
||||
int result = -1;
|
||||
// try {
|
||||
// result = securityOpt.saveKey(AidlConstants.Security.KEY_TYPE_TMK, masterKeyEncrypted, null, KEKIndex, KEY_ALG_TYPE_3DES, TMKIndex, true);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// if (result == 0) {
|
||||
// TerminalKeyDataOperations terminalKeyDataOperations = TerminalKeyDataOperations.getInstance();
|
||||
// terminalKeyDataOperations.saveHasDownloadTMK(true);
|
||||
// }
|
||||
try {
|
||||
result = securityOpt.saveKey(AidlConstants.Security.KEY_TYPE_TMK, masterKeyEncrypted, null, KEKIndex, KEY_ALG_TYPE_3DES, TMKIndex, true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (result == 0) {
|
||||
TerminalKeyDataOperations terminalKeyDataOperations = TerminalKeyDataOperations.getInstance();
|
||||
terminalKeyDataOperations.saveHasDownloadTMK(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -54,41 +57,40 @@ public class TerminalSecure {
|
||||
+ "\n encryption type:3 \n \n" +
|
||||
"TMK cipher text:" + Arrays.toString(masterKeyEncrypted)
|
||||
+ "\n length:" + masterKeyEncrypted.length);
|
||||
// SecurityOpt securityOpt = PayLibsUtils.getInstance().securityOpt;
|
||||
SecurityOpt securityOpt = PayLibsUtils.getInstance().securityOpt;
|
||||
int result = -1;
|
||||
// try {
|
||||
// result = securityOpt.saveKey(AidlConstants.Security.KEY_TYPE_TMK, masterKeyEncrypted, cv, KEKIndex, KEY_ALG_TYPE_3DES, TMKIndex, true);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// if (result == 0) {
|
||||
// TerminalKeyDataOperations terminalKeyDataOperations = TerminalKeyDataOperations.getInstance();
|
||||
// terminalKeyDataOperations.saveHasDownloadTMK(true);
|
||||
// }
|
||||
try {
|
||||
result = securityOpt.saveKey(AidlConstants.Security.KEY_TYPE_TMK, masterKeyEncrypted, cv, KEKIndex, KEY_ALG_TYPE_3DES, TMKIndex, true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (result == 0) {
|
||||
TerminalKeyDataOperations terminalKeyDataOperations = TerminalKeyDataOperations.getInstance();
|
||||
terminalKeyDataOperations.saveHasDownloadTMK(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static synchronized int dataEncrypt(int keyIndex, int keyType, int encryptType, byte[] plaintext, byte[] outArr) {
|
||||
// SecurityOpt securityOpt = PayLibsUtils.getInstance().securityOpt;
|
||||
SecurityOpt securityOpt = PayLibsUtils.getInstance().securityOpt;
|
||||
LogUtil.e(Constant.TAG, "dataEncrypt Key index:" + keyIndex
|
||||
+ "\n Key type:" + keyType
|
||||
+ "\n Encryption type:" + encryptType
|
||||
+ "\n data:" + Arrays.toString(plaintext)
|
||||
+ "\n hex:" + ByteUtil.bytes2HexStr(plaintext));
|
||||
int result = -1;
|
||||
// try {
|
||||
// result = securityOpt.dataEncrypt(keyIndex, plaintext, outArr);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
try {
|
||||
result = securityOpt.dataEncrypt(keyIndex, plaintext, outArr);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String bytesToHexString = ByteUtil.bytes2HexStr(outArr);
|
||||
LogUtil.e(Constant.TAG, "dataEncrypt result:" + result + " Encryption result:" + bytesToHexString);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void generateMAC(byte[] data) {
|
||||
PinPad pinPad = PayLibNex.getInstance().deviceEngine.getPinPad();
|
||||
|
||||
SecurityOptV2 securityOptV2 = PayLibsUtils.getInstance().securityOptV2;
|
||||
|
||||
// copy
|
||||
byte[] dataIn = new byte[data.length - 21];
|
||||
@ -97,7 +99,8 @@ public class TerminalSecure {
|
||||
|
||||
byte[] dataOut = new byte[8];
|
||||
try {
|
||||
dataOut = pinPad.calcMac(Constant.MAK_KEY_INDEX, MacAlgorithmModeEnum.X919, dataIn);
|
||||
int result = securityOptV2.calcMac(Constant.MAK_KEY_INDEX, AidlConstantsV2.Security.MAC_ALG_X9_19, dataIn, dataOut);
|
||||
LogUtil.e(Constant.TAG, "MAC result:" + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -25,13 +25,12 @@ rootProject.name = "KBZ-Master-latest"
|
||||
include ':app'
|
||||
include ':nexsdk-lib'
|
||||
include ':paylibs'
|
||||
//include ':paysdk-lib'
|
||||
include ':paysdk-lib'
|
||||
include ':baselib'
|
||||
include ':mpulib'
|
||||
|
||||
include ':xpay'
|
||||
include ':ecr'
|
||||
include ':ecr-service-lib'
|
||||
include ':link-service-lib'
|
||||
include ':qrgen-lib'
|
||||
include ':nexdlkey-lib'
|
||||
|
||||
@ -38,7 +38,7 @@ dependencies {
|
||||
implementation("androidx.appcompat:appcompat:1.3.1")
|
||||
implementation("com.google.android.material:material:1.4.0")
|
||||
|
||||
// implementation(project( ":paysdk-lib"))
|
||||
implementation(project( ":paysdk-lib"))
|
||||
implementation(project( ":nexsdk-lib"))
|
||||
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
|
||||
@ -3,11 +3,12 @@ package com.kizzy.xpay
|
||||
import com.kizzy.xpay.basic.NexBasic
|
||||
import com.kizzy.xpay.basic.XBasic
|
||||
import com.nexgo.oaf.apiv3.DeviceEngine
|
||||
import sunmi.paylib.SunmiPayKernel
|
||||
|
||||
class XPay {
|
||||
|
||||
lateinit var deviceEngine: DeviceEngine
|
||||
// lateinit var sunmiPayKernel: SunmiPayKernel
|
||||
lateinit var sunmiPayKernel: SunmiPayKernel
|
||||
companion object {
|
||||
val INSTANCE: XPay = XPay()
|
||||
val basicOpt:XBasic by lazy { NexBasic() }
|
||||
@ -21,9 +22,9 @@ class XPay {
|
||||
this.deviceEngine = deviceEngine
|
||||
}
|
||||
|
||||
// fun initSunmi(sunmiPayKernel: SunmiPayKernel) {
|
||||
// this.sunmiPayKernel = sunmiPayKernel
|
||||
// }
|
||||
fun initSunmi(sunmiPayKernel: SunmiPayKernel) {
|
||||
this.sunmiPayKernel = sunmiPayKernel
|
||||
}
|
||||
|
||||
object BasicOpt {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user