导航菜单

页面标题

页面副标题

Vi App v10.18.0 - NativePlusPayActivity.java 源代码

正在查看: Vi App v10.18.0 应用的 NativePlusPayActivity.java JAVA 源代码文件

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


package com.paytmpayments.customuisdk.directpages;

import android.app.AlertDialog;
import android.app.Application;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.Html;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Observer;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.airbnb.lottie.LottieAnimationView;
import com.android.volley.VolleyError;
import com.google.android.play.core.splitcompat.SplitCompat;
import com.google.gson.Gson;
import com.paytmpayments.customuisdk.base.CallbackListener;
import com.paytmpayments.customuisdk.base.DependencyProvider;
import com.paytmpayments.customuisdk.base.EventLogger;
import com.paytmpayments.customuisdk.base.FlowNavigator;
import com.paytmpayments.customuisdk.base.PaytmHelper;
import com.paytmpayments.customuisdk.base.UtilityHelper;
import com.paytmpayments.customuisdk.common.BaseActivity;
import com.paytmpayments.customuisdk.common.Constants.SDKConstants;
import com.paytmpayments.customuisdk.common.listeners.PayFragmentInteractor;
import com.paytmpayments.customuisdk.common.utils.LogUtility;
import com.paytmpayments.customuisdk.directpages.viewmodel.NativePlusPayViewModel;
import com.paytmpayments.customuisdk.paymethods.datasource.NativeSDKRepository;
import com.paytmpayments.customuisdk.paymethods.datasource.PaymentMethodDataSource;
import com.paytmpayments.customuisdk.paymethods.datasource.PaymentRepository;
import com.paytmpayments.customuisdk.paymethods.model.PaytmAssistParams;
import com.paytmpayments.customuisdk.paymethods.model.processtransaction.Body;
import com.paytmpayments.customuisdk.paymethods.model.processtransaction.Head;
import com.paytmpayments.customuisdk.paymethods.model.processtransaction.ProcessTransactionInfo;
import com.paytmpayments.customuisdk.paymethods.model.processtransaction.ResultInfo;
import com.paytmpayments.customuisdk.transaction.PayUtility;
import com.paytmpayments.customuisdk.transaction.PaymentInstrument;
import java.io.Serializable;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONObject;

@Metadata(bv = {}, d1 = {"\u0000\u0080\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u001c\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0005\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u0003B\u0007¢\u0006\u0004\be\u0010fJ\b\u0010\u0005\u001a\u00020\u0004H\u0002J\b\u0010\u0006\u001a\u00020\u0004H\u0002J\b\u0010\u0007\u001a\u00020\u0004H\u0002J\u0010\u0010\n\u001a\u00020\u00042\u0006\u0010\t\u001a\u00020\bH\u0002J\b\u0010\u000b\u001a\u00020\u0004H\u0002J$\u0010\u0010\u001a\u00020\u00042\b\u0010\f\u001a\u0004\u0018\u00010\b2\u0006\u0010\u000e\u001a\u00020\r2\b\u0010\u000f\u001a\u0004\u0018\u00010\bH\u0002J\u0010\u0010\u0013\u001a\u00020\u00042\u0006\u0010\u0012\u001a\u00020\u0011H\u0002J\b\u0010\u0014\u001a\u00020\u0004H\u0002J\b\u0010\u0015\u001a\u00020\u0004H\u0002J\b\u0010\u0016\u001a\u00020\u0004H\u0002J\b\u0010\u0017\u001a\u00020\u0004H\u0002J\b\u0010\u0018\u001a\u00020\u0004H\u0002J\u0010\u0010\u001a\u001a\u00020\r2\u0006\u0010\u0019\u001a\u00020\bH\u0002J\b\u0010\u001b\u001a\u00020\u0004H\u0002J\b\u0010\u001c\u001a\u00020\u0004H\u0002J\b\u0010\u001d\u001a\u00020\u0004H\u0002J\b\u0010\u001e\u001a\u00020\u0004H\u0002J\u0012\u0010\u001f\u001a\u00020\u00042\b\u0010\u000f\u001a\u0004\u0018\u00010\bH\u0002J\b\u0010 \u001a\u00020\u0004H\u0002J\b\u0010!\u001a\u00020\u0004H\u0002J\b\u0010\"\u001a\u00020\u0004H\u0002J\u0012\u0010$\u001a\u00020\u00042\b\u0010#\u001a\u0004\u0018\u00010\bH\u0002J\u0010\u0010%\u001a\u00020\u00042\u0006\u0010#\u001a\u00020\bH\u0002J\b\u0010&\u001a\u00020\u0004H\u0002J\u0010\u0010(\u001a\u00020\u00042\u0006\u0010'\u001a\u00020\bH\u0002J\b\u0010)\u001a\u00020\u0004H\u0002J\b\u0010*\u001a\u00020\u0004H\u0002J\b\u0010+\u001a\u00020\u0004H\u0002J\u0012\u0010-\u001a\u00020\r2\b\u0010,\u001a\u0004\u0018\u00010\bH\u0002J\u0012\u00100\u001a\u00020\u00042\b\u0010/\u001a\u0004\u0018\u00010.H\u0014J\u0010\u00102\u001a\u00020\u00042\u0006\u00101\u001a\u00020.H\u0014J\b\u00103\u001a\u00020\u0004H\u0014J\b\u00104\u001a\u00020\u0004H\u0014J\u0012\u00107\u001a\u00020\u00042\b\u00106\u001a\u0004\u0018\u000105H\u0016J\b\u00108\u001a\u00020\u0004H\u0016J\b\u00109\u001a\u00020\u0004H\u0014J\u0012\u0010;\u001a\u00020\u00042\b\u0010:\u001a\u0004\u0018\u00010\bH\u0016J\b\u0010<\u001a\u00020\bH\u0016J$\u0010@\u001a\u00020\u00042\b\u0010>\u001a\u0004\u0018\u00010=2\b\u0010'\u001a\u0004\u0018\u00010\b2\u0006\u0010?\u001a\u00020\rH\u0016J\u0012\u0010B\u001a\u00020\u00042\b\u0010A\u001a\u0004\u0018\u00010.H\u0016J\b\u0010C\u001a\u00020\u0004H\u0016J\b\u0010D\u001a\u00020\u0004H\u0016J\b\u0010E\u001a\u00020\rH\u0016J\u0012\u0010H\u001a\u00020\u00042\b\u0010G\u001a\u0004\u0018\u00010FH\u0014R\u001c\u0010J\u001a\n I*\u0004\u0018\u00010\b0\b8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bJ\u0010KR\u0018\u0010M\u001a\u0004\u0018\u00010L8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bM\u0010NR\u0016\u0010P\u001a\u00020O8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\bP\u0010QR\u0018\u0010S\u001a\u0004\u0018\u00010R8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bS\u0010TR\u0016\u0010\u001b\u001a\u00020\r8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u001b\u0010UR\u0018\u0010W\u001a\u0004\u0018\u00010V8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bW\u0010XR\"\u0010Z\u001a\u00020Y8\u0006@\u0006X\u0086.¢\u0006\u0012\n\u0004\bZ\u0010[\u001a\u0004\b\\\u0010]\"\u0004\b^\u0010_R\u0016\u0010`\u001a\u00020\r8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b`\u0010UR\u0016\u0010a\u001a\u00020\r8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\ba\u0010UR\u0018\u0010c\u001a\u0004\u0018\u00010b8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bc\u0010d¨\u0006g"}, d2 = {"Lcom/paytmpayments/customuisdk/directpages/NativePlusPayActivity;", "Lcom/paytmpayments/customuisdk/common/BaseActivity;", "Landroid/view/View$OnClickListener;", "Lcom/paytmpayments/customuisdk/common/listeners/PayFragmentInteractor;", "", "initOtpHelper", "removeAutoSubmitOtpUI", "addResendObserable", "", SDKConstants.KEY_STATUS, "sendPayCompleteEvent", "addSubmitObservable", "response", "", "retry", "resultMsg", "redirectToMerchantSDK", "Lorg/json/JSONObject;", "otpApiResponse", "postDataOnCallBack", "addCancelObserable", "initUI", "setFieldsVisibility", "submitOtp", "showOtpValidationError", SDKConstants.KEY_OTP, "isValidOtp", "disableUiInteraction", "enableUiInteraction", "showPaymentLoadingState", "hidePaymentLoadingState", "redirectToPaymentOptions", "backPressCancelTransaction", "enableResendButton", "disableResendButton", "msg", "showResendOtpSuccessUi", "showOtpErrorView", "hideOtpErrorView", SDKConstants.KEY_ERROR_MSG, "showRetryDialog", "payOnBankSite", "showPayOnBankLoader", "hidePayOnBankLoader", "item", "isValidItemPasted", "Landroid/os/Bundle;", "savedInstanceState", "onCreate", "outState", "onSaveInstanceState", "onStop", "onStart", "Landroid/view/View;", "v", "onClick", "onBackPressed", "onDestroy", "activityName", "saveActivityFromFinish", "getChildClassName", "Landroidx/fragment/app/Fragment;", "fragment", "showErrorDialog", "backToCashierPage", "bundle", "addPayFragment", "onWebPageFinish", "addPageVisibleGAEvent", "shouldKillActivity", "Landroid/content/Context;", "base", "attachBaseContext", "kotlin.jvm.PlatformType", "TAG", "Ljava/lang/String;", "Lcom/paytmpayments/customuisdk/paymethods/model/processtransaction/ProcessTransactionInfo;", "processTransactionInfo", "Lcom/paytmpayments/customuisdk/paymethods/model/processtransaction/ProcessTransactionInfo;", "Lcom/paytmpayments/customuisdk/directpages/viewmodel/NativePlusPayViewModel;", "mViewModel", "Lcom/paytmpayments/customuisdk/directpages/viewmodel/NativePlusPayViewModel;", "Landroid/app/AlertDialog;", "mAlertDialog", "Landroid/app/AlertDialog;", "Z", "Lcom/paytmpayments/customuisdk/paymethods/model/PaytmAssistParams;", "assistParams", "Lcom/paytmpayments/customuisdk/paymethods/model/PaytmAssistParams;", "Lcom/paytmpayments/customuisdk/directpages/NativeOtpHelper;", "otpHelper", "Lcom/paytmpayments/customuisdk/directpages/NativeOtpHelper;", "getOtpHelper", "()Lcom/paytmpayments/customuisdk/directpages/NativeOtpHelper;", "setOtpHelper", "(Lcom/paytmpayments/customuisdk/directpages/NativeOtpHelper;)V", "isOtpAutoFilled", "isOtpPasted", "Lcom/paytmpayments/customuisdk/transaction/PaymentInstrument;", "paymentInstrument", "Lcom/paytmpayments/customuisdk/transaction/PaymentInstrument;", "<init>", "()V", "directpages_release"}, k = 1, mv = {1, 7, 1})
public final class NativePlusPayActivity extends BaseActivity implements View.OnClickListener, PayFragmentInteractor {

