导航菜单

页面标题

页面副标题

OLX India v19.42.007 - CustomBrowser.java 源代码

正在查看: OLX India v19.42.007 应用的 CustomBrowser.java JAVA 源代码文件

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


package com.payu.custombrowser;

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.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.otpassist.utils.Constants;
import com.payu.payuanalytics.analytics.model.PayUAnalytics;
import com.payu.upisdk.util.UpiConstant;
import java.util.HashMap;

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 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 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.G(CBConstant.UPI_SDK_PACKAGE, "7.15.2", CBConstant.CB_VERSION);
        com.payu.custombrowser.util.d.c("Class Name: " + getClass().getCanonicalName() + "< postdata >" + customBrowserConfig.getPayuPostData());
        return bVar.a(customBrowserConfig, context);
    }

    private void b(Context context) {
        if (Build.VERSION.SDK_INT >= 26) {
            NotificationChannel a2 = com.clevertap.android.pushtemplates.t.a(CBConstant.NOTIFICATION_CHANNEL_ID, "No Internet Notification", 3);
            com.clevertap.android.pushtemplates.o.a(a2, "No Internet Notification");
            NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
            if (notificationManager != null) {
                com.clevertap.android.pushtemplates.q.a(notificationManager, a2);
            }
        }
    }

    private void c(CustomBrowserConfig customBrowserConfig, PayUAnalytics payUAnalytics, Context context, String str, String str2) {
        try {
            payUAnalytics.log(com.payu.custombrowser.util.b.k(context, str, str2, null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
        } catch (Exception e) {
            com.payu.custombrowser.util.d.c("Class analyticsLogging: key" + str + " value" + str2 + " " + e.getMessage());
        }
    }

    private void d(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.G(CBConstant.UPI_SDK_PACKAGE, "7.15.2", CBConstant.CB_VERSION);
        com.payu.custombrowser.util.d.c("Class Name: " + getClass().getCanonicalName() + "< postdata >" + customBrowserConfig.getPayuPostData());
        bVar.d(activity, customBrowserConfig);
    }

    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(CBConstant.errorCodes.MISSING_PARAMETER_EXCEPTION, d.b());
        }
    }

    public Fragment addSeamlessCustomBrowser(CustomBrowserConfig customBrowserConfig, PayUCustomBrowserCallback payUCustomBrowserCallback, Context context) {
        PayUAnalytics a2 = l0.a(context.getApplicationContext());
        c(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().W(customBrowserConfig.getPayuPostData()));
        PaymentOption r0 = new com.payu.custombrowser.util.b().r0(customBrowserConfig.getPayuPostData());
        if (!TextUtils.isEmpty(customBrowserConfig.getReactVersion())) {
            c(customBrowserConfig, a2, context, "react_version_name", customBrowserConfig.getReactVersion());
        }
        com.payu.custombrowser.util.d.c("Class Name: " + getClass().getCanonicalName() + "Payment option name:" + r0);
        if (r0 == null) {
            c(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(CBConstant.TEST_PAYMENT_URL) || customBrowserConfig.getPostURL().contentEquals(CBConstant.TEST_PAYMENT_URL_SEAMLESS) || customBrowserConfig.getPostURL().contentEquals(CBConstant.PRODUCTION_PAYMENT_URL_SEAMLESS))) {
                if (customBrowserConfig.getPayuPostData().trim().endsWith(Constants.AMPERSAND)) {
                    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)) {
                b(context);
            }
            CBFragment.cbConfigProgressDialogView = customBrowserConfig.getProgressDialogCustomView();
            if (customBrowserConfig.getPayuPostData() != null) {
                String str = (String) new com.payu.custombrowser.util.b().g0(customBrowserConfig.getPayuPostData()).get("bankcode");
                a2.log(com.payu.custombrowser.util.b.k(context.getApplicationContext(), UpiConstant.PAYMENT_OPTION, "bankcode_" + str, null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
            }
            Bundle bundle = new Bundle();
            bundle.putParcelable("cb_config", customBrowserConfig);
            return CBFragment.newInstance(bundle);
        }
        com.payu.custombrowser.util.d.c("Class Name: " + getClass().getCanonicalName() + "PaymentOptionName CB " + r0.getPaymentName());
        if (!r0.isDefault()) {
            if (bVar.isPaymentOptionAvailabilityCalled(r0)) {
                c(customBrowserConfig, a2, context, UpiConstant.PAYMENT_OPTION, "_not_default");
                return a(r0, customBrowserConfig, context);
            }
            c(customBrowserConfig, a2, context, r0.getAnalyticsKey().toLowerCase(), r0.getAnalyticsKey().toLowerCase() + "_launch_failed");
            payUCustomBrowserCallback.onCBErrorReceived(1021, "Forget to call checkForPaymentAvailability for " + r0.getPaymentName());
            return null;
        }
        if (com.payu.custombrowser.util.b.J(r0)) {
            c(customBrowserConfig, a2, context, UpiConstant.PAYMENT_OPTION, "default");
            Log.v("analyticsLoggingCB", "analyticsLogging");
            return a(r0, customBrowserConfig, context);
        }
        a2.log(com.payu.custombrowser.util.b.k(context.getApplicationContext(), "1022_" + r0.getAnalyticsKey().toLowerCase() + " is missing", r0.getAnalyticsKey().toLowerCase() + "_launch_failed", null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
        payUCustomBrowserCallback.onCBErrorReceived(1022, r0.getPackageName() + " is missing");
        return null;
    }

    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.wrapper.b bVar2 = new com.payu.custombrowser.wrapper.b();
        switch (a.a[paymentOption.ordinal()]) {
            case 1:
                if (!com.payu.custombrowser.util.b.J(paymentOption)) {
                    payUCustomBrowserCallback.onCBErrorReceived(1022, CBConstant.DEVICE_NOT_SUPPORTED_OR + paymentOption.getPackageName() + " is missing");
                    break;
                } else {
                    bVar2.e(activity, str, str2, str3, PaymentOption.SAMSUNGPAY.getPaymentName());
                    break;
                }
            case 2:
                if (!com.payu.custombrowser.util.b.J(paymentOption)) {
                    payUCustomBrowserCallback.onCBErrorReceived(1022, CBConstant.DEVICE_NOT_SUPPORTED_OR + paymentOption.getPackageName() + " is missing");
                    break;
                } else {
                    bVar2.e(activity, str, str2, str3, PaymentOption.PHONEPE.getPaymentName());
                    break;
                }
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
                if (!com.payu.custombrowser.util.b.J(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, CustomBrowserConfig customBrowserConfig, PayUCustomBrowserCallback payUCustomBrowserCallback) {
        if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
            PayUAnalytics a2 = l0.a(activity.getApplicationContext());
            c(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().W(customBrowserConfig.getPayuPostData()));
            PaymentOption r0 = new com.payu.custombrowser.util.b().r0(customBrowserConfig.getPayuPostData());
            if (!TextUtils.isEmpty(customBrowserConfig.getReactVersion())) {
                c(customBrowserConfig, a2, activity, "react_version_name", customBrowserConfig.getReactVersion());
            }
            com.payu.custombrowser.util.d.c("Class Name: " + getClass().getCanonicalName() + "Payment option name:" + r0);
            if (r0 != null) {
                com.payu.custombrowser.util.d.c("Class Name: " + getClass().getCanonicalName() + "PaymentOptionName CB " + r0.getPaymentName());
                if (r0.isDefault()) {
                    if (com.payu.custombrowser.util.b.J(r0)) {
                        c(customBrowserConfig, a2, activity, UpiConstant.PAYMENT_OPTION, "default");
                        Log.v("analyticsLoggingCB", "analyticsLogging");
                        d(r0, customBrowserConfig, activity);
                        return;
                    }
                    a2.log(com.payu.custombrowser.util.b.k(activity.getApplicationContext(), "1022_" + r0.getAnalyticsKey().toLowerCase() + " is missing", r0.getAnalyticsKey().toLowerCase() + "_launch_failed", null, customBrowserConfig.getMerchantKey(), customBrowserConfig.getTransactionID(), null));
                    payUCustomBrowserCallback.onCBErrorReceived(1022, r0.getPackageName() + " is missing");
                    return;
                }
                if (bVar.isPaymentOptionAvailabilityCalled(r0)) {
                    c(customBrowserConfig, a2, activity, UpiConstant.PAYMENT_OPTION, "_not_default");
                    d(r0, customBrowserConfig, activity);
                    return;
                }
                c(customBrowserConfig, a2, activity, r0.getAnalyticsKey().toLowerCase(), r0.getAnalyticsKey().toLowerCase() + "_launch_failed");
                payUCustomBrowserCallback.onCBErrorReceived(1021, "Forget to call checkForPaymentAvailability for " + r0.getPaymentName());
                return;
            }
            c(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(CBConstant.TEST_PAYMENT_URL) || customBrowserConfig.getPostURL().contentEquals(CBConstant.TEST_PAYMENT_URL_SEAMLESS) || customBrowserConfig.getPostURL().contentEquals(CBConstant.PRODUCTION_PAYMENT_URL_SEAMLESS))) {
                if (customBrowserConfig.getPayuPostData().trim().endsWith(Constants.AMPERSAND)) {
                    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)) {
                b(activity);
            }
            CBActivity.V = customBrowserConfig.getCbMenuAdapter();
            CBActivity.W = customBrowserConfig.getToolBarView();
            CBActivity.X = customBrowserConfig.getProgressDialogCustomView();
            if (customBrowserConfig.getPayuPostData() != null) {
                String str = (String) new com.payu.custombrowser.util.b().g0(customBrowserConfig.getPayuPostData()).get("bankcode");
                a2.log(com.payu.custombrowser.util.b.k(activity.getApplicationContext(), UpiConstant.PAYMENT_OPTION, "bankcode_" + str, 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(CBConstant.ACTIVITY_NOT_FOUND_CODE, CBConstant.ACTIVITY_NOT_FOUND);
    }
}