导航菜单

页面标题

页面副标题

Aisle v12.32 - CashfreeNativeCheckoutActivity.java 源代码

正在查看: Aisle v12.32 应用的 CashfreeNativeCheckoutActivity.java JAVA 源代码文件

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


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

import A5.b;
import A5.d;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.nfc.NfcAdapter;
import android.nfc.NfcManager;
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.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.DeleteSavedCardResponse;
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.core.hidden.utils.Constants;
import com.cashfree.pg.core.hidden.webcheckout.CFNFCJSInterface;
import com.cashfree.pg.ui.api.CFDropCheckoutPayment;
import com.cashfree.pg.ui.hidden.checkout.CashfreeNativeCheckoutActivity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import q5.InterfaceC1010a;
import s5.C1057d;
import s5.EnumC1058e;
import v5.AbstractC1114a;
import w5.C1134A;
import w5.C1140b;
import w5.C1143e;
import w5.G;
import w5.v;
import x5.InterfaceC1155a;
import y5.C1167G;
import y5.C1176f;
import y5.C1178h;
import y5.M;
import y5.p;
import y5.v;
import y5.w;
import z5.C1250e;

public class CashfreeNativeCheckoutActivity extends r5.b implements InterfaceC1010a, C1167G.c, p.b, PVBottomSheetDialog.PaymentVerificationListener, M.b, v.b, C1176f.g, d.b, v.c, C1178h.b, b.f, C1250e.b {
    private C1134A A;
    private boolean D;
    private PaymentInitiationData E;
    private com.cashfree.pg.ui.hidden.checkout.g G;
    private NfcCardReader H;
    private H5.c b;
    private LinearLayoutCompat c;
    private x5.h d;
    private C1167G e;
    private y5.p f;
    private M i;
    private y5.v o;
    private C1176f p;
    private C1178h q;
    private C1250e r;
    private CoordinatorLayout s;
    private CFTheme t;
    private G u;
    private w5.j v;
    private C1140b w;
    private w5.v x;
    private androidx.appcompat.app.c y;
    private w5.p z;
    private boolean B = false;
    private boolean C = true;
    public final AbstractC1114a F = new i();

    class a extends HashMap {
        a() {
            PaymentMode paymentMode = CashfreeNativeCheckoutActivity.this.E.getPaymentMode();
            if (paymentMode.equals(PaymentMode.QR_CODE)) {
                put("payment_mode", "UPI");
                put("channel", "QR");
            } else if (paymentMode.equals(PaymentMode.UPI_COLLECT)) {
                put("payment_mode", "UPI");
                put("channel", "COLLECT");
            } else if (paymentMode.equals(PaymentMode.UPI_INTENT)) {
                put("payment_mode", "UPI");
                put("channel", "INTENT");
            } else {
                put("payment_mode", CashfreeNativeCheckoutActivity.this.E.getPaymentMode().name());
            }
            if (CashfreeNativeCheckoutActivity.this.E.getName() != null && !CashfreeNativeCheckoutActivity.this.E.getName().isEmpty()) {
                put("payment_method", CashfreeNativeCheckoutActivity.this.E.getName());
            }
            put("payment_attempt_status", "cancelled");
        }
    }

    class b extends HashMap {
        b() {
            PaymentMode paymentMode = CashfreeNativeCheckoutActivity.this.E.getPaymentMode();
            if (paymentMode.equals(PaymentMode.QR_CODE)) {
                put("payment_mode", "UPI");
                put("channel", "QR");
            } else if (paymentMode.equals(PaymentMode.UPI_COLLECT)) {
                put("payment_mode", "UPI");
                put("channel", "COLLECT");
            } else if (paymentMode.equals(PaymentMode.UPI_INTENT)) {
                put("payment_mode", "UPI");
                put("channel", "INTENT");
            } else {
                put("payment_mode", CashfreeNativeCheckoutActivity.this.E.getPaymentMode().name());
            }
            if (CashfreeNativeCheckoutActivity.this.E.getName() != null && !CashfreeNativeCheckoutActivity.this.E.getName().isEmpty()) {
                put("payment_method", CashfreeNativeCheckoutActivity.this.E.getName());
            }
            put("payment_attempt_status", "failed");
        }
    }

