导航菜单

页面标题

页面副标题

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

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

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


package com.payu.upisdk.upiintent;

import android.app.AlertDialog;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.r;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import com.payu.otpassist.utils.Constants;
import com.payu.payuanalytics.analytics.model.PayUAnalytics;
import com.payu.socketverification.socket.SocketHandler;
import com.payu.socketverification.socket.SocketPaymentResponse;
import com.payu.socketverification.util.PayUNetworkConstant;
import com.payu.socketverification.widgets.PayUProgressDialog;
import com.payu.ui.model.utils.AnalyticsConstant;
import com.payu.upisdk.PaymentOption;
import com.payu.upisdk.Upi;
import com.payu.upisdk.bean.UpiConfig;
import com.payu.upisdk.callbacks.OnBackButtonListener;
import com.payu.upisdk.callbacks.PayUUPICallback;
import com.payu.upisdk.callbacks.WebViewListener;
import com.payu.upisdk.upi.a;
import com.payu.upisdk.util.PayUUpiUtil;
import com.payu.upisdk.util.UpiConstant;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.net.ssl.HttpsURLConnection;

public class PaymentResponseUpiSdkFragment extends Fragment implements com.payu.upisdk.upiinterface.a, WebViewListener, OnBackButtonListener {
    public static String r;
    public d a;
    public String b;
    public ArrayList<com.payu.upisdk.upiintent.a> c;
    public ArrayList<com.payu.upisdk.upiintent.a> d;
    public PayUAnalytics e;
    public String f;
    public PaymentOption g;
    public WebView h;
    public UpiConfig i;
    public e k;
    public com.payu.upisdk.upi.a n;
    public PayUProgressDialog o;
    public SocketPaymentResponse p;
    public AlertDialog q;
    public Boolean j = Boolean.FALSE;
    public String l = "";
    public int m = 0;

    public class a implements View.OnKeyListener {
        public a() {
        }

        @Override
        public boolean onKey(View view, int i, KeyEvent keyEvent) {
            if (keyEvent.getAction() != 1 || i != 4) {
                return false;
            }
            PaymentResponseUpiSdkFragment.this.onBackButtonClicked();
            return true;
        }
    }

    public class b extends WebViewClient {

        public class a implements View.OnKeyListener {
            public a() {
            }

            @Override
            public boolean onKey(View view, int i, KeyEvent keyEvent) {
                if (keyEvent.getAction() != 1 || i != 4) {
                    return false;
                }
                PaymentResponseUpiSdkFragment.this.onBackButtonClicked();
                return true;
            }
        }

        public b() {
        }

        @Override
        public void doUpdateVisitedHistory(WebView webView, String str, boolean z) {
            webView.setFocusableInTouchMode(true);
            webView.requestFocus();
            webView.setOnKeyListener(new a());
            super.doUpdateVisitedHistory(webView, str, z);
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            super.onPageFinished(webView, str);
            PaymentResponseUpiSdkFragment.this.a("upiCollect_onPageFinished", str);
            PaymentResponseUpiSdkFragment paymentResponseUpiSdkFragment = PaymentResponseUpiSdkFragment.this;
            PayUProgressDialog payUProgressDialog = paymentResponseUpiSdkFragment.o;
            if (payUProgressDialog == null || !payUProgressDialog.isShowing()) {
                return;
            }
            paymentResponseUpiSdkFragment.o.dismiss();
            paymentResponseUpiSdkFragment.o = null;
        }

        @Override
        public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            super.onPageStarted(webView, str, bitmap);
            PaymentResponseUpiSdkFragment.this.a("upiCollect_onPageStarted", str);
        }

