正在查看: Rilo v2.0.21 应用的 CustomerSheetViewModel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Rilo v2.0.21 应用的 CustomerSheetViewModel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.stripe.android.customersheet;
import android.app.Application;
import android.content.res.Resources;
import androidx.activity.result.ActivityResultCaller;
import androidx.activity.result.ActivityResultLauncher;
import androidx.lifecycle.DefaultLifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelKt;
import androidx.lifecycle.ViewModelProvider;
import com.google.firebase.messaging.Constants;
import com.nimbusds.jose.shaded.ow2asm.Opcodes;
import com.stripe.android.PaymentConfiguration;
import com.stripe.android.common.exception.ExceptionKtKt;
import com.stripe.android.core.Logger;
import com.stripe.android.core.networking.RequestHeadersFactory;
import com.stripe.android.core.strings.ResolvableString;
import com.stripe.android.core.strings.ResolvableStringUtilsKt;
import com.stripe.android.customersheet.CustomerSheet;
import com.stripe.android.customersheet.CustomerSheetViewAction;
import com.stripe.android.customersheet.CustomerSheetViewState;
import com.stripe.android.customersheet.InternalCustomerSheetResult;
import com.stripe.android.customersheet.analytics.CustomerSheetEventReporter;
import com.stripe.android.customersheet.injection.CustomerSheetViewModelScope;
import com.stripe.android.model.ConfirmSetupIntentParams;
import com.stripe.android.model.ConfirmStripeIntentParams;
import com.stripe.android.model.PaymentMethod;
import com.stripe.android.model.PaymentMethodCreateParams;
import com.stripe.android.model.SetupIntent;
import com.stripe.android.model.StripeIntent;
import com.stripe.android.networking.StripeRepository;
import com.stripe.android.payments.bankaccount.navigation.CollectBankAccountResultInternal;
import com.stripe.android.payments.financialconnections.IsFinancialConnectionsAvailable;
import com.stripe.android.payments.paymentlauncher.PaymentLauncher;
import com.stripe.android.payments.paymentlauncher.PaymentLauncherContract;
import com.stripe.android.payments.paymentlauncher.PaymentLauncherUtilsKt;
import com.stripe.android.payments.paymentlauncher.PaymentResult;
import com.stripe.android.payments.paymentlauncher.StripePaymentLauncherAssistedFactory;
import com.stripe.android.paymentsheet.IntentConfirmationInterceptor;
import com.stripe.android.paymentsheet.PaymentSheetConfigurationKtxKt;
import com.stripe.android.paymentsheet.R;
import com.stripe.android.paymentsheet.addresselement.AddressDetails;
import com.stripe.android.paymentsheet.forms.FormArgumentsFactory;
import com.stripe.android.paymentsheet.forms.FormFieldValues;
import com.stripe.android.paymentsheet.forms.FormViewModel;
import com.stripe.android.paymentsheet.injection.FormViewModelSubcomponent;
import com.stripe.android.paymentsheet.model.PaymentSelection;
import com.stripe.android.paymentsheet.paymentdatacollection.FormArguments;
import com.stripe.android.paymentsheet.paymentdatacollection.ach.USBankAccountFormArguments;
import com.stripe.android.paymentsheet.state.PaymentSheetLoaderKt;
import com.stripe.android.paymentsheet.ui.AddPaymentMethodKt;
import com.stripe.android.paymentsheet.ui.ModifiableEditPaymentMethodViewInteractor;
import com.stripe.android.paymentsheet.ui.PrimaryButton;
import com.stripe.android.paymentsheet.utils.StateFlowsKt;
import com.stripe.android.ui.core.cbc.CardBrandChoiceEligibility;
import com.stripe.android.ui.core.forms.resources.LpmRepository;
import com.stripe.android.uicore.elements.IdentifierSpec;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import kotlin.Metadata;
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.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.flow.Flow;
import kotlinx.coroutines.flow.FlowCollector;
import kotlinx.coroutines.flow.FlowKt;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.SharingStarted;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;
@CustomerSheetViewModelScope
@Metadata(d1 = {"\u0000ú\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\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\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\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\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010!\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0007\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\u0002\b\u0006\n\u0002\u0010\u0003\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\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\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\n\b\u0001\u0018\u00002\u00020\u0001:\u0002¼\u0001BÒ\u0001\b\u0007\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0011\u0010\u0004\u001a\r\u0012\u0004\u0012\u00020\u00060\u0005¢\u0006\u0002\b\u0007\u0012\b\u0010\b\u001a\u0004\u0018\u00010\t\u0012\f\u0010\n\u001a\b\u0012\u0004\u0012\u00020\f0\u000b\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\u000e\u0010\u0019\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u001b0\u001a\u0012\u0006\u0010\u001c\u001a\u00020\u001d\u0012\b\b\u0002\u0010\u001e\u001a\u00020\u001f\u0012\u000e\b\u0001\u0010 \u001a\b\u0012\u0004\u0012\u00020!0\u001a\u0012\f\u0010\"\u001a\b\u0012\u0004\u0012\u00020#0\u000b\u0012\u0006\u0010$\u001a\u00020%\u0012\u0006\u0010&\u001a\u00020'\u0012\u0006\u0010(\u001a\u00020)\u0012\u0006\u0010*\u001a\u00020+\u0012\u0006\u0010,\u001a\u00020-¢\u0006\u0002\u0010.J\u0019\u0010F\u001a\u00020G2\u0006\u0010H\u001a\u00020IH\u0082@ø\u0001\u0000¢\u0006\u0002\u0010JJ\u0010\u0010K\u001a\u00020G2\u0006\u0010L\u001a\u00020CH\u0002J\u0019\u0010M\u001a\u00020G2\u0006\u0010L\u001a\u00020CH\u0082@ø\u0001\u0000¢\u0006\u0002\u0010NJ\u0006\u0010O\u001a\u00020!J+\u0010P\u001a\u00020Q2!\u0010R\u001a\u001d\u0012\u0013\u0012\u00110Q¢\u0006\f\bT\u0012\b\bU\u0012\u0004\b\b(D\u0012\u0004\u0012\u00020Q0SH\u0002JG\u0010V\u001a\b\u0012\u0004\u0012\u00020G0\u001a2\u0006\u0010W\u001a\u00020X2\f\u0010\"\u001a\b\u0012\u0004\u0012\u00020#0\u000b2!\u0010Y\u001a\u001d\u0012\u0013\u0012\u00110Z¢\u0006\f\bT\u0012\b\bU\u0012\u0004\b\b([\u0012\u0004\u0012\u00020G0SH\u0002J\u001c\u0010\\\u001a\u00020G2\b\u0010]\u001a\u0004\u0018\u00010\t2\b\u0010^\u001a\u0004\u0018\u00010IH\u0002J.\u0010_\u001a\u00020G2\b\u0010]\u001a\u0004\u0018\u00010\t2\b\u0010^\u001a\u0004\u0018\u00010I2\u0006\u0010`\u001a\u00020a2\b\u0010b\u001a\u0004\u0018\u00010IH\u0002J\u0010\u0010c\u001a\u00020G2\u0006\u0010d\u001a\u00020eH\u0002J\u0010\u0010f\u001a\u00020G2\u0006\u0010g\u001a\u00020hH\u0002J*\u0010i\u001a\b\u0012\u0004\u0012\u00020C0j2\u0006\u0010k\u001a\u00020hH\u0082@ø\u0001\u0001ø\u0001\u0002ø\u0001\u0000ø\u0001\u0000¢\u0006\u0004\bl\u0010mJ\u0012\u0010n\u001a\u00020G2\b\u0010b\u001a\u0004\u0018\u00010IH\u0002J\u0018\u0010o\u001a\u00020G2\u0006\u0010p\u001a\u00020I2\u0006\u0010>\u001a\u00020?H\u0002J\u0010\u0010q\u001a\u00020G2\u0006\u0010L\u001a\u00020CH\u0002J:\u0010r\u001a\b\u0012\u0004\u0012\u00020G0j2\u0006\u0010>\u001a\u00020?2\u0006\u0010p\u001a\u00020I2\u0006\u0010L\u001a\u00020CH\u0082@ø\u0001\u0001ø\u0001\u0002ø\u0001\u0000ø\u0001\u0000¢\u0006\u0004\bs\u0010tJ\u000e\u0010u\u001a\u00020G2\u0006\u0010v\u001a\u00020wJ\u0011\u0010x\u001a\u00020GH\u0082@ø\u0001\u0000¢\u0006\u0002\u0010yJ'\u0010z\u001a\b\u0012\u0004\u0012\u00020C0{2\u0006\u0010L\u001a\u00020C2\u0006\u0010|\u001a\u00020}H\u0082@ø\u0001\u0000¢\u0006\u0002\u0010~J\b\u0010\u007f\u001a\u00020GH\u0002J\u0011\u0010\u0080\u0001\u001a\u00020G2\u0006\u0010L\u001a\u000204H\u0002J\t\u0010\u0081\u0001\u001a\u00020GH\u0002J\t\u0010\u0082\u0001\u001a\u00020GH\u0002J\u0013\u0010\u0083\u0001\u001a\u00020G2\b\u0010\u0084\u0001\u001a\u00030\u0085\u0001H\u0002J\u0013\u0010\u0086\u0001\u001a\u00020G2\b\u0010\u0087\u0001\u001a\u00030\u0088\u0001H\u0002J\t\u0010\u0089\u0001\u001a\u00020GH\u0002J\t\u0010\u008a\u0001\u001a\u00020GH\u0002J\u0011\u0010Y\u001a\u00020G2\u0007\u0010\u008b\u0001\u001a\u00020ZH\u0002J\u0014\u0010\u008c\u0001\u001a\u00020G2\t\u0010\u008d\u0001\u001a\u0004\u0018\u00010IH\u0002J\u0015\u0010\u008e\u0001\u001a\u00020G2\n\u0010\u008f\u0001\u001a\u0005\u0018\u00010\u0090\u0001H\u0002J\u0011\u0010\u0091\u0001\u001a\u00020G2\u0006\u0010L\u001a\u00020CH\u0002J\u0013\u0010\u0092\u0001\u001a\u00020G2\b\u0010]\u001a\u0004\u0018\u00010\tH\u0002J\u0011\u0010\u0093\u0001\u001a\u00020G2\u0006\u0010L\u001a\u00020CH\u0002J\u0012\u0010\u0094\u0001\u001a\u00020G2\u0007\u0010:\u001a\u00030\u0095\u0001H\u0002J\t\u0010\u0096\u0001\u001a\u00020GH\u0002J\u0019\u0010\u0097\u0001\u001a\u00020I2\u0010\u0010\u0098\u0001\u001a\u000b\u0018\u00010Ij\u0005\u0018\u0001`\u0099\u0001J\u001b\u0010\u009a\u0001\u001a\u00020G2\b\u0010\u009b\u0001\u001a\u00030\u009c\u00012\b\u0010\u009d\u0001\u001a\u00030\u009e\u0001J \u0010\u009f\u0001\u001a\b\u0012\u0004\u0012\u00020C0{2\u0006\u0010L\u001a\u00020CH\u0082@ø\u0001\u0000¢\u0006\u0002\u0010NJ\u0011\u0010 \u0001\u001a\u00020G2\u0006\u0010L\u001a\u00020CH\u0002J.\u0010¡\u0001\u001a\u00020G2#\u0010¢\u0001\u001a\u001e\u0012\u0014\u0012\u00120Q¢\u0006\r\bT\u0012\t\bU\u0012\u0005\b\b(£\u0001\u0012\u0004\u0012\u00020Q0SH\u0002J\t\u0010¤\u0001\u001a\u00020GH\u0002J\u0015\u0010¥\u0001\u001a\u00020G2\n\u0010¦\u0001\u001a\u0005\u0018\u00010§\u0001H\u0002J\u001d\u0010¨\u0001\u001a\u00020G2\u0007\u0010©\u0001\u001a\u00020\u00062\t\b\u0002\u0010ª\u0001\u001a\u00020!H\u0002J\u001e\u0010«\u0001\u001a\u00020G2\u0007\u0010¬\u0001\u001a\u00020!2\n\b\u0002\u0010\u00ad\u0001\u001a\u00030®\u0001H\u0002J,\u0010¯\u0001\u001a\u00020G2\r\u0010°\u0001\u001a\b\u0012\u0004\u0012\u00020C0\u00052\b\u0010]\u001a\u0004\u0018\u00010\t2\b\u0010\u00ad\u0001\u001a\u00030®\u0001H\u0002J$\u0010±\u0001\u001a\u00020G2\u0019\u0010²\u0001\u001a\u0014\u0012\u0007\u0012\u0005\u0018\u00010³\u0001\u0012\u0007\u0012\u0005\u0018\u00010³\u00010SH\u0002J\u001d\u0010´\u0001\u001a\u00020G2\t\u0010µ\u0001\u001a\u0004\u0018\u00010I2\u0007\u0010¶\u0001\u001a\u00020!H\u0002J\u0012\u0010·\u0001\u001a\u00020G2\u0007\u0010¸\u0001\u001a\u00020CH\u0002J.\u0010¹\u0001\u001a\u00020G\"\u000b\b\u0000\u0010º\u0001\u0018\u0001*\u00020\u00062\u0015\u0010»\u0001\u001a\u0010\u0012\u0005\u0012\u0003Hº\u0001\u0012\u0005\u0012\u0003Hº\u00010SH\u0082\bR\u0016\u0010/\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010100X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u001f\u00102\u001a\u0013\u0012\u000f\u0012\r\u0012\u0004\u0012\u00020\u00060\u0005¢\u0006\u0002\b\u000700X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u00103\u001a\u000204X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0010X\u0082\u0004¢\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\u000e\u0010,\u001a\u00020-X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u001c\u001a\u00020\u001dX\u0082\u0004¢\u0006\u0002\n\u0000R\u0017\u0010\"\u001a\b\u0012\u0004\u0012\u00020#0\u000b¢\u0006\b\n\u0000\u001a\u0004\b5\u00106R\u000e\u0010&\u001a\u00020'X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010*\u001a\u00020+X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u00107\u001a\u00020!X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010 \u001a\b\u0012\u0004\u0012\u00020!0\u001aX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0012X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0017\u001a\u00020\u0018X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\b\u001a\u0004\u0018\u00010\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\n\u001a\b\u0012\u0004\u0012\u00020\f0\u000bX\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u00108\u001a\u0004\u0018\u000109X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010$\u001a\u00020%X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000eX\u0082\u0004¢\u0006\u0002\n\u0000R\u0019\u0010:\u001a\n\u0012\u0006\u0012\u0004\u0018\u0001010;¢\u0006\b\n\u0000\u001a\u0004\b<\u0010=R\u0016\u0010\u0019\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u001b0\u001aX\u0082\u0004¢\u0006\u0002\n\u0000R\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\u0014\u0010@\u001a\b\u0012\u0004\u0012\u0002040AX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010B\u001a\u0004\u0018\u00010CX\u0082\u000e¢\u0006\u0002\n\u0000R\u0017\u0010D\u001a\b\u0012\u0004\u0012\u00020\u00060;¢\u0006\b\n\u0000\u001a\u0004\bE\u0010=R\u000e\u0010\u001e\u001a\u00020\u001fX\u0082\u0004¢\u0006\u0002\n\u0000\u0082\u0002\u000f\n\u0002\b\u0019\n\u0002\b!\n\u0005\b¡\u001e0\u0001¨\u0006½\u0001"}, d2 = {"Lcom/stripe/android/customersheet/CustomerSheetViewModel;", "Landroidx/lifecycle/ViewModel;", "application", "Landroid/app/Application;", "initialBackStack", "", "Lcom/stripe/android/customersheet/CustomerSheetViewState;", "Lkotlin/jvm/JvmSuppressWildcards;", "originalPaymentSelection", "Lcom/stripe/android/paymentsheet/model/PaymentSelection;", "paymentConfigurationProvider", "Ljavax/inject/Provider;", "Lcom/stripe/android/PaymentConfiguration;", "resources", "Landroid/content/res/Resources;", "configuration", "Lcom/stripe/android/customersheet/CustomerSheet$Configuration;", "logger", "Lcom/stripe/android/core/Logger;", "stripeRepository", "Lcom/stripe/android/networking/StripeRepository;", "customerAdapter", "Lcom/stripe/android/customersheet/CustomerAdapter;", "lpmRepository", "Lcom/stripe/android/ui/core/forms/resources/LpmRepository;", "statusBarColor", "Lkotlin/Function0;", "", "eventReporter", "Lcom/stripe/android/customersheet/analytics/CustomerSheetEventReporter;", "workContext", "Lkotlin/coroutines/CoroutineContext;", "isLiveModeProvider", "", "formViewModelSubcomponentBuilderProvider", "Lcom/stripe/android/paymentsheet/injection/FormViewModelSubcomponent$Builder;", "paymentLauncherFactory", "Lcom/stripe/android/payments/paymentlauncher/StripePaymentLauncherAssistedFactory;", "intentConfirmationInterceptor", "Lcom/stripe/android/paymentsheet/IntentConfirmationInterceptor;", "customerSheetLoader", "Lcom/stripe/android/customersheet/CustomerSheetLoader;", "isFinancialConnectionsAvailable", "Lcom/stripe/android/payments/financialconnections/IsFinancialConnectionsAvailable;", "editInteractorFactory", "Lcom/stripe/android/paymentsheet/ui/ModifiableEditPaymentMethodViewInteractor$Factory;", "(Landroid/app/Application;Ljava/util/List;Lcom/stripe/android/paymentsheet/model/PaymentSelection;Ljavax/inject/Provider;Landroid/content/res/Resources;Lcom/stripe/android/customersheet/CustomerSheet$Configuration;Lcom/stripe/android/core/Logger;Lcom/stripe/android/networking/StripeRepository;Lcom/stripe/android/customersheet/CustomerAdapter;Lcom/stripe/android/ui/core/forms/resources/LpmRepository;Lkotlin/jvm/functions/Function0;Lcom/stripe/android/customersheet/analytics/CustomerSheetEventReporter;Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function0;Ljavax/inject/Provider;Lcom/stripe/android/payments/paymentlauncher/StripePaymentLauncherAssistedFactory;Lcom/stripe/android/paymentsheet/IntentConfirmationInterceptor;Lcom/stripe/android/customersheet/CustomerSheetLoader;Lcom/stripe/android/payments/financialconnections/IsFinancialConnectionsAvailable;Lcom/stripe/android/paymentsheet/ui/ModifiableEditPaymentMethodViewInteractor$Factory;)V", "_result", "Lkotlinx/coroutines/flow/MutableStateFlow;", "Lcom/stripe/android/customersheet/InternalCustomerSheetResult;", "backStack", "card", "Lcom/stripe/android/ui/core/forms/resources/LpmRepository$SupportedPaymentMethod;", "getFormViewModelSubcomponentBuilderProvider", "()Ljavax/inject/Provider;", "isGooglePayReadyAndEnabled", "paymentLauncher", "Lcom/stripe/android/payments/paymentlauncher/PaymentLauncher;", "result", "Lkotlinx/coroutines/flow/StateFlow;", "getResult", "()Lkotlinx/coroutines/flow/StateFlow;", "stripeIntent", "Lcom/stripe/android/model/StripeIntent;", "supportedPaymentMethods", "", "unconfirmedPaymentMethod", "Lcom/stripe/android/model/PaymentMethod;", "viewState", "getViewState", "attachPaymentMethod", "", "id", "", "(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "attachPaymentMethodToCustomer", "paymentMethod", "attachWithSetupIntent", "(Lcom/stripe/android/model/PaymentMethod;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "bottomSheetConfirmStateChange", "buildDefaultSelectPaymentMethod", "Lcom/stripe/android/customersheet/CustomerSheetViewState$SelectPaymentMethod;", "override", "Lkotlin/Function1;", "Lkotlin/ParameterName;", "name", "buildFormObserver", "formArguments", "Lcom/stripe/android/paymentsheet/paymentdatacollection/FormArguments;", "onFormDataUpdated", "Lcom/stripe/android/paymentsheet/forms/FormViewModel$ViewData;", Constants.ScionAnalytics.MessageType.DATA_MESSAGE, "confirmPaymentSelection", "paymentSelection", RequestHeadersFactory.TYPE, "confirmPaymentSelectionError", "cause", "", "displayMessage", "confirmStripeIntent", "confirmStripeIntentParams", "Lcom/stripe/android/model/ConfirmStripeIntentParams;", "createAndAttach", "paymentMethodCreateParams", "Lcom/stripe/android/model/PaymentMethodCreateParams;", "createPaymentMethod", "Lkotlin/Result;", "createParams", "createPaymentMethod-gIAlu-s", "(Lcom/stripe/android/model/PaymentMethodCreateParams;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "handleFailureToRemovePaymentMethod", "handleNextAction", "clientSecret", "handlePaymentMethodRemoved", "handleStripeIntent", "handleStripeIntent-BWLJW6A", "(Lcom/stripe/android/model/StripeIntent;Ljava/lang/String;Lcom/stripe/android/model/PaymentMethod;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "handleViewAction", "viewAction", "Lcom/stripe/android/customersheet/CustomerSheetViewAction;", "loadCustomerSheetState", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "modifyCardPaymentMethod", "Lcom/stripe/android/customersheet/CustomerAdapter$Result;", "brand", "Lcom/stripe/android/model/CardBrand;", "(Lcom/stripe/android/model/PaymentMethod;Lcom/stripe/android/model/CardBrand;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "onAddCardPressed", "onAddPaymentMethodItemChanged", "onBackPressed", "onCancelCloseForm", "onCollectUSBankAccountResult", "bankAccountResult", "Lcom/stripe/android/payments/bankaccount/navigation/CollectBankAccountResultInternal;", "onConfirmUSBankAccount", "usBankAccount", "Lcom/stripe/android/paymentsheet/model/PaymentSelection$New$USBankAccount;", "onDismissed", "onEditPressed", "formData", "onFormError", Constants.IPC_BUNDLE_KEY_SEND_ERROR, "onFormFieldValuesCompleted", "formFieldValues", "Lcom/stripe/android/paymentsheet/forms/FormFieldValues;", "onItemRemoved", "onItemSelected", "onModifyItem", "onPaymentLauncherResult", "Lcom/stripe/android/payments/paymentlauncher/PaymentResult;", "onPrimaryButtonPressed", "providePaymentMethodName", "code", "Lcom/stripe/android/model/PaymentMethodCode;", "registerFromActivity", "activityResultCaller", "Landroidx/activity/result/ActivityResultCaller;", "lifecycleOwner", "Landroidx/lifecycle/LifecycleOwner;", "removePaymentMethod", "removePaymentMethodFromState", "safeUpdateSelectPaymentMethodState", "update", "state", "selectGooglePay", "selectSavedPaymentMethod", "savedPaymentSelection", "Lcom/stripe/android/paymentsheet/model/PaymentSelection$Saved;", "transition", "to", "reset", "transitionToAddPaymentMethod", "isFirstPaymentMethod", "cbcEligibility", "Lcom/stripe/android/ui/core/cbc/CardBrandChoiceEligibility;", "transitionToInitialScreen", "paymentMethods", "updateCustomButtonUIState", "callback", "Lcom/stripe/android/paymentsheet/ui/PrimaryButton$UIState;", "updateMandateText", "mandateText", "showAbove", "updatePaymentMethodInState", "updatedMethod", "updateViewState", "T", "transform", "Factory", "paymentsheet_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class CustomerSheetViewModel extends ViewModel {
private final MutableStateFlow<InternalCustomerSheetResult> _result;
private final Application application;
private final MutableStateFlow<List<CustomerSheetViewState>> backStack;
private final LpmRepository.SupportedPaymentMethod card;
private final CustomerSheet.Configuration configuration;
private final CustomerAdapter customerAdapter;
private final CustomerSheetLoader customerSheetLoader;
private final ModifiableEditPaymentMethodViewInteractor.Factory editInteractorFactory;
private final CustomerSheetEventReporter eventReporter;
private final Provider<FormViewModelSubcomponent.Builder> formViewModelSubcomponentBuilderProvider;
private final IntentConfirmationInterceptor intentConfirmationInterceptor;
private final IsFinancialConnectionsAvailable isFinancialConnectionsAvailable;
private boolean isGooglePayReadyAndEnabled;
private final Function0<Boolean> isLiveModeProvider;
private final Logger logger;
private final LpmRepository lpmRepository;
private PaymentSelection originalPaymentSelection;
private final Provider<PaymentConfiguration> paymentConfigurationProvider;
private PaymentLauncher paymentLauncher;
private final StripePaymentLauncherAssistedFactory paymentLauncherFactory;
private final Resources resources;
private final StateFlow<InternalCustomerSheetResult> result;
private final Function0<Integer> statusBarColor;
private StripeIntent stripeIntent;
private final StripeRepository stripeRepository;
private List<LpmRepository.SupportedPaymentMethod> supportedPaymentMethods;
private PaymentMethod unconfirmedPaymentMethod;
private final StateFlow<CustomerSheetViewState> viewState;
private final CoroutineContext workContext;
public CustomerSheetViewModel(Application application, List list, PaymentSelection paymentSelection, Provider provider, Resources resources, CustomerSheet.Configuration configuration, Logger logger, StripeRepository stripeRepository, CustomerAdapter customerAdapter, LpmRepository lpmRepository, Function0 function0, CustomerSheetEventReporter customerSheetEventReporter, CoroutineContext coroutineContext, Function0 function02, Provider provider2, StripePaymentLauncherAssistedFactory stripePaymentLauncherAssistedFactory, IntentConfirmationInterceptor intentConfirmationInterceptor, CustomerSheetLoader customerSheetLoader, IsFinancialConnectionsAvailable isFinancialConnectionsAvailable, ModifiableEditPaymentMethodViewInteractor.Factory factory, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(application, list, paymentSelection, provider, resources, configuration, logger, stripeRepository, customerAdapter, lpmRepository, function0, customerSheetEventReporter, (i & 4096) != 0 ? (CoroutineContext) Dispatchers.getIO() : coroutineContext, function02, provider2, stripePaymentLauncherAssistedFactory, intentConfirmationInterceptor, customerSheetLoader, isFinancialConnectionsAvailable, factory);
}
public final Provider<FormViewModelSubcomponent.Builder> getFormViewModelSubcomponentBuilderProvider() {
return this.formViewModelSubcomponentBuilderProvider;
}
@Inject
public CustomerSheetViewModel(Application application, List<CustomerSheetViewState> list, PaymentSelection paymentSelection, Provider<PaymentConfiguration> provider, Resources resources, CustomerSheet.Configuration configuration, Logger logger, StripeRepository stripeRepository, CustomerAdapter customerAdapter, LpmRepository lpmRepository, Function0<Integer> function0, CustomerSheetEventReporter customerSheetEventReporter, CoroutineContext coroutineContext, @Named("isLiveMode") Function0<Boolean> function02, Provider<FormViewModelSubcomponent.Builder> provider2, StripePaymentLauncherAssistedFactory stripePaymentLauncherAssistedFactory, IntentConfirmationInterceptor intentConfirmationInterceptor, CustomerSheetLoader customerSheetLoader, IsFinancialConnectionsAvailable isFinancialConnectionsAvailable, ModifiableEditPaymentMethodViewInteractor.Factory factory) {
Intrinsics.checkNotNullParameter(application, "application");
Intrinsics.checkNotNullParameter(list, "initialBackStack");
Intrinsics.checkNotNullParameter(provider, "paymentConfigurationProvider");
Intrinsics.checkNotNullParameter(resources, "resources");
Intrinsics.checkNotNullParameter(configuration, "configuration");
Intrinsics.checkNotNullParameter(logger, "logger");
Intrinsics.checkNotNullParameter(stripeRepository, "stripeRepository");
Intrinsics.checkNotNullParameter(customerAdapter, "customerAdapter");
Intrinsics.checkNotNullParameter(lpmRepository, "lpmRepository");
Intrinsics.checkNotNullParameter(function0, "statusBarColor");
Intrinsics.checkNotNullParameter(customerSheetEventReporter, "eventReporter");
Intrinsics.checkNotNullParameter(coroutineContext, "workContext");
Intrinsics.checkNotNullParameter(function02, "isLiveModeProvider");
Intrinsics.checkNotNullParameter(provider2, "formViewModelSubcomponentBuilderProvider");
Intrinsics.checkNotNullParameter(stripePaymentLauncherAssistedFactory, "paymentLauncherFactory");
Intrinsics.checkNotNullParameter(intentConfirmationInterceptor, "intentConfirmationInterceptor");
Intrinsics.checkNotNullParameter(customerSheetLoader, "customerSheetLoader");
Intrinsics.checkNotNullParameter(isFinancialConnectionsAvailable, "isFinancialConnectionsAvailable");
Intrinsics.checkNotNullParameter(factory, "editInteractorFactory");
this.application = application;
this.originalPaymentSelection = paymentSelection;
this.paymentConfigurationProvider = provider;
this.resources = resources;
this.configuration = configuration;
this.logger = logger;
this.stripeRepository = stripeRepository;
this.customerAdapter = customerAdapter;
this.lpmRepository = lpmRepository;
this.statusBarColor = function0;
this.eventReporter = customerSheetEventReporter;
this.workContext = coroutineContext;
this.isLiveModeProvider = function02;
this.formViewModelSubcomponentBuilderProvider = provider2;
this.paymentLauncherFactory = stripePaymentLauncherAssistedFactory;
this.intentConfirmationInterceptor = intentConfirmationInterceptor;
this.customerSheetLoader = customerSheetLoader;
this.isFinancialConnectionsAvailable = isFinancialConnectionsAvailable;
this.editInteractorFactory = factory;
StateFlow MutableStateFlow = StateFlowKt.MutableStateFlow(list);
this.backStack = MutableStateFlow;
CustomerSheetViewModel customerSheetViewModel = this;
StateFlow<CustomerSheetViewState> mapAsStateFlow$default = StateFlowsKt.mapAsStateFlow$default(customerSheetViewModel, MutableStateFlow, (SharingStarted) null, new Function1<List<CustomerSheetViewState>, CustomerSheetViewState>() {
public final CustomerSheetViewState invoke(List<CustomerSheetViewState> list2) {
Intrinsics.checkNotNullParameter(list2, "it");
return (CustomerSheetViewState) CollectionsKt.last(list2);
}
}, 2, (Object) null);
this.viewState = mapAsStateFlow$default;
StateFlow<InternalCustomerSheetResult> MutableStateFlow2 = StateFlowKt.MutableStateFlow((Object) null);
this._result = MutableStateFlow2;
this.result = MutableStateFlow2;
this.supportedPaymentMethods = new ArrayList();
this.card = LpmRepository.Companion.hardcodedCardSpec(PaymentSheetLoaderKt.toInternal(configuration.getBillingDetailsCollectionConfiguration()));
PaymentSheetConfigurationKtxKt.parseAppearance(configuration.getAppearance());
if (mapAsStateFlow$default.getValue() instanceof CustomerSheetViewState.Loading) {
BuildersKt.launch$default(ViewModelKt.getViewModelScope(customerSheetViewModel), (CoroutineContext) null, (CoroutineStart) null, new AnonymousClass1(null), 3, (Object) null);
}
}
public final StateFlow<CustomerSheetViewState> getViewState() {
return this.viewState;
}
public final StateFlow<InternalCustomerSheetResult> getResult() {
return this.result;
}
@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.customersheet.CustomerSheetViewModel$1", f = "CustomerSheetViewModel.kt", i = {}, l = {119}, m = "invokeSuspend", n = {}, s = {})
static final class AnonymousClass1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
int label;
AnonymousClass1(Continuation<? super AnonymousClass1> continuation) {
super(2, continuation);
}
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
return CustomerSheetViewModel.this.new AnonymousClass1(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 i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
this.label = 1;
if (CustomerSheetViewModel.this.loadCustomerSheetState((Continuation) this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
}
public final void handleViewAction(CustomerSheetViewAction viewAction) {
Intrinsics.checkNotNullParameter(viewAction, "viewAction");
if (viewAction instanceof CustomerSheetViewAction.OnDismissed) {
onDismissed();
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnAddCardPressed) {
onAddCardPressed();
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnBackPressed) {
onBackPressed();
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnEditPressed) {
onEditPressed();
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnItemRemoved) {
onItemRemoved(((CustomerSheetViewAction.OnItemRemoved) viewAction).getPaymentMethod());
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnModifyItem) {
onModifyItem(((CustomerSheetViewAction.OnModifyItem) viewAction).getPaymentMethod());
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnItemSelected) {
onItemSelected(((CustomerSheetViewAction.OnItemSelected) viewAction).getSelection());
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnPrimaryButtonPressed) {
onPrimaryButtonPressed();
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnAddPaymentMethodItemChanged) {
onAddPaymentMethodItemChanged(((CustomerSheetViewAction.OnAddPaymentMethodItemChanged) viewAction).getPaymentMethod());
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnFormFieldValuesCompleted) {
onFormFieldValuesCompleted(((CustomerSheetViewAction.OnFormFieldValuesCompleted) viewAction).getFormFieldValues());
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnUpdateCustomButtonUIState) {
updateCustomButtonUIState(((CustomerSheetViewAction.OnUpdateCustomButtonUIState) viewAction).getCallback());
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnUpdateMandateText) {
CustomerSheetViewAction.OnUpdateMandateText onUpdateMandateText = (CustomerSheetViewAction.OnUpdateMandateText) viewAction;
updateMandateText(onUpdateMandateText.getMandateText(), onUpdateMandateText.getShowAbovePrimaryButton());
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnCollectBankAccountResult) {
onCollectUSBankAccountResult(((CustomerSheetViewAction.OnCollectBankAccountResult) viewAction).getBankAccountResult());
return;
}
if (viewAction instanceof CustomerSheetViewAction.OnConfirmUSBankAccount) {
onConfirmUSBankAccount(((CustomerSheetViewAction.OnConfirmUSBankAccount) viewAction).getUsBankAccount());
} else if (viewAction instanceof CustomerSheetViewAction.OnFormError) {
onFormError(((CustomerSheetViewAction.OnFormError) viewAction).getError());
} else if (viewAction instanceof CustomerSheetViewAction.OnCancelClose) {
onCancelCloseForm();
}
}
public final boolean bottomSheetConfirmStateChange() {
Object value;
ArrayList arrayList;
CustomerSheetViewState.AddPaymentMethod copy;
if (!((CustomerSheetViewState) this.viewState.getValue()).shouldDisplayDismissConfirmationModal(this.isFinancialConnectionsAvailable)) {
return true;
}
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod : list) {
if (addPaymentMethod instanceof CustomerSheetViewState.AddPaymentMethod) {
copy = r7.copy((r38 & 1) != 0 ? r7.paymentMethodCode : null, (r38 & 2) != 0 ? r7.supportedPaymentMethods : null, (r38 & 4) != 0 ? r7.formViewData : null, (r38 & 8) != 0 ? r7.formArguments : null, (r38 & 16) != 0 ? r7.usBankAccountFormArguments : null, (r38 & 32) != 0 ? r7.selectedPaymentMethod : null, (r38 & 64) != 0 ? r7.draftPaymentSelection : null, (r38 & 128) != 0 ? r7.enabled : false, (r38 & 256) != 0 ? r7.isLiveMode : false, (r38 & 512) != 0 ? r7.isProcessing : false, (r38 & 1024) != 0 ? r7.errorMessage : null, (r38 & 2048) != 0 ? r7.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? r7.primaryButtonLabel : null, (r38 & 8192) != 0 ? r7.primaryButtonEnabled : false, (r38 & 16384) != 0 ? r7.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? r7.mandateText : null, (r38 & 65536) != 0 ? r7.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? r7.displayDismissConfirmationModal : true, (r38 & Opcodes.ASM4) != 0 ? r7.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? ((CustomerSheetViewState.AddPaymentMethod) addPaymentMethod).cbcEligibility : null);
addPaymentMethod = copy;
}
arrayList.add(addPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
return false;
}
public final String providePaymentMethodName(String code) {
LpmRepository.SupportedPaymentMethod fromCode = this.lpmRepository.fromCode(code);
String string = fromCode != null ? this.resources.getString(fromCode.getDisplayNameResource()) : null;
return string == null ? "" : string;
}
public final void registerFromActivity(ActivityResultCaller activityResultCaller, LifecycleOwner lifecycleOwner) {
Intrinsics.checkNotNullParameter(activityResultCaller, "activityResultCaller");
Intrinsics.checkNotNullParameter(lifecycleOwner, "lifecycleOwner");
final ActivityResultLauncher registerForActivityResult = activityResultCaller.registerForActivityResult(new PaymentLauncherContract(), new CustomerSheetViewModel$sam$androidx_activity_result_ActivityResultCallback$0(PaymentLauncherUtilsKt.toInternalPaymentResultCallback(new CustomerSheetViewModel$registerFromActivity$launcher$1(this))));
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "activityResultCaller.reg…LauncherResult)\n )");
this.paymentLauncher = this.paymentLauncherFactory.create(new Function0<String>() {
{
super(0);
}
public final String invoke() {
Provider provider;
provider = CustomerSheetViewModel.this.paymentConfigurationProvider;
return ((PaymentConfiguration) provider.get()).getPublishableKey();
}
}, new Function0<String>() {
{
super(0);
}
public final String invoke() {
Provider provider;
provider = CustomerSheetViewModel.this.paymentConfigurationProvider;
return ((PaymentConfiguration) provider.get()).getStripeAccountId();
}
}, (Integer) this.statusBarColor.invoke(), true, registerForActivityResult);
lifecycleOwner.getLifecycle().addObserver(new DefaultLifecycleObserver() {
public void onDestroy(LifecycleOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
registerForActivityResult.unregister();
this.paymentLauncher = null;
super.onDestroy(owner);
}
});
}
public final void onPaymentLauncherResult(PaymentResult result) {
Object value;
ArrayList arrayList;
CustomerSheetViewState.AddPaymentMethod copy;
Object value2;
ArrayList arrayList2;
CustomerSheetViewState.AddPaymentMethod copy2;
if (result instanceof PaymentResult.Canceled) {
MutableStateFlow mutableStateFlow = this.backStack;
do {
value2 = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value2;
arrayList2 = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod : list) {
if (addPaymentMethod instanceof CustomerSheetViewState.AddPaymentMethod) {
CustomerSheetViewState.AddPaymentMethod addPaymentMethod2 = (CustomerSheetViewState.AddPaymentMethod) addPaymentMethod;
copy2 = addPaymentMethod2.copy((r38 & 1) != 0 ? addPaymentMethod2.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod2.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod2.formViewData : null, (r38 & 8) != 0 ? addPaymentMethod2.formArguments : null, (r38 & 16) != 0 ? addPaymentMethod2.usBankAccountFormArguments : null, (r38 & 32) != 0 ? addPaymentMethod2.selectedPaymentMethod : null, (r38 & 64) != 0 ? addPaymentMethod2.draftPaymentSelection : null, (r38 & 128) != 0 ? addPaymentMethod2.enabled : true, (r38 & 256) != 0 ? addPaymentMethod2.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod2.isProcessing : false, (r38 & 1024) != 0 ? addPaymentMethod2.errorMessage : null, (r38 & 2048) != 0 ? addPaymentMethod2.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod2.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod2.primaryButtonEnabled : addPaymentMethod2.getFormViewData().getCompleteFormValues() != null, (r38 & 16384) != 0 ? addPaymentMethod2.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod2.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod2.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? addPaymentMethod2.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? addPaymentMethod2.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? addPaymentMethod2.cbcEligibility : null);
addPaymentMethod = copy2;
}
arrayList2.add(addPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value2, arrayList2));
return;
}
if (result instanceof PaymentResult.Completed) {
safeUpdateSelectPaymentMethodState(new Function1<CustomerSheetViewState.SelectPaymentMethod, CustomerSheetViewState.SelectPaymentMethod>() {
{
super(1);
}
public final CustomerSheetViewState.SelectPaymentMethod invoke(CustomerSheetViewState.SelectPaymentMethod selectPaymentMethod) {
PaymentMethod paymentMethod;
Resources resources;
Application application;
CustomerSheet.Configuration configuration;
CustomerSheetViewState.SelectPaymentMethod copy3;
Intrinsics.checkNotNullParameter(selectPaymentMethod, "viewState");
paymentMethod = CustomerSheetViewModel.this.unconfirmedPaymentMethod;
if (paymentMethod != null) {
CustomerSheetViewModel customerSheetViewModel = CustomerSheetViewModel.this;
customerSheetViewModel.unconfirmedPaymentMethod = null;
PaymentSelection saved = new PaymentSelection.Saved(paymentMethod, (PaymentSelection.Saved.WalletType) null, 2, (DefaultConstructorMarker) null);
resources = customerSheetViewModel.resources;
String string = resources.getString(R.string.stripe_paymentsheet_confirm);
application = customerSheetViewModel.application;
configuration = customerSheetViewModel.configuration;
copy3 = selectPaymentMethod.copy((r28 & 1) != 0 ? selectPaymentMethod.title : null, (r28 & 2) != 0 ? selectPaymentMethod.savedPaymentMethods : CollectionsKt.plus(CollectionsKt.listOf(paymentMethod), selectPaymentMethod.getSavedPaymentMethods()), (r28 & 4) != 0 ? selectPaymentMethod.paymentSelection : saved, (r28 & 8) != 0 ? selectPaymentMethod.isLiveMode : false, (r28 & 16) != 0 ? selectPaymentMethod.isProcessing : false, (r28 & 32) != 0 ? selectPaymentMethod.isEditing : false, (r28 & 64) != 0 ? selectPaymentMethod.isGooglePayEnabled : false, (r28 & 128) != 0 ? selectPaymentMethod.primaryButtonVisible : true, (r28 & 256) != 0 ? selectPaymentMethod.primaryButtonLabel : string, (r28 & 512) != 0 ? selectPaymentMethod.errorMessage : null, (r28 & 1024) != 0 ? selectPaymentMethod.unconfirmedPaymentMethod : null, (r28 & 2048) != 0 ? selectPaymentMethod.mandateText : saved.mandateText(application, configuration.getMerchantDisplayName(), false, false), (r28 & 4096) != 0 ? selectPaymentMethod.cbcEligibility : null);
if (copy3 != null) {
return copy3;
}
}
return selectPaymentMethod;
}
});
onBackPressed();
return;
}
if (result instanceof PaymentResult.Failed) {
MutableStateFlow mutableStateFlow2 = this.backStack;
do {
value = mutableStateFlow2.getValue();
List<CustomerSheetViewState> list2 = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list2, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod3 : list2) {
if (addPaymentMethod3 instanceof CustomerSheetViewState.AddPaymentMethod) {
CustomerSheetViewState.AddPaymentMethod addPaymentMethod4 = (CustomerSheetViewState.AddPaymentMethod) addPaymentMethod3;
copy = addPaymentMethod4.copy((r38 & 1) != 0 ? addPaymentMethod4.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod4.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod4.formViewData : null, (r38 & 8) != 0 ? addPaymentMethod4.formArguments : null, (r38 & 16) != 0 ? addPaymentMethod4.usBankAccountFormArguments : null, (r38 & 32) != 0 ? addPaymentMethod4.selectedPaymentMethod : null, (r38 & 64) != 0 ? addPaymentMethod4.draftPaymentSelection : null, (r38 & 128) != 0 ? addPaymentMethod4.enabled : true, (r38 & 256) != 0 ? addPaymentMethod4.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod4.isProcessing : false, (r38 & 1024) != 0 ? addPaymentMethod4.errorMessage : ExceptionKtKt.stripeErrorMessage(((PaymentResult.Failed) result).getThrowable(), this.application), (r38 & 2048) != 0 ? addPaymentMethod4.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod4.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod4.primaryButtonEnabled : addPaymentMethod4.getFormViewData().getCompleteFormValues() != null, (r38 & 16384) != 0 ? addPaymentMethod4.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod4.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod4.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? addPaymentMethod4.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? addPaymentMethod4.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? addPaymentMethod4.cbcEligibility : null);
addPaymentMethod3 = copy;
}
arrayList.add(addPaymentMethod3);
}
} while (!mutableStateFlow2.compareAndSet(value, arrayList));
}
}
public final java.lang.Object loadCustomerSheetState(kotlin.coroutines.Continuation<? super kotlin.Unit> r6) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.loadCustomerSheetState(kotlin.coroutines.Continuation):java.lang.Object");
}
private final void transitionToInitialScreen(final List<PaymentMethod> paymentMethods, final PaymentSelection paymentSelection, final CardBrandChoiceEligibility cbcEligibility) {
if (paymentMethods.isEmpty() && !this.isGooglePayReadyAndEnabled) {
transitionToAddPaymentMethod(true, cbcEligibility);
} else {
transition(buildDefaultSelectPaymentMethod(new Function1<CustomerSheetViewState.SelectPaymentMethod, CustomerSheetViewState.SelectPaymentMethod>() {
{
super(1);
}
public final CustomerSheetViewState.SelectPaymentMethod invoke(CustomerSheetViewState.SelectPaymentMethod selectPaymentMethod) {
CustomerSheetViewState.SelectPaymentMethod copy;
Intrinsics.checkNotNullParameter(selectPaymentMethod, "it");
copy = selectPaymentMethod.copy((r28 & 1) != 0 ? selectPaymentMethod.title : null, (r28 & 2) != 0 ? selectPaymentMethod.savedPaymentMethods : paymentMethods, (r28 & 4) != 0 ? selectPaymentMethod.paymentSelection : paymentSelection, (r28 & 8) != 0 ? selectPaymentMethod.isLiveMode : false, (r28 & 16) != 0 ? selectPaymentMethod.isProcessing : false, (r28 & 32) != 0 ? selectPaymentMethod.isEditing : false, (r28 & 64) != 0 ? selectPaymentMethod.isGooglePayEnabled : false, (r28 & 128) != 0 ? selectPaymentMethod.primaryButtonVisible : false, (r28 & 256) != 0 ? selectPaymentMethod.primaryButtonLabel : null, (r28 & 512) != 0 ? selectPaymentMethod.errorMessage : null, (r28 & 1024) != 0 ? selectPaymentMethod.unconfirmedPaymentMethod : null, (r28 & 2048) != 0 ? selectPaymentMethod.mandateText : null, (r28 & 4096) != 0 ? selectPaymentMethod.cbcEligibility : cbcEligibility);
return copy;
}
}), true);
}
}
private final void onAddCardPressed() {
transitionToAddPaymentMethod$default(this, false, null, 2, null);
}
private final void onDismissed() {
Object value;
MutableStateFlow<InternalCustomerSheetResult> mutableStateFlow = this._result;
do {
value = mutableStateFlow.getValue();
} while (!mutableStateFlow.compareAndSet(value, new InternalCustomerSheetResult.Canceled(this.originalPaymentSelection)));
}
public final void onBackPressed() {
Object value;
if (((List) this.backStack.getValue()).size() == 1) {
this._result.tryEmit(new InternalCustomerSheetResult.Canceled(this.originalPaymentSelection));
return;
}
MutableStateFlow<List<CustomerSheetViewState>> mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
} while (!mutableStateFlow.compareAndSet(value, CollectionsKt.dropLast((List) value, 1)));
}
private final void onEditPressed() {
Object value;
ArrayList arrayList;
CustomerSheetViewState.SelectPaymentMethod copy;
if (((CustomerSheetViewState) this.viewState.getValue()).getIsEditing()) {
this.eventReporter.onEditCompleted();
} else {
this.eventReporter.onEditTapped();
}
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.SelectPaymentMethod selectPaymentMethod : list) {
if (selectPaymentMethod instanceof CustomerSheetViewState.SelectPaymentMethod) {
CustomerSheetViewState.SelectPaymentMethod selectPaymentMethod2 = (CustomerSheetViewState.SelectPaymentMethod) selectPaymentMethod;
boolean z = !selectPaymentMethod2.getIsEditing();
copy = selectPaymentMethod2.copy((r28 & 1) != 0 ? selectPaymentMethod2.title : null, (r28 & 2) != 0 ? selectPaymentMethod2.savedPaymentMethods : null, (r28 & 4) != 0 ? selectPaymentMethod2.paymentSelection : null, (r28 & 8) != 0 ? selectPaymentMethod2.isLiveMode : false, (r28 & 16) != 0 ? selectPaymentMethod2.isProcessing : false, (r28 & 32) != 0 ? selectPaymentMethod2.isEditing : z, (r28 & 64) != 0 ? selectPaymentMethod2.isGooglePayEnabled : false, (r28 & 128) != 0 ? selectPaymentMethod2.primaryButtonVisible : (z || Intrinsics.areEqual(this.originalPaymentSelection, selectPaymentMethod2.getPaymentSelection())) ? false : true, (r28 & 256) != 0 ? selectPaymentMethod2.primaryButtonLabel : null, (r28 & 512) != 0 ? selectPaymentMethod2.errorMessage : null, (r28 & 1024) != 0 ? selectPaymentMethod2.unconfirmedPaymentMethod : null, (r28 & 2048) != 0 ? selectPaymentMethod2.mandateText : null, (r28 & 4096) != 0 ? selectPaymentMethod2.cbcEligibility : null);
selectPaymentMethod = copy;
}
arrayList.add(selectPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void onAddPaymentMethodItemChanged(LpmRepository.SupportedPaymentMethod paymentMethod) {
Object value;
ArrayList arrayList;
ResolvableString resolvableString$default;
CustomerSheetViewState.AddPaymentMethod copy;
Object value2 = this.viewState.getValue();
CustomerSheetViewState.AddPaymentMethod addPaymentMethod = value2 instanceof CustomerSheetViewState.AddPaymentMethod ? (CustomerSheetViewState.AddPaymentMethod) value2 : null;
if (addPaymentMethod == null || !Intrinsics.areEqual(addPaymentMethod.getPaymentMethodCode(), paymentMethod.getCode())) {
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod2 : list) {
if (addPaymentMethod2 instanceof CustomerSheetViewState.AddPaymentMethod) {
CustomerSheetViewState.AddPaymentMethod addPaymentMethod3 = (CustomerSheetViewState.AddPaymentMethod) addPaymentMethod2;
String code = paymentMethod.getCode();
FormArgumentsFactory formArgumentsFactory = FormArgumentsFactory.INSTANCE;
CustomerSheet.Configuration configuration = this.configuration;
FormArguments create = formArgumentsFactory.create(paymentMethod, configuration, configuration.getMerchantDisplayName(), addPaymentMethod3.getCbcEligibility());
if (Intrinsics.areEqual(paymentMethod.getCode(), PaymentMethod.Type.USBankAccount.code) && !(addPaymentMethod3.getBankAccountResult() instanceof CollectBankAccountResultInternal.Completed)) {
resolvableString$default = ResolvableStringUtilsKt.resolvableString$default(com.stripe.android.ui.core.R.string.stripe_continue_button_label, new Object[0], null, 4, null);
} else {
resolvableString$default = ResolvableStringUtilsKt.resolvableString$default(R.string.stripe_paymentsheet_save, new Object[0], null, 4, null);
}
ResolvableString resolvableString = resolvableString$default;
PaymentSelection draftPaymentSelection = addPaymentMethod3.getDraftPaymentSelection();
copy = addPaymentMethod3.copy((r38 & 1) != 0 ? addPaymentMethod3.paymentMethodCode : code, (r38 & 2) != 0 ? addPaymentMethod3.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod3.formViewData : null, (r38 & 8) != 0 ? addPaymentMethod3.formArguments : create, (r38 & 16) != 0 ? addPaymentMethod3.usBankAccountFormArguments : null, (r38 & 32) != 0 ? addPaymentMethod3.selectedPaymentMethod : paymentMethod, (r38 & 64) != 0 ? addPaymentMethod3.draftPaymentSelection : null, (r38 & 128) != 0 ? addPaymentMethod3.enabled : false, (r38 & 256) != 0 ? addPaymentMethod3.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod3.isProcessing : false, (r38 & 1024) != 0 ? addPaymentMethod3.errorMessage : null, (r38 & 2048) != 0 ? addPaymentMethod3.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod3.primaryButtonLabel : resolvableString, (r38 & 8192) != 0 ? addPaymentMethod3.primaryButtonEnabled : (addPaymentMethod3.getFormViewData().getCompleteFormValues() == null || addPaymentMethod3.getIsProcessing()) ? false : true, (r38 & 16384) != 0 ? addPaymentMethod3.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod3.mandateText : draftPaymentSelection != null ? draftPaymentSelection.mandateText(this.application, this.configuration.getMerchantDisplayName(), false, true) : null, (r38 & 65536) != 0 ? addPaymentMethod3.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? addPaymentMethod3.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? addPaymentMethod3.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? addPaymentMethod3.cbcEligibility : null);
addPaymentMethod2 = copy;
}
arrayList.add(addPaymentMethod2);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
}
private final void onItemRemoved(PaymentMethod paymentMethod) {
BuildersKt.launch$default(ViewModelKt.getViewModelScope(this), (CoroutineContext) null, (CoroutineStart) null, new CustomerSheetViewModel$onItemRemoved$1(this, paymentMethod, null), 3, (Object) null);
}
public final java.lang.Object removePaymentMethod(com.stripe.android.model.PaymentMethod r5, kotlin.coroutines.Continuation<? super com.stripe.android.customersheet.CustomerAdapter.Result<com.stripe.android.model.PaymentMethod>> r6) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.removePaymentMethod(com.stripe.android.model.PaymentMethod, kotlin.coroutines.Continuation):java.lang.Object");
}
public final java.lang.Object modifyCardPaymentMethod(com.stripe.android.model.PaymentMethod r13, com.stripe.android.model.CardBrand r14, kotlin.coroutines.Continuation<? super com.stripe.android.customersheet.CustomerAdapter.Result<com.stripe.android.model.PaymentMethod>> r15) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.modifyCardPaymentMethod(com.stripe.android.model.PaymentMethod, com.stripe.android.model.CardBrand, kotlin.coroutines.Continuation):java.lang.Object");
}
public final void handlePaymentMethodRemoved(PaymentMethod paymentMethod) {
ArrayList arrayList;
CustomerSheetViewState.SelectPaymentMethod copy;
CustomerSheetViewState customerSheetViewState = (CustomerSheetViewState) this.viewState.getValue();
List<PaymentMethod> savedPaymentMethods = customerSheetViewState.getSavedPaymentMethods();
ArrayList arrayList2 = new ArrayList();
for (Object obj : savedPaymentMethods) {
String str = ((PaymentMethod) obj).id;
String str2 = paymentMethod.id;
Intrinsics.checkNotNull(str2);
if (true ^ Intrinsics.areEqual(str, str2)) {
arrayList2.add(obj);
}
}
ArrayList arrayList3 = arrayList2;
PaymentSelection paymentSelection = null;
if (customerSheetViewState instanceof CustomerSheetViewState.SelectPaymentMethod) {
MutableStateFlow mutableStateFlow = this.backStack;
while (true) {
Object value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
ArrayList arrayList4 = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.SelectPaymentMethod selectPaymentMethod : list) {
if (selectPaymentMethod instanceof CustomerSheetViewState.SelectPaymentMethod) {
CustomerSheetViewState.SelectPaymentMethod selectPaymentMethod2 = (CustomerSheetViewState.SelectPaymentMethod) selectPaymentMethod;
PaymentSelection.Saved saved = this.originalPaymentSelection;
boolean z = false;
boolean z2 = (selectPaymentMethod2.getPaymentSelection() instanceof PaymentSelection.Saved) && Intrinsics.areEqual(selectPaymentMethod2.getPaymentSelection().getPaymentMethod().id, paymentMethod.id);
if ((selectPaymentMethod2.getPaymentSelection() instanceof PaymentSelection.Saved) && (saved instanceof PaymentSelection.Saved) && Intrinsics.areEqual(selectPaymentMethod2.getPaymentSelection().getPaymentMethod().id, saved.getPaymentMethod().id)) {
z = true;
}
if (z) {
this.originalPaymentSelection = paymentSelection;
}
PaymentSelection paymentSelection2 = selectPaymentMethod2.getPaymentSelection();
if (z2) {
paymentSelection2 = paymentSelection;
}
if (paymentSelection2 == null) {
paymentSelection2 = this.originalPaymentSelection;
}
arrayList = arrayList4;
copy = selectPaymentMethod2.copy((r28 & 1) != 0 ? selectPaymentMethod2.title : null, (r28 & 2) != 0 ? selectPaymentMethod2.savedPaymentMethods : arrayList3, (r28 & 4) != 0 ? selectPaymentMethod2.paymentSelection : paymentSelection2, (r28 & 8) != 0 ? selectPaymentMethod2.isLiveMode : false, (r28 & 16) != 0 ? selectPaymentMethod2.isProcessing : false, (r28 & 32) != 0 ? selectPaymentMethod2.isEditing : false, (r28 & 64) != 0 ? selectPaymentMethod2.isGooglePayEnabled : false, (r28 & 128) != 0 ? selectPaymentMethod2.primaryButtonVisible : false, (r28 & 256) != 0 ? selectPaymentMethod2.primaryButtonLabel : null, (r28 & 512) != 0 ? selectPaymentMethod2.errorMessage : null, (r28 & 1024) != 0 ? selectPaymentMethod2.unconfirmedPaymentMethod : null, (r28 & 2048) != 0 ? selectPaymentMethod2.mandateText : null, (r28 & 4096) != 0 ? selectPaymentMethod2.cbcEligibility : null);
selectPaymentMethod = copy;
} else {
arrayList = arrayList4;
}
arrayList.add(selectPaymentMethod);
arrayList4 = arrayList;
paymentSelection = null;
}
if (mutableStateFlow.compareAndSet(value, arrayList4)) {
break;
} else {
paymentSelection = null;
}
}
}
if (!arrayList3.isEmpty() || this.isGooglePayReadyAndEnabled) {
return;
}
transitionToAddPaymentMethod$default(this, true, null, 2, null);
}
public final void handleFailureToRemovePaymentMethod(String displayMessage) {
Object value;
ArrayList arrayList;
CustomerSheetViewState.SelectPaymentMethod copy;
if (this.viewState.getValue() instanceof CustomerSheetViewState.SelectPaymentMethod) {
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.SelectPaymentMethod selectPaymentMethod : list) {
if (selectPaymentMethod instanceof CustomerSheetViewState.SelectPaymentMethod) {
copy = r7.copy((r28 & 1) != 0 ? r7.title : null, (r28 & 2) != 0 ? r7.savedPaymentMethods : null, (r28 & 4) != 0 ? r7.paymentSelection : null, (r28 & 8) != 0 ? r7.isLiveMode : false, (r28 & 16) != 0 ? r7.isProcessing : false, (r28 & 32) != 0 ? r7.isEditing : false, (r28 & 64) != 0 ? r7.isGooglePayEnabled : false, (r28 & 128) != 0 ? r7.primaryButtonVisible : false, (r28 & 256) != 0 ? r7.primaryButtonLabel : null, (r28 & 512) != 0 ? r7.errorMessage : displayMessage, (r28 & 1024) != 0 ? r7.unconfirmedPaymentMethod : null, (r28 & 2048) != 0 ? r7.mandateText : null, (r28 & 4096) != 0 ? ((CustomerSheetViewState.SelectPaymentMethod) selectPaymentMethod).cbcEligibility : null);
selectPaymentMethod = copy;
}
arrayList.add(selectPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
}
private final void onModifyItem(PaymentMethod paymentMethod) {
CustomerSheetViewState customerSheetViewState = (CustomerSheetViewState) this.viewState.getValue();
ModifiableEditPaymentMethodViewInteractor.Factory factory = this.editInteractorFactory;
PaymentMethod.Type type = paymentMethod.type;
transition$default(this, new CustomerSheetViewState.EditPaymentMethod(factory.create(paymentMethod, new CustomerSheetViewModel$onModifyItem$1(this, null), new CustomerSheetViewModel$onModifyItem$2(this, null), providePaymentMethodName(type != null ? type.code : null)), customerSheetViewState.getIsLiveMode(), customerSheetViewState.getCbcEligibility(), customerSheetViewState.getSavedPaymentMethods()), false, 2, null);
}
public final void removePaymentMethodFromState(PaymentMethod paymentMethod) {
BuildersKt.launch$default(ViewModelKt.getViewModelScope(this), (CoroutineContext) null, (CoroutineStart) null, new CustomerSheetViewModel$removePaymentMethodFromState$1(this, paymentMethod, null), 3, (Object) null);
}
private final void updatePaymentMethodInState(PaymentMethod updatedMethod) {
BuildersKt.launch$default(ViewModelKt.getViewModelScope(this), (CoroutineContext) null, (CoroutineStart) null, new CustomerSheetViewModel$updatePaymentMethodInState$1(this, updatedMethod, null), 3, (Object) null);
}
private final void onItemSelected(PaymentSelection paymentSelection) {
Object obj;
MutableStateFlow mutableStateFlow;
ArrayList arrayList;
CustomerSheetViewState.SelectPaymentMethod copy;
PaymentSelection paymentSelection2 = paymentSelection;
if (paymentSelection2 instanceof PaymentSelection.GooglePay ? true : paymentSelection2 instanceof PaymentSelection.Saved) {
if (((CustomerSheetViewState) this.viewState.getValue()).getIsEditing()) {
return;
}
MutableStateFlow mutableStateFlow2 = this.backStack;
while (true) {
Object value = mutableStateFlow2.getValue();
List<CustomerSheetViewState> list = (List) value;
ArrayList arrayList2 = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.SelectPaymentMethod selectPaymentMethod : list) {
if (selectPaymentMethod instanceof CustomerSheetViewState.SelectPaymentMethod) {
CustomerSheetViewState.SelectPaymentMethod selectPaymentMethod2 = (CustomerSheetViewState.SelectPaymentMethod) selectPaymentMethod;
boolean z = !Intrinsics.areEqual(this.originalPaymentSelection, paymentSelection2);
String string = this.resources.getString(R.string.stripe_paymentsheet_confirm);
String mandateText = paymentSelection2.mandateText(this.application, this.configuration.getMerchantDisplayName(), false, false);
obj = value;
mutableStateFlow = mutableStateFlow2;
copy = selectPaymentMethod2.copy((r28 & 1) != 0 ? selectPaymentMethod2.title : null, (r28 & 2) != 0 ? selectPaymentMethod2.savedPaymentMethods : null, (r28 & 4) != 0 ? selectPaymentMethod2.paymentSelection : paymentSelection, (r28 & 8) != 0 ? selectPaymentMethod2.isLiveMode : false, (r28 & 16) != 0 ? selectPaymentMethod2.isProcessing : false, (r28 & 32) != 0 ? selectPaymentMethod2.isEditing : false, (r28 & 64) != 0 ? selectPaymentMethod2.isGooglePayEnabled : false, (r28 & 128) != 0 ? selectPaymentMethod2.primaryButtonVisible : z, (r28 & 256) != 0 ? selectPaymentMethod2.primaryButtonLabel : string, (r28 & 512) != 0 ? selectPaymentMethod2.errorMessage : null, (r28 & 1024) != 0 ? selectPaymentMethod2.unconfirmedPaymentMethod : null, (r28 & 2048) != 0 ? selectPaymentMethod2.mandateText : (mandateText == null || !z) ? null : mandateText, (r28 & 4096) != 0 ? selectPaymentMethod2.cbcEligibility : null);
selectPaymentMethod = copy;
arrayList = arrayList2;
} else {
obj = value;
mutableStateFlow = mutableStateFlow2;
arrayList = arrayList2;
}
arrayList.add(selectPaymentMethod);
paymentSelection2 = paymentSelection;
arrayList2 = arrayList;
value = obj;
mutableStateFlow2 = mutableStateFlow;
}
MutableStateFlow mutableStateFlow3 = mutableStateFlow2;
if (mutableStateFlow3.compareAndSet(value, arrayList2)) {
return;
}
paymentSelection2 = paymentSelection;
mutableStateFlow2 = mutableStateFlow3;
}
} else {
throw new IllegalStateException(("Unsupported payment selection " + paymentSelection).toString());
}
}
private final void onPrimaryButtonPressed() {
Object value;
ArrayList arrayList;
CustomerSheetViewState.SelectPaymentMethod copy;
Object value2;
ArrayList arrayList2;
CustomerSheetViewState.AddPaymentMethod copy2;
CustomerSheetViewState customerSheetViewState = (CustomerSheetViewState) this.viewState.getValue();
Unit unit = null;
if (customerSheetViewState instanceof CustomerSheetViewState.AddPaymentMethod) {
CustomerSheetViewState.AddPaymentMethod addPaymentMethod = (CustomerSheetViewState.AddPaymentMethod) customerSheetViewState;
if (addPaymentMethod.getCustomPrimaryButtonUiState() == null) {
MutableStateFlow mutableStateFlow = this.backStack;
do {
value2 = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value2;
arrayList2 = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod2 : list) {
if (addPaymentMethod2 instanceof CustomerSheetViewState.AddPaymentMethod) {
copy2 = r11.copy((r38 & 1) != 0 ? r11.paymentMethodCode : null, (r38 & 2) != 0 ? r11.supportedPaymentMethods : null, (r38 & 4) != 0 ? r11.formViewData : null, (r38 & 8) != 0 ? r11.formArguments : null, (r38 & 16) != 0 ? r11.usBankAccountFormArguments : null, (r38 & 32) != 0 ? r11.selectedPaymentMethod : null, (r38 & 64) != 0 ? r11.draftPaymentSelection : null, (r38 & 128) != 0 ? r11.enabled : false, (r38 & 256) != 0 ? r11.isLiveMode : false, (r38 & 512) != 0 ? r11.isProcessing : true, (r38 & 1024) != 0 ? r11.errorMessage : null, (r38 & 2048) != 0 ? r11.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? r11.primaryButtonLabel : null, (r38 & 8192) != 0 ? r11.primaryButtonEnabled : false, (r38 & 16384) != 0 ? r11.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? r11.mandateText : null, (r38 & 65536) != 0 ? r11.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? r11.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? r11.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? ((CustomerSheetViewState.AddPaymentMethod) addPaymentMethod2).cbcEligibility : null);
addPaymentMethod2 = copy2;
}
arrayList2.add(addPaymentMethod2);
}
} while (!mutableStateFlow.compareAndSet(value2, arrayList2));
LpmRepository.SupportedPaymentMethod fromCode = this.lpmRepository.fromCode(addPaymentMethod.getPaymentMethodCode());
if (fromCode != null) {
FormViewModel.ViewData formViewData = addPaymentMethod.getFormViewData();
if (formViewData.getCompleteFormValues() == null) {
throw new IllegalStateException("completeFormValues cannot be null".toString());
}
createAndAttach(AddPaymentMethodKt.transformToPaymentMethodCreateParams(formViewData.getCompleteFormValues(), fromCode));
unit = Unit.INSTANCE;
}
if (unit != null) {
return;
}
throw new IllegalStateException((addPaymentMethod.getPaymentMethodCode() + " is not supported").toString());
}
addPaymentMethod.getCustomPrimaryButtonUiState().getOnClick().invoke();
return;
}
if (customerSheetViewState instanceof CustomerSheetViewState.SelectPaymentMethod) {
MutableStateFlow mutableStateFlow2 = this.backStack;
do {
value = mutableStateFlow2.getValue();
List<CustomerSheetViewState> list2 = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list2, 10));
for (CustomerSheetViewState.SelectPaymentMethod selectPaymentMethod : list2) {
if (selectPaymentMethod instanceof CustomerSheetViewState.SelectPaymentMethod) {
copy = r11.copy((r28 & 1) != 0 ? r11.title : null, (r28 & 2) != 0 ? r11.savedPaymentMethods : null, (r28 & 4) != 0 ? r11.paymentSelection : null, (r28 & 8) != 0 ? r11.isLiveMode : false, (r28 & 16) != 0 ? r11.isProcessing : true, (r28 & 32) != 0 ? r11.isEditing : false, (r28 & 64) != 0 ? r11.isGooglePayEnabled : false, (r28 & 128) != 0 ? r11.primaryButtonVisible : false, (r28 & 256) != 0 ? r11.primaryButtonLabel : null, (r28 & 512) != 0 ? r11.errorMessage : null, (r28 & 1024) != 0 ? r11.unconfirmedPaymentMethod : null, (r28 & 2048) != 0 ? r11.mandateText : null, (r28 & 4096) != 0 ? ((CustomerSheetViewState.SelectPaymentMethod) selectPaymentMethod).cbcEligibility : null);
selectPaymentMethod = copy;
}
arrayList.add(selectPaymentMethod);
}
} while (!mutableStateFlow2.compareAndSet(value, arrayList));
PaymentSelection paymentSelection = ((CustomerSheetViewState.SelectPaymentMethod) customerSheetViewState).getPaymentSelection();
if (paymentSelection instanceof PaymentSelection.GooglePay) {
selectGooglePay();
return;
}
if (paymentSelection instanceof PaymentSelection.Saved) {
selectSavedPaymentMethod((PaymentSelection.Saved) paymentSelection);
return;
} else {
if (paymentSelection == null) {
selectSavedPaymentMethod(null);
return;
}
throw new IllegalStateException((paymentSelection + " is not supported").toString());
}
}
throw new IllegalStateException((this.viewState.getValue() + " is not supported").toString());
}
private final void createAndAttach(PaymentMethodCreateParams paymentMethodCreateParams) {
BuildersKt.launch$default(ViewModelKt.getViewModelScope(this), (CoroutineContext) null, (CoroutineStart) null, new CustomerSheetViewModel$createAndAttach$1(this, paymentMethodCreateParams, null), 3, (Object) null);
}
static void transitionToAddPaymentMethod$default(CustomerSheetViewModel customerSheetViewModel, boolean z, CardBrandChoiceEligibility cardBrandChoiceEligibility, int i, Object obj) {
if ((i & 2) != 0) {
cardBrandChoiceEligibility = ((CustomerSheetViewState) customerSheetViewModel.viewState.getValue()).getCbcEligibility();
}
customerSheetViewModel.transitionToAddPaymentMethod(z, cardBrandChoiceEligibility);
}
private final void transitionToAddPaymentMethod(boolean isFirstPaymentMethod, CardBrandChoiceEligibility cbcEligibility) {
String str = PaymentMethod.Type.Card.code;
FormArgumentsFactory formArgumentsFactory = FormArgumentsFactory.INSTANCE;
LpmRepository.SupportedPaymentMethod supportedPaymentMethod = this.card;
CustomerSheet.Configuration configuration = this.configuration;
FormArguments create = formArgumentsFactory.create(supportedPaymentMethod, configuration, configuration.getMerchantDisplayName(), cbcEligibility);
Function0<Unit> buildFormObserver = buildFormObserver(create, this.formViewModelSubcomponentBuilderProvider, new CustomerSheetViewModel$transitionToAddPaymentMethod$observe$1(this));
LpmRepository.SupportedPaymentMethod fromCode = this.lpmRepository.fromCode(str);
if (fromCode == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
List<LpmRepository.SupportedPaymentMethod> list = this.supportedPaymentMethods;
FormViewModel.ViewData viewData = new FormViewModel.ViewData((List) null, (FormFieldValues) null, (Set) null, (IdentifierSpec) null, 15, (DefaultConstructorMarker) null);
StripeIntent stripeIntent = this.stripeIntent;
String id = stripeIntent != null ? stripeIntent.getId() : null;
StripeIntent stripeIntent2 = this.stripeIntent;
transition(new CustomerSheetViewState.AddPaymentMethod(str, list, viewData, create, new USBankAccountFormArguments((String) null, false, false, id, stripeIntent2 != null ? stripeIntent2.getClientSecret() : null, (AddressDetails) null, (PaymentSelection) null, new Function2<String, Boolean, Unit>() {
{
super(2);
}
public Object invoke(Object obj, Object obj2) {
invoke((String) obj, ((Boolean) obj2).booleanValue());
return Unit.INSTANCE;
}
public final void invoke(String str2, boolean z) {
CustomerSheetViewModel.this.handleViewAction(new CustomerSheetViewAction.OnUpdateMandateText(str2, z));
}
}, new Function1<PaymentSelection.New.USBankAccount, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((PaymentSelection.New.USBankAccount) obj);
return Unit.INSTANCE;
}
public final void invoke(PaymentSelection.New.USBankAccount uSBankAccount) {
Intrinsics.checkNotNullParameter(uSBankAccount, "it");
CustomerSheetViewModel.this.handleViewAction(new CustomerSheetViewAction.OnConfirmUSBankAccount(uSBankAccount));
}
}, new Function1<CollectBankAccountResultInternal, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((CollectBankAccountResultInternal) obj);
return Unit.INSTANCE;
}
public final void invoke(CollectBankAccountResultInternal collectBankAccountResultInternal) {
Intrinsics.checkNotNullParameter(collectBankAccountResultInternal, "it");
CustomerSheetViewModel.this.handleViewAction(new CustomerSheetViewAction.OnCollectBankAccountResult(collectBankAccountResultInternal));
}
}, new Function1<Function1<? super PrimaryButton.UIState, ? extends PrimaryButton.UIState>, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((Function1<? super PrimaryButton.UIState, PrimaryButton.UIState>) obj);
return Unit.INSTANCE;
}
public final void invoke(Function1<? super PrimaryButton.UIState, PrimaryButton.UIState> function1) {
Intrinsics.checkNotNullParameter(function1, "it");
CustomerSheetViewModel.this.handleViewAction(new CustomerSheetViewAction.OnUpdateCustomButtonUIState(function1));
}
}, new Function1<PrimaryButton.State, Unit>() {
public final void invoke(PrimaryButton.State state) {
Intrinsics.checkNotNullParameter(state, "it");
}
public Object invoke(Object obj) {
invoke((PrimaryButton.State) obj);
return Unit.INSTANCE;
}
}, new Function1<String, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((String) obj);
return Unit.INSTANCE;
}
public final void invoke(String str2) {
CustomerSheetViewModel.this.handleViewAction(new CustomerSheetViewAction.OnFormError(str2));
}
}), fromCode, null, true, ((Boolean) this.isLiveModeProvider.invoke()).booleanValue(), false, null, isFirstPaymentMethod, ResolvableStringUtilsKt.resolvableString$default(R.string.stripe_paymentsheet_save, new Object[0], null, 4, null), false, null, null, false, false, null, cbcEligibility, 230400, null), isFirstPaymentMethod);
buildFormObserver.invoke();
}
private final void onConfirmUSBankAccount(PaymentSelection.New.USBankAccount usBankAccount) {
createAndAttach(usBankAccount.getPaymentMethodCreateParams());
}
public final java.lang.Object m428createPaymentMethodgIAlus(com.stripe.android.model.PaymentMethodCreateParams r11, kotlin.coroutines.Continuation<? super kotlin.Result<com.stripe.android.model.PaymentMethod>> r12) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.m428createPaymentMethodgIAlus(com.stripe.android.model.PaymentMethodCreateParams, kotlin.coroutines.Continuation):java.lang.Object");
}
public final void attachPaymentMethodToCustomer(PaymentMethod paymentMethod) {
BuildersKt.launch$default(ViewModelKt.getViewModelScope(this), (CoroutineContext) null, (CoroutineStart) null, new CustomerSheetViewModel$attachPaymentMethodToCustomer$1(this, paymentMethod, null), 3, (Object) null);
}
public final java.lang.Object attachWithSetupIntent(com.stripe.android.model.PaymentMethod r41, kotlin.coroutines.Continuation<? super kotlin.Unit> r42) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.attachWithSetupIntent(com.stripe.android.model.PaymentMethod, kotlin.coroutines.Continuation):java.lang.Object");
}
public final java.lang.Object m429handleStripeIntentBWLJW6A(com.stripe.android.model.StripeIntent r35, java.lang.String r36, com.stripe.android.model.PaymentMethod r37, kotlin.coroutines.Continuation<? super kotlin.Result<kotlin.Unit>> r38) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.m429handleStripeIntentBWLJW6A(com.stripe.android.model.StripeIntent, java.lang.String, com.stripe.android.model.PaymentMethod, kotlin.coroutines.Continuation):java.lang.Object");
}
private final void confirmStripeIntent(ConfirmStripeIntentParams confirmStripeIntentParams) {
Object obj;
Object value;
ArrayList arrayList;
CustomerSheetViewState.AddPaymentMethod copy;
PaymentLauncher paymentLauncher;
try {
Result.Companion companion = Result.Companion;
CustomerSheetViewModel customerSheetViewModel = this;
paymentLauncher = this.paymentLauncher;
} catch (Throwable th) {
Result.Companion companion2 = Result.Companion;
obj = Result.constructor-impl(ResultKt.createFailure(th));
}
if (paymentLauncher != null) {
obj = Result.constructor-impl(paymentLauncher);
Throwable th2 = Result.exceptionOrNull-impl(obj);
if (th2 != null) {
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod : list) {
if (addPaymentMethod instanceof CustomerSheetViewState.AddPaymentMethod) {
CustomerSheetViewState.AddPaymentMethod addPaymentMethod2 = (CustomerSheetViewState.AddPaymentMethod) addPaymentMethod;
copy = addPaymentMethod2.copy((r38 & 1) != 0 ? addPaymentMethod2.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod2.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod2.formViewData : null, (r38 & 8) != 0 ? addPaymentMethod2.formArguments : null, (r38 & 16) != 0 ? addPaymentMethod2.usBankAccountFormArguments : null, (r38 & 32) != 0 ? addPaymentMethod2.selectedPaymentMethod : null, (r38 & 64) != 0 ? addPaymentMethod2.draftPaymentSelection : null, (r38 & 128) != 0 ? addPaymentMethod2.enabled : false, (r38 & 256) != 0 ? addPaymentMethod2.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod2.isProcessing : false, (r38 & 1024) != 0 ? addPaymentMethod2.errorMessage : ExceptionKtKt.stripeErrorMessage(th2, this.application), (r38 & 2048) != 0 ? addPaymentMethod2.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod2.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod2.primaryButtonEnabled : addPaymentMethod2.getFormViewData().getCompleteFormValues() != null, (r38 & 16384) != 0 ? addPaymentMethod2.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod2.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod2.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? addPaymentMethod2.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? addPaymentMethod2.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? addPaymentMethod2.cbcEligibility : null);
addPaymentMethod = copy;
}
arrayList.add(addPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
return;
}
PaymentLauncher paymentLauncher2 = (PaymentLauncher) obj;
if (confirmStripeIntentParams instanceof ConfirmSetupIntentParams) {
paymentLauncher2.confirm((ConfirmSetupIntentParams) confirmStripeIntentParams);
return;
}
throw new IllegalStateException("Only SetupIntents are supported at this time".toString());
}
throw new IllegalArgumentException("Required value was null.".toString());
}
private final void handleNextAction(String clientSecret, StripeIntent stripeIntent) {
Object obj;
Object value;
ArrayList arrayList;
CustomerSheetViewState.AddPaymentMethod copy;
PaymentLauncher paymentLauncher;
try {
Result.Companion companion = Result.Companion;
CustomerSheetViewModel customerSheetViewModel = this;
paymentLauncher = this.paymentLauncher;
} catch (Throwable th) {
Result.Companion companion2 = Result.Companion;
obj = Result.constructor-impl(ResultKt.createFailure(th));
}
if (paymentLauncher != null) {
obj = Result.constructor-impl(paymentLauncher);
Throwable th2 = Result.exceptionOrNull-impl(obj);
if (th2 != null) {
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod : list) {
if (addPaymentMethod instanceof CustomerSheetViewState.AddPaymentMethod) {
CustomerSheetViewState.AddPaymentMethod addPaymentMethod2 = (CustomerSheetViewState.AddPaymentMethod) addPaymentMethod;
copy = addPaymentMethod2.copy((r38 & 1) != 0 ? addPaymentMethod2.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod2.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod2.formViewData : null, (r38 & 8) != 0 ? addPaymentMethod2.formArguments : null, (r38 & 16) != 0 ? addPaymentMethod2.usBankAccountFormArguments : null, (r38 & 32) != 0 ? addPaymentMethod2.selectedPaymentMethod : null, (r38 & 64) != 0 ? addPaymentMethod2.draftPaymentSelection : null, (r38 & 128) != 0 ? addPaymentMethod2.enabled : false, (r38 & 256) != 0 ? addPaymentMethod2.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod2.isProcessing : false, (r38 & 1024) != 0 ? addPaymentMethod2.errorMessage : ExceptionKtKt.stripeErrorMessage(th2, this.application), (r38 & 2048) != 0 ? addPaymentMethod2.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod2.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod2.primaryButtonEnabled : addPaymentMethod2.getFormViewData().getCompleteFormValues() != null, (r38 & 16384) != 0 ? addPaymentMethod2.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod2.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod2.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? addPaymentMethod2.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? addPaymentMethod2.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? addPaymentMethod2.cbcEligibility : null);
addPaymentMethod = copy;
}
arrayList.add(addPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
return;
}
PaymentLauncher paymentLauncher2 = (PaymentLauncher) obj;
if (stripeIntent instanceof SetupIntent) {
paymentLauncher2.handleNextActionForSetupIntent(clientSecret);
return;
}
throw new IllegalStateException("Only SetupIntents are supported at this time".toString());
}
throw new IllegalArgumentException("Required value was null.".toString());
}
public final java.lang.Object attachPaymentMethod(java.lang.String r31, kotlin.coroutines.Continuation<? super kotlin.Unit> r32) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.attachPaymentMethod(java.lang.String, kotlin.coroutines.Continuation):java.lang.Object");
}
private final void selectSavedPaymentMethod(PaymentSelection.Saved savedPaymentSelection) {
BuildersKt.launch$default(ViewModelKt.getViewModelScope(this), (CoroutineContext) null, (CoroutineStart) null, new CustomerSheetViewModel$selectSavedPaymentMethod$1(this, savedPaymentSelection, null), 3, (Object) null);
}
private final void selectGooglePay() {
BuildersKt.launch$default(ViewModelKt.getViewModelScope(this), (CoroutineContext) null, (CoroutineStart) null, new CustomerSheetViewModel$selectGooglePay$1(this, null), 3, (Object) null);
}
public final void confirmPaymentSelection(PaymentSelection paymentSelection, String type) {
if (type != null) {
this.eventReporter.onConfirmPaymentMethodSucceeded(type);
}
this._result.tryEmit(new InternalCustomerSheetResult.Selected(paymentSelection));
}
public final void confirmPaymentSelectionError(PaymentSelection paymentSelection, String type, Throwable cause, String displayMessage) {
Object value;
ArrayList arrayList;
CustomerSheetViewState.SelectPaymentMethod copy;
if (type != null) {
this.eventReporter.onConfirmPaymentMethodFailed(type);
}
this.logger.error("Failed to persist payment selection: " + paymentSelection, cause);
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.SelectPaymentMethod selectPaymentMethod : list) {
if (selectPaymentMethod instanceof CustomerSheetViewState.SelectPaymentMethod) {
copy = r7.copy((r28 & 1) != 0 ? r7.title : null, (r28 & 2) != 0 ? r7.savedPaymentMethods : null, (r28 & 4) != 0 ? r7.paymentSelection : null, (r28 & 8) != 0 ? r7.isLiveMode : false, (r28 & 16) != 0 ? r7.isProcessing : false, (r28 & 32) != 0 ? r7.isEditing : false, (r28 & 64) != 0 ? r7.isGooglePayEnabled : false, (r28 & 128) != 0 ? r7.primaryButtonVisible : false, (r28 & 256) != 0 ? r7.primaryButtonLabel : null, (r28 & 512) != 0 ? r7.errorMessage : displayMessage, (r28 & 1024) != 0 ? r7.unconfirmedPaymentMethod : null, (r28 & 2048) != 0 ? r7.mandateText : null, (r28 & 4096) != 0 ? ((CustomerSheetViewState.SelectPaymentMethod) selectPaymentMethod).cbcEligibility : null);
selectPaymentMethod = copy;
}
arrayList.add(selectPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void safeUpdateSelectPaymentMethodState(Function1<? super CustomerSheetViewState.SelectPaymentMethod, CustomerSheetViewState.SelectPaymentMethod> update) {
Object value;
Object value2;
ArrayList arrayList;
Iterable iterable = (Iterable) this.backStack.getValue();
boolean z = false;
if (!(iterable instanceof Collection) || !((Collection) iterable).isEmpty()) {
Iterator it = iterable.iterator();
while (true) {
if (it.hasNext()) {
if (((CustomerSheetViewState) it.next()) instanceof CustomerSheetViewState.SelectPaymentMethod) {
z = true;
break;
}
} else {
break;
}
}
}
if (z) {
MutableStateFlow mutableStateFlow = this.backStack;
do {
value2 = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value2;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.SelectPaymentMethod selectPaymentMethod : list) {
if (selectPaymentMethod instanceof CustomerSheetViewState.SelectPaymentMethod) {
selectPaymentMethod = (CustomerSheetViewState.SelectPaymentMethod) update.invoke((CustomerSheetViewState.SelectPaymentMethod) selectPaymentMethod);
}
arrayList.add(selectPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value2, arrayList));
return;
}
MutableStateFlow<List<CustomerSheetViewState>> mutableStateFlow2 = this.backStack;
do {
value = mutableStateFlow2.getValue();
} while (!mutableStateFlow2.compareAndSet(value, CollectionsKt.plus(CollectionsKt.listOf(buildDefaultSelectPaymentMethod(update)), (List) value)));
}
private final Function0<Unit> buildFormObserver(FormArguments formArguments, Provider<FormViewModelSubcomponent.Builder> formViewModelSubcomponentBuilderProvider, final Function1<? super FormViewModel.ViewData, Unit> onFormDataUpdated) {
final FormViewModel viewModel = ((FormViewModelSubcomponent.Builder) formViewModelSubcomponentBuilderProvider.get()).formArguments(formArguments).showCheckboxFlow(FlowKt.flowOf(false)).build().getViewModel();
return new Function0<Unit>() {
{
super(0);
}
@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.customersheet.CustomerSheetViewModel$buildFormObserver$1$1", f = "CustomerSheetViewModel.kt", i = {}, l = {1101}, m = "invokeSuspend", n = {}, s = {})
static final class AnonymousClass1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final FormViewModel $formViewModel;
final Function1<FormViewModel.ViewData, Unit> $onFormDataUpdated;
int label;
AnonymousClass1(FormViewModel formViewModel, Function1<? super FormViewModel.ViewData, Unit> function1, Continuation<? super AnonymousClass1> continuation) {
super(2, continuation);
this.$formViewModel = formViewModel;
this.$onFormDataUpdated = function1;
}
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
return new AnonymousClass1(this.$formViewModel, this.$onFormDataUpdated, 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 i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
Flow viewDataFlow$paymentsheet_release = this.$formViewModel.getViewDataFlow$paymentsheet_release();
final Function1<FormViewModel.ViewData, Unit> function1 = this.$onFormDataUpdated;
this.label = 1;
if (viewDataFlow$paymentsheet_release.collect(new FlowCollector<FormViewModel.ViewData>() {
public Object emit(Object obj2, Continuation continuation) {
return emit((FormViewModel.ViewData) obj2, (Continuation<? super Unit>) continuation);
}
public final Object emit(FormViewModel.ViewData viewData, Continuation<? super Unit> continuation) {
function1.invoke(viewData);
return Unit.INSTANCE;
}
}, (Continuation) this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
}
public Object invoke() {
m430invoke();
return Unit.INSTANCE;
}
public final void m430invoke() {
BuildersKt.launch$default(ViewModelKt.getViewModelScope(CustomerSheetViewModel.this), (CoroutineContext) null, (CoroutineStart) null, new AnonymousClass1(viewModel, onFormDataUpdated, null), 3, (Object) null);
}
};
}
private final CustomerSheetViewState.SelectPaymentMethod buildDefaultSelectPaymentMethod(Function1<? super CustomerSheetViewState.SelectPaymentMethod, CustomerSheetViewState.SelectPaymentMethod> override) {
return (CustomerSheetViewState.SelectPaymentMethod) override.invoke(new CustomerSheetViewState.SelectPaymentMethod(this.configuration.getHeaderTextForSelectionScreen(), CollectionsKt.emptyList(), null, ((Boolean) this.isLiveModeProvider.invoke()).booleanValue(), false, false, this.isGooglePayReadyAndEnabled, false, this.resources.getString(R.string.stripe_paymentsheet_confirm), null, null, null, CardBrandChoiceEligibility.Ineligible.INSTANCE, 3072, null));
}
static void transition$default(CustomerSheetViewModel customerSheetViewModel, CustomerSheetViewState customerSheetViewState, boolean z, int i, Object obj) {
if ((i & 2) != 0) {
z = false;
}
customerSheetViewModel.transition(customerSheetViewState, z);
}
private final void transition(CustomerSheetViewState to, boolean reset) {
Object value;
if (to instanceof CustomerSheetViewState.AddPaymentMethod) {
this.eventReporter.onScreenPresented(CustomerSheetEventReporter.Screen.AddPaymentMethod);
} else if (to instanceof CustomerSheetViewState.SelectPaymentMethod) {
this.eventReporter.onScreenPresented(CustomerSheetEventReporter.Screen.SelectPaymentMethod);
}
MutableStateFlow<List<CustomerSheetViewState>> mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
} while (!mutableStateFlow.compareAndSet(value, reset ? CollectionsKt.listOf(to) : CollectionsKt.plus((List) value, to)));
}
private final <T extends CustomerSheetViewState> void updateViewState(Function1<? super T, ? extends T> transform) {
Object value;
ArrayList arrayList;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState customerSheetViewState : list) {
Intrinsics.reifiedOperationMarker(3, "T");
if (customerSheetViewState instanceof CustomerSheetViewState) {
customerSheetViewState = (CustomerSheetViewState) transform.invoke(customerSheetViewState);
}
arrayList.add(customerSheetViewState);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
@Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\bÇ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J%\u0010\u0003\u001a\u0002H\u0004\"\b\b\u0000\u0010\u0004*\u00020\u00052\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u0002H\u00040\u0007H\u0016¢\u0006\u0002\u0010\b¨\u0006\t"}, d2 = {"Lcom/stripe/android/customersheet/CustomerSheetViewModel$Factory;", "Landroidx/lifecycle/ViewModelProvider$Factory;", "()V", "create", "T", "Landroidx/lifecycle/ViewModel;", "modelClass", "Ljava/lang/Class;", "(Ljava/lang/Class;)Landroidx/lifecycle/ViewModel;", "paymentsheet_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static final class Factory implements ViewModelProvider.Factory {
public static final int $stable = 0;
public static final Factory INSTANCE = new Factory();
private Factory() {
}
public <T extends ViewModel> T create(Class<T> modelClass) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
CustomerSheetViewModel viewModel = CustomerSessionViewModel.INSTANCE.getComponent().getCustomerSheetViewModelComponentBuilder().build().getViewModel();
Intrinsics.checkNotNull(viewModel, "null cannot be cast to non-null type T of com.stripe.android.customersheet.CustomerSheetViewModel.Factory.create");
return viewModel;
}
}
public final void onFormDataUpdated(FormViewModel.ViewData formData) {
Object value;
ArrayList arrayList;
CustomerSheetViewState.AddPaymentMethod copy;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod : list) {
if (addPaymentMethod instanceof CustomerSheetViewState.AddPaymentMethod) {
CustomerSheetViewState.AddPaymentMethod addPaymentMethod2 = (CustomerSheetViewState.AddPaymentMethod) addPaymentMethod;
copy = addPaymentMethod2.copy((r38 & 1) != 0 ? addPaymentMethod2.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod2.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod2.formViewData : formData, (r38 & 8) != 0 ? addPaymentMethod2.formArguments : null, (r38 & 16) != 0 ? addPaymentMethod2.usBankAccountFormArguments : null, (r38 & 32) != 0 ? addPaymentMethod2.selectedPaymentMethod : null, (r38 & 64) != 0 ? addPaymentMethod2.draftPaymentSelection : null, (r38 & 128) != 0 ? addPaymentMethod2.enabled : false, (r38 & 256) != 0 ? addPaymentMethod2.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod2.isProcessing : false, (r38 & 1024) != 0 ? addPaymentMethod2.errorMessage : null, (r38 & 2048) != 0 ? addPaymentMethod2.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod2.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod2.primaryButtonEnabled : (formData.getCompleteFormValues() == null || addPaymentMethod2.getIsProcessing()) ? false : true, (r38 & 16384) != 0 ? addPaymentMethod2.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod2.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod2.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? addPaymentMethod2.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? addPaymentMethod2.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? addPaymentMethod2.cbcEligibility : null);
addPaymentMethod = copy;
}
arrayList.add(addPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void onFormFieldValuesCompleted(FormFieldValues formFieldValues) {
Object value;
ArrayList arrayList;
CustomerSheetViewState.AddPaymentMethod copy;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod : list) {
if (addPaymentMethod instanceof CustomerSheetViewState.AddPaymentMethod) {
CustomerSheetViewState.AddPaymentMethod addPaymentMethod2 = (CustomerSheetViewState.AddPaymentMethod) addPaymentMethod;
copy = addPaymentMethod2.copy((r38 & 1) != 0 ? addPaymentMethod2.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod2.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod2.formViewData : FormViewModel.ViewData.copy$default(addPaymentMethod2.getFormViewData(), (List) null, formFieldValues, (Set) null, (IdentifierSpec) null, 13, (Object) null), (r38 & 8) != 0 ? addPaymentMethod2.formArguments : null, (r38 & 16) != 0 ? addPaymentMethod2.usBankAccountFormArguments : null, (r38 & 32) != 0 ? addPaymentMethod2.selectedPaymentMethod : null, (r38 & 64) != 0 ? addPaymentMethod2.draftPaymentSelection : (PaymentSelection) (formFieldValues != null ? AddPaymentMethodKt.transformToPaymentSelection(formFieldValues, this.resources, addPaymentMethod2.getSelectedPaymentMethod()) : null), (r38 & 128) != 0 ? addPaymentMethod2.enabled : false, (r38 & 256) != 0 ? addPaymentMethod2.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod2.isProcessing : false, (r38 & 1024) != 0 ? addPaymentMethod2.errorMessage : null, (r38 & 2048) != 0 ? addPaymentMethod2.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod2.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod2.primaryButtonEnabled : (formFieldValues == null || addPaymentMethod2.getIsProcessing()) ? false : true, (r38 & 16384) != 0 ? addPaymentMethod2.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod2.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod2.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? addPaymentMethod2.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? addPaymentMethod2.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? addPaymentMethod2.cbcEligibility : null);
addPaymentMethod = copy;
}
arrayList.add(addPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void updateCustomButtonUIState(Function1<? super PrimaryButton.UIState, PrimaryButton.UIState> callback) {
Object value;
ArrayList arrayList;
CustomerSheetViewState.AddPaymentMethod copy;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod : list) {
if (addPaymentMethod instanceof CustomerSheetViewState.AddPaymentMethod) {
CustomerSheetViewState.AddPaymentMethod addPaymentMethod2 = (CustomerSheetViewState.AddPaymentMethod) addPaymentMethod;
PrimaryButton.UIState uIState = (PrimaryButton.UIState) callback.invoke(addPaymentMethod2.getCustomPrimaryButtonUiState());
if (uIState != null) {
copy = addPaymentMethod2.copy((r38 & 1) != 0 ? addPaymentMethod2.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod2.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod2.formViewData : null, (r38 & 8) != 0 ? addPaymentMethod2.formArguments : null, (r38 & 16) != 0 ? addPaymentMethod2.usBankAccountFormArguments : null, (r38 & 32) != 0 ? addPaymentMethod2.selectedPaymentMethod : null, (r38 & 64) != 0 ? addPaymentMethod2.draftPaymentSelection : null, (r38 & 128) != 0 ? addPaymentMethod2.enabled : false, (r38 & 256) != 0 ? addPaymentMethod2.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod2.isProcessing : false, (r38 & 1024) != 0 ? addPaymentMethod2.errorMessage : null, (r38 & 2048) != 0 ? addPaymentMethod2.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod2.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod2.primaryButtonEnabled : uIState.getEnabled(), (r38 & 16384) != 0 ? addPaymentMethod2.customPrimaryButtonUiState : uIState, (r38 & 32768) != 0 ? addPaymentMethod2.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod2.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? addPaymentMethod2.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? addPaymentMethod2.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? addPaymentMethod2.cbcEligibility : null);
} else {
copy = addPaymentMethod2.copy((r38 & 1) != 0 ? addPaymentMethod2.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod2.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod2.formViewData : null, (r38 & 8) != 0 ? addPaymentMethod2.formArguments : null, (r38 & 16) != 0 ? addPaymentMethod2.usBankAccountFormArguments : null, (r38 & 32) != 0 ? addPaymentMethod2.selectedPaymentMethod : null, (r38 & 64) != 0 ? addPaymentMethod2.draftPaymentSelection : null, (r38 & 128) != 0 ? addPaymentMethod2.enabled : false, (r38 & 256) != 0 ? addPaymentMethod2.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod2.isProcessing : false, (r38 & 1024) != 0 ? addPaymentMethod2.errorMessage : null, (r38 & 2048) != 0 ? addPaymentMethod2.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod2.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod2.primaryButtonEnabled : (addPaymentMethod2.getFormViewData().getCompleteFormValues() == null || addPaymentMethod2.getIsProcessing()) ? false : true, (r38 & 16384) != 0 ? addPaymentMethod2.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod2.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod2.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? addPaymentMethod2.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? addPaymentMethod2.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? addPaymentMethod2.cbcEligibility : null);
}
addPaymentMethod = copy;
}
arrayList.add(addPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void updateMandateText(String mandateText, boolean showAbove) {
Object value;
ArrayList arrayList;
CustomerSheetViewState.AddPaymentMethod copy;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod : list) {
if (addPaymentMethod instanceof CustomerSheetViewState.AddPaymentMethod) {
copy = r6.copy((r38 & 1) != 0 ? r6.paymentMethodCode : null, (r38 & 2) != 0 ? r6.supportedPaymentMethods : null, (r38 & 4) != 0 ? r6.formViewData : null, (r38 & 8) != 0 ? r6.formArguments : null, (r38 & 16) != 0 ? r6.usBankAccountFormArguments : null, (r38 & 32) != 0 ? r6.selectedPaymentMethod : null, (r38 & 64) != 0 ? r6.draftPaymentSelection : null, (r38 & 128) != 0 ? r6.enabled : false, (r38 & 256) != 0 ? r6.isLiveMode : false, (r38 & 512) != 0 ? r6.isProcessing : false, (r38 & 1024) != 0 ? r6.errorMessage : null, (r38 & 2048) != 0 ? r6.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? r6.primaryButtonLabel : null, (r38 & 8192) != 0 ? r6.primaryButtonEnabled : false, (r38 & 16384) != 0 ? r6.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? r6.mandateText : mandateText, (r38 & 65536) != 0 ? r6.showMandateAbovePrimaryButton : showAbove, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? r6.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? r6.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? ((CustomerSheetViewState.AddPaymentMethod) addPaymentMethod).cbcEligibility : null);
addPaymentMethod = copy;
}
arrayList.add(addPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void onCollectUSBankAccountResult(CollectBankAccountResultInternal bankAccountResult) {
Object value;
ArrayList arrayList;
ResolvableString resolvableString$default;
CustomerSheetViewState.AddPaymentMethod copy;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod : list) {
if (addPaymentMethod instanceof CustomerSheetViewState.AddPaymentMethod) {
CustomerSheetViewState.AddPaymentMethod addPaymentMethod2 = (CustomerSheetViewState.AddPaymentMethod) addPaymentMethod;
if (bankAccountResult instanceof CollectBankAccountResultInternal.Completed) {
resolvableString$default = ResolvableStringUtilsKt.resolvableString$default(R.string.stripe_paymentsheet_save, new Object[0], null, 4, null);
} else {
resolvableString$default = ResolvableStringUtilsKt.resolvableString$default(com.stripe.android.ui.core.R.string.stripe_continue_button_label, new Object[0], null, 4, null);
}
copy = addPaymentMethod2.copy((r38 & 1) != 0 ? addPaymentMethod2.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod2.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod2.formViewData : null, (r38 & 8) != 0 ? addPaymentMethod2.formArguments : null, (r38 & 16) != 0 ? addPaymentMethod2.usBankAccountFormArguments : null, (r38 & 32) != 0 ? addPaymentMethod2.selectedPaymentMethod : null, (r38 & 64) != 0 ? addPaymentMethod2.draftPaymentSelection : null, (r38 & 128) != 0 ? addPaymentMethod2.enabled : false, (r38 & 256) != 0 ? addPaymentMethod2.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod2.isProcessing : false, (r38 & 1024) != 0 ? addPaymentMethod2.errorMessage : null, (r38 & 2048) != 0 ? addPaymentMethod2.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod2.primaryButtonLabel : resolvableString$default, (r38 & 8192) != 0 ? addPaymentMethod2.primaryButtonEnabled : false, (r38 & 16384) != 0 ? addPaymentMethod2.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod2.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod2.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? addPaymentMethod2.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? addPaymentMethod2.bankAccountResult : bankAccountResult, (r38 & Opcodes.ASM8) != 0 ? addPaymentMethod2.cbcEligibility : null);
addPaymentMethod = copy;
}
arrayList.add(addPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void onFormError(String error) {
Object value;
ArrayList arrayList;
CustomerSheetViewState.AddPaymentMethod copy;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod : list) {
if (addPaymentMethod instanceof CustomerSheetViewState.AddPaymentMethod) {
copy = r6.copy((r38 & 1) != 0 ? r6.paymentMethodCode : null, (r38 & 2) != 0 ? r6.supportedPaymentMethods : null, (r38 & 4) != 0 ? r6.formViewData : null, (r38 & 8) != 0 ? r6.formArguments : null, (r38 & 16) != 0 ? r6.usBankAccountFormArguments : null, (r38 & 32) != 0 ? r6.selectedPaymentMethod : null, (r38 & 64) != 0 ? r6.draftPaymentSelection : null, (r38 & 128) != 0 ? r6.enabled : false, (r38 & 256) != 0 ? r6.isLiveMode : false, (r38 & 512) != 0 ? r6.isProcessing : false, (r38 & 1024) != 0 ? r6.errorMessage : error, (r38 & 2048) != 0 ? r6.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? r6.primaryButtonLabel : null, (r38 & 8192) != 0 ? r6.primaryButtonEnabled : false, (r38 & 16384) != 0 ? r6.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? r6.mandateText : null, (r38 & 65536) != 0 ? r6.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? r6.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? r6.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? ((CustomerSheetViewState.AddPaymentMethod) addPaymentMethod).cbcEligibility : null);
addPaymentMethod = copy;
}
arrayList.add(addPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void onCancelCloseForm() {
Object value;
ArrayList arrayList;
CustomerSheetViewState.AddPaymentMethod copy;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<CustomerSheetViewState> list = (List) value;
arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
for (CustomerSheetViewState.AddPaymentMethod addPaymentMethod : list) {
if (addPaymentMethod instanceof CustomerSheetViewState.AddPaymentMethod) {
copy = r6.copy((r38 & 1) != 0 ? r6.paymentMethodCode : null, (r38 & 2) != 0 ? r6.supportedPaymentMethods : null, (r38 & 4) != 0 ? r6.formViewData : null, (r38 & 8) != 0 ? r6.formArguments : null, (r38 & 16) != 0 ? r6.usBankAccountFormArguments : null, (r38 & 32) != 0 ? r6.selectedPaymentMethod : null, (r38 & 64) != 0 ? r6.draftPaymentSelection : null, (r38 & 128) != 0 ? r6.enabled : false, (r38 & 256) != 0 ? r6.isLiveMode : false, (r38 & 512) != 0 ? r6.isProcessing : false, (r38 & 1024) != 0 ? r6.errorMessage : null, (r38 & 2048) != 0 ? r6.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? r6.primaryButtonLabel : null, (r38 & 8192) != 0 ? r6.primaryButtonEnabled : false, (r38 & 16384) != 0 ? r6.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? r6.mandateText : null, (r38 & 65536) != 0 ? r6.showMandateAbovePrimaryButton : false, (r38 & Opcodes.ACC_DEPRECATED) != 0 ? r6.displayDismissConfirmationModal : false, (r38 & Opcodes.ASM4) != 0 ? r6.bankAccountResult : null, (r38 & Opcodes.ASM8) != 0 ? ((CustomerSheetViewState.AddPaymentMethod) addPaymentMethod).cbcEligibility : null);
addPaymentMethod = copy;
}
arrayList.add(addPaymentMethod);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
}