    class c extends HashMap {
        final NfcCardResponse a;

        c(NfcCardResponse nfcCardResponse) {
            this.a = nfcCardResponse;
            put(CFNFCJSInterface.CARD_TYPE, nfcCardResponse.getEmvCard().getType().getName());
        }
    }

    class d extends HashMap {
        d() {
            put(Constants.SDK_PLATFORM, "android");
        }
    }

    class e extends HashMap {
        final String a;

        e(String str) {
            this.a = str;
            put(AnalyticsUtil.ORDER_ID, str);
            put("payment_method", CashfreeNativeCheckoutActivity.this.E.getPaymentMode().name());
            put("payment_attempt_status", "ended");
        }
    }

    class f extends HashMap {
        final String a;

        f(String str) {
            this.a = str;
            put(AnalyticsUtil.ORDER_ID, str);
            put("payment_method", CashfreeNativeCheckoutActivity.this.E.getPaymentMode().name());
            put("channel", "verify_callback");
        }
    }

    class g extends HashMap {
        final PaymentMode a;

        g(PaymentMode paymentMode) {
            this.a = paymentMode;
            put("payment_mode", paymentMode.name());
        }
    }

    class h implements b.e {
        final String a;

        h(String str) {
            this.a = str;
        }

        public static void d(h hVar, String str) {
            CashfreeNativeCheckoutActivity.this.A.dismiss();
            CashfreeNativeCheckoutActivity.this.r.e(str);
        }

