导航菜单

页面标题

页面副标题

BodyTech v7.6.4 - PaymentLauncherViewModel.java 源代码

正在查看: BodyTech v7.6.4 应用的 PaymentLauncherViewModel.java JAVA 源代码文件

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


package com.stripe.android.payments.paymentlauncher;

import android.app.Application;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultCaller;
import androidx.annotation.VisibleForTesting;
import androidx.compose.runtime.internal.StabilityInferred;
import androidx.lifecycle.DefaultLifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.SavedStateHandle;
import androidx.lifecycle.SavedStateHandleSupport;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelKt;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.viewmodel.CreationExtras;
import com.stripe.android.core.exception.LocalStripeException;
import com.stripe.android.core.exception.StripeException;
import com.stripe.android.core.networking.AnalyticsRequestExecutor;
import com.stripe.android.core.networking.e;
import com.stripe.android.model.ConfirmPaymentIntentParams;
import com.stripe.android.model.ConfirmSetupIntentParams;
import com.stripe.android.model.PaymentMethod;
import com.stripe.android.model.PaymentMethodCreateParams;
import com.stripe.android.model.StripeIntent;
import com.stripe.android.networking.PaymentAnalyticsEvent;
import com.stripe.android.networking.PaymentAnalyticsRequestFactory;
import com.stripe.android.networking.m;
import com.stripe.android.payments.DefaultReturnUrl;
import com.stripe.android.payments.PaymentIntentFlowResultProcessor;
import com.stripe.android.payments.SetupIntentFlowResultProcessor;
import com.stripe.android.payments.Unvalidated;
import com.stripe.android.payments.core.analytics.ErrorReporter;
import com.stripe.android.payments.core.injection.x;
import com.stripe.android.payments.paymentlauncher.a;
import com.stripe.android.payments.paymentlauncher.c;
import java.util.List;
import java.util.Map;
import kotlin.Function;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Pair;
import kotlin.collections.f0;
import kotlin.collections.g0;
import kotlin.collections.n;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.jvm.internal.o;
import kotlin.jvm.internal.r;
import kotlin.reflect.KClass;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlowKt;
import kotlinx.coroutines.scheduling.WorkQueueKt;

