Compare commits

..

No commits in common. "58118a2fb5469fb33483248de8a55c6924e46821" and "5b749073d02f25255a4e00e555a901bbf8b6542b" have entirely different histories.

17 changed files with 81 additions and 156 deletions

View File

@ -13,6 +13,12 @@
</DropdownSelection>
<DialogSelection />
</SelectionState>
<SelectionState runConfigName="testSalePacket()">
<option name="selectionMode" value="DROPDOWN" />
</SelectionState>
<SelectionState runConfigName="testResponseSalePacket()">
<option name="selectionMode" value="DROPDOWN" />
</SelectionState>
</selectionStates>
</component>
</project>

View File

@ -47,6 +47,34 @@ android {
}
}
// defaultConfig {
// applicationId "com.utsmm.kbz.sit"
// minSdk 24
// targetSdk 33
// versionCode 1
// versionName "1.0"
//
//// applicationId "com.utsmm.kbz"
//// versionName "1.10"
//
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
//
//// // Add CMake configuration
//// externalNativeBuild {
//// cmake {
//// cppFlags "-std=c++14"
//// }
//// }
// }
// Configure CMake
// externalNativeBuild {
// cmake {
// path "src/main/cpp/CMakeLists.txt"
// version "3.22.1"
// }
// }
buildTypes {
release {
minifyEnabled true
@ -54,7 +82,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
debuggable false
debuggable true
}
}
compileOptions {

View File

@ -16,8 +16,6 @@ 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;
@ -30,8 +28,6 @@ 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;
@ -42,7 +38,6 @@ 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;
@ -110,8 +105,6 @@ public class MainActivity extends AppCompatActivity implements
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BaseApplication.getInstance().deviceEngine.getPlatform().hideNavigationBar();
// Keep screen on
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
@ -141,32 +134,8 @@ 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() {
@ -427,15 +396,15 @@ public class MainActivity extends AppCompatActivity implements
SystemParamsOperation.getInstance().setDownloadedParams(false);
handleAutoSettlementIntent(getIntent());
BaseApplication.getInstance().deviceEngine.getPlatform().hideNavigationBar();
}
@Override
public void onStop(){
super.onStop();
// BaseApplication.getInstance().deviceEngine.getPlatform().showNavigationBar();
// BaseApplication.getInstance().deviceEngine.getPlatform().enableHomeButton();
// BaseApplication.getInstance().deviceEngine.getPlatform().enableTaskButton();
BaseApplication.getInstance().deviceEngine.getPlatform().showNavigationBar();
BaseApplication.getInstance().deviceEngine.getPlatform().enableHomeButton();
BaseApplication.getInstance().deviceEngine.getPlatform().enableTaskButton();
}
@Override
@ -503,15 +472,14 @@ public class MainActivity extends AppCompatActivity implements
@Override
public void onDestroy() {
super.onDestroy();
// BaseApplication.getInstance().deviceEngine.getPlatform().showNavigationBar();
// BaseApplication.getInstance().deviceEngine.getPlatform().enableHomeButton();
// BaseApplication.getInstance().deviceEngine.getPlatform().enableTaskButton();
BaseApplication.getInstance().deviceEngine.getPlatform().showNavigationBar();
BaseApplication.getInstance().deviceEngine.getPlatform().enableHomeButton();
BaseApplication.getInstance().deviceEngine.getPlatform().enableTaskButton();
// Clean up RxJava disposables
compositeDisposable.clear();
// Reset screen mode
// Disconnect ECR
ECRHelper.INSTANCE.disconnect();
BaseApplication.getInstance().deviceEngine.getPlatform().showNavigationBar();
}
// Navigation drawer interaction listeners
@ -522,12 +490,6 @@ public class MainActivity extends AppCompatActivity implements
navController.navigate(R.id.inputPasswordFragment);
}
@Override
public void onPause(){
super.onPause();
BaseApplication.getInstance().deviceEngine.getPlatform().showNavigationBar();
}
@Override
public void onClickFunction() {
closeDrawer();

View File

@ -146,10 +146,10 @@ public class MainFragment extends DataBindingFragment {
delayFunctionCall(() -> {
NexGoSDK.getInstance().cancelCheckCard();
NexGoSDK.getInstance().closeReader();
// enableHomeButton();
// disableTaskButton();
enableHomeButton();
disableTaskButton();
// BaseApplication.getInstance().deviceEngine.getPlatform().hideNavigationBar();
// BaseApplication.getInstance().deviceEngine.getPlatform().showNavigationBar();
BaseApplication.getInstance().deviceEngine.getPlatform().showNavigationBar();
});
}

View File

@ -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_inputAmountFragment;
routeId = R.id.action_inputPasswordFragment_to_selectRefundFragment;
break;
case PRE_AUTH_COMPLETE:
inputPasswordViewModel.passwordType.setValue(InputPasswordType.SYSTEM);

View File

@ -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 {

View File

@ -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));
}

View File

@ -223,35 +223,6 @@
</LinearLayout>
<!-- MMQR Ref Row -->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal"-->
<!-- android:gravity="center_vertical"-->
<!-- android:layout_marginTop="8dp"-->
<!-- android:visibility="@{(sharedViewModel.payDetail != null &amp;&amp; sharedViewModel.payDetail.qrReferNo != null &amp;&amp; !sharedViewModel.payDetail.qrReferNo.empty) ? android.view.View.VISIBLE : android.view.View.GONE}">-->
<!-- <TextView-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_weight="1"-->
<!-- android:text="MMQR Ref"-->
<!-- android:textColor="@color/colorTextContent"-->
<!-- android:textSize="14sp"-->
<!-- android:fontFamily="@font/rubik_regular" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@{sharedViewModel.payDetail.qrReferNo}"-->
<!-- android:textColor="@color/colorTextTitle"-->
<!-- android:textSize="14sp"-->
<!-- android:fontFamily="@font/rubik_medium"-->
<!-- tools:text="REF123456789"-->
<!-- android:maxLines="1"-->
<!-- android:ellipsize="end"/>-->
<!-- </LinearLayout>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -260,37 +231,27 @@
android:layout_marginTop="8dp"
android:visibility="@{(sharedViewModel.payDetail != null &amp;&amp; sharedViewModel.payDetail.qrReferNo != null &amp;&amp; !sharedViewModel.payDetail.qrReferNo.empty) ? android.view.View.VISIBLE : android.view.View.GONE}">
<!-- Label : 30% -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:layout_weight="1"
android:text="MMQR Ref"
android:textColor="@color/colorTextContent"
android:textSize="14sp"
android:fontFamily="@font/rubik_regular" />
<!-- Value : 70% -->
<TextView
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="7"
android:gravity="end"
android:text="@{sharedViewModel.payDetail.qrReferNo}"
android:textColor="@color/colorTextTitle"
android:textSize="14sp"
android:fontFamily="@font/rubik_medium"
android:maxLines="1"
android:ellipsize="end"
tools:text="REF123456789123456789123456789012345" />
tools:text="REF123456789" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@ -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);

View File

