正在查看: Rilo v2.0.21 应用的 PaymentSheetViewModel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Rilo v2.0.21 应用的 PaymentSheetViewModel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.stripe.android.paymentsheet;
import android.app.Application;
import androidx.activity.result.ActivityResultCaller;
import androidx.activity.result.ActivityResultLauncher;
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.PaymentConfiguration;
import com.stripe.android.common.exception.ExceptionKtKt;
import com.stripe.android.core.Logger;
import com.stripe.android.core.injection.IOContext;
import com.stripe.android.core.networking.AnalyticsRequestFactory;
import com.stripe.android.googlepaylauncher.GooglePayEnvironment;
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncher;
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncherContractV2;
import com.stripe.android.googlepaylauncher.injection.GooglePayPaymentMethodLauncherFactory;
import com.stripe.android.link.LinkConfigurationCoordinator;
import com.stripe.android.model.ConfirmPaymentIntentParams;
import com.stripe.android.model.ConfirmSetupIntentParams;
import com.stripe.android.model.ConfirmStripeIntentParams;
import com.stripe.android.model.PaymentIntent;
import com.stripe.android.model.PaymentMethod;
import com.stripe.android.model.SetupIntent;
import com.stripe.android.model.StripeIntent;
import com.stripe.android.payments.paymentlauncher.InternalPaymentResult;
import com.stripe.android.payments.paymentlauncher.PaymentLauncherContract;
import com.stripe.android.payments.paymentlauncher.PaymentResult;
import com.stripe.android.payments.paymentlauncher.StripePaymentLauncher;
import com.stripe.android.payments.paymentlauncher.StripePaymentLauncherAssistedFactory;
import com.stripe.android.paymentsheet.LinkHandler;
import com.stripe.android.paymentsheet.PaymentSheet;
import com.stripe.android.paymentsheet.PaymentSheetContractV2;
import com.stripe.android.paymentsheet.PaymentSheetResult;
import com.stripe.android.paymentsheet.analytics.EventReporter;
import com.stripe.android.paymentsheet.analytics.PaymentSheetConfirmationError;
import com.stripe.android.paymentsheet.injection.DaggerPaymentSheetLauncherComponent;
import com.stripe.android.paymentsheet.injection.FormViewModelSubcomponent;
import com.stripe.android.paymentsheet.injection.PaymentSheetViewModelModule;
import com.stripe.android.paymentsheet.model.GooglePayButtonType;
import com.stripe.android.paymentsheet.model.PaymentSelection;
import com.stripe.android.paymentsheet.model.PaymentSheetViewState;
import com.stripe.android.paymentsheet.navigation.PaymentSheetScreen;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.BacsMandateConfirmationContract;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.BacsMandateConfirmationLauncher;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.BacsMandateConfirmationLauncherFactory;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.BacsMandateConfirmationResult;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.BacsMandateData;
import com.stripe.android.paymentsheet.repositories.CustomerRepository;
import com.stripe.android.paymentsheet.state.GooglePayState;
import com.stripe.android.paymentsheet.state.PaymentSheetLoader;
import com.stripe.android.paymentsheet.state.PaymentSheetLoadingExceptionKt;
import com.stripe.android.paymentsheet.state.PaymentSheetState;
import com.stripe.android.paymentsheet.state.WalletsState;
import com.stripe.android.paymentsheet.ui.HeaderTextFactory;
import com.stripe.android.paymentsheet.ui.ModifiableEditPaymentMethodViewInteractor;
import com.stripe.android.paymentsheet.ui.PrimaryButton;
import com.stripe.android.paymentsheet.utils.SelectionUtilsKt;
import com.stripe.android.paymentsheet.utils.StateFlowsKt;
import com.stripe.android.paymentsheet.viewmodels.BaseSheetViewModel;
import com.stripe.android.paymentsheet.viewmodels.PrimaryButtonUiStateMapper;
import com.stripe.android.ui.core.cbc.CardBrandChoiceEligibility;
import com.stripe.android.ui.core.forms.resources.LpmRepository;
import com.stripe.android.utils.CreationExtrasKtxKt;
import com.tiktok.appevents.contents.TTContentsEventConstants;
import com.twilio.audioswitch.bluetooth.BluetoothScoJobKt;
import com.twilio.audioswitch.wired.WiredHeadsetReceiverKt;
import dagger.Lazy;
import java.util.Collection;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Provider;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.functions.Function7;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.channels.BufferOverflow;
import kotlinx.coroutines.flow.Flow;
import kotlinx.coroutines.flow.FlowCollector;
import kotlinx.coroutines.flow.FlowKt;
import kotlinx.coroutines.flow.MutableSharedFlow;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.SharedFlow;
import kotlinx.coroutines.flow.SharedFlowKt;
import kotlinx.coroutines.flow.SharingStarted;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;
@Metadata(d1 = {"\u0000¢\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0003\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0000\u0018\u00002\u00020\u0001:\u0004¸\u0001¹\u0001B\u00ad\u0001\b\u0001\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\f\u0010\b\u001a\b\u0012\u0004\u0012\u00020\n0\t\u0012\u0006\u0010\u000b\u001a\u00020\f\u0012\u0006\u0010\r\u001a\u00020\u000e\u0012\u0006\u0010\u000f\u001a\u00020\u0010\u0012\u0006\u0010\u0011\u001a\u00020\u0012\u0012\u0006\u0010\u0013\u001a\u00020\u0014\u0012\u0006\u0010\u0015\u001a\u00020\u0016\u0012\u0006\u0010\u0017\u001a\u00020\u0018\u0012\u0006\u0010\u0019\u001a\u00020\u001a\u0012\b\b\u0001\u0010\u001b\u001a\u00020\u001c\u0012\u0006\u0010\u001d\u001a\u00020\u001e\u0012\u0006\u0010\u001f\u001a\u00020 \u0012\u0006\u0010!\u001a\u00020\"\u0012\u0006\u0010#\u001a\u00020$\u0012\f\u0010%\u001a\b\u0012\u0004\u0012\u00020'0&\u0012\u0006\u0010(\u001a\u00020)¢\u0006\u0002\u0010*J\u0006\u0010r\u001a\u00020sJ\u001a\u0010r\u001a\u00020s2\b\u0010t\u001a\u0004\u0018\u00010u2\u0006\u0010v\u001a\u000208H\u0002J\u0006\u0010w\u001a\u00020sJ\b\u0010x\u001a\u00020sH\u0016J\u0012\u0010y\u001a\u00020s2\b\u0010t\u001a\u0004\u0018\u00010uH\u0002J\u000e\u0010z\u001a\u00020s2\u0006\u0010{\u001a\u00020|J\u000e\u0010}\u001a\b\u0012\u0004\u0012\u00020\u007f0~H\u0016J\u0012\u0010\u0080\u0001\u001a\u00020s2\u0007\u0010t\u001a\u00030\u0081\u0001H\u0016J\u0013\u0010\u0082\u0001\u001a\u00020s2\b\u0010\u0083\u0001\u001a\u00030\u0084\u0001H\u0002J\u001c\u0010\u0085\u0001\u001a\u00020s2\u0007\u0010\u0086\u0001\u001a\u00020A2\b\u0010\u0087\u0001\u001a\u00030\u0088\u0001H\u0002J\u001e\u0010\u0089\u0001\u001a\u00020s2\n\u0010\u008a\u0001\u001a\u0005\u0018\u00010\u008b\u00012\u0007\u0010\u008c\u0001\u001a\u00020QH\u0002J\u0012\u0010\u008d\u0001\u001a\u00020s2\u0007\u0010?\u001a\u00030\u008e\u0001H\u0002J\u0014\u0010\u008f\u0001\u001a\u00020s2\t\u0010\u0090\u0001\u001a\u0004\u0018\u00010uH\u0016J\u0012\u0010\u0091\u0001\u001a\u00020s2\u0007\u0010?\u001a\u00030\u008e\u0001H\u0002J\u0013\u0010\u0092\u0001\u001a\u00020s2\b\u0010\u0093\u0001\u001a\u00030\u0094\u0001H\u0002J\u0013\u0010\u0095\u0001\u001a\u00020sH\u0082@ø\u0001\u0000¢\u0006\u0003\u0010\u0096\u0001J\u0013\u0010\u0097\u0001\u001a\u00020s2\b\u0010\u0098\u0001\u001a\u00030\u0099\u0001H\u0002J\u001c\u0010\u009a\u0001\u001a\u00020s2\u000b\b\u0001\u0010?\u001a\u0005\u0018\u00010\u009b\u0001H\u0016¢\u0006\u0003\u0010\u009c\u0001J\u0013\u0010\u009a\u0001\u001a\u00020s2\b\u0010?\u001a\u0004\u0018\u00010AH\u0016J\u0013\u0010\u009d\u0001\u001a\u00020s2\b\u0010\u009e\u0001\u001a\u00030\u008e\u0001H\u0016J\t\u0010\u009f\u0001\u001a\u00020sH\u0016J\u0019\u0010 \u0001\u001a\u00020s2\b\u0010\u0098\u0001\u001a\u00030¡\u0001H\u0000¢\u0006\u0003\b¢\u0001J\u0012\u0010£\u0001\u001a\u00020s2\u0007\u0010¤\u0001\u001a\u00020bH\u0002J\u0013\u0010¥\u0001\u001a\u00020s2\b\u0010¦\u0001\u001a\u00030§\u0001H\u0016J\t\u0010¨\u0001\u001a\u00020sH\u0016J\u001d\u0010©\u0001\u001a\u00020s2\b\u0010\u0087\u0001\u001a\u00030\u0088\u00012\b\u0010¦\u0001\u001a\u00030§\u0001H\u0002J\u001b\u0010ª\u0001\u001a\u00020s2\b\u0010«\u0001\u001a\u00030¬\u00012\b\u0010\u00ad\u0001\u001a\u00030®\u0001J\u0016\u0010¯\u0001\u001a\u00020s2\u000b\b\u0002\u0010°\u0001\u001a\u0004\u0018\u00010AH\u0002J\"\u0010±\u0001\u001a\u00020s2\b\u0010²\u0001\u001a\u00030³\u00012\u000f\u0010´\u0001\u001a\n\u0012\u0005\u0012\u00030¶\u00010µ\u0001J\u0011\u0010·\u0001\u001a\u00020s2\u0006\u00107\u001a\u000208H\u0002R\u0014\u0010+\u001a\b\u0012\u0004\u0012\u00020-0,X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0004\u001a\u00020\u0005X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b.\u0010/R\u0010\u00100\u001a\u0004\u0018\u000101X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0017\u001a\u00020\u0018X\u0082\u0004¢\u0006\u0002\n\u0000R\u0019\u00102\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010403¢\u0006\b\n\u0000\u001a\u0004\b5\u00106R\u001a\u00107\u001a\u000208X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b9\u0010:\"\u0004\b;\u0010<R\u0010\u0010=\u001a\u0004\u0018\u00010>X\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010?\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010A0@X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\bB\u0010CR\u0019\u0010D\u001a\n\u0012\u0006\u0012\u0004\u0018\u0001040@¢\u0006\b\n\u0000\u001a\u0004\bE\u0010CR\u000e\u0010F\u001a\u00020GX\u0082\u0004¢\u0006\u0002\n\u0000R\u001e\u0010H\u001a\u0004\u0018\u00010I8\u0000X\u0081\u0004¢\u0006\u000e\n\u0000\u0012\u0004\bJ\u0010K\u001a\u0004\bL\u0010MR\u0010\u0010N\u001a\u0004\u0018\u00010OX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0015\u001a\u00020\u0016X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010#\u001a\u00020$X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010P\u001a\u00020Q8@X\u0080\u0004¢\u0006\u0006\u001a\u0004\bR\u0010SR\u0014\u0010\b\u001a\b\u0012\u0004\u0012\u00020\n0\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u0016\u0010T\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010A0@X\u0082\u0004¢\u0006\u0002\n\u0000R\u001c\u0010U\u001a\u0004\u0018\u00010VX\u0096\u000e¢\u0006\u000e\n\u0000\u001a\u0004\bW\u0010X\"\u0004\bY\u0010ZR\u0010\u0010[\u001a\u0004\u0018\u00010\\X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0014X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\fX\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010]\u001a\b\u0012\u0004\u0012\u00020-0^X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b_\u0010`R\u0010\u0010a\u001a\u0004\u0018\u00010bX\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010c\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010d0@X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\be\u0010CR\u000e\u0010f\u001a\u00020gX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010h\u001a\u00020QX\u0096D¢\u0006\b\n\u0000\u001a\u0004\bi\u0010SR$\u0010j\u001a\n\u0012\u0006\u0012\u0004\u0018\u0001040k8\u0000X\u0081\u0004¢\u0006\u000e\n\u0000\u0012\u0004\bl\u0010K\u001a\u0004\bm\u0010nR\u001c\u0010o\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010p0@X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\bq\u0010C\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006º\u0001"}, d2 = {"Lcom/stripe/android/paymentsheet/PaymentSheetViewModel;", "Lcom/stripe/android/paymentsheet/viewmodels/BaseSheetViewModel;", "application", "Landroid/app/Application;", "args", "Lcom/stripe/android/paymentsheet/PaymentSheetContractV2$Args;", "eventReporter", "Lcom/stripe/android/paymentsheet/analytics/EventReporter;", "lazyPaymentConfig", "Ldagger/Lazy;", "Lcom/stripe/android/PaymentConfiguration;", "paymentSheetLoader", "Lcom/stripe/android/paymentsheet/state/PaymentSheetLoader;", "customerRepository", "Lcom/stripe/android/paymentsheet/repositories/CustomerRepository;", "prefsRepository", "Lcom/stripe/android/paymentsheet/PrefsRepository;", "lpmRepository", "Lcom/stripe/android/ui/core/forms/resources/LpmRepository;", "paymentLauncherFactory", "Lcom/stripe/android/payments/paymentlauncher/StripePaymentLauncherAssistedFactory;", "googlePayPaymentMethodLauncherFactory", "Lcom/stripe/android/googlepaylauncher/injection/GooglePayPaymentMethodLauncherFactory;", "bacsMandateConfirmationLauncherFactory", "Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/BacsMandateConfirmationLauncherFactory;", "logger", "Lcom/stripe/android/core/Logger;", "workContext", "Lkotlin/coroutines/CoroutineContext;", "savedStateHandle", "Landroidx/lifecycle/SavedStateHandle;", "linkHandler", "Lcom/stripe/android/paymentsheet/LinkHandler;", "linkConfigurationCoordinator", "Lcom/stripe/android/link/LinkConfigurationCoordinator;", "intentConfirmationInterceptor", "Lcom/stripe/android/paymentsheet/IntentConfirmationInterceptor;", "formViewModelSubComponentBuilderProvider", "Ljavax/inject/Provider;", "Lcom/stripe/android/paymentsheet/injection/FormViewModelSubcomponent$Builder;", "editInteractorFactory", "Lcom/stripe/android/paymentsheet/ui/ModifiableEditPaymentMethodViewInteractor$Factory;", "(Landroid/app/Application;Lcom/stripe/android/paymentsheet/PaymentSheetContractV2$Args;Lcom/stripe/android/paymentsheet/analytics/EventReporter;Ldagger/Lazy;Lcom/stripe/android/paymentsheet/state/PaymentSheetLoader;Lcom/stripe/android/paymentsheet/repositories/CustomerRepository;Lcom/stripe/android/paymentsheet/PrefsRepository;Lcom/stripe/android/ui/core/forms/resources/LpmRepository;Lcom/stripe/android/payments/paymentlauncher/StripePaymentLauncherAssistedFactory;Lcom/stripe/android/googlepaylauncher/injection/GooglePayPaymentMethodLauncherFactory;Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/BacsMandateConfirmationLauncherFactory;Lcom/stripe/android/core/Logger;Lkotlin/coroutines/CoroutineContext;Landroidx/lifecycle/SavedStateHandle;Lcom/stripe/android/paymentsheet/LinkHandler;Lcom/stripe/android/link/LinkConfigurationCoordinator;Lcom/stripe/android/paymentsheet/IntentConfirmationInterceptor;Ljavax/inject/Provider;Lcom/stripe/android/paymentsheet/ui/ModifiableEditPaymentMethodViewInteractor$Factory;)V", "_paymentSheetResult", "Lkotlinx/coroutines/flow/MutableSharedFlow;", "Lcom/stripe/android/paymentsheet/PaymentSheetResult;", "getArgs$paymentsheet_release", "()Lcom/stripe/android/paymentsheet/PaymentSheetContractV2$Args;", "bacsMandateConfirmationLauncher", "Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/BacsMandateConfirmationLauncher;", "buyButtonState", "Lkotlinx/coroutines/flow/Flow;", "Lcom/stripe/android/paymentsheet/model/PaymentSheetViewState;", "getBuyButtonState", "()Lkotlinx/coroutines/flow/Flow;", "checkoutIdentifier", "Lcom/stripe/android/paymentsheet/PaymentSheetViewModel$CheckoutIdentifier;", "getCheckoutIdentifier$paymentsheet_release", "()Lcom/stripe/android/paymentsheet/PaymentSheetViewModel$CheckoutIdentifier;", "setCheckoutIdentifier$paymentsheet_release", "(Lcom/stripe/android/paymentsheet/PaymentSheetViewModel$CheckoutIdentifier;)V", "deferredIntentConfirmationType", "Lcom/stripe/android/paymentsheet/DeferredIntentConfirmationType;", "error", "Lkotlinx/coroutines/flow/StateFlow;", "", "getError", "()Lkotlinx/coroutines/flow/StateFlow;", "googlePayButtonState", "getGooglePayButtonState", "googlePayButtonType", "Lcom/stripe/android/paymentsheet/model/GooglePayButtonType;", "googlePayLauncherConfig", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$Config;", "getGooglePayLauncherConfig$paymentsheet_release$annotations", "()V", "getGooglePayLauncherConfig$paymentsheet_release", "()Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$Config;", "googlePayPaymentMethodLauncher", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher;", "isProcessingPaymentIntent", "", "isProcessingPaymentIntent$paymentsheet_release", "()Z", "linkEmailFlow", "newPaymentSelection", "Lcom/stripe/android/paymentsheet/model/PaymentSelection$New;", "getNewPaymentSelection", "()Lcom/stripe/android/paymentsheet/model/PaymentSelection$New;", "setNewPaymentSelection", "(Lcom/stripe/android/paymentsheet/model/PaymentSelection$New;)V", "paymentLauncher", "Lcom/stripe/android/payments/paymentlauncher/StripePaymentLauncher;", "paymentSheetResult", "Lkotlinx/coroutines/flow/SharedFlow;", "getPaymentSheetResult$paymentsheet_release", "()Lkotlinx/coroutines/flow/SharedFlow;", "pendingPaymentResult", "Lcom/stripe/android/payments/paymentlauncher/InternalPaymentResult;", "primaryButtonUiState", "Lcom/stripe/android/paymentsheet/ui/PrimaryButton$UIState;", "getPrimaryButtonUiState", "primaryButtonUiStateMapper", "Lcom/stripe/android/paymentsheet/viewmodels/PrimaryButtonUiStateMapper;", "shouldCompleteLinkFlowInline", "getShouldCompleteLinkFlowInline", "viewState", "Lkotlinx/coroutines/flow/MutableStateFlow;", "getViewState$paymentsheet_release$annotations", "getViewState$paymentsheet_release", "()Lkotlinx/coroutines/flow/MutableStateFlow;", "walletsState", "Lcom/stripe/android/paymentsheet/state/WalletsState;", "getWalletsState", "checkout", "", "paymentSelection", "Lcom/stripe/android/paymentsheet/model/PaymentSelection;", "identifier", "checkoutWithGooglePay", "clearErrorMessages", "confirmPaymentSelection", "confirmStripeIntent", "confirmStripeIntentParams", "Lcom/stripe/android/model/ConfirmStripeIntentParams;", "determineInitialBackStack", "", "Lcom/stripe/android/paymentsheet/navigation/PaymentSheetScreen;", "handleConfirmUSBankAccount", "Lcom/stripe/android/paymentsheet/model/PaymentSelection$New$USBankAccount;", "handleLinkProcessingState", "processingState", "Lcom/stripe/android/paymentsheet/LinkHandler$ProcessingState;", "handleNextAction", "clientSecret", "stripeIntent", "Lcom/stripe/android/model/StripeIntent;", "handlePaymentCompleted", "paymentMethod", "Lcom/stripe/android/model/PaymentMethod;", "finishImmediately", "handlePaymentFailed", "", "handlePaymentMethodSelected", BaseSheetViewModel.SAVE_SELECTION, "handlePaymentSheetStateLoadFailure", "handlePaymentSheetStateLoaded", WiredHeadsetReceiverKt.INTENT_STATE, "Lcom/stripe/android/paymentsheet/state/PaymentSheetState$Full;", "loadPaymentSheetState", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "onBacsMandateResult", "result", "Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/BacsMandateConfirmationResult;", "onError", "", "(Ljava/lang/Integer;)V", "onFatal", "throwable", "onFinish", "onGooglePayResult", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$Result;", "onGooglePayResult$paymentsheet_release", "onInternalPaymentResult", "launcherResult", "onPaymentResult", "paymentResult", "Lcom/stripe/android/payments/paymentlauncher/PaymentResult;", "onUserCancel", "processPayment", "registerFromActivity", "activityResultCaller", "Landroidx/activity/result/ActivityResultCaller;", "lifecycleOwner", "Landroidx/lifecycle/LifecycleOwner;", "resetViewState", "userErrorMessage", "setupGooglePay", "lifecycleScope", "Lkotlinx/coroutines/CoroutineScope;", "activityResultLauncher", "Landroidx/activity/result/ActivityResultLauncher;", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncherContractV2$Args;", "startProcessing", "CheckoutIdentifier", "Factory", "paymentsheet_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class PaymentSheetViewModel extends BaseSheetViewModel {
private final MutableSharedFlow<PaymentSheetResult> _paymentSheetResult;
private final PaymentSheetContractV2.Args args;
private BacsMandateConfirmationLauncher bacsMandateConfirmationLauncher;
private final BacsMandateConfirmationLauncherFactory bacsMandateConfirmationLauncherFactory;
private final Flow<PaymentSheetViewState> buyButtonState;
private CheckoutIdentifier checkoutIdentifier;
private DeferredIntentConfirmationType deferredIntentConfirmationType;
private final StateFlow<String> error;
private final StateFlow<PaymentSheetViewState> googlePayButtonState;
private final GooglePayButtonType googlePayButtonType;
private final GooglePayPaymentMethodLauncher.Config googlePayLauncherConfig;
private GooglePayPaymentMethodLauncher googlePayPaymentMethodLauncher;
private final GooglePayPaymentMethodLauncherFactory googlePayPaymentMethodLauncherFactory;
private final IntentConfirmationInterceptor intentConfirmationInterceptor;
private final Lazy<PaymentConfiguration> lazyPaymentConfig;
private final StateFlow<String> linkEmailFlow;
private PaymentSelection.New newPaymentSelection;
private StripePaymentLauncher paymentLauncher;
private final StripePaymentLauncherAssistedFactory paymentLauncherFactory;
private final PaymentSheetLoader paymentSheetLoader;
private final SharedFlow<PaymentSheetResult> paymentSheetResult;
private InternalPaymentResult pendingPaymentResult;
private final StateFlow<PrimaryButton.UIState> primaryButtonUiState;
private final PrimaryButtonUiStateMapper primaryButtonUiStateMapper;
private final boolean shouldCompleteLinkFlowInline;
private final MutableStateFlow<PaymentSheetViewState> viewState;
private final StateFlow<WalletsState> walletsState;
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0005\b\u0080\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004j\u0002\b\u0005¨\u0006\u0006"}, d2 = {"Lcom/stripe/android/paymentsheet/PaymentSheetViewModel$CheckoutIdentifier;", "", "(Ljava/lang/String;I)V", "SheetTopGooglePay", "SheetBottomBuy", "None", "paymentsheet_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public enum CheckoutIdentifier {
SheetTopGooglePay,
SheetBottomBuy,
None
}
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
public class WhenMappings {
public static final int[] $EnumSwitchMapping$0;
public static final int[] $EnumSwitchMapping$1;
static {
int[] iArr = new int[PaymentSheet.GooglePayConfiguration.ButtonType.values().length];
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.Buy.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.Book.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.Checkout.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.Donate.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.Order.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.Subscribe.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.Plain.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.Pay.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
$EnumSwitchMapping$0 = iArr;
int[] iArr2 = new int[PaymentSheet.GooglePayConfiguration.Environment.values().length];
try {
iArr2[PaymentSheet.GooglePayConfiguration.Environment.Production.ordinal()] = 1;
} catch (NoSuchFieldError unused9) {
}
$EnumSwitchMapping$1 = iArr2;
}
}
public static void getGooglePayLauncherConfig$paymentsheet_release$annotations() {
}
public static void getViewState$paymentsheet_release$annotations() {
}
public final PaymentSheetContractV2.Args getArgs() {
return this.args;
}
@Inject
public PaymentSheetViewModel(Application application, PaymentSheetContractV2.Args args, EventReporter eventReporter, Lazy<PaymentConfiguration> lazy, PaymentSheetLoader paymentSheetLoader, CustomerRepository customerRepository, PrefsRepository prefsRepository, LpmRepository lpmRepository, StripePaymentLauncherAssistedFactory stripePaymentLauncherAssistedFactory, GooglePayPaymentMethodLauncherFactory googlePayPaymentMethodLauncherFactory, BacsMandateConfirmationLauncherFactory bacsMandateConfirmationLauncherFactory, Logger logger, @IOContext CoroutineContext coroutineContext, SavedStateHandle savedStateHandle, final LinkHandler linkHandler, LinkConfigurationCoordinator linkConfigurationCoordinator, IntentConfirmationInterceptor intentConfirmationInterceptor, Provider<FormViewModelSubcomponent.Builder> provider, ModifiableEditPaymentMethodViewInteractor.Factory factory) {
super(application, args.getConfig$paymentsheet_release(), eventReporter, customerRepository, prefsRepository, coroutineContext, logger, lpmRepository, savedStateHandle, linkHandler, linkConfigurationCoordinator, new HeaderTextFactory(true), provider, factory);
GooglePayButtonType googlePayButtonType;
GooglePayPaymentMethodLauncher.Config config;
GooglePayEnvironment googlePayEnvironment;
Intrinsics.checkNotNullParameter(application, "application");
Intrinsics.checkNotNullParameter(args, "args");
Intrinsics.checkNotNullParameter(eventReporter, "eventReporter");
Intrinsics.checkNotNullParameter(lazy, "lazyPaymentConfig");
Intrinsics.checkNotNullParameter(paymentSheetLoader, "paymentSheetLoader");
Intrinsics.checkNotNullParameter(customerRepository, "customerRepository");
Intrinsics.checkNotNullParameter(prefsRepository, "prefsRepository");
Intrinsics.checkNotNullParameter(lpmRepository, "lpmRepository");
Intrinsics.checkNotNullParameter(stripePaymentLauncherAssistedFactory, "paymentLauncherFactory");
Intrinsics.checkNotNullParameter(googlePayPaymentMethodLauncherFactory, "googlePayPaymentMethodLauncherFactory");
Intrinsics.checkNotNullParameter(bacsMandateConfirmationLauncherFactory, "bacsMandateConfirmationLauncherFactory");
Intrinsics.checkNotNullParameter(logger, "logger");
Intrinsics.checkNotNullParameter(coroutineContext, "workContext");
Intrinsics.checkNotNullParameter(savedStateHandle, "savedStateHandle");
Intrinsics.checkNotNullParameter(linkHandler, "linkHandler");
Intrinsics.checkNotNullParameter(linkConfigurationCoordinator, "linkConfigurationCoordinator");
Intrinsics.checkNotNullParameter(intentConfirmationInterceptor, "intentConfirmationInterceptor");
Intrinsics.checkNotNullParameter(provider, "formViewModelSubComponentBuilderProvider");
Intrinsics.checkNotNullParameter(factory, "editInteractorFactory");
this.args = args;
this.lazyPaymentConfig = lazy;
this.paymentSheetLoader = paymentSheetLoader;
this.paymentLauncherFactory = stripePaymentLauncherAssistedFactory;
this.googlePayPaymentMethodLauncherFactory = googlePayPaymentMethodLauncherFactory;
this.bacsMandateConfirmationLauncherFactory = bacsMandateConfirmationLauncherFactory;
this.intentConfirmationInterceptor = intentConfirmationInterceptor;
PrimaryButtonUiStateMapper primaryButtonUiStateMapper = new PrimaryButtonUiStateMapper(getApplication(), getConfig(), isProcessingPaymentIntent$paymentsheet_release(), getCurrentScreen(), getButtonsEnabled(), getAmount$paymentsheet_release(), getSelection$paymentsheet_release(), getCustomPrimaryButtonUiState(), new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m314invoke();
return Unit.INSTANCE;
}
public final void m314invoke() {
PaymentSheetViewModel.this.reportConfirmButtonPressed();
PaymentSheetViewModel.this.checkout();
}
});
this.primaryButtonUiStateMapper = primaryButtonUiStateMapper;
SharedFlow<PaymentSheetResult> MutableSharedFlow$default = SharedFlowKt.MutableSharedFlow$default(1, 0, (BufferOverflow) null, 6, (Object) null);
this._paymentSheetResult = MutableSharedFlow$default;
this.paymentSheetResult = MutableSharedFlow$default;
Flow MutableStateFlow = StateFlowKt.MutableStateFlow((Object) null);
this.viewState = MutableStateFlow;
this.checkoutIdentifier = CheckoutIdentifier.SheetBottomBuy;
final Flow flow = MutableStateFlow;
StateFlow<PaymentSheetViewState> stateIn = FlowKt.stateIn(new Flow<PaymentSheetViewState>() {
public Object collect(FlowCollector flowCollector, Continuation continuation) {
Object collect = flow.collect(new AnonymousClass2(flowCollector, this), continuation);
return collect == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? collect : Unit.INSTANCE;
}
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0007\u0010\u0000\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002\"\u0004\b\u0001\u0010\u00032\u0006\u0010\u0004\u001a\u0002H\u0002H\u008a@¢\u0006\u0004\b\u0005\u0010\u0006¨\u0006\b"}, d2 = {"<anonymous>", "", "T", "R", TTContentsEventConstants.Params.EVENT_PROPERTY_VALUE, "emit", "(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "kotlinx/coroutines/flow/FlowKt__EmittersKt$unsafeTransform$1$1", "kotlinx/coroutines/flow/FlowKt__TransformKt$filter$$inlined$unsafeTransform$1$2"}, k = 3, mv = {1, 8, 0}, xi = 48)
public static final class AnonymousClass2<T> implements FlowCollector {
final FlowCollector $this_unsafeFlow;
final PaymentSheetViewModel this$0;
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
@DebugMetadata(c = "com.stripe.android.paymentsheet.PaymentSheetViewModel$special$$inlined$filter$1$2", f = "PaymentSheetViewModel.kt", i = {}, l = {223}, m = "emit", n = {}, s = {})
public static final class AnonymousClass1 extends ContinuationImpl {
Object L$0;
Object L$1;
int label;
Object result;
public AnonymousClass1(Continuation continuation) {
super(continuation);
}
public final Object invokeSuspend(Object obj) {
this.result = obj;
this.label |= Integer.MIN_VALUE;
return AnonymousClass2.this.emit(null, (Continuation) this);
}
}
public AnonymousClass2(FlowCollector flowCollector, PaymentSheetViewModel paymentSheetViewModel) {
this.$this_unsafeFlow = flowCollector;
this.this$0 = paymentSheetViewModel;
}
public final java.lang.Object emit(java.lang.Object r6, kotlin.coroutines.Continuation r7) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.paymentsheet.PaymentSheetViewModel$special$$inlined$filter$1.AnonymousClass2.emit(java.lang.Object, kotlin.coroutines.Continuation):java.lang.Object");
}
}
}, CoroutineScopeKt.CoroutineScope(coroutineContext), SharingStarted.Companion.WhileSubscribed$default(SharingStarted.Companion, 0L, 0L, 3, (Object) null), (Object) null);
this.googlePayButtonState = stateIn;
final Flow flow2 = MutableStateFlow;
final Flow<PaymentSheetViewState> flow3 = new Flow<PaymentSheetViewState>() {
public Object collect(FlowCollector flowCollector, Continuation continuation) {
Object collect = flow2.collect(new AnonymousClass2(flowCollector, this), continuation);
return collect == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? collect : Unit.INSTANCE;
}
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0007\u0010\u0000\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002\"\u0004\b\u0001\u0010\u00032\u0006\u0010\u0004\u001a\u0002H\u0002H\u008a@¢\u0006\u0004\b\u0005\u0010\u0006¨\u0006\b"}, d2 = {"<anonymous>", "", "T", "R", TTContentsEventConstants.Params.EVENT_PROPERTY_VALUE, "emit", "(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "kotlinx/coroutines/flow/FlowKt__EmittersKt$unsafeTransform$1$1", "kotlinx/coroutines/flow/FlowKt__TransformKt$filter$$inlined$unsafeTransform$1$2"}, k = 3, mv = {1, 8, 0}, xi = 48)
public static final class AnonymousClass2<T> implements FlowCollector {
final FlowCollector $this_unsafeFlow;
final PaymentSheetViewModel this$0;
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
@DebugMetadata(c = "com.stripe.android.paymentsheet.PaymentSheetViewModel$special$$inlined$filter$2$2", f = "PaymentSheetViewModel.kt", i = {}, l = {223}, m = "emit", n = {}, s = {})
public static final class AnonymousClass1 extends ContinuationImpl {
Object L$0;
Object L$1;
int label;
Object result;
public AnonymousClass1(Continuation continuation) {
super(continuation);
}
public final Object invokeSuspend(Object obj) {
this.result = obj;
this.label |= Integer.MIN_VALUE;
return AnonymousClass2.this.emit(null, (Continuation) this);
}
}
public AnonymousClass2(FlowCollector flowCollector, PaymentSheetViewModel paymentSheetViewModel) {
this.$this_unsafeFlow = flowCollector;
this.this$0 = paymentSheetViewModel;
}
public final java.lang.Object emit(java.lang.Object r6, kotlin.coroutines.Continuation r7) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.paymentsheet.PaymentSheetViewModel$special$$inlined$filter$2.AnonymousClass2.emit(java.lang.Object, kotlin.coroutines.Continuation):java.lang.Object");
}
}
};
this.buyButtonState = flow3;
PaymentSheet.GooglePayConfiguration googlePay = args.getConfig$paymentsheet_release().getGooglePay();
PaymentSheet.GooglePayConfiguration.ButtonType buttonType = googlePay != null ? googlePay.getButtonType() : null;
switch (buttonType == null ? -1 : WhenMappings.$EnumSwitchMapping$0[buttonType.ordinal()]) {
case -1:
case 8:
googlePayButtonType = GooglePayButtonType.Pay;
break;
case 0:
default:
throw new NoWhenBranchMatchedException();
case 1:
googlePayButtonType = GooglePayButtonType.Buy;
break;
case 2:
googlePayButtonType = GooglePayButtonType.Book;
break;
case 3:
googlePayButtonType = GooglePayButtonType.Checkout;
break;
case 4:
googlePayButtonType = GooglePayButtonType.Donate;
break;
case 5:
googlePayButtonType = GooglePayButtonType.Order;
break;
case 6:
googlePayButtonType = GooglePayButtonType.Subscribe;
break;
case 7:
googlePayButtonType = GooglePayButtonType.Plain;
break;
}
this.googlePayButtonType = googlePayButtonType;
PaymentSheet.GooglePayConfiguration googlePayConfig = args.getGooglePayConfig();
if (googlePayConfig != null) {
if (googlePayConfig.getCurrencyCode() == null && !isProcessingPaymentIntent$paymentsheet_release()) {
logger.warning("GooglePayConfiguration.currencyCode is required in order to use Google Pay when processing a Setup Intent");
} else {
if (WhenMappings.$EnumSwitchMapping$1[googlePayConfig.getEnvironment().ordinal()] == 1) {
googlePayEnvironment = GooglePayEnvironment.Production;
} else {
googlePayEnvironment = GooglePayEnvironment.Test;
}
config = new GooglePayPaymentMethodLauncher.Config(googlePayEnvironment, googlePayConfig.getCountryCode(), getMerchantName(), args.getConfig$paymentsheet_release().getBillingDetailsCollectionConfiguration().getCollectsEmail$paymentsheet_release(), args.getConfig$paymentsheet_release().getBillingDetailsCollectionConfiguration().toBillingAddressConfig$paymentsheet_release(), false, false, 96, (DefaultConstructorMarker) null);
this.googlePayLauncherConfig = config;
ViewModel viewModel = (ViewModel) this;
this.primaryButtonUiState = FlowKt.stateIn(primaryButtonUiStateMapper.forCompleteFlow(), ViewModelKt.getViewModelScope(viewModel), SharingStarted.Companion.WhileSubscribed$default(SharingStarted.Companion, 0L, 0L, 3, (Object) null), (Object) null);
this.error = FlowKt.stateIn(new Flow<String>() {
public Object collect(FlowCollector flowCollector, Continuation continuation) {
Object collect = flow3.collect(new AnonymousClass2(flowCollector), continuation);
return collect == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? collect : Unit.INSTANCE;
}
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0007\u0010\u0000\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002\"\u0004\b\u0001\u0010\u00032\u0006\u0010\u0004\u001a\u0002H\u0002H\u008a@¢\u0006\u0004\b\u0005\u0010\u0006¨\u0006\b"}, d2 = {"<anonymous>", "", "T", "R", TTContentsEventConstants.Params.EVENT_PROPERTY_VALUE, "emit", "(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "kotlinx/coroutines/flow/FlowKt__EmittersKt$unsafeTransform$1$1", "kotlinx/coroutines/flow/FlowKt__TransformKt$map$$inlined$unsafeTransform$1$2"}, k = 3, mv = {1, 8, 0}, xi = 48)
public static final class AnonymousClass2<T> implements FlowCollector {
final FlowCollector $this_unsafeFlow;
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
@DebugMetadata(c = "com.stripe.android.paymentsheet.PaymentSheetViewModel$special$$inlined$map$1$2", f = "PaymentSheetViewModel.kt", i = {}, l = {223}, m = "emit", n = {}, s = {})
public static final class AnonymousClass1 extends ContinuationImpl {
Object L$0;
int label;
Object result;
public AnonymousClass1(Continuation continuation) {
super(continuation);
}
public final Object invokeSuspend(Object obj) {
this.result = obj;
this.label |= Integer.MIN_VALUE;
return AnonymousClass2.this.emit(null, (Continuation) this);
}
}
public AnonymousClass2(FlowCollector flowCollector) {
this.$this_unsafeFlow = flowCollector;
}
public final java.lang.Object emit(java.lang.Object r5, kotlin.coroutines.Continuation r6) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.paymentsheet.PaymentSheetViewModel$special$$inlined$map$1.AnonymousClass2.emit(java.lang.Object, kotlin.coroutines.Continuation):java.lang.Object");
}
}
}, ViewModelKt.getViewModelScope(viewModel), SharingStarted.Companion.WhileSubscribed$default(SharingStarted.Companion, BluetoothScoJobKt.TIMEOUT, 0L, 2, (Object) null), (Object) null);
StateFlow<String> stateIn2 = FlowKt.stateIn(linkConfigurationCoordinator.getEmailFlow(), ViewModelKt.getViewModelScope(viewModel), SharingStarted.Companion.WhileSubscribed$default(SharingStarted.Companion, 0L, 0L, 3, (Object) null), (Object) null);
this.linkEmailFlow = stateIn2;
this.walletsState = StateFlowsKt.combineStateFlows(viewModel, linkHandler.isLinkEnabled(), stateIn2, getGooglePayState$paymentsheet_release(), stateIn, getButtonsEnabled(), getSupportedPaymentMethodsFlow(), getBackStack(), new Function7<Boolean, String, GooglePayState, PaymentSheetViewState, Boolean, List<? extends String>, List<? extends PaymentSheetScreen>, WalletsState>() {
{
super(7);
}
public Object invoke(Object obj, Object obj2, Object obj3, Object obj4, Object obj5, Object obj6, Object obj7) {
return invoke((Boolean) obj, (String) obj2, (GooglePayState) obj3, (PaymentSheetViewState) obj4, ((Boolean) obj5).booleanValue(), (List<String>) obj6, (List<? extends PaymentSheetScreen>) obj7);
}
public final WalletsState invoke(Boolean bool, String str, GooglePayState googlePayState, PaymentSheetViewState paymentSheetViewState, boolean z, List<String> list, List<? extends PaymentSheetScreen> list2) {
GooglePayButtonType googlePayButtonType2;
Intrinsics.checkNotNullParameter(googlePayState, "googlePayState");
Intrinsics.checkNotNullParameter(list, "paymentMethodTypes");
Intrinsics.checkNotNullParameter(list2, "stack");
WalletsState.Companion companion = WalletsState.INSTANCE;
GooglePayPaymentMethodLauncher.Config googlePayLauncherConfig = PaymentSheetViewModel.this.getGooglePayLauncherConfig();
googlePayButtonType2 = PaymentSheetViewModel.this.googlePayButtonType;
return companion.create(bool, str, googlePayState, paymentSheetViewState, googlePayButtonType2, z, list, googlePayLauncherConfig, (PaymentSheetScreen) CollectionsKt.last(list2), (Function0) new AnonymousClass1(PaymentSheetViewModel.this), (Function0) new AnonymousClass2(linkHandler));
}
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
class AnonymousClass1 extends FunctionReferenceImpl implements Function0<Unit> {
AnonymousClass1(Object obj) {
super(0, obj, PaymentSheetViewModel.class, "checkoutWithGooglePay", "checkoutWithGooglePay()V", 0);
}
public Object invoke() {
m317invoke();
return Unit.INSTANCE;
}
public final void m317invoke() {
((PaymentSheetViewModel) this.receiver).checkoutWithGooglePay();
}
}
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
class AnonymousClass2 extends FunctionReferenceImpl implements Function0<Unit> {
AnonymousClass2(Object obj) {
super(0, obj, LinkHandler.class, "launchLink", "launchLink()V", 0);
}
public Object invoke() {
m318invoke();
return Unit.INSTANCE;
}
public final void m318invoke() {
((LinkHandler) this.receiver).launchLink();
}
}
});
BuildersKt.launch$default(ViewModelKt.getViewModelScope(viewModel), (CoroutineContext) null, (CoroutineStart) null, new AnonymousClass1(linkHandler, this, null), 3, (Object) null);
AnalyticsRequestFactory.Companion.regenerateSessionId();
eventReporter.onInit(getConfig(), args.getInitializationMode$paymentsheet_release() instanceof PaymentSheet.InitializationMode.DeferredIntent);
BuildersKt.launch$default(ViewModelKt.getViewModelScope(viewModel), (CoroutineContext) null, (CoroutineStart) null, new AnonymousClass2(null), 3, (Object) null);
this.shouldCompleteLinkFlowInline = true;
}
}
config = null;
this.googlePayLauncherConfig = config;
ViewModel viewModel2 = (ViewModel) this;
this.primaryButtonUiState = FlowKt.stateIn(primaryButtonUiStateMapper.forCompleteFlow(), ViewModelKt.getViewModelScope(viewModel2), SharingStarted.Companion.WhileSubscribed$default(SharingStarted.Companion, 0L, 0L, 3, (Object) null), (Object) null);
this.error = FlowKt.stateIn(new Flow<String>() {
public Object collect(FlowCollector flowCollector, Continuation continuation) {
Object collect = flow3.collect(new AnonymousClass2(flowCollector), continuation);
return collect == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? collect : Unit.INSTANCE;
}
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0007\u0010\u0000\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002\"\u0004\b\u0001\u0010\u00032\u0006\u0010\u0004\u001a\u0002H\u0002H\u008a@¢\u0006\u0004\b\u0005\u0010\u0006¨\u0006\b"}, d2 = {"<anonymous>", "", "T", "R", TTContentsEventConstants.Params.EVENT_PROPERTY_VALUE, "emit", "(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "kotlinx/coroutines/flow/FlowKt__EmittersKt$unsafeTransform$1$1", "kotlinx/coroutines/flow/FlowKt__TransformKt$map$$inlined$unsafeTransform$1$2"}, k = 3, mv = {1, 8, 0}, xi = 48)
public static final class AnonymousClass2<T> implements FlowCollector {
final FlowCollector $this_unsafeFlow;
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
@DebugMetadata(c = "com.stripe.android.paymentsheet.PaymentSheetViewModel$special$$inlined$map$1$2", f = "PaymentSheetViewModel.kt", i = {}, l = {223}, m = "emit", n = {}, s = {})
public static final class AnonymousClass1 extends ContinuationImpl {
Object L$0;
int label;
Object result;
public AnonymousClass1(Continuation continuation) {
super(continuation);
}
public final Object invokeSuspend(Object obj) {
this.result = obj;
this.label |= Integer.MIN_VALUE;
return AnonymousClass2.this.emit(null, (Continuation) this);
}
}
public AnonymousClass2(FlowCollector flowCollector) {
this.$this_unsafeFlow = flowCollector;
}
public final java.lang.Object emit(java.lang.Object r5, kotlin.coroutines.Continuation r6) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.paymentsheet.PaymentSheetViewModel$special$$inlined$map$1.AnonymousClass2.emit(java.lang.Object, kotlin.coroutines.Continuation):java.lang.Object");
}
}
}, ViewModelKt.getViewModelScope(viewModel2), SharingStarted.Companion.WhileSubscribed$default(SharingStarted.Companion, BluetoothScoJobKt.TIMEOUT, 0L, 2, (Object) null), (Object) null);
StateFlow<String> stateIn22 = FlowKt.stateIn(linkConfigurationCoordinator.getEmailFlow(), ViewModelKt.getViewModelScope(viewModel2), SharingStarted.Companion.WhileSubscribed$default(SharingStarted.Companion, 0L, 0L, 3, (Object) null), (Object) null);
this.linkEmailFlow = stateIn22;
this.walletsState = StateFlowsKt.combineStateFlows(viewModel2, linkHandler.isLinkEnabled(), stateIn22, getGooglePayState$paymentsheet_release(), stateIn, getButtonsEnabled(), getSupportedPaymentMethodsFlow(), getBackStack(), new Function7<Boolean, String, GooglePayState, PaymentSheetViewState, Boolean, List<? extends String>, List<? extends PaymentSheetScreen>, WalletsState>() {
{
super(7);
}
public Object invoke(Object obj, Object obj2, Object obj3, Object obj4, Object obj5, Object obj6, Object obj7) {
return invoke((Boolean) obj, (String) obj2, (GooglePayState) obj3, (PaymentSheetViewState) obj4, ((Boolean) obj5).booleanValue(), (List<String>) obj6, (List<? extends PaymentSheetScreen>) obj7);
}
public final WalletsState invoke(Boolean bool, String str, GooglePayState googlePayState, PaymentSheetViewState paymentSheetViewState, boolean z, List<String> list, List<? extends PaymentSheetScreen> list2) {
GooglePayButtonType googlePayButtonType2;
Intrinsics.checkNotNullParameter(googlePayState, "googlePayState");
Intrinsics.checkNotNullParameter(list, "paymentMethodTypes");
Intrinsics.checkNotNullParameter(list2, "stack");
WalletsState.Companion companion = WalletsState.INSTANCE;
GooglePayPaymentMethodLauncher.Config googlePayLauncherConfig = PaymentSheetViewModel.this.getGooglePayLauncherConfig();
googlePayButtonType2 = PaymentSheetViewModel.this.googlePayButtonType;
return companion.create(bool, str, googlePayState, paymentSheetViewState, googlePayButtonType2, z, list, googlePayLauncherConfig, (PaymentSheetScreen) CollectionsKt.last(list2), (Function0) new AnonymousClass1(PaymentSheetViewModel.this), (Function0) new AnonymousClass2(linkHandler));
}
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
class AnonymousClass1 extends FunctionReferenceImpl implements Function0<Unit> {
AnonymousClass1(Object obj) {
super(0, obj, PaymentSheetViewModel.class, "checkoutWithGooglePay", "checkoutWithGooglePay()V", 0);
}
public Object invoke() {
m317invoke();
return Unit.INSTANCE;
}
public final void m317invoke() {
((PaymentSheetViewModel) this.receiver).checkoutWithGooglePay();
}
}
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
class AnonymousClass2 extends FunctionReferenceImpl implements Function0<Unit> {
AnonymousClass2(Object obj) {
super(0, obj, LinkHandler.class, "launchLink", "launchLink()V", 0);
}
public Object invoke() {
m318invoke();
return Unit.INSTANCE;
}
public final void m318invoke() {
((LinkHandler) this.receiver).launchLink();
}
}
});
BuildersKt.launch$default(ViewModelKt.getViewModelScope(viewModel2), (CoroutineContext) null, (CoroutineStart) null, new AnonymousClass1(linkHandler, this, null), 3, (Object) null);
AnalyticsRequestFactory.Companion.regenerateSessionId();
eventReporter.onInit(getConfig(), args.getInitializationMode$paymentsheet_release() instanceof PaymentSheet.InitializationMode.DeferredIntent);
BuildersKt.launch$default(ViewModelKt.getViewModelScope(viewModel2), (CoroutineContext) null, (CoroutineStart) null, new AnonymousClass2(null), 3, (Object) null);
this.shouldCompleteLinkFlowInline = true;
}
public final SharedFlow<PaymentSheetResult> getPaymentSheetResult$paymentsheet_release() {
return this.paymentSheetResult;
}
public final MutableStateFlow<PaymentSheetViewState> getViewState$paymentsheet_release() {
return this.viewState;
}
public final CheckoutIdentifier getCheckoutIdentifier() {
return this.checkoutIdentifier;
}
public final void setCheckoutIdentifier$paymentsheet_release(CheckoutIdentifier checkoutIdentifier) {
Intrinsics.checkNotNullParameter(checkoutIdentifier, "<set-?>");
this.checkoutIdentifier = checkoutIdentifier;
}
public final StateFlow<PaymentSheetViewState> getGooglePayButtonState() {
return this.googlePayButtonState;
}
public final Flow<PaymentSheetViewState> getBuyButtonState() {
return this.buyButtonState;
}
public final boolean isProcessingPaymentIntent$paymentsheet_release() {
boolean isProcessingPayment;
isProcessingPayment = PaymentSheetViewModelKt.isProcessingPayment(this.args.getInitializationMode$paymentsheet_release());
return isProcessingPayment;
}
@Override
public PaymentSelection.New getNewPaymentSelection() {
return this.newPaymentSelection;
}
@Override
public void setNewPaymentSelection(PaymentSelection.New r1) {
this.newPaymentSelection = r1;
}
public final GooglePayPaymentMethodLauncher.Config getGooglePayLauncherConfig() {
return this.googlePayLauncherConfig;
}
@Override
public StateFlow<PrimaryButton.UIState> getPrimaryButtonUiState() {
return this.primaryButtonUiState;
}
@Override
public StateFlow<String> getError() {
return this.error;
}
@Override
public StateFlow<WalletsState> getWalletsState() {
return this.walletsState;
}
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 8, 0}, xi = 48)
@DebugMetadata(c = "com.stripe.android.paymentsheet.PaymentSheetViewModel$1", f = "PaymentSheetViewModel.kt", i = {}, l = {258}, m = "invokeSuspend", n = {}, s = {})
static final class AnonymousClass1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final LinkHandler $linkHandler;
int label;
final PaymentSheetViewModel this$0;
AnonymousClass1(LinkHandler linkHandler, PaymentSheetViewModel paymentSheetViewModel, Continuation<? super AnonymousClass1> continuation) {
super(2, continuation);
this.$linkHandler = linkHandler;
this.this$0 = paymentSheetViewModel;
}
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
return new AnonymousClass1(this.$linkHandler, this.this$0, continuation);
}
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return create(coroutineScope, continuation).invokeSuspend(Unit.INSTANCE);
}
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i2 = this.label;
if (i2 == 0) {
ResultKt.throwOnFailure(obj);
Flow<LinkHandler.ProcessingState> processingState = this.$linkHandler.getProcessingState();
final PaymentSheetViewModel paymentSheetViewModel = this.this$0;
this.label = 1;
if (processingState.collect(new FlowCollector<LinkHandler.ProcessingState>() {
public Object emit(Object obj2, Continuation continuation) {
return emit((LinkHandler.ProcessingState) obj2, (Continuation<? super Unit>) continuation);
}
public final Object emit(LinkHandler.ProcessingState processingState2, Continuation<? super Unit> continuation) {
PaymentSheetViewModel.this.handleLinkProcessingState(processingState2);
return Unit.INSTANCE;
}
}, (Continuation) this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i2 != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
}
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 8, 0}, xi = 48)
@DebugMetadata(c = "com.stripe.android.paymentsheet.PaymentSheetViewModel$2", f = "PaymentSheetViewModel.kt", i = {}, l = {273}, m = "invokeSuspend", n = {}, s = {})
static final class AnonymousClass2 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
int label;
AnonymousClass2(Continuation<? super AnonymousClass2> continuation) {
super(2, continuation);
}
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
return PaymentSheetViewModel.this.new AnonymousClass2(continuation);
}
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return create(coroutineScope, continuation).invokeSuspend(Unit.INSTANCE);
}
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i2 = this.label;
if (i2 == 0) {
ResultKt.throwOnFailure(obj);
this.label = 1;
if (PaymentSheetViewModel.this.loadPaymentSheetState((Continuation) this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i2 != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
}
@Override
public boolean getShouldCompleteLinkFlowInline() {
return this.shouldCompleteLinkFlowInline;
}
public final void handleLinkProcessingState(LinkHandler.ProcessingState processingState) {
Unit unit = null;
if (Intrinsics.areEqual(processingState, LinkHandler.ProcessingState.Cancelled.INSTANCE)) {
resetViewState$default(this, null, 1, null);
return;
}
if (processingState instanceof LinkHandler.ProcessingState.PaymentMethodCollected) {
updateSelection(new PaymentSelection.Saved(((LinkHandler.ProcessingState.PaymentMethodCollected) processingState).getPaymentMethod(), PaymentSelection.Saved.WalletType.Link));
checkout();
return;
}
if (processingState instanceof LinkHandler.ProcessingState.CompletedWithPaymentResult) {
onPaymentResult(((LinkHandler.ProcessingState.CompletedWithPaymentResult) processingState).getResult());
return;
}
if (processingState instanceof LinkHandler.ProcessingState.Error) {
onError(((LinkHandler.ProcessingState.Error) processingState).getMessage());
return;
}
if (Intrinsics.areEqual(processingState, LinkHandler.ProcessingState.Launched.INSTANCE)) {
startProcessing(CheckoutIdentifier.SheetBottomBuy);
return;
}
if (processingState instanceof LinkHandler.ProcessingState.PaymentDetailsCollected) {
PaymentSelection paymentSelection = ((LinkHandler.ProcessingState.PaymentDetailsCollected) processingState).getPaymentSelection();
if (paymentSelection != null) {
updateSelection(paymentSelection);
checkout((PaymentSelection) getSelection$paymentsheet_release().getValue(), CheckoutIdentifier.SheetBottomBuy);
unit = Unit.INSTANCE;
}
if (unit == null) {
checkout((PaymentSelection) getSelection$paymentsheet_release().getValue(), CheckoutIdentifier.SheetBottomBuy);
return;
}
return;
}
if (Intrinsics.areEqual(processingState, LinkHandler.ProcessingState.Ready.INSTANCE)) {
updatePrimaryButtonState(PrimaryButton.State.Ready.INSTANCE);
} else if (Intrinsics.areEqual(processingState, LinkHandler.ProcessingState.Started.INSTANCE)) {
updatePrimaryButtonState(PrimaryButton.State.StartProcessing.INSTANCE);
} else if (Intrinsics.areEqual(processingState, LinkHandler.ProcessingState.CompleteWithoutLink.INSTANCE)) {
checkout();
}
}
public final java.lang.Object loadPaymentSheetState(kotlin.coroutines.Continuation<? super kotlin.Unit> r6) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.paymentsheet.PaymentSheetViewModel.loadPaymentSheetState(kotlin.coroutines.Continuation):java.lang.Object");
}
private final void handlePaymentSheetStateLoadFailure(Throwable error) {
if (this.pendingPaymentResult instanceof InternalPaymentResult.Completed) {
handlePaymentCompleted(PaymentSheetLoadingExceptionKt.getAsPaymentSheetLoadingException(error).getUsedPaymentMethod(), true);
} else {
setStripeIntent(null);
onFatal(error);
}
this.pendingPaymentResult = null;
}
private final void handlePaymentSheetStateLoaded(PaymentSheetState.Full state) {
CardBrandChoiceEligibility.Ineligible ineligible;
GooglePayState.NotAvailable notAvailable;
Throwable throwable;
boolean isEligibleForCardBrandChoice = state.isEligibleForCardBrandChoice();
if (isEligibleForCardBrandChoice) {
ineligible = new CardBrandChoiceEligibility.Eligible(state.getConfig().getPreferredNetworks());
} else if (!isEligibleForCardBrandChoice) {
ineligible = CardBrandChoiceEligibility.Ineligible.INSTANCE;
} else {
throw new NoWhenBranchMatchedException();
}
setCbcEligibility(ineligible);
getSavedStateHandle().set(BaseSheetViewModel.SAVE_PAYMENT_METHODS, state.getCustomerPaymentMethods());
updateSelection(state.getPaymentSelection());
SavedStateHandle savedStateHandle = getSavedStateHandle();
if (state.isGooglePayReady()) {
notAvailable = GooglePayState.Available.INSTANCE;
} else {
notAvailable = GooglePayState.NotAvailable.INSTANCE;
}
savedStateHandle.set(BaseSheetViewModel.SAVE_GOOGLE_PAY_STATE, notAvailable);
setStripeIntent(state.getStripeIntent());
getLinkHandler().setupLink(state.getLinkState());
InternalPaymentResult internalPaymentResult = this.pendingPaymentResult;
String str = null;
InternalPaymentResult.Failed failed = internalPaymentResult instanceof InternalPaymentResult.Failed ? (InternalPaymentResult.Failed) internalPaymentResult : null;
if (failed != null && (throwable = failed.getThrowable()) != null) {
str = ExceptionKtKt.stripeErrorMessage(throwable, getApplication());
}
resetViewState(str);
transitionToFirstScreen();
}
public final void setupGooglePay(CoroutineScope lifecycleScope, ActivityResultLauncher<GooglePayPaymentMethodLauncherContractV2.Args> activityResultLauncher) {
Intrinsics.checkNotNullParameter(lifecycleScope, "lifecycleScope");
Intrinsics.checkNotNullParameter(activityResultLauncher, "activityResultLauncher");
GooglePayPaymentMethodLauncher.Config config = this.googlePayLauncherConfig;
if (config != null) {
this.googlePayPaymentMethodLauncher = GooglePayPaymentMethodLauncherFactory.DefaultImpls.create$default(this.googlePayPaymentMethodLauncherFactory, lifecycleScope, config, new GooglePayPaymentMethodLauncher.ReadyCallback() {
public final void onReady(boolean z) {
}
}, activityResultLauncher, false, 16, (Object) null);
}
}
static void resetViewState$default(PaymentSheetViewModel paymentSheetViewModel, String str, int i2, Object obj) {
if ((i2 & 1) != 0) {
str = null;
}
paymentSheetViewModel.resetViewState(str);
}
private final void resetViewState(String userErrorMessage) {
this.viewState.setValue(new PaymentSheetViewState.Reset(userErrorMessage != null ? new BaseSheetViewModel.UserErrorMessage(userErrorMessage) : null));
getSavedStateHandle().set(BaseSheetViewModel.SAVE_PROCESSING, false);
}
private final void startProcessing(CheckoutIdentifier checkoutIdentifier) {
int i2 = 1;
if (this.checkoutIdentifier != checkoutIdentifier) {
BaseSheetViewModel.UserErrorMessage userErrorMessage = null;
this.viewState.setValue(new PaymentSheetViewState.Reset(userErrorMessage, i2, userErrorMessage));
}
this.checkoutIdentifier = checkoutIdentifier;
getSavedStateHandle().set(BaseSheetViewModel.SAVE_PROCESSING, true);
this.viewState.setValue(PaymentSheetViewState.StartProcessing.INSTANCE);
}
public final void checkout() {
checkout((PaymentSelection) getSelection$paymentsheet_release().getValue(), CheckoutIdentifier.SheetBottomBuy);
}
public final void checkoutWithGooglePay() {
setContentVisible(false);
checkout(PaymentSelection.GooglePay.INSTANCE, CheckoutIdentifier.SheetTopGooglePay);
}
private final void checkout(PaymentSelection paymentSelection, CheckoutIdentifier identifier) {
Object m1547constructorimpl;
BacsMandateConfirmationLauncher bacsMandateConfirmationLauncher;
GooglePayPaymentMethodLauncher googlePayPaymentMethodLauncher;
String currencyCode;
Long amount;
startProcessing(identifier);
if (paymentSelection instanceof PaymentSelection.GooglePay) {
StripeIntent stripeIntent = (StripeIntent) getStripeIntent$paymentsheet_release().getValue();
if (stripeIntent == null || (googlePayPaymentMethodLauncher = this.googlePayPaymentMethodLauncher) == null) {
return;
}
boolean z = stripeIntent instanceof PaymentIntent;
PaymentIntent paymentIntent = z ? (PaymentIntent) stripeIntent : null;
if (paymentIntent == null || (currencyCode = paymentIntent.getCurrency()) == null) {
PaymentSheet.GooglePayConfiguration googlePayConfig = this.args.getGooglePayConfig();
currencyCode = googlePayConfig != null ? googlePayConfig.getCurrencyCode() : null;
if (currencyCode == null) {
currencyCode = "";
}
}
long j2 = 0;
if (z) {
Long amount2 = ((PaymentIntent) stripeIntent).getAmount();
if (amount2 != null) {
j2 = amount2.longValue();
}
} else {
if (!(stripeIntent instanceof SetupIntent)) {
throw new NoWhenBranchMatchedException();
}
PaymentSheet.GooglePayConfiguration googlePayConfig2 = this.args.getGooglePayConfig();
if (googlePayConfig2 != null && (amount = googlePayConfig2.getAmount()) != null) {
j2 = amount.longValue();
}
}
String id = stripeIntent.getId();
PaymentSheet.GooglePayConfiguration googlePayConfig3 = this.args.getGooglePayConfig();
googlePayPaymentMethodLauncher.present(currencyCode, j2, id, googlePayConfig3 != null ? googlePayConfig3.getLabel() : null);
return;
}
if (paymentSelection instanceof PaymentSelection.New.GenericPaymentMethod) {
PaymentSelection.New.GenericPaymentMethod genericPaymentMethod = (PaymentSelection.New.GenericPaymentMethod) paymentSelection;
if (Intrinsics.areEqual(genericPaymentMethod.getPaymentMethodCreateParams().getTypeCode(), PaymentMethod.Type.BacsDebit.code)) {
BacsMandateData fromPaymentSelection = BacsMandateData.INSTANCE.fromPaymentSelection(genericPaymentMethod);
if (fromPaymentSelection != null) {
try {
Result.Companion companion = Result.INSTANCE;
PaymentSheetViewModel paymentSheetViewModel = this;
bacsMandateConfirmationLauncher = this.bacsMandateConfirmationLauncher;
} catch (Throwable th) {
Result.Companion companion2 = Result.INSTANCE;
m1547constructorimpl = Result.m1547constructorimpl(ResultKt.createFailure(th));
}
if (bacsMandateConfirmationLauncher != null) {
m1547constructorimpl = Result.m1547constructorimpl(bacsMandateConfirmationLauncher);
if (Result.m1554isSuccessimpl(m1547constructorimpl)) {
((BacsMandateConfirmationLauncher) m1547constructorimpl).launch(fromPaymentSelection, getConfig().getAppearance());
}
if (Result.m1550exceptionOrNullimpl(m1547constructorimpl) != null) {
resetViewState(getApplication().getResources().getString(R.string.stripe_something_went_wrong));
}
Result.m1546boximpl(m1547constructorimpl);
return;
}
throw new IllegalArgumentException("Required value was null.".toString());
}
resetViewState(getApplication().getResources().getString(R.string.stripe_something_went_wrong));
return;
}
}
confirmPaymentSelection(paymentSelection);
}
public final void confirmStripeIntent(ConfirmStripeIntentParams confirmStripeIntentParams) {
Object m1547constructorimpl;
StripePaymentLauncher stripePaymentLauncher;
Intrinsics.checkNotNullParameter(confirmStripeIntentParams, "confirmStripeIntentParams");
try {
Result.Companion companion = Result.INSTANCE;
PaymentSheetViewModel paymentSheetViewModel = this;
stripePaymentLauncher = this.paymentLauncher;
} catch (Throwable th) {
Result.Companion companion2 = Result.INSTANCE;
m1547constructorimpl = Result.m1547constructorimpl(ResultKt.createFailure(th));
}
if (stripePaymentLauncher != null) {
m1547constructorimpl = Result.m1547constructorimpl(stripePaymentLauncher);
Throwable m1550exceptionOrNullimpl = Result.m1550exceptionOrNullimpl(m1547constructorimpl);
if (m1550exceptionOrNullimpl == null) {
StripePaymentLauncher stripePaymentLauncher2 = (StripePaymentLauncher) m1547constructorimpl;
if (confirmStripeIntentParams instanceof ConfirmPaymentIntentParams) {
stripePaymentLauncher2.confirm((ConfirmPaymentIntentParams) confirmStripeIntentParams);
return;
} else {
if (confirmStripeIntentParams instanceof ConfirmSetupIntentParams) {
stripePaymentLauncher2.confirm((ConfirmSetupIntentParams) confirmStripeIntentParams);
return;
}
return;
}
}
onFatal(m1550exceptionOrNullimpl);
return;
}
throw new IllegalArgumentException("Required value was null.".toString());
}
public final void handleNextAction(String clientSecret, StripeIntent stripeIntent) {
Object m1547constructorimpl;
StripePaymentLauncher stripePaymentLauncher;
try {
Result.Companion companion = Result.INSTANCE;
PaymentSheetViewModel paymentSheetViewModel = this;
stripePaymentLauncher = this.paymentLauncher;
} catch (Throwable th) {
Result.Companion companion2 = Result.INSTANCE;
m1547constructorimpl = Result.m1547constructorimpl(ResultKt.createFailure(th));
}
if (stripePaymentLauncher != null) {
m1547constructorimpl = Result.m1547constructorimpl(stripePaymentLauncher);
Throwable m1550exceptionOrNullimpl = Result.m1550exceptionOrNullimpl(m1547constructorimpl);
if (m1550exceptionOrNullimpl == null) {
StripePaymentLauncher stripePaymentLauncher2 = (StripePaymentLauncher) m1547constructorimpl;
if (stripeIntent instanceof PaymentIntent) {
stripePaymentLauncher2.handleNextActionForPaymentIntent(clientSecret);
return;
} else {
if (stripeIntent instanceof SetupIntent) {
stripePaymentLauncher2.handleNextActionForSetupIntent(clientSecret);
return;
}
return;
}
}
onFatal(m1550exceptionOrNullimpl);
return;
}
throw new IllegalArgumentException("Required value was null.".toString());
}
@Override
public void handlePaymentMethodSelected(PaymentSelection selection) {
if (((Boolean) getEditing$paymentsheet_release().getValue()).booleanValue() || Intrinsics.areEqual(selection, getSelection$paymentsheet_release().getValue())) {
return;
}
updateSelection(selection);
}
@Override
public void handleConfirmUSBankAccount(PaymentSelection.New.USBankAccount paymentSelection) {
Intrinsics.checkNotNullParameter(paymentSelection, "paymentSelection");
updateSelection(paymentSelection);
reportConfirmButtonPressed();
checkout();
}
@Override
public void clearErrorMessages() {
if (this.viewState.getValue() instanceof PaymentSheetViewState.Reset) {
this.viewState.setValue(new PaymentSheetViewState.Reset(null));
}
}
public final void registerFromActivity(ActivityResultCaller activityResultCaller, LifecycleOwner lifecycleOwner) {
Intrinsics.checkNotNullParameter(activityResultCaller, "activityResultCaller");
Intrinsics.checkNotNullParameter(lifecycleOwner, "lifecycleOwner");
getLinkHandler().registerFromActivity(activityResultCaller);
final ActivityResultLauncher<BacsMandateConfirmationContract.Args> registerForActivityResult = activityResultCaller.registerForActivityResult(new BacsMandateConfirmationContract(), new PaymentSheetViewModel$registerFromActivity$bacsActivityResultLauncher$1(this));
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "activityResultCaller.reg…csMandateResult\n )");
this.bacsMandateConfirmationLauncher = this.bacsMandateConfirmationLauncherFactory.create(registerForActivityResult);
StripePaymentLauncherAssistedFactory stripePaymentLauncherAssistedFactory = this.paymentLauncherFactory;
Integer statusBarColor$paymentsheet_release = this.args.getStatusBarColor$paymentsheet_release();
ActivityResultLauncher<PaymentLauncherContract.Args> registerForActivityResult2 = activityResultCaller.registerForActivityResult(new PaymentLauncherContract(), new PaymentSheetViewModel$registerFromActivity$1(this));
Function0<String> function0 = new Function0<String>() {
{
super(0);
}
public final String invoke() {
Lazy lazy;
lazy = PaymentSheetViewModel.this.lazyPaymentConfig;
return ((PaymentConfiguration) lazy.get()).getPublishableKey();
}
};
Function0<String> function02 = new Function0<String>() {
{
super(0);
}
public final String invoke() {
Lazy lazy;
lazy = PaymentSheetViewModel.this.lazyPaymentConfig;
return ((PaymentConfiguration) lazy.get()).getStripeAccountId();
}
};
Intrinsics.checkNotNullExpressionValue(registerForActivityResult2, "registerForActivityResul…ymentResult\n )");
this.paymentLauncher = stripePaymentLauncherAssistedFactory.create(function0, function02, statusBarColor$paymentsheet_release, true, registerForActivityResult2);
lifecycleOwner.getLifecycle().addObserver(new DefaultLifecycleObserver() {
public void onDestroy(LifecycleOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
PaymentSheetViewModel.this.paymentLauncher = null;
PaymentSheetViewModel.this.bacsMandateConfirmationLauncher = null;
registerForActivityResult.unregister();
PaymentSheetViewModel.this.getLinkHandler().unregisterFromActivity();
super.onDestroy(owner);
}
});
}
private final void confirmPaymentSelection(PaymentSelection paymentSelection) {
BuildersKt.launch$default(ViewModelKt.getViewModelScope((ViewModel) this), (CoroutineContext) null, (CoroutineStart) null, new PaymentSheetViewModel$confirmPaymentSelection$1(this, paymentSelection, null), 3, (Object) null);
}
@Override
public void onPaymentResult(PaymentResult paymentResult) {
Intrinsics.checkNotNullParameter(paymentResult, "paymentResult");
BuildersKt.launch$default(ViewModelKt.getViewModelScope((ViewModel) this), (CoroutineContext) null, (CoroutineStart) null, new PaymentSheetViewModel$onPaymentResult$1(this, paymentResult, null), 3, (Object) null);
}
public final void onInternalPaymentResult(InternalPaymentResult launcherResult) {
StripeIntent stripeIntent = (StripeIntent) getStripeIntent$paymentsheet_release().getValue();
if (stripeIntent == null) {
this.pendingPaymentResult = launcherResult;
return;
}
if (launcherResult instanceof InternalPaymentResult.Completed) {
processPayment(((InternalPaymentResult.Completed) launcherResult).getIntent(), PaymentResult.Completed.INSTANCE);
} else if (launcherResult instanceof InternalPaymentResult.Failed) {
processPayment(stripeIntent, new PaymentResult.Failed(((InternalPaymentResult.Failed) launcherResult).getThrowable()));
} else if (launcherResult instanceof InternalPaymentResult.Canceled) {
processPayment(stripeIntent, PaymentResult.Canceled.INSTANCE);
}
}
private final void handlePaymentFailed(Throwable error) {
getEventReporter().onPaymentFailure((PaymentSelection) getSelection$paymentsheet_release().getValue(), new PaymentSheetConfirmationError.Stripe(error));
resetViewState(ExceptionKtKt.stripeErrorMessage(error, getApplication()));
}
private final void handlePaymentCompleted(PaymentMethod paymentMethod, boolean finishImmediately) {
getEventReporter().onPaymentSuccess((PaymentSelection) getSelection$paymentsheet_release().getValue(), this.deferredIntentConfirmationType);
PaymentSelection.Saved saved = null;
Object[] objArr = 0;
Object[] objArr2 = 0;
this.deferredIntentConfirmationType = null;
PaymentSelection.Saved saved2 = (PaymentSelection) getSelection$paymentsheet_release().getValue();
if (saved2 instanceof PaymentSelection.New) {
if (!SelectionUtilsKt.canSave((PaymentSelection.New) saved2, this.args.getInitializationMode$paymentsheet_release())) {
paymentMethod = null;
}
if (paymentMethod != null) {
saved = new PaymentSelection.Saved(paymentMethod, objArr2 == true ? 1 : 0, 2, objArr == true ? 1 : 0);
}
saved2 = saved;
}
if (saved2 != null) {
getPrefsRepository().savePaymentSelection(saved2);
}
if (finishImmediately) {
this._paymentSheetResult.tryEmit(PaymentSheetResult.Completed.INSTANCE);
} else {
this.viewState.setValue(new PaymentSheetViewState.FinishProcessing(new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m313invoke();
return Unit.INSTANCE;
}
public final void m313invoke() {
MutableSharedFlow mutableSharedFlow;
mutableSharedFlow = PaymentSheetViewModel.this._paymentSheetResult;
mutableSharedFlow.tryEmit(PaymentSheetResult.Completed.INSTANCE);
}
}));
}
}
public final void processPayment(StripeIntent stripeIntent, PaymentResult paymentResult) {
if (paymentResult instanceof PaymentResult.Completed) {
handlePaymentCompleted(stripeIntent.getPaymentMethod(), false);
} else if (paymentResult instanceof PaymentResult.Failed) {
handlePaymentFailed(((PaymentResult.Failed) paymentResult).getThrowable());
} else if (paymentResult instanceof PaymentResult.Canceled) {
resetViewState$default(this, null, 1, null);
}
}
public final void onGooglePayResult$paymentsheet_release(GooglePayPaymentMethodLauncher.Result result) {
int i2;
Intrinsics.checkNotNullParameter(result, "result");
setContentVisible(true);
if (result instanceof GooglePayPaymentMethodLauncher.Result.Completed) {
PaymentSelection.Saved saved = new PaymentSelection.Saved(((GooglePayPaymentMethodLauncher.Result.Completed) result).getPaymentMethod(), PaymentSelection.Saved.WalletType.GooglePay);
updateSelection(saved);
confirmPaymentSelection(saved);
} else {
if (result instanceof GooglePayPaymentMethodLauncher.Result.Failed) {
GooglePayPaymentMethodLauncher.Result.Failed failed = (GooglePayPaymentMethodLauncher.Result.Failed) result;
getLogger().error("Error processing Google Pay payment", failed.getError());
getEventReporter().onPaymentFailure(PaymentSelection.GooglePay.INSTANCE, new PaymentSheetConfirmationError.GooglePay(failed.getErrorCode()));
if (failed.getErrorCode() == 3) {
i2 = com.stripe.android.R.string.stripe_failure_connection_error;
} else {
i2 = com.stripe.android.R.string.stripe_internal_error;
}
onError(Integer.valueOf(i2));
return;
}
if (result instanceof GooglePayPaymentMethodLauncher.Result.Canceled) {
resetViewState$default(this, null, 1, null);
}
}
}
public final void onBacsMandateResult(BacsMandateConfirmationResult result) {
if (result instanceof BacsMandateConfirmationResult.Confirmed) {
PaymentSelection paymentSelection = (PaymentSelection) getSelection$paymentsheet_release().getValue();
if ((paymentSelection instanceof PaymentSelection.New.GenericPaymentMethod) && Intrinsics.areEqual(((PaymentSelection.New.GenericPaymentMethod) paymentSelection).getPaymentMethodCreateParams().getTypeCode(), PaymentMethod.Type.BacsDebit.code)) {
confirmPaymentSelection(paymentSelection);
return;
}
return;
}
if (result instanceof BacsMandateConfirmationResult.ModifyDetails ? true : result instanceof BacsMandateConfirmationResult.Cancelled) {
resetViewState(null);
}
}
@Override
public void onFatal(Throwable throwable) {
Intrinsics.checkNotNullParameter(throwable, "throwable");
getLogger().error("Payment Sheet error", throwable);
setMostRecentError(throwable);
this._paymentSheetResult.tryEmit(new PaymentSheetResult.Failed(throwable));
}
@Override
public void onUserCancel() {
reportDismiss();
this._paymentSheetResult.tryEmit(PaymentSheetResult.Canceled.INSTANCE);
}
@Override
public void onFinish() {
this._paymentSheetResult.tryEmit(PaymentSheetResult.Completed.INSTANCE);
}
@Override
public void onError(Integer error) {
String str;
if (error != null) {
str = getApplication().getResources().getString(error.intValue());
} else {
str = null;
}
onError(str);
}
@Override
public void onError(String error) {
resetViewState(error);
}
@Override
public List<PaymentSheetScreen> determineInitialBackStack() {
PaymentSheetScreen.AddFirstPaymentMethod addFirstPaymentMethod;
Collection collection = (Collection) getPaymentMethods$paymentsheet_release().getValue();
if (!(collection == null || collection.isEmpty())) {
addFirstPaymentMethod = PaymentSheetScreen.SelectSavedPaymentMethods.INSTANCE;
} else {
addFirstPaymentMethod = PaymentSheetScreen.AddFirstPaymentMethod.INSTANCE;
}
return CollectionsKt.listOf(addFirstPaymentMethod);
}
@Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0000\u0018\u00002\u00020\u0001B\u0013\u0012\f\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003¢\u0006\u0002\u0010\u0005J-\u0010\u0006\u001a\u0002H\u0007\"\b\b\u0000\u0010\u0007*\u00020\b2\f\u0010\t\u001a\b\u0012\u0004\u0012\u0002H\u00070\n2\u0006\u0010\u000b\u001a\u00020\fH\u0016¢\u0006\u0002\u0010\rR\u0014\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000e"}, d2 = {"Lcom/stripe/android/paymentsheet/PaymentSheetViewModel$Factory;", "Landroidx/lifecycle/ViewModelProvider$Factory;", "starterArgsSupplier", "Lkotlin/Function0;", "Lcom/stripe/android/paymentsheet/PaymentSheetContractV2$Args;", "(Lkotlin/jvm/functions/Function0;)V", "create", "T", "Landroidx/lifecycle/ViewModel;", "modelClass", "Ljava/lang/Class;", "extras", "Landroidx/lifecycle/viewmodel/CreationExtras;", "(Ljava/lang/Class;Landroidx/lifecycle/viewmodel/CreationExtras;)Landroidx/lifecycle/ViewModel;", "paymentsheet_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static final class Factory implements ViewModelProvider.Factory {
private final Function0<PaymentSheetContractV2.Args> starterArgsSupplier;
public Factory(Function0<PaymentSheetContractV2.Args> function0) {
Intrinsics.checkNotNullParameter(function0, "starterArgsSupplier");
this.starterArgsSupplier = function0;
}
public <T extends ViewModel> T create(Class<T> modelClass, CreationExtras extras) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
Intrinsics.checkNotNullParameter(extras, "extras");
Application requireApplication = CreationExtrasKtxKt.requireApplication(extras);
T viewModel = DaggerPaymentSheetLauncherComponent.builder().application(requireApplication).build().getPaymentSheetViewModelSubcomponentBuilder().paymentSheetViewModelModule(new PaymentSheetViewModelModule((PaymentSheetContractV2.Args) this.starterArgsSupplier.invoke())).savedStateHandle(SavedStateHandleSupport.createSavedStateHandle(extras)).build().getViewModel();
Intrinsics.checkNotNull(viewModel, "null cannot be cast to non-null type T of com.stripe.android.paymentsheet.PaymentSheetViewModel.Factory.create");
return viewModel;
}
}
}