Commit b5ebd25e authored by Ahmad Abi Mulya's avatar Ahmad Abi Mulya

fix some bug

parent ff37e1b7
ImplementationPartnerConnect
\ No newline at end of file
......@@ -51,13 +51,13 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.10'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation(group: 'com.mdd.payment', name: 'mybanklibrary-release', version: '3.5.8', ext: 'aar')
implementation(group: 'com.mdd.payment', name: 'mybanklibrary-release', version: '3.5.9', ext: 'aar')
implementation(group: 'com.mdd.payment', name: 'nativecripto-release', version: '2.0.0', ext: 'aar')
implementation(group: 'com.mdd.payment', name: 'organicdrv-release', version: '2.1.0', ext: 'aar')
implementation(group: 'com.mdd.payment', name: 'isodeplibrary-release', version: '2.1.1', ext: 'aar')
implementation(group: 'com.mdd.payment', name: 'z91library-release', version: '2.1.0', ext: 'aar')
implementation(group: 'com.mdd.payment', name: 'aar-deviceid-release', version: '2.0.4', ext: 'aar')
implementation(group: 'com.mdd.service', name: 'partner-connect', version: '2.2.5', ext: 'aar')
implementation(group: 'com.mdd.topup', name: 'update-balance', version: '2.3.5', ext: 'aar')
implementation(group: 'com.mdd.service', name: 'partner-connect', version: '2.2.7', ext: 'aar')
implementation(group: 'com.mdd.topup', name: 'update-balance', version: '2.4.0', ext: 'aar')
}
\ No newline at end of file
package id.mdd.implementationpartnerconnect;
import com.mdd.topupUnik.ubal.InitReader;
public interface InitListener {
void onInitReaderComplete(InitReader reader);
}
\ No newline at end of file
......@@ -7,15 +7,23 @@ import android.content.pm.PackageManager;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.mdd.aar.deviceid.AarDeviceId;
import com.mdd.aar.deviceid.DeviceEnvironment;
import com.mdd.aar.deviceid.exceptions.DeviceNotRegisteredException;
import com.mdd.topupUnik.ubal.InitReader;
import com.medicom.dudikov.mybanklibrary.nativeLib;
import butterknife.BindView;
import id.emhusnan.mdd.service.ConfigService;
import id.emhusnan.mdd.service.MDDService;
import io.reactivex.SingleObserver;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
public class MyApp extends Application {
String GIVE_MID = "ba7db816e59612f8ce1630a095ef01c5"; // please ask us for credential
......@@ -23,10 +31,15 @@ public class MyApp extends Application {
String GIVEN_TOKEN = "5b423ef49cb029340d7231cace0de201";// please ask us for credential
private final String accessToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJhdXRoLXNlcnZpY2U6MS4wLjAiLCJzdWIiOnsibmFtZSI6IlRlc3RQcm9kMyIsInVzZXJuYW1lIjoiVGVzdFByb2QzIiwiYXV0aF9sZXZlbCI6Ik1FUkNIQU5UIiwibWlkIjoiMWZiNTdmMTY2YTQ4MGU5N2JmN2EzZGNiZjkzMTkyOTMifSwiaWF0IjoxNTk3NzM3NzIxLCJleHAiOjE1OTc4MjQxMjEsIm5iZiI6MTU5NzczNzcyM30.CXM-5mCv91Yo17c9zHXQKPGR5gqAeu-LADta-_qnABYxzmnE4Dx0q7NQ9IYr6cYO6cXp40UW4s632fzVYmPCXH8f0RtSwLPqTT7_lWHK--fHCP-LZOmfgwUBxdNocYY9xAi-NyWqCmTnkjWx91lqh9S9Fcue6nO_KrBqngUpBPhpS0hPwgmkqHXX6yAdVs931NbfNM3cYW9PpGIw8K-OxoPDHByD61uAFxT9FCrTbca7vV3HFQnZEKpwxxdECu7DCQAsGTl7JqfbH2j5swe_t97rSDAGyE1HRzGX-SMqPULkC-XravF2m_HucosacYQuSdRaxAWfEIQvtQhAcRXwTA";
private InitReader reader;
int idDriver = nativeLib.USE_NFC_NATIVE;
@Override
public void onCreate() {
super.onCreate();
}
public void initConfig() {
public void initConfig(InitListener initListener) {
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
if (idDriver == 1) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (checkSelfPermission(Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, "Please grant permission", Toast.LENGTH_SHORT).show();
......@@ -37,9 +50,33 @@ public class MyApp extends Application {
} else {
doInit();
}
}else{
Log.d("lariKemana", "Lari ke else bro");
new RXReader().initEdcReader(this, nativeLib.USE_NFC_NATIVE)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SingleObserver<InitReader>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(InitReader initReader) {
initListener.onInitReaderComplete(initReader);
Log.e("initReader", String.valueOf(initReader));
}
@Override
public void onError(Throwable e) {
}
});
}
}
private void doInit() {
public void doInit() {
ConfigService configService = new ConfigService();
configService.setMid(GIVE_MID);
configService.setTid(GIVE_TID);
......@@ -58,14 +95,16 @@ public class MyApp extends Application {
MDDService initialize = MDDService.with(this, configService);
if (initialize.isValid()) {
reader = initialize.getInitReader();
if (reader != null)
if (reader != null) {
Log.e("MyApp", "Aktivasi library sukses");
else
Toast.makeText(this, "Aktivasi library sukses", Toast.LENGTH_SHORT).show();
}else {
Log.e("MyApp", "Library belum aktif reader null");
// Toast.makeText(this, "Aktivasi library sukses", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Library belum aktif reader null", Toast.LENGTH_SHORT).show();
}
} else {
Log.e("MyApp", "Library belum aktif");
// Toast.makeText(this, "Library belum aktif", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Library belum aktif", Toast.LENGTH_SHORT).show();
}
}
......
package id.mdd.implementationpartnerconnect;
import android.content.Context;
import com.mdd.aar.deviceid.AarDeviceId;
import com.mdd.aar.deviceid.DeviceEnvironment;
import com.mdd.aar.deviceid.exceptions.DeviceNotRegisteredException;
import com.mdd.topupUnik.ubal.InitDebugCertificate;
import com.mdd.topupUnik.ubal.InitReader;
import com.medicom.dudikov.mybanklibrary.nativeLib;
import id.emhusnan.mdd.service.ConfigService;
import id.emhusnan.mdd.service.LibraryConfig;
import io.reactivex.Single;
public class RXReader {
Single<InitReader> initEdcReader(Context context, int deviceDriver) {
return Single.create(emitter -> {
String accessToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJhdXRoLXNlcnZpY2U6MS4wLjAiLCJzdWIiOnsibmFtZSI6IlRlc3RTdGFnIiwidXNlcm5hbWUiOiJUZXN0U3RhZyIsImF1dGhfbGV2ZWwiOiJNRVJDSEFOVCIsIm1pZCI6IjIwZjFmMTNmODA1MGFjY2QxYjNjNzFlOWUyYTQ0NzU3In0sImlhdCI6MTU5MzQxMzM5MCwiZXhwIjoxNzUxMTk4MTUwLCJuYmYiOjE1OTM0MTMzOTJ9.E6UJMKha5YCbri4KRExDV4zeA1ZBfabpW-O6SInxxvfyTTYnUZCEu58STBGrOCL0RuxTFp5Y-XEyoa932fQcTpMBMsKkvDmGeftJ0hmjzAxAjHTfUxUyEa-HHF1whsM4YQUG9CesEBjU9IUcE6Rs-jykYxuryvvqqop5BoEIwO71qQBrq6DtpwjwFk9hbNt0EKs_HmCpySfXQxorfLMbAVJCHBYoo4UVymUfwUbps7hW6eQwNoBnt11O59CRPf6uUVIfCrsaaBMcJI-mc214-EMyl3RmMbqNl_f_0ITEJhMtK2zbUFZ8dMrGdZZgWJxiHdmzxqdaEPDVshYi9Uo31w";
AarDeviceId aarDeviceId = new AarDeviceId(context);
try {
aarDeviceId.getDeviceId();
} catch (DeviceNotRegisteredException e) {
aarDeviceId.init(accessToken, DeviceEnvironment.PROD);
}
try {
ConfigService configService = new ConfigService();
configService.setMid("ba7db816e59612f8ce1630a095ef01c5");
configService.setTid("1234");
configService.setToken("5b423ef49cb029340d7231cace0de201");
LibraryConfig config = new LibraryConfig(
configService.getMid(),
configService.getTid(),
configService.getToken(),
accessToken
);
nativeLib nativeLibrary = new nativeLib(context, deviceDriver);
InitDebugCertificate debugCertificate = new InitDebugCertificate();
InitReader reader = debugCertificate.getDebug(nativeLibrary, context, deviceDriver, config);
emitter.onSuccess(reader);
} catch (Exception e) {
emitter.onError(e);
}
});
}
}
......@@ -39,10 +39,10 @@
<TextView
android:id="@+id/textCardBalance"
android:layout_width="wrap_content"
android:layout_width="600px"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:gravity="center_horizontal"
android:gravity="left"
android:text="Rp. - -"
android:textColor="#ffffff"
android:textSize="28sp" />
......@@ -233,4 +233,10 @@
android:text="1.0.1"
android:textColor="#dcdcdc" />
</LinearLayout>
<ProgressBar
android:id="@+id/pbloading"
android:layout_width="75dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:visibility="visible"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="text_label">#ffffff</color>
<color name="text_normal">#000</color>
<color name="text_label2">#414042</color>
<color name="text_success">#22bb33</color>
<color name="text_error">#bb2124</color>
<color name="text_warning">#f0ad4e</color>
<color name="text_normal">#000</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">ImplementationPartnerConnect</string>
<string name="balance">Balance</string>
<string name="card_number">Card Number</string>
<string name="tap_card">Tap Card</string>
<string name="amount">Amount</string>
<string name="old_balance">Previous Balance</string>
<string name="new_balance">New Balance</string>
<string name="amount">Amount</string>
<string name="balance">Balance</string>
<string name="check_balance">Check Balance</string>
<string name="update_balance">Update Balance</string>
<string name="update_success">Update Success</string>
<string name="tap_card">Tap Card</string>
<string name="card_info">Card Info</string>
<string name="keep_tap">Please wait, card must always be tapped</string>
<string name="nfc_not_found">NFC reader not found or disable</string>
<string name="no_pending_balance">No Pending Balance</string>
<string name="card_detect_error">No Card Detected</string>
<string name="update_balance_failed">Update Balance Failed, please re-tap</string>
<string name="update_balance_data_missmatch">Sorry, Cannot update balance right now, please update balance at Mandiri ATM machine</string>
<string name="reversal_failed">Update Balance Failed, please re-tap.</string>
<string name="reversal_success">Update Balance Failed, Please re-tap.</string>
<string name="write_card_failed">Update Balance Failed, Please re-tap. [%s]</string>
<string name="tap_for_reversal">Tap For Reversal</string>
<string name="loading">Please Wait.</string>
<string name="loading_reversal">Please Wait..</string>
<string name="copied">Copy Card Number</string>
<string name="error_not_setup">Not Setup yet</string>
<string name="connection_error">Connection Error</string>
<string name="TapMore" translatable="false">Tempelkan sekali lagi untuk memperbarui Saldo</string>
<string name="SuccessGetCard" translatable="false">Sukses mendapatkan info kartu</string>
<string name="title_activity_manual_library">ManualLibraryActivity</string>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment