Luno v7.28.0版本的 MD5 值为:08d81b3b88ef7df48c89cb5d56dc11a2

以下内容为反编译后的 lr3.java 源代码,内容仅作参考


package mdi.sdk;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModelProvider;
import co.bitx.android.walleu.R;
import co.bitx.android.walleu.app.modules.transact.TransactRequest;
import co.bitx.android.walleu.app.modules.transact.TransactType;
import co.bitx.android.walleu.model.wire.creditcards.CreateCreditCardRequest;
import co.bitx.android.walleu.model.wire.creditcards.CreateCreditCardResponse;
import co.bitx.android.walleu.model.wire.creditcards.CreditCard;
import co.bitx.android.walleu.model.wire.creditcards.DeleteCreditCardResponse;
import co.bitx.android.walleu.model.wire.creditcards.ProviderType;
import co.bitx.android.walleu.model.wire.help.ScreenHelp;
import co.bitx.android.walleu.model.wire.walletinfo.AccountInfo;
import co.bitx.android.walleu.model.wire.walletinfo.Action;
import co.bitx.android.walleu.model.wire.walletinfo.Currency;
import co.bitx.android.walleu.model.wire.walletinfo.CurrencyInfo;
import co.bitx.android.walleu.model.wire.walletinfo.Dialog;
import co.bitx.android.walleu.model.wire.walletinfo.DialogAction;
import co.bitx.android.walleu.model.wire.walletinfo.Event;
import co.bitx.android.walleu.model.wire.walletinfo.FundingInfo;
import co.bitx.android.walleu.model.wire.walletinfo.ListAction;
import co.bitx.android.walleu.model.wire.walletinfo.ListItem;
import co.bitx.android.walleu.model.wire.walletinfo.LockInfo;
import co.bitx.android.walleu.model.wire.walletinfo.Provider;
import co.bitx.android.walleu.model.wire.walletinfo.TransferOption;
import co.bitx.android.walleu.model.wire.walletinfo.TransferOptions;
import co.bitx.android.walleu.model.wire.walletinfo.UserInfo;
import co.bitx.android.walleu.model.wire.walletinfo.WalletInfo;
import co.bitx.android.walleu.model.wire.walletinfo.WebView;
import com.facebook.appevents.AppEventsConstants;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import mdi.sdk.f7;
import mdi.sdk.ir3;
import mdi.sdk.nf4;
import mdi.sdk.y95;
import mdi.sdk.zq5;

public final class lr3 extends ah {
    private List<TransferOption> d;
    private final TransactRequest e;
    private final ti4 f;
    private final gf4 g;
    private final s06 h;
    private final ni5 i;
    private final ir3 j;
    private final f7 k;
    private final MutableLiveData<ScreenHelp.ScreenID> l;
    private final MutableLiveData<List<zq5>> m;
    private Long v;
    private WalletInfo w;
    private final zf3<WalletInfo> x;

    public static final class a {
        private a() {
        }

        public a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    public static final class b implements ViewModelProvider.Factory {
        private final List<TransferOption> a;
        private final TransactRequest b;
        private final ti4 c;
        private final gf4 d;
        private final s06 e;
        private final ni5 f;
        private final ir3 g;
        private final f7 h;

        public b(List<TransferOption> list, TransactRequest transactRequest, ti4 ti4Var, gf4 gf4Var, s06 s06Var, ni5 ni5Var, ir3 ir3Var, f7 f7Var) {
            w32.h(list, "transferOptions");
            w32.h(ti4Var, "router");
            w32.h(gf4Var, "resourceResolver");
            w32.h(s06Var, "walletInfoRepository");
            w32.h(ni5Var, "transactClient");
            w32.h(ir3Var, "paymentMethodsSelector");
            w32.h(f7Var, "analyticsService");
            this.a = list;
            this.b = transactRequest;
            this.c = ti4Var;
            this.d = gf4Var;
            this.e = s06Var;
            this.f = ni5Var;
            this.g = ir3Var;
            this.h = f7Var;
        }

        @Override
        public <T extends androidx.lifecycle.s> T create(Class<T> cls) {
            List R0;
            w32.h(cls, "modelClass");
            R0 = py.R0(this.a);
            return new lr3(R0, this.b, this.c, this.d, this.e, this.f, this.g, this.h);
        }
    }

    public interface c {
        b a(List<TransferOption> list, TransactRequest transactRequest);
    }

