导航菜单

页面标题

页面副标题

Housing v14.7.8 - CashfreeNativeCheckoutActivity.java 源代码

正在查看: Housing v14.7.8 应用的 CashfreeNativeCheckoutActivity.java JAVA 源代码文件

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


package com.cashfree.pg.ui.hidden.checkout;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.ProgressBar;
import android.widget.Toast;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.camera.core.n0;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.cashfree.pg.core.api.CFCorePaymentGatewayService;
import com.cashfree.pg.core.api.CFTheme;
import com.cashfree.pg.core.api.base.CFPayment;
import com.cashfree.pg.core.api.card.vault.SavedCardsResponse;
import com.cashfree.pg.core.api.exception.CFException;
import com.cashfree.pg.core.api.persistence.CFPersistence;
import com.cashfree.pg.core.api.state.PaymentMode;
import com.cashfree.pg.core.api.ui.PaymentInitiationData;
import com.cashfree.pg.core.api.ui.dialog.PVBottomSheetDialog;
import com.cashfree.pg.core.api.utils.AnalyticsUtil;
import com.cashfree.pg.core.api.utils.CFErrorResponse;
import com.cashfree.pg.core.api.utils.CFUPIUtil;
import com.cashfree.pg.core.api.utils.CFUtil;
import com.cashfree.pg.core.api.utils.ThreadUtil;
import com.cashfree.pg.core.hidden.analytics.UserEvents;
import com.cashfree.pg.core.hidden.network.response.models.ConfigResponse;
import com.cashfree.pg.core.hidden.network.response.models.config.OrderDetails;
import com.cashfree.pg.core.hidden.network.response.models.config.PaymentModes;
import com.cashfree.pg.core.hidden.nfc.NfcCardReader;
import com.cashfree.pg.core.hidden.nfc.NfcCardResponse;
import com.cashfree.pg.core.hidden.utils.CFPaymentModes;
import com.cashfree.pg.ui.api.CFDropCheckoutPayment;
import com.cashfree.pg.ui.hidden.activity.INativePaymentCheckoutEvents;
import com.cashfree.pg.ui.hidden.checkout.callbacks.CFNativeCoreCallbacks;
import com.cashfree.pg.ui.hidden.checkout.dialog.q;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.a0;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.g;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.h;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.m;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.q;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.v;
import com.cashfree.pg.ui.hidden.checkout.subview.savedcards.e;
import com.cashfree.pg.ui.hidden.dao.d;
import java.util.ArrayList;
import java.util.List;

public class CashfreeNativeCheckoutActivity extends com.cashfree.pg.ui.hidden.activity.base.b implements INativePaymentCheckoutEvents, v.c, m.b, PVBottomSheetDialog.PaymentVerificationListener, a0.a, q.a, g.c, q.c, h.b, d.c, e.a {
    public static final String ANDROID_NFC_ACTION_ADAPTER_STATE_CHANGED = "android.nfc.action.ADAPTER_STATE_CHANGED";
    private static final String TAG = "CashfreeNativeCheckoutActivity";
    private com.cashfree.pg.ui.hidden.checkout.subview.payment.g cardView;
    private CFTheme cfTheme;
    private com.cashfree.pg.ui.hidden.checkout.dialog.c emiInfoDialog;
    private com.cashfree.pg.ui.hidden.checkout.subview.payment.h emiView;
    private androidx.appcompat.app.f exitDialog;
    private boolean isCreated;
    private LinearLayoutCompat llContentScrolling;
    private CoordinatorLayout loader;
    private com.cashfree.pg.ui.hidden.viewModel.f nativeCheckoutViewModel;
    private com.cashfree.pg.ui.hidden.checkout.dialog.i nbAppsDialog;
    private com.cashfree.pg.ui.hidden.checkout.subview.payment.m netBankingView;
    private w nfcCardManager;
    private NfcCardReader nfcCardReader;
    private com.cashfree.pg.ui.hidden.checkout.subview.payment.q payLaterView;
    private PaymentInitiationData paymentInitiationData;
    private com.cashfree.pg.ui.hidden.checkout.dialog.o qrDialog;
    private com.cashfree.pg.ui.hidden.checkout.dialog.q quickCheckoutDialog;
    private com.cashfree.pg.ui.hidden.checkout.dialog.t savedCardDeleteDialog;
    private com.cashfree.pg.ui.hidden.checkout.subview.savedcards.e savedCardView;
    private com.cashfree.pg.ui.hidden.checkout.subview.f toolbarView;
    private com.cashfree.pg.ui.hidden.checkout.dialog.u upiAppsDialog;
    private com.cashfree.pg.ui.hidden.checkout.subview.payment.v upiView;
    private a0 walletView;
    private boolean isResponseSent = false;
    private boolean quickCheckoutEnabled = true;
    public final CFNativeCoreCallbacks cfNativeCoreCallbacks = new AnonymousClass1();