        @Override
        public void a(CFErrorResponse cFErrorResponse) {
            CashfreeNativeCheckoutActivity.this.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    CashfreeNativeCheckoutActivity.this.A.dismiss();
                }
            });
        }

        @Override
        public void b(DeleteSavedCardResponse deleteSavedCardResponse) {
            androidx.appcompat.app.d dVar = CashfreeNativeCheckoutActivity.this;
            final String str = this.a;
            dVar.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    CashfreeNativeCheckoutActivity.h.d(CashfreeNativeCheckoutActivity.h.this, str);
                }
            });
        }
    }

    class i extends AbstractC1114a {
        i() {
        }

        public static void c(i iVar, String str) {
            CashfreeNativeCheckoutActivity.this.o0();
            CashfreeNativeCheckoutActivity.this.D0(str);
        }

        public static void d(i iVar, CFErrorResponse cFErrorResponse) {
            CashfreeNativeCheckoutActivity.this.o0();
            CashfreeNativeCheckoutActivity.this.m0(cFErrorResponse);
        }

        @Override
        public void a(String str) {
            CashfreeNativeCheckoutActivity.this.y0(str);
        }

        @Override
        public void onPaymentFailure(final CFErrorResponse cFErrorResponse, String str) {
            ThreadUtil.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    CashfreeNativeCheckoutActivity.i.d(CashfreeNativeCheckoutActivity.i.this, cFErrorResponse);
                }
            });
        }

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

    static class j {
        static final int[] a;
        static final int[] b;

        static {
            int[] iArr = new int[CFPaymentModes.values().length];
            b = iArr;
            try {
                iArr[CFPaymentModes.UPI.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                b[CFPaymentModes.EMI.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                b[CFPaymentModes.NB.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                b[CFPaymentModes.WALLET.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                b[CFPaymentModes.PAY_LATER.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                b[CFPaymentModes.CARD.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            int[] iArr2 = new int[G5.e.values().length];
            a = iArr2;
            try {
                iArr2[G5.e.upi_id_invalid.ordinal()] = 1;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                a[G5.e.card_holder_name_invalid.ordinal()] = 2;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                a[G5.e.card_number_invalid.ordinal()] = 3;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                a[G5.e.phone_ineligible.ordinal()] = 4;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                a[G5.e.payment_failed_headless.ordinal()] = 5;
            } catch (NoSuchFieldError unused11) {
            }
            try {
                a[G5.e.action_cancelled.ordinal()] = 6;
            } catch (NoSuchFieldError unused12) {
            }
        }
    }

    class k extends HashMap {
        final CFErrorResponse a;

        k(CFErrorResponse cFErrorResponse) {
            this.a = cFErrorResponse;
            put("payment_mode", "UPI");
            put("channel", CashfreeNativeCheckoutActivity.this.E.getId());
            put("payment_method", "COLLECT");
            put("error_code", cFErrorResponse.getCode());
            put("error_message", cFErrorResponse.getMessage());
        }
    }

    class l extends HashMap {
        l() {
            put("payment_mode", "UPI");
            put("channel", "UPI");
            put("payment_attempt_status", "cancelled");
        }
    }

    class m extends HashMap {
        final CFErrorResponse a;

        m(CFErrorResponse cFErrorResponse) {
            this.a = cFErrorResponse;
            put("payment_mode", PaymentMode.CARD.name());
            put("error_code", cFErrorResponse.getCode());
            put("error_message", cFErrorResponse.getMessage());
        }
    }

    class n extends HashMap {
        n() {
            put("payment_mode", CashfreeNativeCheckoutActivity.this.E.getPaymentMode().name());
            if (CashfreeNativeCheckoutActivity.this.E.getName() != null && !CashfreeNativeCheckoutActivity.this.E.getName().isEmpty()) {
                put("payment_method", CashfreeNativeCheckoutActivity.this.E.getName());
            }
            put("payment_attempt_status", "cancelled");
        }
    }

    class o extends HashMap {
        final CFErrorResponse a;

        o(CFErrorResponse cFErrorResponse) {
            this.a = cFErrorResponse;
            put("payment_mode", PaymentMode.CARD.name());
            put("error_code", cFErrorResponse.getCode());
            put("error_message", cFErrorResponse.getMessage());
        }
    }

    class p extends HashMap {
        p() {
            put("payment_mode", CashfreeNativeCheckoutActivity.this.E.getPaymentMode().name());
            if (CashfreeNativeCheckoutActivity.this.E.getName() != null && !CashfreeNativeCheckoutActivity.this.E.getName().isEmpty()) {
                put("payment_method", CashfreeNativeCheckoutActivity.this.E.getName());
            }
            put("payment_attempt_status", "cancelled");
        }
    }

    class q extends HashMap {
        final CFErrorResponse a;

        q(CFErrorResponse cFErrorResponse) {
            this.a = cFErrorResponse;
            put("payment_mode", CashfreeNativeCheckoutActivity.this.E.getPaymentMode().name());
            put("error_code", cFErrorResponse.getCode());
            put("error_message", cFErrorResponse.getMessage());
        }
    }

    class r extends HashMap {
        r() {
            put("payment_mode", CashfreeNativeCheckoutActivity.this.E.getPaymentMode().name());
            if (CashfreeNativeCheckoutActivity.this.E.getName() != null && !CashfreeNativeCheckoutActivity.this.E.getName().isEmpty()) {
                put("payment_method", CashfreeNativeCheckoutActivity.this.E.getName());
            }
            put("payment_attempt_status", "cancelled");
        }
    }

    private void A0(List list, OrderDetails orderDetails) {
        n0();
        this.w = new C1140b(list, orderDetails, this.t, this);
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.w.Y(getSupportFragmentManager(), "EmiInfoBottomSheetDialog");
    }

    private void C0(List list, OrderDetails orderDetails) {
        p0();
        this.v = new w5.j(this, list, orderDetails, this.t, this);
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.v.show();
    }

    public void D0(String str) {
        q0();
        this.z = new w5.p(this, str, this.t, this);
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.z.show();
    }

    private void E0(t5.o oVar, OrderDetails orderDetails) {
        r0();
        this.x = new w5.v(this, oVar, orderDetails, this.t, this);
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.x.show();
    }

    private void F0(ArrayList arrayList, OrderDetails orderDetails) {
        t0();
        this.u = new G(this, arrayList, orderDetails, this.t, new G.b() {
            @Override
            public final void b(PaymentInitiationData paymentInitiationData) {
                CashfreeNativeCheckoutActivity.this.j(paymentInitiationData);
            }
        });
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.u.show();
    }

    public void G0(NfcAdapter nfcAdapter) {
        if (this.p != null) {
            if (nfcAdapter.isEnabled()) {
                AnalyticsUtil.addEvent(UserEvents.NFC_ENABLED);
                this.p.F(C1176f.h.NFC_ENABLED);
            } else {
                AnalyticsUtil.addEvent(UserEvents.NFC_DISABLED);
                this.p.F(C1176f.h.NFC_DISABLED);
            }
        }
    }

    public static void U(CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity, t5.o oVar, OrderDetails orderDetails) {
        cashfreeNativeCheckoutActivity.getClass();
        if (oVar == null || oVar.c().size() <= 0) {
            return;
        }
        cashfreeNativeCheckoutActivity.E0(oVar, orderDetails);
    }

    public static void V(CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity, SavedCardsResponse savedCardsResponse) {
        if (cashfreeNativeCheckoutActivity.r == null) {
            cashfreeNativeCheckoutActivity.r = new C1250e(cashfreeNativeCheckoutActivity.c, savedCardsResponse.getSavedCards(), cashfreeNativeCheckoutActivity, cashfreeNativeCheckoutActivity.t);
        }
    }

    public static void W(CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity, List list, ConfigResponse configResponse, ArrayList arrayList) {
        CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity2;
        List list2;
        ArrayList arrayList2;
        if (!cashfreeNativeCheckoutActivity.C || B5.a.c().e()) {
            cashfreeNativeCheckoutActivity2 = cashfreeNativeCheckoutActivity;
            list2 = list;
            arrayList2 = arrayList;
        } else {
            cashfreeNativeCheckoutActivity2 = cashfreeNativeCheckoutActivity;
            list2 = list;
            arrayList2 = arrayList;
            cashfreeNativeCheckoutActivity.b.s(list2, configResponse.getPaymentModes(), configResponse.getOrderDetails(), arrayList2, cashfreeNativeCheckoutActivity2);
        }
        cashfreeNativeCheckoutActivity2.v0(configResponse, list2, arrayList2);
    }

    public static void Y(CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity) {
        cashfreeNativeCheckoutActivity.getClass();
        AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_close, new com.cashfree.pg.ui.hidden.checkout.d(cashfreeNativeCheckoutActivity));
        cashfreeNativeCheckoutActivity.x0(CFUtil.getResponseFromError(CFUtil.getCancelledResponse()));
    }

    public static void Z(CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity) {
        if (cashfreeNativeCheckoutActivity.B) {
            return;
        }
        cashfreeNativeCheckoutActivity.y0(cashfreeNativeCheckoutActivity.b.q());
    }

    public static void b0(final CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity, ConfigResponse configResponse, List list, ArrayList arrayList) {
        cashfreeNativeCheckoutActivity.d.g(configResponse.getMerchantInfo(), configResponse.getOrderDetails(), new InterfaceC1155a() {
            @Override
            public final void a() {
                CashfreeNativeCheckoutActivity.this.o0();
            }
        });
        if (list.size() == 1) {
            CFErrorResponse l0 = cashfreeNativeCheckoutActivity.l0((CFPaymentModes) list.get(0), configResponse.getPaymentModes(), arrayList);
            if (l0 != null) {
                cashfreeNativeCheckoutActivity.x0(l0);
            } else {
                w k0 = cashfreeNativeCheckoutActivity.k0(configResponse, (CFPaymentModes) list.get(0), arrayList);
                if (k0 != null) {
                    k0.b();
                }
            }
        } else {
            Iterator it = list.iterator();
            while (it.hasNext()) {
                cashfreeNativeCheckoutActivity.k0(configResponse, (CFPaymentModes) it.next(), arrayList);
            }
        }
        if (cashfreeNativeCheckoutActivity.p != null) {
            NfcAdapter defaultAdapter = ((NfcManager) cashfreeNativeCheckoutActivity.getSystemService("nfc")).getDefaultAdapter();
            if (defaultAdapter == null) {
                cashfreeNativeCheckoutActivity.p.F(C1176f.h.NFC_UNAVAILABLE);
                return;
            }
            AnalyticsUtil.addEvent(UserEvents.NFC_AVAILABLE);
            cashfreeNativeCheckoutActivity.G0(defaultAdapter);
            cashfreeNativeCheckoutActivity.G = new com.cashfree.pg.ui.hidden.checkout.g(cashfreeNativeCheckoutActivity);
            cashfreeNativeCheckoutActivity.H = new NfcCardReader();
            cashfreeNativeCheckoutActivity.registerReceiver(new com.cashfree.pg.ui.hidden.checkout.c(cashfreeNativeCheckoutActivity, defaultAdapter), new IntentFilter(CFNFCJSInterface.ANDROID_NFC_ACTION_ADAPTER_STATE_CHANGED));
        }
    }

    public static void c0(CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity) {
        if (cashfreeNativeCheckoutActivity.B) {
            return;
        }
        cashfreeNativeCheckoutActivity.y0(cashfreeNativeCheckoutActivity.b.q());
    }

    private void hideExitDialog() {
        androidx.appcompat.app.c cVar = this.y;
        if (cVar == null || !cVar.isShowing()) {
            return;
        }
        this.y.dismiss();
    }

    private w k0(ConfigResponse configResponse, CFPaymentModes cFPaymentModes, ArrayList arrayList) {
        PaymentModes paymentModes = configResponse.getPaymentModes();
        switch (j.b[cFPaymentModes.ordinal()]) {
            case 1:
                boolean isUPICollectEnable = paymentModes.isUPICollectEnable();
                boolean isUPIQRModeEnable = paymentModes.isUPIQRModeEnable();
                if ((isUPICollectEnable || ((arrayList != null && !arrayList.isEmpty()) || getResources().getBoolean(p5.b.b))) && this.e == null) {
                    this.e = new C1167G(this.c, configResponse.getOrderDetails(), isUPICollectEnable, isUPIQRModeEnable, this.t, arrayList, this);
                }
                return this.e;
            case 2:
                if (this.q == null && !paymentModes.getEMI().isEmpty()) {
                    this.q = new C1178h(this.c, configResponse.getOrderDetails(), paymentModes.getEMI(), this.t, this);
                }
                return this.q;
            case 3:
                if (this.f == null && !paymentModes.getNetBanking().isEmpty()) {
                    this.f = new y5.p(this.c, paymentModes.getNetBanking(), configResponse.getOrderDetails(), this.t, this);
                }
                return this.f;
            case 4:
                if (this.i == null && !paymentModes.getWallet().isEmpty()) {
                    this.i = new M(this.c, paymentModes.getWallet(), configResponse.getOrderDetails(), configResponse.getCustomerDetails(), this.t, this);
                }
                return this.i;
            case 5:
                if (this.o == null && !paymentModes.getPayLater().isEmpty()) {
                    this.o = new y5.v(this.c, paymentModes.getPayLater(), configResponse.getOrderDetails(), configResponse.getCustomerDetails(), this.t, this);
                }
                return this.o;
            case 6:
                if (this.p == null && !paymentModes.getCard().isEmpty()) {
                    this.p = new C1176f(this.c, configResponse.getOrderDetails(), this.t, configResponse.getFeatureConfig().getCFFeaturesConfig().isFetchSavedCardEnabled(), configResponse.getFeatureConfig().getCFFeaturesConfig().isNfcCardReadEnabled(), this);
                }
                return this.p;
            default:
                return null;
        }
    }

    private CFErrorResponse l0(CFPaymentModes cFPaymentModes, PaymentModes paymentModes, ArrayList arrayList) {
        int i2 = j.b[cFPaymentModes.ordinal()];
        if (i2 != 1) {
            if (i2 == 2 && paymentModes.getEMI().isEmpty()) {
                return CFUtil.getErrorForNoPaymentMode(cFPaymentModes.name());
            }
            return null;
        }
        if (!paymentModes.getUpi().isEmpty()) {
            return null;
        }
        if (arrayList == null || arrayList.isEmpty()) {
            return CFUtil.getErrorForNoPaymentMode(cFPaymentModes.name());
        }
        return null;
    }

    public void m0(CFErrorResponse cFErrorResponse) {
        switch (j.a[G5.e.b(cFErrorResponse.getCode()).ordinal()]) {
            case 1:
                C1167G c1167g = this.e;
                if (c1167g != null) {
                    c1167g.v();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new k(cFErrorResponse));
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new l());
                break;
            case 2:
                C1176f c1176f = this.p;
                if (c1176f != null) {
                    c1176f.y();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new m(cFErrorResponse));
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new n());
                CFPersistence.getInstance().clearTxnID();
                break;
            case 3:
                C1176f c1176f2 = this.p;
                if (c1176f2 != null) {
                    c1176f2.v();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new o(cFErrorResponse));
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new p());
                CFPersistence.getInstance().clearTxnID();
                break;
            case 4:
                y5.v vVar = this.o;
                if (vVar != null) {
                    vVar.v();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new q(cFErrorResponse));
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new r());
                CFPersistence.getInstance().clearTxnID();
                break;
            case 5:
            case 6:
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new a());
                CFPersistence.getInstance().clearTxnID();
                break;
            default:
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new b());
                CFPersistence.getInstance().clearTxnID();
                x0(cFErrorResponse);
                break;
        }
    }

    private void n0() {
        C1140b c1140b = this.w;
        if (c1140b == null || !c1140b.isVisible()) {
            return;
        }
        this.w.L();
        this.w = null;
    }

    private void p0() {
        androidx.appcompat.app.q qVar = this.v;
        if (qVar == null || !qVar.isShowing()) {
            return;
        }
        this.v.dismiss();
    }

    private void q0() {
        androidx.appcompat.app.q qVar = this.z;
        if (qVar == null || !qVar.isShowing()) {
            return;
        }
        this.z.dismiss();
    }

    private void r0() {
        androidx.appcompat.app.q qVar = this.x;
        if (qVar == null || !qVar.isShowing()) {
            return;
        }
        this.x.dismiss();
    }

    private void s0() {
        androidx.appcompat.app.q qVar = this.A;
        if (qVar == null || !qVar.isShowing()) {
            return;
        }
        this.A.dismiss();
    }

    private void t0() {
        androidx.appcompat.app.q qVar = this.u;
        if (qVar == null || !qVar.isShowing()) {
            return;
        }
        this.u.dismiss();
    }

    private boolean u0(w wVar) {
        return wVar != null && wVar.a();
    }

    private void v0(final ConfigResponse configResponse, final List list, final ArrayList arrayList) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.b0(CashfreeNativeCheckoutActivity.this, configResponse, list, arrayList);
            }
        });
    }

    private void w0(PaymentMode paymentMode) {
        AnalyticsUtil.addEvent(UserEvents.cfevent_payment_mode_focus, new g(paymentMode));
        C1167G c1167g = this.e;
        if (c1167g != null && paymentMode != PaymentMode.UPI_INTENT && paymentMode != PaymentMode.UPI_COLLECT) {
            c1167g.n();
        }
        y5.p pVar = this.f;
        if (pVar != null && paymentMode != PaymentMode.NET_BANKING) {
            pVar.j();
        }
        M m2 = this.i;
        if (m2 != null && paymentMode != PaymentMode.WALLET) {
            m2.l();
        }
        y5.v vVar = this.o;
        if (vVar != null && paymentMode != PaymentMode.PAY_LATER) {
            vVar.l();
        }
        C1176f c1176f = this.p;
        if (c1176f != null && paymentMode != PaymentMode.CARD) {
            c1176f.q();
        }
        this.d.c();
    }

    private void x0(final CFErrorResponse cFErrorResponse) {
        final String q2;
        finish();
        if (this.B) {
            return;
        }
        this.B = true;
        if (cFErrorResponse.getMessage().equals("payment method failed.") || (q2 = this.b.q()) == null) {
            return;
        }
        ThreadUtil.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                C1057d.e().publishEvent(new C1057d.b(EnumC1058e.onFailure, q2, cFErrorResponse));
            }
        });
    }

    public void y0(final String str) {
        AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new e(str));
        AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_close, new f(str));
        CFPersistence.getInstance().clearTxnID();
        if (this.C) {
            this.b.w(this.E, CFPersistence.getInstance().getEnvironment());
        }
        finish();
        if (this.B) {
            return;
        }
        this.B = true;
        if (str != null) {
            ThreadUtil.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    C1057d.e().publishEvent(new C1057d.b(EnumC1058e.onVerify, str, null));
                }
            });
        }
    }

    private void z0() {
        int parseColor = Color.parseColor(this.t.getNavigationBarBackgroundColor());
        ((ProgressBar) findViewById(p5.d.K0)).getIndeterminateDrawable().setColorFilter(parseColor, PorterDuff.Mode.MULTIPLY);
        getWindow().setStatusBarColor(parseColor);
    }

    @Override
    public void A(List list, OrderDetails orderDetails) {
        A0(list, orderDetails);
    }

    @Override
    public void B(SavedCardsResponse.SavedCards savedCards) {
        s0();
        ?? c1134a = new C1134A(this, this.t, savedCards, this);
        this.A = c1134a;
        c1134a.show();
    }

    public void B0() {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.this.s.setVisibility(0);
            }
        });
    }

    @Override
    public void C(String str, String str2, String str3, String str4, String str5, boolean z) {
        this.b.i(str, str2, str3, str4, str5, z);
    }

    @Override
    protected H5.a Q() {
        return this.b;
    }

    @Override
    public void a(C1178h.a aVar) {
        n0();
        this.b.g(aVar);
    }

    @Override
    public void c(PaymentInitiationData paymentInitiationData) {
        this.b.l(paymentInitiationData);
    }

    @Override
    public void d(CFErrorResponse cFErrorResponse) {
    }

    @Override
    public void g(List list, OrderDetails orderDetails) {
        C0(list, orderDetails);
    }

    @Override
    public void h(final SavedCardsResponse savedCardsResponse) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.V(CashfreeNativeCheckoutActivity.this, savedCardsResponse);
            }
        });
    }

    @Override
    public void i(final t5.o oVar, final OrderDetails orderDetails, List list) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.U(CashfreeNativeCheckoutActivity.this, oVar, orderDetails);
            }
        });
    }

    @Override
    public void j(PaymentInitiationData paymentInitiationData) {
        this.b.n(paymentInitiationData);
    }

    @Override
    public void l(PaymentInitiationData paymentInitiationData) {
        this.b.k(paymentInitiationData);
    }

    @Override
    public void m() {
        ThreadUtil.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.Z(CashfreeNativeCheckoutActivity.this);
            }
        });
    }

    @Override
    public void n(PaymentInitiationData paymentInitiationData) {
        this.b.j(paymentInitiationData);
    }

    @Override
    public void o(PaymentInitiationData paymentInitiationData) {
        this.b.o(paymentInitiationData);
    }

    public void o0() {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.this.s.setVisibility(8);
            }
        });
    }

    public void onBackPressed() {
        this.y = new C1143e(this, this.t, new InterfaceC1155a() {
            @Override
            public final void a() {
                CashfreeNativeCheckoutActivity.Y(CashfreeNativeCheckoutActivity.this);
            }
        });
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.y.show();
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_open, new d());
        this.E = CFPersistence.getInstance().getPaymentInitiationData();
        CFCorePaymentGatewayService.getInstance().setCheckoutCallback(this.F.b());
        CFCorePaymentGatewayService.getInstance().setQRCallback(this.F);
        try {
            this.C = getResources().getBoolean(p5.b.a);
        } catch (Exception e2) {
            Z4.a.c().b("CashfreeNativeCheckoutActivity", e2.getMessage());
        }
        this.D = true;
        this.B = false;
        setContentView(p5.e.a);
        H5.c cVar = new H5.c(this, new com.cashfree.pg.network.h() {
            @Override
            public final boolean isNetworkConnected() {
                boolean a2;
                a2 = com.cashfree.pg.network.j.a(CashfreeNativeCheckoutActivity.this.getApplicationContext());
                return a2;
            }
        });
        this.b = cVar;
        this.t = cVar.t();
        this.s = findViewById(p5.d.z);
        z0();
        this.c = findViewById(p5.d.A0);
        x5.h hVar = new x5.h(findViewById(p5.d.x), this.t);
        this.d = hVar;
        hVar.e();
        setSupportActionBar(this.d.d());
        if (getSupportActionBar() != null) {
            getSupportActionBar().s(true);
            getSupportActionBar().v("");
        }
        B0();
        this.b.v();
        this.b.f(this);
    }

    @Override
    protected void onDestroy() {
        q0();
        r0();
        C1250e c1250e = this.r;
        if (c1250e != null) {
            c1250e.c();
        }
        super.onDestroy();
    }

    protected void onNewIntent(Intent intent) {
        super/*androidx.activity.ComponentActivity*/.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.H.readCard(tag);
        if (readCard == null || readCard.getEmvCard() == null || this.p == null) {
            return;
        }
        AnalyticsUtil.addEvent(UserEvents.NFC_CARD_INFO_ENTRY_DONE, new c(readCard));
        Z4.a.c().a("CashfreeNativeCheckoutActivity", String.format("%s \n %s \n %s \n %s", readCard.getEmvCard().getCardNumber(), readCard.getEmvCard().getExpireDate(), readCard.getEmvCard().getHolderFirstname(), readCard.getEmvCard().getHolderLastname()));
        this.p.x(readCard.getEmvCard().getCardNumber(), readCard.getEmvCard().getExpireDate());
    }

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

    @Override
    public void onPVCancelled() {
    }

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

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

    @Override
    protected void onPause() {
        super.onPause();
        o0();
        com.cashfree.pg.ui.hidden.checkout.g gVar = this.G;
        if (gVar != null) {
            gVar.a();
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        com.cashfree.pg.ui.hidden.checkout.g gVar = this.G;
        if (gVar != null) {
            gVar.b();
        }
    }

    @Override
    protected void onStart() {
        if (this.D) {
            this.D = false;
        } else {
            this.b.r();
        }
        super.onStart();
    }

    @Override
    protected void onStop() {
        super.onStop();
        t0();
        p0();
        hideExitDialog();
        n0();
        s0();
    }

    @Override
    public void p(CFErrorResponse cFErrorResponse) {
        x0(cFErrorResponse);
    }

    @Override
    public void q(CFPayment cFPayment, PaymentInitiationData paymentInitiationData) {
        try {
            CFDropCheckoutPayment b2 = B5.a.c().b();
            if (b2 != null && b2.getSource() != null) {
                String[] split = b2.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.E = paymentInitiationData;
            B0();
            cFPayment.setTheme(this.t);
            CFCorePaymentGatewayService.getInstance().doPayment(this, cFPayment);
        } catch (CFException e2) {
            e2.printStackTrace();
        }
    }

    @Override
    public void r(SavedCardsResponse.SavedCards savedCards, String str) {
        this.b.m(savedCards.getInstrumentID(), str);
    }

    @Override
    public void s(PaymentMode paymentMode) {
        if (u0(this.e) || u0(this.f) || u0(this.i) || u0(this.o) || u0(this.p)) {
            return;
        }
        this.d.e();
    }

    @Override
    public void u() {
        ThreadUtil.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.c0(CashfreeNativeCheckoutActivity.this);
            }
        });
    }

    @Override
    public void v() {
        this.w = null;
    }

    @Override
    public void w(SavedCardsResponse.SavedCards savedCards) {
        String instrumentID = savedCards.getInstrumentID();
        this.b.p(instrumentID, new h(instrumentID));
    }

    @Override
    public void x(final ConfigResponse configResponse, final List list) {
        List list2;
        if (list.isEmpty()) {
            x0(CFUtil.getResponseFromError(CFUtil.getFailedResponse("no payment_modes are available as per configuration.")));
            return;
        }
        if (list.contains(CFPaymentModes.UPI)) {
            CFUPIUtil.getInstalledUPIApps(this, new CFUPIUtil.UPIAppsCallback() {
                @Override
                public final void onUPIAppsFetched(ArrayList arrayList) {
                    CashfreeNativeCheckoutActivity.W(CashfreeNativeCheckoutActivity.this, list, configResponse, arrayList);
                }
            });
            return;
        }
        if (!this.C || B5.a.c().e()) {
            list2 = list;
        } else {
            list2 = list;
            this.b.s(list2, configResponse.getPaymentModes(), configResponse.getOrderDetails(), new ArrayList(), this);
        }
        v0(configResponse, list2, null);
    }

    @Override
    public void y(PaymentMode paymentMode) {
        w0(paymentMode);
    }

    @Override
    public void z(ArrayList arrayList, OrderDetails orderDetails) {
        F0(arrayList, orderDetails);
    }
}