导航菜单

页面标题

页面副标题

Clash Legends v0.0.1 - CashfreeNativeCheckoutActivity.java 源代码

正在查看: Clash Legends v0.0.1 应用的 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.appcompat.app.AlertDialog;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.cashfree.pg.base.logger.CFLoggerService;
import com.cashfree.pg.core.api.CFCorePaymentGatewayService;
import com.cashfree.pg.core.api.CFSession;
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.network.INetworkChecks;
import com.cashfree.pg.network.NetworkConnectivityUtil;
import com.cashfree.pg.ui.R;
import com.cashfree.pg.ui.api.CFDropCheckoutPayment;
import com.cashfree.pg.ui.hidden.activity.INativePaymentCheckoutEvents;
import com.cashfree.pg.ui.hidden.activity.base.BaseActivity;
import com.cashfree.pg.ui.hidden.channel.CFNativeCallbackEventBus;
import com.cashfree.pg.ui.hidden.channel.CFNativeCallbackEvents;
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.EmiInfoBottomSheetDialog;
import com.cashfree.pg.ui.hidden.checkout.dialog.ExitDialog;
import com.cashfree.pg.ui.hidden.checkout.dialog.NBAppsBottomSheetDialog;
import com.cashfree.pg.ui.hidden.checkout.dialog.QRDialog;
import com.cashfree.pg.ui.hidden.checkout.dialog.QuickCheckoutBottomSheetDialog;
import com.cashfree.pg.ui.hidden.checkout.dialog.SavedCardDeleteBottomSheetDialog;
import com.cashfree.pg.ui.hidden.checkout.dialog.UPIAppsBottomSheetDialog;
import com.cashfree.pg.ui.hidden.checkout.subview.Action;
import com.cashfree.pg.ui.hidden.checkout.subview.ToolbarView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.CardView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.EMIView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.NetBankingView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.PayLaterView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.PaymentView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.UPIView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.WalletView;
import com.cashfree.pg.ui.hidden.checkout.subview.savedcards.SavedCardView;
import com.cashfree.pg.ui.hidden.dao.NativeCheckoutDAO;
import com.cashfree.pg.ui.hidden.dao.QuickCheckoutDAO;
import com.cashfree.pg.ui.hidden.persistence.CFUIPersistence;
import com.cashfree.pg.ui.hidden.utils.AnalyticsConstants;
import com.cashfree.pg.ui.hidden.utils.ErrorCode;
import com.cashfree.pg.ui.hidden.viewModel.BaseViewModel;
import com.cashfree.pg.ui.hidden.viewModel.NativeCheckoutViewModel;
import com.facebook.appevents.codeless.internal.Constants;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

public class CashfreeNativeCheckoutActivity extends BaseActivity implements INativePaymentCheckoutEvents, UPIView.UPIViewEvents, NetBankingView.NBViewEvents, PVBottomSheetDialog.PaymentVerificationListener, WalletView.WalletViewEvents, PayLaterView.PayLaterViewEvents, CardView.CardViewEvents, QuickCheckoutDAO.QuickCheckoutListener, QuickCheckoutBottomSheetDialog.QuickCheckoutListener, EMIView.EMIViewEvents, NativeCheckoutDAO.FetchSavedCardsResponseListener, SavedCardView.SavedCardViewEvents {
    public static final String ANDROID_NFC_ACTION_ADAPTER_STATE_CHANGED = "android.nfc.action.ADAPTER_STATE_CHANGED";
    private static final String TAG = "CashfreeNativeCheckoutActivity";
    private CardView cardView;
    private CFTheme cfTheme;
    private EmiInfoBottomSheetDialog emiInfoDialog;
    private EMIView emiView;
    private AlertDialog exitDialog;
    private boolean isCreated;
    private LinearLayoutCompat llContentScrolling;
    private CoordinatorLayout loader;
    private NativeCheckoutViewModel nativeCheckoutViewModel;
    private NBAppsBottomSheetDialog nbAppsDialog;
    private NetBankingView netBankingView;
    private NfcCardManager nfcCardManager;
    private NfcCardReader nfcCardReader;
    private PayLaterView payLaterView;
    private PaymentInitiationData paymentInitiationData;
    private QRDialog qrDialog;
    private QuickCheckoutBottomSheetDialog quickCheckoutDialog;
    private SavedCardDeleteBottomSheetDialog savedCardDeleteDialog;
    private SavedCardView savedCardView;
    private ToolbarView toolbarView;
    private UPIAppsBottomSheetDialog upiAppsDialog;
    private UPIView upiView;
    private WalletView walletView;
    private boolean isResponseSent = false;
    private boolean quickCheckoutEnabled = true;
    public final CFNativeCoreCallbacks cfNativeCoreCallbacks = new AnonymousClass1();

    class AnonymousClass1 extends CFNativeCoreCallbacks {
        AnonymousClass1() {
        }

        @Override
        public void onVerifyPayment(String orderId) {
            CashfreeNativeCheckoutActivity.this.sendVerify(orderId);
        }