    @kotlin.coroutines.jvm.internal.c(c = "co.bitx.android.walleu.app.modules.transact.deposibuy.PaymentMethodsViewModel$addCreditCard$1", f = "PaymentMethodsViewModel.kt", l = {175, 182}, m = "invokeSuspend")
    static final class d extends c85 implements ac1<n50, n40<? super Unit>, Object> {
        Object a;
        Object b;
        int c;
        final String d;
        final lr3 e;
        final String f;

        d(String str, lr3 lr3Var, String str2, n40<? super d> n40Var) {
            super(2, n40Var);
            this.d = str;
            this.e = lr3Var;
            this.f = str2;
        }

        @Override
        public final n40<Unit> create(Object obj, n40<?> n40Var) {
            return new d(this.d, this.e, this.f, n40Var);
        }

        @Override
        public final Object invoke(n50 n50Var, n40<? super Unit> n40Var) {
            return ((d) create(n50Var, n40Var)).invokeSuspend(Unit.a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object d;
            Integer m;
            lr3 lr3Var;
            lr3 lr3Var2;
            lr3 lr3Var3;
            d = z32.d();
            int i = this.c;
            if (i == 0) {
                pf4.b(obj);
                String str = this.d;
                if (str == null || str.length() == 0) {
                    this.e.h1();
                    return Unit.a;
                }
                String str2 = this.f;
                int intValue = (str2 == null || m == null) ? 0 : m.intValue();
                ProviderType fromValue = ProviderType.Companion.fromValue(intValue);
                if (fromValue == null) {
                    fromValue = ProviderType.UNKNOWN_PROVIDER;
                }
                ProviderType providerType = fromValue;
                lr3Var = this.e;
                String str3 = this.d;
                lr3Var.s0(true);
                ni5 ni5Var = lr3Var.i;
                CreateCreditCardRequest createCreditCardRequest = new CreateCreditCardRequest(str3, null, providerType, null, 10, null);
                this.a = lr3Var;
                this.b = lr3Var;
                this.c = 1;
                obj = ni5Var.Z(createCreditCardRequest, this);
                if (obj == d) {
                    return d;
                }
                lr3Var2 = lr3Var;
            } else {
                if (i != 1) {
                    if (i == 2) {
                        ?? r0 = (ah) this.a;
                        pf4.b(obj);
                        lr3Var3 = r0;
                        lr3Var = lr3Var3;
                        lr3Var.s0(false);
                        return Unit.a;
                    }
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                lr3 lr3Var4 = (lr3) this.b;
                ?? r4 = (ah) this.a;
                pf4.b(obj);
                lr3Var2 = lr3Var4;
                lr3Var = r4;
            }
            nf4 nf4Var = (nf4) obj;
            if (nf4Var instanceof nf4.b) {
                lr3Var2.q0(((nf4.b) nf4Var).c());
            }
            if (nf4Var instanceof nf4.c) {
                CreateCreditCardResponse createCreditCardResponse = (CreateCreditCardResponse) ((nf4.c) nf4Var).c();
                this.a = lr3Var;
                this.b = nf4Var;
                this.c = 2;
                if (lr3Var2.i1(createCreditCardResponse, this) == d) {
                    return d;
                }
                lr3Var3 = lr3Var;
                lr3Var = lr3Var3;
            }
            lr3Var.s0(false);
            return Unit.a;
        }
    }

    @kotlin.coroutines.jvm.internal.c(c = "co.bitx.android.walleu.app.modules.transact.deposibuy.PaymentMethodsViewModel$deleteCreditCard$1", f = "PaymentMethodsViewModel.kt", l = {462, 465}, m = "invokeSuspend")
    public static final class e extends c85 implements ac1<n50, n40<? super Unit>, Object> {
        Object a;
        Object b;
        Object c;
        Object d;
        int e;
        final long g;
        final TransferOption h;

        e(long j, TransferOption transferOption, n40<? super e> n40Var) {
            super(2, n40Var);
            this.g = j;
            this.h = transferOption;
        }

        @Override
        public final n40<Unit> create(Object obj, n40<?> n40Var) {
            return new e(this.g, this.h, n40Var);
        }

        @Override
        public final Object invoke(n50 n50Var, n40<? super Unit> n40Var) {
            return ((e) create(n50Var, n40Var)).invokeSuspend(Unit.a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object d;
            lr3 lr3Var;
            TransferOption transferOption;
            DeleteCreditCardResponse deleteCreditCardResponse;
            nf4 nf4Var;
            d = z32.d();
            int i = this.e;
            if (i == 0) {
                pf4.b(obj);
                lr3.this.s0(true);
                ni5 ni5Var = lr3.this.i;
                long j = this.g;
                this.e = 1;
                obj = ni5Var.h1(j, this);
                if (obj == d) {
                    return d;
                }
            } else {
                if (i != 1) {
                    if (i != 2) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    deleteCreditCardResponse = (DeleteCreditCardResponse) this.d;
                    transferOption = (TransferOption) this.b;
                    lr3Var = (lr3) this.a;
                    pf4.b(obj);
                    nf4Var = (nf4) obj;
                    lr3Var.s0(false);
                    if (nf4Var instanceof nf4.b) {
                        ((nf4.b) nf4Var).c();
                        lr3Var.d.remove(transferOption);
                        lr3Var.W0(lr3Var.d, deleteCreditCardResponse.can_add_credit_cards);
                    }
                    return Unit.a;
                }
                pf4.b(obj);
            }
            nf4 nf4Var2 = (nf4) obj;
            lr3 lr3Var2 = lr3.this;
            if (nf4Var2 instanceof nf4.b) {
                lr3Var2.q0(((nf4.b) nf4Var2).c());
            }
            lr3 lr3Var3 = lr3.this;
            TransferOption transferOption2 = this.h;
            if (nf4Var2 instanceof nf4.c) {
                DeleteCreditCardResponse deleteCreditCardResponse2 = (DeleteCreditCardResponse) ((nf4.c) nf4Var2).c();
                s06 s06Var = lr3Var3.h;
                this.a = lr3Var3;
                this.b = transferOption2;
                this.c = nf4Var2;
                this.d = deleteCreditCardResponse2;
                this.e = 2;
                obj = s06Var.d(true, this);
                if (obj == d) {
                    return d;
                }
                lr3Var = lr3Var3;
                transferOption = transferOption2;
                deleteCreditCardResponse = deleteCreditCardResponse2;
                nf4Var = (nf4) obj;
                lr3Var.s0(false);
                if (nf4Var instanceof nf4.b) {
                }
            }
            return Unit.a;
        }
    }

    @kotlin.coroutines.jvm.internal.c(c = "co.bitx.android.walleu.app.modules.transact.deposibuy.PaymentMethodsViewModel$onPaymentMethodClickInternal$1", f = "PaymentMethodsViewModel.kt", l = {}, m = "invokeSuspend")
    public static final class f extends c85 implements ac1<n50, n40<? super Unit>, Object> {
        int a;
        final TransferOption c;

        f(TransferOption transferOption, n40<? super f> n40Var) {
            super(2, n40Var);
            this.c = transferOption;
        }

        @Override
        public final n40<Unit> create(Object obj, n40<?> n40Var) {
            return new f(this.c, n40Var);
        }

        @Override
        public final Object invoke(n50 n50Var, n40<? super Unit> n40Var) {
            return ((f) create(n50Var, n40Var)).invokeSuspend(Unit.a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Double d;
            boolean z;
            Iterator<T> it;
            UserInfo userInfo;
            z32.d();
            if (this.a != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            pf4.b(obj);
            lr3.this.Y0(this.c);
            if (this.c.credit_card != null) {
                WalletInfo walletInfo = lr3.this.w;
                if ((walletInfo == null || (userInfo = walletInfo.user_info) == null || !lr3.this.X0(userInfo, LockInfo.LockAction.DEPOSIT)) ? false : true) {
                    lr3 lr3Var = lr3.this;
                    lr3Var.l0(new bx4(lr3Var.N0()));
                    return Unit.a;
                }
            }
            WalletInfo walletInfo2 = lr3.this.w;
            if (walletInfo2 == null) {
                return Unit.a;
            }
            TransactRequest transactRequest = lr3.this.e;
            double D = transactRequest == null ? 0.0d : transactRequest.D();
            TransactRequest transactRequest2 = lr3.this.e;
            Object obj2 = null;
            boolean z2 = (transactRequest2 == null ? null : transactRequest2.f0()) == TransactType.REPEAT_BUY_V2;
            boolean l = r06.l(walletInfo2, "repeat_transfer_card", null, 2, null);
            TransactRequest.a b = new TransactRequest.a(lr3.this.e).b(this.c.currency, D);
            lr3 lr3Var2 = lr3.this;
            TransferOption transferOption = this.c;
            TransactRequest transactRequest3 = lr3Var2.e;
            if (!(transactRequest3 != null && transactRequest3.t0())) {
                TransactRequest transactRequest4 = lr3Var2.e;
                if ((transactRequest4 == null ? null : transactRequest4.f0()) != TransactType.TRANSFER_IN) {
                    b.m(transferOption);
                    TransactRequest a = b.a();
                    WalletInfo walletInfo3 = lr3.this.w;
                    z = (walletInfo3 == null || (d = r06.d(walletInfo3, a.I(), this.c)) == null || d.doubleValue() <= 0.0d) ? false : true;
                    it = this.c.actions.iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            break;
                        }
                        Object next = it.next();
                        if (((ListAction) next).type == ListAction.Type.TOP_UP) {
                            obj2 = next;
                            break;
                        }
                    }
                    ListAction listAction = (ListAction) obj2;
                    if (!z2 && l) {
                        lr3.this.f.e(new q60(a));
                    } else if (z) {
                        if (D <= 0.0d) {
                            lr3.this.f.e(new xh5(a));
                        } else if (vs0.a.a(walletInfo2)) {
                            lr3.this.f.e(new xh5(a));
                        } else {
                            lr3.this.f.e(new pi5(a));
                        }
                    } else if (listAction != null) {
                        lr3.this.g1(this.c, listAction);
                    } else {
                        qs a2 = ok2.a(lr3.this.g, lr3.this.w, true, a.Z(), a.f0());
                        if (a2.c() == null) {
                            lr3.this.f.e(new xh5(a));
                        } else {
                            lr3.this.f.e(new hs(a2.c(), a2.d()));
                        }
                    }
                    return Unit.a;
                }
            }
            b.l(transferOption);
            TransactRequest a3 = b.a();
            WalletInfo walletInfo32 = lr3.this.w;
            if (walletInfo32 == null) {
                it = this.c.actions.iterator();
                while (true) {
                    if (!it.hasNext()) {
                    }
                }
                ListAction listAction2 = (ListAction) obj2;
                if (!z2) {
                }
                if (z) {
                }
                return Unit.a;
            }
            it = this.c.actions.iterator();
            while (true) {
                if (!it.hasNext()) {
                }
            }
            ListAction listAction22 = (ListAction) obj2;
            if (!z2) {
            }
            if (z) {
            }
            return Unit.a;
        }
    }

    @kotlin.coroutines.jvm.internal.c(c = "co.bitx.android.walleu.app.modules.transact.deposibuy.PaymentMethodsViewModel", f = "PaymentMethodsViewModel.kt", l = {496}, m = "updatePaymentMethodsAndNavigate")
    public static final class g extends kotlin.coroutines.jvm.internal.b {
        Object a;
        Object b;
        Object c;
        int e;

        g(n40<? super g> n40Var) {
            super(n40Var);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            this.c = obj;
            this.e |= Integer.MIN_VALUE;
            return lr3.this.i1(null, this);
        }
    }

    static {
        new a(null);
    }

    public lr3(List<TransferOption> list, TransactRequest transactRequest, ti4 ti4Var, gf4 gf4Var, s06 s06Var, ni5 ni5Var, ir3 ir3Var, f7 f7Var) {
        w32.h(list, "transferOptions");
        w32.h(ti4Var, "router");
        w32.h(gf4Var, "resourceResolver");
        w32.h(s06Var, "walletInfoRepository");
        w32.h(ni5Var, "transactClient");
        w32.h(ir3Var, "paymentMethodsSelector");
        w32.h(f7Var, "analyticsService");
        this.d = list;
        this.e = transactRequest;
        this.f = ti4Var;
        this.g = gf4Var;
        this.h = s06Var;
        this.i = ni5Var;
        this.j = ir3Var;
        this.k = f7Var;
        this.l = new MutableLiveData<>();
        this.m = new MutableLiveData<>();
        zf3<WalletInfo> zf3Var = new zf3() {
            @Override
            public final void onChanged(Object obj) {
                lr3.j1(lr3.this, (WalletInfo) obj);
            }
        };
        this.x = zf3Var;
        s06Var.h().observeForever(zf3Var);
    }

    public final Dialog N0() {
        Map m;
        Map m2;
        String string = this.g.getString(R.string.kyc_lock_dialog_title);
        String e2 = this.g.e(R.string.kyc_lock_dialog_body, U0());
        String string2 = this.g.getString(R.string.kyc_lock_dialog_primary);
        m = my2.m(gn5.a("name", "Increase buy limit"), gn5.a("product_group", "Payments"), gn5.a("value", AppEventsConstants.EVENT_PARAM_VALUE_YES));
        DialogAction dialogAction = new DialogAction(string2, "https://www.luno.com/wallet/settings/identity", new Event("button_click", m, null, 4, null), null, null, 24, null);
        String string3 = this.g.getString(R.string.kyc_lock_dialog_secondary);
        m2 = my2.m(gn5.a("name", "Increase buy limit"), gn5.a("product_group", "Payments"), gn5.a("value", "0"));
        return new Dialog(null, string, null, null, dialogAction, new DialogAction(string3, null, new Event("button_click", m2, null, 4, null), null, null, 26, null), null, null, null, e2, "Dialog: Card Buy Limit", null, 2509, null);
    }

    private final TransferOption O0(WalletInfo walletInfo, TransferOption transferOption) {
        TransferOption.Builder newBuilder = transferOption.newBuilder();
        TransactRequest transactRequest = this.e;
        return newBuilder.extra(em5.b(transferOption, walletInfo, transactRequest == null ? null : transactRequest.f0(), this.g)).build();
    }

    private final void P0(TransferOption transferOption, long j) {
        ah.o0(this, null, new e(j, transferOption, null), 1, null);
    }

    private final y95 R0(WalletInfo walletInfo) {
        CurrencyInfo currencyInfo;
        Map<String, Currency> map;
        TransactRequest transactRequest = this.e;
        if (transactRequest != null && transactRequest.G0()) {
            if (this.e.f0() == TransactType.TRANSFER_IN) {
                return new y95.b(R.string.payment_methods_screen_transfer_in_title, new Object[0]);
            }
            return new y95.b(R.string.payment_methods_screen_transfer_out_title, new Object[0]);
        }
        TransactRequest transactRequest2 = this.e;
        if (transactRequest2 != null && transactRequest2.t0()) {
            String str = null;
            if (walletInfo != null && (currencyInfo = walletInfo.currency_info) != null && (map = currencyInfo.currencies) != null) {
                TransferOption e0 = this.e.e0();
                Currency currency = map.get(e0 == null ? null : e0.currency);
                if (currency != null) {
                    str = currency.display_name;
                }
            }
            if (str == null || str.length() == 0) {
                return new y95.b(R.string.payment_methods_screen_buy_title, new Object[0]);
            }
            return new y95.b(R.string.payment_methods_screen_buy_currency_title, str);
        }
        return new y95.b(R.string.payment_methods_screen_sell_title, new Object[0]);
    }

    private final String U0() {
        UserInfo userInfo;
        List<AccountInfo> list;
        WalletInfo walletInfo = this.w;
        String str = (walletInfo == null || (userInfo = walletInfo.user_info) == null) ? null : userInfo.preferred_fiat_currency;
        if (str == null) {
            str = "";
        }
        if (walletInfo != null && (list = walletInfo.accounts) != null) {
            for (AccountInfo accountInfo : list) {
                Currency currency = accountInfo.account_currency;
                if (w32.d(currency == null ? null : currency.display_code, str)) {
                    return accountInfo.name;
                }
            }
        }
        return "";
    }

    private final void V0(WalletInfo walletInfo) {
        ScreenHelp.ScreenID screenID;
        MutableLiveData<ScreenHelp.ScreenID> mutableLiveData = this.l;
        TransactRequest transactRequest = this.e;
        boolean z = false;
        if (transactRequest != null && transactRequest.t0()) {
            if (vs0.a.b(walletInfo)) {
                screenID = ScreenHelp.ScreenID.BUY;
            } else {
                screenID = ScreenHelp.ScreenID.BUY_SELECT_SOURCE;
            }
        } else {
            TransactRequest transactRequest2 = this.e;
            if (transactRequest2 != null && transactRequest2.D0()) {
                z = true;
            }
            screenID = z ? ScreenHelp.ScreenID.SELL_SELECT_TARGET : ScreenHelp.ScreenID.UNKNOWN;
        }
        mutableLiveData.setValue(screenID);
    }

    public final void W0(List<TransferOption> list, boolean z) {
        int u;
        int u2;
        WalletInfo walletInfo = this.w;
        if (walletInfo == null) {
            return;
        }
        ArrayList arrayList = new ArrayList();
        arrayList.add(new zq5.e(R0(this.w)));
        u = iy.u(list, 10);
        ArrayList<TransferOption> arrayList2 = new ArrayList(u);
        Iterator<T> it = list.iterator();
        while (it.hasNext()) {
            arrayList2.add(O0(walletInfo, (TransferOption) it.next()));
        }
        u2 = iy.u(arrayList2, 10);
        ArrayList arrayList3 = new ArrayList(u2);
        for (TransferOption transferOption : arrayList2) {
            List<ListAction> list2 = transferOption.actions;
            boolean z2 = false;
            boolean z3 = !(list2 == null || list2.isEmpty());
            CreditCard creditCard = transferOption.credit_card;
            if (creditCard != null) {
                if (w32.d(creditCard == null ? null : Long.valueOf(creditCard.id), S0())) {
                    z2 = true;
                }
            }
            arrayList3.add(new zq5.b(transferOption, z3, z2));
        }
        arrayList.addAll(arrayList3);
        if (z) {
            arrayList.add(zq5.a.a);
        }
        this.m.setValue(arrayList);
    }

    public final boolean X0(UserInfo userInfo, LockInfo.LockAction lockAction) {
        List<LockInfo.LockAction> list;
        LockInfo lockInfo = userInfo.lock_info;
        if (lockInfo == null || (list = lockInfo.locked_actions) == null) {
            return false;
        }
        return list.contains(lockAction);
    }

    public final void Y0(TransferOption transferOption) {
        Map m;
        String j;
        Map m2;
        Map m3;
        TransactRequest transactRequest = this.e;
        if (transactRequest != null && transactRequest.t0()) {
            boolean z = (transferOption.credit_card == null && transferOption.provider == null) ? false : true;
            String str = z ? "Existing" : "None";
            String str2 = z ? "Card" : "Wallet";
            f7 f7Var = this.k;
            Pair[] pairArr = new Pair[6];
            pairArr[0] = gn5.a("name", "Select payment method");
            pairArr[1] = gn5.a("product_group", "Payments");
            pairArr[2] = gn5.a("payment_method", str2);
            pairArr[3] = gn5.a("payment_card_status", str);
            pairArr[4] = gn5.a("source_currency", transferOption.currency);
            Provider provider = transferOption.provider;
            j = provider != null ? provider.name : null;
            if (j == null) {
                j = transferOption.label;
            }
            pairArr[5] = gn5.a("provider_name", j);
            m3 = my2.m(pairArr);
            f7.a.c(f7Var, "list_item_click", m3, false, 4, null);
            return;
        }
        TransactRequest transactRequest2 = this.e;
        if (transactRequest2 != null && transactRequest2.G0()) {
            f7 f7Var2 = this.k;
            Pair[] pairArr2 = new Pair[3];
            pairArr2[0] = gn5.a("name", "Select wallet");
            WalletInfo walletInfo = this.w;
            j = walletInfo != null ? r06.j(walletInfo, transferOption.currency) : null;
            if (j == null) {
                j = "";
            }
            pairArr2[1] = gn5.a(FirebaseAnalytics.Param.CURRENCY, j);
            pairArr2[2] = gn5.a("product_group", "Wallet");
            m2 = my2.m(pairArr2);
            f7.a.c(f7Var2, "list_item_click", m2, false, 4, null);
            return;
        }
        f7 f7Var3 = this.k;
        m = my2.m(gn5.a("product_group", "Payments"), gn5.a("name", "Buy"), gn5.a("target_currency", transferOption.currency));
        f7.a.c(f7Var3, "list_item_click", m, false, 4, null);
    }

    private final void Z0() {
        FundingInfo fundingInfo;
        List<Action> list;
        Map m;
        Dialog dialog;
        FundingInfo fundingInfo2;
        WalletInfo walletInfo = this.w;
        ListItem listItem = (walletInfo == null || (fundingInfo = walletInfo.funding_info) == null) ? null : fundingInfo.add_card_item;
        if (listItem != null && (dialog = listItem.dialog) != null) {
            if ((walletInfo == null || (fundingInfo2 = walletInfo.funding_info) == null || fundingInfo2.can_add_cards) ? false : true) {
                l0(new nv4(dialog));
                return;
            }
        }
        Action action = (listItem == null || (list = listItem.actions) == null) ? null : (Action) fy.d0(list);
        f7 f7Var = this.k;
        Event event = action == null ? null : action.event;
        if (event == null) {
            m = my2.m(gn5.a("name", "Select payment method"), gn5.a("product_group", "Payments"), gn5.a("payment_method", "Card"), gn5.a("payment_card_status", "New"), gn5.a("source_currency", "Unknown"));
            event = new Event("list_item_click", m, null, 4, null);
        }
        f7.a.a(f7Var, event, false, 2, null);
        if (Action.Type.WEBVIEW == (action != null ? action.type : null)) {
            this.f.e(new cl5(true, new WebView(action.url, null, null, null, 14, null), true, false));
        } else {
            this.f.e(new r6(this.e));
        }
    }

    private final void a1(TransferOption transferOption) {
        ah.o0(this, null, new f(transferOption, null), 1, null);
    }

    public final void g1(TransferOption transferOption, ListAction listAction) {
        l0(new dx4(transferOption, listAction));
    }

    public final void h1() {
        q0(new Throwable(this.g.getString(R.string.all_error_general)));
    }

    public final Object i1(CreateCreditCardResponse createCreditCardResponse, n40<? super Unit> n40Var) {
        g gVar;
        Object d2;
        int i;
        lr3 lr3Var;
        nf4 nf4Var;
        CreditCard creditCard;
        if (n40Var instanceof g) {
            gVar = (g) n40Var;
            int i2 = gVar.e;
            if ((i2 & Integer.MIN_VALUE) != 0) {
                gVar.e = i2 - Integer.MIN_VALUE;
                Object obj = gVar.c;
                d2 = z32.d();
                i = gVar.e;
                if (i != 0) {
                    pf4.b(obj);
                    s06 s06Var = this.h;
                    gVar.a = this;
                    gVar.b = createCreditCardResponse;
                    gVar.e = 1;
                    obj = s06Var.d(true, gVar);
                    if (obj == d2) {
                        return d2;
                    }
                    lr3Var = this;
                } else {
                    if (i != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    createCreditCardResponse = (CreateCreditCardResponse) gVar.b;
                    lr3Var = (lr3) gVar.a;
                    pf4.b(obj);
                }
                nf4Var = (nf4) obj;
                creditCard = createCreditCardResponse.credit_card;
                if (!nf4Var.b() && creditCard != null) {
                    return Unit.a;
                }
                if (creditCard != null) {
                    lr3Var.h1();
                    return Unit.a;
                }
                TransferOptions transferOptions = ((WalletInfo) nf4Var.a()).transfer_options;
                TransferOption transferOption = null;
                List<TransferOption> list = transferOptions == null ? null : transferOptions.sources;
                if (list != null) {
                    Iterator<T> it = list.iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            break;
                        }
                        Object next = it.next();
                        CreditCard creditCard2 = ((TransferOption) next).credit_card;
                        boolean z = false;
                        if (creditCard2 != null && creditCard2.id == creditCard.id) {
                            z = true;
                        }
                        if (z) {
                            transferOption = next;
                            break;
                        }
                    }
                    transferOption = transferOption;
                }
                if (transferOption == null) {
                    lr3Var.h1();
                    return Unit.a;
                }
                TransactRequest a2 = new TransactRequest.a(lr3Var.e).l(transferOption).a();
                if (a2.D() > 0.0d) {
                    lr3Var.f.e(new pi5(a2));
                } else {
                    lr3Var.f.e(new xh5(a2));
                }
                return Unit.a;
            }
        }
        gVar = new g(n40Var);
        Object obj2 = gVar.c;
        d2 = z32.d();
        i = gVar.e;
        if (i != 0) {
        }
        nf4Var = (nf4) obj2;
        creditCard = createCreditCardResponse.credit_card;
        if (!nf4Var.b()) {
        }
        if (creditCard != null) {
        }
    }

    public static final void j1(lr3 lr3Var, WalletInfo walletInfo) {
        Long W;
        String str;
        TransactType f0;
        TransactRequest transactRequest;
        ArrayList arrayList;
        int u;
        Iterator<T> it;
        int u2;
        TransferOption e0;
        w32.h(lr3Var, "this$0");
        lr3Var.w = walletInfo;
        ir3 ir3Var = lr3Var.j;
        w32.g(walletInfo, "it");
        TransactRequest transactRequest2 = lr3Var.e;
        boolean a2 = ir3Var.a(walletInfo, transactRequest2 == null ? null : transactRequest2.f0());
        if (lr3Var.m.getValue() == null && (!lr3Var.d.isEmpty())) {
            lr3Var.W0(lr3Var.d, a2);
        } else {
            ir3 ir3Var2 = lr3Var.j;
            TransactRequest transactRequest3 = lr3Var.e;
            long longValue = (transactRequest3 == null || (W = transactRequest3.W()) == null) ? 0L : W.longValue();
            TransactRequest transactRequest4 = lr3Var.e;
            String Z = transactRequest4 == null ? null : transactRequest4.Z();
            if (Z == null) {
                TransactRequest transactRequest5 = lr3Var.e;
                if (transactRequest5 == null || (e0 = transactRequest5.e0()) == null) {
                    str = null;
                    TransactRequest transactRequest6 = lr3Var.e;
                    f0 = transactRequest6 != null ? null : transactRequest6.f0();
                    if (f0 == null) {
                        f0 = TransactType.UNKNOWN;
                    }
                    ir3.c b2 = ir3Var2.b(walletInfo, new ir3.b(str, longValue, f0, a2));
                    transactRequest = lr3Var.e;
                    if (!(transactRequest == null && transactRequest.t0())) {
                        TransactRequest transactRequest7 = lr3Var.e;
                        if ((transactRequest7 != null ? transactRequest7.f0() : null) != TransactType.TRANSFER_IN) {
                            List<ir3.a.b> c2 = b2.c();
                            u2 = iy.u(c2, 10);
                            arrayList = new ArrayList(u2);
                            Iterator<T> it2 = c2.iterator();
                            while (it2.hasNext()) {
                                arrayList.add(((ir3.a.b) it2.next()).a());
                            }
                            lr3Var.W0(arrayList, a2);
                        }
                    }
                    List<ir3.a.b> b3 = b2.b();
                    u = iy.u(b3, 10);
                    arrayList = new ArrayList(u);
                    it = b3.iterator();
                    while (it.hasNext()) {
                        arrayList.add(((ir3.a.b) it.next()).a());
                    }
                    lr3Var.W0(arrayList, a2);
                } else {
                    Z = e0.currency;
                }
            }
            str = Z;
            TransactRequest transactRequest62 = lr3Var.e;
            if (transactRequest62 != null) {
            }
            if (f0 == null) {
            }
            ir3.c b22 = ir3Var2.b(walletInfo, new ir3.b(str, longValue, f0, a2));
            transactRequest = lr3Var.e;
            if (!(transactRequest == null && transactRequest.t0())) {
            }
            List<ir3.a.b> b32 = b22.b();
            u = iy.u(b32, 10);
            arrayList = new ArrayList(u);
            it = b32.iterator();
            while (it.hasNext()) {
            }
            lr3Var.W0(arrayList, a2);
        }
        lr3Var.V0(walletInfo);
    }

    public final jd2 M0(String str, String str2) {
        return ah.o0(this, null, new d(str, this, str2, null), 1, null);
    }

    public final String Q0() {
        TransactRequest transactRequest = this.e;
        if ((transactRequest == null ? null : transactRequest.f0()) == TransactType.REPEAT_BUY_V2) {
            return "Repeat Buy: Source Currency";
        }
        TransactRequest transactRequest2 = this.e;
        if ((transactRequest2 == null ? null : transactRequest2.f0()) == TransactType.TRANSFER_IN) {
            return "Savings Transfer In: Select Wallet";
        }
        TransactRequest transactRequest3 = this.e;
        if ((transactRequest3 != null ? transactRequest3.f0() : null) == TransactType.TRANSFER_OUT) {
            return "Savings Transfer Out: Select Wallet";
        }
        TransactRequest transactRequest4 = this.e;
        boolean z = false;
        if (transactRequest4 != null && transactRequest4.t0()) {
            z = true;
        }
        return z ? "Buy: Source Currency" : "Sell: Target Currency";
    }

    public final Long S0() {
        return this.v;
    }

    public final LiveData<ScreenHelp.ScreenID> T0() {
        return this.l;
    }

    public final void b1(TransferOption transferOption, ListAction listAction) {
        w32.h(transferOption, "paymentMethod");
        w32.h(listAction, "action");
        g1(transferOption, listAction);
    }

    public final void c1(TransferOption transferOption, ListAction listAction) {
        DialogAction dialogAction;
        DialogAction dialogAction2;
        CreditCard creditCard;
        w32.h(transferOption, "paymentMethod");
        w32.h(listAction, "action");
        Dialog dialog = listAction.dialog;
        String str = (dialog == null || (dialogAction = dialog.primary_action) == null) ? null : dialogAction.url;
        f7.a.a(this.k, (dialog == null || (dialogAction2 = dialog.primary_action) == null) ? null : dialogAction2.event, false, 2, null);
        if (!(str == null || str.length() == 0)) {
            l0(new li1(str));
        } else {
            if (listAction.type != ListAction.Type.DELETE_CREDIT_CARD || (creditCard = transferOption.credit_card) == null) {
                return;
            }
            P0(transferOption, creditCard.id);
        }
    }

    public final void d1(ListAction listAction) {
        DialogAction dialogAction;
        String str;
        w32.h(listAction, "action");
        Dialog dialog = listAction.dialog;
        if (dialog == null || (dialogAction = dialog.secondary_action) == null || (str = dialogAction.url) == null) {
            return;
        }
        f7.a.a(this.k, (dialog == null || dialogAction == null) ? null : dialogAction.event, false, 2, null);
        l0(new li1(str));
    }

    public final LiveData<List<zq5>> e1() {
        return this.m;
    }

    public final void f1(Long l) {
        this.v = l;
    }

    public final void h(zq5 zq5Var) {
        w32.h(zq5Var, "paymentMethod");
        if (zq5Var instanceof zq5.a) {
            Z0();
        } else if (zq5Var instanceof zq5.b) {
            a1(((zq5.b) zq5Var).a());
        }
    }

    @Override
    public void onCleared() {
        super.onCleared();
        this.h.h().removeObserver(this.x);
    }
}