导航菜单

页面标题

页面副标题

Oolka v2.4.42 - CashfreeNativeCheckoutActivity.java 源代码

正在查看: Oolka v2.4.42 应用的 CashfreeNativeCheckoutActivity.java JAVA 源代码文件

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


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

import android.content.BroadcastReceiver;
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.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.appsflyer.AppsFlyerProperties;
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.CFUPIApp;
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.EmiOption;
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.network.response.models.config.PaymentOption;
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.webcheckout.CFNFCJSInterface;
import com.cashfree.pg.network.NetworkConnectivityUtil;
import com.cashfree.pg.ui.api.CFDropCheckoutPayment;
import com.cashfree.pg.ui.hidden.activity.base.BaseActivity;
import com.cashfree.pg.ui.hidden.channel.d;
import com.cashfree.pg.ui.hidden.checkout.CashfreeNativeCheckoutActivity;
import com.cashfree.pg.ui.hidden.checkout.callbacks.CFNativeCoreCallbacks;
import com.cashfree.pg.ui.hidden.checkout.dialog.b0;
import com.cashfree.pg.ui.hidden.checkout.dialog.h0;
import com.cashfree.pg.ui.hidden.checkout.dialog.w;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.PaymentView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.e0;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.f;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.h;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.j0;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.o;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.t;
import com.cashfree.pg.ui.hidden.checkout.subview.savedcards.e;
import com.cashfree.pg.ui.hidden.dao.b;
import com.cashfree.pg.ui.hidden.dao.d;
import com.cashfree.pg.ui.hidden.viewModel.BaseViewModel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

public class CashfreeNativeCheckoutActivity extends BaseActivity implements com.cashfree.pg.ui.hidden.activity.a, e0.d, o.c, PVBottomSheetDialog.PaymentVerificationListener, j0.c, t.c, f.g, d.b, w.c, h.b, b.f, e.b {
    public e0 A0;
    public com.cashfree.pg.ui.hidden.checkout.subview.savedcards.e A1;
    public w A2;
    public b0 A3;
    public boolean A5;
    public PaymentInitiationData B5;
    public com.cashfree.pg.ui.hidden.checkout.subview.payment.o C0;
    public CoordinatorLayout C1;
    public com.cashfree.pg.ui.hidden.checkout.s D5;
    public NfcCardReader E5;
    public com.cashfree.pg.ui.hidden.viewModel.b H;
    public LinearLayoutCompat I;
    public CFTheme V1;
    public androidx.appcompat.app.b V2;
    public com.cashfree.pg.ui.hidden.checkout.dialog.p W2;
    public com.cashfree.pg.ui.hidden.checkout.subview.d c0;
    public j0 c1;
    public com.cashfree.pg.ui.hidden.checkout.subview.payment.t p1;
    public h0 p2;
    public com.cashfree.pg.ui.hidden.checkout.subview.payment.f x1;
    public com.cashfree.pg.ui.hidden.checkout.dialog.j x2;
    public com.cashfree.pg.ui.hidden.checkout.subview.payment.h y1;
    public com.cashfree.pg.ui.hidden.checkout.dialog.b y2;
    public boolean A4 = false;
    public boolean z5 = true;
    public final CFNativeCoreCallbacks C5 = new k();

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

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

    public class c extends HashMap<String, String> {
        public final NfcCardResponse a;

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

    public class d extends HashMap<String, String> {
        public d() {
            put("platform", "android");
        }
    }

    public class e extends BroadcastReceiver {
        public final NfcAdapter a;

        public e(NfcAdapter nfcAdapter) {
            this.a = nfcAdapter;
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            CashfreeNativeCheckoutActivity.this.n1(this.a);
        }
    }

    public class f extends HashMap<String, String> {
        public final String a;

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

    public class g extends HashMap<String, String> {
        public final String a;

        public g(String str) {
            this.a = str;
            put(AnalyticsUtil.ORDER_ID, str);
            put("payment_method", CashfreeNativeCheckoutActivity.this.B5.getPaymentMode().name());
            put(AppsFlyerProperties.CHANNEL, "verify_callback");
        }
    }

    public class h extends HashMap<String, String> {
        public final PaymentMode a;

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

