diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d7d435 --- /dev/null +++ b/.gitignore @@ -0,0 +1,139 @@ +local.properties +.gradle/7.2/fileHashes/fileHashes.bin +.gradle/7.2/fileHashes/fileHashes.lock +.gradle/7.2/fileHashes/resourceHashesCache.bin +.idea/libraries/Gradle__androidx_activity_activity_1_2_4_aar.xml +.idea/libraries/Gradle__androidx_annotation_annotation_1_3_0.xml +.idea/libraries/Gradle__androidx_annotation_annotation_experimental_1_1_0_aar.xml +.idea/libraries/Gradle__androidx_appcompat_appcompat_1_4_1_aar.xml +.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_4_1_aar.xml +.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml +.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml +.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml +.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml +.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_2_0_1_aar.xml +.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_solver_2_0_1.xml +.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml +.idea/libraries/Gradle__androidx_core_core_1_7_0_aar.xml +.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_customview_customview_1_1_0_aar.xml +.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_1_1_aar.xml +.idea/libraries/Gradle__androidx_dynamicanimation_dynamicanimation_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_fragment_fragment_1_3_6_aar.xml +.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_legacy_legacy_support_v4_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_3_1.xml +.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_4_0.xml +.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml +.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_3_1_aar.xml +.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_3_1_aar.xml +.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_4_0_aar.xml +.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_3_1_aar.xml +.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_3_1_aar.xml +.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_media_media_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_aar.xml +.idea/libraries/Gradle__androidx_savedstate_savedstate_1_1_0_aar.xml +.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_transition_transition_1_2_0_aar.xml +.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml +.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml +.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_1_aar.xml +.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_aar.xml +.idea/libraries/Gradle__com_google_android_material_material_1_5_0_aar.xml +.idea/libraries/Gradle__junit_junit_4_12.xml +.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +molpayxdk/build/.transforms/3dd35c4685ba75bf1b289e95bce55463/results.bin +molpayxdk/build/.transforms/3dd35c4685ba75bf1b289e95bce55463/transformed/desugar_graph.bin +molpayxdk/build/.transforms/3dd35c4685ba75bf1b289e95bce55463/transformed/debug/com/molpay/molpayxdk/BuildConfig.dex +molpayxdk/build/.transforms/3dd35c4685ba75bf1b289e95bce55463/transformed/debug/com/molpay/molpayxdk/MOLPayActivity$1.dex +molpayxdk/build/.transforms/3dd35c4685ba75bf1b289e95bce55463/transformed/debug/com/molpay/molpayxdk/MOLPayActivity$MPBankUIWebClient.dex +molpayxdk/build/.transforms/3dd35c4685ba75bf1b289e95bce55463/transformed/debug/com/molpay/molpayxdk/MOLPayActivity$MPMainUIWebClient.dex +molpayxdk/build/.transforms/3dd35c4685ba75bf1b289e95bce55463/transformed/debug/com/molpay/molpayxdk/MOLPayActivity$MPMOLPayUIWebChromeClient$1.dex +molpayxdk/build/.transforms/3dd35c4685ba75bf1b289e95bce55463/transformed/debug/com/molpay/molpayxdk/MOLPayActivity$MPMOLPayUIWebChromeClient.dex +molpayxdk/build/.transforms/3dd35c4685ba75bf1b289e95bce55463/transformed/debug/com/molpay/molpayxdk/MOLPayActivity$MPMOLPayUIWebClient$1.dex +molpayxdk/build/.transforms/3dd35c4685ba75bf1b289e95bce55463/transformed/debug/com/molpay/molpayxdk/MOLPayActivity$MPMOLPayUIWebClient.dex +molpayxdk/build/.transforms/3dd35c4685ba75bf1b289e95bce55463/transformed/debug/com/molpay/molpayxdk/MOLPayActivity.dex +molpayxdk/build/.transforms/9ab5df3c3f985f2808b70f44db2e591c/results.bin +molpayxdk/build/.transforms/9ab5df3c3f985f2808b70f44db2e591c/transformed/classes/classes.dex +molpayxdk/build/.transforms/c59759f22b36d830573c3c5ff076dad5/results.bin +molpayxdk/build/generated/source/buildConfig/debug/com/molpay/molpayxdk/BuildConfig.java +molpayxdk/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +molpayxdk/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +molpayxdk/build/intermediates/aar_main_jar/debug/classes.jar +molpayxdk/build/intermediates/aar_metadata/debug/aar-metadata.properties +molpayxdk/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +molpayxdk/build/intermediates/annotations_typedef_file/debug/typedefs.txt +molpayxdk/build/intermediates/compile_library_classes_jar/debug/classes.jar +molpayxdk/build/intermediates/compile_r_class_jar/debug/R.jar +molpayxdk/build/intermediates/compile_symbol_list/debug/R.txt +molpayxdk/build/intermediates/compiled_local_resources/debug/out/layout_activity_molpay.xml.flat +molpayxdk/build/intermediates/compiled_local_resources/debug/out/menu_menu_molpay.xml.flat +molpayxdk/build/intermediates/incremental/debug-mergeJavaRes/merge-state +molpayxdk/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +molpayxdk/build/intermediates/incremental/mergeDebugShaders/merger.xml +molpayxdk/build/intermediates/incremental/packageDebugAssets/merger.xml +molpayxdk/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +molpayxdk/build/intermediates/incremental/packageDebugResources/merger.xml +molpayxdk/build/intermediates/incremental/packageDebugResources/merged.dir/values/values.xml +molpayxdk/build/intermediates/incremental/packageDebugResources/merged.dir/values-w820dp-v13/values-w820dp-v13.xml +molpayxdk/build/intermediates/javac/debug/classes/com/molpay/molpayxdk/BuildConfig.class +molpayxdk/build/intermediates/javac/debug/classes/com/molpay/molpayxdk/MOLPayActivity$1.class +molpayxdk/build/intermediates/javac/debug/classes/com/molpay/molpayxdk/MOLPayActivity$MPBankUIWebClient.class +molpayxdk/build/intermediates/javac/debug/classes/com/molpay/molpayxdk/MOLPayActivity$MPMainUIWebClient.class +molpayxdk/build/intermediates/javac/debug/classes/com/molpay/molpayxdk/MOLPayActivity$MPMOLPayUIWebChromeClient$1.class +molpayxdk/build/intermediates/javac/debug/classes/com/molpay/molpayxdk/MOLPayActivity$MPMOLPayUIWebChromeClient.class +molpayxdk/build/intermediates/javac/debug/classes/com/molpay/molpayxdk/MOLPayActivity$MPMOLPayUIWebClient$1.class +molpayxdk/build/intermediates/javac/debug/classes/com/molpay/molpayxdk/MOLPayActivity$MPMOLPayUIWebClient.class +molpayxdk/build/intermediates/javac/debug/classes/com/molpay/molpayxdk/MOLPayActivity.class +molpayxdk/build/intermediates/local_only_symbol_list/debug/R-def.txt +molpayxdk/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +molpayxdk/build/intermediates/merged_java_res/debug/feature-molpayxdk.jar +molpayxdk/build/intermediates/merged_manifest/debug/AndroidManifest.xml +molpayxdk/build/intermediates/navigation_json/debug/navigation.json +molpayxdk/build/intermediates/packaged_manifests/debug/output-metadata.json +molpayxdk/build/intermediates/packaged_res/debug/layout/activity_molpay.xml +molpayxdk/build/intermediates/packaged_res/debug/menu/menu_molpay.xml +molpayxdk/build/intermediates/packaged_res/debug/values/values.xml +molpayxdk/build/intermediates/packaged_res/debug/values-w820dp-v13/values-w820dp-v13.xml +molpayxdk/build/intermediates/runtime_library_classes_dir/debug/com/molpay/molpayxdk/BuildConfig.class +molpayxdk/build/intermediates/runtime_library_classes_dir/debug/com/molpay/molpayxdk/MOLPayActivity$1.class +molpayxdk/build/intermediates/runtime_library_classes_dir/debug/com/molpay/molpayxdk/MOLPayActivity$MPBankUIWebClient.class +molpayxdk/build/intermediates/runtime_library_classes_dir/debug/com/molpay/molpayxdk/MOLPayActivity$MPMainUIWebClient.class +molpayxdk/build/intermediates/runtime_library_classes_dir/debug/com/molpay/molpayxdk/MOLPayActivity$MPMOLPayUIWebChromeClient$1.class +molpayxdk/build/intermediates/runtime_library_classes_dir/debug/com/molpay/molpayxdk/MOLPayActivity$MPMOLPayUIWebChromeClient.class +molpayxdk/build/intermediates/runtime_library_classes_dir/debug/com/molpay/molpayxdk/MOLPayActivity$MPMOLPayUIWebClient$1.class +molpayxdk/build/intermediates/runtime_library_classes_dir/debug/com/molpay/molpayxdk/MOLPayActivity$MPMOLPayUIWebClient.class +molpayxdk/build/intermediates/runtime_library_classes_dir/debug/com/molpay/molpayxdk/MOLPayActivity.class +molpayxdk/build/intermediates/runtime_library_classes_jar/debug/classes.jar +molpayxdk/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +molpayxdk/build/outputs/aar/molpayxdk-debug.aar +molpayxdk/build/outputs/logs/manifest-merger-debug-report.txt +molpayxdk/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +.idea/misc.xml +.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.androidTest.iml +.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.iml +.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.main.iml +.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.unitTest.iml +.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.androidTest.iml +.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.iml +.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.main.iml +.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.unitTest.iml +.gradle/7.2/executionHistory/executionHistory.bin +.gradle/7.2/executionHistory/executionHistory.lock +.gradle/buildOutputCleanup/buildOutputCleanup.lock +.gradle/buildOutputCleanup/outputFiles.bin +.gradle/checksums/checksums.lock +.gradle/checksums/md5-checksums.bin +.gradle/checksums/sha1-checksums.bin +.idea/compiler.xml +.idea/gradle.xml diff --git a/.gradle/7.2/executionHistory/executionHistory.bin b/.gradle/7.2/executionHistory/executionHistory.bin deleted file mode 100644 index afc8ef1..0000000 Binary files a/.gradle/7.2/executionHistory/executionHistory.bin and /dev/null differ diff --git a/.gradle/7.2/executionHistory/executionHistory.lock b/.gradle/7.2/executionHistory/executionHistory.lock deleted file mode 100644 index 3906419..0000000 Binary files a/.gradle/7.2/executionHistory/executionHistory.lock and /dev/null differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock deleted file mode 100644 index b18cbbe..0000000 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and /dev/null differ diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin deleted file mode 100644 index 86c94be..0000000 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and /dev/null differ diff --git a/.gradle/checksums/checksums.lock b/.gradle/checksums/checksums.lock deleted file mode 100644 index ae55877..0000000 Binary files a/.gradle/checksums/checksums.lock and /dev/null differ diff --git a/.gradle/checksums/md5-checksums.bin b/.gradle/checksums/md5-checksums.bin deleted file mode 100644 index 4d69886..0000000 Binary files a/.gradle/checksums/md5-checksums.bin and /dev/null differ diff --git a/.gradle/checksums/sha1-checksums.bin b/.gradle/checksums/sha1-checksums.bin deleted file mode 100644 index bdd0f6e..0000000 Binary files a/.gradle/checksums/sha1-checksums.bin and /dev/null differ diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index fb7f4a8..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index f7ee017..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 26dadeb..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.androidTest.iml b/.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.androidTest.iml deleted file mode 100644 index 8883965..0000000 --- a/.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.androidTest.iml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.iml b/.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.iml deleted file mode 100644 index 203cdbd..0000000 --- a/.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.iml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.main.iml b/.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.main.iml deleted file mode 100644 index bc7b1ab..0000000 --- a/.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.main.iml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.unitTest.iml b/.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.unitTest.iml deleted file mode 100644 index 317b326..0000000 --- a/.idea/modules/app/Mobile-XDK-RazerMS_Android_Library.app.unitTest.iml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.androidTest.iml b/.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.androidTest.iml deleted file mode 100644 index c31a91f..0000000 --- a/.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.androidTest.iml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.iml b/.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.iml deleted file mode 100644 index dba51ea..0000000 --- a/.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.iml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.main.iml b/.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.main.iml deleted file mode 100644 index f97426b..0000000 --- a/.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.main.iml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.unitTest.iml b/.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.unitTest.iml deleted file mode 100644 index ab45710..0000000 --- a/.idea/modules/molpayxdk/Mobile-XDK-RazerMS_Android_Library.molpayxdk.unitTest.iml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/molpayxdk/build.gradle b/molpayxdk/build.gradle index cd4913c..0cba13e 100644 --- a/molpayxdk/build.gradle +++ b/molpayxdk/build.gradle @@ -38,7 +38,7 @@ afterEvaluate { from components.release groupId ='com.rms.mobile' artifactId = 'mobile_xdk' - version = '3.33.4' + version = '3.33.9' } } } diff --git a/molpayxdk/src/main/java/com/molpay/molpayxdk/MOLPayActivity.java b/molpayxdk/src/main/java/com/molpay/molpayxdk/MOLPayActivity.java index 047aeb0..7a957b8 100644 --- a/molpayxdk/src/main/java/com/molpay/molpayxdk/MOLPayActivity.java +++ b/molpayxdk/src/main/java/com/molpay/molpayxdk/MOLPayActivity.java @@ -36,6 +36,8 @@ import android.widget.RelativeLayout; import android.widget.Toast; +import org.json.JSONArray; +import org.json.JSONException; import org.json.JSONObject; import java.io.File; @@ -94,7 +96,7 @@ public class MOLPayActivity extends AppCompatActivity { public final static String mp_dpa_id = "mp_dpa_id"; public final static String mp_company = "mp_company"; - public final static String MOLPAY = "MOLPAY"; + public final static String MOLPAY = "logMOLPAY"; private final static String mpopenmolpaywindow = "mpopenmolpaywindow://"; private final static String mpcloseallwindows = "mpcloseallwindows://"; private final static String mptransactionresults = "mptransactionresults://"; @@ -102,7 +104,7 @@ public class MOLPayActivity extends AppCompatActivity { private final static String mppinstructioncapture = "mppinstructioncapture://"; private final static String module_id = "module_id"; private final static String wrapper_version = "wrapper_version"; - private final static String wrapperVersion = "0"; + private final static String wrapperVersion = "9"; private String base64Img; private String filename; @@ -418,8 +420,13 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { if (dataString.length() > 0) { Log.d(MOLPAY, "MPMainUIWebClient mpopenmolpaywindow success"); - mpMOLPayUI.loadDataWithBaseURL("", dataString, "text/html", "UTF-8", ""); - mpMOLPayUI.setVisibility(View.VISIBLE); + if (mpMOLPayUI != null) { + Log.d(MOLPAY, "mpMOLPayUI not NULL update UI"); + mpMOLPayUI.loadDataWithBaseURL("", dataString, "text/html", "UTF-8", ""); + mpMOLPayUI.setVisibility(View.VISIBLE); + } else { + Log.d(MOLPAY, "mpMOLPayUI NULL avoid crash"); + } } else { Log.d(MOLPAY, "MPMainUIWebClient mpopenmolpaywindow empty dataString"); } @@ -454,23 +461,31 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { Intent result = new Intent(); result.putExtra(MOLPayTransactionResult, dataString); - setResult(RESULT_OK, result); - // Check if mp_request_type is "Receipt", if it is, don't finish() - try { - JSONObject jsonResult = new JSONObject(dataString); + if (isJSONValid(dataString)){ + Log.d(MOLPAY, "isJSONValid setResult"); + setResult(RESULT_OK, result); - Log.d(MOLPAY, "MPMainUIWebClient jsonResult = " + jsonResult); + // Check if mp_request_type is "Receipt", if it is, don't finish() + try { + JSONObject jsonResult = new JSONObject(dataString); + + Log.d(MOLPAY, "MPMainUIWebClient jsonResult = " + jsonResult); - if (!jsonResult.has("mp_request_type") || !jsonResult.getString("mp_request_type").equals("Receipt") || jsonResult.has("error_code")) { + if (!jsonResult.has("mp_request_type") || !jsonResult.getString("mp_request_type").equals("Receipt") || jsonResult.has("error_code")) { + finish(); + } else { + // Next close button click will finish() the activity + isClosingReceipt = true; + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE); + } + } catch (Throwable t) { finish(); - } else { - // Next close button click will finish() the activity - isClosingReceipt = true; - getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE); } - } catch (Throwable t) { - finish(); + } + else { + Log.d(MOLPAY, "json not valid dont setResult"); +// setResult(RESULT_CANCELED, result); } } else if (url != null && url.startsWith(mprunscriptonpopup)) { @@ -535,6 +550,20 @@ public void onPageFinished(WebView view, String url) { } + public boolean isJSONValid(String test) { + try { + new JSONObject(test); + } catch (JSONException ex) { + // in case JSONArray is valid as well + try { + new JSONArray(test); + } catch (JSONException ex1) { + return false; + } + } + return true; + } + private boolean storeImage(Bitmap image) { String fullPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString(); @@ -568,7 +597,7 @@ private boolean storeImage(Bitmap image) { @TargetApi(23) public boolean isStoragePermissionGranted() { if (Build.VERSION.SDK_INT >= 23) { - if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { + if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { Log.d(MOLPAY, "isStoragePermissionGranted Permission granted"); storeImage(imgBitmap); return true;