custom lib added
This commit is contained in:
parent
947cd0916c
commit
816ea17122
@ -10,6 +10,17 @@
|
|||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
<option value="$PROJECT_DIR$/baselib" />
|
||||||
|
<option value="$PROJECT_DIR$/cmhl" />
|
||||||
|
<option value="$PROJECT_DIR$/ecr" />
|
||||||
|
<option value="$PROJECT_DIR$/ecr-service-lib" />
|
||||||
|
<option value="$PROJECT_DIR$/mpu-lib" />
|
||||||
|
<option value="$PROJECT_DIR$/mpulib" />
|
||||||
|
<option value="$PROJECT_DIR$/paylibs" />
|
||||||
|
<option value="$PROJECT_DIR$/paysdk-lib" />
|
||||||
|
<option value="$PROJECT_DIR$/qrgen-lib" />
|
||||||
|
<option value="$PROJECT_DIR$/sunmiui-lib" />
|
||||||
|
<option value="$PROJECT_DIR$/xpay" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
|
|||||||
1
baselib/.gitignore
vendored
Normal file
1
baselib/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
121
baselib/build.gradle
Normal file
121
baselib/build.gradle
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = 'com.utsmyanmar.baselib'
|
||||||
|
compileSdk = 34
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
path = file("src/cpp/CMakeLists.txt")
|
||||||
|
version = "3.22.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdk = 24
|
||||||
|
//noinspection ExpiredTargetSdkVersion
|
||||||
|
targetSdk = 30
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
|
||||||
|
// Room compiler options
|
||||||
|
javaCompileOptions {
|
||||||
|
annotationProcessorOptions {
|
||||||
|
arguments += [
|
||||||
|
"room.schemaLocation" : "$projectDir/schemas".toString(),
|
||||||
|
"room.incremental" : "true",
|
||||||
|
"room.expandProjection": "true"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
dataBinding = true
|
||||||
|
buildConfig = true
|
||||||
|
}
|
||||||
|
|
||||||
|
ndkVersion '25.1.8937393'
|
||||||
|
|
||||||
|
lint {
|
||||||
|
abortOnError false
|
||||||
|
checkReleaseBuilds false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
def lottieVersion = "3.5.0"
|
||||||
|
def roomVersion = "2.4.3"
|
||||||
|
|
||||||
|
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
||||||
|
|
||||||
|
// implementation files('libs/mpulib-1.0.aar')
|
||||||
|
|
||||||
|
implementation project(path: ':paylibs')
|
||||||
|
// implementation project(path: ':mpu-lib')
|
||||||
|
implementation project(path: ':mpulib')
|
||||||
|
implementation project(path: ':ecr')
|
||||||
|
|
||||||
|
|
||||||
|
// implementation project(path: ':PayLib-release-1.4.58')
|
||||||
|
implementation project(path: ':paysdk-lib')
|
||||||
|
implementation project(path: ':sunmiui-lib')
|
||||||
|
// implementation 'com.sunmi:printerlibrary:1.0.9'
|
||||||
|
implementation 'com.sunmi:printerlibrary:1.0.23'
|
||||||
|
|
||||||
|
//RxJava
|
||||||
|
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
|
||||||
|
implementation 'io.reactivex.rxjava3:rxjava:3.0.0'
|
||||||
|
|
||||||
|
//lottie
|
||||||
|
implementation "com.airbnb.android:lottie:$lottieVersion"
|
||||||
|
|
||||||
|
// Hilt
|
||||||
|
implementation libs.hilt.android
|
||||||
|
annotationProcessor libs.hilt.compiler
|
||||||
|
|
||||||
|
// Basic DI support for @Inject annotations
|
||||||
|
implementation 'javax.inject:javax.inject:1'
|
||||||
|
|
||||||
|
// Retrofit
|
||||||
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
|
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||||
|
implementation "com.github.akarnokd:rxjava3-retrofit-adapter:3.0.0"
|
||||||
|
|
||||||
|
// Okhttp
|
||||||
|
implementation("com.squareup.okhttp3:logging-interceptor:4.8.1")
|
||||||
|
implementation("com.squareup.okhttp3:okhttp:4.8.1")
|
||||||
|
|
||||||
|
// Room dependencies - Updated version with better Apple Silicon support
|
||||||
|
implementation "androidx.room:room-runtime:$roomVersion"
|
||||||
|
implementation 'androidx.preference:preference:1.1.1'
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||||
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
|
// Re-enable kapt for Room
|
||||||
|
annotationProcessor "androidx.room:room-compiler:$roomVersion"
|
||||||
|
implementation "androidx.room:room-rxjava3:$roomVersion"
|
||||||
|
|
||||||
|
//navigation component
|
||||||
|
implementation 'androidx.navigation:navigation-fragment:2.3.2'
|
||||||
|
implementation 'androidx.navigation:navigation-ui:2.3.2'
|
||||||
|
|
||||||
|
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
|
implementation 'com.google.android.material:material:1.2.1'
|
||||||
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
|
}
|
||||||
0
baselib/consumer-rules.pro
Normal file
0
baselib/consumer-rules.pro
Normal file
26
baselib/proguard-rules.pro
vendored
Normal file
26
baselib/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
|
-keepclassmembers,allowobfuscation class * {
|
||||||
|
@com.google.gson.annotations.SerializedName <fields>;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.utsmyanmar.baselib;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
public void useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
|
assertEquals("com.utsmyanmar.baselib.test", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
||||||
20
baselib/src/cpp/CMakeLists.txt
Normal file
20
baselib/src/cpp/CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# For more information about using CMake with Android Studio, read the
|
||||||
|
# documentation: https://d.android.com/studio/projects/add-native-code.html
|
||||||
|
|
||||||
|
# Sets the minimum version of CMake required to build the native library.
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.4.1)
|
||||||
|
|
||||||
|
# Creates and names a library, sets it as either STATIC
|
||||||
|
# or SHARED, and provides the relative paths to its source code.
|
||||||
|
# You can define multiple libraries, and CMake builds them for you.
|
||||||
|
# Gradle automatically packages shared libraries with your APK.
|
||||||
|
|
||||||
|
add_library( # Sets the name of the library.
|
||||||
|
native-lib
|
||||||
|
|
||||||
|
# Sets the library as a shared library.
|
||||||
|
SHARED
|
||||||
|
|
||||||
|
# Provides a relative path to your source file(s).
|
||||||
|
native-lib.cpp)
|
||||||
31
baselib/src/cpp/native-lib.cpp
Normal file
31
baselib/src/cpp/native-lib.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
extern "C" jstring Java_com_utsmyanmar_baselib_network_interceptor_SiriusInterceptor_getHiddenFromNative(
|
||||||
|
JNIEnv* env,
|
||||||
|
jobject /* this */) {
|
||||||
|
std::string hidden = "1234567";
|
||||||
|
return env->NewStringUTF(hidden.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" jstring Java_com_utsmyanmar_baselib_util_TerminalUtilsImpl_getHiddenFromNative(
|
||||||
|
JNIEnv* env,
|
||||||
|
jobject /* this */) {
|
||||||
|
std::string hidden = "1234567";
|
||||||
|
return env->NewStringUTF(hidden.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" jstring Java_com_utsmyanmar_baselib_util_TerminalUtilsImpl_getEncryptedFromNative(
|
||||||
|
JNIEnv* env,
|
||||||
|
jobject /* this */) {
|
||||||
|
std::string encrypted = "SN";
|
||||||
|
return env->NewStringUTF(encrypted.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" jstring Java_com_utsmyanmar_baselib_di_NetworkModule_getTMSUrlFromNative(
|
||||||
|
JNIEnv* env,
|
||||||
|
jobject /* this */) {
|
||||||
|
std::string tmsUrl = "https://sirius.utsmyanmar.com";
|
||||||
|
return env->NewStringUTF(tmsUrl.c_str());
|
||||||
|
}
|
||||||
7
baselib/src/main/AndroidManifest.xml
Normal file
7
baselib/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.utsmyanmar.baselib">
|
||||||
|
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
</manifest>
|
||||||
1
baselib/src/main/assets/lottie-search-files.json
Normal file
1
baselib/src/main/assets/lottie-search-files.json
Normal file
File diff suppressed because one or more lines are too long
1
baselib/src/main/assets/lottie_decline.json
Normal file
1
baselib/src/main/assets/lottie_decline.json
Normal file
File diff suppressed because one or more lines are too long
1
baselib/src/main/assets/lottie_info.json
Normal file
1
baselib/src/main/assets/lottie_info.json
Normal file
File diff suppressed because one or more lines are too long
1
baselib/src/main/assets/lottie_printer_not_ready.json
Normal file
1
baselib/src/main/assets/lottie_printer_not_ready.json
Normal file
File diff suppressed because one or more lines are too long
1
baselib/src/main/assets/lottie_remove_card.json
Normal file
1
baselib/src/main/assets/lottie_remove_card.json
Normal file
File diff suppressed because one or more lines are too long
1
baselib/src/main/assets/lottie_success.json
Normal file
1
baselib/src/main/assets/lottie_success.json
Normal file
File diff suppressed because one or more lines are too long
1
baselib/src/main/assets/lottie_timeout.json
Normal file
1
baselib/src/main/assets/lottie_timeout.json
Normal file
File diff suppressed because one or more lines are too long
BIN
baselib/src/main/assets/rubik.ttf
Normal file
BIN
baselib/src/main/assets/rubik.ttf
Normal file
Binary file not shown.
BIN
baselib/src/main/assets/rubik_medium.ttf
Normal file
BIN
baselib/src/main/assets/rubik_medium.ttf
Normal file
Binary file not shown.
@ -0,0 +1,176 @@
|
|||||||
|
package com.utsmyanmar.baselib;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
|
||||||
|
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;
|
||||||
|
import com.sunmi.peripheral.printer.SunmiPrinterService;
|
||||||
|
import com.utsmyanmar.baselib.emv.EmvParamOperation;
|
||||||
|
import com.utsmyanmar.baselib.emv.TerminalParamOperation;
|
||||||
|
import com.utsmyanmar.checkxread.sdk.SunmiSDK;
|
||||||
|
import com.utsmyanmar.ecr.ECRUtil;
|
||||||
|
|
||||||
|
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||||
|
import com.utsmyanmar.paylibs.network.ISOSocket;
|
||||||
|
import com.utsmyanmar.paylibs.utils.ThreadPoolUtil;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import sunmi.paylib.SunmiPayKernel;
|
||||||
|
|
||||||
|
|
||||||
|
//@HiltAndroidApp
|
||||||
|
public class BaseApplication extends Application {
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
public static BaseApplication getInstance(){
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
EmvParamOperation emvParamOperation;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
TerminalParamOperation terminalParamOperation;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
app = this;
|
||||||
|
|
||||||
|
bindSDKServices();
|
||||||
|
PayLibsUtils.getInstance().initLib(app);
|
||||||
|
ECRUtil.INSTANCE.setContext(app);
|
||||||
|
ISOSocket.getInstance().initContext(getApplicationContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bindSDKServices(){
|
||||||
|
bindPrintService();
|
||||||
|
sunmiPayKernel = SunmiPayKernel.getInstance();
|
||||||
|
sunmiPayKernel.initPaySDK(this, mConnectCallback);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private SunmiPayKernel.ConnectCallback mConnectCallback = new SunmiPayKernel.ConnectCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectPaySDK() {
|
||||||
|
try {
|
||||||
|
emvOpt = sunmiPayKernel.mEMVOpt;
|
||||||
|
pinPadOpt = sunmiPayKernel.mPinPadOpt;
|
||||||
|
readCardOpt = sunmiPayKernel.mReadCardOpt;
|
||||||
|
basicOptBinder = sunmiPayKernel.mBasicOpt;
|
||||||
|
securityOpt = sunmiPayKernel.mSecurityOpt;
|
||||||
|
BaseApplication.basicOptV2 = sunmiPayKernel.mBasicOptV2;
|
||||||
|
|
||||||
|
mEMVOptV2 = sunmiPayKernel.mEMVOptV2;
|
||||||
|
mPinPadOptV2 = sunmiPayKernel.mPinPadOptV2;
|
||||||
|
mReadCardOptV2 = sunmiPayKernel.mReadCardOptV2;
|
||||||
|
mSecurityOptV2 = sunmiPayKernel.mSecurityOptV2;
|
||||||
|
//init
|
||||||
|
|
||||||
|
initTerminal();
|
||||||
|
|
||||||
|
PayLibsUtils.getInstance().initLib(mSecurityOptV2,mEMVOptV2,securityOpt,mReadCardOptV2);
|
||||||
|
SunmiSDK.getInstance().initSDK(mReadCardOptV2,basicOptV2);
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisconnectPaySDK() {
|
||||||
|
try {
|
||||||
|
emvOpt = null;
|
||||||
|
pinPadOpt = null;
|
||||||
|
readCardOpt = null;
|
||||||
|
basicOptBinder = null;
|
||||||
|
sunmiPayKernel = null;
|
||||||
|
// handler.sendEmptyMessage(1);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void initTerminal(){
|
||||||
|
//showToast("emv init process finished.");
|
||||||
|
|
||||||
|
|
||||||
|
configMap = EmvUtil.getConfig();
|
||||||
|
|
||||||
|
TerminalKeyUtil.initKey();
|
||||||
|
|
||||||
|
emvParamOperation.loadAidRids();
|
||||||
|
terminalParamOperation.loadBinRange();
|
||||||
|
|
||||||
|
emvParamOperation.loadEmvTerminalParam();
|
||||||
|
|
||||||
|
// emvParamOperation.updateChipAidStatus(false,"A0000000041010");
|
||||||
|
|
||||||
|
// ThreadPoolUtil.executeInCachePool(
|
||||||
|
// ()->{
|
||||||
|
//// EmvUtil.initNFCSpeedupAidAndRid();
|
||||||
|
//// EmvUtil.initAidAndRid();
|
||||||
|
// EmvUtil.setTerminalParam(configMap);
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void bindPrintService() {
|
||||||
|
try {
|
||||||
|
InnerPrinterManager.getInstance().bindService(this, new InnerPrinterCallback() {
|
||||||
|
@Override
|
||||||
|
protected void onConnected(SunmiPrinterService service) {
|
||||||
|
sunmiPrinterService = service;
|
||||||
|
PayLibsUtils.getInstance().initLib(sunmiPrinterService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDisconnected() {
|
||||||
|
|
||||||
|
sunmiPrinterService = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (InnerPrinterException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
575
baselib/src/main/java/com/utsmyanmar/baselib/EmvUtil.java
Normal file
575
baselib/src/main/java/com/utsmyanmar/baselib/EmvUtil.java
Normal file
@ -0,0 +1,575 @@
|
|||||||
|
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;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.TLVUtil;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import sunmi.sunmiui.utils.LogUtil;
|
||||||
|
|
||||||
|
public final class EmvUtil {
|
||||||
|
|
||||||
|
private static final String TAG = EmvUtil.class.getSimpleName();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static Map<String, String> getConfig() {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
// E0F0C8 - UPI
|
||||||
|
map.put("countryCode", "0104"); // country code
|
||||||
|
// map.put("capability", "6060C8"); // capability
|
||||||
|
// map.put("capability","E028C8"); //E068C8
|
||||||
|
// map.put("capability","E0B8C8"); //E068C8
|
||||||
|
// map.put("capability","E0F8C8"); //E068C8
|
||||||
|
// map.put("capability","E028C8"); //signature/no cvm require
|
||||||
|
map.put("capability","E0E8C8"); //online / offline / signature/ no cvm
|
||||||
|
// map.put("capability","E0A8C8"); // offline / signature/ no cvm
|
||||||
|
// map.put("addCapability","F000F0A001");
|
||||||
|
map.put("addCapability","F000F0A001");
|
||||||
|
// map.put("addCapability","600080C000");
|
||||||
|
// map.put("5F2A", "0104"); // transaction currency code
|
||||||
|
map.put("5F2A", "0104");//0156 // transaction currency code
|
||||||
|
map.put("5F36", "00");
|
||||||
|
map.put("dsn","3132333435363738"); // interface device serial number
|
||||||
|
// map.put("ttq","36804000");
|
||||||
|
map.put("ttq","A7004000");
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, String> getConfigBelow() {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
// E0F0C8 - UPI
|
||||||
|
map.put("countryCode", "0104"); // country code
|
||||||
|
// map.put("capability", "6060C8"); // capability
|
||||||
|
// map.put("capability","E028C8"); //E068C8
|
||||||
|
// map.put("capability","E0B8C8"); //E068C8
|
||||||
|
// map.put("capability","E0F8C8"); //E068C8
|
||||||
|
map.put("capability","0008C8"); //E068C8
|
||||||
|
// map.put("addCapability","F000F0A001");
|
||||||
|
map.put("addCapability","F000F0A001");
|
||||||
|
// map.put("addCapability","600080C000");
|
||||||
|
map.put("5F2A", "0104"); // transaction currency code
|
||||||
|
map.put("5F36", "00");
|
||||||
|
map.put("dsn","3132333435363738"); // interface device serial number
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, String> getConfigAbove() {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
// E0F0C8 - UPI
|
||||||
|
map.put("countryCode", "0104"); // country code
|
||||||
|
// map.put("capability", "6060C8"); // capability
|
||||||
|
// map.put("capability","E028C8"); //E068C8
|
||||||
|
// map.put("capability","E0B8C8"); //E068C8
|
||||||
|
// map.put("capability","E0F8C8"); //E068C8
|
||||||
|
map.put("capability","E040C8"); //E068C8
|
||||||
|
// map.put("addCapability","F000F0A001");
|
||||||
|
map.put("addCapability","F000F0A001");
|
||||||
|
// map.put("addCapability","600080C000");
|
||||||
|
map.put("5F2A", "0104"); // transaction currency code
|
||||||
|
map.put("5F36", "00");
|
||||||
|
map.put("dsn","3132333435363738"); // interface device serial number
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package com.utsmyanmar.baselib;
|
||||||
|
|
||||||
|
import android.content.ContentValues;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
|
||||||
|
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.utils.core_utils.ByteUtil;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
import com.utsmyanmar.paylibs.utils.secure.TriDes;
|
||||||
|
|
||||||
|
import java.security.GeneralSecurityException;
|
||||||
|
|
||||||
|
import sunmi.sunmiui.utils.LogUtil;
|
||||||
|
|
||||||
|
public final class TerminalKeyUtil {
|
||||||
|
|
||||||
|
public static final String TAG = TerminalKeyUtil.class.getSimpleName();
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.utsmyanmar.baselib;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.PersistableBundle;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.activity.BaseActivity;
|
||||||
|
|
||||||
|
|
||||||
|
public class TestActivity extends BaseActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.test_activity);
|
||||||
|
|
||||||
|
findViewById(R.id.btnClick).setOnClickListener(v->{
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.utsmyanmar.baselib.activity;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
public class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
|
protected void switchActivity (Context context,Class target) {
|
||||||
|
Intent intent = new Intent(context,target);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.utsmyanmar.baselib.db;
|
||||||
|
|
||||||
|
import androidx.room.Database;
|
||||||
|
import androidx.room.RoomDatabase;
|
||||||
|
import androidx.room.TypeConverters;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.converter.CardSchemeConverter;
|
||||||
|
import com.utsmyanmar.baselib.db.converter.SettleDataConverter;
|
||||||
|
import com.utsmyanmar.baselib.db.converter.TransCVMConverter;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.BinDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.ChipAidDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.MPUCtlsDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.PayDetailDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.PayPassDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.PayWaveDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.QuickPassDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.RidDao;
|
||||||
|
import com.utsmyanmar.baselib.db.model.BinEntity;
|
||||||
|
import com.utsmyanmar.baselib.db.model.ChipAidEntity;
|
||||||
|
import com.utsmyanmar.baselib.db.model.MPUCtlsEntity;
|
||||||
|
import com.utsmyanmar.baselib.db.model.PayPassEntity;
|
||||||
|
import com.utsmyanmar.baselib.db.model.PayWaveEntity;
|
||||||
|
import com.utsmyanmar.baselib.db.model.QuickPassEntity;
|
||||||
|
import com.utsmyanmar.baselib.db.model.RidEntity;
|
||||||
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
|
|
||||||
|
|
||||||
|
@Database(entities = {PayDetail.class, ChipAidEntity.class, PayWaveEntity.class, PayPassEntity.class, QuickPassEntity.class, RidEntity.class, MPUCtlsEntity.class, BinEntity.class},version = 12,exportSchema = false)
|
||||||
|
@TypeConverters({SettleDataConverter.class, TransCVMConverter.class, CardSchemeConverter.class})
|
||||||
|
public abstract class AppDatabase extends RoomDatabase {
|
||||||
|
public static volatile AppDatabase INSTANCE;
|
||||||
|
|
||||||
|
public abstract PayDetailDao payDetailDao();
|
||||||
|
|
||||||
|
|
||||||
|
public abstract ChipAidDao chipAidDao();
|
||||||
|
|
||||||
|
public abstract PayWaveDao payWaveDao();
|
||||||
|
|
||||||
|
public abstract PayPassDao payPassDao();
|
||||||
|
|
||||||
|
public abstract QuickPassDao quickPassDao();
|
||||||
|
|
||||||
|
|
||||||
|
public abstract RidDao ridDao();
|
||||||
|
|
||||||
|
public abstract MPUCtlsDao mpuCtlsDao();
|
||||||
|
|
||||||
|
public abstract BinDao binDao();
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.converter;
|
||||||
|
|
||||||
|
import androidx.room.TypeConverter;
|
||||||
|
|
||||||
|
import com.utsmyanmar.paylibs.model.enums.TransCVM;
|
||||||
|
import com.utsmyanmar.paylibs.utils.enums.CardScheme;
|
||||||
|
|
||||||
|
public class CardSchemeConverter {
|
||||||
|
|
||||||
|
@TypeConverter
|
||||||
|
public static CardScheme toCardScheme(String value) {
|
||||||
|
return CardScheme.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeConverter
|
||||||
|
public String fromCardScheme(CardScheme value) {
|
||||||
|
return value.name();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.converter;
|
||||||
|
|
||||||
|
import androidx.room.TypeConverter;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.utsmyanmar.paylibs.model.SettleData;
|
||||||
|
|
||||||
|
public class SettleDataConverter {
|
||||||
|
private static final Gson gson = new Gson();
|
||||||
|
|
||||||
|
@TypeConverter
|
||||||
|
public static SettleData fromString(String value) {
|
||||||
|
return gson.fromJson(value, SettleData.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeConverter
|
||||||
|
public static String toString(SettleData customObject) {
|
||||||
|
return gson.toJson(customObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.converter;
|
||||||
|
|
||||||
|
import androidx.room.TypeConverter;
|
||||||
|
|
||||||
|
import com.utsmyanmar.paylibs.model.enums.TransCVM;
|
||||||
|
|
||||||
|
public class TransCVMConverter {
|
||||||
|
|
||||||
|
@TypeConverter
|
||||||
|
public static TransCVM toTransCVM(String value) {
|
||||||
|
if (value == null || value.isEmpty()) {
|
||||||
|
return null; // or return a default enum value like TransCVM.DEFAULT
|
||||||
|
}
|
||||||
|
return TransCVM.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeConverter
|
||||||
|
public static String fromTransCVM(TransCVM value) {
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return value.name();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.model.BinEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface BinDao {
|
||||||
|
|
||||||
|
@Query("SELECT * FROM bin_table")
|
||||||
|
Maybe<List<BinEntity>> getAll();
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void updateBin(BinEntity entity);
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
void insertBin(BinEntity entity);
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void deleteBin(BinEntity entity);
|
||||||
|
|
||||||
|
@Query("SELECT EXISTS (SELECT 1 FROM bin_table WHERE binRangeStart <= :cardBin AND binRangeEnd >= :cardBin AND magCapable = 1)")
|
||||||
|
Single<Boolean> isCardMagCapable(String cardBin);
|
||||||
|
|
||||||
|
@Query("DELETE FROM bin_table")
|
||||||
|
Completable deleteAll();
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.model.ChipAidEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface ChipAidDao {
|
||||||
|
|
||||||
|
@Query("SELECT * FROM chip_aid")
|
||||||
|
Maybe<List<ChipAidEntity>> getAllChipAids();
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void updateChipAid(ChipAidEntity... chipAidEntity);
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
void insertChipAid(ChipAidEntity chipAidEntity);
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void deleteChipAid(ChipAidEntity chipAidEntity);
|
||||||
|
|
||||||
|
@Query("UPDATE chip_aid SET cvmLimit = :cvmLimit WHERE cardScheme = :scheme")
|
||||||
|
Completable updateCVMByScheme(String scheme, long cvmLimit);
|
||||||
|
|
||||||
|
@Query("UPDATE chip_aid SET aidEnable = :aidEnable WHERE aid = :aid")
|
||||||
|
Completable updateAidEnabledByAid(boolean aidEnable,String aid);
|
||||||
|
|
||||||
|
@Query("DELETE FROM chip_aid")
|
||||||
|
Completable deleteAll();
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.model.MPUCtlsEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface MPUCtlsDao {
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mpu_ctls")
|
||||||
|
Maybe<List<MPUCtlsEntity>> getAllMPU();
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
void insertMPU(MPUCtlsEntity... entity);
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void updateMPU(MPUCtlsEntity entity);
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void deleteMPU(MPUCtlsEntity entity);
|
||||||
|
|
||||||
|
@Query("UPDATE mpu_ctls SET cvmLimit = :cvmLimit")
|
||||||
|
Completable updateCVM(long cvmLimit);
|
||||||
|
|
||||||
|
@Query("UPDATE mpu_ctls SET currencyCode = :currencyCode")
|
||||||
|
Completable updateCurrencyCode(String currencyCode);
|
||||||
|
|
||||||
|
@Query("DELETE FROM mpu_ctls")
|
||||||
|
Completable deleteAll();
|
||||||
|
|
||||||
|
@Query("UPDATE mpu_ctls SET ttq = :ttq")
|
||||||
|
Completable updateTTQ(String ttq);
|
||||||
|
}
|
||||||
@ -0,0 +1,157 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.dao;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Transaction;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
|
import com.utsmyanmar.paylibs.system.SingleLiveEvent;
|
||||||
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionType;
|
||||||
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface PayDetailDao {
|
||||||
|
|
||||||
|
@Query("select * from paydetail")
|
||||||
|
LiveData<PayDetail> getAll();
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
void insert(PayDetail... payDetails);
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
Completable insertPay(PayDetail... payDetails);
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void update(PayDetail payDetail);
|
||||||
|
|
||||||
|
@Query("DELETE FROM paydetail")
|
||||||
|
void deleteAll();
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void deletePayDetail(PayDetail payDetail);
|
||||||
|
|
||||||
|
// 13 = CASH DEPOSIT & 9 = CASH ADVANCE & 14 = FUND TRANSFER
|
||||||
|
@Query("SELECT * FROM paydetail WHERE isSettle = 0 AND transactionType = 13 OR transactionType = 9 AND isSettle = 0 OR transactionType = 14 AND isSettle = 0")
|
||||||
|
LiveData<List<PayDetail>> getSettlement();
|
||||||
|
|
||||||
|
// 1 = SALE & 7 = PRE_SALE_COMPLETE & 4 = REFUND & 9 = CASH_ADVANCE & 18 = TIP ADJUSTMENT
|
||||||
|
// @Query("SELECT * FROM paydetail WHERE isSettle = 0 AND isCanceled = 0 AND accountType != 'MPU' and accountType != 'UPI' AND (transactionType = 1 OR transactionType = 7 OR transactionType = 4 OR transactionType = 9)")
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE isSettle = 0 AND isCanceled = 0 AND accountType NOT IN ( 'MPU','UnionPay') AND transactionType IN (1, 7, 4, 9)")
|
||||||
|
LiveData<List<PayDetail>> getSettlementPOS();
|
||||||
|
|
||||||
|
// 1 = SALE & 7 = PRE_SALE_COMPLETE & 4 = REFUND & 9 = CASH_ADVANCE & 18 = TIP ADJUSTMENT & 6 = PRE_AUTH_VOID & 20 = WALLET
|
||||||
|
@Query("SELECT * FROM paydetail WHERE isSettle = 0 AND isCanceled = 0 AND transactionType = 1 OR transactionType = 7 AND isSettle = 0 AND isCanceled = 0 OR transactionType = 4 AND isSettle = 0 OR transactionType = 9 AND isSettle = 0 OR transactionType = 6 AND isSettle = 0")
|
||||||
|
LiveData<List<PayDetail>> getSettlementPOSClearBatch();
|
||||||
|
|
||||||
|
// 6 = PRE AUTH CANCEL, 7= PRE_AUTH_COMPLETE , 5 = PRE AUTH
|
||||||
|
// @Query(("SELECT * FROM paydetail WHERE transactionType = 1 AND isCanceled = 1 OR transactionType = 2 AND isCanceled = 0 OR transactionType = 18 AND isCanceled = 0 AND batchNo IN(:batchNo)"))
|
||||||
|
// @Query(("SELECT * FROM paydetail WHERE transactionType = 1 AND isCanceled = 1 OR transactionType = 5 AND isCanceled = 1 OR transactionType = 7 AND isCanceled = 1 OR transactionType = 8 OR transactionType = 6 OR transactionType = 10 OR transactionType = 2 AND isCanceled = 0 OR transactionType = 18 AND isCanceled = 0 OR transactionType = 20 AND isCanceled = 0 OR transactionType = 34 AND isCanceled = 1 AND batchNo IN(:batchNo)"))
|
||||||
|
@Query(("SELECT * FROM paydetail WHERE transactionType = 1 AND isCanceled = 1 OR transactionType = 5 AND isCanceled = 1 OR transactionType = 7 AND isCanceled = 1 OR transactionType = 8 OR transactionType = 6 OR transactionType = 10 OR transactionType = 2 AND isCanceled = 0 OR transactionType = 18 AND isCanceled = 0 OR transactionType = 20 OR transactionType = 34 AND isCanceled = 1 AND batchNo IN(:batchNo)"))
|
||||||
|
LiveData<List<PayDetail>> getDeleteTrans(String batchNo);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE transactionType = 5 AND isCanceled = 0")
|
||||||
|
LiveData<List<PayDetail>> getPreAuthTrans();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* to settle voided transactions....
|
||||||
|
* */
|
||||||
|
@Query("SELECT * FROM paydetail WHERE isCanceled = 1 AND isSettle = 0 AND transactionType = 1 OR isCanceled = 1 AND isSettle = 0 AND transactionType = 7 AND batchNo IN(:batchNo)")
|
||||||
|
LiveData<List<PayDetail>> getAdditionalSettlementPOS(String batchNo);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE transactionType = 10 AND isNeedReversal = 1 AND voucherNo IN(:voucherNo)")
|
||||||
|
LiveData<PayDetail> getReversalTransaction(String voucherNo);
|
||||||
|
|
||||||
|
// @Query("SELECT * FROM paydetail WHERE transactionType != 10 ORDER BY PID DESC")
|
||||||
|
@Query("SELECT * FROM paydetail ORDER BY PID DESC")
|
||||||
|
LiveData<List<PayDetail>> getTransactionHistory();
|
||||||
|
|
||||||
|
// @Query("SELECT * FROM paydetail WHERE isSettle = 0 AND isCanceled = 0 AND transactionType IN(:transactionType)")
|
||||||
|
@Query("SELECT * FROM paydetail WHERE isSettle = 0 AND transactionType IN(:transactionType)")
|
||||||
|
LiveData<List<PayDetail>> getVoidableTransactions(int transactionType);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE isSettle = 0 AND transactionType IN(:transType) AND voucherNo IN(:voucherNo) AND accountType != 'MPU' ")
|
||||||
|
LiveData<PayDetail> getGenericVoidTransEMV(int transType,String voucherNo);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE isSettle = 0 AND transactionType IN(:transType) AND voucherNo IN(:voucherNo) AND accountType = 'MPU' ")
|
||||||
|
LiveData<PayDetail> getGenericVoidTransMPU(int transType,String voucherNo);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE isSettle = 0 AND transactionType IN(:transType) AND voucherNo IN(:voucherNo)")
|
||||||
|
LiveData<PayDetail> getVoidTrans(int transType,String voucherNo);
|
||||||
|
|
||||||
|
// 5 = PRE_SALE
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE isCanceled = 0 AND transactionType = 5 AND voucherNo IN(:voucherNo) AND accountType != 'MPU'")
|
||||||
|
LiveData<PayDetail> getVoidablePreAuth(String voucherNo);
|
||||||
|
|
||||||
|
@Query(("SELECT * FROM paydetail WHERE voucherNo IN(:voucherNo)"))
|
||||||
|
LiveData<PayDetail> searchTransaction(String voucherNo);
|
||||||
|
|
||||||
|
@Query(("SELECT * FROM paydetail WHERE isCanceled = 0 AND referNo IN(:referNo)"))
|
||||||
|
LiveData<PayDetail> searchPayDetail(String referNo);
|
||||||
|
|
||||||
|
@Query(("SELECT * FROM paydetail WHERE isCanceled = 0 AND referNo IN(:referNo)"))
|
||||||
|
Flowable<PayDetail> searchPayDetailByRefNum(String referNo);
|
||||||
|
|
||||||
|
@Query(("SELECT * FROM paydetail WHERE isCanceled = 0 AND referNo IN(:referNo)"))
|
||||||
|
Maybe<PayDetail> searchPayByRefNum(String referNo);
|
||||||
|
|
||||||
|
@Query(("UPDATE paydetail SET customerMobile =:appName, qrTransId =:transId, approvalCode =:transId WHERE referNo =:refNum AND transactionType = 34"))
|
||||||
|
Completable updateUnfinishedQRTrans(String appName,String transId,String refNum);
|
||||||
|
|
||||||
|
@Query(("SELECT * FROM paydetail WHERE isCanceled = 0 AND CardNo IN(:cardNo) AND referNo IN(:referNo)"))
|
||||||
|
LiveData<PayDetail> searchPayDetail(String cardNo,String referNo);
|
||||||
|
|
||||||
|
@Query(("SELECT * FROM paydetail WHERE isCanceled = 0 AND CardNo IN(:cardNo) AND referNo IN(:referNo) AND amount =:amount"))
|
||||||
|
LiveData<PayDetail> searchPayDetail(String cardNo,String referNo,long amount);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE isCanceled = 0 AND transactionType = 5")
|
||||||
|
LiveData<List<PayDetail>> getPreAuthCompData();
|
||||||
|
|
||||||
|
// 2 = VOID & 4 = REFUND
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE isSettle = 1 AND isReturnGood = 0 AND isCanceled = 0 AND CardNo = (:cardNo) AND transactionType != 2 AND transactionType != 4")
|
||||||
|
LiveData<List<PayDetail>> getRefundableByCardNo(String cardNo);
|
||||||
|
|
||||||
|
@Query(("SELECT * FROM paydetail WHERE transactionType = 3 AND voucherNo IN(:voucherNo)"))
|
||||||
|
LiveData<PayDetail> checkLastSettlement(String voucherNo);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE transactionType = 3 AND voucherNo <= :voucherNo AND accountType != 'MPU'")
|
||||||
|
LiveData<List<PayDetail>> getLastSettlement(String voucherNo);
|
||||||
|
|
||||||
|
// @Query("SELECT * FROM paydetail WHERE transactionType != 10 AND voucherNo <= :voucherNo")
|
||||||
|
@Query("SELECT * FROM paydetail WHERE transactionType != 10 AND voucherNo IN(:voucherNo)")
|
||||||
|
LiveData<List<PayDetail>> getLastTransaction(String voucherNo);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE transactionType != 10 AND transactionType != 11 AND transactionType != 12 AND transactionType != 3 AND batchNo = :batchNo AND isSettle = 0")
|
||||||
|
LiveData<List<PayDetail>> getReviewBatchTransactions(String batchNo);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE isNeedReversal = 0 AND transactionType != 11 AND transactionType != 12 AND transactionType != 3 AND batchNo = :batchNo")
|
||||||
|
LiveData<List<PayDetail>> getSmileSummaryTransactions(String batchNo);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail ORDER BY PID DESC LIMIT 3")
|
||||||
|
LiveData<List<PayDetail>> getLastThreeTransactions();
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail ORDER BY PID DESC LIMIT 1")
|
||||||
|
LiveData<PayDetail> getLastTransaction();
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail ORDER BY PID DESC LIMIT 1")
|
||||||
|
Maybe<PayDetail> getLastTransactionRx();
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail ORDER BY PID DESC")
|
||||||
|
LiveData<List<PayDetail>> getAllTrans();
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.model.PayPassEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface PayPassDao {
|
||||||
|
|
||||||
|
@Query("SELECT * FROM pay_pass")
|
||||||
|
Maybe<List<PayPassEntity>> getAllPayPass();
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
void insertPayPass(PayPassEntity... entity);
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void updatePayPass(PayPassEntity entity);
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void deletePayPass(PayPassEntity entity);
|
||||||
|
|
||||||
|
@Query("UPDATE pay_pass SET cvmLimit = :cvmLimit")
|
||||||
|
Completable updateCVM(long cvmLimit);
|
||||||
|
|
||||||
|
@Query("UPDATE pay_pass SET currencyCode = :currencyCode")
|
||||||
|
Completable updateCurrencyCode(String currencyCode);
|
||||||
|
|
||||||
|
@Query("UPDATE pay_pass SET terminalCapability = :terminalCapability")
|
||||||
|
Completable updateTerminalCapability(String terminalCapability);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM pay_pass LIMIT 1")
|
||||||
|
Maybe<PayPassEntity> getPayPass();
|
||||||
|
|
||||||
|
@Query("DELETE FROM pay_pass")
|
||||||
|
Completable deleteAll();
|
||||||
|
|
||||||
|
@Query("UPDATE pay_pass SET ttq = :ttq")
|
||||||
|
Completable updateTTQ(String ttq);
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.model.ContactlessAid;
|
||||||
|
import com.utsmyanmar.baselib.db.model.PayWaveEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface PayWaveDao {
|
||||||
|
|
||||||
|
@Query("SELECT * FROM pay_wave")
|
||||||
|
Maybe<List<PayWaveEntity>> getAllPayWave();
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
void insertPayWave(PayWaveEntity... entity);
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void updatePayWave(PayWaveEntity entity);
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void deletePayWave(PayWaveEntity entity);
|
||||||
|
|
||||||
|
@Query("UPDATE pay_wave SET cvmLimit = :cvmLimit")
|
||||||
|
Completable updateCVM(long cvmLimit);
|
||||||
|
|
||||||
|
@Query("UPDATE pay_wave SET currencyCode = :currencyCode")
|
||||||
|
Completable updateCurrencyCode(String currencyCode);
|
||||||
|
|
||||||
|
@Query("DELETE FROM pay_wave")
|
||||||
|
Completable deleteAll();
|
||||||
|
|
||||||
|
@Query("UPDATE pay_wave SET ttq = :ttq")
|
||||||
|
Completable updateTTQ(String ttq);
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.model.QuickPassEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface QuickPassDao {
|
||||||
|
|
||||||
|
@Query("SELECT * FROM quick_pass")
|
||||||
|
Maybe<List<QuickPassEntity>> getAllQuickPass();
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
void insertQuickPass(QuickPassEntity... entity);
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void updateQuickPass(QuickPassEntity entity);
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void deleteQuickPass(QuickPassEntity entity);
|
||||||
|
|
||||||
|
@Query("UPDATE quick_pass SET cvmLimit = :cvmLimit")
|
||||||
|
Completable updateCVM(long cvmLimit);
|
||||||
|
|
||||||
|
@Query("UPDATE quick_pass SET currencyCode = :currencyCode")
|
||||||
|
Completable updateCurrencyCode(String currencyCode);
|
||||||
|
|
||||||
|
@Query("UPDATE quick_pass SET ttq = :ttq")
|
||||||
|
Completable updateTTQ(String ttq);
|
||||||
|
@Query("DELETE FROM quick_pass")
|
||||||
|
Completable deleteAll();
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.model.RidEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface RidDao {
|
||||||
|
|
||||||
|
@Query("SELECT * FROM rid_table")
|
||||||
|
Maybe<List<RidEntity>> getAllRids();
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
void insertRid(RidEntity... entities);
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void updateRid(RidEntity entity);
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void deleteRid(RidEntity entity);
|
||||||
|
|
||||||
|
@Query("DELETE FROM rid_table")
|
||||||
|
Completable deleteAll();
|
||||||
|
}
|
||||||
@ -0,0 +1,146 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.model;
|
||||||
|
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
import com.utsmyanmar.paylibs.model.enums.TransCVM;
|
||||||
|
import com.utsmyanmar.paylibs.utils.enums.CardScheme;
|
||||||
|
|
||||||
|
@Entity(tableName = "bin_table")
|
||||||
|
public class BinEntity {
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private String binRangeStart;
|
||||||
|
|
||||||
|
private String binRangeEnd;
|
||||||
|
|
||||||
|
private CardScheme cardScheme;
|
||||||
|
|
||||||
|
private String issuerName;
|
||||||
|
|
||||||
|
private String countryCode;
|
||||||
|
|
||||||
|
private String currencyCode;
|
||||||
|
|
||||||
|
private String cardType; //Credit, Debit, Prepaid
|
||||||
|
|
||||||
|
private TransCVM transCVM; // PIN, Signature
|
||||||
|
|
||||||
|
private boolean contactlessCapable;
|
||||||
|
|
||||||
|
private boolean magCapable;
|
||||||
|
|
||||||
|
private String additionalInfo;
|
||||||
|
|
||||||
|
public BinEntity(String binRangeStart, String binRangeEnd, CardScheme cardScheme, String issuerName, String countryCode, String currencyCode, String cardType, boolean magCapable, TransCVM transCVM, boolean contactlessCapable, String additionalInfo) {
|
||||||
|
this.binRangeStart = binRangeStart;
|
||||||
|
this.binRangeEnd = binRangeEnd;
|
||||||
|
this.cardScheme = cardScheme;
|
||||||
|
this.issuerName = issuerName;
|
||||||
|
this.countryCode = countryCode;
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
this.cardType = cardType;
|
||||||
|
this.magCapable = magCapable;
|
||||||
|
this.transCVM = transCVM;
|
||||||
|
this.contactlessCapable = contactlessCapable;
|
||||||
|
this.additionalInfo = additionalInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBinRangeStart(String binRangeStart) {
|
||||||
|
this.binRangeStart = binRangeStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBinRangeEnd(String binRangeEnd) {
|
||||||
|
this.binRangeEnd = binRangeEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardScheme(CardScheme cardScheme) {
|
||||||
|
this.cardScheme = cardScheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIssuerName(String issuerName) {
|
||||||
|
this.issuerName = issuerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountryCode(String countryCode) {
|
||||||
|
this.countryCode = countryCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrencyCode(String currencyCode) {
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardType(String cardType) {
|
||||||
|
this.cardType = cardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMagCapable(boolean magCapable) {
|
||||||
|
this.magCapable = magCapable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransCVM(TransCVM transCVM) {
|
||||||
|
this.transCVM = transCVM;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContactlessCapable(boolean contactlessCapable) {
|
||||||
|
this.contactlessCapable = contactlessCapable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdditionalInfo(String additionalInfo) {
|
||||||
|
this.additionalInfo = additionalInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBinRangeStart() {
|
||||||
|
return binRangeStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBinRangeEnd() {
|
||||||
|
return binRangeEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CardScheme getCardScheme() {
|
||||||
|
return cardScheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIssuerName() {
|
||||||
|
return issuerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountryCode() {
|
||||||
|
return countryCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrencyCode() {
|
||||||
|
return currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardType() {
|
||||||
|
return cardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isMagCapable() {
|
||||||
|
return magCapable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransCVM getTransCVM() {
|
||||||
|
return transCVM;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isContactlessCapable() {
|
||||||
|
return contactlessCapable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAdditionalInfo() {
|
||||||
|
return additionalInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,238 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.model;
|
||||||
|
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
@Entity(tableName = "chip_aid")
|
||||||
|
public class ChipAidEntity implements ContactAid {
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
private int id;
|
||||||
|
private String cardScheme;
|
||||||
|
private boolean aidEnable;
|
||||||
|
private String aid;
|
||||||
|
private String applicationVersion;
|
||||||
|
private String emvDDOL;
|
||||||
|
private String emvTDOL;
|
||||||
|
private boolean partialAidSelection;
|
||||||
|
private String targetPercent;
|
||||||
|
private String maxTargetPercent;
|
||||||
|
private String threshold;
|
||||||
|
private String tacDefault;
|
||||||
|
private String tacOnline;
|
||||||
|
private String tacDenial;
|
||||||
|
private String floorLimit;
|
||||||
|
private long cvmLimit;
|
||||||
|
private String terminalCapability;
|
||||||
|
|
||||||
|
private String transLimit;
|
||||||
|
|
||||||
|
private String riskManageData;
|
||||||
|
|
||||||
|
private String cateCode;
|
||||||
|
|
||||||
|
private String currencyCode;
|
||||||
|
|
||||||
|
|
||||||
|
public ChipAidEntity(String cardScheme, boolean aidEnable, String aid, String applicationVersion, String emvDDOL, String emvTDOL, boolean partialAidSelection, String targetPercent, String maxTargetPercent, String threshold, String tacDefault, String tacOnline, String tacDenial, String floorLimit, Long cvmLimit, String terminalCapability, String transLimit, String riskManageData, String cateCode, String currencyCode) {
|
||||||
|
this.cardScheme = cardScheme;
|
||||||
|
this.aidEnable = aidEnable;
|
||||||
|
this.aid = aid;
|
||||||
|
this.applicationVersion = applicationVersion;
|
||||||
|
this.emvDDOL = emvDDOL;
|
||||||
|
this.emvTDOL = emvTDOL;
|
||||||
|
this.partialAidSelection = partialAidSelection;
|
||||||
|
this.targetPercent = targetPercent;
|
||||||
|
this.maxTargetPercent = maxTargetPercent;
|
||||||
|
this.threshold = threshold;
|
||||||
|
this.tacDefault = tacDefault;
|
||||||
|
this.tacOnline = tacOnline;
|
||||||
|
this.tacDenial = tacDenial;
|
||||||
|
this.floorLimit = floorLimit;
|
||||||
|
this.cvmLimit = cvmLimit;
|
||||||
|
this.terminalCapability = terminalCapability;
|
||||||
|
this.transLimit = transLimit;
|
||||||
|
this.riskManageData = riskManageData;
|
||||||
|
this.cateCode = cateCode;
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getAid() {
|
||||||
|
return aid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransLimit(String transLimit) {
|
||||||
|
this.transLimit = transLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRiskManageData(String riskManageData) {
|
||||||
|
this.riskManageData = riskManageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransLimit() {
|
||||||
|
return transLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getRiskManageData() {
|
||||||
|
return riskManageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAidEnable(boolean aidEnable) {
|
||||||
|
this.aidEnable = aidEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCateCode(String cateCode) {
|
||||||
|
this.cateCode = cateCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrencyCode(String currencyCode) {
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getPartialAidSelection() {
|
||||||
|
return partialAidSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTacDefault() {
|
||||||
|
return tacDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getTacOnline() {
|
||||||
|
return tacOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getTacDenial() {
|
||||||
|
return tacDenial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardScheme() {
|
||||||
|
return cardScheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getAidEnable() {
|
||||||
|
return aidEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApplicationVersion() {
|
||||||
|
return applicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmvDDOL() {
|
||||||
|
return emvDDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmvTDOL() {
|
||||||
|
return emvTDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTargetPercent() {
|
||||||
|
return targetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaxTargetPercent() {
|
||||||
|
return maxTargetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getThreshold() {
|
||||||
|
return threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFloorLimit() {
|
||||||
|
return floorLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCvmLimit() {
|
||||||
|
return cvmLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTerminalCapability() {
|
||||||
|
return terminalCapability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardScheme(String cardScheme) {
|
||||||
|
this.cardScheme = cardScheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAid(String aid) {
|
||||||
|
this.aid = aid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplicationVersion(String applicationVersion) {
|
||||||
|
this.applicationVersion = applicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmvDDOL(String emvDDOL) {
|
||||||
|
this.emvDDOL = emvDDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmvTDOL(String emvTDOL) {
|
||||||
|
this.emvTDOL = emvTDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void setTargetPercent(String targetPercent) {
|
||||||
|
this.targetPercent = targetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxTargetPercent(String maxTargetPercent) {
|
||||||
|
this.maxTargetPercent = maxTargetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThreshold(String threshold) {
|
||||||
|
this.threshold = threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacDefault(String tacDefault) {
|
||||||
|
this.tacDefault = tacDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacOnline(String tacOnline) {
|
||||||
|
this.tacOnline = tacOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacDenial(String tacDenial) {
|
||||||
|
this.tacDenial = tacDenial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFloorLimit(String floorLimit) {
|
||||||
|
this.floorLimit = floorLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCvmLimit(Long cvmLimit) {
|
||||||
|
this.cvmLimit = cvmLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminalCapability(String terminalCapability) {
|
||||||
|
this.terminalCapability = terminalCapability;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getCateCode() {
|
||||||
|
return cateCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getCurrencyCode() {
|
||||||
|
return currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getTerminalCapabilities() {
|
||||||
|
return terminalCapability;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.model;
|
||||||
|
|
||||||
|
public interface ContactAid {
|
||||||
|
|
||||||
|
|
||||||
|
String getAid();
|
||||||
|
|
||||||
|
boolean getPartialAidSelection();
|
||||||
|
|
||||||
|
String getApplicationVersion();
|
||||||
|
|
||||||
|
String getEmvDDOL();
|
||||||
|
|
||||||
|
String getEmvTDOL();
|
||||||
|
|
||||||
|
String getTacDefault();
|
||||||
|
|
||||||
|
String getTacDenial();
|
||||||
|
|
||||||
|
String getTacOnline();
|
||||||
|
|
||||||
|
String getTargetPercent();
|
||||||
|
String getMaxTargetPercent();
|
||||||
|
String getThreshold();
|
||||||
|
|
||||||
|
long getCvmLimit();
|
||||||
|
|
||||||
|
String getTransLimit();
|
||||||
|
String getRiskManageData();
|
||||||
|
|
||||||
|
String getCateCode();
|
||||||
|
|
||||||
|
String getCurrencyCode();
|
||||||
|
|
||||||
|
String getTerminalCapabilities();
|
||||||
|
|
||||||
|
String getFloorLimit();
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.model;
|
||||||
|
|
||||||
|
public interface ContactlessAid {
|
||||||
|
|
||||||
|
|
||||||
|
String getAid();
|
||||||
|
|
||||||
|
boolean getPartialAidSelection();
|
||||||
|
|
||||||
|
String getApplicationVersion();
|
||||||
|
|
||||||
|
String getEmvDDOL();
|
||||||
|
|
||||||
|
String getEmvTDOL();
|
||||||
|
|
||||||
|
String getThreshold();
|
||||||
|
|
||||||
|
String getTargetPercent();
|
||||||
|
String getMaxTargetPercent();
|
||||||
|
String getTacDefault();
|
||||||
|
|
||||||
|
String getTacDenial();
|
||||||
|
|
||||||
|
String getTacOnline();
|
||||||
|
|
||||||
|
String getFloorLimit();
|
||||||
|
|
||||||
|
long getCvmLimit();
|
||||||
|
|
||||||
|
String getTransLimit();
|
||||||
|
|
||||||
|
String getRiskManageData();
|
||||||
|
|
||||||
|
String getKernelType();
|
||||||
|
String getTtq();
|
||||||
|
String getTerminalCapability();
|
||||||
|
|
||||||
|
String getCateCode();
|
||||||
|
|
||||||
|
String getCurrencyCode();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,255 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.model;
|
||||||
|
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
@Entity(tableName = "mpu_ctls")
|
||||||
|
public class MPUCtlsEntity implements ContactlessAid {
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
private int id;
|
||||||
|
private boolean aidEnable;
|
||||||
|
private String aid;
|
||||||
|
private String cardLabel;
|
||||||
|
private String applicationVersion;
|
||||||
|
private String emvDDOL;
|
||||||
|
private String emvTDOL;
|
||||||
|
private boolean partialAidSelection;
|
||||||
|
private String targetPercent;
|
||||||
|
private String maxTargetPercent;
|
||||||
|
private String threshold;
|
||||||
|
private String tacDefault;
|
||||||
|
private String tacOnline;
|
||||||
|
private String tacDenial;
|
||||||
|
private String floorLimit;
|
||||||
|
private long cvmLimit;
|
||||||
|
private String transLimit;
|
||||||
|
private String transLimitCDV;
|
||||||
|
private String terminalCapability;
|
||||||
|
private String riskManageData;
|
||||||
|
private String kernelType;
|
||||||
|
private String ttq;
|
||||||
|
|
||||||
|
private String cateCode;
|
||||||
|
|
||||||
|
private String currencyCode;
|
||||||
|
|
||||||
|
public MPUCtlsEntity(boolean aidEnable, String aid, String cardLabel, String applicationVersion, String emvDDOL, String emvTDOL, boolean partialAidSelection, String targetPercent, String maxTargetPercent, String threshold, String tacDefault, String tacOnline, String tacDenial, String floorLimit, long cvmLimit, String transLimit, String transLimitCDV, String terminalCapability, String riskManageData, String kernelType, String ttq, String cateCode, String currencyCode) {
|
||||||
|
this.aidEnable = aidEnable;
|
||||||
|
this.aid = aid;
|
||||||
|
this.cardLabel = cardLabel;
|
||||||
|
this.applicationVersion = applicationVersion;
|
||||||
|
this.emvDDOL = emvDDOL;
|
||||||
|
this.emvTDOL = emvTDOL;
|
||||||
|
this.partialAidSelection = partialAidSelection;
|
||||||
|
this.targetPercent = targetPercent;
|
||||||
|
this.maxTargetPercent = maxTargetPercent;
|
||||||
|
this.threshold = threshold;
|
||||||
|
this.tacDefault = tacDefault;
|
||||||
|
this.tacOnline = tacOnline;
|
||||||
|
this.tacDenial = tacDenial;
|
||||||
|
this.floorLimit = floorLimit;
|
||||||
|
this.cvmLimit = cvmLimit;
|
||||||
|
this.transLimit = transLimit;
|
||||||
|
this.transLimitCDV = transLimitCDV;
|
||||||
|
this.terminalCapability = terminalCapability;
|
||||||
|
this.riskManageData = riskManageData;
|
||||||
|
this.kernelType = kernelType;
|
||||||
|
this.ttq = ttq;
|
||||||
|
this.cateCode = cateCode;
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCateCode(String cateCode) {
|
||||||
|
this.cateCode = cateCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrencyCode(String currencyCode) {
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCateCode() {
|
||||||
|
return cateCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getCurrencyCode() {
|
||||||
|
return currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTacDefault() {
|
||||||
|
return tacDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getTacOnline() {
|
||||||
|
return tacOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTacDenial() {
|
||||||
|
return tacDenial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApplicationVersion() {
|
||||||
|
return applicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmvDDOL() {
|
||||||
|
return emvDDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmvTDOL() {
|
||||||
|
return emvTDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getPartialAidSelection() {
|
||||||
|
return partialAidSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTargetPercent() {
|
||||||
|
return targetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaxTargetPercent() {
|
||||||
|
return maxTargetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getThreshold() {
|
||||||
|
return threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFloorLimit() {
|
||||||
|
return floorLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCvmLimit() {
|
||||||
|
return cvmLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransLimit() {
|
||||||
|
return transLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransLimitCDV() {
|
||||||
|
return transLimitCDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTerminalCapability() {
|
||||||
|
return terminalCapability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRiskManageData() {
|
||||||
|
return riskManageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKernelType() {
|
||||||
|
return kernelType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTtq() {
|
||||||
|
return ttq;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAid() {
|
||||||
|
return aid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public boolean getAidEnable() {
|
||||||
|
return aidEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardLabel() {
|
||||||
|
return cardLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAidEnable(Boolean aidEnable) {
|
||||||
|
this.aidEnable = aidEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAid(String aid) {
|
||||||
|
this.aid = aid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardLabel(String cardLabel) {
|
||||||
|
this.cardLabel = cardLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplicationVersion(String applicationVersion) {
|
||||||
|
this.applicationVersion = applicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmvDDOL(String emvDDOL) {
|
||||||
|
this.emvDDOL = emvDDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmvTDOL(String emvTDOL) {
|
||||||
|
this.emvTDOL = emvTDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPartialAidSelection(Boolean partialAidSelection) {
|
||||||
|
this.partialAidSelection = partialAidSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTargetPercent(String targetPercent) {
|
||||||
|
this.targetPercent = targetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxTargetPercent(String maxTargetPercent) {
|
||||||
|
this.maxTargetPercent = maxTargetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThreshold(String threshold) {
|
||||||
|
this.threshold = threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacDefault(String tacDefault) {
|
||||||
|
this.tacDefault = tacDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacOnline(String tacOnline) {
|
||||||
|
this.tacOnline = tacOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacDenial(String tacDenial) {
|
||||||
|
this.tacDenial = tacDenial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFloorLimit(String floorLimit) {
|
||||||
|
this.floorLimit = floorLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCvmLimit(Long cvmLimit) {
|
||||||
|
this.cvmLimit = cvmLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransLimit(String transLimit) {
|
||||||
|
this.transLimit = transLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransLimitCDV(String transLimitCDV) {
|
||||||
|
this.transLimitCDV = transLimitCDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminalCapability(String terminalCapability) {
|
||||||
|
this.terminalCapability = terminalCapability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRiskManageData(String riskManageData) {
|
||||||
|
this.riskManageData = riskManageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKernelType(String kernelType) {
|
||||||
|
this.kernelType = kernelType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTtq(String ttq) {
|
||||||
|
this.ttq = ttq;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,255 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.model;
|
||||||
|
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
@Entity(tableName = "pay_pass")
|
||||||
|
public class PayPassEntity implements ContactlessAid {
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
private int id;
|
||||||
|
private boolean aidEnable;
|
||||||
|
private String aid;
|
||||||
|
private String cardLabel;
|
||||||
|
private String applicationVersion;
|
||||||
|
private String emvDDOL;
|
||||||
|
private String emvTDOL;
|
||||||
|
private boolean partialAidSelection;
|
||||||
|
private String targetPercent;
|
||||||
|
private String maxTargetPercent;
|
||||||
|
private String threshold;
|
||||||
|
private String tacDefault;
|
||||||
|
private String tacOnline;
|
||||||
|
private String tacDenial;
|
||||||
|
private String floorLimit;
|
||||||
|
private long cvmLimit;
|
||||||
|
private String transLimit; // DF8125 on device CVM
|
||||||
|
private String transLimitCDV; // DF8124 no- on device CVM
|
||||||
|
private String terminalCapability;
|
||||||
|
private String riskManageData;
|
||||||
|
private String kernelType;
|
||||||
|
private String ttq;
|
||||||
|
private String cateCode;
|
||||||
|
|
||||||
|
private String currencyCode;
|
||||||
|
|
||||||
|
public PayPassEntity(boolean aidEnable, String aid, String cardLabel, String applicationVersion, String emvDDOL, String emvTDOL, boolean partialAidSelection, String targetPercent, String maxTargetPercent, String threshold, String tacDefault, String tacOnline, String tacDenial, String floorLimit, long cvmLimit, String transLimit, String transLimitCDV, String terminalCapability, String riskManageData, String kernelType, String ttq, String cateCode, String currencyCode) {
|
||||||
|
this.aidEnable = aidEnable;
|
||||||
|
this.aid = aid;
|
||||||
|
this.cardLabel = cardLabel;
|
||||||
|
this.applicationVersion = applicationVersion;
|
||||||
|
this.emvDDOL = emvDDOL;
|
||||||
|
this.emvTDOL = emvTDOL;
|
||||||
|
this.partialAidSelection = partialAidSelection;
|
||||||
|
this.targetPercent = targetPercent;
|
||||||
|
this.maxTargetPercent = maxTargetPercent;
|
||||||
|
this.threshold = threshold;
|
||||||
|
this.tacDefault = tacDefault;
|
||||||
|
this.tacOnline = tacOnline;
|
||||||
|
this.tacDenial = tacDenial;
|
||||||
|
this.floorLimit = floorLimit;
|
||||||
|
this.cvmLimit = cvmLimit;
|
||||||
|
this.transLimit = transLimit;
|
||||||
|
this.transLimitCDV = transLimitCDV;
|
||||||
|
this.terminalCapability = terminalCapability;
|
||||||
|
this.riskManageData = riskManageData;
|
||||||
|
this.kernelType = kernelType;
|
||||||
|
this.ttq = ttq;
|
||||||
|
this.cateCode = cateCode;
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCateCode(String cateCode) {
|
||||||
|
this.cateCode = cateCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrencyCode(String currencyCode) {
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCateCode() {
|
||||||
|
return cateCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getCurrencyCode() {
|
||||||
|
return currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTacDefault() {
|
||||||
|
return tacDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getTacOnline() {
|
||||||
|
return tacOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTacDenial() {
|
||||||
|
return tacDenial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApplicationVersion() {
|
||||||
|
return applicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmvDDOL() {
|
||||||
|
return emvDDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmvTDOL() {
|
||||||
|
return emvTDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getPartialAidSelection() {
|
||||||
|
return partialAidSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTargetPercent() {
|
||||||
|
return targetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaxTargetPercent() {
|
||||||
|
return maxTargetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getThreshold() {
|
||||||
|
return threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFloorLimit() {
|
||||||
|
return floorLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCvmLimit() {
|
||||||
|
return cvmLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransLimit() {
|
||||||
|
return transLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransLimitCDV() {
|
||||||
|
return transLimitCDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTerminalCapability() {
|
||||||
|
return terminalCapability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRiskManageData() {
|
||||||
|
return riskManageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKernelType() {
|
||||||
|
return kernelType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTtq() {
|
||||||
|
return ttq;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAid() {
|
||||||
|
return aid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public boolean getAidEnable() {
|
||||||
|
return aidEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardLabel() {
|
||||||
|
return cardLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAidEnable(Boolean aidEnable) {
|
||||||
|
this.aidEnable = aidEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAid(String aid) {
|
||||||
|
this.aid = aid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardLabel(String cardLabel) {
|
||||||
|
this.cardLabel = cardLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplicationVersion(String applicationVersion) {
|
||||||
|
this.applicationVersion = applicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmvDDOL(String emvDDOL) {
|
||||||
|
this.emvDDOL = emvDDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmvTDOL(String emvTDOL) {
|
||||||
|
this.emvTDOL = emvTDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPartialAidSelection(Boolean partialAidSelection) {
|
||||||
|
this.partialAidSelection = partialAidSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTargetPercent(String targetPercent) {
|
||||||
|
this.targetPercent = targetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxTargetPercent(String maxTargetPercent) {
|
||||||
|
this.maxTargetPercent = maxTargetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThreshold(String threshold) {
|
||||||
|
this.threshold = threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacDefault(String tacDefault) {
|
||||||
|
this.tacDefault = tacDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacOnline(String tacOnline) {
|
||||||
|
this.tacOnline = tacOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacDenial(String tacDenial) {
|
||||||
|
this.tacDenial = tacDenial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFloorLimit(String floorLimit) {
|
||||||
|
this.floorLimit = floorLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCvmLimit(Long cvmLimit) {
|
||||||
|
this.cvmLimit = cvmLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransLimit(String transLimit) {
|
||||||
|
this.transLimit = transLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransLimitCDV(String transLimitCDV) {
|
||||||
|
this.transLimitCDV = transLimitCDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminalCapability(String terminalCapability) {
|
||||||
|
this.terminalCapability = terminalCapability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRiskManageData(String riskManageData) {
|
||||||
|
this.riskManageData = riskManageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKernelType(String kernelType) {
|
||||||
|
this.kernelType = kernelType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTtq(String ttq) {
|
||||||
|
this.ttq = ttq;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,256 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.model;
|
||||||
|
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
@Entity(tableName = "pay_wave")
|
||||||
|
public class PayWaveEntity implements ContactlessAid {
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
private int id;
|
||||||
|
private boolean aidEnable;
|
||||||
|
private String aid;
|
||||||
|
private String cardLabel;
|
||||||
|
private String applicationVersion;
|
||||||
|
private String emvDDOL;
|
||||||
|
private String emvTDOL;
|
||||||
|
private boolean partialAidSelection;
|
||||||
|
private String targetPercent;
|
||||||
|
private String maxTargetPercent;
|
||||||
|
private String threshold;
|
||||||
|
private String tacDefault;
|
||||||
|
private String tacOnline;
|
||||||
|
private String tacDenial;
|
||||||
|
private String floorLimit;
|
||||||
|
private long cvmLimit;
|
||||||
|
private String transLimit;
|
||||||
|
private String transLimitCDV;
|
||||||
|
private String terminalCapability;
|
||||||
|
private String riskManageData;
|
||||||
|
private String kernelType;
|
||||||
|
private String ttq;
|
||||||
|
|
||||||
|
private String cateCode;
|
||||||
|
|
||||||
|
private String currencyCode;
|
||||||
|
|
||||||
|
public PayWaveEntity(boolean aidEnable, String aid, String cardLabel, String applicationVersion, String emvDDOL, String emvTDOL, boolean partialAidSelection, String targetPercent, String maxTargetPercent, String threshold, String tacDefault, String tacOnline, String tacDenial, String floorLimit, long cvmLimit, String transLimit, String transLimitCDV, String terminalCapability, String riskManageData, String kernelType, String ttq, String cateCode, String currencyCode) {
|
||||||
|
this.aidEnable = aidEnable;
|
||||||
|
this.aid = aid;
|
||||||
|
this.cardLabel = cardLabel;
|
||||||
|
this.applicationVersion = applicationVersion;
|
||||||
|
this.emvDDOL = emvDDOL;
|
||||||
|
this.emvTDOL = emvTDOL;
|
||||||
|
this.partialAidSelection = partialAidSelection;
|
||||||
|
this.targetPercent = targetPercent;
|
||||||
|
this.maxTargetPercent = maxTargetPercent;
|
||||||
|
this.threshold = threshold;
|
||||||
|
this.tacDefault = tacDefault;
|
||||||
|
this.tacOnline = tacOnline;
|
||||||
|
this.tacDenial = tacDenial;
|
||||||
|
this.floorLimit = floorLimit;
|
||||||
|
this.cvmLimit = cvmLimit;
|
||||||
|
this.transLimit = transLimit;
|
||||||
|
this.transLimitCDV = transLimitCDV;
|
||||||
|
this.terminalCapability = terminalCapability;
|
||||||
|
this.riskManageData = riskManageData;
|
||||||
|
this.kernelType = kernelType;
|
||||||
|
this.ttq = ttq;
|
||||||
|
this.cateCode = cateCode;
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCateCode(String cateCode) {
|
||||||
|
this.cateCode = cateCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrencyCode(String currencyCode) {
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCateCode() {
|
||||||
|
return cateCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getCurrencyCode() {
|
||||||
|
return currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTacDefault() {
|
||||||
|
return tacDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getTacOnline() {
|
||||||
|
return tacOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTacDenial() {
|
||||||
|
return tacDenial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApplicationVersion() {
|
||||||
|
return applicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmvDDOL() {
|
||||||
|
return emvDDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmvTDOL() {
|
||||||
|
return emvTDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getPartialAidSelection() {
|
||||||
|
return partialAidSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTargetPercent() {
|
||||||
|
return targetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaxTargetPercent() {
|
||||||
|
return maxTargetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getThreshold() {
|
||||||
|
return threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFloorLimit() {
|
||||||
|
return floorLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCvmLimit() {
|
||||||
|
return cvmLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransLimit() {
|
||||||
|
return transLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransLimitCDV() {
|
||||||
|
return transLimitCDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTerminalCapability() {
|
||||||
|
return terminalCapability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRiskManageData() {
|
||||||
|
return riskManageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKernelType() {
|
||||||
|
return kernelType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTtq() {
|
||||||
|
return ttq;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAid() {
|
||||||
|
return aid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public boolean getAidEnable() {
|
||||||
|
return aidEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardLabel() {
|
||||||
|
return cardLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAidEnable(Boolean aidEnable) {
|
||||||
|
this.aidEnable = aidEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAid(String aid) {
|
||||||
|
this.aid = aid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardLabel(String cardLabel) {
|
||||||
|
this.cardLabel = cardLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplicationVersion(String applicationVersion) {
|
||||||
|
this.applicationVersion = applicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmvDDOL(String emvDDOL) {
|
||||||
|
this.emvDDOL = emvDDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmvTDOL(String emvTDOL) {
|
||||||
|
this.emvTDOL = emvTDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPartialAidSelection(Boolean partialAidSelection) {
|
||||||
|
this.partialAidSelection = partialAidSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTargetPercent(String targetPercent) {
|
||||||
|
this.targetPercent = targetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxTargetPercent(String maxTargetPercent) {
|
||||||
|
this.maxTargetPercent = maxTargetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThreshold(String threshold) {
|
||||||
|
this.threshold = threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacDefault(String tacDefault) {
|
||||||
|
this.tacDefault = tacDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacOnline(String tacOnline) {
|
||||||
|
this.tacOnline = tacOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacDenial(String tacDenial) {
|
||||||
|
this.tacDenial = tacDenial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFloorLimit(String floorLimit) {
|
||||||
|
this.floorLimit = floorLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCvmLimit(Long cvmLimit) {
|
||||||
|
this.cvmLimit = cvmLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransLimit(String transLimit) {
|
||||||
|
this.transLimit = transLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransLimitCDV(String transLimitCDV) {
|
||||||
|
this.transLimitCDV = transLimitCDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminalCapability(String terminalCapability) {
|
||||||
|
this.terminalCapability = terminalCapability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRiskManageData(String riskManageData) {
|
||||||
|
this.riskManageData = riskManageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKernelType(String kernelType) {
|
||||||
|
this.kernelType = kernelType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTtq(String ttq) {
|
||||||
|
this.ttq = ttq;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,256 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.model;
|
||||||
|
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
@Entity(tableName = "quick_pass")
|
||||||
|
public class QuickPassEntity implements ContactlessAid {
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
private int id;
|
||||||
|
private boolean aidEnable;
|
||||||
|
private String aid;
|
||||||
|
private String cardLabel;
|
||||||
|
private String applicationVersion;
|
||||||
|
private String emvDDOL;
|
||||||
|
private String emvTDOL;
|
||||||
|
private boolean partialAidSelection;
|
||||||
|
private String targetPercent;
|
||||||
|
private String maxTargetPercent;
|
||||||
|
private String threshold;
|
||||||
|
private String tacDefault;
|
||||||
|
private String tacOnline;
|
||||||
|
private String tacDenial;
|
||||||
|
private String floorLimit;
|
||||||
|
private long cvmLimit;
|
||||||
|
private String transLimit;
|
||||||
|
private String transLimitCDV;
|
||||||
|
private String terminalCapability;
|
||||||
|
private String riskManageData;
|
||||||
|
private String kernelType;
|
||||||
|
private String ttq;
|
||||||
|
|
||||||
|
private String cateCode;
|
||||||
|
|
||||||
|
private String currencyCode;
|
||||||
|
|
||||||
|
public QuickPassEntity(boolean aidEnable, String aid, String cardLabel, String applicationVersion, String emvDDOL, String emvTDOL, boolean partialAidSelection, String targetPercent, String maxTargetPercent, String threshold, String tacDefault, String tacOnline, String tacDenial, String floorLimit, long cvmLimit, String transLimit, String transLimitCDV, String terminalCapability, String riskManageData, String kernelType, String ttq, String cateCode, String currencyCode) {
|
||||||
|
this.aidEnable = aidEnable;
|
||||||
|
this.aid = aid;
|
||||||
|
this.cardLabel = cardLabel;
|
||||||
|
this.applicationVersion = applicationVersion;
|
||||||
|
this.emvDDOL = emvDDOL;
|
||||||
|
this.emvTDOL = emvTDOL;
|
||||||
|
this.partialAidSelection = partialAidSelection;
|
||||||
|
this.targetPercent = targetPercent;
|
||||||
|
this.maxTargetPercent = maxTargetPercent;
|
||||||
|
this.threshold = threshold;
|
||||||
|
this.tacDefault = tacDefault;
|
||||||
|
this.tacOnline = tacOnline;
|
||||||
|
this.tacDenial = tacDenial;
|
||||||
|
this.floorLimit = floorLimit;
|
||||||
|
this.cvmLimit = cvmLimit;
|
||||||
|
this.transLimit = transLimit;
|
||||||
|
this.transLimitCDV = transLimitCDV;
|
||||||
|
this.terminalCapability = terminalCapability;
|
||||||
|
this.riskManageData = riskManageData;
|
||||||
|
this.kernelType = kernelType;
|
||||||
|
this.ttq = ttq;
|
||||||
|
this.cateCode = cateCode;
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCateCode(String cateCode) {
|
||||||
|
this.cateCode = cateCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrencyCode(String currencyCode) {
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCateCode() {
|
||||||
|
return cateCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getCurrencyCode() {
|
||||||
|
return currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTacDefault() {
|
||||||
|
return tacDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getTacOnline() {
|
||||||
|
return tacOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTacDenial() {
|
||||||
|
return tacDenial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApplicationVersion() {
|
||||||
|
return applicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmvDDOL() {
|
||||||
|
return emvDDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmvTDOL() {
|
||||||
|
return emvTDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getPartialAidSelection() {
|
||||||
|
return partialAidSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTargetPercent() {
|
||||||
|
return targetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaxTargetPercent() {
|
||||||
|
return maxTargetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getThreshold() {
|
||||||
|
return threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFloorLimit() {
|
||||||
|
return floorLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCvmLimit() {
|
||||||
|
return cvmLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransLimit() {
|
||||||
|
return transLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransLimitCDV() {
|
||||||
|
return transLimitCDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTerminalCapability() {
|
||||||
|
return terminalCapability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRiskManageData() {
|
||||||
|
return riskManageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKernelType() {
|
||||||
|
return kernelType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTtq() {
|
||||||
|
return ttq;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAid() {
|
||||||
|
return aid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public boolean getAidEnable() {
|
||||||
|
return aidEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardLabel() {
|
||||||
|
return cardLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAidEnable(Boolean aidEnable) {
|
||||||
|
this.aidEnable = aidEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAid(String aid) {
|
||||||
|
this.aid = aid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardLabel(String cardLabel) {
|
||||||
|
this.cardLabel = cardLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplicationVersion(String applicationVersion) {
|
||||||
|
this.applicationVersion = applicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmvDDOL(String emvDDOL) {
|
||||||
|
this.emvDDOL = emvDDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmvTDOL(String emvTDOL) {
|
||||||
|
this.emvTDOL = emvTDOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPartialAidSelection(Boolean partialAidSelection) {
|
||||||
|
this.partialAidSelection = partialAidSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTargetPercent(String targetPercent) {
|
||||||
|
this.targetPercent = targetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxTargetPercent(String maxTargetPercent) {
|
||||||
|
this.maxTargetPercent = maxTargetPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThreshold(String threshold) {
|
||||||
|
this.threshold = threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacDefault(String tacDefault) {
|
||||||
|
this.tacDefault = tacDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacOnline(String tacOnline) {
|
||||||
|
this.tacOnline = tacOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTacDenial(String tacDenial) {
|
||||||
|
this.tacDenial = tacDenial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFloorLimit(String floorLimit) {
|
||||||
|
this.floorLimit = floorLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCvmLimit(Long cvmLimit) {
|
||||||
|
this.cvmLimit = cvmLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransLimit(String transLimit) {
|
||||||
|
this.transLimit = transLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransLimitCDV(String transLimitCDV) {
|
||||||
|
this.transLimitCDV = transLimitCDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminalCapability(String terminalCapability) {
|
||||||
|
this.terminalCapability = terminalCapability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRiskManageData(String riskManageData) {
|
||||||
|
this.riskManageData = riskManageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKernelType(String kernelType) {
|
||||||
|
this.kernelType = kernelType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTtq(String ttq) {
|
||||||
|
this.ttq = ttq;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
package com.utsmyanmar.baselib.db.model;
|
||||||
|
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
@Entity(tableName = "rid_table")
|
||||||
|
public class RidEntity {
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
private int id;
|
||||||
|
private String rid;
|
||||||
|
|
||||||
|
private String indx;
|
||||||
|
private String hashInd;
|
||||||
|
private String arithInd;
|
||||||
|
private String modul;
|
||||||
|
private String exponent;
|
||||||
|
private String expDate;
|
||||||
|
private String checkSum;
|
||||||
|
|
||||||
|
|
||||||
|
public RidEntity(String rid, String indx, String hashInd, String arithInd, String modul, String exponent, String expDate, String checkSum) {
|
||||||
|
this.rid = rid;
|
||||||
|
this.indx = indx;
|
||||||
|
this.hashInd = hashInd;
|
||||||
|
this.arithInd = arithInd;
|
||||||
|
this.modul = modul;
|
||||||
|
this.exponent = exponent;
|
||||||
|
this.expDate = expDate;
|
||||||
|
this.checkSum = checkSum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRid(String rid) {
|
||||||
|
this.rid = rid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndx(String indx) {
|
||||||
|
this.indx = indx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHashInd(String hashInd) {
|
||||||
|
this.hashInd = hashInd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArithInd(String arithInd) {
|
||||||
|
this.arithInd = arithInd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModul(String modul) {
|
||||||
|
this.modul = modul;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExponent(String exponent) {
|
||||||
|
this.exponent = exponent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpDate(String expDate) {
|
||||||
|
this.expDate = expDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCheckSum(String checkSum) {
|
||||||
|
this.checkSum = checkSum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRid() {
|
||||||
|
return rid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIndx() {
|
||||||
|
return indx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHashInd() {
|
||||||
|
return hashInd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArithInd() {
|
||||||
|
return arithInd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getModul() {
|
||||||
|
return modul;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExponent() {
|
||||||
|
return exponent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExpDate() {
|
||||||
|
return expDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCheckSum() {
|
||||||
|
return checkSum;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,601 @@
|
|||||||
|
package com.utsmyanmar.baselib.di;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import static com.utsmyanmar.baselib.db.AppDatabase.INSTANCE;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.security.keystore.KeyGenParameterSpec;
|
||||||
|
import android.security.keystore.KeyProperties;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.room.Room;
|
||||||
|
import androidx.room.RoomDatabase;
|
||||||
|
import androidx.room.migration.Migration;
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||||
|
import androidx.sqlite.db.SupportSQLiteOpenHelper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.AppDatabase;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.BinDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.ChipAidDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.MPUCtlsDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.PayDetailDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.PayPassDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.PayWaveDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.QuickPassDao;
|
||||||
|
import com.utsmyanmar.baselib.db.dao.RidDao;
|
||||||
|
import com.utsmyanmar.baselib.util.SecureKeyUtil;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
|
import java.security.KeyStore;
|
||||||
|
import java.security.KeyStoreException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.NoSuchProviderException;
|
||||||
|
import java.security.UnrecoverableEntryException;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
import javax.crypto.KeyGenerator;
|
||||||
|
import javax.crypto.SecretKey;
|
||||||
|
import javax.inject.Provider;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
import java.security.cert.CertificateException;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
import dagger.hilt.InstallIn;
|
||||||
|
import dagger.hilt.components.SingletonComponent;
|
||||||
|
import sunmi.sunmiui.utils.LogUtil;
|
||||||
|
|
||||||
|
@Module
|
||||||
|
@InstallIn(SingletonComponent.class)
|
||||||
|
public class DatabaseModule {
|
||||||
|
|
||||||
|
private static final String DATABASE_KEY_ALIAS = "RoomDatabaseKeyAlias"; // Alias for the database key in Android Keystore
|
||||||
|
private static final String ANDROID_KEYSTORE = "AndroidKeyStore";
|
||||||
|
|
||||||
|
private static final String DATABASE_NAME = "yoma";
|
||||||
|
|
||||||
|
static final Migration MIGRATION_7_8 = new Migration(7, 8) {
|
||||||
|
@Override
|
||||||
|
public void migrate(SupportSQLiteDatabase database) {
|
||||||
|
database.execSQL("ALTER TABLE paydetail "
|
||||||
|
+ " ADD COLUMN isSettlementEnabled INTEGER DEFAULT 0 NOT NULL");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static final Migration MIGRATION_8_9 = new Migration(8, 9) {
|
||||||
|
@Override
|
||||||
|
public void migrate(SupportSQLiteDatabase database) {
|
||||||
|
// local.execSQL("ALTER TABLE paydetail "
|
||||||
|
// + " ADD COLUMN isSettlementEnabled INTEGER DEFAULT 0 NOT NULL");
|
||||||
|
|
||||||
|
database.execSQL("ALTER TABLE emv_detail "
|
||||||
|
+ " ADD COLUMN paramType TEXT");
|
||||||
|
|
||||||
|
database.execSQL("ALTER TABLE emv_detail "
|
||||||
|
+ " ADD COLUMN kernelType TEXT");
|
||||||
|
|
||||||
|
database.execSQL("ALTER TABLE emv_detail "
|
||||||
|
+ " ADD COLUMN zeroCheck TEXT");
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static final Migration MIGRATION_9_10 = new Migration(9, 10) {
|
||||||
|
@Override
|
||||||
|
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||||
|
database.execSQL("ALTER TABLE paydetail "
|
||||||
|
+ " ADD COLUMN transCVM TEXT");
|
||||||
|
|
||||||
|
database.execSQL("DROP TABLE IF EXISTS chip_aid");
|
||||||
|
|
||||||
|
// Recreate the `chip_aid` table with the expected schema
|
||||||
|
database.execSQL(
|
||||||
|
"CREATE TABLE IF NOT EXISTS chip_aid (" +
|
||||||
|
"id INTEGER NOT NULL PRIMARY KEY, " +
|
||||||
|
"aid TEXT, " +
|
||||||
|
"aidEnable INTEGER NOT NULL, " +
|
||||||
|
"floorLimit TEXT, " +
|
||||||
|
"threshold TEXT, " +
|
||||||
|
"tacDenial TEXT, " +
|
||||||
|
"tacDefault TEXT, " +
|
||||||
|
"tacOnline TEXT, " +
|
||||||
|
"emvDDOL TEXT, " +
|
||||||
|
"transLimit TEXT, " +
|
||||||
|
"cvmLimit INTEGER NOT NULL, " +
|
||||||
|
"cardScheme TEXT, " +
|
||||||
|
"riskManageData TEXT, " +
|
||||||
|
"targetPercent TEXT, " +
|
||||||
|
"emvTDOL TEXT, " +
|
||||||
|
"currencyCode TEXT, " +
|
||||||
|
"maxTargetPercent TEXT, " +
|
||||||
|
"cateCode TEXT, " +
|
||||||
|
"partialAidSelection INTEGER NOT NULL, " +
|
||||||
|
"terminalCapability TEXT, " +
|
||||||
|
"applicationVersion TEXT" +
|
||||||
|
")"
|
||||||
|
);
|
||||||
|
|
||||||
|
database.execSQL("DROP TABLE IF EXISTS pay_wave");
|
||||||
|
|
||||||
|
database.execSQL(
|
||||||
|
"CREATE TABLE IF NOT EXISTS pay_wave (" +
|
||||||
|
"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
|
||||||
|
"floorLimit TEXT, " +
|
||||||
|
"threshold TEXT, " +
|
||||||
|
"tacDenial TEXT, " +
|
||||||
|
"cardLabel TEXT, " +
|
||||||
|
"tacDefault TEXT, " +
|
||||||
|
"emvDDOL TEXT, " +
|
||||||
|
"transLimit TEXT, " +
|
||||||
|
"kernelType TEXT, " +
|
||||||
|
"ttq TEXT, " +
|
||||||
|
"transLimitCDV TEXT, " +
|
||||||
|
"tacOnline TEXT, " +
|
||||||
|
"riskManageData TEXT, " +
|
||||||
|
"cvmLimit INTEGER NOT NULL, " +
|
||||||
|
"targetPercent TEXT, " +
|
||||||
|
"emvTDOL TEXT, " +
|
||||||
|
"currencyCode TEXT, " +
|
||||||
|
"maxTargetPercent TEXT, " +
|
||||||
|
"cateCode TEXT, " +
|
||||||
|
"partialAidSelection INTEGER NOT NULL, " +
|
||||||
|
"terminalCapability TEXT, " +
|
||||||
|
"applicationVersion TEXT, " +
|
||||||
|
"aid TEXT, " +
|
||||||
|
"aidEnable INTEGER NOT NULL" +
|
||||||
|
")"
|
||||||
|
);
|
||||||
|
|
||||||
|
database.execSQL("DROP TABLE IF EXISTS pay_pass");
|
||||||
|
|
||||||
|
database.execSQL(
|
||||||
|
"CREATE TABLE IF NOT EXISTS pay_pass (" +
|
||||||
|
"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
|
||||||
|
"floorLimit TEXT, " +
|
||||||
|
"threshold TEXT, " +
|
||||||
|
"tacDenial TEXT, " +
|
||||||
|
"cardLabel TEXT, " +
|
||||||
|
"tacDefault TEXT, " +
|
||||||
|
"emvDDOL TEXT, " +
|
||||||
|
"transLimit TEXT, " +
|
||||||
|
"kernelType TEXT, " +
|
||||||
|
"ttq TEXT, " +
|
||||||
|
"transLimitCDV TEXT, " +
|
||||||
|
"tacOnline TEXT, " +
|
||||||
|
"riskManageData TEXT, " +
|
||||||
|
"cvmLimit INTEGER NOT NULL, " +
|
||||||
|
"targetPercent TEXT, " +
|
||||||
|
"emvTDOL TEXT, " +
|
||||||
|
"currencyCode TEXT, " +
|
||||||
|
"maxTargetPercent TEXT, " +
|
||||||
|
"cateCode TEXT, " +
|
||||||
|
"partialAidSelection INTEGER NOT NULL, " +
|
||||||
|
"terminalCapability TEXT, " +
|
||||||
|
"applicationVersion TEXT, " +
|
||||||
|
"aid TEXT, " +
|
||||||
|
"aidEnable INTEGER NOT NULL" +
|
||||||
|
")"
|
||||||
|
);
|
||||||
|
|
||||||
|
database.execSQL("DROP TABLE IF EXISTS j_speedy");
|
||||||
|
|
||||||
|
database.execSQL(
|
||||||
|
"CREATE TABLE IF NOT EXISTS j_speedy (" +
|
||||||
|
"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
|
||||||
|
"floorLimit TEXT, " +
|
||||||
|
"threshold TEXT, " +
|
||||||
|
"tacDenial TEXT, " +
|
||||||
|
"cardLabel TEXT, " +
|
||||||
|
"tacDefault TEXT, " +
|
||||||
|
"emvDDOL TEXT, " +
|
||||||
|
"transLimit TEXT, " +
|
||||||
|
"kernelType TEXT, " +
|
||||||
|
"ttq TEXT, " +
|
||||||
|
"transLimitCDV TEXT, " +
|
||||||
|
"tacOnline TEXT, " +
|
||||||
|
"riskManageData TEXT, " +
|
||||||
|
"cvmLimit INTEGER NOT NULL, " +
|
||||||
|
"targetPercent TEXT, " +
|
||||||
|
"emvTDOL TEXT, " +
|
||||||
|
"currencyCode TEXT, " +
|
||||||
|
"maxTargetPercent TEXT, " +
|
||||||
|
"cateCode TEXT, " +
|
||||||
|
"partialAidSelection INTEGER NOT NULL, " +
|
||||||
|
"terminalCapability TEXT, " +
|
||||||
|
"applicationVersion TEXT, " +
|
||||||
|
"aid TEXT, " +
|
||||||
|
"aidEnable INTEGER NOT NULL" +
|
||||||
|
")"
|
||||||
|
);
|
||||||
|
|
||||||
|
database.execSQL("DROP TABLE IF EXISTS quick_pass");
|
||||||
|
|
||||||
|
database.execSQL(
|
||||||
|
"CREATE TABLE IF NOT EXISTS quick_pass (" +
|
||||||
|
"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
|
||||||
|
"floorLimit TEXT, " +
|
||||||
|
"threshold TEXT, " +
|
||||||
|
"tacDenial TEXT, " +
|
||||||
|
"cardLabel TEXT, " +
|
||||||
|
"tacDefault TEXT, " +
|
||||||
|
"emvDDOL TEXT, " +
|
||||||
|
"transLimit TEXT, " +
|
||||||
|
"kernelType TEXT, " +
|
||||||
|
"ttq TEXT, " +
|
||||||
|
"transLimitCDV TEXT, " +
|
||||||
|
"tacOnline TEXT, " +
|
||||||
|
"riskManageData TEXT, " +
|
||||||
|
"cvmLimit INTEGER NOT NULL, " +
|
||||||
|
"targetPercent TEXT, " +
|
||||||
|
"emvTDOL TEXT, " +
|
||||||
|
"currencyCode TEXT, " +
|
||||||
|
"maxTargetPercent TEXT, " +
|
||||||
|
"cateCode TEXT, " +
|
||||||
|
"partialAidSelection INTEGER NOT NULL, " +
|
||||||
|
"terminalCapability TEXT, " +
|
||||||
|
"applicationVersion TEXT, " +
|
||||||
|
"aid TEXT, " +
|
||||||
|
"aidEnable INTEGER NOT NULL" +
|
||||||
|
")"
|
||||||
|
);
|
||||||
|
|
||||||
|
database.execSQL("DROP TABLE IF EXISTS mpu_ctls");
|
||||||
|
|
||||||
|
database.execSQL(
|
||||||
|
"CREATE TABLE IF NOT EXISTS mpu_ctls (" +
|
||||||
|
"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
|
||||||
|
"floorLimit TEXT, " +
|
||||||
|
"threshold TEXT, " +
|
||||||
|
"tacDenial TEXT, " +
|
||||||
|
"cardLabel TEXT, " +
|
||||||
|
"tacDefault TEXT, " +
|
||||||
|
"emvDDOL TEXT, " +
|
||||||
|
"transLimit TEXT, " +
|
||||||
|
"kernelType TEXT, " +
|
||||||
|
"ttq TEXT, " +
|
||||||
|
"transLimitCDV TEXT, " +
|
||||||
|
"tacOnline TEXT, " +
|
||||||
|
"riskManageData TEXT, " +
|
||||||
|
"cvmLimit INTEGER NOT NULL, " +
|
||||||
|
"targetPercent TEXT, " +
|
||||||
|
"emvTDOL TEXT, " +
|
||||||
|
"currencyCode TEXT, " +
|
||||||
|
"maxTargetPercent TEXT, " +
|
||||||
|
"cateCode TEXT, " +
|
||||||
|
"partialAidSelection INTEGER NOT NULL, " +
|
||||||
|
"terminalCapability TEXT, " +
|
||||||
|
"applicationVersion TEXT, " +
|
||||||
|
"aid TEXT, " +
|
||||||
|
"aidEnable INTEGER NOT NULL" +
|
||||||
|
")"
|
||||||
|
);
|
||||||
|
|
||||||
|
database.execSQL("DROP TABLE IF EXISTS rid_table");
|
||||||
|
|
||||||
|
// Create the new table with the specified columns and types
|
||||||
|
database.execSQL(
|
||||||
|
"CREATE TABLE IF NOT EXISTS rid_table (" +
|
||||||
|
"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
|
||||||
|
"checkSum TEXT, " +
|
||||||
|
"rid TEXT, " +
|
||||||
|
"hashInd TEXT, " +
|
||||||
|
"modul TEXT, " +
|
||||||
|
"arithInd TEXT, " +
|
||||||
|
"indx TEXT, " +
|
||||||
|
"expDate TEXT, " +
|
||||||
|
"exponent TEXT" +
|
||||||
|
")"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static final Migration MIGRATION_10_11 = new Migration(10, 11) {
|
||||||
|
@Override
|
||||||
|
public void migrate(SupportSQLiteDatabase database) {
|
||||||
|
// local.execSQL("ALTER TABLE paydetail "
|
||||||
|
// + " ADD COLUMN isSettlementEnabled INTEGER DEFAULT 0 NOT NULL");
|
||||||
|
|
||||||
|
database.execSQL("DROP TABLE IF EXISTS bin_table");
|
||||||
|
|
||||||
|
// Create the new table with the specified columns and types
|
||||||
|
database.execSQL(
|
||||||
|
"CREATE TABLE IF NOT EXISTS bin_table (" +
|
||||||
|
"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
|
||||||
|
"binRangeStart TEXT, " +
|
||||||
|
"binRangeEnd TEXT, " +
|
||||||
|
"cardScheme TEXT, " +
|
||||||
|
"issuerName TEXT, " +
|
||||||
|
"countryCode TEXT, " +
|
||||||
|
"currencyCode TEXT, " +
|
||||||
|
"cardType TEXT, " +
|
||||||
|
"transCVM TEXT," +
|
||||||
|
"contactlessCapable INTEGER NOT NULL, " +
|
||||||
|
"magCapable INTEGER NOT NULL, " +
|
||||||
|
"additionalInfo TEXT" +
|
||||||
|
")"
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static final Migration MIGRATION_11_12 = new Migration(11, 12) {
|
||||||
|
@Override
|
||||||
|
public void migrate(SupportSQLiteDatabase database) {
|
||||||
|
|
||||||
|
database.execSQL("DROP TABLE IF EXISTS j_speedy");
|
||||||
|
database.execSQL("DROP TABLE IF EXISTS emv_detail");
|
||||||
|
|
||||||
|
// Handle rid_table - either recreate it or ensure it matches expected schema
|
||||||
|
// Option A: If rid_table structure needs to change, recreate it
|
||||||
|
database.execSQL("DROP TABLE IF EXISTS rid_table");
|
||||||
|
database.execSQL(
|
||||||
|
"CREATE TABLE IF NOT EXISTS rid_table (" +
|
||||||
|
"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
|
||||||
|
"checkSum TEXT, " +
|
||||||
|
"rid TEXT, " +
|
||||||
|
"hashInd TEXT, " +
|
||||||
|
"modul TEXT, " +
|
||||||
|
"arithInd TEXT, " +
|
||||||
|
"indx TEXT, " +
|
||||||
|
"expDate TEXT, " +
|
||||||
|
"exponent TEXT" +
|
||||||
|
")"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private static byte[] getDatabaseKey(Context context) throws KeyStoreException, CertificateException,
|
||||||
|
NoSuchAlgorithmException, IOException, NoSuchProviderException,
|
||||||
|
InvalidAlgorithmParameterException, UnrecoverableEntryException {
|
||||||
|
|
||||||
|
KeyStore keyStore = KeyStore.getInstance(ANDROID_KEYSTORE);
|
||||||
|
keyStore.load(null); // Load the Keystore
|
||||||
|
|
||||||
|
// Check if the key already exists
|
||||||
|
if (!keyStore.containsAlias(DATABASE_KEY_ALIAS)) {
|
||||||
|
// Key does not exist, generate a new one
|
||||||
|
LogUtil.d("Keystore", "Generating new database encryption key.");
|
||||||
|
KeyGenerator keyGenerator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, ANDROID_KEYSTORE);
|
||||||
|
|
||||||
|
// Specify key properties: AES algorithm, purpose (encrypt/decrypt), block mode (GCM), padding (NoPadding)
|
||||||
|
// GCM is recommended for authenticated encryption.
|
||||||
|
KeyGenParameterSpec.Builder builder = new KeyGenParameterSpec.Builder(DATABASE_KEY_ALIAS,
|
||||||
|
KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
|
||||||
|
.setBlockModes(KeyProperties.BLOCK_MODE_GCM)
|
||||||
|
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
|
||||||
|
// Set key size (e.g., 256 bits)
|
||||||
|
.setKeySize(256);
|
||||||
|
|
||||||
|
// Optional: Require user authentication to use the key (adds an extra layer of security)
|
||||||
|
// .setUserAuthenticationRequired(true)
|
||||||
|
// .setUserAuthenticationValidityDurationSeconds(300); // e.g., 5 minutes
|
||||||
|
|
||||||
|
keyGenerator.init(builder.build());
|
||||||
|
SecretKey secretKey = keyGenerator.generateKey();
|
||||||
|
LogUtil.d("Keystore", "Database encryption key generated.");
|
||||||
|
return secretKey.getEncoded(); // Return the raw key bytes
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Key exists, retrieve it
|
||||||
|
LogUtil.d("Keystore", "Retrieving existing database encryption key.");
|
||||||
|
KeyStore.SecretKeyEntry entry = (KeyStore.SecretKeyEntry) keyStore.getEntry(DATABASE_KEY_ALIAS, null);
|
||||||
|
SecretKey secretKey = entry.getSecretKey();
|
||||||
|
LogUtil.d("Keystore", "Database encryption key retrieved.");
|
||||||
|
return secretKey.getEncoded(); // Return the raw key bytes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public static AppDatabase provideAppDatabase(Application application) {
|
||||||
|
return Room.databaseBuilder(application, AppDatabase.class,"yoma")
|
||||||
|
// .fallbackToDestructiveMigration()
|
||||||
|
.addMigrations(MIGRATION_7_8)
|
||||||
|
.addMigrations(MIGRATION_8_9)
|
||||||
|
.addMigrations(MIGRATION_9_10)
|
||||||
|
.addMigrations(MIGRATION_10_11)
|
||||||
|
.addMigrations(MIGRATION_11_12)
|
||||||
|
.allowMainThreadQueries()
|
||||||
|
.addCallback(new RoomDatabase.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onCreate(@NonNull SupportSQLiteDatabase db) {
|
||||||
|
super.onCreate(db);
|
||||||
|
Executors.newSingleThreadScheduledExecutor().execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* init here
|
||||||
|
* */
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build();
|
||||||
|
// if (INSTANCE == null) {
|
||||||
|
// synchronized (AppDatabase.class) {
|
||||||
|
// if (INSTANCE == null) {
|
||||||
|
// try {
|
||||||
|
// // Step 1: Try to get the database key
|
||||||
|
// byte[] databaseKey = getDatabaseKey(application.getApplicationContext());
|
||||||
|
//
|
||||||
|
// // Create the SQLCipher factory with the key
|
||||||
|
// SupportSQLiteOpenHelper.Factory factory = new SupportFactory(databaseKey);
|
||||||
|
//
|
||||||
|
// // Try to build and open the database
|
||||||
|
// try {
|
||||||
|
// INSTANCE = Room.databaseBuilder(application,
|
||||||
|
// AppDatabase.class, DATABASE_NAME)
|
||||||
|
// .openHelperFactory(factory)
|
||||||
|
// .addMigrations(MIGRATION_7_8)
|
||||||
|
// .addMigrations(MIGRATION_8_9)
|
||||||
|
// .addMigrations(MIGRATION_9_10)
|
||||||
|
// .addMigrations(MIGRATION_10_11)
|
||||||
|
// .addMigrations(MIGRATION_11_12)
|
||||||
|
// .allowMainThreadQueries()
|
||||||
|
// .build();
|
||||||
|
//
|
||||||
|
// // Validate the database connection by performing a simple query
|
||||||
|
// // This will throw an exception if the key is wrong
|
||||||
|
// INSTANCE.getOpenHelper().getWritableDatabase();
|
||||||
|
// LogUtil.d("Database", "Database opened successfully with encryption key");
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// LogUtil.e("Database", "Error opening encrypted database: " + e.getMessage()+ e);
|
||||||
|
//
|
||||||
|
// // The key might be wrong - check if this is a first-time issue or a key mismatch
|
||||||
|
// if (isDatabaseFileCorruptOrWrongKey(application)) {
|
||||||
|
// LogUtil.w("Database", "Database file exists but can't be opened with current key. Recreating database.");
|
||||||
|
//
|
||||||
|
// // Delete the existing database file
|
||||||
|
// handleDatabaseRecreation(application);
|
||||||
|
//
|
||||||
|
// // Create a new database with the current key
|
||||||
|
// INSTANCE = Room.databaseBuilder(application,
|
||||||
|
// AppDatabase.class, DATABASE_NAME)
|
||||||
|
// .openHelperFactory(factory)
|
||||||
|
// .addMigrations(MIGRATION_7_8)
|
||||||
|
// .addMigrations(MIGRATION_8_9)
|
||||||
|
// .addMigrations(MIGRATION_9_10)
|
||||||
|
// .addMigrations(MIGRATION_10_11)
|
||||||
|
// .addMigrations(MIGRATION_11_12)
|
||||||
|
// .allowMainThreadQueries()
|
||||||
|
// .build();
|
||||||
|
// } else {
|
||||||
|
// // If it's not a key issue, rethrow the exception
|
||||||
|
// throw e;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// LogUtil.e("Database", "Critical error initializing database: " + e.getMessage()+ e);
|
||||||
|
// throw new RuntimeException("Failed to initialize the database", e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static boolean isDatabaseFileCorruptOrWrongKey(Application application) {
|
||||||
|
File dbFile = application.getDatabasePath(DATABASE_NAME);
|
||||||
|
return dbFile.exists() && dbFile.length() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle database recreation by deleting existing files
|
||||||
|
*/
|
||||||
|
private static void handleDatabaseRecreation(Application application) {
|
||||||
|
// Delete the main database file
|
||||||
|
File dbFile = application.getDatabasePath(DATABASE_NAME);
|
||||||
|
if (dbFile.exists()) {
|
||||||
|
boolean deleted = dbFile.delete();
|
||||||
|
LogUtil.d("Database", "Database file deleted: " + deleted);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete any associated journal or WAL files
|
||||||
|
File dbJournal = new File(dbFile.getPath() + "-journal");
|
||||||
|
if (dbJournal.exists()) {
|
||||||
|
dbJournal.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
File dbWal = new File(dbFile.getPath() + "-wal");
|
||||||
|
if (dbWal.exists()) {
|
||||||
|
dbWal.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
File dbShm = new File(dbFile.getPath() + "-shm");
|
||||||
|
if (dbShm.exists()) {
|
||||||
|
dbShm.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save information that we've recreated the database
|
||||||
|
SharedPreferences prefs = application.getSharedPreferences("db_prefs", Context.MODE_PRIVATE);
|
||||||
|
prefs.edit()
|
||||||
|
.putBoolean("db_recreated", true)
|
||||||
|
.putLong("db_recreated_time", System.currentTimeMillis())
|
||||||
|
.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
// return Room.databaseBuilder(application, AppDatabase.class,"yoma")
|
||||||
|
//// .fallbackToDestructiveMigration()
|
||||||
|
// .addMigrations(MIGRATION_7_8)
|
||||||
|
// .addMigrations(MIGRATION_8_9)
|
||||||
|
// .addMigrations(MIGRATION_9_10)
|
||||||
|
// .addMigrations(MIGRATION_10_11)
|
||||||
|
// .addMigrations(MIGRATION_11_12)
|
||||||
|
// .allowMainThreadQueries()
|
||||||
|
// .addCallback(new RoomDatabase.Callback() {
|
||||||
|
// @Override
|
||||||
|
// public void onCreate(@NonNull SupportSQLiteDatabase db) {
|
||||||
|
// super.onCreate(db);
|
||||||
|
// Executors.newSingleThreadScheduledExecutor().execute(new Runnable() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
//
|
||||||
|
// /*
|
||||||
|
// * init here
|
||||||
|
// * */
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .build();
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public static PayDetailDao providePayDetailDao(AppDatabase appDatabase){
|
||||||
|
return appDatabase.payDetailDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public static ChipAidDao provideChipAidDao(AppDatabase appDatabase) {
|
||||||
|
return appDatabase.chipAidDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public static PayWaveDao providePayWaveDao(AppDatabase appDatabase) {
|
||||||
|
return appDatabase.payWaveDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public static PayPassDao providePayPassDao(AppDatabase appDatabase) {
|
||||||
|
return appDatabase.payPassDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public static QuickPassDao provideQuickPassDao(AppDatabase appDatabase) {
|
||||||
|
return appDatabase.quickPassDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public static RidDao provideRidDao(AppDatabase appDatabase) {
|
||||||
|
return appDatabase.ridDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public static MPUCtlsDao provideMPUCtlsDao(AppDatabase appDatabase) { return appDatabase.mpuCtlsDao(); }
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public static BinDao provideBinDao(AppDatabase appDatabase) { return appDatabase.binDao(); }
|
||||||
|
}
|
||||||
@ -0,0 +1,379 @@
|
|||||||
|
package com.utsmyanmar.baselib.di;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.utsmyanmar.baselib.BuildConfig;
|
||||||
|
import com.utsmyanmar.baselib.network.SiriusApiService;
|
||||||
|
import com.utsmyanmar.baselib.network.WaveApiService;
|
||||||
|
import com.utsmyanmar.baselib.network.WaveTokenApiService;
|
||||||
|
import com.utsmyanmar.baselib.network.interceptor.HostSelectionInterceptor;
|
||||||
|
import com.utsmyanmar.baselib.network.interceptor.QRAuthInterceptor;
|
||||||
|
import com.utsmyanmar.baselib.network.interceptor.SiriusInterceptor;
|
||||||
|
import com.utsmyanmar.baselib.network.interceptor.WaveAuthInterceptor;
|
||||||
|
import com.utsmyanmar.paylibs.Constant;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.security.cert.CertificateException;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import javax.inject.Qualifier;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
import javax.net.ssl.HostnameVerifier;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLSession;
|
||||||
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
import dagger.hilt.InstallIn;
|
||||||
|
import dagger.hilt.components.SingletonComponent;
|
||||||
|
import hu.akarnokd.rxjava3.retrofit.RxJava3CallAdapterFactory;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.logging.HttpLoggingInterceptor;
|
||||||
|
import retrofit2.Retrofit;
|
||||||
|
import retrofit2.converter.gson.GsonConverterFactory;
|
||||||
|
import sunmi.sunmiui.utils.LogUtil;
|
||||||
|
|
||||||
|
@Module
|
||||||
|
@InstallIn(SingletonComponent.class)
|
||||||
|
public class NetworkModule {
|
||||||
|
|
||||||
|
|
||||||
|
public static native String getTMSUrlFromNative();
|
||||||
|
|
||||||
|
private static OkHttpClient getUnsafeOkHttpClient() {
|
||||||
|
try {
|
||||||
|
// Create a trust manager that does not validate certificate chains
|
||||||
|
final TrustManager[] trustAllCerts = new TrustManager[]{
|
||||||
|
new X509TrustManager() {
|
||||||
|
@Override
|
||||||
|
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return new java.security.cert.X509Certificate[]{};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Install the all-trusting trust manager
|
||||||
|
final SSLContext sslContext = SSLContext.getInstance("SSL");
|
||||||
|
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
|
||||||
|
// Create an ssl socket factory with our all-trusting manager
|
||||||
|
final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
|
||||||
|
|
||||||
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
|
builder.sslSocketFactory(sslSocketFactory, (X509TrustManager) trustAllCerts[0]);
|
||||||
|
builder.hostnameVerifier(new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.connectTimeout(1, TimeUnit.MINUTES);
|
||||||
|
builder.readTimeout(1, TimeUnit.MINUTES);
|
||||||
|
|
||||||
|
OkHttpClient okHttpClient = builder.build();
|
||||||
|
return okHttpClient;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static OkHttpClient.Builder getUnsafeOkHttpClientBuilder() {
|
||||||
|
try {
|
||||||
|
// Create a trust manager that does not validate certificate chains
|
||||||
|
final TrustManager[] trustAllCerts = new TrustManager[]{
|
||||||
|
new X509TrustManager() {
|
||||||
|
@Override
|
||||||
|
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return new java.security.cert.X509Certificate[]{};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Install the all-trusting trust manager
|
||||||
|
final SSLContext sslContext = SSLContext.getInstance("SSL");
|
||||||
|
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
|
||||||
|
// Create an ssl socket factory with our all-trusting manager
|
||||||
|
final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
|
||||||
|
|
||||||
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
|
builder.sslSocketFactory(sslSocketFactory, (X509TrustManager) trustAllCerts[0]);
|
||||||
|
builder.hostnameVerifier(new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.connectTimeout(1, TimeUnit.MINUTES);
|
||||||
|
builder.readTimeout(1, TimeUnit.MINUTES);
|
||||||
|
|
||||||
|
// OkHttpClient okHttpClient = builder.build();
|
||||||
|
return builder;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @Provides
|
||||||
|
// @Singleton
|
||||||
|
// public QRAuthInterceptor provideAuthInterceptor(WaveTokenApiService tokenApiService) {
|
||||||
|
// return new QRAuthInterceptor(tokenApiService);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @Provides
|
||||||
|
// @Singleton
|
||||||
|
// public WaveApiService provideWaveApiService() {
|
||||||
|
//
|
||||||
|
//// OkHttpClient.Builder client = getUnsafeOkHttpClientBuilder();
|
||||||
|
//// client.addNetworkInterceptor(new WaveAuthInterceptor());
|
||||||
|
// HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
|
||||||
|
// interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
|
// if(BuildConfig.DEBUG) {
|
||||||
|
// builder.addInterceptor(interceptor);
|
||||||
|
// }
|
||||||
|
// builder.addNetworkInterceptor(new WaveAuthInterceptor());
|
||||||
|
// builder.addInterceptor(new HostSelectionInterceptor());
|
||||||
|
//
|
||||||
|
// builder.connectTimeout(60,TimeUnit.SECONDS);
|
||||||
|
// builder.readTimeout(60,TimeUnit.SECONDS);
|
||||||
|
// builder.writeTimeout(60,TimeUnit.SECONDS);
|
||||||
|
// builder.retryOnConnectionFailure(true);
|
||||||
|
//
|
||||||
|
// OkHttpClient client = builder.build();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// String baseUrl = "";
|
||||||
|
// String IpAddress = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// if(IpAddress != null && !IpAddress.isEmpty()) {
|
||||||
|
// baseUrl = IpAddress;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(baseUrl.isEmpty()) {
|
||||||
|
// baseUrl = "https://devapi.yomabank.net/";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// final Gson gson =
|
||||||
|
// new GsonBuilder().create();
|
||||||
|
//
|
||||||
|
// return new Retrofit.Builder()
|
||||||
|
// .baseUrl(baseUrl)
|
||||||
|
// .addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||||
|
// .addConverterFactory(GsonConverterFactory.create(gson))
|
||||||
|
// .client(client)
|
||||||
|
// .build()
|
||||||
|
// .create(WaveApiService.class);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public WaveApiService provideWaveApiService(QRAuthInterceptor qrAuthInterceptor) {
|
||||||
|
|
||||||
|
// OkHttpClient.Builder client = getUnsafeOkHttpClientBuilder();
|
||||||
|
// client.addNetworkInterceptor(new WaveAuthInterceptor());
|
||||||
|
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
|
||||||
|
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
|
||||||
|
|
||||||
|
|
||||||
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
|
if(BuildConfig.DEBUG) {
|
||||||
|
builder.addInterceptor(interceptor);
|
||||||
|
}
|
||||||
|
// builder.addNetworkInterceptor(new WaveAuthInterceptor());
|
||||||
|
builder.addInterceptor(new HostSelectionInterceptor());
|
||||||
|
builder.addInterceptor(qrAuthInterceptor);
|
||||||
|
builder.connectTimeout(60,TimeUnit.SECONDS);
|
||||||
|
builder.readTimeout(60,TimeUnit.SECONDS);
|
||||||
|
builder.writeTimeout(60,TimeUnit.SECONDS);
|
||||||
|
builder.retryOnConnectionFailure(true);
|
||||||
|
|
||||||
|
OkHttpClient client = builder.build();
|
||||||
|
|
||||||
|
|
||||||
|
String baseUrl = "";
|
||||||
|
String IpAddress = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
||||||
|
|
||||||
|
|
||||||
|
if(IpAddress != null && !IpAddress.isEmpty()) {
|
||||||
|
baseUrl = IpAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(baseUrl.isEmpty()) {
|
||||||
|
baseUrl = "https://devapi.yomabank.net/";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final Gson gson =
|
||||||
|
new GsonBuilder().create();
|
||||||
|
|
||||||
|
return new Retrofit.Builder()
|
||||||
|
.baseUrl(baseUrl)
|
||||||
|
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||||
|
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||||
|
.client(client)
|
||||||
|
.build()
|
||||||
|
.create(WaveApiService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Provides
|
||||||
|
// @Singleton
|
||||||
|
// public WaveTokenApiService provideWaveTokenApiService() {
|
||||||
|
//
|
||||||
|
//// OkHttpClient.Builder client = getUnsafeOkHttpClientBuilder();
|
||||||
|
//// client.addNetworkInterceptor(new WaveAuthInterceptor());
|
||||||
|
// HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
|
||||||
|
// interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
|
||||||
|
//
|
||||||
|
// OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
|
// if(BuildConfig.DEBUG) {
|
||||||
|
// builder.addInterceptor(interceptor);
|
||||||
|
// }
|
||||||
|
// builder.addInterceptor(new HostSelectionInterceptor());
|
||||||
|
// builder.addNetworkInterceptor(new WaveAuthInterceptor());
|
||||||
|
// builder.connectTimeout(30,TimeUnit.SECONDS);
|
||||||
|
// builder.readTimeout(30,TimeUnit.SECONDS);
|
||||||
|
// builder.writeTimeout(30,TimeUnit.SECONDS);
|
||||||
|
// builder.retryOnConnectionFailure(true);
|
||||||
|
// OkHttpClient client = builder.build();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// String baseUrl = "";
|
||||||
|
// String IpAddress = SystemParamsOperation.getInstance().getTokenHostAddress();
|
||||||
|
//
|
||||||
|
// if(IpAddress != null && !IpAddress.isEmpty()) {
|
||||||
|
// baseUrl = IpAddress;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(baseUrl.isEmpty()) {
|
||||||
|
// baseUrl = "https://devapi.yomabank.net/";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// final Gson gson =
|
||||||
|
// new GsonBuilder().create();
|
||||||
|
//
|
||||||
|
// return new Retrofit.Builder()
|
||||||
|
// .baseUrl(baseUrl)
|
||||||
|
// .addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||||
|
// .addConverterFactory(GsonConverterFactory.create(gson))
|
||||||
|
// .client(client)
|
||||||
|
// .build()
|
||||||
|
// .create(WaveTokenApiService.class);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public WaveTokenApiService provideWaveTokenApiService(@TokenRetrofit Retrofit retrofit) {
|
||||||
|
return retrofit.create(WaveTokenApiService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
@TokenRetrofit
|
||||||
|
public Retrofit provideWaveTokenRetrofit() {
|
||||||
|
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
|
||||||
|
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
|
||||||
|
|
||||||
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
|
if(BuildConfig.DEBUG) {
|
||||||
|
builder.addInterceptor(interceptor);
|
||||||
|
}
|
||||||
|
builder.addInterceptor(new HostSelectionInterceptor());
|
||||||
|
// builder.addNetworkInterceptor(new WaveAuthInterceptor());
|
||||||
|
builder.connectTimeout(30,TimeUnit.SECONDS);
|
||||||
|
builder.readTimeout(30,TimeUnit.SECONDS);
|
||||||
|
builder.writeTimeout(30,TimeUnit.SECONDS);
|
||||||
|
builder.retryOnConnectionFailure(true);
|
||||||
|
OkHttpClient client = builder.build();
|
||||||
|
|
||||||
|
String baseUrl = "";
|
||||||
|
String IpAddress = SystemParamsOperation.getInstance().getTokenHostAddress();
|
||||||
|
|
||||||
|
if(IpAddress != null && !IpAddress.isEmpty()) {
|
||||||
|
baseUrl = IpAddress.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(baseUrl.isEmpty()) {
|
||||||
|
baseUrl = "https://devapi.yomabank.net/";
|
||||||
|
}
|
||||||
|
return new Retrofit.Builder()
|
||||||
|
.baseUrl(baseUrl)
|
||||||
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
|
.client(client)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public SiriusApiService provideSiriusApiService() {
|
||||||
|
|
||||||
|
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
|
||||||
|
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
|
||||||
|
// OkHttpClient.Builder client = getUnsafeOkHttpClientBuilder();
|
||||||
|
OkHttpClient.Builder client = new OkHttpClient.Builder();
|
||||||
|
// client.connectTimeout(10,TimeUnit.SECONDS);
|
||||||
|
client.addNetworkInterceptor(new SiriusInterceptor());
|
||||||
|
|
||||||
|
if(BuildConfig.DEBUG) {
|
||||||
|
client.addInterceptor(interceptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String tmsAddress = SystemParamsOperation.getInstance().getTmsAddress();
|
||||||
|
|
||||||
|
if(tmsAddress == null || tmsAddress.equals("")) {
|
||||||
|
tmsAddress = getTMSUrlFromNative();
|
||||||
|
}
|
||||||
|
|
||||||
|
String baseUrl = tmsAddress.trim() + "/api/v1/";
|
||||||
|
|
||||||
|
|
||||||
|
final Gson gson =
|
||||||
|
new GsonBuilder().create();
|
||||||
|
|
||||||
|
return new Retrofit.Builder()
|
||||||
|
.baseUrl(baseUrl)
|
||||||
|
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||||
|
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||||
|
.client(client.build())
|
||||||
|
.build()
|
||||||
|
.create(SiriusApiService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Qualifier
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface TokenRetrofit{}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.utsmyanmar.baselib.emv;
|
||||||
|
|
||||||
|
public enum CvmEvent {
|
||||||
|
|
||||||
|
CONFIRMATION_CODE,
|
||||||
|
CONSUMER_DEVICE,
|
||||||
|
CERTIFICATE,
|
||||||
|
ECASH_PIN,
|
||||||
|
NO_CVM,
|
||||||
|
OFFLINE_PIN,
|
||||||
|
ONLINE_PIN_AND_SIGN,
|
||||||
|
ONLINE_PIN,
|
||||||
|
SIGNATURE,
|
||||||
|
VERIFY_OFFLINE_PIN,
|
||||||
|
END
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.utsmyanmar.baselib.emv;
|
||||||
|
|
||||||
|
import com.sunmi.pay.hardware.aidlv2.bean.AidV2;
|
||||||
|
import com.utsmyanmar.baselib.db.model.ContactlessAid;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||||
|
|
||||||
|
public interface EmvAppConfig {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,338 @@
|
|||||||
|
package com.utsmyanmar.baselib.emv;
|
||||||
|
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
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.ContactAid;
|
||||||
|
import com.utsmyanmar.baselib.db.model.ContactlessAid;
|
||||||
|
import com.utsmyanmar.baselib.db.model.RidEntity;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import sunmi.sunmiui.utils.LogUtil;
|
||||||
|
|
||||||
|
public class EmvParamHelper {
|
||||||
|
|
||||||
|
private static EmvParamHelper instance;
|
||||||
|
|
||||||
|
private static final String TAG = EmvParamHelper.class.getSimpleName();
|
||||||
|
|
||||||
|
private EMVOptV2 emvOptV2;
|
||||||
|
|
||||||
|
public static EmvParamHelper getInstance() {
|
||||||
|
if(instance == null) {
|
||||||
|
instance = new EmvParamHelper();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private EmvParamHelper() {
|
||||||
|
this.emvOptV2 = BaseApplication.getInstance().mEMVOptV2;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 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 initializeRids(RidEntity entity) {
|
||||||
|
CapkV2 capkV2 = convertRid(entity);
|
||||||
|
try {
|
||||||
|
emvOptV2.addCapk(capkV2);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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("00");
|
||||||
|
aidV2.extSelectSupFlg = 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");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(contactlessAid.getRiskManageData() != null && !contactlessAid.getRiskManageData().isEmpty()) {
|
||||||
|
|
||||||
|
aidV2.riskManData = ByteUtil.hexStr2Bytes(contactlessAid.getRiskManageData());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contactAid.getRiskManageData() != null && !contactAid.getRiskManageData().isEmpty()) {
|
||||||
|
aidV2.riskManData = ByteUtil.hexStr2Bytes(contactAid.getRiskManageData());
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void convertData(List<ContactAid> aidValue) {
|
||||||
|
|
||||||
|
for (ContactAid contactAid : aidValue) {
|
||||||
|
Log.d(TAG, "aid : "+ contactAid.getAid());
|
||||||
|
Log.d(TAG, "cvm limit : "+ contactAid.getCvmLimit());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,492 @@
|
|||||||
|
package com.utsmyanmar.baselib.emv;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
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;
|
||||||
|
import com.utsmyanmar.baselib.db.model.ChipAidEntity;
|
||||||
|
import com.utsmyanmar.baselib.db.model.MPUCtlsEntity;
|
||||||
|
import com.utsmyanmar.baselib.db.model.PayPassEntity;
|
||||||
|
import com.utsmyanmar.baselib.db.model.PayWaveEntity;
|
||||||
|
import com.utsmyanmar.baselib.db.model.QuickPassEntity;
|
||||||
|
import com.utsmyanmar.baselib.db.model.RidEntity;
|
||||||
|
import com.utsmyanmar.baselib.repo.local.BinRepository;
|
||||||
|
import com.utsmyanmar.baselib.repo.local.ChipAidRepository;
|
||||||
|
import com.utsmyanmar.baselib.repo.local.MPUCtlsRepository;
|
||||||
|
import com.utsmyanmar.baselib.repo.local.PayPassRepository;
|
||||||
|
import com.utsmyanmar.baselib.repo.local.PayWaveRepository;
|
||||||
|
import com.utsmyanmar.baselib.repo.local.QuickPassRepository;
|
||||||
|
import com.utsmyanmar.baselib.repo.local.RidRepository;
|
||||||
|
import com.utsmyanmar.baselib.util.TerminalUtil;
|
||||||
|
import com.utsmyanmar.baselib.util.rx_helper.ProcessDataResult;
|
||||||
|
import com.utsmyanmar.baselib.util.rx_helper.ProcessSingleDataResult;
|
||||||
|
import com.utsmyanmar.baselib.util.rx_helper.RxCallbackUpdateX;
|
||||||
|
import com.utsmyanmar.baselib.util.rx_helper.RxUtil;
|
||||||
|
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import dagger.hilt.android.qualifiers.ApplicationContext;
|
||||||
|
import io.reactivex.rxjava3.annotations.NonNull;
|
||||||
|
import io.reactivex.rxjava3.core.CompletableObserver;
|
||||||
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
|
import sunmi.sunmiui.utils.LogUtil;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class EmvParamOperation extends ParamOperation{
|
||||||
|
|
||||||
|
private static final String TAG = EmvParamOperation.class.getSimpleName();
|
||||||
|
|
||||||
|
private final PayWaveRepository payWaveRepository;
|
||||||
|
|
||||||
|
private final PayPassRepository payPassRepository;
|
||||||
|
|
||||||
|
private final QuickPassRepository quickPassRepository;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private final MPUCtlsRepository mpuCtlsRepository;
|
||||||
|
|
||||||
|
private final RidRepository ridRepository;
|
||||||
|
|
||||||
|
private final ChipAidRepository chipAidRepository;
|
||||||
|
|
||||||
|
private final BinRepository binRepository;
|
||||||
|
|
||||||
|
private final Context context;
|
||||||
|
|
||||||
|
private final RxUtil<PayWaveEntity> payWaveEntityRxUtil = new RxUtil<>();
|
||||||
|
private final RxUtil<PayPassEntity> payPassEntityRxUtil = new RxUtil<>();
|
||||||
|
private final RxUtil<QuickPassEntity> quickPassEntityRxUtil = new RxUtil<>();
|
||||||
|
private final RxUtil<MPUCtlsEntity> mpuCtlsEntityRxUtil = new RxUtil<>();
|
||||||
|
private final RxUtil<RidEntity> ridEntityRxUtil = new RxUtil<>();
|
||||||
|
private final RxUtil<ChipAidEntity> chipAidEntityRxUtil = new RxUtil<>();
|
||||||
|
private final RxUtil<BinEntity> binEntityRxUtil = new RxUtil<>();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public EmvParamOperation(@ApplicationContext Context context, PayWaveRepository payWaveRepository, PayPassRepository payPassRepository,MPUCtlsRepository mpuCtlsRepository,QuickPassRepository quickPassRepository,RidRepository ridRepository,ChipAidRepository chipAidRepository,BinRepository binRepository) {
|
||||||
|
super(context);
|
||||||
|
this.context = context;
|
||||||
|
this.payWaveRepository = payWaveRepository;
|
||||||
|
this.payPassRepository = payPassRepository;
|
||||||
|
this.quickPassRepository = quickPassRepository;
|
||||||
|
this.mpuCtlsRepository = mpuCtlsRepository;
|
||||||
|
this.ridRepository = ridRepository;
|
||||||
|
this.chipAidRepository = chipAidRepository;
|
||||||
|
this.binRepository = binRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteAids() {
|
||||||
|
EmvParamHelper.getInstance().deleteAllAids();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteRids() {
|
||||||
|
EmvParamHelper.getInstance().deleteAllRids();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
payWaveEntityRxUtil.dispose();
|
||||||
|
payPassEntityRxUtil.dispose();
|
||||||
|
}
|
||||||
|
public void loadAidRids() {
|
||||||
|
deleteAids();
|
||||||
|
deleteRids();
|
||||||
|
|
||||||
|
processPayWave();
|
||||||
|
processPayPass();
|
||||||
|
processQuickPass();
|
||||||
|
|
||||||
|
processMPUCtls();
|
||||||
|
processChips();
|
||||||
|
processRids();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadEmvTerminalParam() {
|
||||||
|
initEmvTerminalParam();
|
||||||
|
|
||||||
|
loadAidRids();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateInterfaceDeviceSerial() {
|
||||||
|
String mSerial = " ";
|
||||||
|
String serialNum = TerminalUtil.getInstance().getSerialNo();
|
||||||
|
if(serialNum != null && !serialNum.isEmpty() && serialNum.length() >= 13) {
|
||||||
|
mSerial = serialNum.substring(5,13);
|
||||||
|
}
|
||||||
|
return convertStringToAsciiHex(mSerial);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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 = false;
|
||||||
|
emvTermParam.scriptMode = true;
|
||||||
|
emvTermParam.ifDsn = generateInterfaceDeviceSerial();
|
||||||
|
// added below flags for 1049 L3 test cases
|
||||||
|
|
||||||
|
// emvTermParam.useTermAIPFlg = false;
|
||||||
|
// emvTermParam.termAIP = false;
|
||||||
|
// 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 static String convertStringToAsciiHex(String inputString) {
|
||||||
|
// Handle null or empty input string gracefully
|
||||||
|
if (inputString == null || inputString.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use StringBuilder for efficient string concatenation
|
||||||
|
StringBuilder hexStringBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
// Iterate over each character in the input string
|
||||||
|
for (char character : inputString.toCharArray()) {
|
||||||
|
// Get the ASCII value of the character
|
||||||
|
int asciiValue = (int) character;
|
||||||
|
|
||||||
|
// Convert the ASCII value to its hexadecimal representation
|
||||||
|
// String.format("%02X", ...) ensures that the hex value is always
|
||||||
|
// two characters long, padding with a leading zero if necessary (e.g., 'A' (10) -> '0A')
|
||||||
|
String hexValue = String.format("%02X", asciiValue);
|
||||||
|
|
||||||
|
// Append the two-character hex value to the StringBuilder
|
||||||
|
hexStringBuilder.append(hexValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the final concatenated hexadecimal string
|
||||||
|
return hexStringBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateChipCVM(String scheme,long cvmLimit) {
|
||||||
|
chipAidRepository.updateChipCVM(scheme, cvmLimit)
|
||||||
|
.subscribeOn(Schedulers.io()) // Perform the operation on the IO thread
|
||||||
|
.observeOn(Schedulers.io()) // Observe the result on the main thread
|
||||||
|
.subscribe(new CompletableObserver() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG,"Update successful");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
LogUtil.d(TAG,"Error : "+e.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateChipAidStatus(boolean status,String aid) {
|
||||||
|
processUpdateChipAidStatus(chipAidEntityRxUtil, chipAidRepository, status,aid, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG,"Error occur updating Chip Aid Status");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG,"Updated "+aid +" status :"+status);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateUpiCVM(long cvmLimit) {
|
||||||
|
processUpdateCtlsCVM(quickPassEntityRxUtil, quickPassRepository, cvmLimit, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG,"Error occur updating UPI Ctls CVM");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG,"Updated UPI Ctls CVM to "+cvmLimit);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateUpiCurrencyCode(String currencyCode) {
|
||||||
|
processUpdateCtlsCurrencyCode(quickPassEntityRxUtil, quickPassRepository, currencyCode, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG,"Error occur updating UPI Ctls CurrencyCode");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG,"Updated UPI Ctls Currency Code to "+currencyCode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void updateQuickPassTTQ(String ttq) {
|
||||||
|
processUpdateTTQ(quickPassEntityRxUtil, quickPassRepository, ttq, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG,"Error occur updating UPI Ctls ttq");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG,"Updated UPI TTQ to "+ttq);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePayWaveTTQ(String ttq) {
|
||||||
|
processUpdateTTQ(payWaveEntityRxUtil, payWaveRepository, ttq, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG,"Error occur updating visa Ctls ttq");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG,"Updated visa TTQ to "+ttq);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePayPassTTQ(String ttq) {
|
||||||
|
processUpdateTTQ(payPassEntityRxUtil, payPassRepository, ttq, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG,"Error occur updating master Ctls ttq");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG,"Updated master TTQ to "+ttq);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePayWaveCVM(long cvmLimit) {
|
||||||
|
processUpdateCtlsCVM(payWaveEntityRxUtil, payWaveRepository, cvmLimit, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG,"Error occur updating PayWave Ctls CVM");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG,"Updated PayWave Ctls CVM to "+cvmLimit);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePayWaveCurrencyCode(String currencyCode) {
|
||||||
|
processUpdateCtlsCurrencyCode(payWaveEntityRxUtil, payWaveRepository, currencyCode, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG,"Error occur updating PayWave Ctls CurrencyCode");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG,"Updated PayWave Ctls Currency Code to "+currencyCode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePayPassCVM(long cvmLimit) {
|
||||||
|
processUpdateCtlsCVM(payPassEntityRxUtil, payPassRepository, cvmLimit, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG,"Error occur updating PayPass Ctls CVM");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG,"Updated PayPass Ctls CVM to "+cvmLimit);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePayPassCurrencyCode(String currencyCode) {
|
||||||
|
processUpdateCtlsCurrencyCode(payPassEntityRxUtil, payPassRepository, currencyCode, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG,"Error occur updating PayWave PayPass CurrencyCode");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG,"Updated PayPass Ctls Currency Code to "+currencyCode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePayPassTerminalCapability(String terminalCapability) {
|
||||||
|
processUpdateCtlsTerminalCapability(payPassEntityRxUtil, payPassRepository, terminalCapability, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG,"Error occur updating PayWave PayPass terminalCapability");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG,"Updated PayPass Ctls terminalCapability to "+terminalCapability);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void retrievePayPassData(ProcessSingleDataResult<PayPassEntity> result) {
|
||||||
|
processSingleData(payPassEntityRxUtil, payPassRepository,result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processQuickPass() {
|
||||||
|
processData(quickPassEntityRxUtil, R.raw.quickpass_config, QuickPassEntity.class, quickPassRepository, new ProcessDataResult<QuickPassEntity>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<QuickPassEntity> lists) {
|
||||||
|
for (QuickPassEntity entity : lists) {
|
||||||
|
EmvParamHelper.getInstance().initializeContactlessAid(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processPayPass() {
|
||||||
|
processData(payPassEntityRxUtil, R.raw.paypass_config, PayPassEntity.class, payPassRepository, new ProcessDataResult<PayPassEntity>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<PayPassEntity> lists) {
|
||||||
|
for (PayPassEntity entity : lists) {
|
||||||
|
EmvParamHelper.getInstance().initializeContactlessAid(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processPayWave() {
|
||||||
|
processData(payWaveEntityRxUtil, R.raw.paywave_config, PayWaveEntity.class, payWaveRepository, new ProcessDataResult<PayWaveEntity>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<PayWaveEntity> lists) {
|
||||||
|
for (PayWaveEntity entity : lists) {
|
||||||
|
EmvParamHelper.getInstance().initializeContactlessAid(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void processMPUCtls() {
|
||||||
|
processData(mpuCtlsEntityRxUtil, R.raw.mpu_ctls_config, MPUCtlsEntity.class, mpuCtlsRepository, new ProcessDataResult<MPUCtlsEntity>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<MPUCtlsEntity> lists) {
|
||||||
|
for (MPUCtlsEntity entity : lists) {
|
||||||
|
EmvParamHelper.getInstance().initializeContactlessAid(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processChips() {
|
||||||
|
processData(chipAidEntityRxUtil, R.raw.contacts_config, ChipAidEntity.class, chipAidRepository, new ProcessDataResult<ChipAidEntity>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<ChipAidEntity> lists) {
|
||||||
|
LogUtil.d(TAG, "Found Chip AID length: "+lists.size());
|
||||||
|
|
||||||
|
for (ChipAidEntity entity : lists) {
|
||||||
|
if(entity.getAidEnable()) {
|
||||||
|
LogUtil.d(TAG,"Added AID : "+entity.getAid());
|
||||||
|
EmvParamHelper.getInstance().initializeContactAid(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processRids() {
|
||||||
|
processDeleteAll(ridEntityRxUtil, ridRepository, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.e(TAG, "DELETING RIDs Failure!");
|
||||||
|
throwable.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG, "DELETING RIDs Success!");
|
||||||
|
LogUtil.d(TAG, "Processing to insert RIDs!");
|
||||||
|
processData(ridEntityRxUtil, R.raw.rid_config, RidEntity.class, ridRepository, new ProcessDataResult<RidEntity>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<RidEntity> lists) {
|
||||||
|
LogUtil.d(TAG,"RID size:"+lists.size());
|
||||||
|
for (RidEntity entity : lists) {
|
||||||
|
LogUtil.d(TAG,"Inserted RID:"+entity.getRid());
|
||||||
|
EmvParamHelper.getInstance().initializeRids(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
418
baselib/src/main/java/com/utsmyanmar/baselib/emv/EmvTags.java
Normal file
418
baselib/src/main/java/com/utsmyanmar/baselib/emv/EmvTags.java
Normal file
@ -0,0 +1,418 @@
|
|||||||
|
package com.utsmyanmar.baselib.emv;
|
||||||
|
|
||||||
|
public class EmvTags {
|
||||||
|
|
||||||
|
public static final String A_TAG_AMEX_OUTCOME = "DF6D";
|
||||||
|
public static final String A_TAG_CVMOUT = "DF38";
|
||||||
|
public static final String A_TAG_IC_9F70 = "9F70";
|
||||||
|
public static final String A_TAG_IC_9F71 = "9F71";
|
||||||
|
public static final String A_TAG_PREAGAIN = "DF8130";
|
||||||
|
public static final String A_TAG_PSEUDO_TRACK1 = "DF45";
|
||||||
|
public static final String A_TAG_PSEUDO_TRACK2 = "DF46";
|
||||||
|
public static final String A_TAG_TM_9F6D = "9F6D";
|
||||||
|
public static final String A_TAG_TM_9F6E = "9F6E";
|
||||||
|
public static final String A_TAG_TM_CVM_LIMIT = "DF8126";
|
||||||
|
public static final String A_TAG_TM_DATA_REC = "FF8105";
|
||||||
|
public static final String A_TAG_TM_ERR_INDI = "DF8115";
|
||||||
|
public static final String A_TAG_TM_FLOOR_LIMIT = "DF8123";
|
||||||
|
public static final String A_TAG_TM_IN_CARD_BIN_RANGE = "DF8127";
|
||||||
|
public static final String A_TAG_TM_MESG_HOLD_TIME = "DF812D";
|
||||||
|
public static final String A_TAG_TM_OUTCOME_PAR = "DF8129";
|
||||||
|
public static final String A_TAG_TM_TRANS_LIMIT = "DF8124";
|
||||||
|
public static final String A_TAG_TM_UI_REQ = "DF8116";
|
||||||
|
public static final String A_TAG_UNRUNGE = "DF44";
|
||||||
|
public static final String C_TAG_IC_9F51 = "9F51";
|
||||||
|
public static final String C_TAG_IC_9F5D = "9F5D";
|
||||||
|
public static final String C_TAG_IC_9F61 = "9F61";
|
||||||
|
public static final String C_TAG_IC_9F62 = "9F62";
|
||||||
|
public static final String C_TAG_IC_9F63 = "9F63";
|
||||||
|
public static final String C_TAG_IC_9F68 = "9F68";
|
||||||
|
public static final String C_TAG_IC_9F69 = "9F69";
|
||||||
|
public static final String C_TAG_IC_9F6C = "9F6C";
|
||||||
|
public static final String C_TAG_IC_9F6D = "9F6D";
|
||||||
|
public static final String C_TAG_IC_9F74 = "9F74";
|
||||||
|
public static final String C_TAG_IC_9F77 = "9F77";
|
||||||
|
public static final String C_TAG_IC_9F78 = "9F78";
|
||||||
|
public static final String C_TAG_IC_9F79 = "9F79";
|
||||||
|
public static final String C_TAG_IC_DF4D = "DF4D";
|
||||||
|
public static final String C_TAG_IC_DF4F = "DF4F";
|
||||||
|
public static final String C_TAG_TM_9F53 = "9F53";
|
||||||
|
public static final String C_TAG_TM_9F66 = "9F66";
|
||||||
|
public static final String C_TAG_TM_9F7A = "9F7A";
|
||||||
|
public static final String C_TAG_TM_9F7B = "9F7B";
|
||||||
|
public static final String C_TAG_TM_CVM_LIMIT = "DF8126";
|
||||||
|
public static final String C_TAG_TM_DF31 = "DF31";
|
||||||
|
public static final String C_TAG_TM_DF69 = "DF69";
|
||||||
|
public static final String C_TAG_TM_FLOOR_LIMIT = "DF8123";
|
||||||
|
public static final String C_TAG_TM_RD_RCP = "DF06";
|
||||||
|
public static final String C_TAG_TM_TRANS_LIMIT = "DF8124";
|
||||||
|
public static final String DEF_TAG_ACCUMULATE_AMOUNT = "DF918107";
|
||||||
|
public static final String DEF_TAG_ACTION_ANALYSIS_RESULT = "DF918129";
|
||||||
|
public static final String DEF_TAG_ADVICE_REQUIRED = "DF918133";
|
||||||
|
public static final String DEF_TAG_AID_ENTRY = "BF918100";
|
||||||
|
public static final String DEF_TAG_ALLOW_DFNAME_ABSENT = "DF918153";
|
||||||
|
public static final String DEF_TAG_ALLOW_DUP_ICC_PRE_NULL = "DF918117";
|
||||||
|
public static final String DEF_TAG_ALLOW_DUP_ICC_SAMEVALUE = "DF918140";
|
||||||
|
public static final String DEF_TAG_APDU_STATUS = "DF918156";
|
||||||
|
public static final String DEF_TAG_APPSELECT_DATA = "BF918101";
|
||||||
|
public static final String DEF_TAG_AUTHORIZE_FLAG = "DF91810A";
|
||||||
|
public static final String DEF_TAG_AUTO_GAC2_NOT_ALLOW = "DF918141";
|
||||||
|
public static final String DEF_TAG_BALANCE_AFT_GAC = "DF918114";
|
||||||
|
public static final String DEF_TAG_BALANCE_BEF_GAC = "DF918113";
|
||||||
|
public static final String DEF_TAG_CA_PUBKEY_EXPONENT = "DF91811D";
|
||||||
|
public static final String DEF_TAG_CA_PUBKEY_MODULUS = "DF91811C";
|
||||||
|
public static final String DEF_TAG_CHECK_CAPK_INDEXLIST = "DF928104";
|
||||||
|
public static final String DEF_TAG_CHECK_EXPIRY_EACHRECORD = "DF918119";
|
||||||
|
public static final String DEF_TAG_CHV_STATUS = "DF918108";
|
||||||
|
public static final String DEF_TAG_CID_CHECK_BITS = "DF918148";
|
||||||
|
public static final String DEF_TAG_CLOSERF_TYPE = "DF918161";
|
||||||
|
public static final String DEF_TAG_CTL_AS_CB_FLAG = "DF928105";
|
||||||
|
public static final String DEF_TAG_CVM_FLAG = "DF918125";
|
||||||
|
public static final String DEF_TAG_DOL_DEFAULT_DDOL = "DF918121";
|
||||||
|
public static final String DEF_TAG_DOL_DEFAULT_TDOL = "DF918122";
|
||||||
|
public static final String DEF_TAG_DOL_DEFAULT_UDOL = "DF918123";
|
||||||
|
public static final String DEF_TAG_DOL_FILL_AS_ICC_RETURN = "DF918118";
|
||||||
|
public static final String DEF_TAG_DUPLICATE_ICCTAG = "DF918158";
|
||||||
|
public static final String DEF_TAG_D_ISSUERSCRIPT_EXCUTIVE = "DF918215";
|
||||||
|
public static final String DEF_TAG_ERROR_TYPE = "DF91815A";
|
||||||
|
public static final String DEF_TAG_EXPIRY_COMPARE_OPTIMIZE = "DF918154";
|
||||||
|
public static final String DEF_TAG_FORCEKID = "DF918160";
|
||||||
|
public static final String DEF_TAG_FORCE_CDA = "DF918142";
|
||||||
|
public static final String DEF_TAG_FORCE_ONLINE_ALL = "DF91815C";
|
||||||
|
public static final String DEF_TAG_GAC2_NOT_CDA = "DF918150";
|
||||||
|
public static final String DEF_TAG_GAC_AAC_SUP_CDA = "DF918147";
|
||||||
|
public static final String DEF_TAG_GAC_CDA_FLAG = "DF918159";
|
||||||
|
public static final String DEF_TAG_GAC_CONTROL = "DF918102";
|
||||||
|
public static final String DEF_TAG_G_ATDTOL = "DF918B06";
|
||||||
|
public static final String DEF_TAG_G_ATOL = "DF918B01";
|
||||||
|
public static final String DEF_TAG_G_CPIO = "DF918B03";
|
||||||
|
public static final String DEF_TAG_G_KER_CAP = "DF918B02";
|
||||||
|
public static final String DEF_TAG_G_MTOL = "DF918B05";
|
||||||
|
public static final String DEF_TAG_G_ONLINE_TYPE = "DF918B08";
|
||||||
|
public static final String DEF_TAG_G_PRE_IND = "DF918B09";
|
||||||
|
public static final String DEF_TAG_HCE_MODE = "DF918151";
|
||||||
|
public static final String DEF_TAG_HOST_TLVDATA = "DF91810B";
|
||||||
|
public static final String DEF_TAG_ICCLOG_ENTRY = "BF918102";
|
||||||
|
public static final String DEF_TAG_ICC_DYNAMIC_DATA = "DF918145";
|
||||||
|
public static final String DEF_TAG_ICC_RANDOM_NUMBER = "DF918132";
|
||||||
|
public static final String DEF_TAG_ISS_PUBKEY_SERIAL_NUM = "DF91811A";
|
||||||
|
public static final String DEF_TAG_ISS_SCRIPT_MAX_LENGTH = "DF918130";
|
||||||
|
public static final String DEF_TAG_ISS_SCRIPT_RESULT = "DF918124";
|
||||||
|
public static final String DEF_TAG_J_CLEAR_TORN_SIGN = "DF918412";
|
||||||
|
public static final String DEF_TAG_J_COMB_OPTION = "DF918404";
|
||||||
|
public static final String DEF_TAG_J_CVM_LIMIT = "DF918403";
|
||||||
|
public static final String DEF_TAG_J_FLOOR_LIMIT = "DF918401";
|
||||||
|
public static final String DEF_TAG_J_MESSAGE_ID = "DF918411";
|
||||||
|
public static final String DEF_TAG_J_ONLINE_TWOPRE = "DF918410";
|
||||||
|
public static final String DEF_TAG_J_REMOVETIME = "DF918407";
|
||||||
|
public static final String DEF_TAG_J_RS_MAX_PERCENT = "DF918405";
|
||||||
|
public static final String DEF_TAG_J_RS_TARGET_PERCENT = "DF918406";
|
||||||
|
public static final String DEF_TAG_J_RS_THRESH_VALUE = "DF918409";
|
||||||
|
public static final String DEF_TAG_J_TIP = "DF918408";
|
||||||
|
public static final String DEF_TAG_J_TRANS_LIMIT = "DF918402";
|
||||||
|
public static final String DEF_TAG_KERNEL_ID = "DF918134";
|
||||||
|
public static final String DEF_TAG_KERN_FUNC_CONFIG = "DF918165";
|
||||||
|
public static final String DEF_TAG_MODIFY_AFL = "DF918144";
|
||||||
|
public static final String DEF_TAG_M_BALANCE_SUP = "DF918202";
|
||||||
|
public static final String DEF_TAG_M_CDV_SUP = "DF918204";
|
||||||
|
public static final String DEF_TAG_M_DEK_DATA_SEND = "DF918219";
|
||||||
|
public static final String DEF_TAG_M_DET_UPDATE_DATA = "DF918218";
|
||||||
|
public static final String DEF_TAG_M_DE_SWITCH = "DF91820B";
|
||||||
|
public static final String DEF_TAG_M_DE_TIME_OUT = "DF918213";
|
||||||
|
public static final String DEF_TAG_M_MAG_REQ_CVM = "DF918207";
|
||||||
|
public static final String DEF_TAG_M_MAG_REQ_NOCVM = "DF918208";
|
||||||
|
public static final String DEF_TAG_M_MSG_HOLDTIME = "DF918209";
|
||||||
|
public static final String DEF_TAG_M_REQ_CVM = "DF918205";
|
||||||
|
public static final String DEF_TAG_M_REQ_NOCVM = "DF918206";
|
||||||
|
public static final String DEF_TAG_M_RF_HOLDTIME = "DF91820A";
|
||||||
|
public static final String DEF_TAG_M_RRP_ACCURACY_THRESHOLD = "DF91820F";
|
||||||
|
public static final String DEF_TAG_M_RRP_EXPECTED_TIME_CAPDU = "DF918211";
|
||||||
|
public static final String DEF_TAG_M_RRP_EXPECTED_TIME_RAPDU = "DF918212";
|
||||||
|
public static final String DEF_TAG_M_RRP_MAX_GRACE_PERIOD = "DF91820D";
|
||||||
|
public static final String DEF_TAG_M_RRP_MIN_GRACE_PERIOD = "DF91820E";
|
||||||
|
public static final String DEF_TAG_M_RRP_MISMATCH_THRESHOLD = "DF918210";
|
||||||
|
public static final String DEF_TAG_M_RRP_SWITCH = "DF91820C";
|
||||||
|
public static final String DEF_TAG_M_TORN_TRANS = "DF918203";
|
||||||
|
public static final String DEF_TAG_M_TRANS_MODE = "DF918201";
|
||||||
|
public static final String DEF_TAG_M_UIRD_DATA = "DF918214";
|
||||||
|
public static final String DEF_TAG_M_WRITE_AFTER_GAC = "DF918217";
|
||||||
|
public static final String DEF_TAG_M_WRITE_BEFORE_GAC = "DF918216";
|
||||||
|
public static final String DEF_TAG_OBTAIN_FLAG = "DF928101";
|
||||||
|
public static final String DEF_TAG_OBTAIN_RETURN_DATA = "DF928102";
|
||||||
|
public static final String DEF_TAG_ODA_ALGORITHM_ID = "DF918135";
|
||||||
|
public static final String DEF_TAG_ODA_CANCEL_FLAG = "DF918149";
|
||||||
|
public static final String DEF_TAG_ODA_EXECUTE_FAST_DDA = "DF91811B";
|
||||||
|
public static final String DEF_TAG_ODA_REVOKED_KEY = "DF918137";
|
||||||
|
public static final String DEF_TAG_OFFPIN_PUBKEY_EXPONENT = "DF918127";
|
||||||
|
public static final String DEF_TAG_OFFPIN_PUBKEY_MODULUS = "DF918126";
|
||||||
|
public static final String DEF_TAG_OFFPIN_TRY_TIMES = "DF918131";
|
||||||
|
public static final String DEF_TAG_ONLIE_ODA_FAIL_FLOW_TYPE = "DF918163";
|
||||||
|
public static final String DEF_TAG_ONLINE_ODA = "DF918152";
|
||||||
|
public static final String DEF_TAG_ONLINE_STATUS = "DF918109";
|
||||||
|
public static final String DEF_TAG_OPTIMIZED_CDOL = "DF918146";
|
||||||
|
public static final String DEF_TAG_PAN_IN_BLACK = "DF918106";
|
||||||
|
public static final String DEF_TAG_PPSE_6A82_TURNTO_AIDLIST = "DF918155";
|
||||||
|
public static final String DEF_TAG_PSE_FLAG = "DF918101";
|
||||||
|
public static final String DEF_TAG_QPBOC_TYPE = "DF918157";
|
||||||
|
public static final String DEF_TAG_QUERY_ICCLOG = "DF918103";
|
||||||
|
public static final String DEF_TAG_RAND_SLT_MAXPER = "DF91810E";
|
||||||
|
public static final String DEF_TAG_RAND_SLT_PER = "DF91810D";
|
||||||
|
public static final String DEF_TAG_RAND_SLT_THRESHOLD = "DF91810C";
|
||||||
|
public static final String DEF_TAG_RESELECT_CONDITION = "DF928103";
|
||||||
|
public static final String DEF_TAG_RESULT_CODE = "DF91810F";
|
||||||
|
public static final String DEF_TAG_SERVICE_TYPE = "DF918104";
|
||||||
|
public static final String DEF_TAG_SFI_RECORD_NO = "DF918143";
|
||||||
|
public static final String DEF_TAG_START_RECOVERY = "DF918105";
|
||||||
|
public static final String DEF_TAG_TAC_DECLINE = "DF918111";
|
||||||
|
public static final String DEF_TAG_TAC_DEFAULT = "DF918110";
|
||||||
|
public static final String DEF_TAG_TAC_ONLINE = "DF918112";
|
||||||
|
public static final String DEF_TAG_TM_ANALYSIS_RESULT = "DF918128";
|
||||||
|
public static final String DEF_TAG_TORN_DATA = "DF918116";
|
||||||
|
public static final String DEF_TAG_TORN_LOG = "BF918103";
|
||||||
|
public static final String DEF_TAG_TORN_SUPPORT = "DF918115";
|
||||||
|
public static final String DEF_TAG_TRM_RANDOM_SELECT_OPTION = "DF918138";
|
||||||
|
public static final String DEF_TAG_TRM_VELOCITY_CHECK_OPTION = "DF918139";
|
||||||
|
public static final String DEF_TAG_TRYGAIN_SPECIAL_RETCODE = "DF918162";
|
||||||
|
public static final String DEF_TAG_USE_DEFAULT_DDOL = "DF918136";
|
||||||
|
public static final String DEF_TAG_V_CVN17_ACTIVE = "DF918303";
|
||||||
|
public static final String DEF_TAG_V_TRACK1_ACTIVE = "DF918301";
|
||||||
|
public static final String DEF_TAG_V_TRACK2_ACTIVE = "DF918302";
|
||||||
|
public static final String DET_TAG_M_DEK_DATA_SEND_WAIT = "DF918220";
|
||||||
|
public static final String DET_TAG_M_DISC_DATA = "DF918221";
|
||||||
|
public static final String D_TAG_CVMOUT = "DF38";
|
||||||
|
public static final String D_TAG_DISCOVER_OUTCOME = "DF6D";
|
||||||
|
public static final String D_TAG_IC_9F80 = "9F80";
|
||||||
|
public static final String D_TAG_PREAGAIN = "DF8130";
|
||||||
|
public static final String D_TAG_PSEUDO_TRACK1 = "DF45";
|
||||||
|
public static final String D_TAG_PSEUDO_TRACK2 = "DF46";
|
||||||
|
public static final String D_TAG_TM_9F66 = "9F66";
|
||||||
|
public static final String D_TAG_TM_CVM_LIMIT = "DF8126";
|
||||||
|
public static final String D_TAG_TM_DATA_REC = "FF8105";
|
||||||
|
public static final String D_TAG_TM_ERR_INDI = "DF8115";
|
||||||
|
public static final String D_TAG_TM_FLOOR_LIMIT = "DF8123";
|
||||||
|
public static final String D_TAG_TM_ISSSCRIPT_USE_ONWAITCARD = "DF8117";
|
||||||
|
public static final String D_TAG_TM_MESG_HOLD_TIME = "DF812D";
|
||||||
|
public static final String D_TAG_TM_OUTCOME_PAR = "DF8129";
|
||||||
|
public static final String D_TAG_TM_RD_RCP = "DF06";
|
||||||
|
public static final String D_TAG_TM_TRANS_LIMIT = "DF8124";
|
||||||
|
public static final String D_TAG_TM_UI_REQ = "DF8116";
|
||||||
|
public static final String D_TAG_UNRUNGE = "DF44";
|
||||||
|
public static final String EMV_TAG_IC_AC = "9F26";
|
||||||
|
public static final String EMV_TAG_IC_AFL = "94";
|
||||||
|
public static final String EMV_TAG_IC_AID = "4F";
|
||||||
|
public static final String EMV_TAG_IC_AID_EXTEND = "9F29";
|
||||||
|
public static final String EMV_TAG_IC_AIP = "82";
|
||||||
|
public static final String EMV_TAG_IC_APCUR = "9F3B";
|
||||||
|
public static final String EMV_TAG_IC_APCUREXP = "9F43";
|
||||||
|
public static final String EMV_TAG_IC_APID = "87";
|
||||||
|
public static final String EMV_TAG_IC_APNAME = "9F12";
|
||||||
|
public static final String EMV_TAG_IC_APPCURCODE = "9F42";
|
||||||
|
public static final String EMV_TAG_IC_APPCUREXP = "9F44";
|
||||||
|
public static final String EMV_TAG_IC_APPDISCDATA = "9F05";
|
||||||
|
public static final String EMV_TAG_IC_APPEFFECTDATE = "5F25";
|
||||||
|
public static final String EMV_TAG_IC_APPEXPIREDATE = "5F24";
|
||||||
|
public static final String EMV_TAG_IC_APPLABEL = "50";
|
||||||
|
public static final String EMV_TAG_IC_APPTEMP = "61";
|
||||||
|
public static final String EMV_TAG_IC_APPVERNO = "9F08";
|
||||||
|
public static final String EMV_TAG_IC_ATC = "9F36";
|
||||||
|
public static final String EMV_TAG_IC_AUC = "9F07";
|
||||||
|
public static final String EMV_TAG_IC_BANKIDCODE = "5F54";
|
||||||
|
public static final String EMV_TAG_IC_CAPKINDEX = "8F";
|
||||||
|
public static final String EMV_TAG_IC_CDOL1 = "8C";
|
||||||
|
public static final String EMV_TAG_IC_CHNAME = "5F20";
|
||||||
|
public static final String EMV_TAG_IC_CHNAMEEX = "9F0B";
|
||||||
|
public static final String EMV_TAG_IC_CID = "9F27";
|
||||||
|
public static final String EMV_TAG_IC_CVMLIST = "8E";
|
||||||
|
public static final String EMV_TAG_IC_DDFNAME = "9D";
|
||||||
|
public static final String EMV_TAG_IC_DDOL = "9F49";
|
||||||
|
public static final String EMV_TAG_IC_DFNAME = "84";
|
||||||
|
public static final String EMV_TAG_IC_DIRDISCTEMP = "73";
|
||||||
|
public static final String EMV_TAG_IC_DTAUTHCODE = "9F45";
|
||||||
|
public static final String EMV_TAG_IC_FCIDISCDATA = "BF0C";
|
||||||
|
public static final String EMV_TAG_IC_FCIPROPTEMP = "A5";
|
||||||
|
public static final String EMV_TAG_IC_FCITEMP = "6F";
|
||||||
|
public static final String EMV_TAG_IC_IAC_DEFAULT = "9F0D";
|
||||||
|
public static final String EMV_TAG_IC_IAC_DENIAL = "9F0E";
|
||||||
|
public static final String EMV_TAG_IC_IAC_ONLINE = "9F0F";
|
||||||
|
public static final String EMV_TAG_IC_IBAN = "5F53";
|
||||||
|
public static final String EMV_TAG_IC_ICCDYNNUM = "9F4C";
|
||||||
|
public static final String EMV_TAG_IC_ICCPKCERT = "9F46";
|
||||||
|
public static final String EMV_TAG_IC_ICCPKEXP = "9F47";
|
||||||
|
public static final String EMV_TAG_IC_ICCPKRMD = "9F48";
|
||||||
|
public static final String EMV_TAG_IC_ISSAPPDATA = "9F10";
|
||||||
|
public static final String EMV_TAG_IC_ISSCOUNTRYCODE = "5F28";
|
||||||
|
public static final String EMV_TAG_IC_ISSCOUNTRYCODE_A2 = "5F55";
|
||||||
|
public static final String EMV_TAG_IC_ISSCOUNTRYCODE_A3 = "5F56";
|
||||||
|
public static final String EMV_TAG_IC_ISSCTINDEX = "9F11";
|
||||||
|
public static final String EMV_TAG_IC_ISSIDNUMBER = "42";
|
||||||
|
public static final String EMV_TAG_IC_ISSPKCERT = "90";
|
||||||
|
public static final String EMV_TAG_IC_ISSPKEXP = "9F32";
|
||||||
|
public static final String EMV_TAG_IC_ISSPKRMD = "92";
|
||||||
|
public static final String EMV_TAG_IC_KERNELID = "9F2A";
|
||||||
|
public static final String EMV_TAG_IC_LANGPREF = "5F2D";
|
||||||
|
public static final String EMV_TAG_IC_LASTATC = "9F13";
|
||||||
|
public static final String EMV_TAG_IC_LCOL = "9F14";
|
||||||
|
public static final String EMV_TAG_IC_LOGENTRY = "9F4D";
|
||||||
|
public static final String EMV_TAG_IC_LOGFORMAT = "9F4F";
|
||||||
|
public static final String EMV_TAG_IC_PAN = "5A";
|
||||||
|
public static final String EMV_TAG_IC_PANSN = "5F34";
|
||||||
|
public static final String EMV_TAG_IC_PAR = "9F24";
|
||||||
|
public static final String EMV_TAG_IC_PDOL = "9F38";
|
||||||
|
public static final String EMV_TAG_IC_PECERT = "9F2D";
|
||||||
|
public static final String EMV_TAG_IC_PEEXP = "9F2E";
|
||||||
|
public static final String EMV_TAG_IC_PERMD = "9F2F";
|
||||||
|
public static final String EMV_TAG_IC_PINTRYCNTR = "9F17";
|
||||||
|
public static final String EMV_TAG_IC_RMTF1 = "80";
|
||||||
|
public static final String EMV_TAG_IC_RMTF2 = "77";
|
||||||
|
public static final String EMV_TAG_IC_SDATAGLIST = "9F4A";
|
||||||
|
public static final String EMV_TAG_IC_SERVICECODE = "5F30";
|
||||||
|
public static final String EMV_TAG_IC_SFI = "88";
|
||||||
|
public static final String EMV_TAG_IC_SIGNDYNAPPDT = "9F4B";
|
||||||
|
public static final String EMV_TAG_IC_SIGNSTAAPPDT = "9300";
|
||||||
|
public static final String EMV_TAG_IC_TDOL = "97";
|
||||||
|
public static final String EMV_TAG_IC_TRACK1DATA = "56";
|
||||||
|
public static final String EMV_TAG_IC_TRACK1DD = "9F1F";
|
||||||
|
public static final String EMV_TAG_IC_TRACK2DATA = "57";
|
||||||
|
public static final String EMV_TAG_IC_TRACK2DD = "9F20";
|
||||||
|
public static final String EMV_TAG_IC_UCOL = "9F23";
|
||||||
|
public static final String EMV_TAG_I_CDOL2 = "8D";
|
||||||
|
public static final String EMV_TAG_TM_ACCOUNTTYPE = "5F57";
|
||||||
|
public static final String EMV_TAG_TM_ACQID = "9F01";
|
||||||
|
public static final String EMV_TAG_TM_AID = "9F06";
|
||||||
|
public static final String EMV_TAG_TM_APPVERNO = "9F09";
|
||||||
|
public static final String EMV_TAG_TM_ARC = "8A";
|
||||||
|
public static final String EMV_TAG_TM_AUTHAMNTB = "81";
|
||||||
|
public static final String EMV_TAG_TM_AUTHAMNTN = "9F02";
|
||||||
|
public static final String EMV_TAG_TM_AUTHCODE = "89";
|
||||||
|
public static final String EMV_TAG_TM_CAP = "9F33";
|
||||||
|
public static final String EMV_TAG_TM_CAPKINDEX = "9F22";
|
||||||
|
public static final String EMV_TAG_TM_CAP_AD = "9F40";
|
||||||
|
public static final String EMV_TAG_TM_CNTRYCODE = "9F1A";
|
||||||
|
public static final String EMV_TAG_TM_CURCODE = "5F2A";
|
||||||
|
public static final String EMV_TAG_TM_CUREXP = "5F36";
|
||||||
|
public static final String EMV_TAG_TM_CVMRESULT = "9F34";
|
||||||
|
public static final String EMV_TAG_TM_FLOORLMT = "9F1B";
|
||||||
|
public static final String EMV_TAG_TM_IFDSN = "9F1E";
|
||||||
|
public static final String EMV_TAG_TM_ISSAUTHDT = "91";
|
||||||
|
public static final String EMV_TAG_TM_ISSSCR1 = "71";
|
||||||
|
public static final String EMV_TAG_TM_ISSSCR2 = "72";
|
||||||
|
public static final String EMV_TAG_TM_ISSSCRID = "9F18";
|
||||||
|
public static final String EMV_TAG_TM_MCHCATCODE = "9F15";
|
||||||
|
public static final String EMV_TAG_TM_MCHID = "9F16";
|
||||||
|
public static final String EMV_TAG_TM_MCHNAMELOC = "9F4E";
|
||||||
|
public static final String EMV_TAG_TM_OTHERAMNTB = "9F04";
|
||||||
|
public static final String EMV_TAG_TM_OTHERAMNTN = "9F03";
|
||||||
|
public static final String EMV_TAG_TM_PINDATA = "99";
|
||||||
|
public static final String EMV_TAG_TM_POSENTMODE = "9F39";
|
||||||
|
public static final String EMV_TAG_TM_REFCURAMNT = "9F3A";
|
||||||
|
public static final String EMV_TAG_TM_REFCURCODE = "9F3C";
|
||||||
|
public static final String EMV_TAG_TM_REFCUREXP = "9F3D";
|
||||||
|
public static final String EMV_TAG_TM_RMDATA = "9F1D";
|
||||||
|
public static final String EMV_TAG_TM_TCHASH = "98";
|
||||||
|
public static final String EMV_TAG_TM_TERMID = "9F1C";
|
||||||
|
public static final String EMV_TAG_TM_TERMTYPE = "9F35";
|
||||||
|
public static final String EMV_TAG_TM_TRANSDATE = "9A";
|
||||||
|
public static final String EMV_TAG_TM_TRANSTIME = "9F21";
|
||||||
|
public static final String EMV_TAG_TM_TRANSTYPE = "9C";
|
||||||
|
public static final String EMV_TAG_TM_TRSEQCNTR = "9F41";
|
||||||
|
public static final String EMV_TAG_TM_TSI = "9B";
|
||||||
|
public static final String EMV_TAG_TM_TVR = "95";
|
||||||
|
public static final String EMV_TAG_TM_UNPNUM = "9F37";
|
||||||
|
public static final String G_TAG_IC_9F50 = "9F50";
|
||||||
|
public static final String G_TAG_IC_CCID = "C5";
|
||||||
|
public static final String G_TAG_IC_CRMCC = "CD";
|
||||||
|
public static final String G_TAG_IC_ECI = "9F75";
|
||||||
|
public static final String G_TAG_IC_TDD = "9F77";
|
||||||
|
public static final String G_TAG_TM_CVM_LIMIT = "DF8126";
|
||||||
|
public static final String G_TAG_TM_DEUR = "9F74";
|
||||||
|
public static final String G_TAG_TM_FLOOR_LIMIT = "DF8123";
|
||||||
|
public static final String G_TAG_TM_GDDOL = "9F70";
|
||||||
|
public static final String G_TAG_TM_GDDOLRB = "9F71";
|
||||||
|
public static final String G_TAG_TM_ISR = "9F73";
|
||||||
|
public static final String G_TAG_TM_MSI = "9F72";
|
||||||
|
public static final String G_TAG_TM_MSRT = "BF71";
|
||||||
|
public static final String G_TAG_TM_MSUES = "85";
|
||||||
|
public static final String G_TAG_TM_MSUET1 = "A2";
|
||||||
|
public static final String G_TAG_TM_MSUET2 = "A3";
|
||||||
|
public static final String G_TAG_TM_MSUET3 = "A4";
|
||||||
|
public static final String G_TAG_TM_MSUT = "BF70";
|
||||||
|
public static final String G_TAG_TM_TAVS = "DF7F";
|
||||||
|
public static final String G_TAG_TM_TRANS_LIMIT = "DF8124";
|
||||||
|
public static final String G_TAG_TM_TTD = "9F77";
|
||||||
|
public static final String G_TAG_TM_TTPI = "C7";
|
||||||
|
public static final String MIR_TAG_KERN_CDARST = "9F70";
|
||||||
|
public static final String MIR_TAG_KERN_KVR = "DF74";
|
||||||
|
public static final String MIR_TAG_TERM_FLOORLMT = "DF8123";
|
||||||
|
public static final String MIR_TAG_TERM_NOCVMLMT = "DF8126";
|
||||||
|
public static final String MIR_TAG_TERM_RECTIME_LIMIT = "DF56";
|
||||||
|
public static final String MIR_TAG_TERM_TPMCAP = "DF55";
|
||||||
|
public static final String M_TAG_DDTRACK1 = "DF812A";
|
||||||
|
public static final String M_TAG_DDTRACK2 = "DF812B";
|
||||||
|
public static final String M_TAG_IC_9F50 = "9F50";
|
||||||
|
public static final String M_TAG_IC_9F51 = "9F51";
|
||||||
|
public static final String M_TAG_IC_9F5D = "9F5D";
|
||||||
|
public static final String M_TAG_IC_9F60 = "9F60";
|
||||||
|
public static final String M_TAG_IC_9F61 = "9F61";
|
||||||
|
public static final String M_TAG_IC_9F62 = "9F62";
|
||||||
|
public static final String M_TAG_IC_9F63 = "9F63";
|
||||||
|
public static final String M_TAG_IC_9F64 = "9F64";
|
||||||
|
public static final String M_TAG_IC_9F65 = "9F65";
|
||||||
|
public static final String M_TAG_IC_9F66 = "9F66";
|
||||||
|
public static final String M_TAG_IC_9F67 = "9F67";
|
||||||
|
public static final String M_TAG_IC_9F69 = "9F69";
|
||||||
|
public static final String M_TAG_IC_9F6B = "9f6B";
|
||||||
|
public static final String M_TAG_IC_9F6E = "9F6E";
|
||||||
|
public static final String M_TAG_IC_PCII = "DF4B";
|
||||||
|
public static final String M_TAG_TM_9F53 = "9F53";
|
||||||
|
public static final String M_TAG_TM_9F6A = "9f6A";
|
||||||
|
public static final String M_TAG_TM_9F6D = "9F6D";
|
||||||
|
public static final String M_TAG_TM_9F7C = "9F7C";
|
||||||
|
public static final String M_TAG_TM_9F7E = "9F7E";
|
||||||
|
public static final String M_TAG_TM_CVM_LIMIT = "DF8126";
|
||||||
|
public static final String M_TAG_TM_FLOOR_LIMIT = "DF8123";
|
||||||
|
public static final String M_TAG_TM_TRANS_LIMIT = "DF8124";
|
||||||
|
public static final String M_TAG_TM_TRANS_LIMIT_CDV = "DF8125";
|
||||||
|
public static final String R_TAG_IC_DF03 = "DF03";
|
||||||
|
public static final String R_TAG_IC_DF07 = "DF07";
|
||||||
|
public static final String R_TAG_IC_DF33 = "DF33";
|
||||||
|
public static final String R_TAG_IC_DF3B = "DF3B";
|
||||||
|
public static final String R_TAG_IC_DF46 = "DF46";
|
||||||
|
public static final String R_TAG_IC_DF47 = "DF47";
|
||||||
|
public static final String R_TAG_IC_DF49 = "DF49";
|
||||||
|
public static final String R_TAG_IC_DF4B = "DF4B";
|
||||||
|
public static final String R_TAG_IC_DF52 = "DF52";
|
||||||
|
public static final String R_TAG_IC_DF61 = "DF61";
|
||||||
|
public static final String R_TAG_IC_KCV = "DF54";
|
||||||
|
public static final String R_TAG_IC_PRMACQ_KEYINDEX = "DF4E";
|
||||||
|
public static final String R_TAG_TM_C1 = "C1";
|
||||||
|
public static final String R_TAG_TM_CVM_LIMIT = "DF4D";
|
||||||
|
public static final String R_TAG_TM_DF15 = "DF15";
|
||||||
|
public static final String R_TAG_TM_DF16 = "DF16";
|
||||||
|
public static final String R_TAG_TM_DF22 = "DF22";
|
||||||
|
public static final String R_TAG_TM_DF23 = "DF23";
|
||||||
|
public static final String R_TAG_TM_DF3A = "DF3A";
|
||||||
|
public static final String R_TAG_TM_DF45 = "DF45";
|
||||||
|
public static final String R_TAG_TM_DF48 = "DF48";
|
||||||
|
public static final String R_TAG_TM_FLOOR_LIMIT = "DF8123";
|
||||||
|
public static final String R_TAG_TM_ONLINE_ORNOT = "DF8144";
|
||||||
|
public static final String R_TAG_TM_SRTRANS_CAP = "DF8140";
|
||||||
|
public static final String R_TAG_TM_TIMELIMIT = "DF8142";
|
||||||
|
public static final String R_TAG_TM_TRANS_LIMIT = "DF4C";
|
||||||
|
public static final String R_TAG_TM_TSRQ = "DF8141";
|
||||||
|
public static final String V_TAG_IC_9F5A = "9F5A";
|
||||||
|
public static final String V_TAG_IC_9F5D = "9F5D";
|
||||||
|
public static final String V_TAG_IC_9F69 = "9F69";
|
||||||
|
public static final String V_TAG_IC_9F6C = "9F6C";
|
||||||
|
public static final String V_TAG_IC_9F6E = "9F6E";
|
||||||
|
public static final String V_TAG_IC_9F7C = "9F7C";
|
||||||
|
public static final String V_TAG_RD_CVM_REQUIRE = "DF04";
|
||||||
|
public static final String V_TAG_RD_DDAVER = "DF03";
|
||||||
|
public static final String V_TAG_RD_DSP_FUNDS = "DF05";
|
||||||
|
public static final String V_TAG_RD_RCP = "DF06";
|
||||||
|
public static final String V_TAG_TM_9F66 = "9F66";
|
||||||
|
public static final String V_TAG_TM_9F7A = "9F7A";
|
||||||
|
public static final String V_TAG_TM_CVM_LIMIT = "DF8126";
|
||||||
|
public static final String V_TAG_TM_FLOOR_LIMIT = "DF8123";
|
||||||
|
public static final String V_TAG_TM_TRANS_LIMIT = "DF8124";
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.utsmyanmar.baselib.emv;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class ParamHelper {
|
||||||
|
|
||||||
|
private static ParamHelper instance;
|
||||||
|
|
||||||
|
public static ParamHelper getInstance() {
|
||||||
|
if(instance == null) {
|
||||||
|
return new ParamHelper();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String convertPaddedString(long number) {
|
||||||
|
return String.format(Locale.getDefault(),"%010d00", number);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,237 @@
|
|||||||
|
package com.utsmyanmar.baselib.emv;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import com.utsmyanmar.baselib.repo.local.ChipAidRepository;
|
||||||
|
import com.utsmyanmar.baselib.repo.local.ParamRepository;
|
||||||
|
import com.utsmyanmar.baselib.repo.local.QuickPassRepository;
|
||||||
|
import com.utsmyanmar.baselib.util.rx_helper.ProcessDataResult;
|
||||||
|
import com.utsmyanmar.baselib.util.rx_helper.ProcessSingleDataResult;
|
||||||
|
import com.utsmyanmar.baselib.util.rx_helper.RxCallbackUpdateX;
|
||||||
|
import com.utsmyanmar.baselib.util.rx_helper.RxCallbackX;
|
||||||
|
import com.utsmyanmar.baselib.util.rx_helper.RxHelper;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import sunmi.sunmiui.utils.LogUtil;
|
||||||
|
|
||||||
|
public class ParamOperation {
|
||||||
|
|
||||||
|
|
||||||
|
private static final String TAG = ParamOperation.class.getSimpleName();
|
||||||
|
private final Context context;
|
||||||
|
|
||||||
|
|
||||||
|
public ParamOperation(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> void processUpdateChipAidStatus(RxHelper<T> rxHelper, ChipAidRepository paramRepository, boolean aidEnable, String aid, RxCallbackUpdateX rxCallbackUpdateX) {
|
||||||
|
rxHelper.updateData(paramRepository.updateAidByAid(aidEnable, aid), new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
rxCallbackUpdateX.onError(throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
rxCallbackUpdateX.onComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> void processUpdateCtlsCVM(RxHelper<T> rxHelper, ParamRepository<T> paramRepository, long cvmLimit, RxCallbackUpdateX rxCallbackUpdateX) {
|
||||||
|
rxHelper.updateData(paramRepository.updateCVMLimit(cvmLimit), new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
rxCallbackUpdateX.onError(throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
rxCallbackUpdateX.onComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> void processUpdateTTQ(RxHelper<T> rxHelper, ParamRepository paramRepository, String ttq, RxCallbackUpdateX rxCallbackUpdateX) {
|
||||||
|
rxHelper.updateData(paramRepository.updateTTQ(ttq), new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
rxCallbackUpdateX.onError(throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
rxCallbackUpdateX.onComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> void processUpdateCtlsCurrencyCode(RxHelper<T> rxHelper, ParamRepository<T> paramRepository, String currencyCode, RxCallbackUpdateX rxCallbackUpdateX) {
|
||||||
|
rxHelper.updateData(paramRepository.updateCurrencyCode(currencyCode), new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
rxCallbackUpdateX.onError(throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
rxCallbackUpdateX.onComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> void processUpdateCtlsTerminalCapability(RxHelper<T> rxHelper, ParamRepository<T> paramRepository, String terminalCapability, RxCallbackUpdateX rxCallbackUpdateX) {
|
||||||
|
rxHelper.updateData(paramRepository.updateTerminalCapability(terminalCapability), new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
rxCallbackUpdateX.onError(throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
rxCallbackUpdateX.onComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> void processDeleteAll(RxHelper<T> rxHelper, ParamRepository<T> paramRepository, RxCallbackUpdateX rxCallbackUpdateX) {
|
||||||
|
rxHelper.updateData(paramRepository.deleteAll(), new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
rxCallbackUpdateX.onError(throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
rxCallbackUpdateX.onComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected <T> void processData(RxHelper<T> rxHelper, int id, Class<T> clazz, ParamRepository<T> paramRepository, ProcessDataResult<T> result) {
|
||||||
|
rxHelper.queryData(paramRepository.getAll(), new RxCallbackX<List<T>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<T> data) {
|
||||||
|
|
||||||
|
if (data != null && !data.isEmpty()) {
|
||||||
|
LogUtil.d(TAG, clazz.getSimpleName() + " loaded from DB: " + data.size());
|
||||||
|
result.onSuccess(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<T> list = loadJsonConfig(id, clazz);
|
||||||
|
deleteAll(rxHelper, paramRepository, new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
insertData(paramRepository, list);
|
||||||
|
LogUtil.d(TAG, clazz.getSimpleName() + "json file extract size: " + list.size());
|
||||||
|
result.onSuccess(list);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// if (data.isEmpty() || list.size() != data.size()) {
|
||||||
|
// deleteAll(rxHelper, paramRepository, new RxCallbackUpdateX() {
|
||||||
|
// @Override
|
||||||
|
// public void onError(Throwable throwable) {
|
||||||
|
// throwable.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onComplete() {
|
||||||
|
// insertData(paramRepository, list);
|
||||||
|
// LogUtil.d(TAG, clazz.getSimpleName() + "json file extract size: " + list.size());
|
||||||
|
// result.onSuccess(list);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// result.onSuccess(data);
|
||||||
|
// LogUtil.d(TAG, clazz.getSimpleName() + " db size: " + data.size());
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG, throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG, "On Complete");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> void processSingleData(RxHelper<T> rxHelper, ParamRepository<T> paramRepository, ProcessSingleDataResult<T> result) {
|
||||||
|
rxHelper.querySingleData(paramRepository.get(), new RxCallbackX<T>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(T data) {
|
||||||
|
if (data != null) {
|
||||||
|
result.onSuccess(data);
|
||||||
|
} else {
|
||||||
|
result.onDataNotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
LogUtil.d(TAG, throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
LogUtil.d(TAG, "On Complete");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> List<T> loadJsonConfig(int id, Class<T> clazz) {
|
||||||
|
InputStream jsonFile = context.getResources().openRawResource(id);
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(jsonFile));
|
||||||
|
Type collections = TypeToken.getParameterized(Collection.class, clazz).getType();
|
||||||
|
return new Gson().fromJson(reader, collections);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> void deleteAll(RxHelper<T> rxHelper, ParamRepository<T> paramRepository, RxCallbackUpdateX rxCallbackUpdateX) {
|
||||||
|
rxHelper.updateData(paramRepository.deleteAll(), new RxCallbackUpdateX() {
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
rxCallbackUpdateX.onError(throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
rxCallbackUpdateX.onComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> void insertData(ParamRepository<T> paramRepository, List<T> lists) {
|
||||||
|
for (T data : lists) {
|
||||||
|
paramRepository.insert(data);
|
||||||
|
LogUtil.d(TAG, "inserted Data..");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package com.utsmyanmar.baselib.emv;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.R;
|
||||||
|
import com.utsmyanmar.baselib.db.model.BinEntity;
|
||||||
|
import com.utsmyanmar.baselib.repo.local.BinRepository;
|
||||||
|
import com.utsmyanmar.baselib.util.rx_helper.ProcessDataResult;
|
||||||
|
import com.utsmyanmar.baselib.util.rx_helper.RxUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import dagger.hilt.android.qualifiers.ApplicationContext;
|
||||||
|
import sunmi.sunmiui.utils.LogUtil;
|
||||||
|
|
||||||
|
public class TerminalParamOperation extends ParamOperation{
|
||||||
|
|
||||||
|
private static final String TAG = TerminalParamOperation.class.getSimpleName();
|
||||||
|
private final BinRepository binRepository;
|
||||||
|
|
||||||
|
private final RxUtil<BinEntity> binEntityRxUtil = new RxUtil<>();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public TerminalParamOperation(@ApplicationContext Context context,BinRepository binRepository) {
|
||||||
|
super(context);
|
||||||
|
this.binRepository = binRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadBinRange() {
|
||||||
|
processBinRange();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processBinRange() {
|
||||||
|
processData(binEntityRxUtil, R.raw.bin_config, BinEntity.class, binRepository, new ProcessDataResult<BinEntity>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<BinEntity> lists) {
|
||||||
|
LogUtil.d(TAG,"Bin Size :"+lists.size());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package com.utsmyanmar.baselib.emv;
|
||||||
|
|
||||||
|
public enum TerminalType {
|
||||||
|
ATTENDED_FINANCIAL_INSTITUTION_ONLINE_ONLY(11),
|
||||||
|
ATTENDED_FINANCIAL_INSTITUTION_ONLINE_AND_OFFLINE(12),
|
||||||
|
ATTENDED_FINANCIAL_INSTITUTION_OFFLINE_ONLY(13),
|
||||||
|
ATTENDED_MERCHANT_ONLINE_ONLY(21),
|
||||||
|
ATTENDED_MERCHANT_ONLINE_AND_OFFLINE(22),
|
||||||
|
ATTENDED_MERCHANT_OFFLINE_ONLY(23),
|
||||||
|
UNATTENDED_FINANCIAL_INSTITUTION_ONLINE_ONLY(14),
|
||||||
|
UNATTENDED_FINANCIAL_INSTITUTION_ONLINE_AND_OFFLINE(15),
|
||||||
|
UNATTENDED_FINANCIAL_INSTITUTION_OFFLINE_ONLY(16),
|
||||||
|
UNATTENDED_MERCHANT_ONLINE_ONLY(24),
|
||||||
|
UNATTENDED_MERCHANT_ONLINE_AND_OFFLINE(25),
|
||||||
|
UNATTENDED_MERCHANT_OFFLINE_ONLY(26),
|
||||||
|
UNATTENDED_CARDHOLDER_ONLINE_ONLY(34),
|
||||||
|
UNATTENDED_CARDHOLDER_ONLINE_AND_OFFLINE(35),
|
||||||
|
UNATTENDED_CARDHOLDER_OFFLINE_ONLY(36);
|
||||||
|
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
private TerminalType(int i) {
|
||||||
|
this.value = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final int getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
package com.utsmyanmar.baselib.fragment;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.ui.DeclineDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.LoadingDialog;
|
||||||
|
|
||||||
|
public class BaseFragment extends Fragment {
|
||||||
|
|
||||||
|
private Handler dlgHandler = new Handler();
|
||||||
|
private LoadingDialog loadDialog;
|
||||||
|
private DeclineDialog declineDialog;
|
||||||
|
|
||||||
|
protected void dismissLoadingDialog() {
|
||||||
|
getActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (loadDialog != null && loadDialog.isShowing()) {
|
||||||
|
loadDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void showLoadingDialog(String msg) {
|
||||||
|
getActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (loadDialog == null) {
|
||||||
|
loadDialog = new LoadingDialog(getContext(),msg);
|
||||||
|
} else {
|
||||||
|
loadDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!loadDialog.isShowing()) {
|
||||||
|
loadDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showDeclineDialog(String msg) {
|
||||||
|
getActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (declineDialog == null) {
|
||||||
|
declineDialog = new DeclineDialog(getContext(),msg);
|
||||||
|
} else {
|
||||||
|
declineDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!declineDialog.isShowing()) {
|
||||||
|
declineDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showToast(String msg){
|
||||||
|
getActivity().runOnUiThread(
|
||||||
|
() -> Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,196 @@
|
|||||||
|
package com.utsmyanmar.baselib.fragment;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.lifecycle.ViewModel;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.R;
|
||||||
|
import com.utsmyanmar.baselib.ui.DeclineDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.InfoDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.LoadingDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.SingleInfoDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.SuccessDialog;
|
||||||
|
import com.utsmyanmar.baselib.util.DelayCaller;
|
||||||
|
|
||||||
|
public abstract class BaseSettingFragment extends PreferenceFragmentCompat {
|
||||||
|
|
||||||
|
|
||||||
|
private Handler dlgHandler = new Handler();
|
||||||
|
private LoadingDialog loadDialog;
|
||||||
|
private DeclineDialog declineDialog;
|
||||||
|
private SuccessDialog successDialog;
|
||||||
|
private InfoDialog infoDialog;
|
||||||
|
private SingleInfoDialog singleInfoDialog;
|
||||||
|
|
||||||
|
private ViewModelProvider fragmentViewModel;
|
||||||
|
|
||||||
|
protected abstract void initViewModel();
|
||||||
|
@Override
|
||||||
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
initViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setToolBarTitleWithBackIcon(String titleName) {
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setTitle(titleName);
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_left);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T extends ViewModel> T getFragmentScopeViewModel(Class<T> modelClass) {
|
||||||
|
if (fragmentViewModel == null) {
|
||||||
|
fragmentViewModel = new ViewModelProvider(requireActivity());
|
||||||
|
}
|
||||||
|
return fragmentViewModel.get(modelClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dismissLoadingDialog() {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (loadDialog != null && loadDialog.isShowing()) {
|
||||||
|
loadDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getResourceString(int resId) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if(activity != null && isAdded()) {
|
||||||
|
return activity.getString(resId);
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showLoadingDialog(String msg) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (loadDialog == null) {
|
||||||
|
loadDialog = new LoadingDialog(getContext(),msg);
|
||||||
|
} else {
|
||||||
|
loadDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!loadDialog.isShowing()) {
|
||||||
|
loadDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void showDeclineDialog(String msg) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (declineDialog == null) {
|
||||||
|
declineDialog = new DeclineDialog(getContext(),msg);
|
||||||
|
} else {
|
||||||
|
declineDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!declineDialog.isShowing()) {
|
||||||
|
declineDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showInfoDialog(String code,String msg) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (infoDialog == null) {
|
||||||
|
infoDialog = new InfoDialog(getContext(),code,msg);
|
||||||
|
} else {
|
||||||
|
infoDialog.setMessage(code,msg);
|
||||||
|
}
|
||||||
|
if (!infoDialog.isShowing()) {
|
||||||
|
infoDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showSingleInfoDialog(String msg) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (singleInfoDialog == null) {
|
||||||
|
singleInfoDialog = new SingleInfoDialog(getContext(),msg);
|
||||||
|
} else {
|
||||||
|
singleInfoDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!singleInfoDialog.isShowing()) {
|
||||||
|
singleInfoDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dismissDeclineDialog() {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (declineDialog != null && declineDialog.isShowing()) {
|
||||||
|
declineDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void showSuccessDialog(String msg) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (successDialog == null) {
|
||||||
|
successDialog = new SuccessDialog(getContext(),msg);
|
||||||
|
} else {
|
||||||
|
successDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!successDialog.isShowing()) {
|
||||||
|
successDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void delayFunctionCall(DelayCaller handlerMethod, long delayTime) {
|
||||||
|
final Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
handler.postDelayed(handlerMethod::onCall, delayTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showSuccessDialogAutoHide(String msg) {
|
||||||
|
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (successDialog == null) {
|
||||||
|
successDialog = new SuccessDialog(getContext(), msg);
|
||||||
|
} else {
|
||||||
|
successDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!successDialog.isShowing()) {
|
||||||
|
successDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
delayFunctionCall(()-> {
|
||||||
|
successDialog.hide();
|
||||||
|
},3000);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,429 @@
|
|||||||
|
package com.utsmyanmar.baselib.fragment;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.CountDownTimer;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.databinding.ViewDataBinding;
|
||||||
|
import androidx.lifecycle.ViewModel;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.navigation.NavController;
|
||||||
|
import androidx.navigation.NavDestination;
|
||||||
|
import androidx.navigation.NavOptions;
|
||||||
|
import androidx.navigation.Navigation;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.BaseApplication;
|
||||||
|
import com.utsmyanmar.baselib.ui.AnimationDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.DeclineDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.InfoDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.LoadingDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.SingleInfoDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.SuccessDialog;
|
||||||
|
import com.utsmyanmar.baselib.util.CardDetectCallback;
|
||||||
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
|
import com.utsmyanmar.baselib.util.DelayCaller;
|
||||||
|
import com.utsmyanmar.baselib.util.TerminalUtil;
|
||||||
|
import com.utsmyanmar.baselib.util.TimeoutCallback;
|
||||||
|
|
||||||
|
import com.utsmyanmar.checkxread.CheckXRead;
|
||||||
|
import com.utsmyanmar.checkxread.sdk.SunmiSDK;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||||
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
|
|
||||||
|
public abstract class DataBindingActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private Handler dlgHandler = new Handler();
|
||||||
|
private LoadingDialog loadDialog;
|
||||||
|
private DeclineDialog declineDialog;
|
||||||
|
private SuccessDialog successDialog;
|
||||||
|
private InfoDialog infoDialog;
|
||||||
|
private SingleInfoDialog singleInfoDialog;
|
||||||
|
private NavController navController;
|
||||||
|
private ViewModelProvider fragmentViewModel;
|
||||||
|
private AnimationDialog animationDialog;
|
||||||
|
private CountDownTimer countDownTimer;
|
||||||
|
|
||||||
|
protected ViewDataBinding mBinding;
|
||||||
|
|
||||||
|
protected abstract void initViewModel();
|
||||||
|
|
||||||
|
protected abstract DataBindingConfig getDataBindingConfig();
|
||||||
|
|
||||||
|
|
||||||
|
public ViewDataBinding binding;
|
||||||
|
|
||||||
|
DataBindingFragment.BackPressCallback backPressCallback;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
initViewModel();
|
||||||
|
// initNavController();
|
||||||
|
|
||||||
|
Window w = getWindow();
|
||||||
|
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
|
||||||
|
|
||||||
|
DataBindingConfig dataBindingConfig = getDataBindingConfig();
|
||||||
|
binding = DataBindingUtil.setContentView(this,dataBindingConfig.getLayout());
|
||||||
|
binding.setLifecycleOwner(this);
|
||||||
|
binding.setVariable(dataBindingConfig.getVmVariableId(), dataBindingConfig.getStateViewModel());
|
||||||
|
SparseArray bindingParams = dataBindingConfig.getBindingParams();
|
||||||
|
for (int i = 0, length = bindingParams.size(); i < length; i++) {
|
||||||
|
binding.setVariable(bindingParams.keyAt(i), bindingParams.valueAt(i));
|
||||||
|
}
|
||||||
|
mBinding = binding;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setBackPressCallback(DataBindingFragment.BackPressCallback backPressCallback) {
|
||||||
|
this.backPressCallback = backPressCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void setupTimeout(int timeOut, TimeoutCallback timeoutCallback) {
|
||||||
|
countDownTimer = new CountDownTimer(timeOut * 1000, 1000) {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onTick(long millisUntilFinished) {
|
||||||
|
timeoutCallback.onTrick(millisUntilFinished);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onFinish() {
|
||||||
|
timeoutCallback.onFinish();
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void isCardInserted(CardDetectCallback cardDetectCallback) {
|
||||||
|
Observable<Boolean> alertObservable = Observable.create((ObservableOnSubscribe<Boolean>) emitter -> {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
while (SunmiSDK.getInstance().checkCardExist() == 2) {
|
||||||
|
emitter.onNext(true);
|
||||||
|
}
|
||||||
|
emitter.onComplete();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
emitter.onError(e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.throttleLast(2, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
alertObservable.subscribe(new io.reactivex.rxjava3.core.Observer<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@io.reactivex.rxjava3.annotations.NonNull Boolean aBoolean) {
|
||||||
|
if (aBoolean) {
|
||||||
|
|
||||||
|
dismissAnimationDialog();
|
||||||
|
try {
|
||||||
|
BaseApplication.basicOptV2.buzzerOnDevice(1, 2000, 1000, 1000);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
showAnimationDialog("Please remove card!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
dismissAnimationDialog();
|
||||||
|
cardDetectCallback.onComplete();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface BackPressCallback {
|
||||||
|
void onBackPress();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected boolean checkTid() {
|
||||||
|
return (SystemParamsOperation.getInstance().getTerminalId().length() != 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
mBinding.unbind();
|
||||||
|
mBinding = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected <T extends ViewModel> T getFragmentScopeViewModel(Class<T> modelClass) {
|
||||||
|
if (fragmentViewModel == null) {
|
||||||
|
fragmentViewModel = new ViewModelProvider(this);
|
||||||
|
}
|
||||||
|
return fragmentViewModel.get(modelClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initNavController(int nav_host_id) {
|
||||||
|
navController = Navigation.findNavController(this, nav_host_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected NavController getNavController(int nav_host_id) {
|
||||||
|
return Navigation.findNavController(this, nav_host_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void navigateToDestination(int destinationRoute) {
|
||||||
|
navController.navigate(destinationRoute);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void popBackStackToDestination(int destinationId) {
|
||||||
|
navController.popBackStack(destinationId, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void callBuzzer() {
|
||||||
|
try {
|
||||||
|
TerminalUtil.getInstance().makeBuzzer(3);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void safeRouteTo(int currentRouteId, int destinationRouteId, int hostId) {
|
||||||
|
NavDestination currentDestination = getNavController(hostId).getCurrentDestination();
|
||||||
|
|
||||||
|
if (currentDestination == null) {
|
||||||
|
getNavController(hostId).navigate(currentRouteId);
|
||||||
|
currentDestination = getNavController(hostId).getCurrentDestination();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentDestination != null && currentDestination.getId() == currentRouteId) {
|
||||||
|
getNavController(hostId).navigate(destinationRouteId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void safeRouteToRemoveStack(int currentRouteId, int destinationRouteId, int hostId) {
|
||||||
|
NavDestination currentDestination = getNavController(hostId).getCurrentDestination();
|
||||||
|
|
||||||
|
if (currentDestination == null) {
|
||||||
|
getNavController(hostId).navigate(currentRouteId);
|
||||||
|
currentDestination = getNavController(hostId).getCurrentDestination();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentDestination != null && currentDestination.getId() == currentRouteId) {
|
||||||
|
getNavController(hostId).navigate(destinationRouteId, null, new NavOptions.Builder().setPopUpTo(currentRouteId, true).build());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected boolean isInputValid(String input) {
|
||||||
|
if (!input.isEmpty() && input.contains(".")) {
|
||||||
|
int decimalIndex = input.indexOf(".");
|
||||||
|
int len = input.length();
|
||||||
|
|
||||||
|
for (int i = decimalIndex + 1; i < len; i++) {
|
||||||
|
if (input.charAt(i) != '0') {
|
||||||
|
return true; // Valid input: Non-zero digits found after decimal point
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < decimalIndex; i++) {
|
||||||
|
if (input.charAt(i) != '0') {
|
||||||
|
return true; // Valid input: Non-zero digits found before decimal point
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return input.isEmpty() || !input.equals("0");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void delayFunctionCall(DelayCaller handlerMethod) {
|
||||||
|
final Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
handler.postDelayed(handlerMethod::onCall, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void dismissLoadingDialog() {
|
||||||
|
this.runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (loadDialog != null && loadDialog.isShowing()) {
|
||||||
|
loadDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showLoadingDialog(String msg) {
|
||||||
|
this.runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (loadDialog == null) {
|
||||||
|
loadDialog = new LoadingDialog(this, msg);
|
||||||
|
} else {
|
||||||
|
loadDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!loadDialog.isShowing()) {
|
||||||
|
loadDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showAnimationDialog(String msg) {
|
||||||
|
this.runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (animationDialog == null) {
|
||||||
|
animationDialog = new AnimationDialog(this, msg);
|
||||||
|
} else {
|
||||||
|
animationDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!animationDialog.isShowing()) {
|
||||||
|
animationDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dismissAnimationDialog() {
|
||||||
|
this.runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (animationDialog != null && animationDialog.isShowing()) {
|
||||||
|
animationDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
|
||||||
|
if (countDownTimer != null)
|
||||||
|
countDownTimer.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showShortToast(String msg) {
|
||||||
|
this.runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showDeclineDialog(String msg) {
|
||||||
|
this.runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (declineDialog == null) {
|
||||||
|
declineDialog = new DeclineDialog(this, msg);
|
||||||
|
} else {
|
||||||
|
declineDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!declineDialog.isShowing()) {
|
||||||
|
declineDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showInfoDialog(String code, String msg) {
|
||||||
|
this.runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (infoDialog == null) {
|
||||||
|
infoDialog = new InfoDialog(this, code, msg);
|
||||||
|
} else {
|
||||||
|
infoDialog.setMessage(code, msg);
|
||||||
|
}
|
||||||
|
if (!infoDialog.isShowing()) {
|
||||||
|
infoDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showSingleInfoDialog(String msg) {
|
||||||
|
this.runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (singleInfoDialog == null) {
|
||||||
|
singleInfoDialog = new SingleInfoDialog(this, msg);
|
||||||
|
} else {
|
||||||
|
singleInfoDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!singleInfoDialog.isShowing()) {
|
||||||
|
singleInfoDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dismissDeclineDialog() {
|
||||||
|
this.runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (declineDialog != null && declineDialog.isShowing()) {
|
||||||
|
declineDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dismissSingleInfoDialog() {
|
||||||
|
this.runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (singleInfoDialog != null && singleInfoDialog.isShowing()) {
|
||||||
|
singleInfoDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void showSuccessDialog(String msg) {
|
||||||
|
this.runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (successDialog == null) {
|
||||||
|
successDialog = new SuccessDialog(this, msg);
|
||||||
|
} else {
|
||||||
|
successDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!successDialog.isShowing()) {
|
||||||
|
successDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,331 @@
|
|||||||
|
package com.utsmyanmar.baselib.fragment;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.databinding.ViewDataBinding;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.ViewModel;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.navigation.NavController;
|
||||||
|
import androidx.navigation.NavDestination;
|
||||||
|
import androidx.navigation.Navigation;
|
||||||
|
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||||
|
import com.utsmyanmar.baselib.R;
|
||||||
|
import com.utsmyanmar.baselib.ui.DeclineDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.InfoDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.LoadingDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.SingleInfoDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.SuccessDialog;
|
||||||
|
import com.utsmyanmar.baselib.util.BackPressCallback;
|
||||||
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
|
import com.utsmyanmar.baselib.util.DelayCaller;
|
||||||
|
import com.utsmyanmar.baselib.util.TerminalUtil;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public abstract class DataBindingBottomSheetFragment extends BottomSheetDialogFragment {
|
||||||
|
|
||||||
|
private Handler dlgHandler = new Handler();
|
||||||
|
private LoadingDialog loadDialog;
|
||||||
|
private DeclineDialog declineDialog;
|
||||||
|
private SuccessDialog successDialog;
|
||||||
|
private InfoDialog infoDialog;
|
||||||
|
private SingleInfoDialog singleInfoDialog;
|
||||||
|
private NavController navController;
|
||||||
|
private ViewModelProvider fragmentViewModel;
|
||||||
|
|
||||||
|
protected ViewDataBinding mBinding;
|
||||||
|
|
||||||
|
protected abstract void initViewModel();
|
||||||
|
|
||||||
|
protected abstract DataBindingConfig getDataBindingConfig();
|
||||||
|
|
||||||
|
public ViewDataBinding binding;
|
||||||
|
|
||||||
|
BackPressCallback backPressCallback;
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
// Create a custom dialog by using the BottomSheetDialog constructor
|
||||||
|
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
|
||||||
|
|
||||||
|
dialog.setOnShowListener(dialogInterface -> {
|
||||||
|
// Get the BottomSheetBehavior from the dialog's internal view
|
||||||
|
FrameLayout bottomSheet = dialog.findViewById(com.google.android.material.R.id.design_bottom_sheet);
|
||||||
|
BottomSheetBehavior.from(bottomSheet).setDraggable(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Disable dismiss behavior
|
||||||
|
dialog.setCanceledOnTouchOutside(false);
|
||||||
|
dialog.setCancelable(false);
|
||||||
|
|
||||||
|
|
||||||
|
// Return the modified dialog
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
initViewModel();
|
||||||
|
|
||||||
|
|
||||||
|
Window w = requireActivity().getWindow();
|
||||||
|
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
DataBindingConfig dataBindingConfig = getDataBindingConfig();
|
||||||
|
binding = DataBindingUtil.inflate(inflater,dataBindingConfig.getLayout(),container,false);
|
||||||
|
binding.setLifecycleOwner(this);
|
||||||
|
binding.setVariable(dataBindingConfig.getVmVariableId(),dataBindingConfig.getStateViewModel());
|
||||||
|
SparseArray bindingParams = dataBindingConfig.getBindingParams();
|
||||||
|
for (int i = 0, length = bindingParams.size(); i < length; i++) {
|
||||||
|
binding.setVariable(bindingParams.keyAt(i), bindingParams.valueAt(i));
|
||||||
|
}
|
||||||
|
mBinding = binding;
|
||||||
|
|
||||||
|
return mBinding.getRoot();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackPressCallback(BackPressCallback backPressCallback) {
|
||||||
|
this.backPressCallback = backPressCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
mBinding.unbind();
|
||||||
|
mBinding = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setStatusBarColor() {
|
||||||
|
Window window = requireActivity().getWindow();
|
||||||
|
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
|
||||||
|
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
window.setStatusBarColor(Color.TRANSPARENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T extends ViewModel> T getFragmentScopeViewModel(Class<T> modelClass) {
|
||||||
|
if(fragmentViewModel == null) {
|
||||||
|
fragmentViewModel = new ViewModelProvider(requireActivity());
|
||||||
|
}
|
||||||
|
return fragmentViewModel.get(modelClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initNavController(int nav_host_id) {
|
||||||
|
navController = Navigation.findNavController(requireActivity(),nav_host_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected NavController getNavController(int nav_host_id) {
|
||||||
|
return Navigation.findNavController(requireActivity(),nav_host_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void navigateToDestination(int destinationRoute) {
|
||||||
|
navController.navigate(destinationRoute);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void popBackStackToDestination(int destinationId) {
|
||||||
|
navController.popBackStack(destinationId,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean checkTid() {
|
||||||
|
return (SystemParamsOperation.getInstance().getTerminalId().length() != 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void safeRouteTo(int currentRouteId,int destinationRouteId,int hostId) {
|
||||||
|
NavDestination currentDestination = getNavController(hostId).getCurrentDestination();
|
||||||
|
|
||||||
|
if(currentDestination == null) {
|
||||||
|
getNavController(hostId).navigate(currentRouteId);
|
||||||
|
currentDestination = getNavController(hostId).getCurrentDestination();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(currentDestination != null && currentDestination.getId() == currentRouteId) {
|
||||||
|
getNavController(hostId).navigate(destinationRouteId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void callBuzzer(){
|
||||||
|
try {
|
||||||
|
TerminalUtil.getInstance().makeBuzzer(3);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void delayFunctionCall(DelayCaller handlerMethod){
|
||||||
|
final Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
handler.postDelayed(handlerMethod::onCall, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void dismissLoadingDialog() {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (loadDialog != null && loadDialog.isShowing()) {
|
||||||
|
loadDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showLoadingDialog(String msg) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (loadDialog == null) {
|
||||||
|
loadDialog = new LoadingDialog(getContext(),msg);
|
||||||
|
} else {
|
||||||
|
loadDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!loadDialog.isShowing()) {
|
||||||
|
loadDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setToolBarTitle(String titleName){
|
||||||
|
((AppCompatActivity)requireActivity()).getSupportActionBar().setTitle(titleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setToolBarTitleCenter(String titleName){
|
||||||
|
((AppCompatActivity)requireActivity()).getSupportActionBar().setTitle(titleName);
|
||||||
|
((AppCompatActivity)requireActivity()).getSupportActionBar().setDisplayShowTitleEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showShortToast(String msg) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
Toast.makeText(getContext(),msg,Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showDeclineDialog(String msg) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (declineDialog == null) {
|
||||||
|
declineDialog = new DeclineDialog(getContext(),msg);
|
||||||
|
} else {
|
||||||
|
declineDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!declineDialog.isShowing()) {
|
||||||
|
declineDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showInfoDialog(String code,String msg) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (infoDialog == null) {
|
||||||
|
infoDialog = new InfoDialog(getContext(),code,msg);
|
||||||
|
} else {
|
||||||
|
infoDialog.setMessage(code,msg);
|
||||||
|
}
|
||||||
|
if (!infoDialog.isShowing()) {
|
||||||
|
infoDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showSingleInfoDialog(String msg) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (singleInfoDialog == null) {
|
||||||
|
singleInfoDialog = new SingleInfoDialog(getContext(),msg);
|
||||||
|
} else {
|
||||||
|
singleInfoDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!singleInfoDialog.isShowing()) {
|
||||||
|
singleInfoDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dismissDeclineDialog() {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (declineDialog != null && declineDialog.isShowing()) {
|
||||||
|
declineDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dismissSingleInfoDialog() {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (singleInfoDialog != null && singleInfoDialog.isShowing()) {
|
||||||
|
singleInfoDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void showSuccessDialog(String msg) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (successDialog == null) {
|
||||||
|
successDialog = new SuccessDialog(getContext(),msg);
|
||||||
|
} else {
|
||||||
|
successDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!successDialog.isShowing()) {
|
||||||
|
successDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,895 @@
|
|||||||
|
package com.utsmyanmar.baselib.fragment;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.res.AssetFileDescriptor;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.media.MediaPlayer;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.CountDownTimer;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.databinding.ViewDataBinding;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.ViewModel;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.navigation.NavController;
|
||||||
|
import androidx.navigation.NavDestination;
|
||||||
|
import androidx.navigation.NavOptions;
|
||||||
|
import androidx.navigation.Navigation;
|
||||||
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.BaseApplication;
|
||||||
|
import com.utsmyanmar.baselib.R;
|
||||||
|
import com.utsmyanmar.baselib.ui.AnimationDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.DeclineDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.InfoDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.LoadingDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.PrinterAlertDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.SingleInfoDialog;
|
||||||
|
import com.utsmyanmar.baselib.ui.SuccessDialog;
|
||||||
|
import com.utsmyanmar.baselib.util.BackPressCallback;
|
||||||
|
import com.utsmyanmar.baselib.util.CardDetectCallback;
|
||||||
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
|
import com.utsmyanmar.baselib.util.DelayCaller;
|
||||||
|
import com.utsmyanmar.baselib.util.DialogCallback;
|
||||||
|
import com.utsmyanmar.baselib.util.TerminalUtil;
|
||||||
|
import com.utsmyanmar.baselib.util.TimeoutCallback;
|
||||||
|
|
||||||
|
|
||||||
|
import com.utsmyanmar.checkxread.CheckXRead;
|
||||||
|
import com.utsmyanmar.checkxread.sdk.SunmiSDK;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
|
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 sunmi.sunmiui.utils.LogUtil;
|
||||||
|
|
||||||
|
public abstract class DataBindingFragment extends Fragment {
|
||||||
|
|
||||||
|
private static final String TAG = DataBindingFragment.class.getSimpleName();
|
||||||
|
private Handler dlgHandler = new Handler();
|
||||||
|
private LoadingDialog loadDialog;
|
||||||
|
private DeclineDialog declineDialog;
|
||||||
|
private SuccessDialog successDialog;
|
||||||
|
private PrinterAlertDialog printerAlertDialog;
|
||||||
|
|
||||||
|
private InfoDialog infoDialog;
|
||||||
|
private SingleInfoDialog singleInfoDialog;
|
||||||
|
private NavController navController;
|
||||||
|
private ViewModelProvider fragmentViewModel;
|
||||||
|
private AnimationDialog animationDialog;
|
||||||
|
|
||||||
|
private CountDownTimer countDownTimer;
|
||||||
|
|
||||||
|
protected ViewDataBinding mBinding;
|
||||||
|
|
||||||
|
protected abstract void initViewModel();
|
||||||
|
|
||||||
|
protected abstract DataBindingConfig getDataBindingConfig();
|
||||||
|
|
||||||
|
|
||||||
|
public ViewDataBinding binding;
|
||||||
|
|
||||||
|
BackPressCallback backPressCallback;
|
||||||
|
|
||||||
|
protected abstract int currentId();
|
||||||
|
protected abstract int hostId();
|
||||||
|
protected abstract int routeId();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
initViewModel();
|
||||||
|
// initNavController();
|
||||||
|
|
||||||
|
Window w = requireActivity().getWindow();
|
||||||
|
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
DataBindingConfig dataBindingConfig = getDataBindingConfig();
|
||||||
|
binding = DataBindingUtil.inflate(inflater, dataBindingConfig.getLayout(), container, false);
|
||||||
|
binding.setLifecycleOwner(getViewLifecycleOwner());
|
||||||
|
binding.setVariable(dataBindingConfig.getVmVariableId(), dataBindingConfig.getStateViewModel());
|
||||||
|
SparseArray bindingParams = dataBindingConfig.getBindingParams();
|
||||||
|
for (int i = 0, length = bindingParams.size(); i < length; i++) {
|
||||||
|
binding.setVariable(bindingParams.keyAt(i), bindingParams.valueAt(i));
|
||||||
|
}
|
||||||
|
mBinding = binding;
|
||||||
|
|
||||||
|
return mBinding.getRoot();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void setBackPressCallback(BackPressCallback backPressCallback) {
|
||||||
|
this.backPressCallback = backPressCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setupBackButtonPressDetection(BackPressCallback callback) {
|
||||||
|
// this.backPressCallback = backPressCallback;
|
||||||
|
getView().setFocusableInTouchMode(true);
|
||||||
|
getView().requestFocus();
|
||||||
|
getView().setOnKeyListener((v, keyCode, event) -> {
|
||||||
|
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onBackPress();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isValidDomain(String domain) {
|
||||||
|
String regex = "^(https?://)?([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,}(/)?$";
|
||||||
|
|
||||||
|
Pattern pattern = Pattern.compile(regex);
|
||||||
|
Matcher matcher = pattern.matcher(domain);
|
||||||
|
|
||||||
|
if (matcher.matches()) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setupTimeout(int timeOut, TimeoutCallback timeoutCallback) {
|
||||||
|
countDownTimer = new CountDownTimer(timeOut * 1000, 1000) {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onTick(long millisUntilFinished) {
|
||||||
|
timeoutCallback.onTrick(millisUntilFinished);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onFinish() {
|
||||||
|
timeoutCallback.onFinish();
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void cancelTimeout() {
|
||||||
|
if(countDownTimer != null) {
|
||||||
|
countDownTimer.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void isCardInserted(CardDetectCallback cardDetectCallback) {
|
||||||
|
Observable<Boolean> alertObservable = Observable.create((ObservableOnSubscribe<Boolean>) emitter -> {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
int result = SunmiSDK.getInstance().checkCardExist();
|
||||||
|
|
||||||
|
while(result == -10107){
|
||||||
|
result = SunmiSDK.getInstance().checkCardExist();
|
||||||
|
}
|
||||||
|
|
||||||
|
while (SunmiSDK.getInstance().checkCardExist() == 2) {
|
||||||
|
emitter.onNext(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
LogUtil.d("DATA BINDING FRAGMENT","Card exist status : "+SunmiSDK.getInstance().checkCardExist());
|
||||||
|
emitter.onComplete();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
emitter.onError(e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.throttleLast(2, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
alertObservable.subscribe(new io.reactivex.rxjava3.core.Observer<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@io.reactivex.rxjava3.annotations.NonNull Boolean aBoolean) {
|
||||||
|
if (aBoolean) {
|
||||||
|
|
||||||
|
dismissAnimationDialog();
|
||||||
|
try {
|
||||||
|
BaseApplication.basicOptV2.buzzerOnDevice(1, 2000, 1000, 1000);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
showAnimationDialog("Please remove card!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
dismissAnimationDialog();
|
||||||
|
cardDetectCallback.onComplete();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void isCardTaped(String alertMsg,CardDetectCallback cardDetectCallback) {
|
||||||
|
Observable<Boolean> alertObservable = Observable.create((ObservableOnSubscribe<Boolean>) emitter -> {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
int result = SunmiSDK.getInstance().checkCardTap();
|
||||||
|
|
||||||
|
while(result == -10107){
|
||||||
|
result = SunmiSDK.getInstance().checkCardTap();
|
||||||
|
}
|
||||||
|
|
||||||
|
while (SunmiSDK.getInstance().checkCardTap() == 2) {
|
||||||
|
emitter.onNext(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
LogUtil.d(TAG,"Card exist status : "+SunmiSDK.getInstance().checkCardTap());
|
||||||
|
emitter.onComplete();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
emitter.onError(e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.throttleLast(1, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
alertObservable.subscribe(new io.reactivex.rxjava3.core.Observer<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@io.reactivex.rxjava3.annotations.NonNull Boolean aBoolean) {
|
||||||
|
if (aBoolean) {
|
||||||
|
|
||||||
|
dismissAnimationDialog();
|
||||||
|
try {
|
||||||
|
BaseApplication.basicOptV2.buzzerOnDevice(1, 2000, 1000, 1000);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
showAnimationDialog(alertMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
dismissAnimationDialog();
|
||||||
|
cardDetectCallback.onComplete();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void disableNavigationBar() {
|
||||||
|
try {
|
||||||
|
int result = BaseApplication.getInstance().basicOptBinder.setScreenMode(1);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void enableNavigationBar() {
|
||||||
|
try {
|
||||||
|
int result = BaseApplication.getInstance().basicOptBinder.setScreenMode(-1);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface BackPressCallback {
|
||||||
|
void onBackPress();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected boolean checkTid() {
|
||||||
|
return (SystemParamsOperation.getInstance().getTerminalId().length() != 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
mBinding.unbind();
|
||||||
|
mBinding = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setStatusBarColor() {
|
||||||
|
Window window = requireActivity().getWindow();
|
||||||
|
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
|
||||||
|
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
window.setStatusBarColor(Color.TRANSPARENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T extends ViewModel> T getFragmentScopeViewModel(Class<T> modelClass) {
|
||||||
|
if (fragmentViewModel == null) {
|
||||||
|
fragmentViewModel = new ViewModelProvider(requireActivity());
|
||||||
|
}
|
||||||
|
return fragmentViewModel.get(modelClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initNavController(int nav_host_id) {
|
||||||
|
navController = Navigation.findNavController(requireActivity(), nav_host_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected NavController getNavController(int nav_host_id) {
|
||||||
|
return Navigation.findNavController(requireActivity(), nav_host_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void callBuzzer() {
|
||||||
|
try {
|
||||||
|
TerminalUtil.getInstance().makeBuzzer(3);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getResourceString(int resId) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if(activity != null && isAdded()) {
|
||||||
|
return activity.getString(resId);
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void popBackStack() {
|
||||||
|
getNavController(hostId()).popBackStack();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void safeNavigateToRouteId(){
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if(activity != null && isAdded()) {
|
||||||
|
NavDestination currentDestination = getNavController(hostId()).getCurrentDestination();
|
||||||
|
|
||||||
|
if (currentDestination == null) {
|
||||||
|
getNavController(hostId()).navigate(currentId());
|
||||||
|
currentDestination = getNavController(hostId()).getCurrentDestination();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentDestination != null && currentDestination.getId() == currentId()) {
|
||||||
|
getNavController(hostId()).navigate(routeId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void safeRouteTo(int currentRouteId, int destinationRouteId, int hostId) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if(activity != null && isAdded()) {
|
||||||
|
NavDestination currentDestination = getNavController(hostId).getCurrentDestination();
|
||||||
|
|
||||||
|
if (currentDestination == null) {
|
||||||
|
getNavController(hostId).navigate(currentRouteId);
|
||||||
|
currentDestination = getNavController(hostId).getCurrentDestination();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentDestination != null && currentDestination.getId() == currentRouteId) {
|
||||||
|
getNavController(hostId).navigate(destinationRouteId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void safePopBackStack() {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if(activity != null && isAdded()) {
|
||||||
|
NavDestination currentDestination = getNavController(hostId()).getCurrentDestination();
|
||||||
|
|
||||||
|
if (currentDestination == null) {
|
||||||
|
getNavController(hostId()).navigate(currentId());
|
||||||
|
currentDestination = getNavController(hostId()).getCurrentDestination();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentDestination != null && currentDestination.getId() == currentId()) {
|
||||||
|
getNavController(hostId()).popBackStack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void safePopBack(int currentRouteId, int hostId) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if(activity != null && isAdded()) {
|
||||||
|
NavDestination currentDestination = getNavController(hostId).getCurrentDestination();
|
||||||
|
|
||||||
|
if (currentDestination == null) {
|
||||||
|
getNavController(hostId).navigate(currentRouteId);
|
||||||
|
currentDestination = getNavController(hostId).getCurrentDestination();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentDestination != null && currentDestination.getId() == currentRouteId) {
|
||||||
|
getNavController(hostId).popBackStack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void safeRouteToRemoveStack(int currentRouteId, int destinationRouteId, int hostId) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if(activity != null && isAdded()) {
|
||||||
|
NavDestination currentDestination = getNavController(hostId).getCurrentDestination();
|
||||||
|
|
||||||
|
if (currentDestination == null) {
|
||||||
|
getNavController(hostId).navigate(currentRouteId);
|
||||||
|
currentDestination = getNavController(hostId).getCurrentDestination();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentDestination != null && currentDestination.getId() == currentRouteId) {
|
||||||
|
getNavController(hostId).navigate(destinationRouteId, null, new NavOptions.Builder().setPopUpTo(currentRouteId, true).build());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected boolean isInputValid(String input) {
|
||||||
|
if (!input.isEmpty() && input.contains(".")) {
|
||||||
|
int decimalIndex = input.indexOf(".");
|
||||||
|
int len = input.length();
|
||||||
|
|
||||||
|
for (int i = decimalIndex + 1; i < len; i++) {
|
||||||
|
if (input.charAt(i) != '0') {
|
||||||
|
return true; // Valid input: Non-zero digits found after decimal point
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < decimalIndex; i++) {
|
||||||
|
if (input.charAt(i) != '0') {
|
||||||
|
return true; // Valid input: Non-zero digits found before decimal point
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return input.isEmpty() || !input.equals("0");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void delayFunctionCall(DelayCaller handlerMethod) {
|
||||||
|
final Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
handler.postDelayed(handlerMethod::onCall, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (loadDialog != null && loadDialog.isShowing()) {
|
||||||
|
loadDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showDeclineDialogAutoHide(String msg) {
|
||||||
|
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (declineDialog == null) {
|
||||||
|
declineDialog = new DeclineDialog(getContext(), msg);
|
||||||
|
} else {
|
||||||
|
declineDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!declineDialog.isShowing()) {
|
||||||
|
declineDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
delayFunctionCall(()-> {
|
||||||
|
declineDialog.hide();
|
||||||
|
},3000);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showLoadingDialog(String msg) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (loadDialog == null) {
|
||||||
|
loadDialog = new LoadingDialog(getContext(), msg);
|
||||||
|
} else {
|
||||||
|
loadDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!loadDialog.isShowing()) {
|
||||||
|
loadDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showAnimationDialog(String msg) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (animationDialog == null) {
|
||||||
|
animationDialog = new AnimationDialog(getContext(), msg);
|
||||||
|
} else {
|
||||||
|
animationDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!animationDialog.isShowing()) {
|
||||||
|
animationDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dismissAnimationDialog() {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (animationDialog != null && animationDialog.isShowing()) {
|
||||||
|
animationDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void startSound(String filename) {
|
||||||
|
AssetFileDescriptor afd = null;
|
||||||
|
try {
|
||||||
|
afd = getResources().getAssets().openFd(filename);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
MediaPlayer player = new MediaPlayer();
|
||||||
|
try {
|
||||||
|
assert afd != null;
|
||||||
|
player.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
player.prepare();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
player.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setToolBarTitle(String titleName) {
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setTitle(titleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setToolBarTitleCenter(String titleName) {
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setTitle(titleName);
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setDisplayShowTitleEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setNavBarIconWithTitle(String titleName) {
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setTitle(titleName);
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_hamburger);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setToolBarTitleWithBackIcon(String titleName) {
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setTitle(titleName);
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_left);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setToolBarTitleWithoutBackIcon(String titleName) {
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setTitle(titleName);
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setHomeButtonEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setDefaultToolbar() {
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
((AppCompatActivity) requireActivity()).getSupportActionBar().setHomeButtonEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean checkValidTime(String time) {
|
||||||
|
String regexPattern = "^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$";
|
||||||
|
Pattern pattern = Pattern.compile(regexPattern);
|
||||||
|
|
||||||
|
// Create a Matcher object
|
||||||
|
Matcher matcher = pattern.matcher(time);
|
||||||
|
|
||||||
|
// Check if the test string matches the regex pattern
|
||||||
|
if (matcher.matches()) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
setDefaultToolbar();
|
||||||
|
|
||||||
|
if (countDownTimer != null)
|
||||||
|
countDownTimer.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showShortToast(String msg) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showDeclineDialog(String msg) {
|
||||||
|
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
|
||||||
|
if (declineDialog == null) {
|
||||||
|
declineDialog = new DeclineDialog(getContext(), msg);
|
||||||
|
} else {
|
||||||
|
declineDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!declineDialog.isShowing()) {
|
||||||
|
declineDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showInfoDialog(String code, String msg) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (infoDialog == null) {
|
||||||
|
infoDialog = new InfoDialog(getContext(), code, msg);
|
||||||
|
} else {
|
||||||
|
infoDialog.setMessage(code, msg);
|
||||||
|
}
|
||||||
|
if (!infoDialog.isShowing()) {
|
||||||
|
infoDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showSingleInfoDialog(String msg) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (singleInfoDialog == null) {
|
||||||
|
singleInfoDialog = new SingleInfoDialog(getContext(), msg);
|
||||||
|
} else {
|
||||||
|
singleInfoDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!singleInfoDialog.isShowing()) {
|
||||||
|
singleInfoDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dismissDeclineDialog() {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (declineDialog != null && declineDialog.isShowing()) {
|
||||||
|
declineDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dismissSingleInfoDialog() {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (singleInfoDialog != null && singleInfoDialog.isShowing()) {
|
||||||
|
singleInfoDialog.dismiss();
|
||||||
|
}
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void showSuccessDialog(String msg) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (successDialog == null) {
|
||||||
|
successDialog = new SuccessDialog(getContext(), msg);
|
||||||
|
} else {
|
||||||
|
successDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!successDialog.isShowing()) {
|
||||||
|
successDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showSuccessDialogAutoHide(String msg) {
|
||||||
|
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null && !activity.isFinishing()) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (successDialog == null) {
|
||||||
|
successDialog = new SuccessDialog(getContext(), msg);
|
||||||
|
} else {
|
||||||
|
successDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!successDialog.isShowing()) {
|
||||||
|
successDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
delayFunctionCall(()-> {
|
||||||
|
successDialog.hide();
|
||||||
|
},3000);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showSingleInfoDialogAutoHide(String msg) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (singleInfoDialog == null) {
|
||||||
|
singleInfoDialog = new SingleInfoDialog(getContext(), msg);
|
||||||
|
} else {
|
||||||
|
singleInfoDialog.setMessage(msg);
|
||||||
|
}
|
||||||
|
if (!singleInfoDialog.isShowing()) {
|
||||||
|
singleInfoDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
delayFunctionCall(()-> {
|
||||||
|
singleInfoDialog.hide();
|
||||||
|
},1500);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showPrinterAlertDialog(String msg, DialogCallback dialogCallback) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
if (printerAlertDialog == null) {
|
||||||
|
printerAlertDialog = new PrinterAlertDialog(getContext(), msg,dialogCallback);
|
||||||
|
} else {
|
||||||
|
printerAlertDialog.setMessage(msg,dialogCallback);
|
||||||
|
}
|
||||||
|
if (!printerAlertDialog.isShowing()) {
|
||||||
|
printerAlertDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dismissPrinterAlertDialog() {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (isAdded() && activity != null) {
|
||||||
|
requireActivity().runOnUiThread(
|
||||||
|
() -> {
|
||||||
|
|
||||||
|
if (printerAlertDialog != null && printerAlertDialog.isShowing()) {
|
||||||
|
printerAlertDialog.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
dlgHandler.removeCallbacksAndMessages(null);
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.utsmyanmar.baselib.network;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.utsmyanmar.baselib.network.model.SiriusBody;
|
||||||
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusRequest;
|
||||||
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusResponse;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.Header;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
|
||||||
|
public interface SiriusApiService {
|
||||||
|
|
||||||
|
@POST("terminal/sync")
|
||||||
|
Observable<SiriusResponse> getParams(@Body SiriusRequest siriusRequest);
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.utsmyanmar.baselib.network;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.network.model.MMQRReturnRequest;
|
||||||
|
import com.utsmyanmar.baselib.network.model.MMQRReturnResponse;
|
||||||
|
import com.utsmyanmar.baselib.network.model.MMQRStatusResponse;
|
||||||
|
import com.utsmyanmar.baselib.network.model.WaveQRRequest;
|
||||||
|
import com.utsmyanmar.baselib.network.model.WaveQRResponse;
|
||||||
|
import com.utsmyanmar.baselib.network.model.WaveStatusRequest;
|
||||||
|
import com.utsmyanmar.baselib.network.model.WaveTokenResponse;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.Field;
|
||||||
|
import retrofit2.http.FormUrlEncoded;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
|
||||||
|
public interface WaveApiService {
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST("auth")
|
||||||
|
Observable<WaveTokenResponse> authRequest(
|
||||||
|
@Field("client_id") String clientId,
|
||||||
|
@Field("grant-type") String grantType,
|
||||||
|
@Field("username") String username,
|
||||||
|
@Field("password") String password
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@POST("requestqr")
|
||||||
|
Observable<WaveQRResponse> qrRequest(@Body WaveQRRequest waveQRRequest);
|
||||||
|
|
||||||
|
@POST("status")
|
||||||
|
Observable<MMQRStatusResponse> checkStatus(@Body WaveStatusRequest waveStatusRequest);
|
||||||
|
|
||||||
|
@POST("return")
|
||||||
|
Observable<MMQRReturnResponse> returnTrans(@Body MMQRReturnRequest mmqrReturnRequest);
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package com.utsmyanmar.baselib.network;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.utsmyanmar.baselib.network.model.WaveAccessTokenResponse;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.Field;
|
||||||
|
import retrofit2.http.FormUrlEncoded;
|
||||||
|
import retrofit2.http.HeaderMap;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
|
||||||
|
public interface WaveTokenApiService {
|
||||||
|
|
||||||
|
@POST("token")
|
||||||
|
@FormUrlEncoded
|
||||||
|
Observable<WaveAccessTokenResponse> tokenRequest(@Field("grant_type") String grantType);
|
||||||
|
|
||||||
|
@POST("token")
|
||||||
|
@FormUrlEncoded
|
||||||
|
Call<JsonObject> tokenQRRequest(
|
||||||
|
@HeaderMap Map<String, String> headers,
|
||||||
|
@Field("grant_type") String grantType
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.interceptor;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import okhttp3.HttpUrl;
|
||||||
|
import okhttp3.Interceptor;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interceptor is for the case while fetching the QR API endpoint recently and the app need a restart.
|
||||||
|
* */
|
||||||
|
public class HostSelectionInterceptor implements Interceptor {
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Response intercept(@NonNull Chain chain) throws IOException {
|
||||||
|
Request request = chain.request();
|
||||||
|
|
||||||
|
HttpUrl url = request.url();
|
||||||
|
|
||||||
|
String host = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
||||||
|
String tokenHost = SystemParamsOperation.getInstance().getTokenHostAddress();
|
||||||
|
if (host != null) {
|
||||||
|
|
||||||
|
if(url.toString().contains("requestqr")) {
|
||||||
|
host = host + "requestqr";
|
||||||
|
} else if(url.toString().contains("status")) {
|
||||||
|
host = host + "status";
|
||||||
|
} else if(url.toString().contains("token")) {
|
||||||
|
host = tokenHost + "token";
|
||||||
|
} else if(url.toString().contains("return")) {
|
||||||
|
host = host + "return";
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpUrl newUrl = HttpUrl.parse(host);
|
||||||
|
request = request.newBuilder()
|
||||||
|
.url(newUrl)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
return chain.proceed(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,102 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.interceptor;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.utsmyanmar.baselib.network.WaveTokenApiService;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsSettings;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import okhttp3.HttpUrl;
|
||||||
|
import okhttp3.Interceptor;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
public class QRAuthInterceptor implements Interceptor {
|
||||||
|
|
||||||
|
private final WaveTokenApiService tokenApiService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public QRAuthInterceptor(WaveTokenApiService tokenApiService) {
|
||||||
|
this.tokenApiService = tokenApiService;
|
||||||
|
}
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Response intercept(@NonNull Chain chain) throws IOException {
|
||||||
|
Request originalRequest = chain.request();
|
||||||
|
|
||||||
|
Request.Builder builder = originalRequest.newBuilder();
|
||||||
|
|
||||||
|
HttpUrl url = originalRequest.url();
|
||||||
|
|
||||||
|
builder.removeHeader("Content-Type");
|
||||||
|
|
||||||
|
String accessToken = SystemParamsOperation.getInstance().getUserToken();
|
||||||
|
|
||||||
|
//// if(url.toString().contains("token")) {
|
||||||
|
//// tokenHost = tokenHost + "token";
|
||||||
|
//// builder.url(tokenHost);
|
||||||
|
//// builder.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
//// builder.addHeader("Authorization",authToken);
|
||||||
|
////
|
||||||
|
//// } else {
|
||||||
|
//// builder.addHeader("Content-Type", "application/json");
|
||||||
|
//// builder.addHeader("Authorization","Bearer "+accessToken);
|
||||||
|
//// }
|
||||||
|
|
||||||
|
builder.addHeader("Content-Type", "application/json");
|
||||||
|
builder.addHeader("Authorization","Bearer "+accessToken);
|
||||||
|
|
||||||
|
|
||||||
|
Response response = chain.proceed(builder.build());
|
||||||
|
|
||||||
|
// Handle token expiration
|
||||||
|
if (response.code() == 401) {
|
||||||
|
synchronized (this) {
|
||||||
|
String newAccessToken = refreshAccessToken();
|
||||||
|
|
||||||
|
if (newAccessToken != null) {
|
||||||
|
SystemParamsOperation.getInstance().setUserToken(newAccessToken);
|
||||||
|
|
||||||
|
response.close();
|
||||||
|
// Retry the original request with the new token
|
||||||
|
Request newRequest = originalRequest.newBuilder()
|
||||||
|
.header("Authorization", "Bearer " + newAccessToken)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Close the previous response before retrying
|
||||||
|
|
||||||
|
return chain.proceed(newRequest); // Retry the request
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String refreshAccessToken() {
|
||||||
|
try {
|
||||||
|
String grantType = SystemParamsOperation.getInstance().getGrantType();
|
||||||
|
String authToken = SystemParamsOperation.getInstance().getAuthToken();
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Content-Type", "application/x-www-form-urlencoded"); // Add your custom header
|
||||||
|
headers.put("Authorization", authToken); // If you need authorization
|
||||||
|
Call<JsonObject> refreshCall = tokenApiService.tokenQRRequest(headers,grantType);
|
||||||
|
retrofit2.Response<JsonObject> refreshResponse = refreshCall.execute();
|
||||||
|
|
||||||
|
if (refreshResponse.isSuccessful()) {
|
||||||
|
JsonObject jsonResponse = refreshResponse.body();
|
||||||
|
return jsonResponse != null ? jsonResponse.get("access_token").getAsString() : null;
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.interceptor;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.util.TerminalUtil;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
import okhttp3.HttpUrl;
|
||||||
|
import okhttp3.Interceptor;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import sunmi.sunmiui.utils.LogUtil;
|
||||||
|
|
||||||
|
public class SiriusInterceptor implements Interceptor {
|
||||||
|
|
||||||
|
private static final String TAG = SiriusInterceptor.class.getSimpleName();
|
||||||
|
|
||||||
|
public static native String getHiddenFromNative();
|
||||||
|
|
||||||
|
static {
|
||||||
|
System.loadLibrary("native-lib");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Response intercept(@NonNull Chain chain) throws IOException {
|
||||||
|
|
||||||
|
Request request = chain.request();
|
||||||
|
Request newRequest;
|
||||||
|
|
||||||
|
String hashed = "";
|
||||||
|
String nonce = TerminalUtil.getInstance().generateRandomNumbers();
|
||||||
|
try {
|
||||||
|
hashed = TerminalUtil.getInstance().generateHashedString(nonce);
|
||||||
|
|
||||||
|
// LogUtil.d(TAG,"hashed :"+ hashed);
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
newRequest = request.newBuilder()
|
||||||
|
// .addHeader("content-type", "application/json")
|
||||||
|
.addHeader("request-id", hashed)
|
||||||
|
.addHeader("request-code",nonce)
|
||||||
|
.build();
|
||||||
|
return chain.proceed(newRequest);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.interceptor;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsSettings;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import okhttp3.HttpUrl;
|
||||||
|
import okhttp3.Interceptor;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class WaveAuthInterceptor implements Interceptor {
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Response intercept(@NonNull Chain chain) throws IOException {
|
||||||
|
Request originalRequest = chain.request();
|
||||||
|
|
||||||
|
Request.Builder builder = originalRequest.newBuilder();
|
||||||
|
|
||||||
|
HttpUrl url = originalRequest.url();
|
||||||
|
|
||||||
|
builder.removeHeader("Content-Type");
|
||||||
|
|
||||||
|
String accessToken = SystemParamsOperation.getInstance().getUserToken();
|
||||||
|
|
||||||
|
String authToken = SystemParamsOperation.getInstance().getAuthToken();
|
||||||
|
|
||||||
|
if (url.toString().contains("auth")) {
|
||||||
|
builder.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
} else if(url.toString().contains("token")) {
|
||||||
|
builder.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
builder.addHeader("Authorization",authToken);
|
||||||
|
} else {
|
||||||
|
builder.addHeader("Content-Type", "application/json");
|
||||||
|
// builder.addHeader("access-token",accessToken);
|
||||||
|
builder.addHeader("Authorization","Bearer "+accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
return chain.proceed(builder.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
public abstract class BaseWaveResponse {
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
public BaseWaveResponse(int code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
public class MMQRReturnRequest {
|
||||||
|
|
||||||
|
private String refLabel;
|
||||||
|
private String amount;
|
||||||
|
private int daysAllowed;
|
||||||
|
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
private String terminalId;
|
||||||
|
|
||||||
|
public MMQRReturnRequest(String refLabel, String amount, int daysAllowed, String merchantId, String terminalId) {
|
||||||
|
this.refLabel = refLabel;
|
||||||
|
this.amount = amount;
|
||||||
|
this.daysAllowed = daysAllowed;
|
||||||
|
this.merchantId = merchantId;
|
||||||
|
this.terminalId = terminalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefLabel(String refLabel) {
|
||||||
|
this.refLabel = refLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(String amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDaysAllowed(int daysAllowed) {
|
||||||
|
this.daysAllowed = daysAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMerchantId(String merchantId) {
|
||||||
|
this.merchantId = merchantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminalId(String terminalId) {
|
||||||
|
this.terminalId = terminalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRefLabel() {
|
||||||
|
return refLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDaysAllowed() {
|
||||||
|
return daysAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMerchantId() {
|
||||||
|
return merchantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTerminalId() {
|
||||||
|
return terminalId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
public class MMQRReturnResponse {
|
||||||
|
|
||||||
|
private String refLabel;
|
||||||
|
private String status;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public MMQRReturnResponse(String refLabel, String status, String description) {
|
||||||
|
this.refLabel = refLabel;
|
||||||
|
this.status = status;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MMQRReturnResponse(String refLabel, String status) {
|
||||||
|
this.refLabel = refLabel;
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefLabel(String refLabel) {
|
||||||
|
this.refLabel = refLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRefLabel() {
|
||||||
|
return refLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class MMQRStatusResponse {
|
||||||
|
private String transactionID;
|
||||||
|
private String referenceId;
|
||||||
|
|
||||||
|
private String transactionStatus;
|
||||||
|
|
||||||
|
private String transactionDateTime;
|
||||||
|
|
||||||
|
private String scannerChannel;
|
||||||
|
|
||||||
|
public MMQRStatusResponse(String transactionID, String referenceId, String transactionStatus, String transactionDateTime, String scannerChannel) {
|
||||||
|
this.transactionID = transactionID;
|
||||||
|
this.referenceId = referenceId;
|
||||||
|
this.transactionStatus = transactionStatus;
|
||||||
|
this.transactionDateTime = transactionDateTime;
|
||||||
|
this.scannerChannel = scannerChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransactionID() {
|
||||||
|
return transactionID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReferenceId() {
|
||||||
|
return referenceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkResponse() {
|
||||||
|
try {
|
||||||
|
return getTransactionStatus().equals("payment credit success");
|
||||||
|
}catch (NullPointerException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransactionStatus() {
|
||||||
|
return transactionStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransactionDateTime() {
|
||||||
|
return transactionDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionID(String transactionID) {
|
||||||
|
this.transactionID = transactionID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReferenceId(String referenceId) {
|
||||||
|
this.referenceId = referenceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionStatus(String transactionStatus) {
|
||||||
|
this.transactionStatus = transactionStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionDateTime(String transactionDateTime) {
|
||||||
|
this.transactionDateTime = transactionDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScannerChannel() { return scannerChannel; }
|
||||||
|
|
||||||
|
public void setScannerChannel(String scannerChannel) {
|
||||||
|
this.scannerChannel = scannerChannel;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
public class ResponseMap {
|
||||||
|
private String qrString;
|
||||||
|
|
||||||
|
ResponseMap(String qrString) {
|
||||||
|
this.qrString = qrString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQrString() {
|
||||||
|
return qrString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQrString(String qrString) {
|
||||||
|
this.qrString = qrString;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
public class SiriusBody {
|
||||||
|
|
||||||
|
private String android;
|
||||||
|
private String application;
|
||||||
|
private String firmware;
|
||||||
|
private String model;
|
||||||
|
private String info;
|
||||||
|
private Long timeStamp;
|
||||||
|
|
||||||
|
public SiriusBody(String android, String application, String firmware, String model, String info, Long timeStamp) {
|
||||||
|
this.android = android;
|
||||||
|
this.application = application;
|
||||||
|
this.firmware = firmware;
|
||||||
|
this.model = model;
|
||||||
|
this.info = info;
|
||||||
|
this.timeStamp = timeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAndroid() {
|
||||||
|
return android;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApplication() {
|
||||||
|
return application;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirmware() {
|
||||||
|
return firmware;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getModel() {
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInfo() {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTimeStamp() {
|
||||||
|
return timeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAndroid(String android) {
|
||||||
|
this.android = android;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplication(String application) {
|
||||||
|
this.application = application;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirmware(String firmware) {
|
||||||
|
this.firmware = firmware;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModel(String model) {
|
||||||
|
this.model = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInfo(String info) {
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeStamp(Long timeStamp) {
|
||||||
|
this.timeStamp = timeStamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
public class SiriusModel {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private String data;
|
||||||
|
private String data_type;
|
||||||
|
|
||||||
|
public SiriusModel(int id,String name,String description, String data, String data_type) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
this.data = data;
|
||||||
|
this.data_type = data_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getData_type() {
|
||||||
|
return data_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData_type(String data_type) {
|
||||||
|
this.data_type = data_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(String data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
public class SiriusTrans {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String tid;
|
||||||
|
private String mid;
|
||||||
|
private String desc;
|
||||||
|
private Long tranTime;
|
||||||
|
|
||||||
|
public SiriusTrans(String name, String tid, String mid, String desc, Long tranTime) {
|
||||||
|
this.name = name;
|
||||||
|
this.tid = tid;
|
||||||
|
this.mid = mid;
|
||||||
|
this.desc = desc;
|
||||||
|
this.tranTime = tranTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTid(String tid) {
|
||||||
|
this.tid = tid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMid(String mid) {
|
||||||
|
this.mid = mid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTranTime(Long tranTime) {
|
||||||
|
this.tranTime = tranTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTid() {
|
||||||
|
return tid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMid() {
|
||||||
|
return mid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTranTime() {
|
||||||
|
return tranTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
public class WaveAccessTokenResponse {
|
||||||
|
|
||||||
|
private String access_token;
|
||||||
|
private String scope;
|
||||||
|
private String token_type;
|
||||||
|
|
||||||
|
private int expires_in;
|
||||||
|
|
||||||
|
public WaveAccessTokenResponse(String access_token, String scope, String token_type, int expires_in) {
|
||||||
|
this.access_token = access_token;
|
||||||
|
this.scope = scope;
|
||||||
|
this.token_type = token_type;
|
||||||
|
this.expires_in = expires_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccess_token(String access_token) {
|
||||||
|
this.access_token = access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScope(String scope) {
|
||||||
|
this.scope = scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken_type(String token_type) {
|
||||||
|
this.token_type = token_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpires_in(int expires_in) {
|
||||||
|
this.expires_in = expires_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccess_token() {
|
||||||
|
return access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScope() {
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToken_type() {
|
||||||
|
return token_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getExpires_in() {
|
||||||
|
return expires_in;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
public class WaveQRRequest {
|
||||||
|
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
private String terminalId;
|
||||||
|
private String amount;
|
||||||
|
|
||||||
|
private String billNumber;
|
||||||
|
|
||||||
|
private String additionalData;
|
||||||
|
|
||||||
|
public WaveQRRequest(String merchantId, String terminalId, String amount, String billNumber, String additionalData) {
|
||||||
|
this.merchantId = merchantId;
|
||||||
|
this.terminalId = terminalId;
|
||||||
|
this.amount = amount;
|
||||||
|
this.billNumber = billNumber;
|
||||||
|
this.additionalData = additionalData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMerchantId(String merchantId) {
|
||||||
|
this.merchantId = merchantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminalId(String terminalId) {
|
||||||
|
this.terminalId = terminalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(String amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBillNumber(String billNumber) {
|
||||||
|
this.billNumber = billNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdditionalData(String additionalData) {
|
||||||
|
this.additionalData = additionalData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMerchantId() {
|
||||||
|
return merchantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTerminalId() {
|
||||||
|
return terminalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBillNumber() {
|
||||||
|
return billNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAdditionalData() {
|
||||||
|
return additionalData;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class WaveQRResponse {
|
||||||
|
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String refLabel;
|
||||||
|
|
||||||
|
private String qrString;
|
||||||
|
|
||||||
|
@SerializedName("mmqr")
|
||||||
|
private boolean mmQR;
|
||||||
|
|
||||||
|
public WaveQRResponse(String code, String message, String refLabel, String qrString) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
this.refLabel = refLabel;
|
||||||
|
this.qrString = qrString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WaveQRResponse(String code, String message, String refLabel, String qrString,boolean mmQR) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
this.refLabel = refLabel;
|
||||||
|
this.qrString = qrString;
|
||||||
|
this.mmQR = mmQR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMmQR(boolean mmQR) { this.mmQR = mmQR; }
|
||||||
|
|
||||||
|
public boolean getMmQr() { return mmQR; }
|
||||||
|
|
||||||
|
public void setRefLabel(String refLabel) {
|
||||||
|
this.refLabel = refLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQrString(String qrString) {
|
||||||
|
this.qrString = qrString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRefLabel() {
|
||||||
|
return refLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQrString() {
|
||||||
|
return qrString;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
public class WaveStatusRequest {
|
||||||
|
private String refLabel;
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
public WaveStatusRequest(String refLabel, String merchantId) {
|
||||||
|
this.refLabel = refLabel;
|
||||||
|
this.merchantId = merchantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefLabel(String refLabel) {
|
||||||
|
this.refLabel = refLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMerchantId(String merchantId) {
|
||||||
|
this.merchantId = merchantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRefLabel() {
|
||||||
|
return refLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMerchantId() {
|
||||||
|
return merchantId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
public class WaveStatusResponse extends BaseWaveResponse{
|
||||||
|
|
||||||
|
private String txnStatus;
|
||||||
|
|
||||||
|
private String txnStatusDateTime;
|
||||||
|
public WaveStatusResponse(int code, String message) {
|
||||||
|
super(code, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WaveStatusResponse(int code, String message, String txnStatus, String txnStatusDateTime) {
|
||||||
|
super(code, message);
|
||||||
|
this.txnStatus = txnStatus;
|
||||||
|
this.txnStatusDateTime = txnStatusDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTxnStatus() {
|
||||||
|
return txnStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTxnStatusDateTime() {
|
||||||
|
return txnStatusDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxnStatus(String txnStatus) {
|
||||||
|
this.txnStatus = txnStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxnStatusDateTime(String txnStatusDateTime) {
|
||||||
|
this.txnStatusDateTime = txnStatusDateTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model;
|
||||||
|
|
||||||
|
public class WaveTokenResponse {
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
private String accessToken;
|
||||||
|
|
||||||
|
public WaveTokenResponse(int code, String message, String accessToken) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
this.accessToken = accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccessToken(String accessToken) {
|
||||||
|
this.accessToken = accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessToken() {
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model.sirius;
|
||||||
|
|
||||||
|
public class SiriusError {
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
public SiriusError(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model.sirius;
|
||||||
|
|
||||||
|
public class SiriusHost {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String primaryIP;
|
||||||
|
|
||||||
|
private String secondaryIP;
|
||||||
|
|
||||||
|
private String currency;
|
||||||
|
|
||||||
|
private String mid;
|
||||||
|
|
||||||
|
private String tid;
|
||||||
|
|
||||||
|
public SiriusHost(String name, String description, String primaryIP, String secondaryIP, String currency, String mid, String tid) {
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
this.primaryIP = primaryIP;
|
||||||
|
this.secondaryIP = secondaryIP;
|
||||||
|
this.currency = currency;
|
||||||
|
this.mid = mid;
|
||||||
|
this.tid = tid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrimaryIP(String primaryIP) {
|
||||||
|
this.primaryIP = primaryIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecondaryIP(String secondaryIP) {
|
||||||
|
this.secondaryIP = secondaryIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrency(String currency) {
|
||||||
|
this.currency = currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMid(String mid) {
|
||||||
|
this.mid = mid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTid(String tid) {
|
||||||
|
this.tid = tid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrimaryIP() {
|
||||||
|
return primaryIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSecondaryIP() {
|
||||||
|
return secondaryIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrency() {
|
||||||
|
return currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMid() {
|
||||||
|
return mid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTid() {
|
||||||
|
return tid;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model.sirius;
|
||||||
|
|
||||||
|
public class SiriusMerchant {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
private String address2;
|
||||||
|
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
public SiriusMerchant(int id, String name, String description, String address,String address2,String phone,String mobile) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
this.address = address;
|
||||||
|
this.address2 = address2;
|
||||||
|
this.phone = phone;
|
||||||
|
this.mobile = mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress2(String address2) {
|
||||||
|
this.address2 = address2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMobile(String mobile) {
|
||||||
|
this.mobile = mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress2() {
|
||||||
|
return address2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMobile() {
|
||||||
|
return mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,94 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model.sirius;
|
||||||
|
|
||||||
|
public class SiriusProperty {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private int terId;
|
||||||
|
|
||||||
|
private int appId;
|
||||||
|
|
||||||
|
private int configId;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String property;
|
||||||
|
|
||||||
|
public SiriusProperty(int id, int terId, int appId, int configId, String name, String description, String type, String property) {
|
||||||
|
this.id = id;
|
||||||
|
this.terId = terId;
|
||||||
|
this.appId = appId;
|
||||||
|
this.configId = configId;
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
this.type = type;
|
||||||
|
this.property = property;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerId(int terId) {
|
||||||
|
this.terId = terId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppId(int appId) {
|
||||||
|
this.appId = appId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfigId(int configId) {
|
||||||
|
this.configId = configId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProperty(String property) {
|
||||||
|
this.property = property;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTerId() {
|
||||||
|
return terId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAppId() {
|
||||||
|
return appId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getConfigId() {
|
||||||
|
return configId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProperty() {
|
||||||
|
return property;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model.sirius;
|
||||||
|
|
||||||
|
public class SiriusRequest {
|
||||||
|
private String serial;
|
||||||
|
|
||||||
|
private String appPackage;
|
||||||
|
|
||||||
|
private String androidVersion;
|
||||||
|
|
||||||
|
private String firmwareVersion;
|
||||||
|
|
||||||
|
private String applicationVersion;
|
||||||
|
|
||||||
|
private String currentNetwork;
|
||||||
|
|
||||||
|
private String lastTransaction;
|
||||||
|
|
||||||
|
private String lastTranTime;
|
||||||
|
|
||||||
|
public SiriusRequest() {}
|
||||||
|
public SiriusRequest(String serial, String appPackage, String androidVersion, String firmwareVersion, String applicationVersion, String currentNetwork, String lastTransaction, String lastTranTime) {
|
||||||
|
this.serial = serial;
|
||||||
|
this.appPackage = appPackage;
|
||||||
|
this.androidVersion = androidVersion;
|
||||||
|
this.firmwareVersion = firmwareVersion;
|
||||||
|
this.applicationVersion = applicationVersion;
|
||||||
|
this.currentNetwork = currentNetwork;
|
||||||
|
this.lastTransaction = lastTransaction;
|
||||||
|
this.lastTranTime = lastTranTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerial(String serial) {
|
||||||
|
this.serial = serial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppPackage(String appPackage) {
|
||||||
|
this.appPackage = appPackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAndroidVersion(String androidVersion) {
|
||||||
|
this.androidVersion = androidVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirmwareVersion(String firmwareVersion) {
|
||||||
|
this.firmwareVersion = firmwareVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplicationVersion(String applicationVersion) {
|
||||||
|
this.applicationVersion = applicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentNetwork(String currentNetwork) {
|
||||||
|
this.currentNetwork = currentNetwork;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastTransaction(String lastTransaction) {
|
||||||
|
this.lastTransaction = lastTransaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastTranTime(String lastTranTime) {
|
||||||
|
this.lastTranTime = lastTranTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSerial() {
|
||||||
|
return serial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppPackage() {
|
||||||
|
return appPackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAndroidVersion() {
|
||||||
|
return androidVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirmwareVersion() {
|
||||||
|
return firmwareVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApplicationVersion() {
|
||||||
|
return applicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrentNetwork() {
|
||||||
|
return currentNetwork;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastTransaction() {
|
||||||
|
return lastTransaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastTranTime() {
|
||||||
|
return lastTranTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
package com.utsmyanmar.baselib.network.model.sirius;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SiriusResponse {
|
||||||
|
|
||||||
|
private String serial;
|
||||||
|
|
||||||
|
private String ecrKey;
|
||||||
|
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
private String address2;
|
||||||
|
|
||||||
|
private SiriusMerchant merchant;
|
||||||
|
|
||||||
|
private List<SiriusHost> hosts;
|
||||||
|
|
||||||
|
private List<SiriusProperty> properties;
|
||||||
|
|
||||||
|
public SiriusResponse(String serial, String ecrKey,String address,String address2, SiriusMerchant merchant, List<SiriusHost> hosts, List<SiriusProperty> properties) {
|
||||||
|
this.serial = serial;
|
||||||
|
this.ecrKey = ecrKey;
|
||||||
|
this.address = address;
|
||||||
|
this.address2 = address2;
|
||||||
|
this.merchant = merchant;
|
||||||
|
this.hosts = hosts;
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress2(String address2) {
|
||||||
|
this.address2 = address2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress2() {
|
||||||
|
return address2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerial(String serial) {
|
||||||
|
this.serial = serial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEcrKey(String ecrKey) {
|
||||||
|
this.ecrKey = ecrKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMerchant(SiriusMerchant merchant) {
|
||||||
|
this.merchant = merchant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHosts(List<SiriusHost> hosts) {
|
||||||
|
this.hosts = hosts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProperties(List<SiriusProperty> properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSerial() {
|
||||||
|
return serial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEcrKey() {
|
||||||
|
return ecrKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SiriusMerchant getMerchant() {
|
||||||
|
return merchant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SiriusHost> getHosts() {
|
||||||
|
return hosts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SiriusProperty> getProperties() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,209 @@
|
|||||||
|
package com.utsmyanmar.baselib.repo;
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.dao.PayDetailDao;
|
||||||
|
import com.utsmyanmar.baselib.db.model.PayWaveEntity;
|
||||||
|
import com.utsmyanmar.baselib.network.SiriusApiService;
|
||||||
|
import com.utsmyanmar.baselib.network.WaveApiService;
|
||||||
|
import com.utsmyanmar.baselib.network.WaveTokenApiService;
|
||||||
|
import com.utsmyanmar.baselib.network.model.MMQRReturnRequest;
|
||||||
|
import com.utsmyanmar.baselib.network.model.MMQRReturnResponse;
|
||||||
|
import com.utsmyanmar.baselib.network.model.MMQRStatusResponse;
|
||||||
|
import com.utsmyanmar.baselib.network.model.WaveAccessTokenResponse;
|
||||||
|
import com.utsmyanmar.baselib.network.model.WaveQRRequest;
|
||||||
|
import com.utsmyanmar.baselib.network.model.WaveQRResponse;
|
||||||
|
import com.utsmyanmar.baselib.network.model.WaveStatusRequest;
|
||||||
|
import com.utsmyanmar.baselib.network.model.WaveTokenResponse;
|
||||||
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusRequest;
|
||||||
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusResponse;
|
||||||
|
import com.utsmyanmar.baselib.repo.local.PayWaveRepository;
|
||||||
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
|
||||||
|
public class Repository {
|
||||||
|
|
||||||
|
private PayDetailDao payDetailDao;
|
||||||
|
private SiriusApiService siriusApiService;
|
||||||
|
private WaveApiService waveApiService;
|
||||||
|
private WaveTokenApiService waveTokenApiService;
|
||||||
|
private PayWaveRepository payWaveRepository;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public Repository(PayDetailDao payDetailDao, SiriusApiService siriusApiService, WaveApiService waveApiService, WaveTokenApiService tokenApiService, PayWaveRepository payWaveRepository){
|
||||||
|
this.payDetailDao = payDetailDao;
|
||||||
|
this.siriusApiService = siriusApiService;
|
||||||
|
this.waveApiService = waveApiService;
|
||||||
|
this.waveTokenApiService = tokenApiService;
|
||||||
|
this.payWaveRepository = payWaveRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void insertPayWave(PayWaveEntity payWaveEntity) {
|
||||||
|
payWaveRepository.insert(payWaveEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Observable<SiriusResponse> getParams(SiriusRequest siriusRequest) {
|
||||||
|
return siriusApiService.getParams(siriusRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Observable<WaveTokenResponse> authRequest(String clientId, String username, String password) {
|
||||||
|
return waveApiService.authRequest(clientId,"password",username,password);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Observable<WaveQRResponse> qrRequest(WaveQRRequest waveQRRequest) {
|
||||||
|
return waveApiService.qrRequest(waveQRRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Observable<WaveAccessTokenResponse> tokenRequest(String grantType) {
|
||||||
|
return waveTokenApiService.tokenRequest(grantType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Observable<MMQRStatusResponse> checkStatus(WaveStatusRequest waveStatusRequest) {
|
||||||
|
return waveApiService.checkStatus(waveStatusRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Observable<MMQRReturnResponse> returnTrans(MMQRReturnRequest returnRequest) {
|
||||||
|
return waveApiService.returnTrans(returnRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void insertPayDetail(PayDetail payDetail){ payDetailDao.insert(payDetail);}
|
||||||
|
|
||||||
|
public Completable insertPay(PayDetail payDetail) { return payDetailDao.insertPay(payDetail); }
|
||||||
|
|
||||||
|
public LiveData<PayDetail> getAll(){
|
||||||
|
return payDetailDao.getAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getSettlement() { return payDetailDao.getSettlement(); }
|
||||||
|
|
||||||
|
public void updatePayDetail(PayDetail payDetail){payDetailDao.update(payDetail);}
|
||||||
|
|
||||||
|
public LiveData<PayDetail> getReversalTransaction(String voucherNo) { return payDetailDao.getReversalTransaction(voucherNo);}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getTransactionHistory(){ return payDetailDao.getTransactionHistory();}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getLastSettlement(String voucherNo) { return payDetailDao.getLastSettlement(voucherNo);}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getLastTransaction(String voucherNo) { return payDetailDao.getLastTransaction(voucherNo);}
|
||||||
|
|
||||||
|
public LiveData<PayDetail> getLastTransaction() {return payDetailDao.getLastTransaction();}
|
||||||
|
public LiveData<List<PayDetail>> getReviewBatchTransaction(String batchNo) { return payDetailDao.getReviewBatchTransactions(batchNo);}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getSmileSummaryTrans(String batchNo) {
|
||||||
|
return payDetailDao.getSmileSummaryTransactions(batchNo);
|
||||||
|
}
|
||||||
|
public LiveData<PayDetail> checkLastSettlement(String voucherNo){ return payDetailDao.checkLastSettlement(voucherNo);}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getLastThreeTransactions(){ return payDetailDao.getLastThreeTransactions();}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getVoidableTransactions(int transType){
|
||||||
|
return payDetailDao.getVoidableTransactions(transType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<PayDetail> getGenericVoidTransaction(int transType,String voucherNo,boolean isEmv) {
|
||||||
|
if(isEmv) {
|
||||||
|
return payDetailDao.getGenericVoidTransEMV(transType,voucherNo);
|
||||||
|
} else {
|
||||||
|
return payDetailDao.getGenericVoidTransMPU(transType,voucherNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<PayDetail> getVoidTransaction(int transType,String voucherNo) {
|
||||||
|
return payDetailDao.getVoidTrans(transType,voucherNo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public LiveData<PayDetail> searchTransaction(String voucherNo) {
|
||||||
|
return payDetailDao.searchTransaction(voucherNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<PayDetail> searchPayDetail(String referNo) {
|
||||||
|
return payDetailDao.searchPayDetail(referNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<PayDetail> searchPayDetail(String cardNo,String referNo) {
|
||||||
|
return payDetailDao.searchPayDetail(cardNo,referNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<PayDetail> searchPayDetail(String cardNo,String referNo,long amount) {
|
||||||
|
return payDetailDao.searchPayDetail(cardNo,referNo,amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Flowable<PayDetail> searchPayDetailByRefNum(String refNum) {
|
||||||
|
return payDetailDao.searchPayDetailByRefNum(refNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Maybe<PayDetail> searchPayByRefNum(String refNum) {
|
||||||
|
return payDetailDao.searchPayByRefNum(refNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Maybe<PayDetail> getLastTransactionRx() {
|
||||||
|
return payDetailDao.getLastTransactionRx();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Completable updateUnFinishedQRTrans(String appName,String transId,String refNum) {
|
||||||
|
return payDetailDao.updateUnfinishedQRTrans(appName,transId,refNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<PayDetail> getVoidablePreAuth(String voucherNo){
|
||||||
|
return payDetailDao.getVoidablePreAuth(voucherNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getRefundableByCardNo(String cardNo) {
|
||||||
|
return payDetailDao.getRefundableByCardNo(cardNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getAdditionalSettlementPOS(String batchNo) {
|
||||||
|
return payDetailDao.getAdditionalSettlementPOS(batchNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getPreAuthCompData() {
|
||||||
|
return payDetailDao.getPreAuthCompData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getSettlementPOS() {
|
||||||
|
return payDetailDao.getSettlementPOS();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getSettlementPOSClearBatch() {
|
||||||
|
return payDetailDao.getSettlementPOSClearBatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getDeleteTrans(String batchNo) {
|
||||||
|
return payDetailDao.getDeleteTrans(batchNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getPreAuthTrans() {
|
||||||
|
return payDetailDao.getPreAuthTrans();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAll() {
|
||||||
|
payDetailDao.deleteAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deletePayDetail(PayDetail payDetail) {
|
||||||
|
payDetailDao.deletePayDetail(payDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getAllTrans() { return payDetailDao.getAllTrans(); }
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.utsmyanmar.baselib.repo;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.network.SiriusApiService;
|
||||||
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusRequest;
|
||||||
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusResponse;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
|
||||||
|
public class TMSRepository {
|
||||||
|
|
||||||
|
|
||||||
|
private SiriusApiService siriusApiService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public TMSRepository(SiriusApiService siriusApiService) {
|
||||||
|
this.siriusApiService = siriusApiService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Observable<SiriusResponse> getParams(SiriusRequest siriusRequest) {
|
||||||
|
return siriusApiService.getParams(siriusRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
package com.utsmyanmar.baselib.repo.local;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.dao.BinDao;
|
||||||
|
import com.utsmyanmar.baselib.db.model.BinEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
public class BinRepository implements ParamRepository<BinEntity> {
|
||||||
|
|
||||||
|
private final BinDao binDao;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public BinRepository(BinDao binDao) { this.binDao = binDao; }
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<List<BinEntity>> getAll() {
|
||||||
|
return binDao.getAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<BinEntity> get() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(BinEntity data) {
|
||||||
|
binDao.insertBin(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(BinEntity data) {
|
||||||
|
binDao.updateBin(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(BinEntity data) {
|
||||||
|
binDao.deleteBin(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateCVMLimit(long cvmLimit) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateCurrencyCode(String currencyCode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTerminalCapability(String capability) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable deleteAll() {
|
||||||
|
return binDao.deleteAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTTQ(String ttq) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
package com.utsmyanmar.baselib.repo.local;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.dao.ChipAidDao;
|
||||||
|
import com.utsmyanmar.baselib.db.model.ChipAidEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
public class ChipAidRepository implements ParamRepository<ChipAidEntity> {
|
||||||
|
|
||||||
|
private ChipAidDao chipAidDao;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public ChipAidRepository(ChipAidDao chipAidDao) {
|
||||||
|
this.chipAidDao = chipAidDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<List<ChipAidEntity>> getAll() {
|
||||||
|
return chipAidDao.getAllChipAids();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<ChipAidEntity> get() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(ChipAidEntity data) {
|
||||||
|
chipAidDao.insertChipAid(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(ChipAidEntity data) {
|
||||||
|
chipAidDao.updateChipAid(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(ChipAidEntity data) {
|
||||||
|
chipAidDao.deleteChipAid(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateCVMLimit(long cvmLimit) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateCurrencyCode(String currencyCode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTerminalCapability(String capability) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable deleteAll() {
|
||||||
|
return chipAidDao.deleteAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTTQ(String ttq) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Completable updateChipCVM(String scheme, long cvmLimit) { return chipAidDao.updateCVMByScheme(scheme,cvmLimit);}
|
||||||
|
|
||||||
|
public Completable updateAidByAid(boolean aidEnable,String aid) {
|
||||||
|
return chipAidDao.updateAidEnabledByAid(aidEnable,aid);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package com.utsmyanmar.baselib.repo.local;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.dao.MPUCtlsDao;
|
||||||
|
import com.utsmyanmar.baselib.db.model.MPUCtlsEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
public class MPUCtlsRepository implements ParamRepository<MPUCtlsEntity> {
|
||||||
|
|
||||||
|
private MPUCtlsDao mpuCtlsDao;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public MPUCtlsRepository(MPUCtlsDao mpuCtlsDao) {
|
||||||
|
this.mpuCtlsDao = mpuCtlsDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<List<MPUCtlsEntity>> getAll() {
|
||||||
|
return mpuCtlsDao.getAllMPU();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<MPUCtlsEntity> get() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(MPUCtlsEntity data) {
|
||||||
|
mpuCtlsDao.insertMPU(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(MPUCtlsEntity data) {
|
||||||
|
mpuCtlsDao.updateMPU(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(MPUCtlsEntity data) {
|
||||||
|
mpuCtlsDao.deleteMPU(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Completable updateCVMLimit(long cvmLimit) { return mpuCtlsDao.updateCVM(cvmLimit);}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateCurrencyCode(String currencyCode) {
|
||||||
|
return mpuCtlsDao.updateCurrencyCode(currencyCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTerminalCapability(String capability) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable deleteAll() {
|
||||||
|
return mpuCtlsDao.deleteAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTTQ(String ttq) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.utsmyanmar.baselib.repo.local;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
public interface ParamRepository <T>{
|
||||||
|
|
||||||
|
Maybe<List<T>> getAll();
|
||||||
|
|
||||||
|
Maybe<T> get();
|
||||||
|
|
||||||
|
void insert(T data);
|
||||||
|
|
||||||
|
void update(T data);
|
||||||
|
void delete(T data);
|
||||||
|
|
||||||
|
Completable updateCVMLimit(long cvmLimit);
|
||||||
|
|
||||||
|
Completable updateCurrencyCode(String currencyCode);
|
||||||
|
|
||||||
|
Completable updateTerminalCapability(String capability);
|
||||||
|
|
||||||
|
Completable deleteAll();
|
||||||
|
|
||||||
|
Completable updateTTQ(String ttq);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
package com.utsmyanmar.baselib.repo.local;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.dao.PayPassDao;
|
||||||
|
import com.utsmyanmar.baselib.db.model.PayPassEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
public class PayPassRepository implements ParamRepository<PayPassEntity> {
|
||||||
|
|
||||||
|
private final PayPassDao payPassDao;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public PayPassRepository(PayPassDao payPassDao) {
|
||||||
|
this.payPassDao = payPassDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<List<PayPassEntity>> getAll() {
|
||||||
|
return payPassDao.getAllPayPass();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<PayPassEntity> get() {
|
||||||
|
return payPassDao.getPayPass();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(PayPassEntity data) {
|
||||||
|
payPassDao.insertPayPass(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(PayPassEntity data) {
|
||||||
|
payPassDao.updatePayPass(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(PayPassEntity data) {
|
||||||
|
payPassDao.deletePayPass(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Completable updateCVMLimit(long cvmLimit) { return payPassDao.updateCVM(cvmLimit);}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateCurrencyCode(String currencyCode) {
|
||||||
|
return payPassDao.updateCurrencyCode(currencyCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTerminalCapability(String capability) {
|
||||||
|
return payPassDao.updateTerminalCapability(capability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable deleteAll() {
|
||||||
|
return payPassDao.deleteAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTTQ(String ttq) {
|
||||||
|
return payPassDao.updateTTQ(ttq);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
package com.utsmyanmar.baselib.repo.local;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.dao.PayWaveDao;
|
||||||
|
import com.utsmyanmar.baselib.db.model.ContactlessAid;
|
||||||
|
import com.utsmyanmar.baselib.db.model.PayWaveEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
public class PayWaveRepository implements ParamRepository<PayWaveEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
private final PayWaveDao payWaveDao;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public PayWaveRepository(PayWaveDao payWaveDao) {
|
||||||
|
this.payWaveDao = payWaveDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<List<PayWaveEntity>> getAll() {
|
||||||
|
return payWaveDao.getAllPayWave();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<PayWaveEntity> get() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(PayWaveEntity data) {
|
||||||
|
payWaveDao.insertPayWave(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(PayWaveEntity data) {
|
||||||
|
payWaveDao.updatePayWave(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(PayWaveEntity data) {
|
||||||
|
payWaveDao.deletePayWave(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Completable updateCVMLimit(long cvmLimit) { return payWaveDao.updateCVM(cvmLimit);}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateCurrencyCode(String currencyCode) {
|
||||||
|
return payWaveDao.updateCurrencyCode(currencyCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTerminalCapability(String capability) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable deleteAll() {
|
||||||
|
return payWaveDao.deleteAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTTQ(String ttq) {
|
||||||
|
return payWaveDao.updateTTQ(ttq);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
package com.utsmyanmar.baselib.repo.local;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.dao.QuickPassDao;
|
||||||
|
import com.utsmyanmar.baselib.db.model.QuickPassEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
public class QuickPassRepository implements ParamRepository<QuickPassEntity> {
|
||||||
|
|
||||||
|
private QuickPassDao quickPassDao;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public QuickPassRepository(QuickPassDao quickPassDao) {
|
||||||
|
this.quickPassDao = quickPassDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<List<QuickPassEntity>> getAll() {
|
||||||
|
return quickPassDao.getAllQuickPass();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<QuickPassEntity> get() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(QuickPassEntity data) {
|
||||||
|
quickPassDao.insertQuickPass(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(QuickPassEntity data) {
|
||||||
|
quickPassDao.updateQuickPass(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(QuickPassEntity data) {
|
||||||
|
quickPassDao.deleteQuickPass(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Completable updateCVMLimit(long cvmLimit) { return quickPassDao.updateCVM(cvmLimit);}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateCurrencyCode(String currencyCode) {
|
||||||
|
return quickPassDao.updateCurrencyCode(currencyCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTerminalCapability(String capability) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Completable updateTTQ(String ttq) {
|
||||||
|
return quickPassDao.updateTTQ(ttq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable deleteAll() {
|
||||||
|
return quickPassDao.deleteAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
package com.utsmyanmar.baselib.repo.local;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.db.dao.RidDao;
|
||||||
|
import com.utsmyanmar.baselib.db.model.RidEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
import io.reactivex.rxjava3.core.Maybe;
|
||||||
|
|
||||||
|
public class RidRepository implements ParamRepository<RidEntity> {
|
||||||
|
|
||||||
|
private RidDao ridDao;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public RidRepository(RidDao ridDao) {
|
||||||
|
this.ridDao = ridDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<List<RidEntity>> getAll() {
|
||||||
|
return ridDao.getAllRids();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Maybe<RidEntity> get() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(RidEntity data) {
|
||||||
|
ridDao.insertRid(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(RidEntity data) {
|
||||||
|
ridDao.updateRid(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(RidEntity data) {
|
||||||
|
ridDao.deleteRid(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateCVMLimit(long cvmLimit) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateCurrencyCode(String currencyCode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTerminalCapability(String capability) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable deleteAll() {
|
||||||
|
return ridDao.deleteAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Completable updateTTQ(String ttq) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,188 @@
|
|||||||
|
package com.utsmyanmar.baselib.ui;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.R;
|
||||||
|
import com.utsmyanmar.baselib.util.Config;
|
||||||
|
|
||||||
|
public class AmountInputView extends androidx.appcompat.widget.AppCompatTextView {
|
||||||
|
|
||||||
|
|
||||||
|
private StringBuilder inputSB;
|
||||||
|
|
||||||
|
private String def = "0.00";
|
||||||
|
|
||||||
|
|
||||||
|
private boolean isNewInputType = Config.getInstance().IS_SETTING_NEW_INPUT_TYPE();
|
||||||
|
|
||||||
|
|
||||||
|
private boolean isClickDot = false;
|
||||||
|
|
||||||
|
private int rightIndex = 0;
|
||||||
|
|
||||||
|
public AmountInputView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
inputSB = new StringBuilder();
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
inputSB.append(def);
|
||||||
|
String str = def + getResources().getString(R.string.mmk);
|
||||||
|
setText(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public synchronized void addText(String text) {
|
||||||
|
if (isNewInputType) {
|
||||||
|
newAddText(text);
|
||||||
|
} else {
|
||||||
|
if (inputSB.length() >= 10) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
inputSB.append(text);
|
||||||
|
}
|
||||||
|
String str = inputSB.toString();
|
||||||
|
String cutStr = filter(str);
|
||||||
|
|
||||||
|
inputSB.setLength(0);
|
||||||
|
inputSB.append(cutStr);
|
||||||
|
String value = inputSB.toString() +getResources().getString(R.string.mmk);
|
||||||
|
setText(value);
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void newAddText(String text) {
|
||||||
|
int length = inputSB.length();
|
||||||
|
if (isClickDot) {
|
||||||
|
if (rightIndex == 0) {
|
||||||
|
inputSB.replace(length - 2, length - 1, text);
|
||||||
|
}
|
||||||
|
if (rightIndex == 1) {
|
||||||
|
if (!text.equals("0")) {
|
||||||
|
inputSB.replace(length - 1, length, text);
|
||||||
|
rightIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rightIndex == 0) {
|
||||||
|
rightIndex++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (inputSB.length() >= 10) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (inputSB.toString().equals(def)) {
|
||||||
|
inputSB = inputSB.replace(0, 1, text);
|
||||||
|
} else {
|
||||||
|
inputSB.insert(length - 3, text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private String filter(String str) {
|
||||||
|
String cutStr = str;
|
||||||
|
/* Delete dot in string */
|
||||||
|
for (int i = str.length() - 1; i >= 0; i--) {
|
||||||
|
char c = str.charAt(i);
|
||||||
|
if ('.' == c) {
|
||||||
|
cutStr = str.substring(0, i) + str.substring(i + 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Delete the extra 0 in front */
|
||||||
|
int NUM = cutStr.length();
|
||||||
|
int zeroIndex = -1;
|
||||||
|
for (int i = 0; i < NUM - 2; i++) {
|
||||||
|
char c = cutStr.charAt(i);
|
||||||
|
if (c != '0') {
|
||||||
|
zeroIndex = i;
|
||||||
|
break;
|
||||||
|
} else if (i == NUM - 3) {
|
||||||
|
zeroIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (zeroIndex != -1) {
|
||||||
|
cutStr = cutStr.substring(zeroIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cutStr.length() < 3) {
|
||||||
|
cutStr = "0" + cutStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
cutStr = cutStr.substring(0, cutStr.length() - 2)
|
||||||
|
+ "." + cutStr.substring(cutStr.length() - 2);
|
||||||
|
return cutStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delLast() {
|
||||||
|
int length = inputSB.length();
|
||||||
|
if (isNewInputType) {
|
||||||
|
newDelLast(length);
|
||||||
|
} else {
|
||||||
|
if ((inputSB.toString()).equals(def))
|
||||||
|
return;
|
||||||
|
inputSB.deleteCharAt(length - 1);
|
||||||
|
}
|
||||||
|
String temp = inputSB.toString();
|
||||||
|
temp = filter(temp);
|
||||||
|
inputSB.setLength(0);
|
||||||
|
inputSB.append(temp);
|
||||||
|
String value = inputSB.toString()+getResources().getString(R.string.mmk) ;
|
||||||
|
setText(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void newDelLast(int length) {
|
||||||
|
if (isClickDot) {
|
||||||
|
if (rightIndex == 2) {
|
||||||
|
inputSB.replace(length - 1, length, "0");
|
||||||
|
}
|
||||||
|
if (rightIndex == 1) {
|
||||||
|
inputSB.replace(length - 2, length - 1, "0");
|
||||||
|
}
|
||||||
|
if (rightIndex == 0) {
|
||||||
|
inputSB.deleteCharAt(length - 4);
|
||||||
|
}
|
||||||
|
if (rightIndex == 1) {
|
||||||
|
rightIndex--;
|
||||||
|
isClickDot = false;
|
||||||
|
}
|
||||||
|
if (rightIndex == 2) {
|
||||||
|
rightIndex--;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
inputSB.deleteCharAt(length - 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void clean() {
|
||||||
|
inputSB.setLength(0);
|
||||||
|
inputSB.append(def);
|
||||||
|
String value = String.valueOf(inputSB)+getResources().getString(R.string.mmk);
|
||||||
|
setText(value);
|
||||||
|
isClickDot = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharSequence getAmountText() {
|
||||||
|
return inputSB.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClickDot(boolean clickDot) {
|
||||||
|
isClickDot = clickDot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isClickDot() {
|
||||||
|
return isClickDot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRightIndex(int rightIndex) {
|
||||||
|
this.rightIndex = rightIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
package com.utsmyanmar.baselib.ui;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.R;
|
||||||
|
|
||||||
|
public class AnimationDialog extends Dialog {
|
||||||
|
|
||||||
|
private TextView mTvMessage;
|
||||||
|
|
||||||
|
public AnimationDialog(Context context, String text) {
|
||||||
|
this(context, R.style.DefaultDialogStyle, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AnimationDialog(Context context, int theme, String text) {
|
||||||
|
super(context, theme);
|
||||||
|
init(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(String msg) {
|
||||||
|
setContentView(R.layout.dialog_animation);
|
||||||
|
Window window = getWindow();
|
||||||
|
if (window != null) {
|
||||||
|
window.getAttributes().gravity = Gravity.CENTER;
|
||||||
|
}
|
||||||
|
setCanceledOnTouchOutside(true);
|
||||||
|
setCancelable(true);
|
||||||
|
|
||||||
|
mTvMessage = findViewById(R.id.tv_message);
|
||||||
|
if (msg == null || msg.trim().length() == 0) {
|
||||||
|
mTvMessage.setText(R.string.loading);
|
||||||
|
} else {
|
||||||
|
mTvMessage.setText(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String msg) {
|
||||||
|
mTvMessage.setText(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,85 @@
|
|||||||
|
package com.utsmyanmar.baselib.ui;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.R;
|
||||||
|
|
||||||
|
public class CustomPinPadKeyboard extends LinearLayout {
|
||||||
|
|
||||||
|
public CustomPinPadKeyboard(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomPinPadKeyboard(Context context, AttributeSet attrs) {
|
||||||
|
this(context, attrs, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomPinPadKeyboard(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
initView(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TextView key_0, key_1, key_2;
|
||||||
|
private TextView key_3, key_4, key_5;
|
||||||
|
private TextView key_6, key_7, key_8;
|
||||||
|
private TextView key_9;
|
||||||
|
|
||||||
|
private void initView(Context context) {
|
||||||
|
inflate(context, R.layout.view_fix_password_keyboard, this);
|
||||||
|
key_0 = findViewById(R.id.text_0);
|
||||||
|
key_1 = findViewById(R.id.text_1);
|
||||||
|
key_2 = findViewById(R.id.text_2);
|
||||||
|
key_3 = findViewById(R.id.text_3);
|
||||||
|
key_4 = findViewById(R.id.text_4);
|
||||||
|
key_5 = findViewById(R.id.text_5);
|
||||||
|
key_6 = findViewById(R.id.text_6);
|
||||||
|
key_7 = findViewById(R.id.text_7);
|
||||||
|
key_8 = findViewById(R.id.text_8);
|
||||||
|
key_9 = findViewById(R.id.text_9);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKeyBoard(String keys) {
|
||||||
|
if (keys == null || keys.length() != 10) return;
|
||||||
|
|
||||||
|
String temp = keys.substring(0, 1);
|
||||||
|
key_0.setText(temp);
|
||||||
|
|
||||||
|
temp = keys.substring(1, 2);
|
||||||
|
key_1.setText(temp);
|
||||||
|
|
||||||
|
temp = keys.substring(2, 3);
|
||||||
|
key_2.setText(temp);
|
||||||
|
|
||||||
|
temp = keys.substring(3, 4);
|
||||||
|
key_3.setText(temp);
|
||||||
|
|
||||||
|
temp = keys.substring(4, 5);
|
||||||
|
key_4.setText(temp);
|
||||||
|
|
||||||
|
temp = keys.substring(5, 6);
|
||||||
|
key_5.setText(temp);
|
||||||
|
|
||||||
|
temp = keys.substring(6, 7);
|
||||||
|
key_6.setText(temp);
|
||||||
|
|
||||||
|
temp = keys.substring(7, 8);
|
||||||
|
key_7.setText(temp);
|
||||||
|
|
||||||
|
temp = keys.substring(8, 9);
|
||||||
|
key_8.setText(temp);
|
||||||
|
|
||||||
|
temp = keys.substring(9, 10);
|
||||||
|
key_9.setText(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextView getKey_0() {
|
||||||
|
return key_0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextView getKey_2() {
|
||||||
|
return key_2;
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user