@ -82,6 +82,9 @@ public class NetworkModule {
public static native String getTMSUrlFromNative();
public static String Refund_Base_Url = "https://api.kbzpay.com:18008/payment/gateway/uat/";
private static OkHttpClient getUnsafeOkHttpClient() {
try {
// Create a trust manager that does not validate certificate chains
@ -392,21 +395,6 @@ public Retrofit provideKPayRefundRetrofit(@ApplicationContext Context context) {
// char[] password = "test123".toCharArray();
// public static String Refund_Base_Url = "https://api.kbzpay.com:18008/payment/gateway/uat/";
String refundBaseUrl = "";
String IpAddress = SystemParamsOperation.getInstance().getSecHostIpAddress();
if (IpAddress != null && !IpAddress.isEmpty()) {
refundBaseUrl = IpAddress;
}
if (refundBaseUrl.isEmpty()) {
refundBaseUrl = "https://api.kbzpay.com/payment/gateway/";
}
String pass = SystemParamsOperation.getInstance().getCertificatePassword();
if (TextUtils.isEmpty(pass)) {
pass = "test123";
@ -468,7 +456,7 @@ public Retrofit provideKPayRefundRetrofit(@ApplicationContext Context context) {
.build();
return new Retrofit.Builder()
.baseUrl(refundBaseUrl)
.baseUrl(Refund_Base_Url)
.client(okHttp)
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
@ -480,7 +468,7 @@ public Retrofit provideKPayRefundRetrofit(@ApplicationContext Context context) {
// Provide fallback Retrofit to avoid crash, but no SSL
return new Retrofit.Builder()
.baseUrl(refundBaseUrl)
.baseUrl(Refund_Base_Url)
.client(new OkHttpClient())
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())

View File

@ -24,8 +24,8 @@ public interface KPayApiService {
//this accept "url" bez this api start with https and other are http in uat
@POST("closeorder")
Observable<KPayQRRequest.CloseOrderResponse> closeOrder(@Body KPayQRRequest.CloseOrderRequest closeOrderRequest);
@POST
Observable<KPayQRRequest.CloseOrderResponse> closeOrder(@Url String url, @Body KPayQRRequest.CloseOrderRequest closeOrderRequest);
//this 2 is for production

View File

@ -40,7 +40,7 @@ public class SiriusInterceptor implements Interceptor {
// hashed = TerminalUtil.getInstance().generateHashedString(nonce); // old tms
hashed = TerminalUtil.getInstance().generateHashedString(nonce).toLowerCase(); // new tms
// LogUtil.d(TAG,"hashed :"+ hashed);
LogUtil.d(TAG,"hashed :"+ hashed);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}

View File

@ -86,8 +86,8 @@ public class Repository {
}
public Observable<KPayQRRequest.CloseOrderResponse> qrCloseOrder(KPayQRRequest.CloseOrderRequest request){
// String url = "https://api.kbzpay.com/payment/gateway/uat/closeorder"; //close this in prod
return kPayApiService.closeOrder(request);
String url = "https://api.kbzpay.com/payment/gateway/uat/closeorder"; //close this in prod
return kPayApiService.closeOrder(url, request);
// return kPayApiService.closeOrder(request); //this is for prod
}

View File

@ -895,7 +895,7 @@ public abstract class BaseXPrint {
dashBreak();
print2ColumnsString("Sale Total :MMK", PrintUtils.getInstance().getSeparatorOnlyNumberFormat(totalAmount));
dashBreak();
print2ColumnsString("Grand Total :MMK", PrintUtils.getInstance().getSeparatorOnlyNumberFormat(totalAmount - refundTotal));
print2ColumnsString("Sale Total :MMK", PrintUtils.getInstance().getSeparatorOnlyNumberFormat(totalAmount - refundTotal));
dashBreakEnding();
// emptyLine(2);

View File

@ -117,7 +117,7 @@ public class SignOnProcess {
}
LogUtil.d(TAG, "TMK Index:" + tmkIndex);
SystemParamsOperation.getInstance().savePIK(encryptedPIK);
SystemParamsOperation.getInstance().saveKeyPIK(encryptedPIK, kcv);
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,7 +165,6 @@ 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);

View File

@ -1,7 +1,6 @@
package com.utsmyanmar.paylibs.utils.core_utils;
import android.text.TextUtils;
import android.util.Base64;
import java.util.ArrayList;
import java.util.Locale;
@ -1047,34 +1046,22 @@ public class SystemParamsOperation {
saveSystemParamsSettings(params);
}
public void savePIK(byte[] pikValue){
public void saveKeyPIK(byte[] pikValue,byte[] pikKcv){
SystemParamsSettings params = getSystemParamsSettings();
String pikString = Base64.encodeToString(pikValue, Base64.DEFAULT);
params.setPik_value(pikString);
params.setPik_value(pikValue);
params.setPik_kcv(pikKcv);
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);
@ -1669,11 +1656,6 @@ 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();

View File

@ -243,8 +243,7 @@ public class SystemParamsSettings implements Serializable {
private boolean nfcEnabled = false;
private String pik_value;
private byte[] pik_value;
private byte[] pik_kcv;
@ -820,7 +819,7 @@ public class SystemParamsSettings implements Serializable {
this.batchNumStart = batchNumStart;
}
protected String getPik_value() {
protected byte[] getPik_value() {
return pik_value;
}
@ -828,7 +827,7 @@ public class SystemParamsSettings implements Serializable {
return pik_kcv;
}
protected void setPik_value(String pik_value) {
protected void setPik_value(byte[] pik_value) {
this.pik_value = pik_value;
}