正在查看: Crafto v9.3.3 应用的 DefaultFlowController.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Crafto v9.3.3 应用的 DefaultFlowController.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.stripe.android.paymentsheet.flowcontroller;
import Hk.p;
import Hk.q;
import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.lifecycle.I;
import androidx.lifecycle.U;
import androidx.lifecycle.w;
import androidx.lifecycle.y0;
import com.stripe.android.PaymentConfiguration;
import com.stripe.android.camera.scanui.CameraView;
import com.stripe.android.core.injection.Injectable;
import com.stripe.android.core.injection.Injector;
import com.stripe.android.core.injection.InjectorKey;
import com.stripe.android.core.injection.UIContext;
import com.stripe.android.core.injection.WeakMapInjectorRegistry;
import com.stripe.android.googlepaylauncher.GooglePayEnvironment;
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncher;
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncherContract;
import com.stripe.android.googlepaylauncher.injection.GooglePayPaymentMethodLauncherFactory;
import com.stripe.android.model.ConfirmStripeIntentParams;
import com.stripe.android.model.PaymentIntent;
import com.stripe.android.model.PaymentMethod;
import com.stripe.android.model.StripeIntent;
import com.stripe.android.payments.core.injection.NamedConstantsKt;
import com.stripe.android.payments.paymentlauncher.PaymentLauncher;
import com.stripe.android.payments.paymentlauncher.PaymentLauncherContract;
import com.stripe.android.payments.paymentlauncher.PaymentResult;
import com.stripe.android.payments.paymentlauncher.StripePaymentLauncherAssistedFactory;
import com.stripe.android.paymentsheet.PaymentOptionCallback;
import com.stripe.android.paymentsheet.PaymentOptionContract;
import com.stripe.android.paymentsheet.PaymentOptionResult;
import com.stripe.android.paymentsheet.PaymentOptionsViewModel;
import com.stripe.android.paymentsheet.PaymentSheet;
import com.stripe.android.paymentsheet.PaymentSheetConfigurationKtxKt;
import com.stripe.android.paymentsheet.PaymentSheetResult;
import com.stripe.android.paymentsheet.PaymentSheetResultCallback;
import com.stripe.android.paymentsheet.analytics.EventReporter;
import com.stripe.android.paymentsheet.flowcontroller.FlowControllerInitializer;
import com.stripe.android.paymentsheet.forms.FormViewModel;
import com.stripe.android.paymentsheet.injection.DaggerFlowControllerComponent;
import com.stripe.android.paymentsheet.injection.FlowControllerComponent;
import com.stripe.android.paymentsheet.model.ClientSecret;
import com.stripe.android.paymentsheet.model.ConfirmStripeIntentParamsFactory;
import com.stripe.android.paymentsheet.model.PaymentIntentClientSecret;
import com.stripe.android.paymentsheet.model.PaymentOption;
import com.stripe.android.paymentsheet.model.PaymentOptionFactory;
import com.stripe.android.paymentsheet.model.PaymentSelection;
import com.stripe.android.paymentsheet.model.SavedSelection;
import com.stripe.android.paymentsheet.model.SetupIntentClientSecret;
import com.stripe.android.ui.core.forms.resources.ResourceRepository;
import dl.H;
import dl.J;
import dl.g;
import java.security.InvalidParameterException;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import org.jetbrains.annotations.NotNull;
@Metadata
public final class DefaultFlowController implements PaymentSheet.FlowController, Injector {
@NotNull
public static final Companion Companion = new Companion(null);
private final boolean enableLogging;
@NotNull
private final EventReporter eventReporter;
public FlowControllerComponent flowControllerComponent;
@NotNull
private final FlowControllerInitializer flowControllerInitializer;
@NotNull
private i.c<GooglePayPaymentMethodLauncherContract.Args> googlePayActivityLauncher;
@NotNull
private final GooglePayPaymentMethodLauncherFactory googlePayPaymentMethodLauncherFactory;
@NotNull
private final String injectorKey;
@NotNull
private final xk.a<PaymentConfiguration> lazyPaymentConfiguration;
@NotNull
private final H lifecycleScope;
private PaymentLauncher paymentLauncher;
@NotNull
private final StripePaymentLauncherAssistedFactory paymentLauncherFactory;
@NotNull
private final i.c<PaymentOptionContract.Args> paymentOptionActivityLauncher;
@NotNull
private final PaymentOptionCallback paymentOptionCallback;
@NotNull
private final PaymentOptionFactory paymentOptionFactory;
@NotNull
private final PaymentSheetResultCallback paymentResultCallback;
@NotNull
private final Set<String> productUsage;
@NotNull
private final ResourceRepository resourceRepository;
@NotNull
private final Function0<Integer> statusBarColor;
@NotNull
private final CoroutineContext uiContext;
@NotNull
private final FlowControllerViewModel viewModel;
@Metadata
public static final class Args implements Parcelable {
@NotNull
private final String clientSecret;
private final PaymentSheet.Configuration config;
@NotNull
public static final Parcelable.Creator<Args> CREATOR = new Creator();
public static final int $stable = 8;
@Metadata
public static final class Creator implements Parcelable.Creator<Args> {
@Override
@NotNull
public final Args createFromParcel(@NotNull Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
return new Args(parcel.readString(), parcel.readInt() == 0 ? null : PaymentSheet.Configuration.CREATOR.createFromParcel(parcel));
}
@Override
@NotNull
public final Args[] newArray(int i) {
return new Args[i];
}
}
public Args(@NotNull String str, PaymentSheet.Configuration configuration) {
Intrinsics.checkNotNullParameter(str, "clientSecret");
this.clientSecret = str;
this.config = configuration;
}
public static Args copy$default(Args args, String str, PaymentSheet.Configuration configuration, int i, Object obj) {
if ((i & 1) != 0) {
str = args.clientSecret;
}
if ((i & 2) != 0) {
configuration = args.config;
}
return args.copy(str, configuration);
}
@NotNull
public final String component1() {
return this.clientSecret;
}
public final PaymentSheet.Configuration component2() {
return this.config;
}
@NotNull
public final Args copy(@NotNull String str, PaymentSheet.Configuration configuration) {
Intrinsics.checkNotNullParameter(str, "clientSecret");
return new Args(str, configuration);
}
@Override
public int describeContents() {
return 0;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Args)) {
return false;
}
Args args = (Args) obj;
return Intrinsics.areEqual(this.clientSecret, args.clientSecret) && Intrinsics.areEqual(this.config, args.config);
}
@NotNull
public final String getClientSecret() {
return this.clientSecret;
}
public final PaymentSheet.Configuration getConfig() {
return this.config;
}
public int hashCode() {
int hashCode = this.clientSecret.hashCode() * 31;
PaymentSheet.Configuration configuration = this.config;
return hashCode + (configuration == null ? 0 : configuration.hashCode());
}
@NotNull
public String toString() {
return "Args(clientSecret=" + this.clientSecret + ", config=" + this.config + ')';
}
@Override
public void writeToParcel(@NotNull Parcel parcel, int i) {
Intrinsics.checkNotNullParameter(parcel, "out");
parcel.writeString(this.clientSecret);
PaymentSheet.Configuration configuration = this.config;
if (configuration == null) {
parcel.writeInt(0);
} else {
parcel.writeInt(1);
configuration.writeToParcel(parcel, i);
}
}
}
@Metadata
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
@NotNull
public final PaymentSheet.FlowController getInstance(@NotNull Context context, @NotNull y0 y0Var, @NotNull H h, @NotNull I i, @NotNull i.b bVar, @NotNull Function0<Integer> function0, @NotNull PaymentOptionFactory paymentOptionFactory, @NotNull PaymentOptionCallback paymentOptionCallback, @NotNull PaymentSheetResultCallback paymentSheetResultCallback) {
Intrinsics.checkNotNullParameter(context, "appContext");
Intrinsics.checkNotNullParameter(y0Var, "viewModelStoreOwner");
Intrinsics.checkNotNullParameter(h, "lifecycleScope");
Intrinsics.checkNotNullParameter(i, "lifecycleOwner");
Intrinsics.checkNotNullParameter(bVar, "activityResultCaller");
Intrinsics.checkNotNullParameter(function0, "statusBarColor");
Intrinsics.checkNotNullParameter(paymentOptionFactory, "paymentOptionFactory");
Intrinsics.checkNotNullParameter(paymentOptionCallback, "paymentOptionCallback");
Intrinsics.checkNotNullParameter(paymentSheetResultCallback, "paymentResultCallback");
WeakMapInjectorRegistry weakMapInjectorRegistry = WeakMapInjectorRegistry.INSTANCE;
String simpleName = Reflection.getOrCreateKotlinClass(PaymentSheet.FlowController.class).getSimpleName();
if (simpleName == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
String nextKey = weakMapInjectorRegistry.nextKey(simpleName);
FlowControllerComponent build = DaggerFlowControllerComponent.builder().appContext(context).viewModelStoreOwner(y0Var).lifecycleScope(h).lifeCycleOwner(i).activityResultCaller(bVar).statusBarColor(function0).paymentOptionFactory(paymentOptionFactory).paymentOptionCallback(paymentOptionCallback).paymentResultCallback(paymentSheetResultCallback).injectorKey(nextKey).build();
DefaultFlowController flowController = build.getFlowController();
flowController.setFlowControllerComponent(build);
weakMapInjectorRegistry.register(flowController, nextKey);
return flowController;
}
private Companion() {
}
}
@Metadata
public static final class GooglePayException extends Exception {
public static final int $stable = 8;
@NotNull
private final Throwable throwable;
public GooglePayException(@NotNull Throwable th) {
super(th);
Intrinsics.checkNotNullParameter(th, "throwable");
this.throwable = th;
}
@NotNull
public final Throwable getThrowable() {
return this.throwable;
}
}
@Metadata
public class WhenMappings {
public static final int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[PaymentSheet.GooglePayConfiguration.Environment.values().length];
iArr[PaymentSheet.GooglePayConfiguration.Environment.Production.ordinal()] = 1;
$EnumSwitchMapping$0 = iArr;
}
}
public DefaultFlowController(@NotNull H h, @NotNull I i, @NotNull Function0<Integer> function0, @NotNull PaymentOptionFactory paymentOptionFactory, @NotNull PaymentOptionCallback paymentOptionCallback, @NotNull PaymentSheetResultCallback paymentSheetResultCallback, @NotNull final i.b bVar, @InjectorKey @NotNull String str, @NotNull FlowControllerInitializer flowControllerInitializer, @NotNull EventReporter eventReporter, @NotNull FlowControllerViewModel flowControllerViewModel, @NotNull StripePaymentLauncherAssistedFactory stripePaymentLauncherAssistedFactory, @NotNull ResourceRepository resourceRepository, @NotNull xk.a<PaymentConfiguration> aVar, @UIContext @NotNull CoroutineContext coroutineContext, boolean z, @NotNull Set<String> set, @NotNull GooglePayPaymentMethodLauncherFactory googlePayPaymentMethodLauncherFactory) {
Intrinsics.checkNotNullParameter(h, "lifecycleScope");
Intrinsics.checkNotNullParameter(i, "lifecycleOwner");
Intrinsics.checkNotNullParameter(function0, "statusBarColor");
Intrinsics.checkNotNullParameter(paymentOptionFactory, "paymentOptionFactory");
Intrinsics.checkNotNullParameter(paymentOptionCallback, "paymentOptionCallback");
Intrinsics.checkNotNullParameter(paymentSheetResultCallback, "paymentResultCallback");
Intrinsics.checkNotNullParameter(bVar, "activityResultCaller");
Intrinsics.checkNotNullParameter(str, "injectorKey");
Intrinsics.checkNotNullParameter(flowControllerInitializer, "flowControllerInitializer");
Intrinsics.checkNotNullParameter(eventReporter, "eventReporter");
Intrinsics.checkNotNullParameter(flowControllerViewModel, "viewModel");
Intrinsics.checkNotNullParameter(stripePaymentLauncherAssistedFactory, "paymentLauncherFactory");
Intrinsics.checkNotNullParameter(resourceRepository, "resourceRepository");
Intrinsics.checkNotNullParameter(aVar, "lazyPaymentConfiguration");
Intrinsics.checkNotNullParameter(coroutineContext, "uiContext");
Intrinsics.checkNotNullParameter(set, NamedConstantsKt.PRODUCT_USAGE);
Intrinsics.checkNotNullParameter(googlePayPaymentMethodLauncherFactory, "googlePayPaymentMethodLauncherFactory");
this.lifecycleScope = h;
this.statusBarColor = function0;
this.paymentOptionFactory = paymentOptionFactory;
this.paymentOptionCallback = paymentOptionCallback;
this.paymentResultCallback = paymentSheetResultCallback;
this.injectorKey = str;
this.flowControllerInitializer = flowControllerInitializer;
this.eventReporter = eventReporter;
this.viewModel = flowControllerViewModel;
this.paymentLauncherFactory = stripePaymentLauncherAssistedFactory;
this.resourceRepository = resourceRepository;
this.lazyPaymentConfiguration = aVar;
this.uiContext = coroutineContext;
this.enableLogging = z;
this.productUsage = set;
this.googlePayPaymentMethodLauncherFactory = googlePayPaymentMethodLauncherFactory;
i.getLifecycle().a(new androidx.lifecycle.H() {
@U(w.a.ON_CREATE)
public final void onCreate() {
DefaultFlowController defaultFlowController = DefaultFlowController.this;
StripePaymentLauncherAssistedFactory stripePaymentLauncherAssistedFactory2 = defaultFlowController.paymentLauncherFactory;
final DefaultFlowController defaultFlowController2 = DefaultFlowController.this;
Function0<String> function02 = new Function0<String>() {
{
super(0);
}
@NotNull
public final String invoke() {
xk.a aVar2;
aVar2 = DefaultFlowController.this.lazyPaymentConfiguration;
return ((PaymentConfiguration) aVar2.get()).getPublishableKey();
}
};
final DefaultFlowController defaultFlowController3 = DefaultFlowController.this;
Function0<String> function03 = new Function0<String>() {
{
super(0);
}
public final String invoke() {
xk.a aVar2;
aVar2 = DefaultFlowController.this.lazyPaymentConfiguration;
return ((PaymentConfiguration) aVar2.get()).getStripeAccountId();
}
};
i.b bVar2 = bVar;
PaymentLauncherContract paymentLauncherContract = new PaymentLauncherContract();
final DefaultFlowController defaultFlowController4 = DefaultFlowController.this;
i.c<PaymentLauncherContract.Args> registerForActivityResult = bVar2.registerForActivityResult(paymentLauncherContract, new i.a() {
public final void onActivityResult(Object obj) {
DefaultFlowController.this.onPaymentResult$paymentsheet_release((PaymentResult) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "activityResultCaller.reg… )");
defaultFlowController.paymentLauncher = stripePaymentLauncherAssistedFactory2.create(function02, function03, registerForActivityResult);
}
@U(w.a.ON_DESTROY)
public final void onDestroy() {
DefaultFlowController.this.paymentLauncher = null;
}
});
i.c<PaymentOptionContract.Args> registerForActivityResult = bVar.registerForActivityResult(new PaymentOptionContract(), new i.a() {
public final void onActivityResult(Object obj) {
DefaultFlowController.this.onPaymentOptionResult$paymentsheet_release((PaymentOptionResult) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "activityResultCaller.reg…ptionResult\n )");
this.paymentOptionActivityLauncher = registerForActivityResult;
i.c<GooglePayPaymentMethodLauncherContract.Args> registerForActivityResult2 = bVar.registerForActivityResult(new GooglePayPaymentMethodLauncherContract(), new i.a() {
public final void onActivityResult(Object obj) {
DefaultFlowController.this.onGooglePayResult$paymentsheet_release((GooglePayPaymentMethodLauncher.Result) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult2, "activityResultCaller.reg…lePayResult\n )");
this.googlePayActivityLauncher = registerForActivityResult2;
}
private final void configureInternal(ClientSecret clientSecret, PaymentSheet.Configuration configuration, PaymentSheet.FlowController.ConfigCallback configCallback) {
if (configuration != null) {
try {
PaymentSheetConfigurationKtxKt.validate(configuration);
} catch (InvalidParameterException e) {
configCallback.onConfigured(false, e);
return;
}
}
clientSecret.validate();
g.b(this.lifecycleScope, (CoroutineContext) null, (J) null, new DefaultFlowController$configureInternal$1(this, clientSecret, configuration, configCallback, null), 3);
}
public final PaymentSheetResult createPaymentSheetResult(PaymentResult paymentResult) {
return paymentResult instanceof PaymentResult.Completed ? PaymentSheetResult.Completed.INSTANCE : paymentResult instanceof PaymentResult.Canceled ? PaymentSheetResult.Canceled.INSTANCE : paymentResult instanceof PaymentResult.Failed ? new PaymentSheetResult.Failed(((PaymentResult.Failed) paymentResult).getThrowable()) : new PaymentSheetResult.Failed(new RuntimeException("Failed to complete payment."));
}
public final Object dispatchResult(FlowControllerInitializer.InitResult initResult, PaymentSheet.FlowController.ConfigCallback configCallback, Kk.c<? super Unit> cVar) {
Object e = g.e(cVar, this.uiContext, new DefaultFlowController$dispatchResult$2(initResult, this, configCallback, null));
return e == Lk.a.COROUTINE_SUSPENDED ? e : Unit.a;
}
private final void launchGooglePay(InitData initData) {
String currencyCode;
Long amount;
PaymentSheet.Configuration config = initData.getConfig();
if (config == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
PaymentSheet.GooglePayConfiguration googlePay = config.getGooglePay();
if (googlePay == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
GooglePayPaymentMethodLauncher create = this.googlePayPaymentMethodLauncherFactory.create(this.lifecycleScope, new GooglePayPaymentMethodLauncher.Config(WhenMappings.$EnumSwitchMapping$0[googlePay.getEnvironment().ordinal()] == 1 ? GooglePayEnvironment.Production : GooglePayEnvironment.Test, googlePay.getCountryCode(), config.getMerchantDisplayName(), false, null, false, false, 120, null), new GooglePayPaymentMethodLauncher.ReadyCallback() {
@Override
public final void onReady(boolean z) {
}
}, this.googlePayActivityLauncher, true);
StripeIntent stripeIntent = initData.getStripeIntent();
PaymentIntent paymentIntent = stripeIntent instanceof PaymentIntent ? (PaymentIntent) stripeIntent : null;
if ((paymentIntent == null || (currencyCode = paymentIntent.getCurrency()) == null) && (currencyCode = googlePay.getCurrencyCode()) == null) {
currencyCode = CameraView.FILL_ASPECT_RATIO;
}
StripeIntent stripeIntent2 = initData.getStripeIntent();
PaymentIntent paymentIntent2 = stripeIntent2 instanceof PaymentIntent ? (PaymentIntent) stripeIntent2 : null;
create.present(currencyCode, (paymentIntent2 == null || (amount = paymentIntent2.getAmount()) == null) ? 0 : (int) amount.longValue(), initData.getStripeIntent().getId());
}
public final void onInitSuccess(InitData initData, PaymentSheet.FlowController.ConfigCallback configCallback) {
PaymentSelection paymentSelection;
Object obj;
this.eventReporter.onInit(initData.getConfig());
SavedSelection savedSelection = initData.getSavedSelection();
if (Intrinsics.areEqual(savedSelection, SavedSelection.GooglePay.INSTANCE)) {
paymentSelection = PaymentSelection.GooglePay.INSTANCE;
} else {
if (savedSelection instanceof SavedSelection.PaymentMethod) {
Iterator<T> it = initData.getPaymentMethods().iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
} else {
obj = it.next();
if (Intrinsics.areEqual(((PaymentMethod) obj).id, ((SavedSelection.PaymentMethod) savedSelection).getId())) {
break;
}
}
}
PaymentMethod paymentMethod = (PaymentMethod) obj;
if (paymentMethod != null) {
paymentSelection = new PaymentSelection.Saved(paymentMethod);
}
}
paymentSelection = null;
}
this.viewModel.setPaymentSelection(paymentSelection);
this.viewModel.setInitData(initData);
configCallback.onConfigured(true, null);
}
@Override
public void configureWithPaymentIntent(@NotNull String str, PaymentSheet.Configuration configuration, @NotNull PaymentSheet.FlowController.ConfigCallback configCallback) {
Intrinsics.checkNotNullParameter(str, "paymentIntentClientSecret");
Intrinsics.checkNotNullParameter(configCallback, "callback");
configureInternal(new PaymentIntentClientSecret(str), configuration, configCallback);
}
@Override
public void configureWithSetupIntent(@NotNull String str, PaymentSheet.Configuration configuration, @NotNull PaymentSheet.FlowController.ConfigCallback configCallback) {
Intrinsics.checkNotNullParameter(str, "setupIntentClientSecret");
Intrinsics.checkNotNullParameter(configCallback, "callback");
configureInternal(new SetupIntentClientSecret(str), configuration, configCallback);
}
@Override
public void confirm() {
InitData a;
try {
p.a aVar = p.b;
a = this.viewModel.getInitData();
} catch (Throwable th) {
p.a aVar2 = p.b;
a = q.a(th);
}
if (p.a(a) != null) {
throw new IllegalStateException("FlowController must be successfully initialized using configureWithPaymentIntent() or configureWithSetupIntent() before calling confirm()".toString());
}
InitData initData = a;
PaymentSelection paymentSelection = this.viewModel.getPaymentSelection();
if (Intrinsics.areEqual(paymentSelection, PaymentSelection.GooglePay.INSTANCE)) {
launchGooglePay(initData);
} else {
confirmPaymentSelection(paymentSelection, initData);
}
}
public final void confirmPaymentSelection(PaymentSelection paymentSelection, @NotNull InitData initData) {
Intrinsics.checkNotNullParameter(initData, "initData");
ConfirmStripeIntentParamsFactory<ConfirmStripeIntentParams> createFactory = ConfirmStripeIntentParamsFactory.Companion.createFactory(initData.getClientSecret());
ConfirmStripeIntentParams create = paymentSelection instanceof PaymentSelection.Saved ? createFactory.create((PaymentSelection.Saved) paymentSelection) : paymentSelection instanceof PaymentSelection.New ? createFactory.create((PaymentSelection.New) paymentSelection) : null;
if (create != null) {
g.b(this.lifecycleScope, (CoroutineContext) null, (J) null, new DefaultFlowController$confirmPaymentSelection$1$1(create, this, null), 3);
}
}
@NotNull
public final FlowControllerComponent getFlowControllerComponent() {
FlowControllerComponent flowControllerComponent = this.flowControllerComponent;
if (flowControllerComponent != null) {
return flowControllerComponent;
}
Intrinsics.throwUninitializedPropertyAccessException("flowControllerComponent");
return null;
}
@Override
public PaymentOption getPaymentOption() {
PaymentSelection paymentSelection = this.viewModel.getPaymentSelection();
if (paymentSelection != null) {
return this.paymentOptionFactory.create(paymentSelection);
}
return null;
}
@Override
public void inject(@NotNull Injectable<?> injectable) {
Intrinsics.checkNotNullParameter(injectable, "injectable");
if (injectable instanceof PaymentOptionsViewModel.Factory) {
getFlowControllerComponent().inject((PaymentOptionsViewModel.Factory) injectable);
return;
}
if (injectable instanceof FormViewModel.Factory) {
getFlowControllerComponent().inject((FormViewModel.Factory) injectable);
return;
}
throw new IllegalArgumentException("invalid Injectable " + injectable + " requested in " + this);
}
public final void onGooglePayResult$paymentsheet_release(@NotNull GooglePayPaymentMethodLauncher.Result result) {
InitData a;
Intrinsics.checkNotNullParameter(result, "googlePayResult");
if (!(result instanceof GooglePayPaymentMethodLauncher.Result.Completed)) {
if (result instanceof GooglePayPaymentMethodLauncher.Result.Failed) {
this.eventReporter.onPaymentFailure(PaymentSelection.GooglePay.INSTANCE);
this.paymentResultCallback.onPaymentSheetResult(new PaymentSheetResult.Failed(new GooglePayException(((GooglePayPaymentMethodLauncher.Result.Failed) result).getError())));
return;
} else {
if (result instanceof GooglePayPaymentMethodLauncher.Result.Canceled) {
this.paymentResultCallback.onPaymentSheetResult(PaymentSheetResult.Canceled.INSTANCE);
return;
}
return;
}
}
try {
p.a aVar = p.b;
a = this.viewModel.getInitData();
} catch (Throwable th) {
p.a aVar2 = p.b;
a = q.a(th);
}
Throwable a2 = p.a(a);
if (a2 != null) {
this.eventReporter.onPaymentFailure(PaymentSelection.GooglePay.INSTANCE);
this.paymentResultCallback.onPaymentSheetResult(new PaymentSheetResult.Failed(a2));
} else {
PaymentSelection.Saved saved = new PaymentSelection.Saved(((GooglePayPaymentMethodLauncher.Result.Completed) result).getPaymentMethod());
this.viewModel.setPaymentSelection(saved);
confirmPaymentSelection(saved, a);
}
}
public final void onPaymentOptionResult$paymentsheet_release(PaymentOptionResult paymentOptionResult) {
List<PaymentMethod> paymentMethods;
if (paymentOptionResult != null && (paymentMethods = paymentOptionResult.getPaymentMethods()) != null) {
FlowControllerViewModel flowControllerViewModel = this.viewModel;
flowControllerViewModel.setInitData(InitData.copy$default(flowControllerViewModel.getInitData(), null, null, null, paymentMethods, null, false, 55, null));
}
if (paymentOptionResult instanceof PaymentOptionResult.Succeeded) {
PaymentSelection paymentSelection = ((PaymentOptionResult.Succeeded) paymentOptionResult).getPaymentSelection();
this.viewModel.setPaymentSelection(paymentSelection);
this.paymentOptionCallback.onPaymentOption(this.paymentOptionFactory.create(paymentSelection));
return;
}
if (!(paymentOptionResult instanceof PaymentOptionResult.Failed) && !(paymentOptionResult instanceof PaymentOptionResult.Canceled)) {
this.viewModel.setPaymentSelection(null);
this.paymentOptionCallback.onPaymentOption(null);
} else {
PaymentOptionCallback paymentOptionCallback = this.paymentOptionCallback;
PaymentSelection paymentSelection2 = this.viewModel.getPaymentSelection();
paymentOptionCallback.onPaymentOption(paymentSelection2 != null ? this.paymentOptionFactory.create(paymentSelection2) : null);
}
}
public final void onPaymentResult$paymentsheet_release(@NotNull PaymentResult paymentResult) {
Intrinsics.checkNotNullParameter(paymentResult, "paymentResult");
g.b(this.lifecycleScope, (CoroutineContext) null, (J) null, new DefaultFlowController$onPaymentResult$1(this, paymentResult, null), 3);
}
@Override
public void presentPaymentOptions() {
InitData a;
try {
p.a aVar = p.b;
a = this.viewModel.getInitData();
} catch (Throwable th) {
p.a aVar2 = p.b;
a = q.a(th);
}
if (p.a(a) != null) {
throw new IllegalStateException("FlowController must be successfully initialized using configureWithPaymentIntent() or configureWithSetupIntent() before calling presentPaymentOptions()".toString());
}
InitData initData = a;
i.c<PaymentOptionContract.Args> cVar = this.paymentOptionActivityLauncher;
StripeIntent stripeIntent = initData.getStripeIntent();
List<PaymentMethod> paymentMethods = initData.getPaymentMethods();
PaymentSheet.Configuration config = initData.getConfig();
boolean isGooglePayReady = initData.isGooglePayReady();
PaymentSelection paymentSelection = this.viewModel.getPaymentSelection();
cVar.launch(new PaymentOptionContract.Args(stripeIntent, paymentMethods, config, isGooglePayReady, paymentSelection instanceof PaymentSelection.New ? (PaymentSelection.New) paymentSelection : null, (Integer) this.statusBarColor.invoke(), this.injectorKey, this.enableLogging, this.productUsage));
}
public final void setFlowControllerComponent(@NotNull FlowControllerComponent flowControllerComponent) {
Intrinsics.checkNotNullParameter(flowControllerComponent, "<set-?>");
this.flowControllerComponent = flowControllerComponent;
}
}