导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - PaymentResponseUpiSdkFragment.java 源代码

正在查看: Hopscotch v9.7.2 应用的 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.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.n;
import com.payu.india.Payu.PayuConstants;
import com.payu.socketverification.socket.SocketHandler;
import com.payu.socketverification.socket.SocketPaymentResponse;
import com.payu.socketverification.widgets.PayUProgressDialog;
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.util.PayUUpiUtil;
import com.payu.upisdk.util.UpiConstant;
import in.hopscotch.android.api.factory.OrderReturnApiFactory;
import in.hopscotch.android.api.response.ActionResponse;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import javax.net.ssl.HttpsURLConnection;

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

    public class a extends WebViewClient {
        public a() {
        }

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

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

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

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

    public final void a() {
        com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + " Err 1002");
        a(" MERCHANT_INFO_NOT_PRESENT", "ErrorListener_code_1002");
        PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
        if (payUUPICallback != null) {
            payUUPICallback.onUpiErrorReceived(1002, "MERCHANT_INFO_NOT_PRESENT");
        }
    }

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

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

    public void errorReceived(int i, String str) {
        com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "Error Received " + str);
        StringBuilder sb = new StringBuilder("Technical Error_errorMessage_");
        sb.append(str);
        a("socket_cancel", sb.toString());
        if (i == 1003) {
            f fVar = this.a;
            if (fVar != null) {
                fVar.i(OrderReturnApiFactory.REFUND_TYPE_CANCEL, UpiConstant.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.e("Class Name: " + getClass().getCanonicalName() + "Upi callback class should not be null onPaymentSuccess");
    }

    public void getSocketResult(String str, String str2, String str3, boolean z) {
        if (str3.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.e("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.e("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 void onActivityResult(int i, int i2, Intent intent) {
        SocketPaymentResponse socketPaymentResponse;
        super.onActivityResult(i, i2, intent);
        if (i == 101) {
            com.payu.upisdk.util.a.e("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(OrderReturnApiFactory.REFUND_TYPE_CANCEL, "Customer cancelled on PSP App resultCode " + i2);
                com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "Cancel return");
                this.a.i(OrderReturnApiFactory.REFUND_TYPE_CANCEL, UpiConstant.CUSTOMER_CANCELLED_ON_PSP_APP);
                return;
            }
            if (intent.hasExtra("Status")) {
                str = intent.getStringExtra("Status");
            } else if (intent.hasExtra("response")) {
                str = com.payu.upisdk.util.c.o(intent.getStringExtra("response")).get("Status");
            }
            PaymentOption paymentOption = this.g;
            if (paymentOption != null && paymentOption.getAnalyticsKey() != null) {
                a(this.g.getAnalyticsKey().toLowerCase() + " _payment_app_response", android.support.v4.media.b.j("status_", str, "__payment_app_response_", stringExtra));
            }
            if (str != null && !str.equalsIgnoreCase("SUCCESS") && !str.equalsIgnoreCase(UpiConstant.SUBMITTED)) {
                com.payu.upisdk.util.a.e("Payment App response ".concat(str));
                this.l = UpiConstant.GET_RESPONSE_FROM_PSP;
                this.a.i(UpiConstant.FAILURE, UpiConstant.GET_RESPONSE_FROM_PSP);
                return;
            }
            com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "Return FAILURE");
            String str2 = this.l;
            a("upi_socket", UpiConstant.PUSH_ENABLED);
            e eVar = this.k;
            if (eVar == null || (socketPaymentResponse = eVar.o) == null || socketPaymentResponse.getUpiPushDisabled() == null || !this.k.o.getUpiPushDisabled().equals(PayuConstants.STRING_ZERO)) {
                a("long_polling_from", "verify_using_http");
                this.a.i(UpiConstant.FAILURE, str2);
                return;
            }
            a(UpiConstant.VERIFY_TYPE, UpiConstant.SOCKET);
            SocketPaymentResponse socketPaymentResponse2 = new SocketPaymentResponse();
            this.o = socketPaymentResponse2;
            e eVar2 = this.k;
            if (eVar2 != null) {
                socketPaymentResponse2.setReferenceId(eVar2.d);
                UpiConfig upiConfig = this.i;
                if (upiConfig != null && upiConfig.getTransactionID() != null) {
                    this.o.setTxnId(this.i.getTransactionID());
                }
                this.o.setUpiPushDisabled(this.k.o.getUpiPushDisabled());
                this.o.setUpiServicePollInterval(this.k.o.getUpiServicePollInterval());
                this.o.setSdkUpiPushExpiry(this.k.o.getSdkUpiPushExpiry());
                this.o.setSdkUpiVerificationInterval(this.k.o.getSdkUpiVerificationInterval());
                this.o.setPushServiceUrl(this.k.o.getPushServiceUrl());
            }
            SocketPaymentResponse socketPaymentResponse3 = this.o;
            if (socketPaymentResponse3 == null || socketPaymentResponse3.getTxnId() == null) {
                return;
            }
            SocketHandler.getInstance().createSocket(this.o, 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", android.support.v4.media.b.j("packageName_", str, "_version_name_", str2));
        }
        this.a.c(this, str);
    }

    @Override
    public void onBackButtonClicked() {
        k kVar = new k(this);
        n activity = getActivity();
        String string = getString(com.payu.upisdk.g.do_you_really_want_to_cancel_the_transaction);
        AlertDialog.Builder builder = new AlertDialog.Builder(activity, com.payu.upisdk.h.upi_sdk_dialog);
        if (string != null) {
            builder.setMessage(string);
        }
        builder.setPositiveButton("Ok", kVar);
        builder.setNegativeButton("Cancel", kVar);
        PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
        if (payUUPICallback != null) {
            payUUPICallback.onBackButton(builder);
            AlertDialog create = builder.create();
            this.p = create;
            create.show();
        }
    }

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

    public void onDestroyView() {
        super.onDestroyView();
        com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "OnDestroy ");
        SocketHandler.getInstance().onActivityDestroyed(getActivity());
        f fVar = this.a;
        if (fVar != null) {
            PayUProgressDialog payUProgressDialog = fVar.c;
            if (payUProgressDialog != null && !payUProgressDialog.isShowing()) {
                fVar.c.dismiss();
                fVar.c = null;
            }
            fVar.a = null;
        }
        AlertDialog alertDialog = this.p;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
        PayUProgressDialog payUProgressDialog2 = this.n;
        if (payUProgressDialog2 != null) {
            if (payUProgressDialog2.isShowing()) {
                this.n.dismiss();
            }
            this.n = null;
        }
        com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "Is recreating " + Upi.isRecreating);
        if (Upi.isRecreating) {
            Upi.isRecreating = false;
            return;
        }
        PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
        if (payUUPICallback != null) {
            payUUPICallback.onPaymentTerminate();
        }
    }

    @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.i(ActionResponse.FAILURE, "No Upi apps present and collect disabled.");
            return;
        }
        if (this.m != -1) {
            this.a.i(OrderReturnApiFactory.REFUND_TYPE_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();
        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();
            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();
                return;
            }
            String m = com.payu.upisdk.util.c.m(eVar.l);
            if (m == null) {
                a();
                return;
            }
            PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
            if (payUUPICallback != null) {
                payUUPICallback.onPaymentFailure(m, null);
                return;
            }
            return;
        }
        PaymentOption paymentOption = this.g;
        if (paymentOption == PaymentOption.TEZ) {
            this.a.c(this, UpiConstant.PACKAGE_ID_GOOGLEPAY);
            return;
        }
        if (paymentOption != PaymentOption.UPI_INTENT && paymentOption != PaymentOption.UPI_INTENT_TPV) {
            a();
            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.b(getContext(), this.i.getPackageNameForSpecificApp()));
            return;
        }
        q = eVar.b;
        this.d = new ArrayList<>();
        ArrayList arrayList2 = eVar.i;
        if (arrayList2 != null && arrayList2.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> arrayList3 = this.d;
        if (arrayList3 != null && (arrayList = this.c) != null) {
            arrayList3.addAll(arrayList);
        }
        com.payu.upisdk.j A = com.payu.upisdk.j.A(this.d, eVar, this.i);
        A.setStyle(0, com.payu.upisdk.h.UpiSdkFullScreenDialogStyle);
        A.setRetainInstance(true);
        A.show(getActivity().getSupportFragmentManager(), "packageList");
        this.j = Boolean.TRUE;
        a("_payment_app", "show_PackageListDialog");
    }

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

    public void onViewCreated(@NonNull View view, Bundle bundle) {
        super.onViewCreated(view, bundle);
        Bundle arguments = getArguments();
        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 upiConfig = this.i;
            if (upiConfig != null) {
                this.b = upiConfig.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.getClass();
                switch (lowerCase) {
                    case "tezomni":
                    case "teztpv":
                    case "upitpv":
                    case "upi":
                        b();
                        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.e("Class Name: " + getClass().getCanonicalName() + "Payment Started for UpiCollect >>> " + this.g.getPackageName());
                        com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "PostDataUpiSdk " + this.b);
                        c();
                        String postUrl = this.i.getPostUrl();
                        PaymentOption paymentOption = this.g;
                        if (paymentOption != null && paymentOption.getAnalyticsKey() != null) {
                            a(this.g.getAnalyticsKey().toLowerCase(), this.g.getAnalyticsKey().toLowerCase() + UpiConstant.LAUNCHED);
                            a(this.g.getAnalyticsKey().toLowerCase() + "_url_", postUrl);
                            a(this.g.getAnalyticsKey().toLowerCase() + "_postdata_", this.i.getPayuPostData());
                        }
                        b(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 f(requireActivity(), this.b, this.k.j, this, new j(this));
                        }
                        if (!this.j.booleanValue()) {
                            this.a = new f(requireActivity(), this.b, this, new j(this));
                            this.c = new ArrayList<>();
                            Intent intent = new Intent();
                            intent.setData(Uri.parse(UpiConstant.CP_UPI_INTENT_PREFIX));
                            for (ResolveInfo resolveInfo : getContext().getPackageManager().queryIntentActivities(intent, 65536)) {
                                try {
                                    com.payu.upisdk.util.a.e("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.e("UPI Installed App....... PackageManager.NameNotFoundException");
                                }
                            }
                            PaymentOption paymentOption2 = this.g;
                            if (paymentOption2 != null && paymentOption2.getAnalyticsKey() != null) {
                                a(this.g.getAnalyticsKey().toLowerCase(), this.g.getAnalyticsKey().toLowerCase() + UpiConstant.LAUNCHED);
                            }
                            this.a.h();
                            break;
                        } else {
                            PaymentOption paymentOption3 = this.g;
                            if (paymentOption3 != null && paymentOption3.getAnalyticsKey() != null) {
                                a(this.g.getAnalyticsKey().toLowerCase(), this.g.getAnalyticsKey().toLowerCase() + UpiConstant.UPI_APP_ALREADY_OPEN);
                                break;
                            }
                        }
                        break;
                    case "upi_generic":
                        Upi.isRecreating = true;
                        b();
                        c();
                        this.g = PaymentOption.UPI_COLLECT_GENERIC;
                        com.payu.upisdk.util.a.e("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);
                            q = arguments2.getString("returnUrl");
                            PaymentOption paymentOption4 = this.g;
                            if (paymentOption4 != null && paymentOption4.getAnalyticsKey() != null) {
                                a(this.g.getAnalyticsKey().toLowerCase(), this.g.getAnalyticsKey().toLowerCase() + UpiConstant.LAUNCHED);
                                a(this.g.getAnalyticsKey().toLowerCase() + "_url_", q);
                                a(this.g.getAnalyticsKey().toLowerCase() + "_postdata_", string);
                            }
                            b(q, 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;
                }
            }
        }
    }

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

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

    public void a(String str, String str2) {
        try {
            com.payu.payuanalytics.analytics.model.g gVar = this.e;
            if (gVar == null || this.i == null) {
                return;
            }
            gVar.i(com.payu.upisdk.util.c.c(getContext(), str, str2, this.i.getMerchantKey(), this.i.getTransactionID()));
        } catch (Exception e) {
            com.payu.upisdk.util.a.e("Class Name:getTransactionID " + str + " " + str2 + e.getMessage());
        }
    }

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