正在查看: BodyTech v7.6.4 应用的 PaymentSheetViewModel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BodyTech v7.6.4 应用的 PaymentSheetViewModel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.stripe.android.paymentsheet;
import android.app.Application;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultCaller;
import androidx.activity.result.ActivityResultLauncher;
import androidx.annotation.IntegerRes;
import androidx.compose.runtime.internal.StabilityInferred;
import androidx.compose.ui.input.pointer.PrimaryButton;
import androidx.compose.ui.input.pointer.e;
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 cl.b;
import com.stripe.android.analytics.SessionSavedStateHandler;
import com.stripe.android.googlepaylauncher.GooglePayEnvironment;
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncher;
import com.stripe.android.googlepaylauncher.injection.g;
import com.stripe.android.googlepaylauncher.j;
import com.stripe.android.model.ConfirmPaymentIntentParams;
import com.stripe.android.model.ConfirmSetupIntentParams;
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.core.analytics.ErrorReporter;
import com.stripe.android.payments.paymentlauncher.a;
import com.stripe.android.payments.paymentlauncher.c;
import com.stripe.android.payments.paymentlauncher.e;
import com.stripe.android.paymentsheet.LinkHandler;
import com.stripe.android.paymentsheet.PaymentSheet;
import com.stripe.android.paymentsheet.PaymentSheetViewModel;
import com.stripe.android.paymentsheet.analytics.EventReporter;
import com.stripe.android.paymentsheet.analytics.PaymentSheetConfirmationError;
import com.stripe.android.paymentsheet.injection.a1;
import com.stripe.android.paymentsheet.model.GooglePayButtonType;
import com.stripe.android.paymentsheet.model.PaymentSelection;
import com.stripe.android.paymentsheet.navigation.PaymentSheetScreen;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.BacsMandateData;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.a;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.d;
import com.stripe.android.paymentsheet.state.Full;
import com.stripe.android.paymentsheet.state.WalletsState;
import com.stripe.android.paymentsheet.state.k;
import com.stripe.android.paymentsheet.viewmodels.BaseSheetViewModel;
import com.stripe.android.paymentsheet.viewmodels.PrimaryButtonUiStateMapper;
import com.stripe.android.paymentsheet.w;
import com.stripe.android.paymentsheet.y;
import com.stripe.android.ui.core.Amount;
import com.stripe.android.uicore.utils.StateFlowsKt;
import com.stripe.android.view.BecsDebitAccountNumberEditText;
import gi.e;
import java.util.List;
import kotlin.Function;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Result;
import kotlin.Unit;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.enums.EnumEntries;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.functions.Function6;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.reflect.KClass;
import kotlin.time.DurationUnit;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.TimeoutKt;
import kotlinx.coroutines.channels.Channel;
import kotlinx.coroutines.channels.ChannelKt;
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;
import kotlinx.coroutines.scheduling.WorkQueueKt;
import yh.PaymentMethodMetadata;
@StabilityInferred(parameters = 0)
@Metadata(d1 = {"\u0000Ê\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u0003\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\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\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\b\u0003\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\u0002\b\f\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0002\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\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\b\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\b\u0006\b\u0000\u0018\u00002\u00020\u0001:\u0004ì\u0001í\u0001B·\u0001\b\u0001\u0012\b\u0010×\u0001\u001a\u00030Ö\u0001\u0012\u0006\u0010_\u001a\u00020Z\u0012\b\u0010Ù\u0001\u001a\u00030Ø\u0001\u0012\f\u0010d\u001a\b\u0012\u0004\u0012\u00020a0`\u0012\u0006\u0010h\u001a\u00020e\u0012\b\u0010Û\u0001\u001a\u00030Ú\u0001\u0012\b\u0010Ý\u0001\u001a\u00030Ü\u0001\u0012\u0006\u0010l\u001a\u00020i\u0012\u0006\u0010p\u001a\u00020m\u0012\u0006\u0010t\u001a\u00020q\u0012\b\u0010ß\u0001\u001a\u00030Þ\u0001\u0012\n\b\u0001\u0010á\u0001\u001a\u00030à\u0001\u0012\b\u0010ã\u0001\u001a\u00030â\u0001\u0012\b\u0010å\u0001\u001a\u00030ä\u0001\u0012\b\u0010ç\u0001\u001a\u00030æ\u0001\u0012\u0006\u0010x\u001a\u00020u\u0012\b\u0010é\u0001\u001a\u00030è\u0001\u0012\u0006\u0010|\u001a\u00020y¢\u0006\u0006\bê\u0001\u0010ë\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0002J\u0010\u0010\u0006\u001a\u00020\u0004H\u0082@¢\u0006\u0004\b\u0006\u0010\u0007J\u0010\u0010\n\u001a\u00020\u00042\u0006\u0010\t\u001a\u00020\bH\u0002J\u0018\u0010\r\u001a\u00020\u00042\u0006\u0010\f\u001a\u00020\u000bH\u0082@¢\u0006\u0004\b\r\u0010\u000eJ \u0010\u0011\u001a\u00020\u00042\u0006\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\t\u001a\u00020\bH\u0082@¢\u0006\u0004\b\u0011\u0010\u0012J\u0018\u0010\u0013\u001a\u00020\u00042\u0006\u0010\f\u001a\u00020\u000bH\u0082@¢\u0006\u0004\b\u0013\u0010\u000eJ\u0014\u0010\u0016\u001a\u00020\u00042\n\b\u0002\u0010\u0015\u001a\u0004\u0018\u00010\u0014H\u0002J\u0010\u0010\u0019\u001a\u00020\u00042\u0006\u0010\u0018\u001a\u00020\u0017H\u0002J\u001a\u0010\u001d\u001a\u00020\u00042\b\u0010\u001b\u001a\u0004\u0018\u00010\u001a2\u0006\u0010\u001c\u001a\u00020\u0017H\u0002J\u0018\u0010\u001f\u001a\u00020\u00042\u0006\u0010\u001e\u001a\u00020\u00142\u0006\u0010\u0010\u001a\u00020\u000fH\u0002J\u0012\u0010 \u001a\u00020\u00042\b\u0010\u001b\u001a\u0004\u0018\u00010\u001aH\u0002J\u0010\u0010#\u001a\u00020\u00042\u0006\u0010\"\u001a\u00020!H\u0002J\u0010\u0010&\u001a\u00020\u00042\u0006\u0010%\u001a\u00020$H\u0002J\u0010\u0010'\u001a\u00020\u00042\u0006\u0010\t\u001a\u00020\bH\u0002J\u001a\u0010,\u001a\u00020\u00042\b\u0010)\u001a\u0004\u0018\u00010(2\u0006\u0010+\u001a\u00020*H\u0002J\u0018\u0010-\u001a\u00020\u00042\u0006\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\"\u001a\u00020!H\u0002J\u0010\u00100\u001a\u00020\u00042\u0006\u0010/\u001a\u00020.H\u0002J\u0012\u00101\u001a\u0004\u0018\u00010$H\u0082@¢\u0006\u0004\b1\u0010\u0007J\b\u00102\u001a\u00020\u0004H\u0002J\u0010\u00103\u001a\u00020\u000fH\u0082@¢\u0006\u0004\b3\u0010\u0007J\u001c\u00106\u001a\u0004\u0018\u0001042\b\u00105\u001a\u0004\u0018\u0001042\u0006\u0010\u0018\u001a\u00020\u0017H\u0002J\u001c\u0010<\u001a\u00020\u00042\u0006\u00108\u001a\u0002072\f\u0010;\u001a\b\u0012\u0004\u0012\u00020:09J\u0006\u0010=\u001a\u00020\u0004J\u0006\u0010>\u001a\u00020\u0004J\u000e\u0010A\u001a\u00020\u00042\u0006\u0010@\u001a\u00020?J\u0012\u0010C\u001a\u00020\u00042\b\u0010B\u001a\u0004\u0018\u00010\u001aH\u0016J\u0010\u0010E\u001a\u00020\u00042\u0006\u0010\u001b\u001a\u00020DH\u0016J\b\u0010F\u001a\u00020\u0004H\u0016J\u0016\u0010K\u001a\u00020\u00042\u0006\u0010H\u001a\u00020G2\u0006\u0010J\u001a\u00020IJ\u0010\u0010L\u001a\u00020\u00042\u0006\u0010\"\u001a\u00020!H\u0016J\u0017\u0010N\u001a\u00020\u00042\u0006\u0010/\u001a\u00020MH\u0000¢\u0006\u0004\bN\u0010OJ\u0010\u0010Q\u001a\u00020\u00042\u0006\u0010P\u001a\u00020\bH\u0016J\b\u0010R\u001a\u00020\u0004H\u0016J\u001b\u0010T\u001a\u00020\u00042\n\b\u0001\u0010\t\u001a\u0004\u0018\u00010SH\u0016¢\u0006\u0004\bT\u0010UJ\u0012\u0010V\u001a\u00020\u00042\b\u0010\t\u001a\u0004\u0018\u00010\u0014H\u0016J\u000e\u0010Y\u001a\b\u0012\u0004\u0012\u00020X0WH\u0016R\u001a\u0010_\u001a\u00020Z8\u0000X\u0080\u0004¢\u0006\f\n\u0004\b[\u0010\\\u001a\u0004\b]\u0010^R\u001a\u0010d\u001a\b\u0012\u0004\u0012\u00020a0`8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bb\u0010cR\u0014\u0010h\u001a\u00020e8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bf\u0010gR\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\u0010|\u001a\u00020y8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bz\u0010{R\u0015\u0010\u0080\u0001\u001a\u00020}8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b~\u0010\u007fR\u001f\u0010\u0085\u0001\u001a\n\u0012\u0005\u0012\u00030\u0082\u00010\u0081\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b\u0083\u0001\u0010\u0084\u0001R'\u0010\u008b\u0001\u001a\n\u0012\u0005\u0012\u00030\u0082\u00010\u0086\u00018\u0000X\u0080\u0004¢\u0006\u0010\n\u0006\b\u0087\u0001\u0010\u0088\u0001\u001a\u0006\b\u0089\u0001\u0010\u008a\u0001R/\u00105\u001a\u000b\u0012\u0006\u0012\u0004\u0018\u0001040\u008c\u00018\u0000X\u0081\u0004¢\u0006\u0018\n\u0006\b\u008d\u0001\u0010\u008e\u0001\u0012\u0006\b\u0091\u0001\u0010\u0092\u0001\u001a\u0006\b\u008f\u0001\u0010\u0090\u0001R(\u0010\u0018\u001a\u00020\u00178\u0000@\u0000X\u0080\u000e¢\u0006\u0018\n\u0006\b\u0093\u0001\u0010\u0094\u0001\u001a\u0006\b\u0095\u0001\u0010\u0096\u0001\"\u0006\b\u0097\u0001\u0010\u0098\u0001R%\u0010\u009e\u0001\u001a\u000b\u0012\u0006\u0012\u0004\u0018\u0001040\u0099\u00018\u0006¢\u0006\u0010\n\u0006\b\u009a\u0001\u0010\u009b\u0001\u001a\u0006\b\u009c\u0001\u0010\u009d\u0001R,\u0010¦\u0001\u001a\u0005\u0018\u00010\u009f\u00018\u0016@\u0016X\u0096\u000e¢\u0006\u0018\n\u0006\b \u0001\u0010¡\u0001\u001a\u0006\b¢\u0001\u0010£\u0001\"\u0006\b¤\u0001\u0010¥\u0001R\u001b\u0010©\u0001\u001a\u0005\u0018\u00010§\u00018\u0002@\u0002X\u0082\u000e¢\u0006\u0007\n\u0005\bE\u0010¨\u0001R\u001b\u0010¬\u0001\u001a\u0005\u0018\u00010ª\u00018\u0002@\u0002X\u0082\u000e¢\u0006\u0007\n\u0005\bC\u0010«\u0001R\"\u0010°\u0001\u001a\u000b\u0012\u0005\u0012\u00030\u00ad\u0001\u0018\u0001098\u0002@\u0002X\u0082\u000e¢\u0006\b\n\u0006\b®\u0001\u0010¯\u0001R\u001c\u0010´\u0001\u001a\u0005\u0018\u00010±\u00018\u0002@\u0002X\u0082\u000e¢\u0006\b\n\u0006\b²\u0001\u0010³\u0001R\u0018\u0010¸\u0001\u001a\u00030µ\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b¶\u0001\u0010·\u0001R \u0010¼\u0001\u001a\t\u0012\u0004\u0012\u00020$0¹\u00018\u0002@\u0002X\u0082\u000e¢\u0006\b\n\u0006\bº\u0001\u0010»\u0001R)\u0010Â\u0001\u001a\u0005\u0018\u00010½\u00018\u0000X\u0081\u0004¢\u0006\u0017\n\u0005\bV\u0010¾\u0001\u0012\u0006\bÁ\u0001\u0010\u0092\u0001\u001a\u0006\b¿\u0001\u0010À\u0001R(\u0010Å\u0001\u001a\f\u0012\u0007\u0012\u0005\u0018\u00010Ã\u00010\u0099\u00018\u0016X\u0096\u0004¢\u0006\u000f\n\u0006\bÄ\u0001\u0010\u009b\u0001\u001a\u0005\bj\u0010\u009d\u0001R'\u0010\t\u001a\u000b\u0012\u0006\u0012\u0004\u0018\u00010\u00140\u0099\u00018\u0016X\u0096\u0004¢\u0006\u0010\n\u0006\bÆ\u0001\u0010\u009b\u0001\u001a\u0006\bÇ\u0001\u0010\u009d\u0001R)\u0010Ê\u0001\u001a\f\u0012\u0007\u0012\u0005\u0018\u00010È\u00010\u0099\u00018\u0016X\u0096\u0004¢\u0006\u0010\n\u0006\bÉ\u0001\u0010\u009b\u0001\u001a\u0006\b\u0093\u0001\u0010\u009d\u0001R(\u0010Ì\u0001\u001a\f\u0012\u0007\u0012\u0005\u0018\u00010Ë\u00010\u0099\u00018\u0016X\u0096\u0004¢\u0006\u000f\n\u0005\bR\u0010\u009b\u0001\u001a\u0006\b\u008d\u0001\u0010\u009d\u0001R\u001c\u0010Ð\u0001\u001a\u0005\u0018\u00010Í\u00018\u0002@\u0002X\u0082\u000e¢\u0006\b\n\u0006\bÎ\u0001\u0010Ï\u0001R\u001d\u0010Ó\u0001\u001a\u00020*8\u0016X\u0096D¢\u0006\u000e\n\u0005\bÑ\u0001\u0010v\u001a\u0005\bz\u0010Ò\u0001R\u0017\u0010Õ\u0001\u001a\u00020*8@X\u0080\u0004¢\u0006\b\u001a\u0006\bÔ\u0001\u0010Ò\u0001¨\u0006î\u0001"}, d2 = {"Lcom/stripe/android/paymentsheet/PaymentSheetViewModel;", "Lcom/stripe/android/paymentsheet/viewmodels/BaseSheetViewModel;", "Lcom/stripe/android/paymentsheet/LinkHandler$a;", "processingState", "", "L1", "U1", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "", "error", "P1", "Lcom/stripe/android/paymentsheet/state/j;", "state", "Q1", "(Lcom/stripe/android/paymentsheet/state/j;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "Lcom/stripe/android/model/StripeIntent;", "stripeIntent", "R1", "(Lcom/stripe/android/model/StripeIntent;Ljava/lang/Throwable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "S1", "", "userErrorMessage", "f2", "Lcom/stripe/android/paymentsheet/PaymentSheetViewModel$CheckoutIdentifier;", "checkoutIdentifier", "j2", "Lcom/stripe/android/paymentsheet/model/PaymentSelection;", "paymentSelection", "identifier", "D1", "clientSecret", "M1", "F1", "Lcom/stripe/android/payments/paymentlauncher/e;", "paymentResult", "Y1", "Lcom/stripe/android/payments/paymentlauncher/a;", "launcherResult", "b2", "O1", "Lcom/stripe/android/model/PaymentMethod;", "paymentMethod", "", "finishImmediately", "N1", "d2", "Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/d;", "result", "W1", "A1", "k2", "B1", "Lgi/e;", "viewState", "V1", "Lkotlinx/coroutines/CoroutineScope;", "lifecycleScope", "Landroidx/activity/result/ActivityResultLauncher;", "Lcom/stripe/android/googlepaylauncher/j$a;", "activityResultLauncher", "h2", "C1", "E1", "Lai/d;", "confirmStripeIntentParams", "G1", "selection", "j0", "Lcom/stripe/android/paymentsheet/model/PaymentSelection$d$d;", "i0", "o", "Landroidx/activity/result/ActivityResultCaller;", "activityResultCaller", "Landroidx/lifecycle/LifecycleOwner;", "lifecycleOwner", "e2", "c2", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$d;", "a2", "(Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$d;)V", "throwable", "Z1", "s0", "", "X1", "(Ljava/lang/Integer;)V", "o0", "", "Lcom/stripe/android/paymentsheet/navigation/PaymentSheetScreen;", "q", "Lcom/stripe/android/paymentsheet/w$a;", "T", "Lcom/stripe/android/paymentsheet/w$a;", "H1", "()Lcom/stripe/android/paymentsheet/w$a;", "args", "Ldj/a;", "Lcom/stripe/android/o;", "U", "Ldj/a;", "lazyPaymentConfig", "Lcom/stripe/android/paymentsheet/state/g;", "V", "Lcom/stripe/android/paymentsheet/state/g;", "paymentSheetLoader", "Lcom/stripe/android/payments/paymentlauncher/g;", "W", "Lcom/stripe/android/payments/paymentlauncher/g;", "paymentLauncherFactory", "Lcom/stripe/android/googlepaylauncher/injection/g;", "X", "Lcom/stripe/android/googlepaylauncher/injection/g;", "googlePayPaymentMethodLauncherFactory", "Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/c;", "Y", "Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/c;", "bacsMandateConfirmationLauncherFactory", "Lcom/stripe/android/paymentsheet/n;", "Z", "Lcom/stripe/android/paymentsheet/n;", "intentConfirmationInterceptor", "Lcom/stripe/android/payments/core/analytics/ErrorReporter;", "a0", "Lcom/stripe/android/payments/core/analytics/ErrorReporter;", "errorReporter", "Lcom/stripe/android/paymentsheet/viewmodels/PrimaryButtonUiStateMapper;", "b0", "Lcom/stripe/android/paymentsheet/viewmodels/PrimaryButtonUiStateMapper;", "primaryButtonUiStateMapper", "Lkotlinx/coroutines/flow/MutableSharedFlow;", "Lcom/stripe/android/paymentsheet/y;", "c0", "Lkotlinx/coroutines/flow/MutableSharedFlow;", "_paymentSheetResult", "Lkotlinx/coroutines/flow/SharedFlow;", "d0", "Lkotlinx/coroutines/flow/SharedFlow;", "K1", "()Lkotlinx/coroutines/flow/SharedFlow;", "paymentSheetResult", "Lkotlinx/coroutines/flow/MutableStateFlow;", "e0", "Lkotlinx/coroutines/flow/MutableStateFlow;", "getViewState$paymentsheet_release", "()Lkotlinx/coroutines/flow/MutableStateFlow;", "getViewState$paymentsheet_release$annotations", "()V", "f0", "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", "Lkotlinx/coroutines/flow/StateFlow;", "g0", "Lkotlinx/coroutines/flow/StateFlow;", "I1", "()Lkotlinx/coroutines/flow/StateFlow;", "buyButtonState", "Lcom/stripe/android/paymentsheet/viewmodels/BaseSheetViewModel$b;", "h0", "Lcom/stripe/android/paymentsheet/viewmodels/BaseSheetViewModel$b;", "N", "()Lcom/stripe/android/paymentsheet/viewmodels/BaseSheetViewModel$b;", "M0", "(Lcom/stripe/android/paymentsheet/viewmodels/BaseSheetViewModel$b;)V", "newPaymentSelection", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher;", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher;", "googlePayPaymentMethodLauncher", "Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/b;", "Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/b;", "bacsMandateConfirmationLauncher", "Lcom/stripe/android/paymentsheet/j;", "k0", "Landroidx/activity/result/ActivityResultLauncher;", "externalPaymentMethodLauncher", "Lcom/stripe/android/paymentsheet/DeferredIntentConfirmationType;", "l0", "Lcom/stripe/android/paymentsheet/DeferredIntentConfirmationType;", "deferredIntentConfirmationType", "Lcom/stripe/android/paymentsheet/model/GooglePayButtonType;", "m0", "Lcom/stripe/android/paymentsheet/model/GooglePayButtonType;", "googlePayButtonType", "Lkotlinx/coroutines/channels/Channel;", "n0", "Lkotlinx/coroutines/channels/Channel;", "pendingPaymentResultChannel", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$b;", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$b;", "J1", "()Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$b;", "getGooglePayLauncherConfig$paymentsheet_release$annotations", "googlePayLauncherConfig", "Lcom/stripe/android/paymentsheet/ui/PrimaryButton$UIState;", "p0", "primaryButtonUiState", "q0", "A", "Lcom/stripe/android/paymentsheet/state/l;", "r0", "walletsState", "Lcom/stripe/android/paymentsheet/state/k;", "walletsProcessingState", "Lcom/stripe/android/payments/paymentlauncher/f;", "t0", "Lcom/stripe/android/payments/paymentlauncher/f;", "paymentLauncher", "u0", "()Z", "shouldCompleteLinkFlowInline", "T1", "isProcessingPaymentIntent", "Landroid/app/Application;", "application", "Lcom/stripe/android/paymentsheet/analytics/EventReporter;", "eventReporter", "Lcom/stripe/android/paymentsheet/repositories/b;", "customerRepository", "Lcom/stripe/android/paymentsheet/c0;", "prefsRepository", "Llh/d;", "logger", "Lkotlin/coroutines/CoroutineContext;", "workContext", "Landroidx/lifecycle/SavedStateHandle;", "savedStateHandle", "Lcom/stripe/android/paymentsheet/LinkHandler;", "linkHandler", "Lcom/stripe/android/link/e;", "linkConfigurationCoordinator", "Lcom/stripe/android/paymentsheet/ui/e$a;", "editInteractorFactory", "<init>", "(Landroid/app/Application;Lcom/stripe/android/paymentsheet/w$a;Lcom/stripe/android/paymentsheet/analytics/EventReporter;Ldj/a;Lcom/stripe/android/paymentsheet/state/g;Lcom/stripe/android/paymentsheet/repositories/b;Lcom/stripe/android/paymentsheet/c0;Lcom/stripe/android/payments/paymentlauncher/g;Lcom/stripe/android/googlepaylauncher/injection/g;Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/c;Llh/d;Lkotlin/coroutines/CoroutineContext;Landroidx/lifecycle/SavedStateHandle;Lcom/stripe/android/paymentsheet/LinkHandler;Lcom/stripe/android/link/e;Lcom/stripe/android/paymentsheet/n;Lcom/stripe/android/paymentsheet/ui/e$a;Lcom/stripe/android/payments/core/analytics/ErrorReporter;)V", "CheckoutIdentifier", "a", "paymentsheet_release"}, k = 1, mv = {1, 9, 0})
public final class PaymentSheetViewModel extends BaseSheetViewModel {
private final w.Args args;
private final dj.a<com.stripe.android.o> lazyPaymentConfig;
private final com.stripe.android.paymentsheet.state.g paymentSheetLoader;
private final com.stripe.android.payments.paymentlauncher.g paymentLauncherFactory;
private final com.stripe.android.googlepaylauncher.injection.g googlePayPaymentMethodLauncherFactory;
private final com.stripe.android.paymentsheet.paymentdatacollection.bacs.c bacsMandateConfirmationLauncherFactory;
private final n intentConfirmationInterceptor;
private final ErrorReporter errorReporter;
private final PrimaryButtonUiStateMapper primaryButtonUiStateMapper;
private final MutableSharedFlow<y> _paymentSheetResult;
private final SharedFlow<y> paymentSheetResult;
private final MutableStateFlow<gi.e> viewState;
private CheckoutIdentifier checkoutIdentifier;
private final StateFlow<gi.e> buyButtonState;
private BaseSheetViewModel.b newPaymentSelection;
private GooglePayPaymentMethodLauncher googlePayPaymentMethodLauncher;
private com.stripe.android.paymentsheet.paymentdatacollection.bacs.b bacsMandateConfirmationLauncher;
private ActivityResultLauncher<ExternalPaymentMethodInput> externalPaymentMethodLauncher;
private DeferredIntentConfirmationType deferredIntentConfirmationType;
private final GooglePayButtonType googlePayButtonType;
private Channel<com.stripe.android.payments.paymentlauncher.a> pendingPaymentResultChannel;
private final GooglePayPaymentMethodLauncher.Config googlePayLauncherConfig;
private final StateFlow<PrimaryButton.UIState> primaryButtonUiState;
private final StateFlow<String> error;
private final StateFlow<WalletsState> walletsState;
private final StateFlow<com.stripe.android.paymentsheet.state.k> walletsProcessingState;
private com.stripe.android.payments.paymentlauncher.f paymentLauncher;
private final boolean shouldCompleteLinkFlowInline;
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\u0010\u0002\u001a\u00020\u0001*\u00020\u0000H\u008a@"}, d2 = {"Lkotlinx/coroutines/CoroutineScope;", "", "<anonymous>"}, k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0})
@kotlin.coroutines.jvm.internal.c(c = "com.stripe.android.paymentsheet.PaymentSheetViewModel$1", f = "PaymentSheetViewModel.kt", l = {258}, m = "invokeSuspend")
static final class AnonymousClass1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final LinkHandler $linkHandler;
int label;
final PaymentSheetViewModel this$0;
@Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0001\u001a\u00020\u0000H\u008a@¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"Lcom/stripe/android/paymentsheet/LinkHandler$a;", "processingState", "", "a", "(Lcom/stripe/android/paymentsheet/LinkHandler$a;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;"}, k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0})
static final class a<T> implements FlowCollector {
final PaymentSheetViewModel c;
a(PaymentSheetViewModel paymentSheetViewModel) {
this.c = paymentSheetViewModel;
}
@Override
public final Object emit(LinkHandler.a aVar, Continuation<? super Unit> continuation) {
this.c.L1(aVar);
return Unit.a;
}
}
AnonymousClass1(LinkHandler linkHandler, PaymentSheetViewModel paymentSheetViewModel, Continuation<? super AnonymousClass1> continuation) {
super(2, continuation);
this.$linkHandler = linkHandler;
this.this$0 = paymentSheetViewModel;
}
@Override
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
return new AnonymousClass1(this.$linkHandler, this.this$0, continuation);
}
@Override
public final Object invokeSuspend(Object obj) {
Object f;
f = kotlin.coroutines.intrinsics.b.f();
int i = this.label;
if (i == 0) {
kotlin.f.b(obj);
Flow<LinkHandler.a> h = this.$linkHandler.h();
a aVar = new a(this.this$0);
this.label = 1;
if (h.collect(aVar, this) == f) {
return f;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
kotlin.f.b(obj);
}
return Unit.a;
}
@Override
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((AnonymousClass1) create(coroutineScope, continuation)).invokeSuspend(Unit.a);
}
}
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\u0010\u0002\u001a\u00020\u0001*\u00020\u0000H\u008a@"}, d2 = {"Lkotlinx/coroutines/CoroutineScope;", "", "<anonymous>"}, k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0})
@kotlin.coroutines.jvm.internal.c(c = "com.stripe.android.paymentsheet.PaymentSheetViewModel$2", f = "PaymentSheetViewModel.kt", l = {271}, m = "invokeSuspend")
static final class AnonymousClass2 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
int label;
AnonymousClass2(Continuation<? super AnonymousClass2> continuation) {
super(2, continuation);
}
@Override
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
return PaymentSheetViewModel.this.new AnonymousClass2(continuation);
}
@Override
public final Object invokeSuspend(Object obj) {
Object f;
f = kotlin.coroutines.intrinsics.b.f();
int i = this.label;
if (i == 0) {
kotlin.f.b(obj);
PaymentSheetViewModel paymentSheetViewModel = PaymentSheetViewModel.this;
this.label = 1;
if (paymentSheetViewModel.U1(this) == f) {
return f;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
kotlin.f.b(obj);
}
return Unit.a;
}
@Override
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((AnonymousClass2) create(coroutineScope, continuation)).invokeSuspend(Unit.a);
}
}
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0006\b\u0080\u0081\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003j\u0002\b\u0004j\u0002\b\u0005j\u0002\b\u0006¨\u0006\u0007"}, d2 = {"Lcom/stripe/android/paymentsheet/PaymentSheetViewModel$CheckoutIdentifier;", "", "<init>", "(Ljava/lang/String;I)V", "c", "d", "e", "paymentsheet_release"}, k = 1, mv = {1, 9, 0})
public static final class CheckoutIdentifier {
public static final CheckoutIdentifier c = new CheckoutIdentifier("SheetTopWallet", 0);
public static final CheckoutIdentifier d = new CheckoutIdentifier("SheetBottomBuy", 1);
public static final CheckoutIdentifier e = new CheckoutIdentifier("None", 2);
private static final CheckoutIdentifier[] k;
private static final EnumEntries n;
static {
CheckoutIdentifier[] a = a();
k = a;
n = kotlin.enums.a.a(a);
}
private CheckoutIdentifier(String str, int i) {
}
private static final CheckoutIdentifier[] a() {
return new CheckoutIdentifier[]{c, d, e};
}
public static CheckoutIdentifier valueOf(String str) {
return (CheckoutIdentifier) Enum.valueOf(CheckoutIdentifier.class, str);
}
public static CheckoutIdentifier[] values() {
return (CheckoutIdentifier[]) k.clone();
}
}
@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/paymentsheet/PaymentSheetViewModel$a;", "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/paymentsheet/w$a;", "a", "Lkotlin/jvm/functions/Function0;", "starterArgsSupplier", "<init>", "(Lkotlin/jvm/functions/Function0;)V", "paymentsheet_release"}, k = 1, mv = {1, 9, 0})
public static final class a implements ViewModelProvider.Factory {
private final Function0<w.Args> starterArgsSupplier;
public a(Function0<w.Args> starterArgsSupplier) {
kotlin.jvm.internal.r.i(starterArgsSupplier, "starterArgsSupplier");
this.starterArgsSupplier = starterArgsSupplier;
}
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) {
kotlin.jvm.internal.r.i(modelClass, "modelClass");
kotlin.jvm.internal.r.i(extras, "extras");
Application a = sh.b.a(extras);
PaymentSheetViewModel a2 = com.stripe.android.paymentsheet.injection.y.a().b(a).build().a().b(new a1(this.starterArgsSupplier.invoke())).a(SavedStateHandleSupport.createSavedStateHandle(extras)).build().a();
kotlin.jvm.internal.r.g(a2, "null cannot be cast to non-null type T of com.stripe.android.paymentsheet.PaymentSheetViewModel.Factory.create");
return a2;
}
}
@Metadata(k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0}, xi = 48)
public class b {
public static final int[] a;
public static final int[] b;
static {
int[] iArr = new int[PaymentSheet.GooglePayConfiguration.ButtonType.values().length];
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.c.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.d.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.e.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.k.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.n.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.q.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.r.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
iArr[PaymentSheet.GooglePayConfiguration.ButtonType.p.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
a = iArr;
int[] iArr2 = new int[PaymentSheet.GooglePayConfiguration.Environment.values().length];
try {
iArr2[PaymentSheet.GooglePayConfiguration.Environment.c.ordinal()] = 1;
} catch (NoSuchFieldError unused9) {
}
b = iArr2;
}
}
@Metadata(k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0}, xi = 48)
class c implements ActivityResultCallback, kotlin.jvm.internal.o {
c() {
}
public final void onActivityResult(com.stripe.android.payments.paymentlauncher.a p0) {
kotlin.jvm.internal.r.i(p0, "p0");
PaymentSheetViewModel.this.b2(p0);
}
public final boolean equals(Object obj) {
if ((obj instanceof ActivityResultCallback) && (obj instanceof kotlin.jvm.internal.o)) {
return kotlin.jvm.internal.r.d(getFunctionDelegate(), ((kotlin.jvm.internal.o) obj).getFunctionDelegate());
}
return false;
}
@Override
public final Function<?> getFunctionDelegate() {
return new FunctionReferenceImpl(1, PaymentSheetViewModel.this, PaymentSheetViewModel.class, "onInternalPaymentResult", "onInternalPaymentResult(Lcom/stripe/android/payments/paymentlauncher/InternalPaymentResult;)V", 0);
}
public final int hashCode() {
return getFunctionDelegate().hashCode();
}
}
@Metadata(k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0}, xi = 48)
class d implements ActivityResultCallback, kotlin.jvm.internal.o {
d() {
}
public final void onActivityResult(com.stripe.android.payments.paymentlauncher.e p0) {
kotlin.jvm.internal.r.i(p0, "p0");
PaymentSheetViewModel.this.Y1(p0);
}
public final boolean equals(Object obj) {
if ((obj instanceof ActivityResultCallback) && (obj instanceof kotlin.jvm.internal.o)) {
return kotlin.jvm.internal.r.d(getFunctionDelegate(), ((kotlin.jvm.internal.o) obj).getFunctionDelegate());
}
return false;
}
@Override
public final Function<?> getFunctionDelegate() {
return new FunctionReferenceImpl(1, PaymentSheetViewModel.this, PaymentSheetViewModel.class, "onExternalPaymentMethodResult", "onExternalPaymentMethodResult(Lcom/stripe/android/payments/paymentlauncher/PaymentResult;)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/paymentsheet/PaymentSheetViewModel$e", "Landroidx/lifecycle/DefaultLifecycleObserver;", "Landroidx/lifecycle/LifecycleOwner;", "owner", "", "onDestroy", "paymentsheet_release"}, k = 1, mv = {1, 9, 0})
public static final class e implements DefaultLifecycleObserver {
final ActivityResultLauncher<a.Args> d;
e(ActivityResultLauncher<a.Args> activityResultLauncher) {
this.d = activityResultLauncher;
}
public void onCreate(LifecycleOwner lifecycleOwner) {
androidx.lifecycle.c.a(this, lifecycleOwner);
}
public void onDestroy(LifecycleOwner owner) {
kotlin.jvm.internal.r.i(owner, "owner");
PaymentSheetViewModel.this.paymentLauncher = null;
PaymentSheetViewModel.this.bacsMandateConfirmationLauncher = null;
this.d.unregister();
PaymentSheetViewModel.this.getLinkHandler().p();
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);
}
}
@Metadata(k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0}, xi = 48)
class f implements ActivityResultCallback, kotlin.jvm.internal.o {
f() {
}
public final void onActivityResult(com.stripe.android.paymentsheet.paymentdatacollection.bacs.d p0) {
kotlin.jvm.internal.r.i(p0, "p0");
PaymentSheetViewModel.this.W1(p0);
}
public final boolean equals(Object obj) {
if ((obj instanceof ActivityResultCallback) && (obj instanceof kotlin.jvm.internal.o)) {
return kotlin.jvm.internal.r.d(getFunctionDelegate(), ((kotlin.jvm.internal.o) obj).getFunctionDelegate());
}
return false;
}
@Override
public final Function<?> getFunctionDelegate() {
return new FunctionReferenceImpl(1, PaymentSheetViewModel.this, PaymentSheetViewModel.class, "onBacsMandateResult", "onBacsMandateResult(Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/BacsMandateConfirmationResult;)V", 0);
}
public final int hashCode() {
return getFunctionDelegate().hashCode();
}
}
public PaymentSheetViewModel(Application application, w.Args args, EventReporter eventReporter, dj.a<com.stripe.android.o> lazyPaymentConfig, com.stripe.android.paymentsheet.state.g paymentSheetLoader, com.stripe.android.paymentsheet.repositories.b customerRepository, c0 prefsRepository, com.stripe.android.payments.paymentlauncher.g paymentLauncherFactory, com.stripe.android.googlepaylauncher.injection.g googlePayPaymentMethodLauncherFactory, com.stripe.android.paymentsheet.paymentdatacollection.bacs.c bacsMandateConfirmationLauncherFactory, lh.d logger, CoroutineContext workContext, SavedStateHandle savedStateHandle, final LinkHandler linkHandler, com.stripe.android.link.e linkConfigurationCoordinator, n intentConfirmationInterceptor, e.a editInteractorFactory, ErrorReporter errorReporter) {
super(application, args.getConfig(), eventReporter, customerRepository, prefsRepository, workContext, logger, savedStateHandle, linkHandler, linkConfigurationCoordinator, new androidx.compose.ui.input.pointer.d(true), editInteractorFactory);
GooglePayButtonType googlePayButtonType;
GooglePayPaymentMethodLauncher.Config config;
kotlin.jvm.internal.r.i(application, "application");
kotlin.jvm.internal.r.i(args, "args");
kotlin.jvm.internal.r.i(eventReporter, "eventReporter");
kotlin.jvm.internal.r.i(lazyPaymentConfig, "lazyPaymentConfig");
kotlin.jvm.internal.r.i(paymentSheetLoader, "paymentSheetLoader");
kotlin.jvm.internal.r.i(customerRepository, "customerRepository");
kotlin.jvm.internal.r.i(prefsRepository, "prefsRepository");
kotlin.jvm.internal.r.i(paymentLauncherFactory, "paymentLauncherFactory");
kotlin.jvm.internal.r.i(googlePayPaymentMethodLauncherFactory, "googlePayPaymentMethodLauncherFactory");
kotlin.jvm.internal.r.i(bacsMandateConfirmationLauncherFactory, "bacsMandateConfirmationLauncherFactory");
kotlin.jvm.internal.r.i(logger, "logger");
kotlin.jvm.internal.r.i(workContext, "workContext");
kotlin.jvm.internal.r.i(savedStateHandle, "savedStateHandle");
kotlin.jvm.internal.r.i(linkHandler, "linkHandler");
kotlin.jvm.internal.r.i(linkConfigurationCoordinator, "linkConfigurationCoordinator");
kotlin.jvm.internal.r.i(intentConfirmationInterceptor, "intentConfirmationInterceptor");
kotlin.jvm.internal.r.i(editInteractorFactory, "editInteractorFactory");
kotlin.jvm.internal.r.i(errorReporter, "errorReporter");
this.args = args;
this.lazyPaymentConfig = lazyPaymentConfig;
this.paymentSheetLoader = paymentSheetLoader;
this.paymentLauncherFactory = paymentLauncherFactory;
this.googlePayPaymentMethodLauncherFactory = googlePayPaymentMethodLauncherFactory;
this.bacsMandateConfirmationLauncherFactory = bacsMandateConfirmationLauncherFactory;
this.intentConfirmationInterceptor = intentConfirmationInterceptor;
this.errorReporter = errorReporter;
PrimaryButtonUiStateMapper primaryButtonUiStateMapper = new PrimaryButtonUiStateMapper(getApplication(), getConfig(), T1(), w(), t(), StateFlowsKt.m(O(), new Function1<PaymentMethodMetadata, Amount>() {
@Override
public final Amount invoke(PaymentMethodMetadata paymentMethodMetadata) {
if (paymentMethodMetadata != null) {
return paymentMethodMetadata.b();
}
return null;
}
}), Z(), x(), new Function0<Unit>() {
{
super(0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
PaymentSheetViewModel.this.B0();
PaymentSheetViewModel.this.C1();
}
});
this.primaryButtonUiStateMapper = primaryButtonUiStateMapper;
MutableSharedFlow<y> MutableSharedFlow$default = SharedFlowKt.MutableSharedFlow$default(1, 0, null, 6, null);
this._paymentSheetResult = MutableSharedFlow$default;
this.paymentSheetResult = MutableSharedFlow$default;
MutableStateFlow<gi.e> MutableStateFlow = StateFlowKt.MutableStateFlow(null);
this.viewState = MutableStateFlow;
this.checkoutIdentifier = CheckoutIdentifier.d;
StateFlow<gi.e> m = StateFlowsKt.m(MutableStateFlow, new Function1<gi.e, gi.e>() {
{
super(1);
}
@Override
public final gi.e invoke(gi.e eVar) {
gi.e V1;
V1 = PaymentSheetViewModel.this.V1(eVar, PaymentSheetViewModel.CheckoutIdentifier.d);
return V1;
}
});
this.buyButtonState = m;
PaymentSheet.GooglePayConfiguration googlePay = args.getConfig().getGooglePay();
PaymentSheet.GooglePayConfiguration.ButtonType buttonType = googlePay != null ? googlePay.getButtonType() : null;
switch (buttonType == null ? -1 : b.a[buttonType.ordinal()]) {
case -1:
case 8:
googlePayButtonType = GooglePayButtonType.p;
break;
case 0:
default:
throw new NoWhenBranchMatchedException();
case 1:
googlePayButtonType = GooglePayButtonType.c;
break;
case 2:
googlePayButtonType = GooglePayButtonType.d;
break;
case WorkQueueKt.STEAL_ANY:
googlePayButtonType = GooglePayButtonType.e;
break;
case 4:
googlePayButtonType = GooglePayButtonType.k;
break;
case BecsDebitAccountNumberEditText.DEFAULT_MIN_LENGTH:
googlePayButtonType = GooglePayButtonType.n;
break;
case 6:
googlePayButtonType = GooglePayButtonType.q;
break;
case WorkQueueKt.BUFFER_CAPACITY_BASE:
googlePayButtonType = GooglePayButtonType.r;
break;
}
this.googlePayButtonType = googlePayButtonType;
this.pendingPaymentResultChannel = ChannelKt.Channel$default(1, null, null, 6, null);
PaymentSheet.GooglePayConfiguration c2 = args.c();
if (c2 != null) {
if (c2.getCurrencyCode() != null || T1()) {
config = new GooglePayPaymentMethodLauncher.Config(b.b[c2.getEnvironment().ordinal()] == 1 ? GooglePayEnvironment.c : GooglePayEnvironment.d, c2.getCountryCode(), getMerchantName(), args.getConfig().getBillingDetailsCollectionConfiguration().g(), args.getConfig().getBillingDetailsCollectionConfiguration().u(), false, false, 96, null);
this.googlePayLauncherConfig = config;
this.primaryButtonUiState = FlowKt.stateIn(primaryButtonUiStateMapper.f(), ViewModelKt.getViewModelScope(this), SharingStarted.Companion.WhileSubscribed$default(SharingStarted.INSTANCE, 0L, 0L, 3, null), null);
this.error = StateFlowsKt.m(m, new Function1<gi.e, String>() {
@Override
public final String invoke(gi.e eVar) {
BaseSheetViewModel.UserErrorMessage errorMessage;
if (eVar == null || (errorMessage = eVar.getErrorMessage()) == null) {
return null;
}
return errorMessage.getMessage();
}
});
this.walletsState = StateFlowsKt.h(linkHandler.i(), G(), C(), t(), c0(), s(), new Function6<Boolean, String, com.stripe.android.paymentsheet.state.e, Boolean, List<? extends String>, List<? extends PaymentSheetScreen>, WalletsState>() {
@Metadata(k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0}, xi = 48)
class AnonymousClass1 extends FunctionReferenceImpl implements Function0<Unit> {
AnonymousClass1(Object obj) {
super(0, obj, PaymentSheetViewModel.class, "checkoutWithGooglePay", "checkoutWithGooglePay()V", 0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
((PaymentSheetViewModel) this.receiver).E1();
}
}
@Metadata(k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0}, xi = 48)
class AnonymousClass2 extends FunctionReferenceImpl implements Function0<Unit> {
AnonymousClass2(Object obj) {
super(0, obj, LinkHandler.class, "launchLink", "launchLink()V", 0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
((LinkHandler) this.receiver).j();
}
}
{
super(6);
}
public final WalletsState a(Boolean bool, String str, com.stripe.android.paymentsheet.state.e googlePayState, boolean z, List<String> paymentMethodTypes, List<? extends PaymentSheetScreen> stack) {
GooglePayButtonType googlePayButtonType2;
kotlin.jvm.internal.r.i(googlePayState, "googlePayState");
kotlin.jvm.internal.r.i(paymentMethodTypes, "paymentMethodTypes");
kotlin.jvm.internal.r.i(stack, "stack");
WalletsState.Companion companion = WalletsState.INSTANCE;
GooglePayPaymentMethodLauncher.Config googlePayLauncherConfig = PaymentSheetViewModel.this.getGooglePayLauncherConfig();
googlePayButtonType2 = PaymentSheetViewModel.this.googlePayButtonType;
PaymentSheetScreen paymentSheetScreen = (PaymentSheetScreen) CollectionsKt___CollectionsKt.F0(stack);
AnonymousClass1 anonymousClass1 = new AnonymousClass1(PaymentSheetViewModel.this);
AnonymousClass2 anonymousClass2 = new AnonymousClass2(linkHandler);
PaymentMethodMetadata value = PaymentSheetViewModel.this.O().getValue();
return companion.a(bool, str, googlePayState, googlePayButtonType2, z, paymentMethodTypes, googlePayLauncherConfig, paymentSheetScreen, true, anonymousClass1, anonymousClass2, (value != null ? value.getStripeIntent() : null) instanceof SetupIntent);
}
@Override
public WalletsState invoke(Boolean bool, String str, com.stripe.android.paymentsheet.state.e eVar, Boolean bool2, List<? extends String> list, List<? extends PaymentSheetScreen> list2) {
return a(bool, str, eVar, bool2.booleanValue(), list, list2);
}
});
this.walletsProcessingState = StateFlowsKt.m(MutableStateFlow, new Function1<gi.e, com.stripe.android.paymentsheet.state.k>() {
{
super(1);
}
@Override
public final com.stripe.android.paymentsheet.state.k invoke(gi.e eVar) {
gi.e V1;
String message;
V1 = PaymentSheetViewModel.this.V1(eVar, PaymentSheetViewModel.CheckoutIdentifier.c);
qh.b bVar = null;
if (V1 == null) {
return null;
}
if (V1 instanceof e.Reset) {
BaseSheetViewModel.UserErrorMessage errorMessage = ((e.Reset) V1).getErrorMessage();
if (errorMessage != null && (message = errorMessage.getMessage()) != null) {
bVar = qh.c.b(message, new Object[0]);
}
return new k.Idle(bVar);
}
if (V1 instanceof e.c) {
return k.c.a;
}
if (V1 instanceof e.FinishProcessing) {
return new k.a(((e.FinishProcessing) V1).b());
}
throw new NoWhenBranchMatchedException();
}
});
SessionSavedStateHandler.a.c(this, savedStateHandle);
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new AnonymousClass1(linkHandler, this, null), 3, null);
eventReporter.s(getConfig(), args.getInitializationMode() instanceof PaymentSheet.i.DeferredIntent);
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), workContext, null, new AnonymousClass2(null), 2, null);
this.shouldCompleteLinkFlowInline = true;
}
logger.a("GooglePayConfiguration.currencyCode is required in order to use Google Pay when processing a Setup Intent");
}
config = null;
this.googlePayLauncherConfig = config;
this.primaryButtonUiState = FlowKt.stateIn(primaryButtonUiStateMapper.f(), ViewModelKt.getViewModelScope(this), SharingStarted.Companion.WhileSubscribed$default(SharingStarted.INSTANCE, 0L, 0L, 3, null), null);
this.error = StateFlowsKt.m(m, new Function1<gi.e, String>() {
@Override
public final String invoke(gi.e eVar) {
BaseSheetViewModel.UserErrorMessage errorMessage;
if (eVar == null || (errorMessage = eVar.getErrorMessage()) == null) {
return null;
}
return errorMessage.getMessage();
}
});
this.walletsState = StateFlowsKt.h(linkHandler.i(), G(), C(), t(), c0(), s(), new Function6<Boolean, String, com.stripe.android.paymentsheet.state.e, Boolean, List<? extends String>, List<? extends PaymentSheetScreen>, WalletsState>() {
@Metadata(k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0}, xi = 48)
class AnonymousClass1 extends FunctionReferenceImpl implements Function0<Unit> {
AnonymousClass1(Object obj) {
super(0, obj, PaymentSheetViewModel.class, "checkoutWithGooglePay", "checkoutWithGooglePay()V", 0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
((PaymentSheetViewModel) this.receiver).E1();
}
}
@Metadata(k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0}, xi = 48)
class AnonymousClass2 extends FunctionReferenceImpl implements Function0<Unit> {
AnonymousClass2(Object obj) {
super(0, obj, LinkHandler.class, "launchLink", "launchLink()V", 0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
((LinkHandler) this.receiver).j();
}
}
{
super(6);
}
public final WalletsState a(Boolean bool, String str, com.stripe.android.paymentsheet.state.e googlePayState, boolean z, List<String> paymentMethodTypes, List<? extends PaymentSheetScreen> stack) {
GooglePayButtonType googlePayButtonType2;
kotlin.jvm.internal.r.i(googlePayState, "googlePayState");
kotlin.jvm.internal.r.i(paymentMethodTypes, "paymentMethodTypes");
kotlin.jvm.internal.r.i(stack, "stack");
WalletsState.Companion companion = WalletsState.INSTANCE;
GooglePayPaymentMethodLauncher.Config googlePayLauncherConfig = PaymentSheetViewModel.this.getGooglePayLauncherConfig();
googlePayButtonType2 = PaymentSheetViewModel.this.googlePayButtonType;
PaymentSheetScreen paymentSheetScreen = (PaymentSheetScreen) CollectionsKt___CollectionsKt.F0(stack);
AnonymousClass1 anonymousClass1 = new AnonymousClass1(PaymentSheetViewModel.this);
AnonymousClass2 anonymousClass2 = new AnonymousClass2(linkHandler);
PaymentMethodMetadata value = PaymentSheetViewModel.this.O().getValue();
return companion.a(bool, str, googlePayState, googlePayButtonType2, z, paymentMethodTypes, googlePayLauncherConfig, paymentSheetScreen, true, anonymousClass1, anonymousClass2, (value != null ? value.getStripeIntent() : null) instanceof SetupIntent);
}
@Override
public WalletsState invoke(Boolean bool, String str, com.stripe.android.paymentsheet.state.e eVar, Boolean bool2, List<? extends String> list, List<? extends PaymentSheetScreen> list2) {
return a(bool, str, eVar, bool2.booleanValue(), list, list2);
}
});
this.walletsProcessingState = StateFlowsKt.m(MutableStateFlow, new Function1<gi.e, com.stripe.android.paymentsheet.state.k>() {
{
super(1);
}
@Override
public final com.stripe.android.paymentsheet.state.k invoke(gi.e eVar) {
gi.e V1;
String message;
V1 = PaymentSheetViewModel.this.V1(eVar, PaymentSheetViewModel.CheckoutIdentifier.c);
qh.b bVar = null;
if (V1 == null) {
return null;
}
if (V1 instanceof e.Reset) {
BaseSheetViewModel.UserErrorMessage errorMessage = ((e.Reset) V1).getErrorMessage();
if (errorMessage != null && (message = errorMessage.getMessage()) != null) {
bVar = qh.c.b(message, new Object[0]);
}
return new k.Idle(bVar);
}
if (V1 instanceof e.c) {
return k.c.a;
}
if (V1 instanceof e.FinishProcessing) {
return new k.a(((e.FinishProcessing) V1).b());
}
throw new NoWhenBranchMatchedException();
}
});
SessionSavedStateHandler.a.c(this, savedStateHandle);
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new AnonymousClass1(linkHandler, this, null), 3, null);
eventReporter.s(getConfig(), args.getInitializationMode() instanceof PaymentSheet.i.DeferredIntent);
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), workContext, null, new AnonymousClass2(null), 2, null);
this.shouldCompleteLinkFlowInline = true;
}
private final Object A1(Continuation<? super com.stripe.android.payments.paymentlauncher.a> continuation) {
Boolean bool = (Boolean) getSavedStateHandle().remove("AwaitingPaymentResult");
if (bool == null || !bool.booleanValue()) {
return null;
}
b.Companion companion = cl.b.INSTANCE;
return TimeoutKt.m374withTimeoutOrNullKLykuaI(cl.d.s(1, DurationUnit.k), new PaymentSheetViewModel$awaitPaymentResult$2(this, null), continuation);
}
public final java.lang.Object B1(kotlin.coroutines.Continuation<? super com.stripe.android.model.StripeIntent> r5) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.paymentsheet.PaymentSheetViewModel.B1(kotlin.coroutines.Continuation):java.lang.Object");
}
private final void D1(PaymentSelection paymentSelection, CheckoutIdentifier identifier) {
Object b2;
com.stripe.android.paymentsheet.paymentdatacollection.bacs.b bVar;
StripeIntent stripeIntent;
GooglePayPaymentMethodLauncher googlePayPaymentMethodLauncher;
String currencyCode;
Long amount;
j2(identifier);
if (!(paymentSelection instanceof PaymentSelection.b)) {
if (paymentSelection instanceof PaymentSelection.ExternalPaymentMethod) {
PaymentSelection.ExternalPaymentMethod externalPaymentMethod = (PaymentSelection.ExternalPaymentMethod) paymentSelection;
k.a.b(externalPaymentMethod.getType(), externalPaymentMethod.getBillingDetails(), new PaymentSheetViewModel$checkout$2(this), this.externalPaymentMethodLauncher, this.errorReporter);
return;
}
if (paymentSelection instanceof PaymentSelection.d.GenericPaymentMethod) {
PaymentSelection.d.GenericPaymentMethod genericPaymentMethod = (PaymentSelection.d.GenericPaymentMethod) paymentSelection;
if (kotlin.jvm.internal.r.d(genericPaymentMethod.getPaymentMethodCreateParams().q(), PaymentMethod.Type.t.code)) {
BacsMandateData a2 = BacsMandateData.INSTANCE.a(genericPaymentMethod);
if (a2 == null) {
f2(getApplication().getResources().getString(i0.X));
return;
}
try {
Result.Companion companion = Result.INSTANCE;
bVar = this.bacsMandateConfirmationLauncher;
} catch (Throwable th2) {
Result.Companion companion2 = Result.INSTANCE;
b2 = Result.b(kotlin.f.a(th2));
}
if (bVar == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
b2 = Result.b(bVar);
if (Result.h(b2)) {
((com.stripe.android.paymentsheet.paymentdatacollection.bacs.b) b2).a(a2, getConfig().getAppearance());
}
if (Result.e(b2) != null) {
f2(getApplication().getResources().getString(i0.X));
}
Result.a(b2);
return;
}
}
F1(paymentSelection);
return;
}
PaymentMethodMetadata value = O().getValue();
if (value == null || (stripeIntent = value.getStripeIntent()) == 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 c2 = this.args.c();
currencyCode = c2 != null ? c2.getCurrencyCode() : null;
if (currencyCode == null) {
currencyCode = "";
}
}
long j = 0;
if (z) {
Long amount2 = ((PaymentIntent) stripeIntent).getAmount();
if (amount2 != null) {
j = amount2.longValue();
}
} else {
if (!(stripeIntent instanceof SetupIntent)) {
throw new NoWhenBranchMatchedException();
}
PaymentSheet.GooglePayConfiguration c3 = this.args.c();
if (c3 != null && (amount = c3.getAmount()) != null) {
j = amount.longValue();
}
}
String id = stripeIntent.getId();
PaymentSheet.GooglePayConfiguration c4 = this.args.c();
googlePayPaymentMethodLauncher.e(currencyCode, j, id, c4 != null ? c4.getLabel() : null);
}
private final void F1(PaymentSelection paymentSelection) {
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), getWorkContext(), null, new PaymentSheetViewModel$confirmPaymentSelection$1(this, paymentSelection, null), 2, null);
}
public final void L1(LinkHandler.a processingState) {
int i = 1;
Unit unit = null;
Object[] objArr = 0;
Object[] objArr2 = 0;
if (kotlin.jvm.internal.r.d(processingState, LinkHandler.a.C0111a.a)) {
g2(this, null, 1, null);
return;
}
if (processingState instanceof LinkHandler.a.PaymentMethodCollected) {
d1(new PaymentSelection.Saved(((LinkHandler.a.PaymentMethodCollected) processingState).getPaymentMethod(), PaymentSelection.Saved.WalletType.d, false, null, 12, null));
D1(Z().getValue(), CheckoutIdentifier.c);
return;
}
if (processingState instanceof LinkHandler.a.CompletedWithPaymentResult) {
c2(((LinkHandler.a.CompletedWithPaymentResult) processingState).getResult());
return;
}
if (processingState instanceof LinkHandler.a.Error) {
o0(((LinkHandler.a.Error) processingState).getMessage());
return;
}
if (kotlin.jvm.internal.r.d(processingState, LinkHandler.a.e.a)) {
j2(CheckoutIdentifier.c);
return;
}
if (processingState instanceof LinkHandler.a.PaymentDetailsCollected) {
PaymentSelection paymentSelection = ((LinkHandler.a.PaymentDetailsCollected) processingState).getPaymentSelection();
if (paymentSelection != null) {
d1(paymentSelection);
D1(Z().getValue(), CheckoutIdentifier.d);
unit = Unit.a;
}
if (unit == null) {
D1(Z().getValue(), CheckoutIdentifier.d);
return;
}
return;
}
if (kotlin.jvm.internal.r.d(processingState, LinkHandler.a.h.a)) {
this.checkoutIdentifier = CheckoutIdentifier.d;
this.viewState.setValue(new e.Reset(objArr2 == true ? 1 : 0, i, objArr == true ? 1 : 0));
} else if (kotlin.jvm.internal.r.d(processingState, LinkHandler.a.i.a)) {
this.checkoutIdentifier = CheckoutIdentifier.d;
this.viewState.setValue(e.c.b);
} else if (kotlin.jvm.internal.r.d(processingState, LinkHandler.a.b.a)) {
C1();
}
}
public final void M1(String clientSecret, StripeIntent stripeIntent) {
Object b2;
com.stripe.android.payments.paymentlauncher.f fVar;
try {
Result.Companion companion = Result.INSTANCE;
fVar = this.paymentLauncher;
} catch (Throwable th2) {
Result.Companion companion2 = Result.INSTANCE;
b2 = Result.b(kotlin.f.a(th2));
}
if (fVar == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
b2 = Result.b(fVar);
Throwable e2 = Result.e(b2);
if (e2 != null) {
Z1(e2);
return;
}
com.stripe.android.payments.paymentlauncher.f fVar2 = (com.stripe.android.payments.paymentlauncher.f) b2;
if (stripeIntent instanceof PaymentIntent) {
fVar2.d(clientSecret);
} else if (stripeIntent instanceof SetupIntent) {
fVar2.b(clientSecret);
}
k2();
}
private final void N1(PaymentMethod paymentMethod, boolean finishImmediately) {
PaymentSelection value = Z().getValue();
getEventReporter().h(value, this.deferredIntentConfirmationType);
this.deferredIntentConfirmationType = null;
if (value != null && com.stripe.android.paymentsheet.model.a.a(value)) {
getLinkHandler().k();
}
if (value instanceof PaymentSelection.d) {
PaymentMethod paymentMethod2 = com.stripe.android.paymentsheet.utils.b.a((PaymentSelection.d) value, this.args.getInitializationMode()) ? paymentMethod : null;
value = paymentMethod2 != null ? new PaymentSelection.Saved(paymentMethod2, null, false, null, 14, null) : null;
}
if (value != null) {
getPrefsRepository().a(value);
}
if (finishImmediately) {
this._paymentSheetResult.tryEmit(y.b.c);
} else {
this.viewState.setValue(new e.FinishProcessing(new Function0<Unit>() {
{
super(0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
MutableSharedFlow mutableSharedFlow;
mutableSharedFlow = PaymentSheetViewModel.this._paymentSheetResult;
mutableSharedFlow.tryEmit(y.b.c);
}
}));
}
}
private final void O1(Throwable error) {
getEventReporter().f(Z().getValue(), new PaymentSheetConfirmationError.Stripe(error));
f2(kh.a.a(error, getApplication()));
}
private final void P1(Throwable error) {
N0(null);
Z1(error);
}
private final Object Q1(Full full, Continuation<? super Unit> continuation) {
Object f2;
Object f3;
if (full.getValidationError() != null) {
Object R1 = R1(full.n(), full.getValidationError(), continuation);
f3 = kotlin.coroutines.intrinsics.b.f();
return R1 == f3 ? R1 : Unit.a;
}
Object S1 = S1(full, continuation);
f2 = kotlin.coroutines.intrinsics.b.f();
return S1 == f2 ? S1 : Unit.a;
}
public final java.lang.Object R1(com.stripe.android.model.StripeIntent r5, java.lang.Throwable r6, kotlin.coroutines.Continuation<? super kotlin.Unit> r7) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.paymentsheet.PaymentSheetViewModel.R1(com.stripe.android.model.StripeIntent, java.lang.Throwable, kotlin.coroutines.Continuation):java.lang.Object");
}
public final java.lang.Object S1(com.stripe.android.paymentsheet.state.Full r6, kotlin.coroutines.Continuation<? super kotlin.Unit> r7) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.paymentsheet.PaymentSheetViewModel.S1(com.stripe.android.paymentsheet.state.j, kotlin.coroutines.Continuation):java.lang.Object");
}
public final java.lang.Object U1(kotlin.coroutines.Continuation<? super kotlin.Unit> r8) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.paymentsheet.PaymentSheetViewModel.U1(kotlin.coroutines.Continuation):java.lang.Object");
}
public final gi.e V1(gi.e viewState, CheckoutIdentifier checkoutIdentifier) {
if (this.checkoutIdentifier != checkoutIdentifier) {
return null;
}
return viewState;
}
public final void W1(com.stripe.android.paymentsheet.paymentdatacollection.bacs.d result) {
if (!(result instanceof d.c)) {
if ((result instanceof d.C0156d) || (result instanceof d.a)) {
f2(null);
return;
}
return;
}
PaymentSelection value = Z().getValue();
if ((value instanceof PaymentSelection.d.GenericPaymentMethod) && kotlin.jvm.internal.r.d(((PaymentSelection.d.GenericPaymentMethod) value).getPaymentMethodCreateParams().q(), PaymentMethod.Type.t.code)) {
F1(value);
}
}
public final void Y1(com.stripe.android.payments.paymentlauncher.e paymentResult) {
PaymentSelection value = Z().getValue();
if (paymentResult instanceof e.c) {
getEventReporter().h(value, null);
} else if (paymentResult instanceof e.d) {
getEventReporter().f(value, PaymentSheetConfirmationError.ExternalPaymentMethod.c);
} else {
boolean z = paymentResult instanceof e.a;
}
c2(paymentResult);
}
public final void b2(com.stripe.android.payments.paymentlauncher.a launcherResult) {
PaymentMethodMetadata value = O().getValue();
StripeIntent stripeIntent = value != null ? value.getStripeIntent() : null;
if (stripeIntent == null) {
this.pendingPaymentResultChannel.mo36trySendJP2dKIU(launcherResult);
return;
}
if (launcherResult instanceof a.Completed) {
d2(((a.Completed) launcherResult).getIntent(), e.c.e);
} else if (launcherResult instanceof a.d) {
d2(stripeIntent, new e.d(((a.d) launcherResult).getThrowable()));
} else if (launcherResult instanceof a.C0101a) {
d2(stripeIntent, e.a.e);
}
}
public final void d2(StripeIntent stripeIntent, com.stripe.android.payments.paymentlauncher.e paymentResult) {
if (paymentResult instanceof e.c) {
N1(stripeIntent.getPaymentMethod(), false);
} else if (paymentResult instanceof e.d) {
O1(((e.d) paymentResult).getThrowable());
} else if (paymentResult instanceof e.a) {
g2(this, null, 1, null);
}
}
private final void f2(String userErrorMessage) {
this.viewState.setValue(new e.Reset(userErrorMessage != null ? new BaseSheetViewModel.UserErrorMessage(userErrorMessage) : null));
getSavedStateHandle().set("processing", Boolean.FALSE);
}
static void g2(PaymentSheetViewModel paymentSheetViewModel, String str, int i, Object obj) {
if ((i & 1) != 0) {
str = null;
}
paymentSheetViewModel.f2(str);
}
private final void j2(CheckoutIdentifier checkoutIdentifier) {
this.checkoutIdentifier = checkoutIdentifier;
getSavedStateHandle().set("processing", Boolean.TRUE);
this.viewState.setValue(e.c.b);
}
private final void k2() {
getSavedStateHandle().set("AwaitingPaymentResult", Boolean.TRUE);
}
@Override
public StateFlow<String> A() {
return this.error;
}
public final void C1() {
D1(Z().getValue(), CheckoutIdentifier.d);
}
public final void E1() {
J0(false);
D1(PaymentSelection.b.c, CheckoutIdentifier.c);
}
public final void G1(ai.d confirmStripeIntentParams) {
Object b2;
com.stripe.android.payments.paymentlauncher.f fVar;
kotlin.jvm.internal.r.i(confirmStripeIntentParams, "confirmStripeIntentParams");
try {
Result.Companion companion = Result.INSTANCE;
fVar = this.paymentLauncher;
} catch (Throwable th2) {
Result.Companion companion2 = Result.INSTANCE;
b2 = Result.b(kotlin.f.a(th2));
}
if (fVar == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
b2 = Result.b(fVar);
Throwable e2 = Result.e(b2);
if (e2 != null) {
Z1(e2);
return;
}
com.stripe.android.payments.paymentlauncher.f fVar2 = (com.stripe.android.payments.paymentlauncher.f) b2;
if (confirmStripeIntentParams instanceof ConfirmPaymentIntentParams) {
fVar2.c((ConfirmPaymentIntentParams) confirmStripeIntentParams);
} else if (confirmStripeIntentParams instanceof ConfirmSetupIntentParams) {
fVar2.a((ConfirmSetupIntentParams) confirmStripeIntentParams);
}
k2();
}
public final w.Args getArgs() {
return this.args;
}
public final StateFlow<gi.e> I1() {
return this.buyButtonState;
}
public final GooglePayPaymentMethodLauncher.Config getGooglePayLauncherConfig() {
return this.googlePayLauncherConfig;
}
public final SharedFlow<y> K1() {
return this.paymentSheetResult;
}
@Override
public void M0(BaseSheetViewModel.b bVar) {
this.newPaymentSelection = bVar;
}
@Override
public BaseSheetViewModel.b getNewPaymentSelection() {
return this.newPaymentSelection;
}
public final boolean T1() {
boolean b2;
b2 = b0.b(this.args.getInitializationMode());
return b2;
}
@Override
public StateFlow<PrimaryButton.UIState> W() {
return this.primaryButtonUiState;
}
public void X1(@IntegerRes Integer error) {
String str;
if (error != null) {
str = getApplication().getResources().getString(error.intValue());
} else {
str = null;
}
o0(str);
}
public void Z1(Throwable throwable) {
kotlin.jvm.internal.r.i(throwable, "throwable");
getLogger().error("Payment Sheet error", throwable);
L0(throwable);
this._paymentSheetResult.tryEmit(new y.Failed(throwable));
}
@Override
public boolean getShouldCompleteLinkFlowInline() {
return this.shouldCompleteLinkFlowInline;
}
public final void a2(GooglePayPaymentMethodLauncher.d result) {
kotlin.jvm.internal.r.i(result, "result");
J0(true);
if (result instanceof GooglePayPaymentMethodLauncher.d.Completed) {
PaymentSelection.Saved saved = new PaymentSelection.Saved(((GooglePayPaymentMethodLauncher.d.Completed) result).getPaymentMethod(), PaymentSelection.Saved.WalletType.c, false, null, 12, null);
d1(saved);
F1(saved);
} else if (!(result instanceof GooglePayPaymentMethodLauncher.d.Failed)) {
if (result instanceof GooglePayPaymentMethodLauncher.d.a) {
g2(this, null, 1, null);
}
} else {
GooglePayPaymentMethodLauncher.d.Failed failed = (GooglePayPaymentMethodLauncher.d.Failed) result;
getLogger().error("Error processing Google Pay payment", failed.getError());
getEventReporter().f(PaymentSelection.b.c, new PaymentSheetConfirmationError.GooglePay(failed.getErrorCode()));
X1(Integer.valueOf(failed.getErrorCode() == 3 ? com.stripe.android.c0.m0 : com.stripe.android.c0.s0));
}
}
public void c2(com.stripe.android.payments.paymentlauncher.e paymentResult) {
kotlin.jvm.internal.r.i(paymentResult, "paymentResult");
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), getWorkContext(), null, new PaymentSheetViewModel$onPaymentResult$1(this, paymentResult, null), 2, null);
}
@Override
public StateFlow<com.stripe.android.paymentsheet.state.k> e0() {
return this.walletsProcessingState;
}
public final void e2(ActivityResultCaller activityResultCaller, LifecycleOwner lifecycleOwner) {
kotlin.jvm.internal.r.i(activityResultCaller, "activityResultCaller");
kotlin.jvm.internal.r.i(lifecycleOwner, "lifecycleOwner");
getLinkHandler().n(activityResultCaller);
ActivityResultLauncher<a.Args> registerForActivityResult = activityResultCaller.registerForActivityResult(new com.stripe.android.paymentsheet.paymentdatacollection.bacs.a(), new f());
kotlin.jvm.internal.r.h(registerForActivityResult, "registerForActivityResult(...)");
this.bacsMandateConfirmationLauncher = this.bacsMandateConfirmationLauncherFactory.a(registerForActivityResult);
com.stripe.android.payments.paymentlauncher.g gVar = this.paymentLauncherFactory;
Integer statusBarColor = this.args.getStatusBarColor();
ActivityResultLauncher<c.a> registerForActivityResult2 = activityResultCaller.registerForActivityResult(new com.stripe.android.payments.paymentlauncher.c(), new c());
Function0<String> function0 = new Function0<String>() {
{
super(0);
}
@Override
public final String invoke() {
dj.a aVar;
aVar = PaymentSheetViewModel.this.lazyPaymentConfig;
return ((com.stripe.android.o) aVar.get()).e();
}
};
Function0<String> function02 = new Function0<String>() {
{
super(0);
}
@Override
public final String invoke() {
dj.a aVar;
aVar = PaymentSheetViewModel.this.lazyPaymentConfig;
return ((com.stripe.android.o) aVar.get()).g();
}
};
kotlin.jvm.internal.r.f(registerForActivityResult2);
this.paymentLauncher = gVar.a(function0, function02, statusBarColor, true, registerForActivityResult2);
this.externalPaymentMethodLauncher = activityResultCaller.registerForActivityResult(new i(this.errorReporter), new d());
lifecycleOwner.getLifecycle().addObserver(new e(registerForActivityResult));
}
@Override
public StateFlow<WalletsState> f0() {
return this.walletsState;
}
public final void h2(CoroutineScope lifecycleScope, ActivityResultLauncher<j.Args> activityResultLauncher) {
kotlin.jvm.internal.r.i(lifecycleScope, "lifecycleScope");
kotlin.jvm.internal.r.i(activityResultLauncher, "activityResultLauncher");
GooglePayPaymentMethodLauncher.Config config = this.googlePayLauncherConfig;
if (config != null) {
this.googlePayPaymentMethodLauncher = g.a.a(this.googlePayPaymentMethodLauncherFactory, lifecycleScope, config, new GooglePayPaymentMethodLauncher.c() {
@Override
public final void a(boolean z) {
PaymentSheetViewModel.i2(z);
}
}, activityResultLauncher, false, 16, null);
}
}
@Override
public void i0(PaymentSelection.d.USBankAccount paymentSelection) {
kotlin.jvm.internal.r.i(paymentSelection, "paymentSelection");
d1(paymentSelection);
B0();
C1();
}
@Override
public void j0(PaymentSelection selection) {
if (z().getValue().booleanValue() || kotlin.jvm.internal.r.d(selection, Z().getValue())) {
return;
}
d1(selection);
}
@Override
public void o() {
if (this.viewState.getValue() instanceof e.Reset) {
this.viewState.setValue(new e.Reset(null));
}
}
@Override
public void o0(String error) {
f2(error);
}
@Override
public List<PaymentSheetScreen> q() {
if (getConfig().getPaymentMethodLayout() == PaymentSheet.PaymentMethodLayout.k) {
return kotlin.collections.n.e(com.stripe.android.paymentsheet.verticalmode.d.a.a(this));
}
List<PaymentMethod> value = P().getValue();
return kotlin.collections.n.e((value == null || value.isEmpty()) ^ true ? PaymentSheetScreen.SelectSavedPaymentMethods.c : PaymentSheetScreen.AddFirstPaymentMethod.c);
}
@Override
public void s0() {
C0();
this._paymentSheetResult.tryEmit(y.a.c);
}
public static final void i2(boolean z) {
}
}