正在查看: Hopscotch v9.7.2 应用的 CustomBrowser.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Hopscotch v9.7.2 应用的 CustomBrowser.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.payu.custombrowser;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.payu.custombrowser.bean.CustomBrowserConfig;
import com.payu.custombrowser.bean.CustomBrowserResultData;
import com.payu.custombrowser.util.CBConstant;
import com.payu.custombrowser.util.PaymentOption;
import com.payu.paymentparamhelper.PayuConstants;
import com.payu.upisdk.util.UpiConstant;
import java.util.HashMap;
public class CustomBrowser {
public static class a {
static final int[] a;
static {
int[] iArr = new int[PaymentOption.values().length];
a = iArr;
try {
iArr[PaymentOption.SAMSUNGPAY.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[PaymentOption.PHONEPE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[PaymentOption.TEZ.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[PaymentOption.UPI_INTENT.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
a[PaymentOption.UPI_TPV_COLLECT.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
a[PaymentOption.TEZ_OMNI.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
a[PaymentOption.UPI_COLLECT.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
}
}
private void a(@NonNull CustomBrowserConfig customBrowserConfig, com.payu.payuanalytics.analytics.model.g gVar, Context context, String str, String str2) {
try {
gVar.i(com.payu.custombrowser.util.b.a(context, str, str2, null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
} catch (Exception e) {
StringBuilder k = android.support.v4.media.d.k("Class analyticsLogging: key", str, " value", str2, " ");
k.append(e.getMessage());
com.payu.custombrowser.util.d.b(k.toString());
}
}
public void addCustomBrowser(Activity activity, HashMap<String, Object> hashMap, PayUCustomBrowserCallback payUCustomBrowserCallback) {
com.payu.custombrowser.parser.a d = new com.payu.custombrowser.parser.a(hashMap).d();
if (d.c()) {
addCustomBrowser(activity, d.a(), payUCustomBrowserCallback);
} else {
payUCustomBrowserCallback.onCBErrorReceived(5001, d.b());
}
}
public Fragment addSeamlessCustomBrowser(@NonNull CustomBrowserConfig customBrowserConfig, @NonNull PayUCustomBrowserCallback payUCustomBrowserCallback, Context context) {
com.payu.payuanalytics.analytics.model.g a2 = com.payu.custombrowser.a.a(context.getApplicationContext());
a(customBrowserConfig, a2, context, "cb_config", customBrowserConfig.getAnalyticsString());
com.payu.custombrowser.bean.b bVar = com.payu.custombrowser.bean.b.SINGLETON;
bVar.setPayuCustomBrowserCallback(payUCustomBrowserCallback);
customBrowserConfig.setPayuPostData(new com.payu.custombrowser.util.b().c(customBrowserConfig.getPayuPostData()));
PaymentOption i = new com.payu.custombrowser.util.b().i(customBrowserConfig.getPayuPostData());
if (!TextUtils.isEmpty(customBrowserConfig.getReactVersion())) {
a(customBrowserConfig, a2, context, "react_version_name", customBrowserConfig.getReactVersion());
}
com.payu.custombrowser.util.d.b("Class Name: " + getClass().getCanonicalName() + "Payment option name:" + i);
if (i == null) {
a(customBrowserConfig, a2, context, UpiConstant.PAYMENT_OPTION, "_paymentOptionName_is_null");
if (customBrowserConfig.getPayuPostData() != null && customBrowserConfig.getEnableSurePay() > 0 && customBrowserConfig.getPostURL() != null && (customBrowserConfig.getPostURL().contentEquals("https://secure.payu.in/_payment") || customBrowserConfig.getPostURL().contentEquals("https://test.payu.in/_payment") || customBrowserConfig.getPostURL().contentEquals(CBConstant.TEST_PAYMENT_URL_SEAMLESS) || customBrowserConfig.getPostURL().contentEquals(CBConstant.PRODUCTION_PAYMENT_URL_SEAMLESS))) {
if (customBrowserConfig.getPayuPostData().trim().endsWith("&")) {
customBrowserConfig.setPayuPostData(customBrowserConfig.getPayuPostData().substring(0, customBrowserConfig.getPayuPostData().length() - 1));
}
customBrowserConfig.setPayuPostData(customBrowserConfig.getPayuPostData() + "&snooze=" + customBrowserConfig.getEnableSurePay());
}
if (customBrowserConfig.getSurePayNotificationChannelId().equalsIgnoreCase(CBConstant.NOTIFICATION_CHANNEL_ID)) {
a(context);
}
CBFragment.cbConfigProgressDialogView = customBrowserConfig.getProgressDialogCustomView();
if (customBrowserConfig.getPayuPostData() != null) {
a2.i(com.payu.custombrowser.util.b.a(context.getApplicationContext(), UpiConstant.PAYMENT_OPTION, androidx.privacysandbox.ads.adservices.java.internal.a.o("bankcode_", new com.payu.custombrowser.util.b().e(customBrowserConfig.getPayuPostData()).get("bankcode")), null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
}
Bundle bundle = new Bundle();
bundle.putParcelable("cb_config", customBrowserConfig);
return CBFragment.newInstance(bundle);
}
com.payu.custombrowser.util.d.b("Class Name: " + getClass().getCanonicalName() + "PaymentOptionName CB " + i.getPaymentName());
if (!i.isDefault()) {
if (bVar.isPaymentOptionAvailabilityCalled(i)) {
a(customBrowserConfig, a2, context, UpiConstant.PAYMENT_OPTION, "_not_default");
return a(i, customBrowserConfig, context);
}
a(customBrowserConfig, a2, context, i.getAnalyticsKey().toLowerCase(), i.getAnalyticsKey().toLowerCase() + "_launch_failed");
StringBuilder sb = new StringBuilder("Forget to call checkForPaymentAvailability for ");
sb.append(i.getPaymentName());
payUCustomBrowserCallback.onCBErrorReceived(1021, sb.toString());
return null;
}
if (com.payu.custombrowser.util.b.a(i)) {
a(customBrowserConfig, a2, context, UpiConstant.PAYMENT_OPTION, PayuConstants.DEFAULT);
Log.v("analyticsLoggingCB", "analyticsLogging");
return a(i, customBrowserConfig, context);
}
a2.i(com.payu.custombrowser.util.b.a(context.getApplicationContext(), "1022_" + i.getAnalyticsKey().toLowerCase() + " is missing", i.getAnalyticsKey().toLowerCase() + "_launch_failed", null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
payUCustomBrowserCallback.onCBErrorReceived(1022, i.getPackageName() + " is missing");
return null;
}
public void checkForPaymentAvailability(Activity activity, @NonNull PaymentOption paymentOption, @NonNull PayUCustomBrowserCallback payUCustomBrowserCallback, String str, String str2, String str3) {
com.payu.custombrowser.bean.b bVar = com.payu.custombrowser.bean.b.SINGLETON;
bVar.setPayuCustomBrowserCallback(payUCustomBrowserCallback);
com.payu.custombrowser.wrapper.b bVar2 = new com.payu.custombrowser.wrapper.b();
switch (a.a[paymentOption.ordinal()]) {
case 1:
if (!com.payu.custombrowser.util.b.a(paymentOption)) {
payUCustomBrowserCallback.onCBErrorReceived(1022, CBConstant.DEVICE_NOT_SUPPORTED_OR + paymentOption.getPackageName() + " is missing");
break;
} else {
bVar2.a(activity, str, str2, str3, PaymentOption.SAMSUNGPAY.getPaymentName());
break;
}
case 2:
if (!com.payu.custombrowser.util.b.a(paymentOption)) {
payUCustomBrowserCallback.onCBErrorReceived(1022, CBConstant.DEVICE_NOT_SUPPORTED_OR + paymentOption.getPackageName() + " is missing");
break;
} else {
bVar2.a(activity, str, str2, str3, PaymentOption.PHONEPE.getPaymentName());
break;
}
case 3:
case 4:
case 5:
case 6:
case 7:
if (!com.payu.custombrowser.util.b.a(paymentOption)) {
payUCustomBrowserCallback.onCBErrorReceived(1022, CBConstant.DEVICE_NOT_SUPPORTED_OR + paymentOption.getPackageName() + " is missing");
break;
} else {
CustomBrowserResultData customBrowserResultData = new CustomBrowserResultData();
customBrowserResultData.setPaymentOption(paymentOption);
customBrowserResultData.setPaymentOptionAvailable(true);
bVar.setPaymentOption(paymentOption);
payUCustomBrowserCallback.isPaymentOptionAvailable(customBrowserResultData);
break;
}
}
}
public void addCustomBrowser(Activity activity, @NonNull CustomBrowserConfig customBrowserConfig, @NonNull PayUCustomBrowserCallback payUCustomBrowserCallback) {
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
com.payu.payuanalytics.analytics.model.g a2 = com.payu.custombrowser.a.a(activity.getApplicationContext());
a(customBrowserConfig, a2, activity, "cb_config", customBrowserConfig.getAnalyticsString());
com.payu.custombrowser.bean.b bVar = com.payu.custombrowser.bean.b.SINGLETON;
bVar.setPayuCustomBrowserCallback(payUCustomBrowserCallback);
customBrowserConfig.setPayuPostData(new com.payu.custombrowser.util.b().c(customBrowserConfig.getPayuPostData()));
PaymentOption i = new com.payu.custombrowser.util.b().i(customBrowserConfig.getPayuPostData());
if (!TextUtils.isEmpty(customBrowserConfig.getReactVersion())) {
a(customBrowserConfig, a2, activity, "react_version_name", customBrowserConfig.getReactVersion());
}
com.payu.custombrowser.util.d.b("Class Name: " + getClass().getCanonicalName() + "Payment option name:" + i);
if (i != null) {
com.payu.custombrowser.util.d.b("Class Name: " + getClass().getCanonicalName() + "PaymentOptionName CB " + i.getPaymentName());
if (i.isDefault()) {
if (com.payu.custombrowser.util.b.a(i)) {
a(customBrowserConfig, a2, activity, UpiConstant.PAYMENT_OPTION, PayuConstants.DEFAULT);
Log.v("analyticsLoggingCB", "analyticsLogging");
a(i, customBrowserConfig, activity);
return;
}
a2.i(com.payu.custombrowser.util.b.a(activity.getApplicationContext(), "1022_" + i.getAnalyticsKey().toLowerCase() + " is missing", i.getAnalyticsKey().toLowerCase() + "_launch_failed", null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
payUCustomBrowserCallback.onCBErrorReceived(1022, i.getPackageName() + " is missing");
return;
}
if (bVar.isPaymentOptionAvailabilityCalled(i)) {
a(customBrowserConfig, a2, activity, UpiConstant.PAYMENT_OPTION, "_not_default");
a(i, customBrowserConfig, activity);
return;
}
a(customBrowserConfig, a2, activity, i.getAnalyticsKey().toLowerCase(), i.getAnalyticsKey().toLowerCase() + "_launch_failed");
StringBuilder sb = new StringBuilder("Forget to call checkForPaymentAvailability for ");
sb.append(i.getPaymentName());
payUCustomBrowserCallback.onCBErrorReceived(1021, sb.toString());
return;
}
a(customBrowserConfig, a2, activity, UpiConstant.PAYMENT_OPTION, "_paymentOptionName_is_null");
if (customBrowserConfig.getPayuPostData() != null && customBrowserConfig.getEnableSurePay() > 0 && customBrowserConfig.getPostURL() != null && (customBrowserConfig.getPostURL().contentEquals("https://secure.payu.in/_payment") || customBrowserConfig.getPostURL().contentEquals("https://test.payu.in/_payment") || customBrowserConfig.getPostURL().contentEquals(CBConstant.TEST_PAYMENT_URL_SEAMLESS) || customBrowserConfig.getPostURL().contentEquals(CBConstant.PRODUCTION_PAYMENT_URL_SEAMLESS))) {
if (customBrowserConfig.getPayuPostData().trim().endsWith("&")) {
customBrowserConfig.setPayuPostData(customBrowserConfig.getPayuPostData().substring(0, customBrowserConfig.getPayuPostData().length() - 1));
}
customBrowserConfig.setPayuPostData(customBrowserConfig.getPayuPostData() + "&snooze=" + customBrowserConfig.getEnableSurePay());
}
if (customBrowserConfig.getSurePayNotificationChannelId().equalsIgnoreCase(CBConstant.NOTIFICATION_CHANNEL_ID)) {
a(activity);
}
CBActivity.f = customBrowserConfig.getCbMenuAdapter();
CBActivity.g = customBrowserConfig.getToolBarView();
CBActivity.h = customBrowserConfig.getProgressDialogCustomView();
if (customBrowserConfig.getPayuPostData() != null) {
a2.i(com.payu.custombrowser.util.b.a(activity.getApplicationContext(), UpiConstant.PAYMENT_OPTION, androidx.privacysandbox.ads.adservices.java.internal.a.o("bankcode_", new com.payu.custombrowser.util.b().e(customBrowserConfig.getPayuPostData()).get("bankcode")), null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
}
Intent intent = new Intent(activity, (Class<?>) CBActivity.class);
intent.putExtra("cb_config", customBrowserConfig);
activity.startActivity(intent);
return;
}
payUCustomBrowserCallback.onCBErrorReceived(105, CBConstant.ACTIVITY_NOT_FOUND);
}
private void a(PaymentOption paymentOption, CustomBrowserConfig customBrowserConfig, Activity activity) {
com.payu.custombrowser.wrapper.b bVar = new com.payu.custombrowser.wrapper.b();
customBrowserConfig.setPaymentType(paymentOption.getPaymentName());
com.payu.custombrowser.util.b.a(CBConstant.UPI_SDK_PACKAGE, "7.13.3", CBConstant.CB_VERSION);
com.payu.custombrowser.util.d.b("Class Name: " + getClass().getCanonicalName() + "< postdata >" + customBrowserConfig.getPayuPostData());
bVar.a(activity, customBrowserConfig);
}
private Fragment a(PaymentOption paymentOption, CustomBrowserConfig customBrowserConfig, Context context) {
com.payu.custombrowser.wrapper.b bVar = new com.payu.custombrowser.wrapper.b();
customBrowserConfig.setPaymentType(paymentOption.getPaymentName());
com.payu.custombrowser.util.b.a(CBConstant.UPI_SDK_PACKAGE, "7.13.3", CBConstant.CB_VERSION);
com.payu.custombrowser.util.d.b("Class Name: " + getClass().getCanonicalName() + "< postdata >" + customBrowserConfig.getPayuPostData());
return bVar.a(customBrowserConfig, context);
}
@TargetApi(26)
private void a(Context context) {
if (Build.VERSION.SDK_INT >= 26) {
NotificationChannel notificationChannel = new NotificationChannel(CBConstant.NOTIFICATION_CHANNEL_ID, "No Internet Notification", 3);
notificationChannel.setDescription("No Internet Notification");
NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
if (notificationManager != null) {
notificationManager.createNotificationChannel(notificationChannel);
}
}
}
}