optimized refund
This commit is contained in:
parent
13617eead1
commit
720b3ddccb
@ -16,6 +16,8 @@ import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.WindowManager;
|
||||
@ -28,6 +30,8 @@ import com.nexgo.downloadkey.downloadflow.DownloadFlow;
|
||||
import com.nexgo.downloadkey.downloadflow.DownloadFlowProcessListener;
|
||||
import com.nexgo.downloadkey.downloadflow.DownloadFlowResultEntity;
|
||||
import com.nexgo.downloadkey.downloadflow.DownloadResult;
|
||||
import com.nexgo.oaf.apiv3.device.pinpad.PinPad;
|
||||
import com.nexgo.oaf.apiv3.device.pinpad.WorkKeyTypeEnum;
|
||||
import com.utsmyanmar.baselib.BaseApplication;
|
||||
import com.utsmyanmar.baselib.repo.Repository;
|
||||
import com.utsmyanmar.baselib.ui.AnimationDialog;
|
||||
@ -38,6 +42,7 @@ import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.print.printx.PrintXReceipt;
|
||||
import com.utsmyanmar.paylibs.utils.POSUtil;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsSettings;
|
||||
import com.utsmyanmar.paylibs.utils.enums.TransMenu;
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||
import com.utsmm.kbz.databinding.ActivityMainNewBinding;
|
||||
@ -134,8 +139,33 @@ public class MainActivity extends AppCompatActivity implements
|
||||
|
||||
// Initialize special back handling fragments
|
||||
initSpecialBackHandlingFragments();
|
||||
|
||||
final Handler handler = new Handler(Looper.getMainLooper());
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initKey();
|
||||
}
|
||||
}, 500);
|
||||
|
||||
}
|
||||
|
||||
private void initKey(){
|
||||
// SystemParamsOperation.getInstance().setTmsAddress("https://api-tms-uat.kbzbank.com:8443/sirius");
|
||||
// SystemParamsOperation.getInstance().setTmsAddress("http://sirius-nest.utsmyanmar.com");
|
||||
// SystemParamsOperation.getInstance().setEReceiptAddress("https://api-tms-uat.kbzbank.com:8443/receipt");
|
||||
// SystemParamsOperation.getInstance().setEReceiptAddress("http://receipt-nest.utsmyanmar.com");
|
||||
|
||||
PinPad pinPad = MyApplication.getInstance().deviceEngine.getPinPad();
|
||||
byte[] encryptedPIK = SystemParamsOperation.getInstance().getPIK();
|
||||
|
||||
if (encryptedPIK != null && encryptedPIK.length != 0) {
|
||||
int result = pinPad.writeWKey(9, WorkKeyTypeEnum.PINKEY, encryptedPIK, encryptedPIK.length);
|
||||
LogUtil.d(TAG, "save PIK key result: "+result);
|
||||
} else {
|
||||
LogUtil.d(TAG, "There's no PIK key!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initViewModels() {
|
||||
|
||||
@ -176,7 +176,7 @@ public class InputPasswordFragment extends DataBindingFragment implements DataBi
|
||||
break;
|
||||
case REFUND:
|
||||
inputPasswordViewModel.passwordType.setValue(InputPasswordType.SYSTEM);
|
||||
routeId = R.id.action_inputPasswordFragment_to_selectRefundFragment;
|
||||
routeId = R.id.action_inputPasswordFragment_to_inputAmountFragment;
|
||||
break;
|
||||
case PRE_AUTH_COMPLETE:
|
||||
inputPasswordViewModel.passwordType.setValue(InputPasswordType.SYSTEM);
|
||||
|
||||
@ -526,7 +526,7 @@ public class InputRRNFragment extends DataBindingFragment {
|
||||
String date = payDetail.getTransDate();
|
||||
String time = payDetail.getTransTime();
|
||||
|
||||
if(checkRefund(configTime,date,time)) {
|
||||
// if(checkRefund(configTime,date,time)) {
|
||||
PayDetail newPay = transProcessViewModel.getPayDetail();
|
||||
newPay.setReferNo(rrnNo);
|
||||
|
||||
@ -537,9 +537,9 @@ public class InputRRNFragment extends DataBindingFragment {
|
||||
|
||||
callNextScreen();
|
||||
|
||||
} else {
|
||||
terminatedTransRefund(isECR);
|
||||
}
|
||||
// } else {
|
||||
// terminatedTransRefund(isECR);
|
||||
// }
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@ -179,10 +179,10 @@ public class ProcessingFragment extends DataBindingFragment {
|
||||
|
||||
}
|
||||
|
||||
if(sharedViewModel.payDetail.getValue() != null) {
|
||||
EReceiptRequest request = EReceiptUtil.getInstance().generateMPUReceipt(sharedViewModel.payDetail.getValue());
|
||||
sharedViewModel.pushReceipt(request);
|
||||
}
|
||||
// if(sharedViewModel.payDetail.getValue() != null) {
|
||||
// EReceiptRequest request = EReceiptUtil.getInstance().generateMPUReceipt(sharedViewModel.payDetail.getValue());
|
||||
// sharedViewModel.pushReceipt(request);
|
||||
// }
|
||||
|
||||
// transProcessViewModel.payDetailResult.observe(getViewLifecycleOwner(), payDetail -> sharedViewModel.payDetail.postValue(payDetail));
|
||||
}
|
||||
|
||||
@ -51,11 +51,11 @@ public final class TerminalKeyUtil {
|
||||
|
||||
LogUtil.d(TAG, "save tmk key result: "+result);
|
||||
|
||||
byte[] encryptedPIK = SystemParamsOperation.getInstance().getKeyPIK().get(0);
|
||||
|
||||
result = pinPad.writeWKey(9, WorkKeyTypeEnum.PINKEY,encryptedPIK,encryptedPIK.length);
|
||||
|
||||
LogUtil.d(TAG, "save PIK key result: "+result);
|
||||
// byte[] encryptedPIK = SystemParamsOperation.getInstance().getKeyPIK().get(0);
|
||||
//
|
||||
// result = pinPad.writeWKey(9, WorkKeyTypeEnum.PINKEY,encryptedPIK,encryptedPIK.length);
|
||||
//
|
||||
// LogUtil.d(TAG, "save PIK key result: "+result);
|
||||
// LogUtil.d(TAG, "save pin key result: "+resultPINKEY);
|
||||
// LogUtil.d(TAG, "save tdk key result: "+resultTDKEY);
|
||||
// LogUtil.d(TAG, "save tek key result: "+resultTEK);
|
||||
|
||||
@ -117,7 +117,7 @@ public class SignOnProcess {
|
||||
}
|
||||
LogUtil.d(TAG, "TMK Index:" + tmkIndex);
|
||||
|
||||
SystemParamsOperation.getInstance().saveKeyPIK(encryptedPIK, kcv);
|
||||
SystemParamsOperation.getInstance().savePIK(encryptedPIK);
|
||||
|
||||
int res = PayLibNex.getInstance().deviceEngine.getPinPad().writeWKey(tmkIndex, WorkKeyTypeEnum.PINKEY,encryptedPIK,encryptedPIK.length);
|
||||
// int res = PayLibsUtils.getInstance().securityOptV2.saveCiphertextKey(AidlConstantsV2.Security.KEY_TYPE_PIK, encryptedPIK, null, tmkIndex, AidlConstantsV2.Security.KEY_ALG_TYPE_3DES, 11);
|
||||
@ -165,6 +165,7 @@ public class SignOnProcess {
|
||||
tmkIndex = Integer.parseInt(SystemParamsOperation.getInstance().getTMKIndex());
|
||||
}
|
||||
|
||||
SystemParamsOperation.getInstance().savePIK(encryptedPIK);
|
||||
LogUtil.d(TAG, "TMK Index:" + tmkIndex);
|
||||
int res = PayLibNex.getInstance().deviceEngine.getPinPad().writeWKey(tmkIndex, WorkKeyTypeEnum.PINKEY,encryptedPIK,encryptedPIK.length);
|
||||
// int res = PayLibsUtils.getInstance().securityOptV2.saveCiphertextKey(AidlConstantsV2.Security.KEY_TYPE_PIK, encryptedPIK, null, tmkIndex, AidlConstantsV2.Security.KEY_ALG_TYPE_3DES, 11);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.utsmyanmar.paylibs.utils.core_utils;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
@ -1046,22 +1047,34 @@ public class SystemParamsOperation {
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
public void saveKeyPIK(byte[] pikValue,byte[] pikKcv){
|
||||
|
||||
|
||||
public void savePIK(byte[] pikValue){
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
params.setPik_value(pikValue);
|
||||
params.setPik_kcv(pikKcv);
|
||||
|
||||
String pikString = Base64.encodeToString(pikValue, Base64.DEFAULT);
|
||||
|
||||
params.setPik_value(pikString);
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
public ArrayList<byte[]> getKeyPIK(){
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
ArrayList<byte[]> arrayList = new ArrayList<>();
|
||||
arrayList.add(params.getPik_value());
|
||||
// arrayList.add(params.getPik_value());
|
||||
arrayList.add(params.getPik_kcv());
|
||||
return arrayList;
|
||||
|
||||
}
|
||||
|
||||
public byte[] getPIK(){
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
// return params.getPik_value();
|
||||
if(params.getPik_value() != null)
|
||||
return Base64.decode(params.getPik_value(), Base64.DEFAULT);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
public void setConnectStatus(boolean status){
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
params.setConnect_status(status);
|
||||
@ -1656,6 +1669,11 @@ public class SystemParamsOperation {
|
||||
return params.getCertificatePassword();
|
||||
}
|
||||
|
||||
public void setEReceiptAddress(String url) {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
params.setEreceiptAddress(url);
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
public String getEreceiptAddress() {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
return params.getEreceiptAddress();
|
||||
|
||||
@ -243,7 +243,8 @@ public class SystemParamsSettings implements Serializable {
|
||||
|
||||
private boolean nfcEnabled = false;
|
||||
|
||||
private byte[] pik_value;
|
||||
private String pik_value;
|
||||
|
||||
|
||||
private byte[] pik_kcv;
|
||||
|
||||
@ -819,7 +820,7 @@ public class SystemParamsSettings implements Serializable {
|
||||
this.batchNumStart = batchNumStart;
|
||||
}
|
||||
|
||||
protected byte[] getPik_value() {
|
||||
protected String getPik_value() {
|
||||
return pik_value;
|
||||
}
|
||||
|
||||
@ -827,7 +828,7 @@ public class SystemParamsSettings implements Serializable {
|
||||
return pik_kcv;
|
||||
}
|
||||
|
||||
protected void setPik_value(byte[] pik_value) {
|
||||
protected void setPik_value(String pik_value) {
|
||||
this.pik_value = pik_value;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user