    @Nullable
    private PaytmAssistParams assistParams;
    private boolean disableUiInteraction;
    private boolean isOtpAutoFilled;
    private boolean isOtpPasted;

    @Nullable
    private AlertDialog mAlertDialog;
    private NativePlusPayViewModel mViewModel;
    public NativeOtpHelper otpHelper;

    @Nullable
    private PaymentInstrument paymentInstrument;

    @Nullable
    private ProcessTransactionInfo processTransactionInfo;

    @NotNull
    public Map<Integer, View> _$_findViewCache = new LinkedHashMap();
    private final String TAG = NativePlusPayActivity.class.getSimpleName();

    private final void addCancelObserable() {
        NativePlusPayViewModel nativePlusPayViewModel = this.mViewModel;
        if (nativePlusPayViewModel == null) {
            Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
            nativePlusPayViewModel = null;
        }
        MutableLiveData<JSONObject> otpCancelResponse = nativePlusPayViewModel.getOtpCancelResponse();
        if (otpCancelResponse != null) {
            otpCancelResponse.observe(this, new Observer() {
                public final void onChanged(Object obj) {
                    NativePlusPayActivity.m23addCancelObserable$lambda7(NativePlusPayActivity.this, (JSONObject) obj);
                }
            });
        }
    }

    public static final void m23addCancelObserable$lambda7(NativePlusPayActivity nativePlusPayActivity, JSONObject jSONObject) {
        Map<String, ? extends Object> genericEventParams;
        PaytmHelper paytmHelper;
        Map<String, ? extends Object> genericEventParams2;
        PaytmHelper paytmHelper2;
        Intrinsics.checkNotNullParameter(nativePlusPayActivity, "this$0");
        Object obj = jSONObject.get("body");
        Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type org.json.JSONObject");
        JSONObject jSONObject2 = (JSONObject) obj;
        Object obj2 = jSONObject2.get("resultInfo");
        Intrinsics.checkNotNull(obj2, "null cannot be cast to non-null type org.json.JSONObject");
        ResultInfo resultInfo = (ResultInfo) new Gson().fromJson(((JSONObject) obj2).toString(), ResultInfo.class);
        boolean z = false;
        if (resultInfo != null ? Intrinsics.areEqual(resultInfo.getRetry(), Boolean.TRUE) : false) {
            PaytmHelper paytmHelper3 = DependencyProvider.getPaytmHelper();
            if (paytmHelper3 != null && (genericEventParams2 = paytmHelper3.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "cancel_otp", "retry_true", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper2 = DependencyProvider.getPaytmHelper()) != null) {
                paytmHelper2.sendGaEvents(genericEventParams2);
            }
            UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
            if (utilitiesHelper != null && utilitiesHelper.isServerSDK()) {
                z = true;
            }
            if (z) {
                Object obj3 = jSONObject2.get("txnInfo");
                Intrinsics.checkNotNull(obj3, "null cannot be cast to non-null type org.json.JSONObject");
                nativePlusPayActivity.redirectToMerchantSDK(((JSONObject) obj3).toString(), true, resultInfo.getResultMsg());
            } else {
                nativePlusPayActivity.redirectToPaymentOptions(resultInfo.getResultMsg());
            }
        } else {
            PaytmHelper paytmHelper4 = DependencyProvider.getPaytmHelper();
            if (paytmHelper4 != null && (genericEventParams = paytmHelper4.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "cancel_otp", "retry_false", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper = DependencyProvider.getPaytmHelper()) != null) {
                paytmHelper.sendGaEvents(genericEventParams);
            }
            nativePlusPayActivity.backPressCancelTransaction();
        }
        AlertDialog alertDialog = nativePlusPayActivity.mAlertDialog;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
    }