        @Override
        public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
            super.onReceivedError(webView, webResourceRequest, webResourceError);
            if (webResourceRequest == null || webResourceRequest.getUrl() == null) {
                return;
            }
            PaymentResponseUpiSdkFragment.this.a("upiCollect_onReceivedError", webResourceRequest.getUrl().toString());
        }

        @Override
        public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
            super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
            if (webResourceRequest == null || webResourceRequest.getUrl() == null) {
                return;
            }
            PaymentResponseUpiSdkFragment.this.a("upiCollect_onReceivedHttpError", webResourceRequest.getUrl().toString());
        }

        @Override
        public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
            super.onReceivedSslError(webView, sslErrorHandler, sslError);
            if (sslError == null || sslError.getUrl() == null) {
                return;
            }
            PaymentResponseUpiSdkFragment.this.a("upiCollect_onReceivedSslError", sslError.getUrl());
        }
    }

    public class c implements Runnable {
        public c() {
        }

        @Override
        public void run() {
            String str;
            try {
                StringBuilder sb = new StringBuilder();
                HttpsURLConnection httpsURLConnection = null;
                try {
                    String cookie = CookieManager.getInstance().getCookie("https://secure.payu.in");
                    if (cookie != null) {
                        for (String str2 : cookie.split(";")) {
                            String[] split = str2.split(Constants.EQUALS);
                            sb.append(split[0]);
                            sb.append(Constants.EQUALS);
                            sb.append(split[1]);
                            sb.append(";");
                        }
                    }
                    if (sb.length() > 0) {
                        sb = new StringBuilder(sb.substring(0, sb.length() - 1));
                    }
                    str = sb.toString();
                } catch (Exception e) {
                    com.payu.upisdk.util.a.c("Class Name: " + com.payu.upisdk.util.c.class.getCanonicalName() + "getCookieList exception " + e.getMessage());
                    str = null;
                }
                try {
                    HttpsURLConnection httpsURLConnection2 = (HttpsURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(new URL("https://secure.payu.in/paytxn").openConnection()));
                    httpsURLConnection2.setRequestMethod("POST");
                    httpsURLConnection2.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                    if (str != null) {
                        httpsURLConnection2.setRequestProperty("Cookie", str);
                    }
                    httpsURLConnection2.setSSLSocketFactory(new com.payu.upisdk.util.b());
                    httpsURLConnection2.setDoOutput(true);
                    httpsURLConnection = httpsURLConnection2;
                } catch (Exception unused) {
                }
                if (httpsURLConnection.getResponseCode() != 200) {
                    com.payu.upisdk.util.a.c("BackButtonClick - UnSuccessful post to Paytxn");
                    PaymentResponseUpiSdkFragment.this.a("post_pay_txn", UpiConstant.SUCCESS);
                } else {
                    com.payu.upisdk.util.a.c("BackButtonClick - Successful post to Paytxn");
                    PaymentResponseUpiSdkFragment.this.a("post_pay_txn", UpiConstant.FAILURE);
                }
            } catch (Exception e2) {
                com.payu.upisdk.util.a.c("BackButtonClick Exception - " + e2.getMessage());
                PaymentResponseUpiSdkFragment.this.a("post_pay_txn_exception", UpiConstant.FAILURE);
            }
        }
    }

    public void h5(String str, String str2) {
        if (str.equals("success")) {
            com.payu.upisdk.k kVar = com.payu.upisdk.k.SINGLETON;
            if (kVar.f != null) {
                a("socket_trxn_status_upi_sdk", "success_transaction");
                kVar.f.onPaymentSuccess(str2, null);
            } else {
                com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Upi callback class should not be null onPaymentSuccess");
            }
        } else {
            com.payu.upisdk.k kVar2 = com.payu.upisdk.k.SINGLETON;
            if (kVar2.f != null) {
                a("socket_trxn_status_upi_sdk", "failure_transaction");
                kVar2.f.onPaymentFailure(str2, null);
            } else {
                com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Upi callback class should not be null onPaymentFailure");
            }
        }
        PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
        if (payUUPICallback != null) {
            payUUPICallback.onBackApprove();
        }
    }

    public static PaymentResponseUpiSdkFragment newInstance(Bundle bundle) {
        PaymentResponseUpiSdkFragment paymentResponseUpiSdkFragment = new PaymentResponseUpiSdkFragment();
        paymentResponseUpiSdkFragment.setArguments(bundle);
        return paymentResponseUpiSdkFragment;
    }

    public final void a() {
        this.n = new com.payu.upisdk.upi.a(getActivity(), this.e, this.i, this);
        WebView webView = this.h;
        if (webView != null) {
            webView.getSettings().setJavaScriptEnabled(true);
            this.h.addJavascriptInterface(this.n, "PayU");
            this.h.setVisibility(8);
            this.h.setWebViewClient(new b());
        }
    }

    public final void b() {
        if (this.o == null) {
            this.o = new PayUProgressDialog(getContext(), com.payu.upisdk.k.SINGLETON.a);
        }
        this.o.setCancelable(false);
        if (com.payu.upisdk.k.SINGLETON.a == null) {
            this.o.setPayUDialogSettings(getContext());
            this.o.show();
        }
    }

    public final void c(String str, String str2) {
        com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "URL web " + str);
        com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Postdata web " + str2);
        if (this.h != null) {
            getActivity().getWindow().setLayout(-1, -1);
            this.h.setVisibility(0);
            a("upiCollect_postUrlWebView", str);
            this.h.postUrl(str, str2.getBytes());
        }
    }

    public void errorReceived(int i, String str) {
        com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Error Received " + str);
        StringBuilder sb = new StringBuilder();
        sb.append("technical_error_&_error_message: ");
        sb.append(str);
        a("socket_cancel", sb.toString());
        if (i == 1003) {
            d dVar = this.a;
            if (dVar != null) {
                dVar.l("cancel", "Technical Error");
                return;
            }
            return;
        }
        PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
        if (payUUPICallback != null) {
            payUUPICallback.onUpiErrorReceived(i, str);
            return;
        }
        com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Upi callback class should not be null onPaymentSuccess");
    }

    public void getSocketResult(String str, final String str2, final String str3, boolean z) {
        a.c cVar = new a.c() {
            @Override
            public final void run() {
                PaymentResponseUpiSdkFragment.this.h5(str3, str2);
            }
        };
        com.payu.upisdk.upi.a aVar = this.n;
        if (aVar == null) {
            cVar.run();
        } else {
            aVar.i = cVar;
            aVar.d();
        }
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        SocketPaymentResponse socketPaymentResponse;
        super.onActivityResult(i, i2, intent);
        a(this.g.getAnalyticsKey().toLowerCase() + " ", "ResultCode" + i2 + "_|_data_" + intent);
        if (i == 101) {
            com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Result code " + i2 + " Data  " + intent);
            this.m = i2;
            String str = null;
            String stringExtra = (intent == null || !intent.hasExtra("response")) ? null : intent.getStringExtra("response");
            if (i2 != -1 || intent == null) {
                a("cancel", UpiConstant.CUSTOMER_CANCELLED_ON_PSP_APP + "_&_requestCode_" + i2);
                StringBuilder sb = new StringBuilder();
                sb.append("Class Name: ");
                sb.append(getClass().getCanonicalName());
                sb.append("Cancel return");
                com.payu.upisdk.util.a.c(sb.toString());
                this.a.l("cancel", UpiConstant.CUSTOMER_CANCELLED_ON_PSP_APP);
                return;
            }
            if (intent.hasExtra(AnalyticsConstant.CP_GV_STATUS)) {
                str = intent.getStringExtra(AnalyticsConstant.CP_GV_STATUS);
            } else if (intent.hasExtra("response")) {
                str = (String) com.payu.upisdk.util.c.p(intent.getStringExtra("response")).get(AnalyticsConstant.CP_GV_STATUS);
            }
            PaymentOption paymentOption = this.g;
            if (paymentOption != null && paymentOption.getAnalyticsKey() != null) {
                a(this.g.getAnalyticsKey().toLowerCase() + " _payment_app_response", "Status_" + str + "_|_payment_app_response_" + stringExtra);
            }
            if (str != null && !str.equalsIgnoreCase(UpiConstant.SUCCESS) && !str.equalsIgnoreCase(UpiConstant.SUBMITTED)) {
                com.payu.upisdk.util.a.c("Payment App response " + str);
                this.l = UpiConstant.GET_RESPONSE_FROM_PSP;
                this.a.l(UpiConstant.FAILURE, UpiConstant.GET_RESPONSE_FROM_PSP);
                return;
            }
            com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Return " + UpiConstant.FAILURE);
            String str2 = this.l;
            a(PayUNetworkConstant.UPI_SOCKET, "push_enabled");
            e eVar = this.k;
            if (eVar == null || (socketPaymentResponse = eVar.o) == null || socketPaymentResponse.getUpiPushDisabled() == null || !this.k.o.getUpiPushDisabled().equals("0")) {
                a("long_polling_from", "verify_using_http");
                this.a.l(UpiConstant.FAILURE, str2);
                return;
            }
            a("verify_type", "socket");
            SocketPaymentResponse socketPaymentResponse2 = new SocketPaymentResponse();
            this.p = socketPaymentResponse2;
            e eVar2 = this.k;
            if (eVar2 != null) {
                socketPaymentResponse2.setReferenceId(eVar2.d);
                UpiConfig upiConfig = this.i;
                if (upiConfig != null && upiConfig.getTransactionID() != null) {
                    this.p.setTxnId(this.i.getTransactionID());
                }
                this.p.setUpiPushDisabled(this.k.o.getUpiPushDisabled());
                this.p.setUpiServicePollInterval(this.k.o.getUpiServicePollInterval());
                this.p.setSdkUpiPushExpiry(this.k.o.getSdkUpiPushExpiry());
                this.p.setSdkUpiVerificationInterval(this.k.o.getSdkUpiVerificationInterval());
                this.p.setPushServiceUrl(this.k.o.getPushServiceUrl());
            }
            SocketPaymentResponse socketPaymentResponse3 = this.p;
            if (socketPaymentResponse3 == null || socketPaymentResponse3.getTxnId() == null) {
                return;
            }
            SocketHandler.getInstance().createSocket(this.p, requireActivity(), new i(this));
        }
    }

    @Override
    public void onAppSelected(String str, String str2) {
        PaymentOption paymentOption;
        if (this.i != null && (paymentOption = this.g) != null && paymentOption.getAnalyticsKey() != null) {
            a(this.g.getAnalyticsKey().toLowerCase() + "_payment_app", "packageName_" + str + "_version_name_" + str2);
        }
        this.a.h(str, this);
    }

    @Override
    public void onBackButtonClicked() {
        AlertDialog.Builder a2 = com.payu.upisdk.util.c.a(getActivity(), new k(this), Constants.PAYU_OK, "Cancel", null, getString(com.payu.upisdk.h.do_you_really_want_to_cancel_the_transaction));
        PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
        if (payUUPICallback != null) {
            payUUPICallback.onBackButton(a2);
            AlertDialog create = a2.create();
            this.q = create;
            create.show();
        }
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View inflate = layoutInflater.inflate(com.payu.upisdk.g.fragmen_payment_response, viewGroup, false);
        this.h = (WebView) inflate.findViewById(com.payu.upisdk.e.wvCollect);
        return inflate;
    }

    public void onDestroy() {
        super.onDestroy();
        Boolean bool = Boolean.FALSE;
        a(bool, bool);
    }

    public void onDestroyView() {
        super.onDestroyView();
        com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "OnDestroy ");
        SocketHandler.getInstance().onActivityDestroyed(getActivity());
        d dVar = this.a;
        if (dVar != null) {
            dVar.c();
        }
        AlertDialog alertDialog = this.q;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
        PayUProgressDialog payUProgressDialog = this.o;
        if (payUProgressDialog != null) {
            if (payUProgressDialog.isShowing()) {
                this.o.dismiss();
            }
            this.o = null;
        }
        com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Is recreating " + Upi.isRecreating);
        if (Upi.isRecreating) {
            Upi.isRecreating = false;
        } else {
            PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
            if (payUUPICallback != null) {
                payUUPICallback.onPaymentTerminate();
            }
        }
        PayUUpiUtil.updateLayoutSecurity(requireActivity(), Boolean.FALSE);
    }

    @Override
    public void onDialogCancelled(boolean z, String str) {
        PaymentOption paymentOption;
        PaymentOption paymentOption2;
        if (!z) {
            if (this.i != null && (paymentOption = this.g) != null && paymentOption.getAnalyticsKey() != null) {
                a(this.g.getAnalyticsKey().toLowerCase(), "No Upi apps present and collect disabled.");
            }
            this.a.l("failure", "No Upi apps present and collect disabled.");
            return;
        }
        if (this.m != -1) {
            this.a.l("cancel", str);
        }
        if (this.i == null || (paymentOption2 = this.g) == null || paymentOption2.getAnalyticsKey() == null) {
            return;
        }
        a(this.g.getAnalyticsKey().toLowerCase(), "back_button_cancel_statusCode: " + this.m + " | cancelReason: " + str);
    }

    public void onPause() {
        super.onPause();
        Boolean bool = Boolean.FALSE;
        a(bool, bool);
        SocketHandler.getInstance().onActivityPaused(getActivity());
    }

    @Override
    public void onPaymentFinished() {
    }

    @Override
    public void onResponse(e eVar) {
        ArrayList<com.payu.upisdk.upiintent.a> arrayList;
        this.k = eVar;
        if (eVar == null) {
            a("paymentResponse_null");
            return;
        }
        if (TextUtils.isEmpty(eVar.b) || TextUtils.isEmpty(this.k.c) || TextUtils.isEmpty(this.k.d)) {
            if (eVar.n != 0 || !TextUtils.isEmpty(eVar.l)) {
                a("paymentStatus_zero_&_paymentResult_blank");
                return;
            }
            String n = com.payu.upisdk.util.c.n(eVar.l);
            if (n == null) {
                a("base64Response_null");
                return;
            }
            PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
            if (payUUPICallback != null) {
                payUUPICallback.onPaymentFailure(n, null);
                return;
            }
            return;
        }
        PaymentOption paymentOption = this.g;
        if (paymentOption == PaymentOption.TEZ) {
            this.a.h("com.google.android.apps.nbu.paisa.user", this);
            return;
        }
        if (paymentOption != PaymentOption.UPI_INTENT && paymentOption != PaymentOption.UPI_INTENT_TPV) {
            a("invalid_response");
            return;
        }
        if (this.j.booleanValue()) {
            a("activity", "activity_finished");
            return;
        }
        if (this.i.getPackageNameForSpecificApp() != null && this.i.getPackageNameForSpecificApp().length() > 0) {
            onAppSelected(this.i.getPackageNameForSpecificApp(), com.payu.upisdk.util.c.e(this.i.getPackageNameForSpecificApp(), getContext()));
            return;
        }
        r = eVar.b;
        this.d = new ArrayList<>();
        List list = eVar.i;
        if (list != null && list.size() > 0) {
            for (com.payu.upisdk.upiintent.a aVar : eVar.i) {
                Iterator<com.payu.upisdk.upiintent.a> it = this.c.iterator();
                while (it.hasNext()) {
                    com.payu.upisdk.upiintent.a next = it.next();
                    if (next.equals(aVar)) {
                        next.a = aVar.a;
                        this.d.add(next);
                        it.remove();
                    }
                }
            }
        }
        ArrayList<com.payu.upisdk.upiintent.a> arrayList2 = this.d;
        if (arrayList2 != null && (arrayList = this.c) != null) {
            arrayList2.addAll(arrayList);
        }
        com.payu.upisdk.a i5 = com.payu.upisdk.a.i5(this.d, eVar, this.i, this);
        i5.setStyle(0, com.payu.upisdk.i.UpiSdkFullScreenDialogStyle);
        i5.setRetainInstance(true);
        i5.show(getActivity().getSupportFragmentManager(), "packageList");
        this.j = Boolean.TRUE;
        a("_payment_app", "show_PackageListDialog");
    }

    public void onResume() {
        super.onResume();
        Boolean bool = Boolean.TRUE;
        a(bool, bool);
    }

    public void onSocketCreated() {
        SocketHandler.getInstance().startSocketEvents(this.i.getMerchantKey(), this.i.getTransactionID(), new i(this), this.i.getProgressDialogCustomView());
    }

    public void onStop() {
        super.onStop();
        Boolean bool = Boolean.FALSE;
        a(bool, bool);
    }

    public void onViewCreated(View view, Bundle bundle) {
        super.onViewCreated(view, bundle);
        Bundle arguments = getArguments();
        r requireActivity = requireActivity();
        UpiConfig upiConfig = this.i;
        PayUUpiUtil.updateLayoutSecurity(requireActivity, Boolean.valueOf(upiConfig != null && upiConfig.isProtectedScreen()));
        if (arguments != null) {
            this.i = (UpiConfig) arguments.getParcelable(UpiConstant.UPI_CONFIG);
            SocketHandler.getInstance().onActivityCreated(getActivity(), new i(this));
            if (bundle != null) {
                if (bundle.get(UpiConstant.IS_UPI_APP_ALREADY_OPENED) != null) {
                    this.j = Boolean.valueOf(bundle.getBoolean(UpiConstant.IS_UPI_APP_ALREADY_OPENED));
                }
                if (bundle.get(UpiConstant.UPI_CONFIG) != null) {
                    this.i = (UpiConfig) bundle.getParcelable(UpiConstant.UPI_CONFIG);
                }
                if (bundle.get(UpiConstant.PAYMENT_RESPONSE) != null) {
                    this.k = (e) bundle.getParcelable(UpiConstant.PAYMENT_RESPONSE);
                }
            }
            UpiConfig upiConfig2 = this.i;
            if (upiConfig2 != null) {
                this.b = upiConfig2.getPayuPostData();
                this.f = this.i.getPaymentType();
                this.i.setProgressDialogCustomView(com.payu.upisdk.k.SINGLETON.a);
                this.e = com.payu.upisdk.util.a.a(getContext());
                a(UpiConstant.PAYMENT_OPTION, this.f.toLowerCase());
                String lowerCase = this.f.toLowerCase();
                lowerCase.hashCode();
                switch (lowerCase) {
                    case "tezomni":
                    case "teztpv":
                    case "upitpv":
                    case "upi":
                        a();
                        if (this.f.equalsIgnoreCase(UpiConstant.UPI_COLLECT_TPV)) {
                            this.g = PaymentOption.UPI_COLLECT_TPV;
                        } else if (this.f.equalsIgnoreCase(UpiConstant.TEZ_TPV)) {
                            this.g = PaymentOption.TEZ_TPV;
                        } else if (this.f.equalsIgnoreCase(UpiConstant.TEZOMNI)) {
                            this.g = PaymentOption.TEZ_OMNI;
                        } else {
                            this.g = PaymentOption.UPI_COLLECT;
                        }
                        com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Payment Started for UpiCollect >>> " + this.g.getPackageName());
                        com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "PostDataUpiSdk " + this.b);
                        b();
                        String postUrl = this.i.getPostUrl();
                        PaymentOption paymentOption = this.g;
                        if (paymentOption != null && paymentOption.getAnalyticsKey() != null) {
                            a(this.g.getAnalyticsKey().toLowerCase(), this.g.getAnalyticsKey().toLowerCase() + "_launched");
                            a("teztpv_url", postUrl);
                            a("teztpv_post_data", this.i.getPayuPostData());
                        }
                        c(postUrl, this.b);
                        break;
                    case "intent":
                    case "inttpv":
                        if (this.f.equalsIgnoreCase(UpiConstant.UPI_INTENT_TPV)) {
                            this.g = PaymentOption.UPI_INTENT_TPV;
                        } else {
                            this.g = PaymentOption.UPI_INTENT;
                        }
                        PayUUpiUtil.setUpiPackageName(this.i.getPackageNameForSpecificApp());
                        e eVar = this.k;
                        if (eVar != null && eVar.j != null) {
                            this.a = new d(requireActivity(), this.b, this.k.j, this, new j(this));
                        }
                        if (this.j.booleanValue()) {
                            PaymentOption paymentOption2 = this.g;
                            if (paymentOption2 != null && paymentOption2.getAnalyticsKey() != null) {
                                a(this.g.getAnalyticsKey().toLowerCase(), this.g.getAnalyticsKey().toLowerCase() + "_upi_app_already_open");
                                break;
                            }
                        } else {
                            this.a = new d(requireActivity(), this.b, this, new j(this));
                            this.c = new ArrayList<>();
                            Intent intent = new Intent();
                            intent.setData(Uri.parse("upi://pay?"));
                            for (ResolveInfo resolveInfo : getContext().getPackageManager().queryIntentActivities(intent, 65536)) {
                                try {
                                    com.payu.upisdk.util.a.c("UPI Installed App....... " + resolveInfo.activityInfo.packageName);
                                    PackageInfo packageInfo = getContext().getPackageManager().getPackageInfo(resolveInfo.activityInfo.packageName, 0);
                                    this.c.add(new com.payu.upisdk.upiintent.a((String) getContext().getPackageManager().getApplicationLabel(packageInfo.applicationInfo), packageInfo.packageName));
                                } catch (PackageManager.NameNotFoundException unused) {
                                    com.payu.upisdk.util.a.c("UPI Installed App....... PackageManager.NameNotFoundException");
                                }
                            }
                            PaymentOption paymentOption3 = this.g;
                            if (paymentOption3 != null && paymentOption3.getAnalyticsKey() != null) {
                                a(this.g.getAnalyticsKey().toLowerCase(), this.g.getAnalyticsKey().toLowerCase() + "_launched");
                            }
                            this.a.k();
                            break;
                        }
                        break;
                    case "upi_generic":
                        Upi.isRecreating = true;
                        a();
                        b();
                        this.g = PaymentOption.UPI_COLLECT_GENERIC;
                        com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Payment Started for UpiCollect >>> " + this.g.getPackageName());
                        Bundle arguments2 = getArguments();
                        if (arguments2 != null && arguments2.getString(UpiConstant.POST_DATA_UPI_COLLECT_GENERIC) != null && arguments2.getString("returnUrl") != null) {
                            String string = arguments2.getString(UpiConstant.POST_DATA_UPI_COLLECT_GENERIC);
                            r = arguments2.getString("returnUrl");
                            PaymentOption paymentOption4 = this.g;
                            if (paymentOption4 != null && paymentOption4.getAnalyticsKey() != null) {
                                a(this.g.getAnalyticsKey().toLowerCase(), this.g.getAnalyticsKey().toLowerCase() + "_launched");
                                a("upi_generic_url", r);
                                a("upi_generic_postdata", string);
                            }
                            c(r, string);
                            break;
                        } else {
                            PaymentOption paymentOption5 = this.g;
                            if (paymentOption5 != null && paymentOption5.getAnalyticsKey() != null) {
                                a(this.g.getAnalyticsKey().toLowerCase(), this.g.getAnalyticsKey().toLowerCase() + UpiConstant.LAUNCH_ERROR);
                                break;
                            }
                        }
                        break;
                }
            }
        }
        view.setFocusableInTouchMode(true);
        view.requestFocus();
        view.setOnKeyListener(new a());
    }

    public void postToPaytxn() {
        Thread thread = new Thread(new c());
        thread.setPriority(10);
        thread.start();
    }

    public void transactionCancelled() {
        onDialogCancelled(true, UpiConstant.CUSTOMER_CANCELLED_ON_PSP_APP);
    }

    public final void a(String str) {
        com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + " Err " + Constants.INVALID_MERCHANT_KEY_ERROR_CODE);
        a("MERCHANT_INFO_NOT_PRESENT", "ErrorDetails_" + str + "_|_ErrorCode: " + Constants.INVALID_MERCHANT_KEY_ERROR_CODE);
        PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
        if (payUUPICallback != null) {
            payUUPICallback.onUpiErrorReceived(Constants.INVALID_MERCHANT_KEY_ERROR_CODE, "MERCHANT_INFO_NOT_PRESENT");
        }
    }

    public final void a(Boolean bool, Boolean bool2) {
        com.payu.upisdk.upi.a aVar = this.n;
        if (aVar != null) {
            aVar.j = bool;
            if (bool2.booleanValue()) {
                this.n.d();
            }
        }
    }

    public void a(String str, String str2) {
        try {
            PayUAnalytics payUAnalytics = this.e;
            if (payUAnalytics != null && this.i != null) {
                payUAnalytics.log(com.payu.upisdk.util.c.c(getContext(), str, str2, this.i.getMerchantKey(), this.i.getTransactionID()));
            } else {
                StringBuilder sb = new StringBuilder();
                sb.append("analyticsLogging analytics");
                sb.append(this.e != null);
                sb.append(" upiConfig ");
                sb.append(this.i != null);
                Log.d("analyticsLogging", sb.toString());
            }
        } catch (Exception e) {
            Log.d("analyticsLogging", "Class Name:getTransactionID " + str + " " + str2 + e.getMessage());
        }
    }
}