导航菜单

页面标题

页面副标题

Clash Legends v0.0.1 - CustomBrowser.java 源代码

正在查看: Clash Legends v0.0.1 应用的 CustomBrowser.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.payu.custombrowser;

import android.app.Activity;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Intent;
import android.os.Build;
import android.text.TextUtils;
import com.onesignal.core.internal.database.impl.OneSignalDbContract;
import com.payu.custombrowser.bean.CustomBrowserConfig;
import com.payu.custombrowser.bean.CustomBrowserResultData;
import com.payu.custombrowser.util.PaymentOption;
import com.payu.custombrowser.util.e;
import com.payu.payuanalytics.analytics.factory.AnalyticsFactory;
import com.payu.payuanalytics.analytics.model.AnalyticsType;
import com.payu.payuanalytics.analytics.model.PayUAnalytics;
import com.payu.upisdk.util.UpiConstant;

public class CustomBrowser {

    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 e) {
            }
            try {
                a[PaymentOption.PHONEPE.ordinal()] = 2;
            } catch (NoSuchFieldError e2) {
            }
            try {
                a[PaymentOption.TEZ.ordinal()] = 3;
            } catch (NoSuchFieldError e3) {
            }
            try {
                a[PaymentOption.UPI_INTENT.ordinal()] = 4;
            } catch (NoSuchFieldError e4) {
            }
            try {
                a[PaymentOption.UPI_TPV_COLLECT.ordinal()] = 5;
            } catch (NoSuchFieldError e5) {
            }
            try {
                a[PaymentOption.UPI_COLLECT.ordinal()] = 6;
            } catch (NoSuchFieldError e6) {
            }
        }
    }

    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.c.a(com.payu.custombrowser.util.b.UPI_SDK_PACKAGE, "7.8.0", com.payu.custombrowser.util.b.CB_VERSION);
        e.b("Class Name: " + getClass().getCanonicalName() + "< postdata >" + customBrowserConfig.getPayuPostData());
        bVar.a(activity, customBrowserConfig);
    }

    public void addCustomBrowser(Activity activity, CustomBrowserConfig customBrowserConfig, PayUCustomBrowserCallback payUCustomBrowserCallback) {
        com.payu.custombrowser.util.c.b(activity);
        PayUAnalytics payUAnalytics = (PayUAnalytics) new AnalyticsFactory(activity.getApplicationContext()).getAnalyticsClass(AnalyticsType.PAYU_ANALYTICS);
        payUAnalytics.log(com.payu.custombrowser.util.c.a(activity, "cb_config", customBrowserConfig.getAnalyticsString(), null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
        com.payu.custombrowser.bean.b bVar = com.payu.custombrowser.bean.b.SINGLETON;
        bVar.setPayuCustomBrowserCallback(payUCustomBrowserCallback);
        customBrowserConfig.setPayuPostData(new com.payu.custombrowser.util.c().b(customBrowserConfig.getPayuPostData()));
        PaymentOption g = new com.payu.custombrowser.util.c().g(customBrowserConfig.getPayuPostData());
        if (!TextUtils.isEmpty(customBrowserConfig.getReactVersion())) {
            payUAnalytics.log(com.payu.custombrowser.util.c.a(activity.getApplicationContext(), "react_version_name", customBrowserConfig.getReactVersion(), null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
        }
        e.b("Class Name: " + getClass().getCanonicalName() + "Payment option name:" + g);
        if (g != null) {
            e.b("Class Name: " + getClass().getCanonicalName() + "PaymentOptionName CB " + g.getPaymentName());
            if (g.isDefault()) {
                if (com.payu.custombrowser.util.c.a(g)) {
                    a(g, customBrowserConfig, activity);
                    return;
                } else {
                    payUCustomBrowserCallback.onCBErrorReceived(1022, g.getPackageName() + " is missing");
                    return;
                }
            }
            if (bVar.isPaymentOptionAvailabilityCalled(g)) {
                a(g, customBrowserConfig, activity);
                return;
            } else {
                payUAnalytics.log(com.payu.custombrowser.util.c.a(activity.getApplicationContext(), g.getAnalyticsKey().toLowerCase(), g.getAnalyticsKey().toLowerCase() + "_launch_failed", null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
                payUCustomBrowserCallback.onCBErrorReceived(1021, "Forget to call checkForPaymentAvailability for " + g.getPaymentName());
                return;
            }
        }
        if (customBrowserConfig.getPayuPostData() != null && customBrowserConfig.getEnableSurePay() > 0 && customBrowserConfig.getPostURL() != null && (customBrowserConfig.getPostURL().contentEquals("https://secure.payu.in/_payment") || customBrowserConfig.getPostURL().contentEquals("https://mobiletest.payu.in/_payment") || customBrowserConfig.getPostURL().contentEquals(com.payu.custombrowser.util.b.MOBILE_TEST_PAYMENT_URL_SEAMLESS) || customBrowserConfig.getPostURL().contentEquals(com.payu.custombrowser.util.b.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(com.payu.custombrowser.util.b.NOTIFICATION_CHANNEL_ID)) {
            a(activity);
        }
        CBActivity.f = customBrowserConfig.getCbMenuAdapter();
        CBActivity.h = customBrowserConfig.getToolBarView();
        CBActivity.i = customBrowserConfig.getProgressDialogCustomView();
        if (customBrowserConfig.getPayuPostData() != null) {
            payUAnalytics.log(com.payu.custombrowser.util.c.a(activity.getApplicationContext(), UpiConstant.PAYMENT_OPTION, new com.payu.custombrowser.util.c().c(customBrowserConfig.getPayuPostData()).get("bankcode"), null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
        }
        Intent intent = new Intent(activity, (Class<?>) CBActivity.class);
        intent.putExtra("cb_config", customBrowserConfig);
        if (customBrowserConfig.getReviewOrderDefaultViewData() != null && customBrowserConfig.getReviewOrderDefaultViewData().getReviewOrderDatas() != null) {
            intent.putExtra(com.payu.custombrowser.util.b.ORDER_DETAILS, customBrowserConfig.getReviewOrderDefaultViewData().getReviewOrderDatas());
        }
        activity.startActivity(intent);
    }

    public void checkForPaymentAvailability(Activity activity, PaymentOption paymentOption, 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.util.c.b(activity);
        com.payu.custombrowser.wrapper.b bVar2 = new com.payu.custombrowser.wrapper.b();
        switch (a.a[paymentOption.ordinal()]) {
            case 1:
                if (!com.payu.custombrowser.util.c.a(paymentOption)) {
                    payUCustomBrowserCallback.onCBErrorReceived(1022, com.payu.custombrowser.util.b.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.c.a(paymentOption)) {
                    payUCustomBrowserCallback.onCBErrorReceived(1022, com.payu.custombrowser.util.b.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:
                if (!com.payu.custombrowser.util.c.a(paymentOption)) {
                    payUCustomBrowserCallback.onCBErrorReceived(1022, com.payu.custombrowser.util.b.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;
                }
        }
    }

    private void a(Activity activity) {
        if (Build.VERSION.SDK_INT >= 26) {
            NotificationChannel notificationChannel = new NotificationChannel(com.payu.custombrowser.util.b.NOTIFICATION_CHANNEL_ID, "No Internet Notification", 3);
            notificationChannel.setDescription("No Internet Notification");
            NotificationManager notificationManager = (NotificationManager) activity.getSystemService(OneSignalDbContract.NotificationTable.TABLE_NAME);
            if (notificationManager != null) {
                notificationManager.createNotificationChannel(notificationChannel);
            }
        }
    }
}