    private final void addResendObserable() {
        NativePlusPayViewModel nativePlusPayViewModel = this.mViewModel;
        if (nativePlusPayViewModel == null) {
            Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
            nativePlusPayViewModel = null;
        }
        MutableLiveData<JSONObject> otpResendResponse = nativePlusPayViewModel.getOtpResendResponse();
        if (otpResendResponse != null) {
            otpResendResponse.observe(this, new Observer<JSONObject>() {
                public void onChanged(@org.jetbrains.annotations.NotNull org.json.JSONObject r10) {
                    throw new UnsupportedOperationException("Method not decompiled: com.paytmpayments.customuisdk.directpages.NativePlusPayActivity$addResendObserable$1.onChanged(org.json.JSONObject):void");
                }
            });
        }
    }

    private final void addSubmitObservable() {
        NativePlusPayViewModel nativePlusPayViewModel = this.mViewModel;
        if (nativePlusPayViewModel == null) {
            Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
            nativePlusPayViewModel = null;
        }
        MutableLiveData<JSONObject> otpSubmitResponse = nativePlusPayViewModel.getOtpSubmitResponse();
        if (otpSubmitResponse != null) {
            otpSubmitResponse.observe(this, new Observer<JSONObject>() {
                public void onChanged(@NotNull JSONObject otpResponse) {
                    PaymentInstrument paymentInstrument;
                    Map<String, ? extends Object> genericEventParams;
                    PaytmHelper paytmHelper;
                    PaymentInstrument paymentInstrument2;
                    Map<String, ? extends Object> genericEventParams2;
                    PaytmHelper paytmHelper2;
                    PaymentInstrument paymentInstrument3;
                    Map<String, Object> genericEventParams3;
                    PaytmHelper paytmHelper3;
                    PaymentInstrument paymentInstrument4;
                    Map<String, ? extends Object> genericEventParams4;
                    PaytmHelper paytmHelper4;
                    Map<String, ? extends Object> genericEventParams5;
                    PaytmHelper paytmHelper5;
                    Intrinsics.checkNotNullParameter(otpResponse, "otpResponse");
                    Object obj = otpResponse.get("body");
                    Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type org.json.JSONObject");
                    JSONObject jSONObject = (JSONObject) obj;
                    Object obj2 = jSONObject.get("resultInfo");
                    Intrinsics.checkNotNull(obj2, "null cannot be cast to non-null type org.json.JSONObject");
                    ResultInfo resultInfo = (ResultInfo) new Gson().fromJson(((JSONObject) obj2).toString(), ResultInfo.class);
                    if (resultInfo == null) {
                        NativePlusPayActivity.this.sendPayCompleteEvent(SDKConstants.VALUE_FAIL);
                        PaytmHelper paytmHelper6 = DependencyProvider.getPaytmHelper();
                        if (paytmHelper6 != null && (genericEventParams5 = paytmHelper6.getGenericEventParams(SDKConstants.API_TIME_OUT, "otp_submit_api", "direct_otp_page")) != null && (paytmHelper5 = DependencyProvider.getPaytmHelper()) != null) {
                            paytmHelper5.sendGaEvents(genericEventParams5);
                        }
                        NativePlusPayActivity.this.enableUiInteraction();
                        PaytmHelper paytmHelper7 = DependencyProvider.getPaytmHelper();
                        if (paytmHelper7 != null && (genericEventParams4 = paytmHelper7.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "submit_otp", "timeout", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper4 = DependencyProvider.getPaytmHelper()) != null) {
                            paytmHelper4.sendGaEvents(genericEventParams4);
                        }
                        PayUtility.finishSdk(NativePlusPayActivity.this, null, null, SDKConstants.VALUE_CAP_FAILED, "NETWORK_OR_TIMEOUT_ERROR");
                        return;
                    }
                    ?? r8 = NativePlusPayActivity.this;
                    if (!Intrinsics.areEqual("0000", resultInfo.getResultCode()) && !Intrinsics.areEqual("S", resultInfo.getResultStatus())) {
                        Boolean bankRetry = resultInfo.getBankRetry();
                        Boolean bool = Boolean.TRUE;
                        if (Intrinsics.areEqual(bankRetry, bool)) {
                            paymentInstrument4 = ((NativePlusPayActivity) r8).paymentInstrument;
                            if (paymentInstrument4 != null) {
                                r8.sendPayCompleteEvent(SDKConstants.VALUE_PENDING);
                            }
                            r8.enableUiInteraction();
                            String resultMsg = resultInfo.getResultMsg();
                            if (resultMsg == null) {
                                resultMsg = "";
                            }
                            r8.showRetryDialog(resultMsg);
                            PaytmHelper paytmHelper8 = DependencyProvider.getPaytmHelper();
                            if (paytmHelper8 == null || (genericEventParams3 = paytmHelper8.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "submit_otp", "retry_true", SDKConstants.GA_NATIVE_PLUS, "")) == null || (paytmHelper3 = DependencyProvider.getPaytmHelper()) == null) {
                                return;
                            }
                        } else if (Intrinsics.areEqual(resultInfo.getRetry(), bool)) {
                            paymentInstrument3 = ((NativePlusPayActivity) r8).paymentInstrument;
                            if (paymentInstrument3 != null) {
                                r8.sendPayCompleteEvent(SDKConstants.VALUE_PENDING);
                            }
                            r8.enableUiInteraction();
                            UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
                            if (utilitiesHelper != null && utilitiesHelper.isServerSDK()) {
                                Object obj3 = jSONObject.get("txnInfo");
                                Intrinsics.checkNotNull(obj3, "null cannot be cast to non-null type org.json.JSONObject");
                                r8.redirectToMerchantSDK(((JSONObject) obj3).toString(), true, resultInfo.getResultMsg());
                            } else {
                                r8.redirectToPaymentOptions(resultInfo.getResultMsg());
                            }
                            PaytmHelper paytmHelper9 = DependencyProvider.getPaytmHelper();
                            if (paytmHelper9 == null || (genericEventParams3 = paytmHelper9.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "submit_otp", "retry_true", SDKConstants.GA_NATIVE_PLUS, "")) == null || (paytmHelper3 = DependencyProvider.getPaytmHelper()) == null) {
                                return;
                            }
                        } else {
                            paymentInstrument2 = ((NativePlusPayActivity) r8).paymentInstrument;
                            if (paymentInstrument2 != null) {
                                r8.sendPayCompleteEvent(SDKConstants.VALUE_FAIL);
                            }
                            PaytmHelper paytmHelper10 = DependencyProvider.getPaytmHelper();
                            if (paytmHelper10 != null && (genericEventParams2 = paytmHelper10.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "submit_otp", "retry_false", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper2 = DependencyProvider.getPaytmHelper()) != null) {
                                paytmHelper2.sendGaEvents(genericEventParams2);
                            }
                            if (!jSONObject.has("txnInfo")) {
                                r8.enableUiInteraction();
                                PayUtility.finishSdk(r8, null, null, SDKConstants.VALUE_CAP_FAILED, "OTP_SUBMIT_FAILED");
                                return;
                            }
                        }
                        paytmHelper3.sendGaEvents(genericEventParams3);
                        return;
                    }
                    paymentInstrument = ((NativePlusPayActivity) r8).paymentInstrument;
                    if (paymentInstrument != null) {
                        r8.sendPayCompleteEvent(SDKConstants.VALUE_SUCCESS);
                    }
                    PaytmHelper paytmHelper11 = DependencyProvider.getPaytmHelper();
                    if (paytmHelper11 != null && (genericEventParams = paytmHelper11.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "submit_otp", SDKConstants.VALUE_SUCCESS, SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper = DependencyProvider.getPaytmHelper()) != null) {
                        paytmHelper.sendGaEvents(genericEventParams);
                    }
                    if (!jSONObject.has("txnInfo")) {
                        r8.enableUiInteraction();
                        PayUtility.finishSdk(r8, null, null, SDKConstants.VALUE_CAP_SUCCESS, null);
                        return;
                    }
                    r8.postDataOnCallBack(otpResponse);
                }
            });
        }
    }

    private final void backPressCancelTransaction() {
        NativeSDKRepository nativeSDKRepository;
        CallbackListener callbackListener;
        try {
            nativeSDKRepository = NativeSDKRepository.getInstance(this);
        } catch (IllegalStateException e) {
            PaytmHelper paytmHelper = DependencyProvider.getPaytmHelper();
            NativeSDKRepository.init(this, paytmHelper != null && paytmHelper.isToCreateOrderPaytmSdk());
            EventLogger eventLogger = DependencyProvider.getEventLogger();
            if (eventLogger != null) {
                eventLogger.sendCrashLogs("com.paytmpayments.customuisdk.directpages", "backPressCancelTransaction", e);
            }
            nativeSDKRepository = null;
        }
        if (nativeSDKRepository != null) {
            nativeSDKRepository.notifyServerAboutCloseOrder();
        }
        if (DependencyProvider.getCallbackListener() != null && (callbackListener = DependencyProvider.getCallbackListener()) != null) {
            callbackListener.onBackPressedCancelTransaction();
        }
        Intent intent = new Intent("kill");
        intent.putExtra(SDKConstants.SAVE_ACTIVITY, "none");
        LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
        AlertDialog alertDialog = this.mAlertDialog;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
    }

    private final void disableResendButton() {
        int i = R.id.tvResendOtp;
        ((TextView) _$_findCachedViewById(i)).setOnClickListener(null);
        ((TextView) _$_findCachedViewById(i)).setTextColor(ContextCompat.getColor(this, R.color.black));
        ((TextView) _$_findCachedViewById(i)).setAlpha(0.4f);
    }

    private final void disableUiInteraction() {
        this.disableUiInteraction = true;
        ((FrameLayout) _$_findCachedViewById(R.id.disableClickView)).setClickable(true);
        showPaymentLoadingState();
        ((RelativeLayout) _$_findCachedViewById(R.id.payButton)).setOnClickListener(null);
    }

    public final void enableResendButton() {
        int i = R.id.tvResendOtp;
        ((TextView) _$_findCachedViewById(i)).setOnClickListener(this);
        ((TextView) _$_findCachedViewById(i)).setTextColor(ContextCompat.getColor(this, R.color.paytm_blue));
        ((TextView) _$_findCachedViewById(i)).setAlpha(1.0f);
    }

    public final void enableUiInteraction() {
        AlertDialog alertDialog = this.mAlertDialog;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
        this.disableUiInteraction = false;
        ((FrameLayout) _$_findCachedViewById(R.id.disableClickView)).setClickable(false);
        ((RelativeLayout) _$_findCachedViewById(R.id.payButton)).setOnClickListener(this);
        hidePaymentLoadingState();
    }

    public final void hideOtpErrorView() {
        int i = R.id.rlResendOtpSuccess;
        if (((LinearLayout) _$_findCachedViewById(i)) != null) {
            int i2 = R.id.tvPaymentAmount;
            if (((TextView) _$_findCachedViewById(i2)) != null) {
                int i3 = R.id.llOtpErrorView;
                if (((LinearLayout) _$_findCachedViewById(i3)) != null) {
                    ((LinearLayout) _$_findCachedViewById(i)).setVisibility(8);
                    ((TextView) _$_findCachedViewById(i2)).setVisibility(0);
                    ((LinearLayout) _$_findCachedViewById(i3)).setVisibility(8);
                }
            }
        }
    }

    private final void hidePayOnBankLoader() {
        int i = R.id.ltv_loading1;
        if (_$_findCachedViewById(i) != null) {
            LottieAnimationView _$_findCachedViewById = _$_findCachedViewById(i);
            Intrinsics.checkNotNull(_$_findCachedViewById, "null cannot be cast to non-null type com.airbnb.lottie.LottieAnimationView");
            _$_findCachedViewById.setVisibility(0);
            _$_findCachedViewById.setAnimation("Payments-Loader.json");
            _$_findCachedViewById.loop(true);
            _$_findCachedViewById.cancelAnimation();
            _$_findCachedViewById(i).setVisibility(8);
            ((TextView) _$_findCachedViewById(R.id.tvGoToBankWebSite)).setVisibility(0);
        }
    }

    private final void hidePaymentLoadingState() {
        int i = R.id.ltv_loading;
        if (_$_findCachedViewById(i) != null) {
            LottieAnimationView _$_findCachedViewById = _$_findCachedViewById(i);
            Intrinsics.checkNotNull(_$_findCachedViewById, "null cannot be cast to non-null type com.airbnb.lottie.LottieAnimationView");
            _$_findCachedViewById.setVisibility(0);
            _$_findCachedViewById.setAnimation("Payments-Loader.json");
            _$_findCachedViewById.loop(true);
            _$_findCachedViewById.cancelAnimation();
            ((RelativeLayout) _$_findCachedViewById(R.id.payButton)).setBackgroundResource(R.drawable.nativesdk_button_click);
            _$_findCachedViewById(i).setVisibility(8);
            ((TextView) _$_findCachedViewById(R.id.tvPaySecurely)).setVisibility(0);
        }
    }

    private final void initOtpHelper() {
        setOtpHelper(new NativeOtpHelper(this, new OtpListener() {
            @Override
            public void onOtpReceived(@NotNull String otp) {
                String str;
                Map<String, ? extends Object> genericEventParams;
                PaytmHelper paytmHelper;
                Intrinsics.checkNotNullParameter(otp, SDKConstants.KEY_OTP);
                str = NativePlusPayActivity.this.TAG;
                LogUtility.d(str, "received otp is " + otp);
                NativePlusPayActivity nativePlusPayActivity = NativePlusPayActivity.this;
                int i = R.id.otpEditText;
                Editable text = ((OtpEditText) nativePlusPayActivity._$_findCachedViewById(i)).getText();
                Intrinsics.checkNotNull(text);
                if (text.length() == 0) {
                    ((OtpEditText) NativePlusPayActivity.this._$_findCachedViewById(i)).setText(otp);
                    NativePlusPayActivity.this.isOtpAutoFilled = true;
                    PaytmHelper paytmHelper2 = DependencyProvider.getPaytmHelper();
                    if (paytmHelper2 == null || (genericEventParams = paytmHelper2.getGenericEventParams(SDKConstants.GA_DIRECT_OTP_INPUT_ACTION, "auto_fill", "")) == null || (paytmHelper = DependencyProvider.getPaytmHelper()) == null) {
                        return;
                    }
                    paytmHelper.sendGaEvents(genericEventParams);
                }
            }
        }));
    }

    private final void initUI() {
        throw new UnsupportedOperationException("Method not decompiled: com.paytmpayments.customuisdk.directpages.NativePlusPayActivity.initUI():void");
    }

    public static final void m24initUI$lambda9(NativePlusPayActivity nativePlusPayActivity, View view) {
        Intrinsics.checkNotNullParameter(nativePlusPayActivity, "this$0");
        ((OtpEditText) nativePlusPayActivity._$_findCachedViewById(R.id.otpEditText)).isActive = true;
    }

    public final boolean isValidItemPasted(String item) {
        Editable text = ((OtpEditText) _$_findCachedViewById(R.id.otpEditText)).getText();
        Intrinsics.checkNotNull(text);
        if (text.length() == 6) {
            return true;
        }
        if (item != null) {
            int min = Math.min(item.length(), 6);
            for (int i = 0; i < min; i++) {
                if (Character.isDigit(item.charAt(i))) {
                    return true;
                }
            }
        }
        return false;
    }

    private final boolean isValidOtp(String otp) {
        return otp.length() == 6;
    }

    public static final void m25onBackPressed$lambda20(NativePlusPayActivity nativePlusPayActivity, DialogInterface dialogInterface, int i) {
        Map<String, ? extends Object> genericEventParams;
        PaytmHelper paytmHelper;
        Map<String, ? extends Object> genericEventParams2;
        PaytmHelper paytmHelper2;
        Map<String, ? extends Object> genericEventParams3;
        PaytmHelper paytmHelper3;
        Intrinsics.checkNotNullParameter(nativePlusPayActivity, "this$0");
        PaytmHelper paytmHelper4 = DependencyProvider.getPaytmHelper();
        if (paytmHelper4 != null && (genericEventParams3 = paytmHelper4.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "cancel_otp", "init", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper3 = DependencyProvider.getPaytmHelper()) != null) {
            paytmHelper3.sendGaEvents(genericEventParams3);
        }
        UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
        if (!(utilitiesHelper != null && utilitiesHelper.isNetworkAvailable(nativePlusPayActivity))) {
            PaytmHelper paytmHelper5 = DependencyProvider.getPaytmHelper();
            if (paytmHelper5 != null && (genericEventParams2 = paytmHelper5.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "cancel_otp", "timeout", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper2 = DependencyProvider.getPaytmHelper()) != null) {
                paytmHelper2.sendGaEvents(genericEventParams2);
            }
            nativePlusPayActivity.backPressCancelTransaction();
            return;
        }
        NativePlusPayViewModel nativePlusPayViewModel = nativePlusPayActivity.mViewModel;
        if (nativePlusPayViewModel == null) {
            Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
            nativePlusPayViewModel = null;
        }
        nativePlusPayViewModel.cancelTransaction();
        PaytmHelper paytmHelper6 = DependencyProvider.getPaytmHelper();
        if (paytmHelper6 == null || (genericEventParams = paytmHelper6.getGenericEventParams(SDKConstants.GA_KEY_CANCEL_PAYMENT, SDKConstants.VALUE_YES, "")) == null || (paytmHelper = DependencyProvider.getPaytmHelper()) == null) {
            return;
        }
        paytmHelper.sendGaEvents(genericEventParams);
    }

    public static final void m26onBackPressed$lambda22(DialogInterface dialogInterface, int i) {
        Map<String, ? extends Object> genericEventParams;
        PaytmHelper paytmHelper;
        PaytmHelper paytmHelper2 = DependencyProvider.getPaytmHelper();
        if (paytmHelper2 == null || (genericEventParams = paytmHelper2.getGenericEventParams(SDKConstants.GA_KEY_CANCEL_PAYMENT, SDKConstants.VALUE_NO, "")) == null || (paytmHelper = DependencyProvider.getPaytmHelper()) == null) {
            return;
        }
        paytmHelper.sendGaEvents(genericEventParams);
    }

    private final void payOnBankSite() {
        Bundle bundle = new Bundle();
        bundle.putBoolean(SDKConstants.EXTRA_NEW_FLOW, true);
        NativePlusPayViewModel nativePlusPayViewModel = this.mViewModel;
        if (nativePlusPayViewModel == null) {
            Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
            nativePlusPayViewModel = null;
        }
        bundle.putSerializable(SDKConstants.EXTRA_BANK_FORM_ITEM, nativePlusPayViewModel.getDirectFormItemMap().get("payonbank"));
        PaytmAssistParams paytmAssistParams = this.assistParams;
        bundle.putString(SDKConstants.PAY_TYPE, paytmAssistParams != null ? paytmAssistParams.getPayType() : null);
        PaytmAssistParams paytmAssistParams2 = this.assistParams;
        bundle.putString(SDKConstants.BANK_CODE, paytmAssistParams2 != null ? paytmAssistParams2.getBankCode() : null);
        PaytmAssistParams paytmAssistParams3 = this.assistParams;
        bundle.putString(SDKConstants.CARD_TYPE, paytmAssistParams3 != null ? paytmAssistParams3.getCardType() : null);
        addPayFragment(bundle);
        showPayOnBankLoader();
        this.disableUiInteraction = true;
        ((FrameLayout) _$_findCachedViewById(R.id.disableClickView)).setClickable(true);
    }

    public final void postDataOnCallBack(final JSONObject otpApiResponse) {
        Gson gson = new Gson();
        Object obj = otpApiResponse.get("head");
        Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type org.json.JSONObject");
        ProcessTransactionInfo processTransactionInfo = new ProcessTransactionInfo((Head) gson.fromJson(((JSONObject) obj).toString(), Head.class), new Body());
        Body body = processTransactionInfo.getBody();
        if (body != null) {
            Object obj2 = otpApiResponse.get("body");
            Intrinsics.checkNotNull(obj2, "null cannot be cast to non-null type org.json.JSONObject");
            body.setCallBackUrl(((JSONObject) obj2).getString("callBackUrl"));
        }
        Object obj3 = otpApiResponse.get("body");
        Intrinsics.checkNotNull(obj3, "null cannot be cast to non-null type org.json.JSONObject");
        Object obj4 = ((JSONObject) obj3).get("txnInfo");
        Body body2 = processTransactionInfo.getBody();
        if (body2 != null) {
            body2.setTxnInfo(new Gson().fromJson(obj4.toString(), HashMap.class));
        }
        PaymentRepository.Companion companion = PaymentRepository.INSTANCE;
        Context applicationContext = getApplicationContext();
        Intrinsics.checkNotNullExpressionValue(applicationContext, "applicationContext");
        companion.getInstance(applicationContext).postDataOnCallBack(processTransactionInfo, new PaymentMethodDataSource.Callback<Object>() {
            @Override
            public void onErrorResponse(@Nullable VolleyError error, @Nullable Object errorInfo) {
                AppCompatActivity appCompatActivity = NativePlusPayActivity.this;
                Object obj5 = otpApiResponse.get("body");
                Intrinsics.checkNotNull(obj5, "null cannot be cast to non-null type org.json.JSONObject");
                PayUtility.finishSdk(appCompatActivity, ((JSONObject) obj5).get("txnInfo").toString(), null, null, null);
            }

            @Override
            public void onResponse(@Nullable Object response) {
                AppCompatActivity appCompatActivity = NativePlusPayActivity.this;
                Object obj5 = otpApiResponse.get("body");
                Intrinsics.checkNotNull(obj5, "null cannot be cast to non-null type org.json.JSONObject");
                PayUtility.finishSdk(appCompatActivity, ((JSONObject) obj5).get("txnInfo").toString(), null, null, null);
            }
        });
    }

    public final void redirectToMerchantSDK(String response, boolean retry, String resultMsg) {
        PayUtility.finishSdk(this, response, retry, resultMsg);
    }

    public final void redirectToPaymentOptions(String resultMsg) {
        Intent intent = new Intent();
        intent.putExtra(SDKConstants.DATA, resultMsg);
        setResult(SDKConstants.SHOW_ALERT, intent);
        finish();
    }

    private final void removeAutoSubmitOtpUI() {
        int i = R.id.tvPaySecurely;
        ((TextView) _$_findCachedViewById(i)).setText(getString(R.string.paytm_pay_securely));
        ((TextView) _$_findCachedViewById(i)).setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
        int i2 = R.id.autoSubmitProgressBar;
        ((ProgressBar) _$_findCachedViewById(i2)).setProgress(0);
        ((ProgressBar) _$_findCachedViewById(i2)).setVisibility(8);
    }

    public final void sendPayCompleteEvent(String status) {
        HashMap<String, String> hashMap = new HashMap<>();
        PaymentInstrument paymentInstrument = this.paymentInstrument;
        String gaPaymentMethod = paymentInstrument != null ? paymentInstrument.getGaPaymentMethod() : null;
        if (gaPaymentMethod == null) {
            gaPaymentMethod = "";
        }
        hashMap.put(SDKConstants.KEY_PAYMENT_OPTION_TYPE, gaPaymentMethod);
        PaymentInstrument paymentInstrument2 = this.paymentInstrument;
        String gaPaymentMode = paymentInstrument2 != null ? paymentInstrument2.getGaPaymentMode() : null;
        hashMap.put(SDKConstants.KEY_PAYMENT_MODE_TYPE, gaPaymentMode != null ? gaPaymentMode : "");
        hashMap.put(SDKConstants.KEY_PAYMENT_STATUS, status);
        EventLogger eventLogger = DependencyProvider.getEventLogger();
        if (eventLogger != null) {
            eventLogger.sendLogs(SDKConstants.PG_EVENT_CATEGORY, "pay_complete", hashMap);
        }
    }

    private final void setFieldsVisibility() {
        NativePlusPayViewModel nativePlusPayViewModel = this.mViewModel;
        NativePlusPayViewModel nativePlusPayViewModel2 = null;
        if (nativePlusPayViewModel == null) {
            Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
            nativePlusPayViewModel = null;
        }
        if (nativePlusPayViewModel.getDirectFormItemMap().get("submit") != null) {
            ((RelativeLayout) _$_findCachedViewById(R.id.payButton)).setVisibility(0);
        } else {
            ((RelativeLayout) _$_findCachedViewById(R.id.payButton)).setVisibility(8);
        }
        NativePlusPayViewModel nativePlusPayViewModel3 = this.mViewModel;
        if (nativePlusPayViewModel3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
            nativePlusPayViewModel3 = null;
        }
        if (nativePlusPayViewModel3.getDirectFormItemMap().get("resend") != null) {
            ((TextView) _$_findCachedViewById(R.id.tvResendOtp)).setVisibility(0);
        } else {
            ((TextView) _$_findCachedViewById(R.id.tvResendOtp)).setVisibility(8);
        }
        NativePlusPayViewModel nativePlusPayViewModel4 = this.mViewModel;
        if (nativePlusPayViewModel4 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
        } else {
            nativePlusPayViewModel2 = nativePlusPayViewModel4;
        }
        if (nativePlusPayViewModel2.getDirectFormItemMap().get("payonbank") != null) {
            ((RelativeLayout) _$_findCachedViewById(R.id.rlFooter)).setVisibility(0);
            ((TextView) _$_findCachedViewById(R.id.footerSeparator)).setVisibility(0);
        } else {
            ((RelativeLayout) _$_findCachedViewById(R.id.rlFooter)).setVisibility(8);
            ((TextView) _$_findCachedViewById(R.id.footerSeparator)).setVisibility(8);
        }
    }

    public final void showOtpErrorView(String msg) {
        ((LinearLayout) _$_findCachedViewById(R.id.rlResendOtpSuccess)).setVisibility(8);
        ((TextView) _$_findCachedViewById(R.id.tvPaymentAmount)).setVisibility(4);
        ((LinearLayout) _$_findCachedViewById(R.id.llOtpErrorView)).setVisibility(0);
        ((TextView) _$_findCachedViewById(R.id.tvOtpErrorMsg)).setText(Html.fromHtml(msg));
    }

    public final void showOtpValidationError() {
        ((OtpEditText) _$_findCachedViewById(R.id.otpEditText)).requestFocus();
        new Handler().postDelayed(new Runnable() {
            @Override
            public final void run() {
                NativePlusPayActivity.m29showOtpValidationError$lambda16(NativePlusPayActivity.this);
            }
        }, 100L);
    }

    public static final void m29showOtpValidationError$lambda16(NativePlusPayActivity nativePlusPayActivity) {
        TextView textView;
        int i;
        Intrinsics.checkNotNullParameter(nativePlusPayActivity, "this$0");
        Editable text = ((OtpEditText) nativePlusPayActivity._$_findCachedViewById(R.id.otpEditText)).getText();
        Intrinsics.checkNotNull(text);
        if (text.length() == 0) {
            textView = (TextView) nativePlusPayActivity._$_findCachedViewById(R.id.tvInvalidOtpText);
            i = R.string.empty_otp_error;
        } else {
            textView = (TextView) nativePlusPayActivity._$_findCachedViewById(R.id.tvInvalidOtpText);
            i = R.string.paytm_invalid_otp;
        }
        textView.setText(nativePlusPayActivity.getString(i));
        ((TextView) nativePlusPayActivity._$_findCachedViewById(R.id.tvInvalidOtpText)).setVisibility(0);
    }

    private final void showPayOnBankLoader() {
        int i = R.id.ltv_loading1;
        if (_$_findCachedViewById(i) != null) {
            LottieAnimationView _$_findCachedViewById = _$_findCachedViewById(i);
            Intrinsics.checkNotNull(_$_findCachedViewById, "null cannot be cast to non-null type com.airbnb.lottie.LottieAnimationView");
            _$_findCachedViewById.setVisibility(0);
            _$_findCachedViewById.setAnimation("Payments-Loader.json");
            _$_findCachedViewById.loop(true);
            _$_findCachedViewById.playAnimation();
            _$_findCachedViewById(i).setVisibility(0);
            ((TextView) _$_findCachedViewById(R.id.tvGoToBankWebSite)).setVisibility(4);
        }
    }

    private final void showPaymentLoadingState() {
        int i = R.id.ltv_loading;
        if (_$_findCachedViewById(i) != null) {
            LottieAnimationView _$_findCachedViewById = _$_findCachedViewById(i);
            Intrinsics.checkNotNull(_$_findCachedViewById, "null cannot be cast to non-null type com.airbnb.lottie.LottieAnimationView");
            _$_findCachedViewById.setVisibility(0);
            _$_findCachedViewById.setAnimation("Payments-Loader.json");
            _$_findCachedViewById.loop(true);
            _$_findCachedViewById.playAnimation();
            ((RelativeLayout) _$_findCachedViewById(R.id.payButton)).setBackgroundResource(R.drawable.native_button_onloading);
            _$_findCachedViewById(i).setVisibility(0);
            ((TextView) _$_findCachedViewById(R.id.tvPaySecurely)).setVisibility(8);
        }
    }

    public final void showResendOtpSuccessUi(String msg) {
        ((LinearLayout) _$_findCachedViewById(R.id.rlResendOtpSuccess)).setVisibility(0);
        ((TextView) _$_findCachedViewById(R.id.tvPaymentAmount)).setVisibility(4);
        ((LinearLayout) _$_findCachedViewById(R.id.llOtpErrorView)).setVisibility(8);
        ((TextView) _$_findCachedViewById(R.id.tvResendOtpSuccess)).setText(Html.fromHtml(msg));
    }

    public final void showRetryDialog(String errorMsg) {
        UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
        if (utilitiesHelper != null) {
            utilitiesHelper.showDialog(this, errorMsg, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    NativePlusPayActivity.m30showRetryDialog$lambda23(NativePlusPayActivity.this, dialogInterface, i);
                }
            });
        }
    }

    public static final void m30showRetryDialog$lambda23(NativePlusPayActivity nativePlusPayActivity, DialogInterface dialogInterface, int i) {
        Intrinsics.checkNotNullParameter(nativePlusPayActivity, "this$0");
        ((OtpEditText) nativePlusPayActivity._$_findCachedViewById(R.id.otpEditText)).setText("");
    }

    private final void submitOtp() {
        Map<String, ? extends Object> genericEventParams;
        PaytmHelper paytmHelper;
        UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
        if (!(utilitiesHelper != null && utilitiesHelper.isNetworkAvailable(this))) {
            UtilityHelper utilitiesHelper2 = DependencyProvider.getUtilitiesHelper();
            if (utilitiesHelper2 != null) {
                utilitiesHelper2.showNoInternetDialog(this, new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i) {
                        dialogInterface.dismiss();
                    }
                });
            }
            enableUiInteraction();
            return;
        }
        PaytmHelper paytmHelper2 = DependencyProvider.getPaytmHelper();
        if (paytmHelper2 != null && (genericEventParams = paytmHelper2.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "submit_otp", "init", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper = DependencyProvider.getPaytmHelper()) != null) {
            paytmHelper.sendGaEvents(genericEventParams);
        }
        disableUiInteraction();
        NativePlusPayViewModel nativePlusPayViewModel = this.mViewModel;
        if (nativePlusPayViewModel == null) {
            Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
            nativePlusPayViewModel = null;
        }
        nativePlusPayViewModel.paySecurely(String.valueOf(((OtpEditText) _$_findCachedViewById(R.id.otpEditText)).getText()));
    }

    @Nullable
    public View _$_findCachedViewById(int i) {
        Map<Integer, View> map = this._$_findViewCache;
        View view = map.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        if (findViewById == null) {
            return null;
        }
        map.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    @Override
    public void addPageVisibleGAEvent() {
    }

    @Override
    public void addPayFragment(@Nullable Bundle bundle) {
        FlowNavigator flowNavigator = DependencyProvider.getFlowNavigator();
        if (flowNavigator != null) {
            int i = R.id.fragment_container;
            FragmentManager supportFragmentManager = getSupportFragmentManager();
            Intrinsics.checkNotNullExpressionValue(supportFragmentManager, "supportFragmentManager");
            flowNavigator.addPayFragment(i, supportFragmentManager, bundle);
        }
    }

    public void attachBaseContext(@Nullable Context base) {
        super.attachBaseContext(base);
        try {
            SplitCompat.installActivity(this);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void backToCashierPage(@Nullable Fragment fragment, @Nullable String errorMsg, boolean showErrorDialog) {
        hidePayOnBankLoader();
        if (showErrorDialog) {
            UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
            if (!(utilitiesHelper != null && utilitiesHelper.isServerSDK())) {
                redirectToPaymentOptions(errorMsg);
                return;
            }
        }
        PayUtility.finishSdk(this, null, null, SDKConstants.VALUE_CAP_FAILED, errorMsg);
    }

    @NotNull
    public String getChildClassName() {
        String localClassName = getLocalClassName();
        Intrinsics.checkNotNullExpressionValue(localClassName, "localClassName");
        return localClassName;
    }

    @NotNull
    public final NativeOtpHelper getOtpHelper() {
        NativeOtpHelper nativeOtpHelper = this.otpHelper;
        if (nativeOtpHelper != null) {
            return nativeOtpHelper;
        }
        Intrinsics.throwUninitializedPropertyAccessException("otpHelper");
        return null;
    }

    public void onBackPressed() {
        UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
        if (utilitiesHelper != null) {
            utilitiesHelper.showTwoButtonDialogNew(this, getString(R.string.native_back_press_title), getString(R.string.common_yes), getString(R.string.common_no), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    NativePlusPayActivity.m25onBackPressed$lambda20(NativePlusPayActivity.this, dialogInterface, i);
                }
            }, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    NativePlusPayActivity.m26onBackPressed$lambda22(dialogInterface, i);
                }
            });
        }
    }

    @Override
    public void onClick(@Nullable View v) {
        Map<String, ? extends Object> genericEventParams;
        PaytmHelper paytmHelper;
        Map<String, ? extends Object> genericEventParams2;
        PaytmHelper paytmHelper2;
        NativePlusPayViewModel nativePlusPayViewModel = null;
        Integer valueOf = v != null ? Integer.valueOf(v.getId()) : null;
        int i = R.id.ivBack;
        if (valueOf != null && valueOf.intValue() == i) {
            onBackPressed();
            return;
        }
        int i2 = R.id.tvGoToBankWebSite;
        boolean z = false;
        if (valueOf != null && valueOf.intValue() == i2) {
            UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
            if (utilitiesHelper != null && utilitiesHelper.isNetworkAvailable(this)) {
                z = true;
            }
            if (!z) {
                UtilityHelper utilitiesHelper2 = DependencyProvider.getUtilitiesHelper();
                if (utilitiesHelper2 != null) {
                    utilitiesHelper2.showNoInternetDialog(this, new DialogInterface.OnClickListener() {
                        @Override
                        public final void onClick(DialogInterface dialogInterface, int i3) {
                            dialogInterface.dismiss();
                        }
                    });
                    return;
                }
                return;
            }
            PaytmHelper paytmHelper3 = DependencyProvider.getPaytmHelper();
            if (paytmHelper3 != null && (genericEventParams2 = paytmHelper3.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "go_to_bank", "init", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper2 = DependencyProvider.getPaytmHelper()) != null) {
                paytmHelper2.sendGaEvents(genericEventParams2);
            }
            payOnBankSite();
            return;
        }
        int i3 = R.id.tvResendOtp;
        if (valueOf == null || valueOf.intValue() != i3) {
            int i4 = R.id.payButton;
            if (valueOf != null && valueOf.intValue() == i4) {
                if (((ProgressBar) _$_findCachedViewById(R.id.autoSubmitProgressBar)).getVisibility() == 0) {
                    ((RelativeLayout) _$_findCachedViewById(i4)).setOnClickListener(null);
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            ((RelativeLayout) NativePlusPayActivity.this._$_findCachedViewById(R.id.payButton)).setOnClickListener(NativePlusPayActivity.this);
                        }
                    }, 1000L);
                    removeAutoSubmitOtpUI();
                    return;
                } else if (isValidOtp(String.valueOf(((OtpEditText) _$_findCachedViewById(R.id.otpEditText)).getText()))) {
                    submitOtp();
                    return;
                } else {
                    showOtpValidationError();
                    return;
                }
            }
            return;
        }
        UtilityHelper utilitiesHelper3 = DependencyProvider.getUtilitiesHelper();
        if (utilitiesHelper3 != null && utilitiesHelper3.isNetworkAvailable(this)) {
            z = true;
        }
        if (!z) {
            UtilityHelper utilitiesHelper4 = DependencyProvider.getUtilitiesHelper();
            if (utilitiesHelper4 != null) {
                utilitiesHelper4.showNoInternetDialog(this, new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i5) {
                        dialogInterface.dismiss();
                    }
                });
                return;
            }
            return;
        }
        PaytmHelper paytmHelper4 = DependencyProvider.getPaytmHelper();
        if (paytmHelper4 != null && (genericEventParams = paytmHelper4.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "resend_otp", "init", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper = DependencyProvider.getPaytmHelper()) != null) {
            paytmHelper.sendGaEvents(genericEventParams);
        }
        disableResendButton();
        NativePlusPayViewModel nativePlusPayViewModel2 = this.mViewModel;
        if (nativePlusPayViewModel2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
        } else {
            nativePlusPayViewModel = nativePlusPayViewModel2;
        }
        nativePlusPayViewModel.resendOtp();
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        Map<String, ? extends Object> genericEventParams;
        PaytmHelper paytmHelper;
        Serializable serializableExtra;
        Serializable serializableExtra2;
        Serializable serializableExtra3;
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_native_payment);
        if (savedInstanceState != null) {
            Serializable serializable = savedInstanceState.getSerializable("processTransactionInfo");
            this.processTransactionInfo = serializable instanceof ProcessTransactionInfo ? (ProcessTransactionInfo) serializable : null;
            Serializable serializable2 = savedInstanceState.getSerializable(SDKConstants.EXTRA_ASSIST_PARAMS);
            this.assistParams = serializable2 instanceof PaytmAssistParams ? (PaytmAssistParams) serializable2 : null;
        }
        Intent intent = getIntent();
        if (intent != null && (serializableExtra3 = intent.getSerializableExtra("processTransactionInfo")) != null) {
            this.processTransactionInfo = serializableExtra3 instanceof ProcessTransactionInfo ? (ProcessTransactionInfo) serializableExtra3 : null;
        }
        Intent intent2 = getIntent();
        if (intent2 != null && (serializableExtra2 = intent2.getSerializableExtra(SDKConstants.EXTRA_ASSIST_PARAMS)) != null) {
            this.assistParams = serializableExtra2 instanceof PaytmAssistParams ? (PaytmAssistParams) serializableExtra2 : null;
        }
        Intent intent3 = getIntent();
        if (intent3 != null && (serializableExtra = intent3.getSerializableExtra(SDKConstants.PAYMENT_INFO)) != null) {
            this.paymentInstrument = serializableExtra instanceof PaymentInstrument ? (PaymentInstrument) serializableExtra : null;
        }
        Application application = getApplication();
        Intrinsics.checkNotNullExpressionValue(application, "this.application");
        this.mViewModel = new NativePlusPayViewModel(application, this.processTransactionInfo);
        addSubmitObservable();
        addResendObserable();
        addCancelObserable();
        initUI();
        initOtpHelper();
        PaytmHelper paytmHelper2 = DependencyProvider.getPaytmHelper();
        if (paytmHelper2 == null || (genericEventParams = paytmHelper2.getGenericEventParams("", SDKConstants.PG_SCREEN_LOADED, "direct_otp", "", "", SDKConstants.GA_NATIVE_PLUS)) == null || (paytmHelper = DependencyProvider.getPaytmHelper()) == null) {
            return;
        }
        paytmHelper.sendGaEvents(genericEventParams);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        AlertDialog alertDialog = this.mAlertDialog;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
    }

    public void onSaveInstanceState(@NotNull Bundle outState) {
        Intrinsics.checkNotNullParameter(outState, "outState");
        outState.putSerializable("processTransactionInfo", this.processTransactionInfo);
        outState.putSerializable(SDKConstants.EXTRA_ASSIST_PARAMS, this.assistParams);
        super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(outState);
    }

    public void onStart() {
        super.onStart();
        getOtpHelper().onStartOtpHelper();
    }

    public void onStop() {
        super.onStop();
        getOtpHelper().onStopOtpHelper();
    }

    @Override
    public void onWebPageFinish() {
        hidePayOnBankLoader();
        this.disableUiInteraction = false;
        ((FrameLayout) _$_findCachedViewById(R.id.disableClickView)).setClickable(false);
        UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
        if (utilitiesHelper != null) {
            utilitiesHelper.dismissLoadingSheet(this);
        }
    }

    @Override
    public void saveActivityFromFinish(@Nullable String activityName) {
        if (StringsKt.equals(activityName, getChildClassName(), true)) {
            return;
        }
        finish();
    }

    public final void setOtpHelper(@NotNull NativeOtpHelper nativeOtpHelper) {
        Intrinsics.checkNotNullParameter(nativeOtpHelper, "<set-?>");
        this.otpHelper = nativeOtpHelper;
    }

    @Override
    public boolean shouldKillActivity() {
        return true;
    }
}