        @Override
        public void onPaymentFailure(final CFErrorResponse cfErrorResponse, String orderID) {
            ThreadUtil.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    CashfreeNativeCheckoutActivity.AnonymousClass1.this.m150x986012c9(cfErrorResponse);
                }
            });
        }

        void m150x986012c9(CFErrorResponse cfErrorResponse) {
            CashfreeNativeCheckoutActivity.this.hideLoader();
            CashfreeNativeCheckoutActivity.this.handleError(cfErrorResponse);
        }

        @Override
        public void onQRFetched(final String base64Icon) {
            ThreadUtil.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    CashfreeNativeCheckoutActivity.AnonymousClass1.this.m151xce3ec0c6(base64Icon);
                }
            });
        }

        void m151xce3ec0c6(String base64Icon) {
            CashfreeNativeCheckoutActivity.this.hideLoader();
            CashfreeNativeCheckoutActivity.this.showQRCodeDialog(base64Icon);
        }
    }

    public void handleError(CFErrorResponse cfErrorResponse) {
        ErrorCode errorCode = ErrorCode.getCode(cfErrorResponse.getCode());
        switch (AnonymousClass20.$SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[errorCode.ordinal()]) {
            case 1:
                UPIView uPIView = this.upiView;
                if (uPIView != null) {
                    uPIView.setUpiIdInvalid();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new HashMap<String, String>(cfErrorResponse) {
                    final CFErrorResponse val$cfErrorResponse;

                    {
                        this.val$cfErrorResponse = cfErrorResponse;
                        put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
                        put(AnalyticsConstants.CHANNEL, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getId());
                        put(AnalyticsConstants.PAYMENT_METHOD, AnalyticsConstants.COLLECT);
                        put("error_code", cfErrorResponse.getCode());
                        put("error_message", cfErrorResponse.getMessage());
                    }
                });
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>() {
                    {
                        put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
                        put(AnalyticsConstants.CHANNEL, AnalyticsConstants.UPI);
                        put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, "cancelled");
                    }
                });
                break;
            case 2:
                CardView cardView = this.cardView;
                if (cardView != null) {
                    cardView.setCardHolderInvalid();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new HashMap<String, String>(cfErrorResponse) {
                    final CFErrorResponse val$cfErrorResponse;

                    {
                        this.val$cfErrorResponse = cfErrorResponse;
                        put(AnalyticsConstants.PAYMENT_MODE, PaymentMode.CARD.name());
                        put("error_code", cfErrorResponse.getCode());
                        put("error_message", cfErrorResponse.getMessage());
                    }
                });
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>() {
                    {
                        put(AnalyticsConstants.PAYMENT_MODE, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
                        if (CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName() != null && !CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName().isEmpty()) {
                            put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName());
                        }
                        put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, "cancelled");
                    }
                });
                CFPersistence.getInstance().clearTxnID();
                break;
            case 3:
                CardView cardView2 = this.cardView;
                if (cardView2 != null) {
                    cardView2.setCardNumberError();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new HashMap<String, String>(cfErrorResponse) {
                    final CFErrorResponse val$cfErrorResponse;

                    {
                        this.val$cfErrorResponse = cfErrorResponse;
                        put(AnalyticsConstants.PAYMENT_MODE, PaymentMode.CARD.name());
                        put("error_code", cfErrorResponse.getCode());
                        put("error_message", cfErrorResponse.getMessage());
                    }
                });
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>() {
                    {
                        put(AnalyticsConstants.PAYMENT_MODE, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
                        if (CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName() != null && !CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName().isEmpty()) {
                            put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName());
                        }
                        put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, "cancelled");
                    }
                });
                CFPersistence.getInstance().clearTxnID();
                break;
            case 4:
                PayLaterView payLaterView = this.payLaterView;
                if (payLaterView != null) {
                    payLaterView.showPhoneIllegible();
                }
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new HashMap<String, String>(cfErrorResponse) {
                    final CFErrorResponse val$cfErrorResponse;

                    {
                        this.val$cfErrorResponse = cfErrorResponse;
                        put(AnalyticsConstants.PAYMENT_MODE, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
                        put("error_code", cfErrorResponse.getCode());
                        put("error_message", cfErrorResponse.getMessage());
                    }
                });
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>() {
                    {
                        put(AnalyticsConstants.PAYMENT_MODE, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
                        if (CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName() != null && !CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName().isEmpty()) {
                            put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName());
                        }
                        put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, "cancelled");
                    }
                });
                CFPersistence.getInstance().clearTxnID();
                break;
            case 5:
            case 6:
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>() {
                    {
                        PaymentMode mode = CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode();
                        if (mode.equals(PaymentMode.QR_CODE)) {
                            put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
                            put(AnalyticsConstants.CHANNEL, AnalyticsConstants.QR);
                        } else if (mode.equals(PaymentMode.UPI_COLLECT)) {
                            put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
                            put(AnalyticsConstants.CHANNEL, AnalyticsConstants.COLLECT);
                        } else if (!mode.equals(PaymentMode.UPI_INTENT)) {
                            put(AnalyticsConstants.PAYMENT_MODE, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
                        } else {
                            put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
                            put(AnalyticsConstants.CHANNEL, AnalyticsConstants.INTENT);
                        }
                        if (CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName() != null && !CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName().isEmpty()) {
                            put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName());
                        }
                        put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, "cancelled");
                    }
                });
                CFPersistence.getInstance().clearTxnID();
                break;
            default:
                AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>() {
                    {
                        PaymentMode mode = CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode();
                        if (mode.equals(PaymentMode.QR_CODE)) {
                            put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
                            put(AnalyticsConstants.CHANNEL, AnalyticsConstants.QR);
                        } else if (mode.equals(PaymentMode.UPI_COLLECT)) {
                            put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
                            put(AnalyticsConstants.CHANNEL, AnalyticsConstants.COLLECT);
                        } else if (!mode.equals(PaymentMode.UPI_INTENT)) {
                            put(AnalyticsConstants.PAYMENT_MODE, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
                        } else {
                            put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
                            put(AnalyticsConstants.CHANNEL, AnalyticsConstants.INTENT);
                        }
                        if (CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName() != null && !CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName().isEmpty()) {
                            put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName());
                        }
                        put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, AnalyticsConstants.FAILED);
                    }
                });
                CFPersistence.getInstance().clearTxnID();
                sendError(cfErrorResponse);
                break;
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        NfcCardManager nfcCardManager = this.nfcCardManager;
        if (nfcCardManager != null) {
            nfcCardManager.enableDispatch();
        }
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        Tag tag = (Tag) intent.getParcelableExtra("android.nfc.extra.TAG");
        if (tag == null) {
            Toast.makeText(this, "TAG null", 0).show();
            return;
        }
        NfcCardResponse cardResponse = this.nfcCardReader.readCard(tag);
        if (cardResponse != null && cardResponse.getEmvCard() != null && this.cardView != null) {
            AnalyticsUtil.addEvent(UserEvents.NFC_CARD_INFO_ENTRY_DONE, new HashMap<String, String>(cardResponse) {
                final NfcCardResponse val$cardResponse;

                {
                    this.val$cardResponse = cardResponse;
                    put("card_type", cardResponse.getEmvCard().getType().getName());
                }
            });
            CFLoggerService.getInstance().d(TAG, String.format("%s \n %s \n %s \n %s", cardResponse.getEmvCard().getCardNumber(), cardResponse.getEmvCard().getExpireDate(), cardResponse.getEmvCard().getHolderFirstname(), cardResponse.getEmvCard().getHolderLastname()));
            this.cardView.setCardNoAndExp(cardResponse.getEmvCard().getCardNumber(), cardResponse.getEmvCard().getExpireDate());
        }
    }

    @Override
    protected BaseViewModel getViewModel() {
        return this.nativeCheckoutViewModel;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_open, new HashMap<String, String>() {
            {
                put("platform", Constants.PLATFORM);
            }
        });
        this.paymentInitiationData = CFPersistence.getInstance().getPaymentInitiationData();
        CFCorePaymentGatewayService.getInstance().setCheckoutCallback(this.cfNativeCoreCallbacks.getCfCheckoutResponseCallback());
        CFCorePaymentGatewayService.getInstance().setQRCallback(this.cfNativeCoreCallbacks);
        try {
            this.quickCheckoutEnabled = getResources().getBoolean(R.bool.cf_quick_checkout_enabled);
        } catch (Exception e) {
            CFLoggerService.getInstance().e(TAG, e.getMessage());
        }
        this.isCreated = true;
        this.isResponseSent = false;
        setContentView(R.layout.activity_cashfree_native_checkout);
        NativeCheckoutViewModel nativeCheckoutViewModel = new NativeCheckoutViewModel(this, new INetworkChecks() {
            @Override
            public final boolean isNetworkConnected() {
                return CashfreeNativeCheckoutActivity.this.m143x91c6b994();
            }
        });
        this.nativeCheckoutViewModel = nativeCheckoutViewModel;
        this.cfTheme = nativeCheckoutViewModel.getTheme();
        this.loader = (CoordinatorLayout) findViewById(R.id.cf_loader);
        setTheme();
        this.llContentScrolling = (LinearLayoutCompat) findViewById(R.id.llc_content);
        ToolbarView toolbarView = new ToolbarView((CoordinatorLayout) findViewById(R.id.cf_cl_root), this.cfTheme);
        this.toolbarView = toolbarView;
        toolbarView.open();
        setSupportActionBar(this.toolbarView.getMaterialToolbar());
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().setTitle("");
        }
        showLoader();
        this.nativeCheckoutViewModel.init();
        this.nativeCheckoutViewModel.addSavedCardListener(this);
    }

    boolean m143x91c6b994() {
        return NetworkConnectivityUtil.isNetworkConnected(getApplicationContext());
    }

    public void toggleCardViewUIState(NfcAdapter adapter) {
        if (this.cardView != null) {
            if (adapter.isEnabled()) {
                AnalyticsUtil.addEvent(UserEvents.NFC_ENABLED);
                this.cardView.setUIState(CardView.CardViewUIState.NFC_ENABLED);
            } else {
                AnalyticsUtil.addEvent(UserEvents.NFC_DISABLED);
                this.cardView.setUIState(CardView.CardViewUIState.NFC_DISABLED);
            }
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == 16908332) {
            onBackPressed();
        }
        return super.onOptionsItemSelected(item);
    }

    private void setTheme() {
        int toolbarColor = Color.parseColor(this.cfTheme.getNavigationBarBackgroundColor());
        ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress_bar);
        progressBar.getIndeterminateDrawable().setColorFilter(toolbarColor, PorterDuff.Mode.MULTIPLY);
        getWindow().setStatusBarColor(toolbarColor);
    }

    @Override
    protected void onPause() {
        super.onPause();
        hideLoader();
        NfcCardManager nfcCardManager = this.nfcCardManager;
        if (nfcCardManager != null) {
            nfcCardManager.disableDispatch();
        }
    }

    @Override
    protected void onStop() {
        super.onStop();
        hideUPIDialog();
        hideNBDialog();
        hideExitDialog();
        hideEmiDialog();
        hideSavedCardDeleteDialog();
    }

    @Override
    protected void onDestroy() {
        hideQRDialog();
        hideQuickCheckout();
        SavedCardView savedCardView = this.savedCardView;
        if (savedCardView != null) {
            savedCardView.resetView();
        }
        super.onDestroy();
    }

    @Override
    protected void onStart() {
        if (this.isCreated) {
            this.isCreated = false;
        } else {
            this.nativeCheckoutViewModel.getOrderStatus();
        }
        super.onStart();
    }

    @Override
    public void onFetchPaymentData(final ConfigResponse configResponse, final List<CFPaymentModes> cfPaymentModes) {
        if (cfPaymentModes.isEmpty()) {
            CFErrorResponse cfErrorResponse = CFUtil.getResponseFromError(CFUtil.getFailedResponse("no payment_modes are available as per configuration."));
            sendError(cfErrorResponse);
        } else {
            if (cfPaymentModes.contains(CFPaymentModes.UPI)) {
                CFUPIUtil.getInstalledUPIApps(this, new CFUPIUtil.UPIAppsCallback() {
                    @Override
                    public final void onUPIAppsFetched(ArrayList arrayList) {
                        CashfreeNativeCheckoutActivity.this.m145xa89af80f(cfPaymentModes, configResponse, arrayList);
                    }
                });
                return;
            }
            if (this.quickCheckoutEnabled && !CFUIPersistence.getInstance().getQuickCheckoutShown()) {
                this.nativeCheckoutViewModel.getQuickCheckoutData(cfPaymentModes, configResponse.getPaymentModes(), configResponse.getOrderDetails(), new ArrayList(), this);
            }
            loadViews(configResponse, cfPaymentModes, null);
        }
    }

    void m145xa89af80f(List cfPaymentModes, ConfigResponse configResponse, ArrayList upiAppList) {
        if (this.quickCheckoutEnabled && !CFUIPersistence.getInstance().getQuickCheckoutShown()) {
            this.nativeCheckoutViewModel.getQuickCheckoutData(cfPaymentModes, configResponse.getPaymentModes(), configResponse.getOrderDetails(), upiAppList, this);
        }
        loadViews(configResponse, cfPaymentModes, upiAppList);
    }

    private void loadViews(final ConfigResponse response, final List<CFPaymentModes> cfPaymentModes, final ArrayList<CFUPIApp> upiAppList) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.this.m141x6357fc29(response, cfPaymentModes, upiAppList);
            }
        });
    }

    void m141x6357fc29(ConfigResponse response, List cfPaymentModes, ArrayList upiAppList) {
        this.toolbarView.setMerchantInfo(response.getMerchantInfo(), response.getOrderDetails(), new Action() {
            @Override
            public final void onAction() {
                CashfreeNativeCheckoutActivity.this.hideLoader();
            }
        });
        if (cfPaymentModes.size() == 1) {
            CFErrorResponse errorResponse = checkAndGetPaymentModeError((CFPaymentModes) cfPaymentModes.get(0), response.getPaymentModes(), upiAppList);
            if (errorResponse != null) {
                sendError(errorResponse);
            } else {
                PaymentView paymentView = addView(response, (CFPaymentModes) cfPaymentModes.get(0), upiAppList);
                if (paymentView != null) {
                    paymentView.open();
                }
            }
        } else {
            Iterator it = cfPaymentModes.iterator();
            while (it.hasNext()) {
                CFPaymentModes cfPaymentMode = (CFPaymentModes) it.next();
                addView(response, cfPaymentMode, upiAppList);
            }
        }
        if (this.cardView != null) {
            NfcManager manager = (NfcManager) getSystemService("nfc");
            final NfcAdapter adapter = manager.getDefaultAdapter();
            if (adapter != null) {
                AnalyticsUtil.addEvent(UserEvents.NFC_AVAILABLE);
                toggleCardViewUIState(adapter);
                this.nfcCardManager = new NfcCardManager(this);
                this.nfcCardReader = new NfcCardReader();
                IntentFilter filter = new IntentFilter("android.nfc.action.ADAPTER_STATE_CHANGED");
                BroadcastReceiver receiver = new BroadcastReceiver() {
                    @Override
                    public void onReceive(Context context, Intent intent) {
                        CashfreeNativeCheckoutActivity.this.toggleCardViewUIState(adapter);
                    }
                };
                registerReceiver(receiver, filter);
                return;
            }
            this.cardView.setUIState(CardView.CardViewUIState.NFC_UNAVAILABLE);
        }
    }

    static class AnonymousClass20 {
        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 e) {
            }
            try {
                $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.EMI.ordinal()] = 2;
            } catch (NoSuchFieldError e2) {
            }
            try {
                $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.NB.ordinal()] = 3;
            } catch (NoSuchFieldError e3) {
            }
            try {
                $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.WALLET.ordinal()] = 4;
            } catch (NoSuchFieldError e4) {
            }
            try {
                $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.PAY_LATER.ordinal()] = 5;
            } catch (NoSuchFieldError e5) {
            }
            try {
                $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.CARD.ordinal()] = 6;
            } catch (NoSuchFieldError e6) {
            }
            int[] iArr2 = new int[ErrorCode.values().length];
            $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode = iArr2;
            try {
                iArr2[ErrorCode.upi_id_invalid.ordinal()] = 1;
            } catch (NoSuchFieldError e7) {
            }
            try {
                $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[ErrorCode.card_holder_name_invalid.ordinal()] = 2;
            } catch (NoSuchFieldError e8) {
            }
            try {
                $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[ErrorCode.card_number_invalid.ordinal()] = 3;
            } catch (NoSuchFieldError e9) {
            }
            try {
                $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[ErrorCode.phone_ineligible.ordinal()] = 4;
            } catch (NoSuchFieldError e10) {
            }
            try {
                $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[ErrorCode.payment_failed_headless.ordinal()] = 5;
            } catch (NoSuchFieldError e11) {
            }
            try {
                $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[ErrorCode.action_cancelled.ordinal()] = 6;
            } catch (NoSuchFieldError e12) {
            }
        }
    }

    private CFErrorResponse checkAndGetPaymentModeError(CFPaymentModes modes, PaymentModes paymentModes, ArrayList<CFUPIApp> upiAppList) {
        switch (AnonymousClass20.$SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[modes.ordinal()]) {
            case 1:
                if (!paymentModes.getUpi().isEmpty()) {
                    return null;
                }
                if (upiAppList != null && !upiAppList.isEmpty()) {
                    return null;
                }
                CFErrorResponse errorResponse = CFUtil.getErrorForNoPaymentMode(modes.name());
                return errorResponse;
            case 2:
                if (!paymentModes.getEMI().isEmpty()) {
                    return null;
                }
                CFErrorResponse errorResponse2 = CFUtil.getErrorForNoPaymentMode(modes.name());
                return errorResponse2;
            default:
                return null;
        }
    }

    private void showQuickCheckoutDialog(QuickCheckout quickCheckout, OrderDetails orderDetails) {
        hideQuickCheckout();
        this.quickCheckoutDialog = new QuickCheckoutBottomSheetDialog(this, quickCheckout, orderDetails, this.cfTheme, this);
        if (!isFinishing() && !isDestroyed()) {
            this.quickCheckoutDialog.show();
        }
    }

    @Override
    public void onInitiatePayment(CFPayment cfPayment, PaymentInitiationData data) {
        try {
            CFDropCheckoutPayment cfDropCheckoutPayment = CFUIPersistence.getInstance().getCheckoutPayment();
            if (cfDropCheckoutPayment != null && cfDropCheckoutPayment.getSource() != null) {
                String[] source = cfDropCheckoutPayment.getSource().split("-");
                cfPayment.setCfSDKFlavour(CFPayment.CFSDKFlavour.fromString(source[1]).withVersion(source[2]));
                cfPayment.setCfsdkFramework(CFPayment.CFSDKFramework.fromString(source[0]).withVersion(source[3]));
                cfPayment.withBrowserVersion(source[7]);
            }
            CFPersistence.getInstance().setPaymentInitiationData(data);
            this.paymentInitiationData = data;
            showLoader();
            cfPayment.setTheme(this.cfTheme);
            CFCorePaymentGatewayService.getInstance().doPayment(this, cfPayment);
        } catch (CFException e) {
            e.printStackTrace();
        }
    }

    void m149x3d8634cc() {
        this.loader.setVisibility(0);
    }

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

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

    void m140x8dc9b892() {
        this.loader.setVisibility(8);
    }

    private PaymentView addView(ConfigResponse configResponse, CFPaymentModes cfPaymentMode, ArrayList<CFUPIApp> upiAppList) {
        PaymentModes paymentModes = configResponse.getPaymentModes();
        switch (AnonymousClass20.$SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[cfPaymentMode.ordinal()]) {
            case 1:
                boolean isCollectEnable = paymentModes.isUPICollectEnable();
                boolean isUPIQREnable = paymentModes.isUPIQRModeEnable();
                if ((isCollectEnable || ((upiAppList != null && !upiAppList.isEmpty()) || getResources().getBoolean(R.bool.isDeviceTablet))) && this.upiView == null) {
                    this.upiView = new UPIView(this.llContentScrolling, configResponse.getOrderDetails(), isCollectEnable, isUPIQREnable, this.cfTheme, upiAppList, this);
                }
                return this.upiView;
            case 2:
                if (this.emiView == null && !paymentModes.getEMI().isEmpty()) {
                    this.emiView = new EMIView(this.llContentScrolling, configResponse.getOrderDetails(), paymentModes.getEMI(), this.cfTheme, this);
                }
                return this.emiView;
            case 3:
                if (this.netBankingView == null && !paymentModes.getNetBanking().isEmpty()) {
                    this.netBankingView = new NetBankingView(this.llContentScrolling, paymentModes.getNetBanking(), configResponse.getOrderDetails(), this.cfTheme, this);
                }
                return this.netBankingView;
            case 4:
                if (this.walletView == null && !paymentModes.getWallet().isEmpty()) {
                    this.walletView = new WalletView(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 PayLaterView(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 CardView(this.llContentScrolling, configResponse.getOrderDetails(), this.cfTheme, configResponse.getFeatureConfig().getCFFeaturesConfig().isFetchSavedCardEnabled(), configResponse.getFeatureConfig().getCFFeaturesConfig().isNfcCardReadEnabled(), this);
                }
                return this.cardView;
            default:
                return null;
        }
    }

    private void hideUPIDialog() {
        UPIAppsBottomSheetDialog uPIAppsBottomSheetDialog = this.upiAppsDialog;
        if (uPIAppsBottomSheetDialog != null && uPIAppsBottomSheetDialog.isShowing()) {
            this.upiAppsDialog.dismiss();
        }
    }

    private void showUPIDialog(ArrayList<CFUPIApp> upiAppList, OrderDetails orderDetails) {
        hideUPIDialog();
        this.upiAppsDialog = new UPIAppsBottomSheetDialog(this, upiAppList, orderDetails, this.cfTheme, new UPIAppsBottomSheetDialog.UPIPayListener() {
            @Override
            public final void onPayInitiate(PaymentInitiationData paymentInitiationData) {
                CashfreeNativeCheckoutActivity.this.onUPIPayClick(paymentInitiationData);
            }
        });
        if (!isFinishing() && !isDestroyed()) {
            this.upiAppsDialog.show();
        }
    }

    private void hideNBDialog() {
        NBAppsBottomSheetDialog nBAppsBottomSheetDialog = this.nbAppsDialog;
        if (nBAppsBottomSheetDialog != null && nBAppsBottomSheetDialog.isShowing()) {
            this.nbAppsDialog.dismiss();
        }
    }

    private void hideEmiDialog() {
        EmiInfoBottomSheetDialog emiInfoBottomSheetDialog = this.emiInfoDialog;
        if (emiInfoBottomSheetDialog != null && emiInfoBottomSheetDialog.isVisible()) {
            this.emiInfoDialog.dismissAllowingStateLoss();
            this.emiInfoDialog = null;
        }
    }

    private void hideSavedCardDeleteDialog() {
        SavedCardDeleteBottomSheetDialog savedCardDeleteBottomSheetDialog = this.savedCardDeleteDialog;
        if (savedCardDeleteBottomSheetDialog != null && savedCardDeleteBottomSheetDialog.isShowing()) {
            this.savedCardDeleteDialog.dismiss();
        }
    }

    private void hideExitDialog() {
        AlertDialog alertDialog = this.exitDialog;
        if (alertDialog != null && alertDialog.isShowing()) {
            this.exitDialog.dismiss();
        }
    }

    private void hideQRDialog() {
        QRDialog qRDialog = this.qrDialog;
        if (qRDialog != null && qRDialog.isShowing()) {
            this.qrDialog.dismiss();
        }
    }

    private void hideQuickCheckout() {
        QuickCheckoutBottomSheetDialog quickCheckoutBottomSheetDialog = this.quickCheckoutDialog;
        if (quickCheckoutBottomSheetDialog != null && quickCheckoutBottomSheetDialog.isShowing()) {
            this.quickCheckoutDialog.dismiss();
        }
    }

    public void sendVerify(final String orderId) {
        AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>(orderId) {
            final String val$orderId;

            {
                this.val$orderId = orderId;
                put("order_id", orderId);
                put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
                put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, AnalyticsConstants.ENDED);
            }
        });
        AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_close, new HashMap<String, String>(orderId) {
            final String val$orderId;

            {
                this.val$orderId = orderId;
                put("order_id", orderId);
                put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
                put(AnalyticsConstants.CHANNEL, AnalyticsConstants.VERIFY_CALLBACK);
            }
        });
        CFPersistence.getInstance().clearTxnID();
        if (this.quickCheckoutEnabled) {
            CFSession.Environment environment = CFPersistence.getInstance().getEnvironment();
            this.nativeCheckoutViewModel.sendPaymentDataForQuickCheckout(this.paymentInitiationData, environment);
        }
        finish();
        if (!this.isResponseSent) {
            this.isResponseSent = true;
            if (orderId != null) {
                ThreadUtil.runOnUIThread(new Runnable() {
                    @Override
                    public final void run() {
                        CFNativeCallbackEventBus.getInstance().publishEvent(new CFNativeCallbackEventBus.CFPaymentCallbackEvent(CFNativeCallbackEvents.onVerify, orderId, null));
                    }
                });
            }
        }
    }

    private void sendError(final CFErrorResponse cfErrorResponse) {
        final String orderId;
        finish();
        if (!this.isResponseSent) {
            this.isResponseSent = true;
            if (!cfErrorResponse.getMessage().equals("payment method failed.") && (orderId = this.nativeCheckoutViewModel.getOrderId()) != null) {
                ThreadUtil.runOnUIThread(new Runnable() {
                    @Override
                    public final void run() {
                        CFNativeCallbackEventBus.getInstance().publishEvent(new CFNativeCallbackEventBus.CFPaymentCallbackEvent(CFNativeCallbackEvents.onFailure, orderId, cfErrorResponse));
                    }
                });
            }
        }
    }

    private void showEmiOptions(List<EmiOption> emiOptions, OrderDetails orderDetails) {
        hideEmiDialog();
        this.emiInfoDialog = new EmiInfoBottomSheetDialog(emiOptions, orderDetails, this.cfTheme, this);
        if (!isFinishing() && !isDestroyed()) {
            this.emiInfoDialog.show(getSupportFragmentManager(), EmiInfoBottomSheetDialog.TAG);
        }
    }

    private void showNBDialog(List<PaymentOption> paymentOptions, OrderDetails orderDetails) {
        hideNBDialog();
        this.nbAppsDialog = new NBAppsBottomSheetDialog(this, paymentOptions, orderDetails, this.cfTheme, this);
        if (!isFinishing() && !isDestroyed()) {
            this.nbAppsDialog.show();
        }
    }

    public void showQRCodeDialog(String base64Icon) {
        hideQRDialog();
        this.qrDialog = new QRDialog(this, base64Icon, this.cfTheme, this);
        if (!isFinishing() && !isDestroyed()) {
            this.qrDialog.show();
        }
    }

    @Override
    public void onPaymentFailure(CFErrorResponse cfException) {
        sendError(cfException);
    }

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

    void m147xaf868433() {
        if (!this.isResponseSent) {
            sendVerify(this.nativeCheckoutViewModel.getOrderId());
        }
    }

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

    void m146xfe1037e5() {
        if (!this.isResponseSent) {
            sendVerify(this.nativeCheckoutViewModel.getOrderId());
        }
    }

    @Override
    public void onOpen(PaymentMode paymentMode) {
        onOpenMode(paymentMode);
    }

    @Override
    public void onClose(PaymentMode paymentMode) {
        if (isPaymentModeOpen(this.upiView) || isPaymentModeOpen(this.netBankingView) || isPaymentModeOpen(this.walletView) || isPaymentModeOpen(this.payLaterView) || isPaymentModeOpen(this.cardView)) {
            return;
        }
        this.toolbarView.open();
    }

    private boolean isPaymentModeOpen(PaymentView paymentView) {
        return paymentView != null && paymentView.isOpen();
    }

    private void onOpenMode(PaymentMode paymentMode) {
        AnalyticsUtil.addEvent(UserEvents.cfevent_payment_mode_focus, new HashMap<String, String>(paymentMode) {
            final PaymentMode val$paymentMode;

            {
                this.val$paymentMode = paymentMode;
                put(AnalyticsConstants.PAYMENT_MODE, paymentMode.name());
            }
        });
        if (this.upiView != null && paymentMode != PaymentMode.UPI_INTENT && paymentMode != PaymentMode.UPI_COLLECT) {
            this.upiView.close();
        }
        if (this.netBankingView != null && paymentMode != PaymentMode.NET_BANKING) {
            this.netBankingView.close();
        }
        if (this.walletView != null && paymentMode != PaymentMode.WALLET) {
            this.walletView.close();
        }
        if (this.payLaterView != null && paymentMode != PaymentMode.PAY_LATER) {
            this.payLaterView.close();
        }
        if (this.cardView != null && paymentMode != PaymentMode.CARD) {
            this.cardView.close();
        }
        this.toolbarView.close();
    }

    @Override
    public void onUPIPayClick(PaymentInitiationData paymentInitiationData) {
        this.nativeCheckoutViewModel.createUPIPayment(paymentInitiationData);
    }

    @Override
    public void onShowMoreUPIClick(ArrayList<CFUPIApp> upiAppList, OrderDetails orderDetails) {
        showUPIDialog(upiAppList, orderDetails);
    }

    @Override
    public void onShowMoreNBClick(List<PaymentOption> nbList, OrderDetails orderDetails) {
        showNBDialog(nbList, orderDetails);
    }

    @Override
    public void onNBPayClick(PaymentInitiationData paymentInitiationData) {
        this.nativeCheckoutViewModel.createNBPayment(paymentInitiationData);
    }

    @Override
    public void onPVVerified(String orderId) {
        sendVerify(orderId);
    }

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

    @Override
    public void onPVCancelled() {
    }

    @Override
    public void onWalletPayClick(PaymentInitiationData paymentInitiationData) {
        this.nativeCheckoutViewModel.createWalletPayment(paymentInitiationData);
    }

    @Override
    public void onPayLaterPayClick(PaymentInitiationData paymentInitiationData) {
        this.nativeCheckoutViewModel.createPayLaterPayment(paymentInitiationData);
    }

    @Override
    public void onCardPayClick(String name, String number, String expiryMM, String expiryYY, String cvv, boolean shouldSaveCard) {
        this.nativeCheckoutViewModel.createCardPayment(name, number, expiryMM, expiryYY, cvv, shouldSaveCard);
    }

    @Override
    public void onEmiOptionClicked(List<EmiOption> emiOptions, OrderDetails orderDetails) {
        showEmiOptions(emiOptions, orderDetails);
    }

    @Override
    public void onEmiDialogDismiss() {
        this.emiInfoDialog = null;
    }

    @Override
    public void onEmiPayClick(EMIView.EMIPaymentObject emiPaymentInfo) {
        hideEmiDialog();
        this.nativeCheckoutViewModel.createCardEMIPayment(emiPaymentInfo);
    }

    @Override
    public void onBackPressed() {
        this.exitDialog = new ExitDialog(this, this.cfTheme, new Action() {
            @Override
            public final void onAction() {
                CashfreeNativeCheckoutActivity.this.m142x694fdba4();
            }
        });
        if (!isFinishing() && !isDestroyed()) {
            this.exitDialog.show();
        }
    }

    void m142x694fdba4() {
        AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_close, new HashMap<String, String>() {
            {
                put(AnalyticsConstants.CHANNEL, "back_clicked");
                put("platform", Constants.PLATFORM);
            }
        });
        sendError(CFUtil.getResponseFromError(CFUtil.getCancelledResponse()));
    }

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

    void m144x75120820(QuickCheckout quickCheckout, OrderDetails orderDetails) {
        if (quickCheckout != null && quickCheckout.getQuickPaymentModes().size() > 0) {
            showQuickCheckoutDialog(quickCheckout, orderDetails);
        }
    }

    @Override
    public void onSelect(PaymentInitiationData paymentInitiationData) {
        this.nativeCheckoutViewModel.createQuickCheckoutPayment(paymentInitiationData);
    }

    @Override
    public void onSavedCardsFetchSuccess(final SavedCardsResponse configResponse) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                CashfreeNativeCheckoutActivity.this.m148xc3e7a2d3(configResponse);
            }
        });
    }

    void m148xc3e7a2d3(SavedCardsResponse configResponse) {
        if (this.savedCardView == null) {
            this.savedCardView = new SavedCardView(this.llContentScrolling, configResponse.getSavedCards(), this, this.cfTheme);
        }
    }

    @Override
    public void onSavedCardsFetchFailure(CFErrorResponse cfErrorResponse) {
    }

    @Override
    public void onSavedCardPayNowClick(SavedCardsResponse.SavedCards savedCard, String cvv) {
        this.nativeCheckoutViewModel.createSavedCardPayment(savedCard.getInstrumentID(), cvv);
    }

    @Override
    public void onSavedCardDeleteClick(SavedCardsResponse.SavedCards savedCard) {
        hideSavedCardDeleteDialog();
        SavedCardDeleteBottomSheetDialog savedCardDeleteBottomSheetDialog = new SavedCardDeleteBottomSheetDialog(this, this.cfTheme, savedCard, this);
        this.savedCardDeleteDialog = savedCardDeleteBottomSheetDialog;
        savedCardDeleteBottomSheetDialog.show();
    }

    class AnonymousClass19 implements NativeCheckoutDAO.DeleteSavedCardResponseListener {
        final String val$instrumentID;

        AnonymousClass19(String str) {
            this.val$instrumentID = str;
        }

        @Override
        public void onSavedCardDeleteSuccess(DeleteSavedCardResponse deleteResponse) {
            CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity = CashfreeNativeCheckoutActivity.this;
            final String str = this.val$instrumentID;
            cashfreeNativeCheckoutActivity.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    CashfreeNativeCheckoutActivity.AnonymousClass19.this.m153x6a6095b3(str);
                }
            });
        }

        void m153x6a6095b3(String instrumentID) {
            CashfreeNativeCheckoutActivity.this.savedCardDeleteDialog.dismiss();
            CashfreeNativeCheckoutActivity.this.savedCardView.updateSavedCardViewAfterDelete(instrumentID);
        }

        @Override
        public void onSavedCardDeleteFailure(CFErrorResponse cfErrorResponse) {
            CashfreeNativeCheckoutActivity.this.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    CashfreeNativeCheckoutActivity.AnonymousClass19.this.m152x6ba646eb();
                }
            });
        }

        void m152x6ba646eb() {
            CashfreeNativeCheckoutActivity.this.savedCardDeleteDialog.dismiss();
        }
    }

    @Override
    public void onSavedCardDeleteConfirmClick(SavedCardsResponse.SavedCards savedCard) {
        String instrumentID = savedCard.getInstrumentID();
        this.nativeCheckoutViewModel.deleteSavedCard(instrumentID, new AnonymousClass19(instrumentID));
    }
}