    public class i extends HashMap<String, String> {
        public i() {
            put(AppsFlyerProperties.CHANNEL, "back_clicked");
            put("platform", "android");
        }
    }

    public class j implements b.e {
        public final String a;

        public j(String str) {
            this.a = str;
        }

        public void e() {
            CashfreeNativeCheckoutActivity.this.A3.dismiss();
        }

        public void f(String str) {
            CashfreeNativeCheckoutActivity.this.A3.dismiss();
            CashfreeNativeCheckoutActivity.this.A1.e(str);
        }

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

        @Override
        public void b(DeleteSavedCardResponse deleteSavedCardResponse) {
            AppCompatActivity appCompatActivity = CashfreeNativeCheckoutActivity.this;
            final String str = this.a;
            appCompatActivity.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    CashfreeNativeCheckoutActivity.j.this.f(str);
                }
            });
        }
    }

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

        public void e(CFErrorResponse cFErrorResponse) {
            CashfreeNativeCheckoutActivity.this.L0();
            CashfreeNativeCheckoutActivity.this.J0(cFErrorResponse);
        }

        public void f(String str) {
            CashfreeNativeCheckoutActivity.this.L0();
            CashfreeNativeCheckoutActivity.this.k1(str);
        }

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

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

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

    public static class l {
        public static final int[] a;
        public 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[com.cashfree.pg.ui.hidden.utils.b.values().length];
            a = iArr2;
            try {
                iArr2[com.cashfree.pg.ui.hidden.utils.b.upi_id_invalid.ordinal()] = 1;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                a[com.cashfree.pg.ui.hidden.utils.b.card_holder_name_invalid.ordinal()] = 2;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                a[com.cashfree.pg.ui.hidden.utils.b.card_number_invalid.ordinal()] = 3;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                a[com.cashfree.pg.ui.hidden.utils.b.phone_ineligible.ordinal()] = 4;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                a[com.cashfree.pg.ui.hidden.utils.b.payment_failed_headless.ordinal()] = 5;
            } catch (NoSuchFieldError unused11) {
            }
            try {
                a[com.cashfree.pg.ui.hidden.utils.b.action_cancelled.ordinal()] = 6;
            } catch (NoSuchFieldError unused12) {
            }
        }
    }

    public class m extends HashMap<String, String> {
        public final CFErrorResponse a;

        public m(CFErrorResponse cFErrorResponse) {
            this.a = cFErrorResponse;
            put("payment_mode", "UPI");
            put(AppsFlyerProperties.CHANNEL, CashfreeNativeCheckoutActivity.this.B5.getId());
            put("payment_method", "COLLECT");
            put("error_code", cFErrorResponse.getCode());
            put("error_message", cFErrorResponse.getMessage());
        }
    }

    public class n extends HashMap<String, String> {
        public n() {
            put("payment_mode", "UPI");
            put(AppsFlyerProperties.CHANNEL, "UPI");
            put("payment_attempt_status", "cancelled");
        }
    }

    public class o extends HashMap<String, String> {
        public final CFErrorResponse a;

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

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

    public class q extends HashMap<String, String> {
        public final CFErrorResponse a;

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

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

    public class s extends HashMap<String, String> {
        public final CFErrorResponse a;

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

    public class t extends HashMap<String, String> {
        public t() {
            put("payment_mode", CashfreeNativeCheckoutActivity.this.B5.getPaymentMode().name());
            if (CashfreeNativeCheckoutActivity.this.B5.getName() != null && !CashfreeNativeCheckoutActivity.this.B5.getName().isEmpty()) {
                put("payment_method", CashfreeNativeCheckoutActivity.this.B5.getName());
            }
            put("payment_attempt_status", "cancelled");
        }
    }

    public void S0() {
        this.C1.setVisibility(8);
    }

    public void T0(ConfigResponse configResponse, List list, ArrayList arrayList) {
        this.c0.h(configResponse.getMerchantInfo(), configResponse.getOrderDetails(), new com.cashfree.pg.ui.hidden.checkout.subview.a() {
            @Override
            public final void a() {
                CashfreeNativeCheckoutActivity.this.L0();
            }
        });
        if (list.size() == 1) {
            CFErrorResponse I0 = I0((CFPaymentModes) list.get(0), configResponse.getPaymentModes(), arrayList);
            if (I0 != null) {
                f1(I0);
            } else {
                PaymentView H0 = H0(configResponse, (CFPaymentModes) list.get(0), arrayList);
                if (H0 != null) {
                    H0.b();
                }
            }
        } else {
            Iterator it = list.iterator();
            while (it.hasNext()) {
                H0(configResponse, (CFPaymentModes) it.next(), arrayList);
            }
        }
        if (this.x1 != null) {
            NfcAdapter defaultAdapter = ((NfcManager) getSystemService("nfc")).getDefaultAdapter();
            if (defaultAdapter == null) {
                this.x1.N(f.h.NFC_UNAVAILABLE);
                return;
            }
            AnalyticsUtil.addEvent(UserEvents.NFC_AVAILABLE);
            n1(defaultAdapter);
            this.D5 = new com.cashfree.pg.ui.hidden.checkout.s(this);
            this.E5 = new NfcCardReader();
            registerReceiver(new e(defaultAdapter), new IntentFilter(CFNFCJSInterface.ANDROID_NFC_ACTION_ADAPTER_STATE_CHANGED));
        }
    }

    public void U0() {
        AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_close, new i());
        f1(CFUtil.getResponseFromError(CFUtil.getCancelledResponse()));
    }

    public void V0(QuickCheckout quickCheckout, OrderDetails orderDetails) {
        if (quickCheckout == null || quickCheckout.c().size() <= 0) {
            return;
        }
        l1(quickCheckout, orderDetails);
    }

    public void W0(List list, ConfigResponse configResponse, ArrayList arrayList) {
        if (this.z5 && !com.cashfree.pg.ui.hidden.persistence.a.c().e()) {
            this.H.s(list, configResponse.getPaymentModes(), configResponse.getOrderDetails(), arrayList, this);
        }
        d1(configResponse, list, arrayList);
    }

    public void X0() {
        if (this.A4) {
            return;
        }
        g1(this.H.p());
    }

    public void Y0() {
        if (this.A4) {
            return;
        }
        g1(this.H.p());
    }

    public void Z0(SavedCardsResponse savedCardsResponse) {
        if (this.A1 == null) {
            this.A1 = new com.cashfree.pg.ui.hidden.checkout.subview.savedcards.e(this.I, savedCardsResponse.getSavedCards(), this, this.V1);
        }
    }

    public static void a1(String str, CFErrorResponse cFErrorResponse) {
        com.cashfree.pg.ui.hidden.channel.d.e().publishEvent(new d.b(com.cashfree.pg.ui.hidden.channel.e.onFailure, str, cFErrorResponse));
    }

    public static void b1(String str) {
        com.cashfree.pg.ui.hidden.channel.d.e().publishEvent(new d.b(com.cashfree.pg.ui.hidden.channel.e.onVerify, str, null));
    }

    public void c1() {
        this.C1.setVisibility(0);
    }

    public boolean lambda$onCreate$0() {
        return NetworkConnectivityUtil.a(getApplicationContext());
    }

    @Override
    public void A(SavedCardsResponse.SavedCards savedCards) {
        String instrumentID = savedCards.getInstrumentID();
        this.H.o(instrumentID, new j(instrumentID));
    }

    @Override
    public void B(PaymentMode paymentMode) {
        e1(paymentMode);
    }

    @Override
    public void C(SavedCardsResponse.SavedCards savedCards) {
        P0();
        ?? b0Var = new b0(this, this.V1, savedCards, this);
        this.A3 = b0Var;
        b0Var.show();
    }

    public final PaymentView H0(ConfigResponse configResponse, CFPaymentModes cFPaymentModes, ArrayList<CFUPIApp> arrayList) {
        PaymentModes paymentModes = configResponse.getPaymentModes();
        switch (l.b[cFPaymentModes.ordinal()]) {
            case 1:
                boolean isUPICollectEnable = paymentModes.isUPICollectEnable();
                boolean isUPIQRModeEnable = paymentModes.isUPIQRModeEnable();
                if ((isUPICollectEnable || ((arrayList != null && !arrayList.isEmpty()) || getResources().getBoolean(com.cashfree.pg.ui.b.b))) && this.A0 == null) {
                    this.A0 = new e0(this.I, configResponse.getOrderDetails(), isUPICollectEnable, isUPIQRModeEnable, this.V1, arrayList, this);
                }
                return this.A0;
            case 2:
                if (this.y1 == null && !paymentModes.getEMI().isEmpty()) {
                    this.y1 = new com.cashfree.pg.ui.hidden.checkout.subview.payment.h(this.I, configResponse.getOrderDetails(), paymentModes.getEMI(), this.V1, this);
                }
                return this.y1;
            case 3:
                if (this.C0 == null && !paymentModes.getNetBanking().isEmpty()) {
                    this.C0 = new com.cashfree.pg.ui.hidden.checkout.subview.payment.o(this.I, paymentModes.getNetBanking(), configResponse.getOrderDetails(), this.V1, this);
                }
                return this.C0;
            case 4:
                if (this.c1 == null && !paymentModes.getWallet().isEmpty()) {
                    this.c1 = new j0(this.I, paymentModes.getWallet(), configResponse.getOrderDetails(), configResponse.getCustomerDetails(), this.V1, this);
                }
                return this.c1;
            case 5:
                if (this.p1 == null && !paymentModes.getPayLater().isEmpty()) {
                    this.p1 = new com.cashfree.pg.ui.hidden.checkout.subview.payment.t(this.I, paymentModes.getPayLater(), configResponse.getOrderDetails(), configResponse.getCustomerDetails(), this.V1, this);
                }
                return this.p1;
            case 6:
                if (this.x1 == null && !paymentModes.getCard().isEmpty()) {
                    this.x1 = new com.cashfree.pg.ui.hidden.checkout.subview.payment.f(this.I, configResponse.getOrderDetails(), this.V1, configResponse.getFeatureConfig(), this);
                }
                return this.x1;
            default:
                return null;
        }
    }

    public final CFErrorResponse I0(CFPaymentModes cFPaymentModes, PaymentModes paymentModes, ArrayList<CFUPIApp> arrayList) {
        int i2 = l.b[cFPaymentModes.ordinal()];
        if (i2 != 1) {
            if (i2 == 2 && paymentModes.getEMI().isEmpty()) {
                return CFUtil.getErrorForNoPaymentMode(cFPaymentModes.name());
            }
        } else if (paymentModes.getUpi().isEmpty() && (arrayList == null || arrayList.isEmpty())) {
            return CFUtil.getErrorForNoPaymentMode(cFPaymentModes.name());
        }
        return null;
    }

    public final void J0(CFErrorResponse cFErrorResponse) {
        switch (l.a[com.cashfree.pg.ui.hidden.utils.b.getCode(cFErrorResponse.getCode()).ordinal()]) {
            case 1:
                e0 e0Var = this.A0;
                if (e0Var != null) {
                    e0Var.D();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new m(cFErrorResponse));
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new n());
                break;
            case 2:
                com.cashfree.pg.ui.hidden.checkout.subview.payment.f fVar = this.x1;
                if (fVar != null) {
                    fVar.D();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new o(cFErrorResponse));
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new p());
                CFPersistence.getInstance().clearTxnID();
                break;
            case 3:
                com.cashfree.pg.ui.hidden.checkout.subview.payment.f fVar2 = this.x1;
                if (fVar2 != null) {
                    fVar2.G();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new q(cFErrorResponse));
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new r());
                CFPersistence.getInstance().clearTxnID();
                break;
            case 4:
                com.cashfree.pg.ui.hidden.checkout.subview.payment.t tVar = this.p1;
                if (tVar != null) {
                    tVar.z();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new s(cFErrorResponse));
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new t());
                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();
                f1(cFErrorResponse);
                break;
        }
    }

    public final void K0() {
        com.cashfree.pg.ui.hidden.checkout.dialog.b bVar = this.y2;
        if (bVar == null || !bVar.isVisible()) {
            return;
        }
        this.y2.dismissAllowingStateLoss();
        this.y2 = null;
    }

    public void L0() {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.this.S0();
            }
        });
    }

    public final void M0() {
        com.google.android.material.bottomsheet.a aVar = this.x2;
        if (aVar == null || !aVar.isShowing()) {
            return;
        }
        this.x2.dismiss();
    }

    public final void N0() {
        androidx.appcompat.app.q qVar = this.W2;
        if (qVar == null || !qVar.isShowing()) {
            return;
        }
        this.W2.dismiss();
    }

    public final void O0() {
        com.google.android.material.bottomsheet.a aVar = this.A2;
        if (aVar == null || !aVar.isShowing()) {
            return;
        }
        this.A2.dismiss();
    }

    public final void P0() {
        com.google.android.material.bottomsheet.a aVar = this.A3;
        if (aVar == null || !aVar.isShowing()) {
            return;
        }
        this.A3.dismiss();
    }

    public final void Q0() {
        com.google.android.material.bottomsheet.a aVar = this.p2;
        if (aVar == null || !aVar.isShowing()) {
            return;
        }
        this.p2.dismiss();
    }

    public final boolean R0(PaymentView paymentView) {
        return paymentView != null && paymentView.a();
    }

    @Override
    public void a(h.a aVar) {
        K0();
        this.H.g(aVar);
    }

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

    @Override
    public void d(CFErrorResponse cFErrorResponse) {
    }

    public final void d1(final ConfigResponse configResponse, final List<CFPaymentModes> list, final ArrayList<CFUPIApp> arrayList) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.this.T0(configResponse, list, arrayList);
            }
        });
    }

    public final void e1(PaymentMode paymentMode) {
        AnalyticsUtil.addEvent(UserEvents.cfevent_payment_mode_focus, new h(paymentMode));
        e0 e0Var = this.A0;
        if (e0Var != null && paymentMode != PaymentMode.UPI_INTENT && paymentMode != PaymentMode.UPI_COLLECT) {
            e0Var.n();
        }
        com.cashfree.pg.ui.hidden.checkout.subview.payment.o oVar = this.C0;
        if (oVar != null && paymentMode != PaymentMode.NET_BANKING) {
            oVar.j();
        }
        j0 j0Var = this.c1;
        if (j0Var != null && paymentMode != PaymentMode.WALLET) {
            j0Var.l();
        }
        com.cashfree.pg.ui.hidden.checkout.subview.payment.t tVar = this.p1;
        if (tVar != null && paymentMode != PaymentMode.PAY_LATER) {
            tVar.l();
        }
        com.cashfree.pg.ui.hidden.checkout.subview.payment.f fVar = this.x1;
        if (fVar != null && paymentMode != PaymentMode.CARD) {
            fVar.s();
        }
        this.c0.c();
    }

    public final void f1(final CFErrorResponse cFErrorResponse) {
        final String p2;
        finish();
        if (this.A4) {
            return;
        }
        this.A4 = true;
        if (cFErrorResponse.getMessage().equals("payment method failed.") || (p2 = this.H.p()) == null) {
            return;
        }
        ThreadUtil.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.a1(p2, cFErrorResponse);
            }
        });
    }

    public final void g1(final String str) {
        AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new f(str));
        AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_close, new g(str));
        CFPersistence.getInstance().clearTxnID();
        if (this.z5) {
            this.H.w(this.B5, CFPersistence.getInstance().getEnvironment());
        }
        finish();
        if (this.A4) {
            return;
        }
        this.A4 = true;
        if (str != null) {
            ThreadUtil.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    CashfreeNativeCheckoutActivity.b1(str);
                }
            });
        }
    }

    @Override
    public void h(PaymentInitiationData paymentInitiationData) {
        this.H.i(paymentInitiationData);
    }

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

    public final void h1(List<EmiOption> list, OrderDetails orderDetails) {
        K0();
        this.y2 = new com.cashfree.pg.ui.hidden.checkout.dialog.b(list, orderDetails, this.V1, this);
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.y2.show(getSupportFragmentManager(), "EmiInfoBottomSheetDialog");
    }

    public final void hideExitDialog() {
        androidx.appcompat.app.b bVar = this.V2;
        if (bVar == null || !bVar.isShowing()) {
            return;
        }
        this.V2.dismiss();
    }

    @Override
    public void i(CFErrorResponse cFErrorResponse) {
        f1(cFErrorResponse);
    }

    @Override
    public void i0() {
        this.y2 = null;
    }

    public void i1() {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.this.c1();
            }
        });
    }

    @Override
    public void j0(List<EmiOption> list, OrderDetails orderDetails) {
        h1(list, orderDetails);
    }

    public final void j1(List<PaymentOption> list, OrderDetails orderDetails) {
        M0();
        this.x2 = new com.cashfree.pg.ui.hidden.checkout.dialog.j(this, list, orderDetails, this.V1, this);
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.x2.show();
    }

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

    public final void k1(String str) {
        N0();
        this.W2 = new com.cashfree.pg.ui.hidden.checkout.dialog.p(this, str, this.V1, this);
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.W2.show();
    }

    @Override
    public void l(ArrayList<CFUPIApp> arrayList, OrderDetails orderDetails) {
        m1(arrayList, orderDetails);
    }

    @Override
    public void l0(CFPayment cFPayment, PaymentInitiationData paymentInitiationData) {
        try {
            CFDropCheckoutPayment b2 = com.cashfree.pg.ui.hidden.persistence.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.B5 = paymentInitiationData;
            i1();
            cFPayment.setTheme(this.V1);
            CFCorePaymentGatewayService.getInstance().doPayment(this, cFPayment);
        } catch (CFException e2) {
            e2.printStackTrace();
        }
    }

    public final void l1(QuickCheckout quickCheckout, OrderDetails orderDetails) {
        O0();
        this.A2 = new w(this, quickCheckout, orderDetails, this.V1, this);
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.A2.show();
    }

    @Override
    public void m(final QuickCheckout quickCheckout, final OrderDetails orderDetails, List<CFUPIApp> list) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.this.V0(quickCheckout, orderDetails);
            }
        });
    }

    @Override
    public void m0(final ConfigResponse configResponse, final List<CFPaymentModes> list) {
        if (list.isEmpty()) {
            f1(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.this.W0(list, configResponse, arrayList);
                }
            });
            return;
        }
        if (this.z5 && !com.cashfree.pg.ui.hidden.persistence.a.c().e()) {
            this.H.s(list, configResponse.getPaymentModes(), configResponse.getOrderDetails(), new ArrayList(), this);
        }
        d1(configResponse, list, null);
    }

    public final void m1(ArrayList<CFUPIApp> arrayList, OrderDetails orderDetails) {
        Q0();
        this.p2 = new h0(this, arrayList, orderDetails, this.V1, new h0.b() {
            @Override
            public final void c(PaymentInitiationData paymentInitiationData) {
                CashfreeNativeCheckoutActivity.this.r(paymentInitiationData);
            }
        });
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.p2.show();
    }

    @Override
    public void n(String str, String str2, String str3, String str4, String str5, boolean z) {
        this.H.h(str, str2, str3, str4, str5, z);
    }

    @Override
    public BaseViewModel n0() {
        return this.H;
    }

    public final void n1(NfcAdapter nfcAdapter) {
        if (this.x1 != null) {
            if (nfcAdapter.isEnabled()) {
                AnalyticsUtil.addEvent(UserEvents.NFC_ENABLED);
                this.x1.N(f.h.NFC_ENABLED);
            } else {
                AnalyticsUtil.addEvent(UserEvents.NFC_DISABLED);
                this.x1.N(f.h.NFC_DISABLED);
            }
        }
    }

    public void onBackPressed() {
        this.V2 = new com.cashfree.pg.ui.hidden.checkout.dialog.e(this, this.V1, new com.cashfree.pg.ui.hidden.checkout.subview.a() {
            @Override
            public final void a() {
                CashfreeNativeCheckoutActivity.this.U0();
            }
        });
        if (isFinishing() || isDestroyed()) {
            return;
        }
        this.V2.show();
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_open, new d());
        this.B5 = CFPersistence.getInstance().getPaymentInitiationData();
        CFCorePaymentGatewayService.getInstance().setCheckoutCallback(this.C5.b());
        CFCorePaymentGatewayService.getInstance().setQRCallback(this.C5);
        try {
            this.z5 = getResources().getBoolean(com.cashfree.pg.ui.b.a);
        } catch (Exception e2) {
            com.cashfree.pg.base.logger.a.c().b("CashfreeNativeCheckoutActivity", e2.getMessage());
        }
        this.A5 = true;
        this.A4 = false;
        setContentView(com.cashfree.pg.ui.e.a);
        com.cashfree.pg.ui.hidden.viewModel.b bVar = new com.cashfree.pg.ui.hidden.viewModel.b(this, new com.cashfree.pg.network.c() {
            @Override
            public final boolean isNetworkConnected() {
                boolean lambda$onCreate$0;
                lambda$onCreate$0 = CashfreeNativeCheckoutActivity.this.lambda$onCreate$0();
                return lambda$onCreate$0;
            }
        });
        this.H = bVar;
        this.V1 = bVar.t();
        this.C1 = findViewById(com.cashfree.pg.ui.d.z);
        setTheme();
        this.I = findViewById(com.cashfree.pg.ui.d.A0);
        com.cashfree.pg.ui.hidden.checkout.subview.d dVar = new com.cashfree.pg.ui.hidden.checkout.subview.d(findViewById(com.cashfree.pg.ui.d.x), this.V1);
        this.c0 = dVar;
        dVar.f();
        setSupportActionBar(this.c0.d());
        if (getSupportActionBar() != null) {
            getSupportActionBar().t(true);
            getSupportActionBar().x("");
        }
        i1();
        this.H.v();
        this.H.f(this);
    }

    @Override
    public void onDestroy() {
        N0();
        O0();
        com.cashfree.pg.ui.hidden.checkout.subview.savedcards.e eVar = this.A1;
        if (eVar != null) {
            eVar.c();
        }
        super.onDestroy();
    }

    public 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.E5.readCard(tag);
        if (readCard == null || readCard.getEmvCard() == null || this.x1 == null) {
            return;
        }
        AnalyticsUtil.addEvent(UserEvents.NFC_CARD_INFO_ENTRY_DONE, new c(readCard));
        com.cashfree.pg.base.logger.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.x1.F(readCard.getEmvCard().getCardNumber(), readCard.getEmvCard().getExpireDate());
    }

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

    @Override
    public void onPVCancelled() {
    }

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

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

    @Override
    public void onPause() {
        super.onPause();
        L0();
        com.cashfree.pg.ui.hidden.checkout.s sVar = this.D5;
        if (sVar != null) {
            sVar.a();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        com.cashfree.pg.ui.hidden.checkout.s sVar = this.D5;
        if (sVar != null) {
            sVar.b();
        }
    }

    @Override
    public void onStart() {
        if (this.A5) {
            this.A5 = false;
        } else {
            this.H.r();
        }
        super.onStart();
    }

    @Override
    public void onStop() {
        super.onStop();
        Q0();
        M0();
        hideExitDialog();
        K0();
        P0();
    }

    @Override
    public void p(List<PaymentOption> list, OrderDetails orderDetails) {
        j1(list, orderDetails);
    }

    @Override
    public void q(final SavedCardsResponse savedCardsResponse) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.this.Z0(savedCardsResponse);
            }
        });
    }

    @Override
    public void r(PaymentInitiationData paymentInitiationData) {
        this.H.m(paymentInitiationData);
    }

    @Override
    public void s(PaymentInitiationData paymentInitiationData) {
        this.H.j(paymentInitiationData);
    }

    public final void setTheme() {
        int parseColor = Color.parseColor(this.V1.getNavigationBarBackgroundColor());
        ((ProgressBar) findViewById(com.cashfree.pg.ui.d.K0)).getIndeterminateDrawable().setColorFilter(parseColor, PorterDuff.Mode.MULTIPLY);
        getWindow().setStatusBarColor(parseColor);
    }

    @Override
    public void t(PaymentInitiationData paymentInitiationData) {
        this.H.n(paymentInitiationData);
    }

    @Override
    public void v(SavedCardsResponse.SavedCards savedCards, String str) {
        this.H.l(savedCards.getInstrumentID(), str);
    }

    @Override
    public void w(PaymentMode paymentMode) {
        if (R0(this.A0) || R0(this.C0) || R0(this.c1) || R0(this.p1) || R0(this.x1)) {
            return;
        }
        this.c0.f();
    }
}