    public class AnonymousClass1 extends CFNativeCoreCallbacks {
        public AnonymousClass1() {
        }

        @Override
        public final void a(String str) {
            CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity = CashfreeNativeCheckoutActivity.this;
            String str2 = CashfreeNativeCheckoutActivity.ANDROID_NFC_ACTION_ADAPTER_STATE_CHANGED;
            cashfreeNativeCheckoutActivity.V(str);
        }

        @Override
        public void onPaymentFailure(CFErrorResponse cFErrorResponse, String str) {
            ThreadUtil.runOnUIThread(new c(1, this, cFErrorResponse));
        }

        @Override
        public final void onQRFetched(String str) {
            ThreadUtil.runOnUIThread(new c(0, this, str));
        }
    }

    public static class a {
        static final int[] $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes;
        static final int[] $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode;

        static {
            int[] iArr = new int[CFPaymentModes.values().length];
            $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes = iArr;
            try {
                iArr[CFPaymentModes.UPI.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.EMI.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.NB.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.WALLET.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.PAY_LATER.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.CARD.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            int[] iArr2 = new int[com.cashfree.pg.ui.hidden.utils.d.values().length];
            $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode = iArr2;
            try {
                iArr2[com.cashfree.pg.ui.hidden.utils.d.upi_id_invalid.ordinal()] = 1;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[com.cashfree.pg.ui.hidden.utils.d.card_holder_name_invalid.ordinal()] = 2;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[com.cashfree.pg.ui.hidden.utils.d.card_number_invalid.ordinal()] = 3;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[com.cashfree.pg.ui.hidden.utils.d.phone_ineligible.ordinal()] = 4;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[com.cashfree.pg.ui.hidden.utils.d.payment_failed_headless.ordinal()] = 5;
            } catch (NoSuchFieldError unused11) {
            }
            try {
                $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[com.cashfree.pg.ui.hidden.utils.d.action_cancelled.ordinal()] = 6;
            } catch (NoSuchFieldError unused12) {
            }
        }
    }

    public static boolean D(com.cashfree.pg.ui.hidden.checkout.subview.payment.r rVar) {
        return rVar != null && rVar.a();
    }

    public static void q(CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity, x xVar, OrderDetails orderDetails) {
        cashfreeNativeCheckoutActivity.getClass();
        if (xVar.b().size() > 0) {
            com.google.android.material.bottomsheet.j jVar = cashfreeNativeCheckoutActivity.quickCheckoutDialog;
            if (jVar != null && jVar.isShowing()) {
                cashfreeNativeCheckoutActivity.quickCheckoutDialog.dismiss();
            }
            cashfreeNativeCheckoutActivity.quickCheckoutDialog = new com.cashfree.pg.ui.hidden.checkout.dialog.q(cashfreeNativeCheckoutActivity, xVar, orderDetails, cashfreeNativeCheckoutActivity.cfTheme, cashfreeNativeCheckoutActivity);
            if (cashfreeNativeCheckoutActivity.isFinishing() || cashfreeNativeCheckoutActivity.isDestroyed()) {
                return;
            }
            cashfreeNativeCheckoutActivity.quickCheckoutDialog.show();
        }
    }

    public static void r(CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity, SavedCardsResponse savedCardsResponse) {
        if (cashfreeNativeCheckoutActivity.savedCardView == null) {
            cashfreeNativeCheckoutActivity.savedCardView = new com.cashfree.pg.ui.hidden.checkout.subview.savedcards.e(cashfreeNativeCheckoutActivity.llContentScrolling, savedCardsResponse.getSavedCards(), cashfreeNativeCheckoutActivity, cashfreeNativeCheckoutActivity.cfTheme);
        }
    }

    public static void s(ConfigResponse configResponse, CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity, ArrayList arrayList, ArrayList arrayList2) {
        ?? r62;
        ArrayList arrayList3;
        ArrayList arrayList4;
        if (!cashfreeNativeCheckoutActivity.quickCheckoutEnabled || com.cashfree.pg.ui.hidden.persistence.a.c().e()) {
            r62 = cashfreeNativeCheckoutActivity;
            arrayList3 = arrayList;
            arrayList4 = arrayList2;
        } else {
            CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity2 = cashfreeNativeCheckoutActivity;
            arrayList3 = arrayList;
            cashfreeNativeCheckoutActivity.nativeCheckoutViewModel.s(arrayList3, configResponse.getPaymentModes(), configResponse.getOrderDetails(), arrayList2, cashfreeNativeCheckoutActivity2);
            arrayList4 = arrayList2;
            r62 = cashfreeNativeCheckoutActivity2;
        }
        r62.runOnUiThread(new n0((Object) r62, configResponse, arrayList3, arrayList4, 4));
    }

    public static void t(CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity) {
        if (cashfreeNativeCheckoutActivity.isResponseSent) {
            return;
        }
        cashfreeNativeCheckoutActivity.V(cashfreeNativeCheckoutActivity.nativeCheckoutViewModel.q());
    }

    public static void u(com.cashfree.pg.core.hidden.network.response.models.ConfigResponse r6, com.cashfree.pg.ui.hidden.checkout.CashfreeNativeCheckoutActivity r7, java.util.ArrayList r8, java.util.ArrayList r9) {
        throw new UnsupportedOperationException("Method not decompiled: com.cashfree.pg.ui.hidden.checkout.CashfreeNativeCheckoutActivity.u(com.cashfree.pg.core.hidden.network.response.models.ConfigResponse, com.cashfree.pg.ui.hidden.checkout.CashfreeNativeCheckoutActivity, java.util.ArrayList, java.util.ArrayList):void");
    }

    public static void v(CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity) {
        if (cashfreeNativeCheckoutActivity.isResponseSent) {
            return;
        }
        cashfreeNativeCheckoutActivity.V(cashfreeNativeCheckoutActivity.nativeCheckoutViewModel.q());
    }

    public static void w(CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity, String str) {
        androidx.appcompat.app.v vVar = cashfreeNativeCheckoutActivity.qrDialog;
        if (vVar != null && vVar.isShowing()) {
            cashfreeNativeCheckoutActivity.qrDialog.dismiss();
        }
        cashfreeNativeCheckoutActivity.qrDialog = new com.cashfree.pg.ui.hidden.checkout.dialog.o(cashfreeNativeCheckoutActivity, str, cashfreeNativeCheckoutActivity.cfTheme, cashfreeNativeCheckoutActivity);
        if (cashfreeNativeCheckoutActivity.isFinishing() || cashfreeNativeCheckoutActivity.isDestroyed()) {
            return;
        }
        cashfreeNativeCheckoutActivity.qrDialog.show();
    }

    public static void x(CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity, CFErrorResponse cFErrorResponse) {
        cashfreeNativeCheckoutActivity.getClass();
        switch (a.$SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[com.cashfree.pg.ui.hidden.utils.d.getCode(cFErrorResponse.getCode()).ordinal()]) {
            case 1:
                com.cashfree.pg.ui.hidden.checkout.subview.payment.v vVar = cashfreeNativeCheckoutActivity.upiView;
                if (vVar != null) {
                    vVar.o();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new o(cashfreeNativeCheckoutActivity, cFErrorResponse));
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new p(cashfreeNativeCheckoutActivity));
                break;
            case 2:
                com.cashfree.pg.ui.hidden.checkout.subview.payment.g gVar = cashfreeNativeCheckoutActivity.cardView;
                if (gVar != null) {
                    gVar.q();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new q(cashfreeNativeCheckoutActivity, cFErrorResponse));
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new r(cashfreeNativeCheckoutActivity));
                CFPersistence.getInstance().clearTxnID();
                break;
            case 3:
                com.cashfree.pg.ui.hidden.checkout.subview.payment.g gVar2 = cashfreeNativeCheckoutActivity.cardView;
                if (gVar2 != null) {
                    gVar2.s();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new s(cashfreeNativeCheckoutActivity, cFErrorResponse));
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new t(cashfreeNativeCheckoutActivity));
                CFPersistence.getInstance().clearTxnID();
                break;
            case 4:
                com.cashfree.pg.ui.hidden.checkout.subview.payment.q qVar = cashfreeNativeCheckoutActivity.payLaterView;
                if (qVar != null) {
                    qVar.l();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new u(cashfreeNativeCheckoutActivity, cFErrorResponse));
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new v(cashfreeNativeCheckoutActivity));
                CFPersistence.getInstance().clearTxnID();
                break;
            case 5:
            case 6:
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new d(cashfreeNativeCheckoutActivity));
                CFPersistence.getInstance().clearTxnID();
                break;
            default:
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new e(cashfreeNativeCheckoutActivity));
                CFPersistence.getInstance().clearTxnID();
                cashfreeNativeCheckoutActivity.U(cFErrorResponse);
                break;
        }
    }

    public final com.cashfree.pg.ui.hidden.checkout.subview.payment.r B(ConfigResponse configResponse, CFPaymentModes cFPaymentModes, ArrayList arrayList) {
        PaymentModes paymentModes = configResponse.getPaymentModes();
        switch (a.$SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[cFPaymentModes.ordinal()]) {
            case 1:
                boolean isUPICollectEnable = paymentModes.isUPICollectEnable();
                boolean isUPIQRModeEnable = paymentModes.isUPIQRModeEnable();
                if ((isUPICollectEnable || ((arrayList != null && !arrayList.isEmpty()) || getResources().getBoolean(g5.b.isDeviceTablet))) && this.upiView == null) {
                    this.upiView = new com.cashfree.pg.ui.hidden.checkout.subview.payment.v(this.llContentScrolling, configResponse.getOrderDetails(), isUPICollectEnable, isUPIQRModeEnable, this.cfTheme, arrayList, this);
                }
                return this.upiView;
            case 2:
                if (this.emiView == null && !paymentModes.getEMI().isEmpty()) {
                    this.emiView = new com.cashfree.pg.ui.hidden.checkout.subview.payment.h(this.llContentScrolling, configResponse.getOrderDetails(), paymentModes.getEMI(), this.cfTheme, this);
                }
                return this.emiView;
            case 3:
                if (this.netBankingView == null && !paymentModes.getNetBanking().isEmpty()) {
                    this.netBankingView = new com.cashfree.pg.ui.hidden.checkout.subview.payment.m(this.llContentScrolling, paymentModes.getNetBanking(), configResponse.getOrderDetails(), this.cfTheme, this);
                }
                return this.netBankingView;
            case 4:
                if (this.walletView == null && !paymentModes.getWallet().isEmpty()) {
                    this.walletView = new a0(this.llContentScrolling, paymentModes.getWallet(), configResponse.getOrderDetails(), configResponse.getCustomerDetails(), this.cfTheme, this);
                }
                return this.walletView;
            case 5:
                if (this.payLaterView == null && !paymentModes.getPayLater().isEmpty()) {
                    this.payLaterView = new com.cashfree.pg.ui.hidden.checkout.subview.payment.q(this.llContentScrolling, paymentModes.getPayLater(), configResponse.getOrderDetails(), configResponse.getCustomerDetails(), this.cfTheme, this);
                }
                return this.payLaterView;
            case 6:
                if (this.cardView == null && !paymentModes.getCard().isEmpty()) {
                    this.cardView = new com.cashfree.pg.ui.hidden.checkout.subview.payment.g(this.llContentScrolling, configResponse.getOrderDetails(), this.cfTheme, configResponse.getFeatureConfig(), this);
                }
                return this.cardView;
            default:
                return null;
        }
    }

    public final void C() {
        com.cashfree.pg.ui.hidden.checkout.dialog.c cVar = this.emiInfoDialog;
        if (cVar == null || !cVar.isVisible()) {
            return;
        }
        this.emiInfoDialog.dismissAllowingStateLoss();
        this.emiInfoDialog = null;
    }

    public final void E(String str, String str2, String str3, String str4, String str5, boolean z) {
        this.nativeCheckoutViewModel.i(str, str2, str3, str4, str5, z);
    }

    public final void F() {
        if (D(this.upiView) || D(this.netBankingView) || D(this.walletView) || D(this.payLaterView) || D(this.cardView)) {
            return;
        }
        this.toolbarView.d();
    }

    public final void G() {
        this.emiInfoDialog = null;
    }

    public final void H(List list, OrderDetails orderDetails) {
        C();
        this.emiInfoDialog = new com.cashfree.pg.ui.hidden.checkout.dialog.c(list, orderDetails, this.cfTheme, this);
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.emiInfoDialog.show(getSupportFragmentManager(), com.cashfree.pg.ui.hidden.checkout.dialog.c.TAG);
    }

    public final void I(h.a aVar) {
        C();
        this.nativeCheckoutViewModel.h(aVar);
    }

    public final void J(PaymentInitiationData paymentInitiationData) {
        this.nativeCheckoutViewModel.j(paymentInitiationData);
    }

    public final void K(PaymentMode paymentMode) {
        AnalyticsUtil.addEvent(UserEvents.cfevent_payment_mode_focus, new k(this, paymentMode));
        com.cashfree.pg.ui.hidden.checkout.subview.payment.v vVar = this.upiView;
        if (vVar != null && paymentMode != PaymentMode.UPI_INTENT && paymentMode != PaymentMode.UPI_COLLECT) {
            vVar.m();
        }
        com.cashfree.pg.ui.hidden.checkout.subview.payment.m mVar = this.netBankingView;
        if (mVar != null && paymentMode != PaymentMode.NET_BANKING) {
            mVar.i();
        }
        a0 a0Var = this.walletView;
        if (a0Var != null && paymentMode != PaymentMode.WALLET) {
            a0Var.k();
        }
        com.cashfree.pg.ui.hidden.checkout.subview.payment.q qVar = this.payLaterView;
        if (qVar != null && paymentMode != PaymentMode.PAY_LATER) {
            qVar.k();
        }
        com.cashfree.pg.ui.hidden.checkout.subview.payment.g gVar = this.cardView;
        if (gVar != null && paymentMode != PaymentMode.CARD) {
            gVar.m();
        }
        this.toolbarView.b();
    }

    public final void L(PaymentInitiationData paymentInitiationData) {
        this.nativeCheckoutViewModel.k(paymentInitiationData);
    }

    public final void M(SavedCardsResponse.SavedCards savedCards) {
        com.google.android.material.bottomsheet.j jVar = this.savedCardDeleteDialog;
        if (jVar != null && jVar.isShowing()) {
            this.savedCardDeleteDialog.dismiss();
        }
        ?? tVar = new com.cashfree.pg.ui.hidden.checkout.dialog.t(this, this.cfTheme, savedCards, this);
        this.savedCardDeleteDialog = tVar;
        tVar.show();
    }

    public final void N(SavedCardsResponse.SavedCards savedCards) {
        String instrumentID = savedCards.getInstrumentID();
        this.nativeCheckoutViewModel.p(instrumentID, new n(this, instrumentID));
    }

    public final void O(SavedCardsResponse.SavedCards savedCards, String str) {
        this.nativeCheckoutViewModel.m(savedCards.getInstrumentID(), str);
    }

    public final void P(PaymentInitiationData paymentInitiationData) {
        this.nativeCheckoutViewModel.l(paymentInitiationData);
    }

    public final void Q(ArrayList arrayList, OrderDetails orderDetails) {
        com.google.android.material.bottomsheet.j jVar = this.nbAppsDialog;
        if (jVar != null && jVar.isShowing()) {
            this.nbAppsDialog.dismiss();
        }
        this.nbAppsDialog = new com.cashfree.pg.ui.hidden.checkout.dialog.i(this, arrayList, orderDetails, this.cfTheme, this);
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.nbAppsDialog.show();
    }

    public final void R(ArrayList arrayList, OrderDetails orderDetails) {
        com.google.android.material.bottomsheet.j jVar = this.upiAppsDialog;
        if (jVar != null && jVar.isShowing()) {
            this.upiAppsDialog.dismiss();
        }
        this.upiAppsDialog = new com.cashfree.pg.ui.hidden.checkout.dialog.u(this, arrayList, orderDetails, this.cfTheme, new b(this, 2));
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.upiAppsDialog.show();
    }

    public final void S(PaymentInitiationData paymentInitiationData) {
        this.nativeCheckoutViewModel.n(paymentInitiationData);
    }

    public final void T(PaymentInitiationData paymentInitiationData) {
        this.nativeCheckoutViewModel.o(paymentInitiationData);
    }

    public final void U(CFErrorResponse cFErrorResponse) {
        String q;
        finish();
        if (this.isResponseSent) {
            return;
        }
        this.isResponseSent = true;
        if (cFErrorResponse.getMessage().equals("payment method failed.") || (q = this.nativeCheckoutViewModel.q()) == null) {
            return;
        }
        ThreadUtil.runOnUIThread(new c(q, cFErrorResponse));
    }

    public final void V(String str) {
        AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new i(this, str));
        AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_close, new j(this, str));
        CFPersistence.getInstance().clearTxnID();
        if (this.quickCheckoutEnabled) {
            this.nativeCheckoutViewModel.v(this.paymentInitiationData, CFPersistence.getInstance().getEnvironment());
        }
        finish();
        if (this.isResponseSent) {
            return;
        }
        this.isResponseSent = true;
        if (str != null) {
            ThreadUtil.runOnUIThread(new m(str, 1));
        }
    }

    public final void W(NfcAdapter nfcAdapter) {
        if (this.cardView != null) {
            if (nfcAdapter.isEnabled()) {
                AnalyticsUtil.addEvent(UserEvents.NFC_ENABLED);
                this.cardView.t(g.d.NFC_ENABLED);
            } else {
                AnalyticsUtil.addEvent(UserEvents.NFC_DISABLED);
                this.cardView.t(g.d.NFC_DISABLED);
            }
        }
    }

    @Override
    public final void a(CFErrorResponse cFErrorResponse) {
    }

    @Override
    public final void b() {
        ThreadUtil.runOnUIThread(new com.cashfree.pg.ui.hidden.checkout.a(this, 0));
    }

    @Override
    public final void d(ConfigResponse configResponse, ArrayList arrayList) {
        ArrayList arrayList2;
        if (arrayList.isEmpty()) {
            U(CFUtil.getResponseFromError(CFUtil.getFailedResponse("no payment_modes are available as per configuration.")));
            return;
        }
        if (arrayList.contains(CFPaymentModes.UPI)) {
            CFUPIUtil.getInstalledUPIApps(this, new androidx.camera.extensions.f(this, 3, arrayList, configResponse));
            return;
        }
        if (!this.quickCheckoutEnabled || com.cashfree.pg.ui.hidden.persistence.a.c().e()) {
            arrayList2 = arrayList;
        } else {
            arrayList2 = arrayList;
            this.nativeCheckoutViewModel.s(arrayList2, configResponse.getPaymentModes(), configResponse.getOrderDetails(), new ArrayList(), this);
        }
        runOnUiThread(new n0(this, configResponse, arrayList2, (Object) null, 4));
    }

    @Override
    public final void e(SavedCardsResponse savedCardsResponse) {
        runOnUiThread(new c(4, this, savedCardsResponse));
    }

    @Override
    public final void f() {
        ThreadUtil.runOnUIThread(new com.cashfree.pg.ui.hidden.checkout.a(this, 1));
    }

    @Override
    public final void g(CFPayment cFPayment, PaymentInitiationData paymentInitiationData) {
        try {
            CFDropCheckoutPayment b = com.cashfree.pg.ui.hidden.persistence.a.c().b();
            if (b != null && b.getSource() != null) {
                String[] split = b.getSource().split("-");
                cFPayment.setCfSDKFlavour(CFPayment.CFSDKFlavour.fromString(split[1]).withVersion(split[2]));
                cFPayment.setCfsdkFramework(CFPayment.CFSDKFramework.fromString(split[0]).withVersion(split[3]));
                cFPayment.withBrowserVersion(split[7]);
            }
            CFPersistence.getInstance().setPaymentInitiationData(paymentInitiationData);
            this.paymentInitiationData = paymentInitiationData;
            runOnUiThread(new com.cashfree.pg.ui.hidden.checkout.a(this, 3));
            cFPayment.setTheme(this.cfTheme);
            CFCorePaymentGatewayService.getInstance().doPayment(this, cFPayment);
        } catch (CFException e) {
            e.printStackTrace();
        }
    }

    @Override
    public final com.cashfree.pg.ui.hidden.viewModel.a n() {
        return this.nativeCheckoutViewModel;
    }

    public final void onBackPressed() {
        this.exitDialog = new com.cashfree.pg.ui.hidden.checkout.dialog.e(this, this.cfTheme, new b(this, 0));
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.exitDialog.show();
    }

    @Override
    public final void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_open, new g(this));
        this.paymentInitiationData = CFPersistence.getInstance().getPaymentInitiationData();
        CFCorePaymentGatewayService.getInstance().setCheckoutCallback(this.cfNativeCoreCallbacks.b());
        CFCorePaymentGatewayService.getInstance().setQRCallback(this.cfNativeCoreCallbacks);
        try {
            this.quickCheckoutEnabled = getResources().getBoolean(g5.b.cf_quick_checkout_enabled);
        } catch (Exception e) {
            s4.a.c().b(TAG, e.getMessage());
        }
        this.isCreated = true;
        this.isResponseSent = false;
        setContentView(g5.e.activity_cashfree_native_checkout);
        com.cashfree.pg.ui.hidden.viewModel.f fVar = new com.cashfree.pg.ui.hidden.viewModel.f(this, new b(this, 1));
        this.nativeCheckoutViewModel = fVar;
        this.cfTheme = fVar.t();
        this.loader = findViewById(g5.d.cf_loader);
        int parseColor = Color.parseColor(this.cfTheme.getNavigationBarBackgroundColor());
        ((ProgressBar) findViewById(g5.d.progress_bar)).getIndeterminateDrawable().setColorFilter(parseColor, PorterDuff.Mode.MULTIPLY);
        getWindow().setStatusBarColor(parseColor);
        this.llContentScrolling = findViewById(g5.d.llc_content);
        com.cashfree.pg.ui.hidden.checkout.subview.f fVar2 = new com.cashfree.pg.ui.hidden.checkout.subview.f(findViewById(g5.d.cf_cl_root), this.cfTheme);
        this.toolbarView = fVar2;
        fVar2.d();
        setSupportActionBar(this.toolbarView.c());
        if (getSupportActionBar() != null) {
            getSupportActionBar().m(true);
            getSupportActionBar().q("");
        }
        runOnUiThread(new com.cashfree.pg.ui.hidden.checkout.a(this, 3));
        this.nativeCheckoutViewModel.u();
        this.nativeCheckoutViewModel.g(this);
    }

    @Override
    public final void onDestroy() {
        androidx.appcompat.app.v vVar = this.qrDialog;
        if (vVar != null && vVar.isShowing()) {
            this.qrDialog.dismiss();
        }
        com.google.android.material.bottomsheet.j jVar = this.quickCheckoutDialog;
        if (jVar != null && jVar.isShowing()) {
            this.quickCheckoutDialog.dismiss();
        }
        com.cashfree.pg.ui.hidden.checkout.subview.savedcards.e eVar = this.savedCardView;
        if (eVar != null) {
            eVar.b();
        }
        super.onDestroy();
    }

    public final void onNewIntent(Intent intent) {
        super/*androidx.activity.h*/.onNewIntent(intent);
        Tag tag = (Tag) intent.getParcelableExtra("android.nfc.extra.TAG");
        if (tag == null) {
            Toast.makeText((Context) this, (CharSequence) "TAG null", 0).show();
            return;
        }
        NfcCardResponse readCard = this.nfcCardReader.readCard(tag);
        if (readCard == null || readCard.getEmvCard() == null || this.cardView == null) {
            return;
        }
        AnalyticsUtil.addEvent(UserEvents.NFC_CARD_INFO_ENTRY_DONE, new f(this, readCard));
        s4.a c = s4.a.c();
        String cardNumber = readCard.getEmvCard().getCardNumber();
        String expireDate = readCard.getEmvCard().getExpireDate();
        String holderFirstname = readCard.getEmvCard().getHolderFirstname();
        String holderLastname = readCard.getEmvCard().getHolderLastname();
        StringBuilder r = androidx.datastore.preferences.protobuf.q.r(cardNumber, " \n ", expireDate, " \n ", holderFirstname);
        r.append(" \n ");
        r.append(holderLastname);
        c.a(TAG, r.toString());
        this.cardView.r(readCard.getEmvCard().getCardNumber(), readCard.getEmvCard().getExpireDate());
    }

    public final boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() == 16908332) {
            onBackPressed();
        }
        return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
    }

    @Override
    public final void onPVCancelled() {
    }

    @Override
    public final void onPVFailed() {
        this.nativeCheckoutViewModel.r();
    }

    @Override
    public final void onPVVerified(String str) {
        V(str);
    }

    @Override
    public final void onPause() {
        super.onPause();
        runOnUiThread(new com.cashfree.pg.ui.hidden.checkout.a(this, 2));
        w wVar = this.nfcCardManager;
        if (wVar != null) {
            wVar.a();
        }
    }

    @Override
    public void onPaymentFailure(CFErrorResponse cFErrorResponse) {
        U(cFErrorResponse);
    }

    @Override
    public final void onResume() {
        super.onResume();
        w wVar = this.nfcCardManager;
        if (wVar != null) {
            wVar.b();
        }
    }

    @Override
    public final void onStart() {
        if (this.isCreated) {
            this.isCreated = false;
        } else {
            this.nativeCheckoutViewModel.r();
        }
        super.onStart();
    }

    @Override
    public final void onStop() {
        super.onStop();
        com.google.android.material.bottomsheet.j jVar = this.upiAppsDialog;
        if (jVar != null && jVar.isShowing()) {
            this.upiAppsDialog.dismiss();
        }
        com.google.android.material.bottomsheet.j jVar2 = this.nbAppsDialog;
        if (jVar2 != null && jVar2.isShowing()) {
            this.nbAppsDialog.dismiss();
        }
        androidx.appcompat.app.f fVar = this.exitDialog;
        if (fVar != null && fVar.isShowing()) {
            this.exitDialog.dismiss();
        }
        C();
        com.google.android.material.bottomsheet.j jVar3 = this.savedCardDeleteDialog;
        if (jVar3 == null || !jVar3.isShowing()) {
            return;
        }
        this.savedCardDeleteDialog.dismiss();
    }
}