@StabilityInferred(parameters = 0)
@Metadata(d1 = {"\u0000Î\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010$\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010%\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u000f\b\u0000\u0018\u0000 h2\u00020\u0001:\u0002)iB\u0095\u0001\b\u0007\u0012\b\b\u0001\u0010+\u001a\u00020(\u0012\u0006\u0010/\u001a\u00020,\u0012\u0006\u00103\u001a\u000200\u0012\u0006\u00107\u001a\u000204\u0012\f\u0010<\u001a\b\u0012\u0004\u0012\u00020908\u0012\u0012\u0010@\u001a\u000e\u0012\u0004\u0012\u00020\u000f\u0012\u0004\u0012\u00020\u000f0=\u0012\f\u0010E\u001a\b\u0012\u0004\u0012\u00020B0A\u0012\f\u0010H\u001a\b\u0012\u0004\u0012\u00020F0A\u0012\u0006\u0010L\u001a\u00020I\u0012\u0006\u0010P\u001a\u00020M\u0012\b\b\u0001\u0010T\u001a\u00020Q\u0012\u0006\u0010X\u001a\u00020U\u0012\b\b\u0001\u0010Z\u001a\u00020(¢\u0006\u0004\bf\u0010gJ\u001f\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0000¢\u0006\u0004\b\u0007\u0010\bJ\u001f\u0010\r\u001a\u00020\u00062\u0006\u0010\n\u001a\u00020\t2\u0006\u0010\f\u001a\u00020\u000bH\u0000¢\u0006\u0004\b\r\u0010\u000eJ\u001f\u0010\u0011\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\f\u001a\u00020\u000bH\u0000¢\u0006\u0004\b\u0011\u0010\u0012J\u0017\u0010\u0015\u001a\u00020\u00062\u0006\u0010\u0014\u001a\u00020\u0013H\u0001¢\u0006\u0004\b\u0015\u0010\u0016J\u001c\u0010\u0018\u001a\u000e\u0012\u0004\u0012\u00020\u000f\u0012\u0004\u0012\u00020\u000f0\u00172\u0006\u0010\n\u001a\u00020\tH\u0002J.\u0010\u001c\u001a\b\u0012\u0004\u0012\u00020\u001b0\u001a2\u0006\u0010\n\u001a\u00020\t2\b\u0010\u0019\u001a\u0004\u0018\u00010\u000fH\u0082@ø\u0001\u0000ø\u0001\u0001¢\u0006\u0004\b\u001c\u0010\u001dJ\u001c\u0010\u001e\u001a\u000e\u0012\u0004\u0012\u00020\u000f\u0012\u0004\u0012\u00020\u000f0\u00172\u0006\u0010\u0010\u001a\u00020\u000fH\u0002J\u0016\u0010!\u001a\u00020\u00062\f\u0010 \u001a\b\u0012\u0004\u0012\u00020\u001b0\u001fH\u0002J2\u0010&\u001a\u00020\u00062\u0006\u0010#\u001a\u00020\"2\n\b\u0002\u0010$\u001a\u0004\u0018\u00010\u001b2\u0014\b\u0002\u0010%\u001a\u000e\u0012\u0004\u0012\u00020\u000f\u0012\u0004\u0012\u00020\u000f0\u0017H\u0002J\u0012\u0010'\u001a\u00020\u00062\b\u0010\u0019\u001a\u0004\u0018\u00010\u000fH\u0002R\u0014\u0010+\u001a\u00020(8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b)\u0010*R\u0014\u0010/\u001a\u00020,8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b-\u0010.R\u0014\u00103\u001a\u0002008\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b1\u00102R\u0014\u00107\u001a\u0002048\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b5\u00106R\u001a\u0010<\u001a\b\u0012\u0004\u0012\u000209088\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b:\u0010;R \u0010@\u001a\u000e\u0012\u0004\u0012\u00020\u000f\u0012\u0004\u0012\u00020\u000f0=8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b>\u0010?R\u001a\u0010E\u001a\b\u0012\u0004\u0012\u00020B0A8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bC\u0010DR\u001a\u0010H\u001a\b\u0012\u0004\u0012\u00020F0A8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bG\u0010DR\u0014\u0010L\u001a\u00020I8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bJ\u0010KR\u0014\u0010P\u001a\u00020M8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bN\u0010OR\u0014\u0010T\u001a\u00020Q8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bR\u0010SR\u0014\u0010X\u001a\u00020U8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bV\u0010WR\u0014\u0010Z\u001a\u00020(8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bY\u0010*R\"\u0010`\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\"0[8\u0000X\u0080\u0004¢\u0006\f\n\u0004\b\\\u0010]\u001a\u0004\b^\u0010_R\u0014\u0010c\u001a\u00020(8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\ba\u0010bR\u0014\u0010e\u001a\u00020(8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\bd\u0010b\u0082\u0002\u000b\n\u0002\b!\n\u0005\b¡\u001e0\u0001¨\u0006j"}, d2 = {"Lcom/stripe/android/payments/paymentlauncher/PaymentLauncherViewModel;", "Landroidx/lifecycle/ViewModel;", "Landroidx/activity/result/ActivityResultCaller;", "activityResultCaller", "Landroidx/lifecycle/LifecycleOwner;", "lifecycleOwner", "", "D", "(Landroidx/activity/result/ActivityResultCaller;Landroidx/lifecycle/LifecycleOwner;)V", "Lai/d;", "confirmStripeIntentParams", "Lcom/stripe/android/view/i;", "host", "r", "(Lai/d;Lcom/stripe/android/view/i;)V", "", "clientSecret", "v", "(Ljava/lang/String;Lcom/stripe/android/view/i;)V", "Lcom/stripe/android/payments/c;", "paymentFlowResult", "z", "(Lcom/stripe/android/payments/c;)V", "", "w", "returnUrl", "Lkotlin/Result;", "Lcom/stripe/android/model/StripeIntent;", "q", "(Lai/d;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "x", "Lcom/stripe/android/g0;", "stripeIntentResult", "C", "Lcom/stripe/android/payments/paymentlauncher/a;", "stripeInternalResult", "intent", "analyticsParams", "A", "y", "", "a", "Z", "isPaymentIntent", "Lcom/stripe/android/networking/m;", "b", "Lcom/stripe/android/networking/m;", "stripeApiRepository", "Lcom/stripe/android/payments/core/authentication/e;", "c", "Lcom/stripe/android/payments/core/authentication/e;", "authenticatorRegistry", "Lcom/stripe/android/payments/a;", "d", "Lcom/stripe/android/payments/a;", "defaultReturnUrl", "Lfj/a;", "Lcom/stripe/android/core/networking/e$c;", "e", "Lfj/a;", "apiRequestOptionsProvider", "", "f", "Ljava/util/Map;", "threeDs1IntentReturnUrlMap", "Ldj/a;", "Lcom/stripe/android/payments/PaymentIntentFlowResultProcessor;", "g", "Ldj/a;", "lazyPaymentIntentFlowResultProcessor", "Lcom/stripe/android/payments/SetupIntentFlowResultProcessor;", "h", "lazySetupIntentFlowResultProcessor", "Lcom/stripe/android/core/networking/AnalyticsRequestExecutor;", "i", "Lcom/stripe/android/core/networking/AnalyticsRequestExecutor;", "analyticsRequestExecutor", "Lcom/stripe/android/networking/PaymentAnalyticsRequestFactory;", "j", "Lcom/stripe/android/networking/PaymentAnalyticsRequestFactory;", "paymentAnalyticsRequestFactory", "Lkotlin/coroutines/CoroutineContext;", "k", "Lkotlin/coroutines/CoroutineContext;", "uiContext", "Landroidx/lifecycle/SavedStateHandle;", "l", "Landroidx/lifecycle/SavedStateHandle;", "savedStateHandle", "m", "isInstantApp", "Lkotlinx/coroutines/flow/MutableStateFlow;", "n", "Lkotlinx/coroutines/flow/MutableStateFlow;", "u", "()Lkotlinx/coroutines/flow/MutableStateFlow;", "internalPaymentResult", "t", "()Z", "hasStarted", "s", "confirmActionRequested", "<init>", "(ZLcom/stripe/android/networking/m;Lcom/stripe/android/payments/core/authentication/e;Lcom/stripe/android/payments/a;Lfj/a;Ljava/util/Map;Ldj/a;Ldj/a;Lcom/stripe/android/core/networking/AnalyticsRequestExecutor;Lcom/stripe/android/networking/PaymentAnalyticsRequestFactory;Lkotlin/coroutines/CoroutineContext;Landroidx/lifecycle/SavedStateHandle;Z)V", "o", "Factory", "payments-core_release"}, k = 1, mv = {1, 9, 0})
public final class PaymentLauncherViewModel extends ViewModel {
    public static final int p = 8;
    private static final List<String> q = n.e("payment_method");

    private final boolean isPaymentIntent;

    private final m stripeApiRepository;

    private final com.stripe.android.payments.core.authentication.e authenticatorRegistry;

    private final DefaultReturnUrl defaultReturnUrl;

    private final fj.a<e.Options> apiRequestOptionsProvider;

    private final Map<String, String> threeDs1IntentReturnUrlMap;

    private final dj.a<PaymentIntentFlowResultProcessor> lazyPaymentIntentFlowResultProcessor;

    private final dj.a<SetupIntentFlowResultProcessor> lazySetupIntentFlowResultProcessor;

    private final AnalyticsRequestExecutor analyticsRequestExecutor;

    private final PaymentAnalyticsRequestFactory paymentAnalyticsRequestFactory;

    private final CoroutineContext uiContext;

    private final SavedStateHandle savedStateHandle;

    private final boolean isInstantApp;

    private final MutableStateFlow<a> internalPaymentResult;

    @StabilityInferred(parameters = 1)
    @Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0000\u0018\u00002\u00020\u0001B\u0015\u0012\f\u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\u000b0\n¢\u0006\u0004\b\u000f\u0010\u0010J/\u0010\b\u001a\u00028\u0000\"\b\b\u0000\u0010\u0003*\u00020\u00022\f\u0010\u0005\u001a\b\u0012\u0004\u0012\u00028\u00000\u00042\u0006\u0010\u0007\u001a\u00020\u0006H\u0016¢\u0006\u0004\b\b\u0010\tR\u001a\u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\u000b0\n8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\f\u0010\r¨\u0006\u0011"}, d2 = {"Lcom/stripe/android/payments/paymentlauncher/PaymentLauncherViewModel$Factory;", "Landroidx/lifecycle/ViewModelProvider$Factory;", "Landroidx/lifecycle/ViewModel;", "T", "Ljava/lang/Class;", "modelClass", "Landroidx/lifecycle/viewmodel/CreationExtras;", "extras", "create", "(Ljava/lang/Class;Landroidx/lifecycle/viewmodel/CreationExtras;)Landroidx/lifecycle/ViewModel;", "Lkotlin/Function0;", "Lcom/stripe/android/payments/paymentlauncher/c$a;", "a", "Lkotlin/jvm/functions/Function0;", "argsSupplier", "<init>", "(Lkotlin/jvm/functions/Function0;)V", "payments-core_release"}, k = 1, mv = {1, 9, 0})
    public static final class Factory implements ViewModelProvider.Factory {

        private final Function0<c.a> argsSupplier;

        public Factory(Function0<? extends c.a> argsSupplier) {
            r.i(argsSupplier, "argsSupplier");
            this.argsSupplier = argsSupplier;
        }

        public ViewModel create(Class cls) {
            return androidx.lifecycle.n.a(this, cls);
        }

        public ViewModel create(KClass kClass, CreationExtras creationExtras) {
            return androidx.lifecycle.n.c(this, kClass, creationExtras);
        }

        public <T extends ViewModel> T create(Class<T> modelClass, CreationExtras extras) {
            r.i(modelClass, "modelClass");
            r.i(extras, "extras");
            final c.a invoke = this.argsSupplier.invoke();
            Application a = sh.b.a(extras);
            SavedStateHandle createSavedStateHandle = SavedStateHandleSupport.createSavedStateHandle(extras);
            x.a a2 = com.stripe.android.payments.core.injection.i.a().a(a).c(invoke.getEnableLogging()).d(new Function0<String>() {
                {
                    super(0);
                }

                @Override
                public final String invoke() {
                    return c.a.this.getPublishableKey();
                }
            }).e(new Function0<String>() {
                {
                    super(0);
                }

                @Override
                public final String invoke() {
                    return c.a.this.getStripeAccountId();
                }
            }).b(invoke.e()).f(invoke.getIncludePaymentSheetAuthenticators()).build().a();
            boolean z = false;
            if (invoke instanceof c.a.IntentConfirmationArgs) {
                ai.d confirmStripeIntentParams = ((c.a.IntentConfirmationArgs) invoke).getConfirmStripeIntentParams();
                if (!(confirmStripeIntentParams instanceof ConfirmPaymentIntentParams)) {
                    if (!(confirmStripeIntentParams instanceof ConfirmSetupIntentParams)) {
                        throw new NoWhenBranchMatchedException();
                    }
                    PaymentLauncherViewModel a3 = a2.b(z).a(createSavedStateHandle).build().a();
                    r.g(a3, "null cannot be cast to non-null type T of com.stripe.android.payments.paymentlauncher.PaymentLauncherViewModel.Factory.create");
                    return a3;
                }
                z = true;
                PaymentLauncherViewModel a32 = a2.b(z).a(createSavedStateHandle).build().a();
                r.g(a32, "null cannot be cast to non-null type T of com.stripe.android.payments.paymentlauncher.PaymentLauncherViewModel.Factory.create");
                return a32;
            }
            if (!(invoke instanceof c.a.PaymentIntentNextActionArgs)) {
                if (!(invoke instanceof c.a.SetupIntentNextActionArgs)) {
                    throw new NoWhenBranchMatchedException();
                }
                PaymentLauncherViewModel a322 = a2.b(z).a(createSavedStateHandle).build().a();
                r.g(a322, "null cannot be cast to non-null type T of com.stripe.android.payments.paymentlauncher.PaymentLauncherViewModel.Factory.create");
                return a322;
            }
            z = true;
            PaymentLauncherViewModel a3222 = a2.b(z).a(createSavedStateHandle).build().a();
            r.g(a3222, "null cannot be cast to non-null type T of com.stripe.android.payments.paymentlauncher.PaymentLauncherViewModel.Factory.create");
            return a3222;
        }
    }

    @Metadata(k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0}, xi = 48)
    class b implements ActivityResultCallback, o {
        b() {
        }

        public final void onActivityResult(Unvalidated p0) {
            r.i(p0, "p0");
            PaymentLauncherViewModel.this.z(p0);
        }

        public final boolean equals(Object obj) {
            if ((obj instanceof ActivityResultCallback) && (obj instanceof o)) {
                return r.d(getFunctionDelegate(), ((o) obj).getFunctionDelegate());
            }
            return false;
        }

        @Override
        public final Function<?> getFunctionDelegate() {
            return new FunctionReferenceImpl(1, PaymentLauncherViewModel.this, PaymentLauncherViewModel.class, "onPaymentFlowResult", "onPaymentFlowResult$payments_core_release(Lcom/stripe/android/payments/PaymentFlowResult$Unvalidated;)V", 0);
        }

        public final int hashCode() {
            return getFunctionDelegate().hashCode();
        }
    }

    @Metadata(d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0006"}, d2 = {"com/stripe/android/payments/paymentlauncher/PaymentLauncherViewModel$c", "Landroidx/lifecycle/DefaultLifecycleObserver;", "Landroidx/lifecycle/LifecycleOwner;", "owner", "", "onDestroy", "payments-core_release"}, k = 1, mv = {1, 9, 0})
    public static final class c implements DefaultLifecycleObserver {
        c() {
        }

        public void onCreate(LifecycleOwner lifecycleOwner) {
            androidx.lifecycle.c.a(this, lifecycleOwner);
        }

        public void onDestroy(LifecycleOwner owner) {
            r.i(owner, "owner");
            PaymentLauncherViewModel.this.authenticatorRegistry.b();
            androidx.lifecycle.c.b(this, owner);
        }

        public void onPause(LifecycleOwner lifecycleOwner) {
            androidx.lifecycle.c.c(this, lifecycleOwner);
        }

        public void onResume(LifecycleOwner lifecycleOwner) {
            androidx.lifecycle.c.d(this, lifecycleOwner);
        }

        public void onStart(LifecycleOwner lifecycleOwner) {
            androidx.lifecycle.c.e(this, lifecycleOwner);
        }

        public void onStop(LifecycleOwner lifecycleOwner) {
            androidx.lifecycle.c.f(this, lifecycleOwner);
        }
    }

    public PaymentLauncherViewModel(boolean z, m stripeApiRepository, com.stripe.android.payments.core.authentication.e authenticatorRegistry, DefaultReturnUrl defaultReturnUrl, fj.a<e.Options> apiRequestOptionsProvider, Map<String, String> threeDs1IntentReturnUrlMap, dj.a<PaymentIntentFlowResultProcessor> lazyPaymentIntentFlowResultProcessor, dj.a<SetupIntentFlowResultProcessor> lazySetupIntentFlowResultProcessor, AnalyticsRequestExecutor analyticsRequestExecutor, PaymentAnalyticsRequestFactory paymentAnalyticsRequestFactory, CoroutineContext uiContext, SavedStateHandle savedStateHandle, boolean z2) {
        r.i(stripeApiRepository, "stripeApiRepository");
        r.i(authenticatorRegistry, "authenticatorRegistry");
        r.i(defaultReturnUrl, "defaultReturnUrl");
        r.i(apiRequestOptionsProvider, "apiRequestOptionsProvider");
        r.i(threeDs1IntentReturnUrlMap, "threeDs1IntentReturnUrlMap");
        r.i(lazyPaymentIntentFlowResultProcessor, "lazyPaymentIntentFlowResultProcessor");
        r.i(lazySetupIntentFlowResultProcessor, "lazySetupIntentFlowResultProcessor");
        r.i(analyticsRequestExecutor, "analyticsRequestExecutor");
        r.i(paymentAnalyticsRequestFactory, "paymentAnalyticsRequestFactory");
        r.i(uiContext, "uiContext");
        r.i(savedStateHandle, "savedStateHandle");
        this.isPaymentIntent = z;
        this.stripeApiRepository = stripeApiRepository;
        this.authenticatorRegistry = authenticatorRegistry;
        this.defaultReturnUrl = defaultReturnUrl;
        this.apiRequestOptionsProvider = apiRequestOptionsProvider;
        this.threeDs1IntentReturnUrlMap = threeDs1IntentReturnUrlMap;
        this.lazyPaymentIntentFlowResultProcessor = lazyPaymentIntentFlowResultProcessor;
        this.lazySetupIntentFlowResultProcessor = lazySetupIntentFlowResultProcessor;
        this.analyticsRequestExecutor = analyticsRequestExecutor;
        this.paymentAnalyticsRequestFactory = paymentAnalyticsRequestFactory;
        this.uiContext = uiContext;
        this.savedStateHandle = savedStateHandle;
        this.isInstantApp = z2;
        this.internalPaymentResult = StateFlowKt.MutableStateFlow(null);
    }

    private final void A(a stripeInternalResult, StripeIntent intent, Map<String, String> analyticsParams) {
        Map n;
        Map s;
        Map<String, ? extends Object> s2;
        PaymentMethod paymentMethod;
        PaymentMethod.Type type;
        StripeIntent.Status status;
        String clientSecret;
        MutableStateFlow<a> mutableStateFlow = this.internalPaymentResult;
        PaymentAnalyticsEvent paymentAnalyticsEvent = s() ? PaymentAnalyticsEvent.P : PaymentAnalyticsEvent.R;
        Pair[] pairArr = new Pair[3];
        String str = null;
        pairArr[0] = gj.i.a("intent_id", (intent == null || (clientSecret = intent.getClientSecret()) == null) ? null : d.b(clientSecret));
        pairArr[1] = gj.i.a("status", (intent == null || (status = intent.getStatus()) == null) ? null : status.getCode());
        if (intent != null && (paymentMethod = intent.getPaymentMethod()) != null && (type = paymentMethod.type) != null) {
            str = type.code;
        }
        pairArr[2] = gj.i.a("payment_method_type", str);
        n = g0.n(pairArr);
        Map a = com.stripe.android.utils.b.a(n);
        Map<String, String> d = stripeInternalResult instanceof a.d ? ErrorReporter.INSTANCE.d(StripeException.INSTANCE.b(((a.d) stripeInternalResult).getThrowable())) : g0.j();
        AnalyticsRequestExecutor analyticsRequestExecutor = this.analyticsRequestExecutor;
        PaymentAnalyticsRequestFactory paymentAnalyticsRequestFactory = this.paymentAnalyticsRequestFactory;
        s = g0.s(analyticsParams, a);
        s2 = g0.s(s, d);
        analyticsRequestExecutor.a(paymentAnalyticsRequestFactory.e(paymentAnalyticsEvent, s2));
        mutableStateFlow.setValue(stripeInternalResult);
    }

    static void B(PaymentLauncherViewModel paymentLauncherViewModel, a aVar, StripeIntent stripeIntent, Map map, int i, Object obj) {
        if ((i & 2) != 0) {
            stripeIntent = null;
        }
        if ((i & 4) != 0) {
            map = g0.j();
        }
        paymentLauncherViewModel.A(aVar, stripeIntent, map);
    }

    public final void C(com.stripe.android.g0<? extends StripeIntent> stripeIntentResult) {
        a completed;
        int g = stripeIntentResult.g();
        if (g == 1) {
            completed = new a.Completed(stripeIntentResult.e());
        } else if (g == 2) {
            completed = new a.d(new LocalStripeException(stripeIntentResult.c(), "failedIntentOutcomeError"));
        } else if (g == 3) {
            completed = a.C0101a.d;
        } else if (g != 4) {
            completed = new a.d(new LocalStripeException("Payment fails due to unknown error. \n" + stripeIntentResult.c(), "unknownIntentOutcomeError"));
        } else {
            completed = new a.d(new LocalStripeException("Payment fails due to time out. \n" + stripeIntentResult.c(), "timedOutIntentOutcomeError"));
        }
        B(this, completed, stripeIntentResult.e(), null, 4, null);
    }

    public final java.lang.Object q(ai.d r6, java.lang.String r7, kotlin.coroutines.Continuation<? super kotlin.Result<? extends com.stripe.android.model.StripeIntent>> r8) {
        throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.payments.paymentlauncher.PaymentLauncherViewModel.q(ai.d, java.lang.String, kotlin.coroutines.Continuation):java.lang.Object");
    }

    private final boolean s() {
        Boolean bool = (Boolean) this.savedStateHandle.get("confirm_action_requested");
        if (bool != null) {
            return bool.booleanValue();
        }
        return true;
    }

    private final boolean t() {
        Boolean bool = (Boolean) this.savedStateHandle.get("key_has_started");
        if (bool != null) {
            return bool.booleanValue();
        }
        return false;
    }

    public final Map<String, String> w(ai.d confirmStripeIntentParams) {
        String b2;
        Map n;
        Pair[] pairArr = new Pair[2];
        PaymentMethodCreateParams a = ai.e.a(confirmStripeIntentParams);
        pairArr[0] = gj.i.a("payment_method_type", a != null ? a.getCode() : null);
        b2 = d.b(confirmStripeIntentParams.getClientSecret());
        pairArr[1] = gj.i.a("intent_id", b2);
        n = g0.n(pairArr);
        Map<String, String> a2 = com.stripe.android.utils.b.a(n);
        this.analyticsRequestExecutor.a(this.paymentAnalyticsRequestFactory.e(PaymentAnalyticsEvent.O, a2));
        return a2;
    }

    public final Map<String, String> x(String clientSecret) {
        String b2;
        Map<String, String> f;
        b2 = d.b(clientSecret);
        f = f0.f(gj.i.a("intent_id", b2));
        this.analyticsRequestExecutor.a(this.paymentAnalyticsRequestFactory.e(PaymentAnalyticsEvent.Q, f));
        return f;
    }

    public final void y(String returnUrl) {
        this.analyticsRequestExecutor.a(PaymentAnalyticsRequestFactory.s(this.paymentAnalyticsRequestFactory, r.d(returnUrl, this.defaultReturnUrl.a()) ? PaymentAnalyticsEvent.b0 : returnUrl == null ? PaymentAnalyticsEvent.a0 : PaymentAnalyticsEvent.c0, null, null, null, null, null, 62, null));
    }

    public final void D(ActivityResultCaller activityResultCaller, LifecycleOwner lifecycleOwner) {
        r.i(activityResultCaller, "activityResultCaller");
        r.i(lifecycleOwner, "lifecycleOwner");
        this.authenticatorRegistry.a(activityResultCaller, new b());
        lifecycleOwner.getLifecycle().addObserver(new c());
    }

    public final void r(ai.d confirmStripeIntentParams, com.stripe.android.view.i host) {
        r.i(confirmStripeIntentParams, "confirmStripeIntentParams");
        r.i(host, "host");
        if (t()) {
            return;
        }
        BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new PaymentLauncherViewModel$confirmStripeIntent$1(this, confirmStripeIntentParams, host, null), 3, null);
    }

    public final MutableStateFlow<a> u() {
        return this.internalPaymentResult;
    }

    public final void v(String clientSecret, com.stripe.android.view.i host) {
        r.i(clientSecret, "clientSecret");
        r.i(host, "host");
        if (t()) {
            return;
        }
        BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new PaymentLauncherViewModel$handleNextActionForStripeIntent$1(this, clientSecret, host, null), 3, null);
    }

    @VisibleForTesting
    public final void z(Unvalidated paymentFlowResult) {
        r.i(paymentFlowResult, "paymentFlowResult");
        BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new PaymentLauncherViewModel$onPaymentFlowResult$1(this, paymentFlowResult, null), 3, null);
    }
}