diff --git a/app/src/main/java/com/molpay/molpayxdkproject/MainActivity.java b/app/src/main/java/com/molpay/molpayxdkproject/MainActivity.java index 927b397..b1ea017 100644 --- a/app/src/main/java/com/molpay/molpayxdkproject/MainActivity.java +++ b/app/src/main/java/com/molpay/molpayxdkproject/MainActivity.java @@ -95,15 +95,19 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); - Log.e("logGooglePay" , "onActivityResult requestCode = " + requestCode); - Log.e("logGooglePay" , "onActivityResult resultCode = " + resultCode); + // Log.e("logGooglePay" , "onActivityResult requestCode = " + requestCode); + // Log.e("logGooglePay" , "onActivityResult resultCode = " + resultCode); if (requestCode == MOLPayActivity.MOLPayXDK && data != null){ if (data.getStringExtra(MOLPayActivity.MOLPayTransactionResult) != null) { - Log.d(MOLPayActivity.MOLPAY, "MOLPay result = " + data.getStringExtra(MOLPayActivity.MOLPayTransactionResult)); + // Log.d(MOLPayActivity.MOLPAY, "MOLPay result = " + data.getStringExtra(MOLPayActivity.MOLPayTransactionResult)); TextView tw = findViewById(R.id.resultTV); tw.setText(data.getStringExtra(MOLPayActivity.MOLPayTransactionResult)); } + } else if (requestCode == MOLPayActivity.MOLPayXDK && resultCode == MainActivity.RESULT_CANCELED && data == null) { + // Log.e("logGooglePay" , "RESULT_CANCELED data == null"); + TextView tw = findViewById(R.id.resultTV); + tw.setText("data == null"); } } diff --git a/molpayxdk/src/main/java/com/molpay/molpayxdk/MOLPayActivity.java b/molpayxdk/src/main/java/com/molpay/molpayxdk/MOLPayActivity.java index 1d4ecb9..3d1bfc5 100644 --- a/molpayxdk/src/main/java/com/molpay/molpayxdk/MOLPayActivity.java +++ b/molpayxdk/src/main/java/com/molpay/molpayxdk/MOLPayActivity.java @@ -109,7 +109,7 @@ public class MOLPayActivity extends AppCompatActivity { private final static String mpclickgpbutton = "mpclickgpbutton://"; private final static String module_id = "module_id"; private final static String wrapper_version = "wrapper_version"; - private final static String wrapperVersion = "1"; + private final static String wrapperVersion = "5"; private String base64Img; private String filename; @@ -218,15 +218,15 @@ protected void onCreate(Bundle savedInstanceState) { mpMOLPayUI.setLongClickable(true); mpMOLPayUI.setOnLongClickListener(view -> { - Log.d(MOLPAY, "Long press fired!"); + // Log.d(MOLPAY, "Long press fired!"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { mpMOLPayUI.evaluateJavascript("document.getElementById(\"qrcode_img\").src", new ValueCallback() { @Override public void onReceiveValue(String qrdata) { - Log.d(MOLPAY, "QR data = " + qrdata); + // Log.d(MOLPAY, "QR data = " + qrdata); if(qrdata != null && !qrdata.equals("null")) { String imageQrCode = qrdata.replaceAll("data:image/png;base64,", ""); - Log.d(MOLPAY, "imageQrCode = " + imageQrCode); + // Log.d(MOLPAY, "imageQrCode = " + imageQrCode); byte[] decodedBytes = Base64.decode(imageQrCode, 0); imgBitmap = BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.length); filename = Objects.requireNonNull(paymentDetails.get("mp_order_ID")) + ".png"; @@ -243,7 +243,7 @@ public void onReceiveValue(String qrdata) { OnBackPressedCallback callback = new OnBackPressedCallback(true) { @Override public void handleOnBackPressed() { - Log.e("logGooglePay" , "WebCore onBackPressed"); + // Log.e("logGooglePay" , "WebCore onBackPressed"); closemolpay(); } }; @@ -253,7 +253,7 @@ public void handleOnBackPressed() { } private void nativeWebRequestUrlUpdates(String url) { - Log.d(MOLPAY, "nativeWebRequestUrlUpdates url = " + url); + // Log.d(MOLPAY, "nativeWebRequestUrlUpdates url = " + url); HashMap data = new HashMap<>(); data.put("requestPath", url); @@ -266,7 +266,7 @@ private void nativeWebRequestUrlUpdates(String url) { } private void nativeWebRequestUrlUpdatesOnFinishLoad(String url) { - Log.d(MOLPAY, "nativeWebRequestUrlUpdatesOnFinishLoad url = " + url); + // Log.d(MOLPAY, "nativeWebRequestUrlUpdatesOnFinishLoad url = " + url); HashMap data = new HashMap<>(); data.put("requestPath", url); @@ -281,7 +281,7 @@ private void nativeWebRequestUrlUpdatesOnFinishLoad(String url) { private class MPBankUIWebClient extends WebViewClient { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { - Log.d(MOLPAY, "MPBankUIWebClient onPageStarted url = " + url); + // Log.d(MOLPAY, "MPBankUIWebClient onPageStarted url = " + url); if (url != null) { nativeWebRequestUrlUpdates(url); @@ -289,7 +289,7 @@ public void onPageStarted(WebView view, String url, Bitmap favicon) { } @Override public void onPageFinished (WebView view, String url) { - Log.d(MOLPAY, "MPBankUIWebClient onPageFinished url = " + url); + // Log.d(MOLPAY, "MPBankUIWebClient onPageFinished url = " + url); nativeWebRequestUrlUpdates(url); } } @@ -297,7 +297,7 @@ public void onPageFinished (WebView view, String url) { private class MPMOLPayUIWebClient extends WebViewClient { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { - Log.d(MOLPAY, "MPMOLPayUIWebClient onPageStarted url = " + url); + // Log.d(MOLPAY, "MPMOLPayUIWebClient onPageStarted url = " + url); if (url != null) { nativeWebRequestUrlUpdates(url); @@ -307,7 +307,7 @@ public void onPageStarted(WebView view, String url, Bitmap favicon) { @RequiresApi(api = Build.VERSION_CODES.KITKAT) @Override public boolean shouldOverrideUrlLoading(final WebView view, String url) { - Log.d(MOLPAY, "MPMOLPayUIWebClient shouldOverrideUrlLoading url = " + url); + // Log.d(MOLPAY, "MPMOLPayUIWebClient shouldOverrideUrlLoading url = " + url); if (url != null) { if (url.contains("scbeasy/easy_app_link.html")) { try { @@ -320,7 +320,7 @@ public boolean shouldOverrideUrlLoading(final WebView view, String url) { view.evaluateJavascript("document.getElementById(\"ref_no\").value", new ValueCallback() { @Override public void onReceiveValue(String ref_no) { - Log.d(MOLPAY, "MPMOLPayUIWebClient trans_id = " + ref_no.replaceAll("\"", "")); + // Log.d(MOLPAY, "MPMOLPayUIWebClient trans_id = " + ref_no.replaceAll("\"", "")); view.loadUrl("https://pay.merchant.razer.com/RMS/intermediate_app/loading.php?tranID=" + ref_no.replaceAll("\"", "")); } }); @@ -354,27 +354,27 @@ public void onReceiveValue(String ref_no) { @RequiresApi(api = Build.VERSION_CODES.KITKAT) @Override public void onPageFinished (final WebView view, String url) { - Log.d(MOLPAY, "MPMOLPayUIWebClient onPageFinished url = " + url); + // Log.d(MOLPAY, "MPMOLPayUIWebClient onPageFinished url = " + url); // nativeWebRequestUrlUpdates(url); if (url.contains("intermediate_appTNG-EWALLET.php") || url.contains("intermediate_app/processing.php")) { - Log.d(MOLPAY, "contains url"); + // Log.d(MOLPAY, "contains url"); view.evaluateJavascript("document.getElementById(\"systembrowserurl\").innerHTML", s -> { - Log.d(MOLPAY, "MPMOLPayUIWebClient base64String = " + s); + // Log.d(MOLPAY, "MPMOLPayUIWebClient base64String = " + s); // // Decode base64 byte[] data = Base64.decode(s, Base64.DEFAULT); String dataString = new String(data); - Log.d(MOLPAY, "MPBankUIWebClient dataString = " + dataString); + // Log.d(MOLPAY, "MPBankUIWebClient dataString = " + dataString); if (s.length() > 0) { - Log.d(MOLPAY, "MPMOLPayUIWebClient success"); + // Log.d(MOLPAY, "MPMOLPayUIWebClient success"); Intent intent= new Intent(Intent.ACTION_VIEW, Uri.parse(dataString)); startActivity(intent); } else { - Log.d(MOLPAY, "MPMOLPayUIWebClient empty dataString"); + // Log.d(MOLPAY, "MPMOLPayUIWebClient empty dataString"); } }); @@ -387,7 +387,7 @@ private class MPMOLPayUIWebChromeClient extends WebChromeClient { @Override public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, Message resultMsg) { - Log.d(MOLPAY, "MPMOLPayUIWebChromeClient onCreateWindow resultMsg = " + resultMsg); + // Log.d(MOLPAY, "MPMOLPayUIWebChromeClient onCreateWindow resultMsg = " + resultMsg); RelativeLayout container = (RelativeLayout) findViewById(R.id.MPContainer); @@ -420,29 +420,29 @@ public void onCloseWindow(WebView window) { private class MPMainUIWebClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { - Log.d(MOLPAY, "MPMainUIWebClient shouldOverrideUrlLoading url = " + url); + // Log.d(MOLPAY, "MPMainUIWebClient shouldOverrideUrlLoading url = " + url); if (url != null) { if (url.startsWith(mpopenmolpaywindow)) { String base64String = url.replace(mpopenmolpaywindow, ""); - Log.d(MOLPAY, "MPMainUIWebClient mpopenmolpaywindow base64String = " + base64String); + // Log.d(MOLPAY, "MPMainUIWebClient mpopenmolpaywindow base64String = " + base64String); // Decode base64 byte[] data = Base64.decode(base64String, Base64.DEFAULT); String dataString = new String(data); - Log.d(MOLPAY, "MPMainUIWebClient mpopenmolpaywindow dataString = " + dataString); + // Log.d(MOLPAY, "MPMainUIWebClient mpopenmolpaywindow dataString = " + dataString); if (dataString.length() > 0) { - Log.d(MOLPAY, "MPMainUIWebClient mpopenmolpaywindow success"); + // Log.d(MOLPAY, "MPMainUIWebClient mpopenmolpaywindow success"); if (mpMOLPayUI != null) { - Log.d(MOLPAY, "mpMOLPayUI not NULL update UI"); + // 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"); + // Log.d(MOLPAY, "mpMOLPayUI NULL avoid crash"); } } else { - Log.d(MOLPAY, "MPMainUIWebClient mpopenmolpaywindow empty dataString"); + // Log.d(MOLPAY, "MPMainUIWebClient mpopenmolpaywindow empty dataString"); } } @@ -468,25 +468,25 @@ else if (url.startsWith(mpcloseallwindows)) { } else if (url.startsWith(mptransactionresults)) { String base64String = url.replace(mptransactionresults, ""); - Log.d(MOLPAY, "MPMainUIWebClient mptransactionresults base64String = " + base64String); + // Log.d(MOLPAY, "MPMainUIWebClient mptransactionresults base64String = " + base64String); // Decode base64 byte[] data = Base64.decode(base64String, Base64.DEFAULT); String dataString = new String(data); - Log.d(MOLPAY, "MPMainUIWebClient mptransactionresults dataString = " + dataString); + // Log.d(MOLPAY, "MPMainUIWebClient mptransactionresults dataString = " + dataString); Intent result = new Intent(); result.putExtra(MOLPayTransactionResult, dataString); if (isJSONValid(dataString)){ - Log.d(MOLPAY, "isJSONValid setResult"); + // Log.d(MOLPAY, "isJSONValid setResult"); setResult(RESULT_OK, result); // 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); + // Log.d(MOLPAY, "MPMainUIWebClient jsonResult = " + jsonResult); if (!jsonResult.has("mp_request_type") || !jsonResult.getString("mp_request_type").equals("Receipt") || jsonResult.has("error_code")) { finish(); @@ -500,41 +500,41 @@ else if (url.startsWith(mptransactionresults)) { } } else { - Log.d(MOLPAY, "json not valid dont setResult"); + // Log.d(MOLPAY, "json not valid dont setResult"); // setResult(RESULT_CANCELED, result); } } else if (url.startsWith(mprunscriptonpopup)) { String base64String = url.replace(mprunscriptonpopup, ""); - Log.d(MOLPAY, "MPMainUIWebClient mprunscriptonpopup base64String = " + base64String); + // Log.d(MOLPAY, "MPMainUIWebClient mprunscriptonpopup base64String = " + base64String); // Decode base64 byte[] data = Base64.decode(base64String, Base64.DEFAULT); String jsString = new String(data); - Log.d(MOLPAY, "MPMainUIWebClient mprunscriptonpopup jsString = " + jsString); + // Log.d(MOLPAY, "MPMainUIWebClient mprunscriptonpopup jsString = " + jsString); if (mpBankUI != null) { mpBankUI.loadUrl("javascript:"+jsString); - Log.d(MOLPAY, "mpBankUI loadUrl = " + "javascript:"+jsString); + // Log.d(MOLPAY, "mpBankUI loadUrl = " + "javascript:"+jsString); } } else if (url.startsWith(mppinstructioncapture)) { String base64String = url.replace(mppinstructioncapture, ""); - Log.d(MOLPAY, "MPMainUIWebClient mppinstructioncapture base64String = " + base64String); + // Log.d(MOLPAY, "MPMainUIWebClient mppinstructioncapture base64String = " + base64String); // Decode base64 byte[] data = Base64.decode(base64String, Base64.DEFAULT); String dataString = new String(data); - Log.d(MOLPAY, "MPMainUIWebClient mppinstructioncapture dataString = " + dataString); + // Log.d(MOLPAY, "MPMainUIWebClient mppinstructioncapture dataString = " + dataString); try { JSONObject jsonResult = new JSONObject(dataString); base64Img = jsonResult.getString("base64ImageUrlData"); filename = jsonResult.getString("filename"); - Log.d(MOLPAY, "MPMainUIWebClient jsonResult = " + jsonResult); + // Log.d(MOLPAY, "MPMainUIWebClient jsonResult = " + jsonResult); byte[] decodedBytes = Base64.decode(base64Img, 0); imgBitmap = BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.length); @@ -542,7 +542,7 @@ else if (url.startsWith(mppinstructioncapture)) { isStoragePermissionGranted(); } catch (Throwable t) { - Log.d(MOLPAY, "MPMainUIWebClient jsonResult error = " + t); + // Log.d(MOLPAY, "MPMainUIWebClient jsonResult error = " + t); } } @@ -584,7 +584,7 @@ public void onPageFinished(WebView view, String url) { // Create JSON object for Payment details JSONObject json = new JSONObject(paymentDetails); - Log.d(MOLPAY, "MPMainUIWebClient onPageFinished paymentDetails = " + json.toString()); + // Log.d(MOLPAY, "MPMainUIWebClient onPageFinished paymentDetails = " + json.toString()); // Init javascript mpMainUI.loadUrl("javascript:updateSdkData(" + json.toString() + ")"); @@ -599,12 +599,12 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); - Log.e("logGooglePay" , "MOLPAY onActivityResult requestCode = " + requestCode); - Log.e("logGooglePay" , "MOLPAY onActivityResult resultCode = " + resultCode); + // Log.e("logGooglePay" , "MOLPAY onActivityResult requestCode = " + requestCode); + // Log.e("logGooglePay" , "MOLPAY onActivityResult resultCode = " + resultCode); if (requestCode == MOLPayActivity.MOLPayXDK && data != null) { if (data.getStringExtra(MOLPayActivity.MOLPayTransactionResult) != null) { - Log.e("logGooglePay", "MOLPAY result = " + data.getStringExtra(MOLPayActivity.MOLPayTransactionResult)); + // Log.e("logGooglePay", "MOLPAY result = " + data.getStringExtra(MOLPayActivity.MOLPayTransactionResult)); Intent result = new Intent(); result.putExtra(MOLPayTransactionResult, data.getStringExtra(MOLPayActivity.MOLPayTransactionResult)); setResult(resultCode, result); @@ -650,7 +650,7 @@ private boolean storeImage(Bitmap image) { return true; } catch (Exception e) { - Log.d(MOLPAY, "MPMainUIWebClient storeImage error = " + e.getMessage()); + // Log.d(MOLPAY, "MPMainUIWebClient storeImage error = " + e.getMessage()); Toast toast = Toast.makeText(this, "Image not saved", Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); @@ -662,17 +662,17 @@ private boolean storeImage(Bitmap image) { public boolean isStoragePermissionGranted() { if (Build.VERSION.SDK_INT >= 23) { if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { - Log.d(MOLPAY, "isStoragePermissionGranted Permission granted"); + // Log.d(MOLPAY, "isStoragePermissionGranted Permission granted"); storeImage(imgBitmap); return true; } else { - Log.d(MOLPAY, "isStoragePermissionGranted Permission revoked"); + // Log.d(MOLPAY, "isStoragePermissionGranted Permission revoked"); ActivityCompat.requestPermissions(MOLPayActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_EXTERNAL_STORAGE); return false; } } else { //permission is automatically granted on sdk<23 upon installation - Log.d(MOLPAY, "isStoragePermissionGranted Permission granted on sdk<23"); + // Log.d(MOLPAY, "isStoragePermissionGranted Permission granted on sdk<23"); storeImage(imgBitmap); return true; } @@ -687,13 +687,13 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis if (requestCode == REQUEST_EXTERNAL_STORAGE) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { - Log.d(MOLPAY, "onRequestPermissionsResult Permission: " + permissions[0] + "was " + grantResults[0]); + // Log.d(MOLPAY, "onRequestPermissionsResult Permission: " + permissions[0] + "was " + grantResults[0]); //resume tasks needing this permission storeImage(imgBitmap); } else { - Log.d(MOLPAY, "onRequestPermissionsResult EXTERNAL_STORAGE permission was NOT granted."); + // Log.d(MOLPAY, "onRequestPermissionsResult EXTERNAL_STORAGE permission was NOT granted."); Toast.makeText(this, "Image not saved", Toast.LENGTH_LONG).show(); } } diff --git a/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/ActivityGP.java b/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/ActivityGP.java index 4c10979..e7ff628 100644 --- a/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/ActivityGP.java +++ b/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/ActivityGP.java @@ -62,8 +62,8 @@ public class ActivityGP extends AppCompatActivity { ActivityResultLauncher resolvePaymentForResult = registerForActivityResult( new ActivityResultContracts.StartIntentSenderForResult(), result -> { - Log.e("logGooglePay" , "resolvePaymentForResult"); - Log.e("logGooglePay" , "result.getResultCode() = " + result.getResultCode()); + // Log.e("logGooglePay" , "resolvePaymentForResult"); + // Log.e("logGooglePay" , "result.getResultCode() = " + result.getResultCode()); switch (result.getResultCode()) { case Activity.RESULT_OK: Intent resultData = result.getData(); @@ -77,6 +77,7 @@ public class ActivityGP extends AppCompatActivity { case Activity.RESULT_CANCELED: // The user cancelled the payment attempt + setResult(RESULT_CANCELED, null); finish(); break; @@ -122,7 +123,7 @@ protected void onCreate(Bundle savedInstanceState) { @Override public void handleOnBackPressed() { // Do nothing - prevent user from performing backpress - Log.e("logGooglePay" , "ActivityGP backpressed"); + // Log.e("logGooglePay" , "ActivityGP backpressed"); } }; @@ -157,9 +158,9 @@ private void setGooglePayAvailable(boolean available) { public void requestPayment() { - Log.e("logGooglePay" , "requestPayment"); - Log.e("logGooglePay" , "mp_amount = " + Objects.requireNonNull(paymentDetails.get("mp_amount")).toString()); - Log.e("logGooglePay" , "totalPriceCents = " + Objects.requireNonNull(paymentDetails.get("mp_amount")).toString().replaceAll("[.,]","")); + // Log.e("logGooglePay" , "requestPayment"); + // Log.e("logGooglePay" , "mp_amount = " + Objects.requireNonNull(paymentDetails.get("mp_amount")).toString()); + // Log.e("logGooglePay" , "totalPriceCents = " + Objects.requireNonNull(paymentDetails.get("mp_amount")).toString().replaceAll("[.,]","")); // The price provided to the API should include taxes and shipping. // This price is not displayed to the user. @@ -168,7 +169,7 @@ public void requestPayment() { final Task task = model.getLoadPaymentDataTask(totalPriceCents); task.addOnCompleteListener(completedTask -> { - Log.e("logGooglePay" , "addOnCompleteListener"); + // Log.e("logGooglePay" , "addOnCompleteListener"); if (completedTask.isSuccessful()) { handlePaymentSuccess(completedTask.getResult()); @@ -202,7 +203,7 @@ public void requestPayment() { private void handlePaymentSuccess(PaymentData paymentData) { pbLoading.setVisibility(View.VISIBLE); - Log.e("logGooglePay" , "handlePaymentSuccess"); + // Log.e("logGooglePay" , "handlePaymentSuccess"); final String paymentInfo = paymentData.toJson(); @@ -250,7 +251,7 @@ private void handlePaymentSuccess(PaymentData paymentData) { }); } catch (JSONException e) { -// Log.e(Constants.LOG_GOOGLE_PAY, "handlePaymentSuccess JSONException: " + e); +// // Log.e(Constants.LOG_GOOGLE_PAY, "handlePaymentSuccess JSONException: " + e); } } @@ -266,7 +267,7 @@ private void handlePaymentSuccess(PaymentData paymentData) { * WalletConstants#constant-summary">Wallet Constants Library */ private void handleError(int statusCode, @Nullable String message) { -// Log.e("loadPaymentData failed", String.format(Locale.getDefault(), "Error code: %d, Message: %s", statusCode, message)); +// // Log.e("loadPaymentData failed", String.format(Locale.getDefault(), "Error code: %d, Message: %s", statusCode, message)); } @Override @@ -289,13 +290,13 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten if (data != null) { response = data.getStringExtra("response"); - Log.e("logGooglePay" , "RESULT_OK response = " + response); + // Log.e("logGooglePay" , "RESULT_OK response = " + response); Intent result = new Intent(); result.putExtra(MOLPayActivity.MOLPayTransactionResult, response); setResult(RESULT_OK, result); } else { - Log.e("logGooglePay" , "RESULT_OK data = null"); + // Log.e("logGooglePay" , "RESULT_OK data = null"); setResult(RESULT_OK, null); } @@ -308,12 +309,12 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten // Response Error CallBack if (data != null) { response = data.getStringExtra("response"); - Log.e("logGooglePay" , "RESULT_CANCELED response = " + response); + // Log.e("logGooglePay" , "RESULT_CANCELED response = " + response); Intent resultCancel = new Intent(); resultCancel.putExtra(MOLPayActivity.MOLPayTransactionResult, response); setResult(RESULT_CANCELED, resultCancel); } else { - Log.e("logGooglePay" , "RESULT_CANCELED data = null"); + // Log.e("logGooglePay" , "RESULT_CANCELED data = null"); setResult(RESULT_CANCELED, null); } @@ -325,7 +326,7 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten if (status != null) { handleError(status.getStatusCode() , status.getStatusMessage()); } else { - Log.e("logGooglePay" , "RESULT_ERROR status = null"); + // Log.e("logGooglePay" , "RESULT_ERROR status = null"); handleError(0 , ""); } break; diff --git a/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/Helper/ApplicationHelper.java b/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/Helper/ApplicationHelper.java index c4e133f..c85a336 100644 --- a/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/Helper/ApplicationHelper.java +++ b/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/Helper/ApplicationHelper.java @@ -23,7 +23,7 @@ public static ApplicationHelper getInstance() { public String GetVCode(String amount, String merchantID, String orderId, String verifyKey, String currency, boolean extendedVCode) { byte[] hashData; - Log.e("logGooglePay" , "extendedVCode = " + extendedVCode); + // Log.e("logGooglePay" , "extendedVCode = " + extendedVCode); if (extendedVCode) { hashData = AlgorithmHelper.md5(amount + merchantID + orderId + verifyKey + currency); diff --git a/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/ViewModelGP.java b/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/ViewModelGP.java index 598fd88..2eba1f2 100644 --- a/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/ViewModelGP.java +++ b/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/ViewModelGP.java @@ -40,7 +40,7 @@ public ViewModelGP(@NonNull Application application) { private void fetchCanUseGooglePay() { final JSONObject isReadyToPayJson = UtilGP.getIsReadyToPayRequest(); if (isReadyToPayJson == null) { - Log.e("logGooglePay" , "_canUseGooglePay isReadyToPayJson == null"); + // Log.e("logGooglePay" , "_canUseGooglePay isReadyToPayJson == null"); _canUseGooglePay.setValue(false); return; } @@ -51,16 +51,16 @@ private void fetchCanUseGooglePay() { Task task = paymentsClient.isReadyToPay(request); task.addOnCompleteListener( completedTask -> { - Log.e("logGooglePay" , "_canUseGooglePay completedTask = " + completedTask.toString()); + // Log.e("logGooglePay" , "_canUseGooglePay completedTask = " + completedTask.toString()); if (completedTask.isSuccessful()) { - Log.e("logGooglePay" , "_canUseGooglePay completedTask.isSuccessful"); + // Log.e("logGooglePay" , "_canUseGooglePay completedTask.isSuccessful"); _canUseGooglePay.setValue(completedTask.getResult()); } else { - Log.e("logGooglePay" , "_canUseGooglePay setValue(false)"); + // Log.e("logGooglePay" , "_canUseGooglePay setValue(false)"); Exception exception = completedTask.getException(); - Log.e("logGooglePay", "Error checking if ready to pay = " + exception); - Log.e("logGooglePay", "getCause = " + exception.getCause()); - Log.e("logGooglePay", "getMessage = " + exception.getMessage()); + // Log.e("logGooglePay", "Error checking if ready to pay = " + exception); + // Log.e("logGooglePay", "getCause = " + exception.getCause()); + // Log.e("logGooglePay", "getMessage = " + exception.getMessage()); _canUseGooglePay.setValue(false); } }); @@ -75,7 +75,7 @@ private void fetchCanUseGooglePay() { */ public Task getLoadPaymentDataTask(final long priceCents) { - Log.e("logGooglePay" , "getLoadPaymentDataTask"); + // Log.e("logGooglePay" , "getLoadPaymentDataTask"); JSONObject paymentDataRequestJson = UtilGP.getPaymentDataRequest(priceCents); diff --git a/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/WebActivity.java b/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/WebActivity.java index 0afdef3..03a0b5d 100644 --- a/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/WebActivity.java +++ b/molpayxdk/src/main/java/com/molpay/molpayxdk/googlepay/WebActivity.java @@ -53,7 +53,7 @@ public class WebActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Log.e("logGooglePay" , "WebActivity"); + // Log.e("logGooglePay" , "WebActivity"); setContentView(R.layout.activity_web); @@ -67,7 +67,7 @@ protected void onCreate(Bundle savedInstanceState) { paymentInputObj = new JSONObject(paymentInput); transaction.setVkey(paymentInputObj.getString("verificationKey")); isSandbox = paymentInputObj.getString("isSandbox"); - Log.e("logGooglePay" , "WebActivity isSandbox = " + isSandbox); + // Log.e("logGooglePay" , "WebActivity isSandbox = " + isSandbox); } catch (JSONException e) { e.printStackTrace(); } @@ -107,7 +107,7 @@ protected void onCreate(Bundle savedInstanceState) { @Override public void handleOnBackPressed() { // Do nothing - prevent user from performing backpress - Log.e("logGooglePay" , "WebActivity GP backpressed"); + // Log.e("logGooglePay" , "WebActivity GP backpressed"); } }; @@ -163,11 +163,11 @@ public void onTick(long millisUntilFinished) { Intent intent = new Intent(); intent.putExtra("response", String.valueOf(responseBodyObj)); - Log.e("logGooglePay" , "statCodeValue " + statCodeValue); + // Log.e("logGooglePay" , "statCodeValue " + statCodeValue); if (statCodeValue.equals("00")) { if (statCodeValueSuccess) { - Log.e("logGooglePay" , "statCodeValueSuccess finish"); + // Log.e("logGooglePay" , "statCodeValueSuccess finish"); onFinish(); } } else if (statCodeValue.equals("11")) { @@ -221,7 +221,7 @@ public void onFinish() { Intent intent = new Intent(); intent.putExtra("response", String.valueOf(responseBodyObj)); - Log.e("logGooglePay" , "onFinish response = " + String.valueOf(responseBodyObj)); + // Log.e("logGooglePay" , "onFinish response = " + String.valueOf(responseBodyObj)); // If timeout / cancel if (!responseBodyObj.has("StatCode")){ @@ -251,7 +251,7 @@ private void onLoadHtmlWebView(String plainHtml) { String encodedHtml = Base64.encodeToString(plainHtml.getBytes(), Base64.NO_PADDING); - Log.e("logGooglePay" , "plainHtml = " + plainHtml); + // Log.e("logGooglePay" , "plainHtml = " + plainHtml); if (plainHtml.contains("xdkHTMLRedirection")) { xdkHTMLRedirection = StringUtils.substringBetween(plainHtml, "xdkHTMLRedirection' value='", "'");