正在查看: Crafto v9.3.3 应用的 PaymentLauncherViewModel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Crafto v9.3.3 应用的 PaymentLauncherViewModel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.stripe.android.payments.paymentlauncher;
import K.N;
import W3.f;
import android.app.Application;
import android.os.Bundle;
import androidx.lifecycle.S;
import androidx.lifecycle.e0;
import androidx.lifecycle.r0;
import androidx.lifecycle.s0;
import androidx.lifecycle.w0;
import com.stripe.android.StripeIntentResult;
import com.stripe.android.core.exception.APIException;
import com.stripe.android.core.injection.InjectWithFallbackKt;
import com.stripe.android.core.injection.Injectable;
import com.stripe.android.core.injection.UIContext;
import com.stripe.android.core.networking.ApiRequest;
import com.stripe.android.core.networking.DefaultAnalyticsRequestExecutor;
import com.stripe.android.model.ConfirmPaymentIntentParams;
import com.stripe.android.model.ConfirmSetupIntentParams;
import com.stripe.android.model.ConfirmStripeIntentParams;
import com.stripe.android.model.StripeIntent;
import com.stripe.android.networking.PaymentAnalyticsEvent;
import com.stripe.android.networking.PaymentAnalyticsRequestFactory;
import com.stripe.android.networking.StripeRepository;
import com.stripe.android.payments.DefaultReturnUrl;
import com.stripe.android.payments.PaymentFlowResult;
import com.stripe.android.payments.PaymentIntentFlowResultProcessor;
import com.stripe.android.payments.SetupIntentFlowResultProcessor;
import com.stripe.android.payments.core.authentication.PaymentAuthenticatorRegistry;
import com.stripe.android.payments.core.injection.DaggerPaymentLauncherViewModelFactoryComponent;
import com.stripe.android.payments.core.injection.NamedConstantsKt;
import com.stripe.android.payments.core.injection.PaymentLauncherViewModelSubcomponent;
import com.stripe.android.payments.paymentlauncher.PaymentLauncherContract;
import com.stripe.android.payments.paymentlauncher.PaymentLauncherViewModel;
import com.stripe.android.payments.paymentlauncher.PaymentResult;
import com.stripe.android.view.AuthActivityStarterHost;
import dl.J;
import dl.g;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.collections.s;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
@Metadata
public final class PaymentLauncherViewModel extends r0 {
@NotNull
public static final Companion Companion = new Companion(null);
@NotNull
private static final List<String> EXPAND_PAYMENT_METHOD = s.b("payment_method");
@NotNull
public static final String KEY_HAS_STARTED = "key_has_started";
@NotNull
public static final String REQUIRED_ERROR = "API request returned an invalid response.";
@NotNull
public static final String TIMEOUT_ERROR = "Payment fails due to time out. \n";
@NotNull
public static final String UNKNOWN_ERROR = "Payment fails due to unknown error. \n";
@NotNull
private final DefaultAnalyticsRequestExecutor analyticsRequestExecutor;
@NotNull
private final xk.a<ApiRequest.Options> apiRequestOptionsProvider;
@NotNull
private final PaymentAuthenticatorRegistry authenticatorRegistry;
@NotNull
private final DefaultReturnUrl defaultReturnUrl;
private final boolean isInstantApp;
private final boolean isPaymentIntent;
@NotNull
private final Ti.a<PaymentIntentFlowResultProcessor> lazyPaymentIntentFlowResultProcessor;
@NotNull
private final Ti.a<SetupIntentFlowResultProcessor> lazySetupIntentFlowResultProcessor;
@NotNull
private final PaymentAnalyticsRequestFactory paymentAnalyticsRequestFactory;
@NotNull
private final S<PaymentResult> paymentLauncherResult;
@NotNull
private final e0 savedStateHandle;
@NotNull
private final StripeRepository stripeApiRepository;
@NotNull
private final Map<String, String> threeDs1IntentReturnUrlMap;
@NotNull
private final CoroutineContext uiContext;
@Metadata
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
@NotNull
public final List<String> getEXPAND_PAYMENT_METHOD() {
return PaymentLauncherViewModel.EXPAND_PAYMENT_METHOD;
}
private Companion() {
}
public static void getKEY_HAS_STARTED$payments_core_release$annotations() {
}
}
@Metadata
public static final class Factory extends androidx.lifecycle.a implements Injectable<FallbackInitializeParam> {
@NotNull
private final Function0<Application> applicationSupplier;
@NotNull
private final Function0<PaymentLauncherContract.Args> argsSupplier;
public xk.a<PaymentLauncherViewModelSubcomponent.Builder> subComponentBuilderProvider;
@Metadata
public static final class FallbackInitializeParam {
@NotNull
private final Application application;
private final boolean enableLogging;
@NotNull
private final Set<String> productUsage;
@NotNull
private final String publishableKey;
private final String stripeAccountId;
public FallbackInitializeParam(@NotNull Application application, boolean z, @NotNull String str, String str2, @NotNull Set<String> set) {
Intrinsics.checkNotNullParameter(application, "application");
Intrinsics.checkNotNullParameter(str, "publishableKey");
Intrinsics.checkNotNullParameter(set, NamedConstantsKt.PRODUCT_USAGE);
this.application = application;
this.enableLogging = z;
this.publishableKey = str;
this.stripeAccountId = str2;
this.productUsage = set;
}
public static FallbackInitializeParam copy$default(FallbackInitializeParam fallbackInitializeParam, Application application, boolean z, String str, String str2, Set set, int i, Object obj) {
if ((i & 1) != 0) {
application = fallbackInitializeParam.application;
}
if ((i & 2) != 0) {
z = fallbackInitializeParam.enableLogging;
}
boolean z2 = z;
if ((i & 4) != 0) {
str = fallbackInitializeParam.publishableKey;
}
String str3 = str;
if ((i & 8) != 0) {
str2 = fallbackInitializeParam.stripeAccountId;
}
String str4 = str2;
if ((i & 16) != 0) {
set = fallbackInitializeParam.productUsage;
}
return fallbackInitializeParam.copy(application, z2, str3, str4, set);
}
@NotNull
public final Application component1() {
return this.application;
}
public final boolean component2() {
return this.enableLogging;
}
@NotNull
public final String component3() {
return this.publishableKey;
}
public final String component4() {
return this.stripeAccountId;
}
@NotNull
public final Set<String> component5() {
return this.productUsage;
}
@NotNull
public final FallbackInitializeParam copy(@NotNull Application application, boolean z, @NotNull String str, String str2, @NotNull Set<String> set) {
Intrinsics.checkNotNullParameter(application, "application");
Intrinsics.checkNotNullParameter(str, "publishableKey");
Intrinsics.checkNotNullParameter(set, NamedConstantsKt.PRODUCT_USAGE);
return new FallbackInitializeParam(application, z, str, str2, set);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof FallbackInitializeParam)) {
return false;
}
FallbackInitializeParam fallbackInitializeParam = (FallbackInitializeParam) obj;
return Intrinsics.areEqual(this.application, fallbackInitializeParam.application) && this.enableLogging == fallbackInitializeParam.enableLogging && Intrinsics.areEqual(this.publishableKey, fallbackInitializeParam.publishableKey) && Intrinsics.areEqual(this.stripeAccountId, fallbackInitializeParam.stripeAccountId) && Intrinsics.areEqual(this.productUsage, fallbackInitializeParam.productUsage);
}
@NotNull
public final Application getApplication() {
return this.application;
}
public final boolean getEnableLogging() {
return this.enableLogging;
}
@NotNull
public final Set<String> getProductUsage() {
return this.productUsage;
}
@NotNull
public final String getPublishableKey() {
return this.publishableKey;
}
public final String getStripeAccountId() {
return this.stripeAccountId;
}
public int hashCode() {
int hashCode = this.application.hashCode() * 31;
boolean z = this.enableLogging;
int i = z;
if (z != 0) {
i = 1;
}
int a = N.a((hashCode + i) * 31, 31, this.publishableKey);
String str = this.stripeAccountId;
return this.productUsage.hashCode() + ((a + (str == null ? 0 : str.hashCode())) * 31);
}
@NotNull
public String toString() {
return "FallbackInitializeParam(application=" + this.application + ", enableLogging=" + this.enableLogging + ", publishableKey=" + this.publishableKey + ", stripeAccountId=" + this.stripeAccountId + ", productUsage=" + this.productUsage + ')';
}
}
public Factory(@NotNull Function0<? extends PaymentLauncherContract.Args> function0, @NotNull Function0<? extends Application> function02, @NotNull f fVar) {
super(fVar, (Bundle) null);
Intrinsics.checkNotNullParameter(function0, "argsSupplier");
Intrinsics.checkNotNullParameter(function02, "applicationSupplier");
Intrinsics.checkNotNullParameter(fVar, "owner");
this.argsSupplier = function0;
this.applicationSupplier = function02;
}
@NotNull
public r0 create(@NotNull al.c cVar, @NotNull y2.a aVar) {
return w0.a(this, cVar, aVar);
}
@NotNull
public final xk.a<PaymentLauncherViewModelSubcomponent.Builder> getSubComponentBuilderProvider() {
xk.a<PaymentLauncherViewModelSubcomponent.Builder> aVar = this.subComponentBuilderProvider;
if (aVar != null) {
return aVar;
}
Intrinsics.throwUninitializedPropertyAccessException("subComponentBuilderProvider");
return null;
}
public final void setSubComponentBuilderProvider(@NotNull xk.a<PaymentLauncherViewModelSubcomponent.Builder> aVar) {
Intrinsics.checkNotNullParameter(aVar, "<set-?>");
this.subComponentBuilderProvider = aVar;
}
public <T extends r0> T create(@NotNull String str, @NotNull Class<T> cls, @NotNull e0 e0Var) {
Intrinsics.checkNotNullParameter(str, "key");
Intrinsics.checkNotNullParameter(cls, "modelClass");
Intrinsics.checkNotNullParameter(e0Var, "handle");
PaymentLauncherContract.Args args = (PaymentLauncherContract.Args) this.argsSupplier.invoke();
InjectWithFallbackKt.injectWithFallback(this, args.getInjectorKey(), new FallbackInitializeParam((Application) this.applicationSupplier.invoke(), args.getEnableLogging(), args.getPublishableKey(), args.getStripeAccountId(), args.getProductUsage()));
PaymentLauncherViewModelSubcomponent.Builder builder = (PaymentLauncherViewModelSubcomponent.Builder) getSubComponentBuilderProvider().get();
boolean z = false;
if (!(args instanceof PaymentLauncherContract.Args.IntentConfirmationArgs)) {
if (!(args instanceof PaymentLauncherContract.Args.PaymentIntentNextActionArgs)) {
if (!(args instanceof PaymentLauncherContract.Args.SetupIntentNextActionArgs)) {
throw new NoWhenBranchMatchedException();
}
return builder.isPaymentIntent(z).savedStateHandle(e0Var).build().getViewModel();
}
z = true;
return builder.isPaymentIntent(z).savedStateHandle(e0Var).build().getViewModel();
}
ConfirmStripeIntentParams confirmStripeIntentParams = ((PaymentLauncherContract.Args.IntentConfirmationArgs) args).getConfirmStripeIntentParams();
if (!(confirmStripeIntentParams instanceof ConfirmPaymentIntentParams)) {
if (!(confirmStripeIntentParams instanceof ConfirmSetupIntentParams)) {
throw new NoWhenBranchMatchedException();
}
return builder.isPaymentIntent(z).savedStateHandle(e0Var).build().getViewModel();
}
z = true;
return builder.isPaymentIntent(z).savedStateHandle(e0Var).build().getViewModel();
}
@Override
public void fallbackInitialize(@NotNull final FallbackInitializeParam fallbackInitializeParam) {
Intrinsics.checkNotNullParameter(fallbackInitializeParam, "arg");
DaggerPaymentLauncherViewModelFactoryComponent.builder().context(fallbackInitializeParam.getApplication()).enableLogging(fallbackInitializeParam.getEnableLogging()).publishableKeyProvider(new Function0<String>() {
{
super(0);
}
@NotNull
public final String invoke() {
return PaymentLauncherViewModel.Factory.FallbackInitializeParam.this.getPublishableKey();
}
}).stripeAccountIdProvider(new Function0<String>() {
{
super(0);
}
public final String invoke() {
return PaymentLauncherViewModel.Factory.FallbackInitializeParam.this.getStripeAccountId();
}
}).productUsage(fallbackInitializeParam.getProductUsage()).build().inject(this);
}
}
public PaymentLauncherViewModel(boolean z, @NotNull StripeRepository stripeRepository, @NotNull PaymentAuthenticatorRegistry paymentAuthenticatorRegistry, @NotNull DefaultReturnUrl defaultReturnUrl, @NotNull xk.a<ApiRequest.Options> aVar, @NotNull Map<String, String> map, @NotNull Ti.a<PaymentIntentFlowResultProcessor> aVar2, @NotNull Ti.a<SetupIntentFlowResultProcessor> aVar3, @NotNull DefaultAnalyticsRequestExecutor defaultAnalyticsRequestExecutor, @NotNull PaymentAnalyticsRequestFactory paymentAnalyticsRequestFactory, @UIContext @NotNull CoroutineContext coroutineContext, @NotNull e0 e0Var, boolean z2) {
Intrinsics.checkNotNullParameter(stripeRepository, "stripeApiRepository");
Intrinsics.checkNotNullParameter(paymentAuthenticatorRegistry, "authenticatorRegistry");
Intrinsics.checkNotNullParameter(defaultReturnUrl, "defaultReturnUrl");
Intrinsics.checkNotNullParameter(aVar, "apiRequestOptionsProvider");
Intrinsics.checkNotNullParameter(map, "threeDs1IntentReturnUrlMap");
Intrinsics.checkNotNullParameter(aVar2, "lazyPaymentIntentFlowResultProcessor");
Intrinsics.checkNotNullParameter(aVar3, "lazySetupIntentFlowResultProcessor");
Intrinsics.checkNotNullParameter(defaultAnalyticsRequestExecutor, "analyticsRequestExecutor");
Intrinsics.checkNotNullParameter(paymentAnalyticsRequestFactory, "paymentAnalyticsRequestFactory");
Intrinsics.checkNotNullParameter(coroutineContext, "uiContext");
Intrinsics.checkNotNullParameter(e0Var, "savedStateHandle");
this.isPaymentIntent = z;
this.stripeApiRepository = stripeRepository;
this.authenticatorRegistry = paymentAuthenticatorRegistry;
this.defaultReturnUrl = defaultReturnUrl;
this.apiRequestOptionsProvider = aVar;
this.threeDs1IntentReturnUrlMap = map;
this.lazyPaymentIntentFlowResultProcessor = aVar2;
this.lazySetupIntentFlowResultProcessor = aVar3;
this.analyticsRequestExecutor = defaultAnalyticsRequestExecutor;
this.paymentAnalyticsRequestFactory = paymentAnalyticsRequestFactory;
this.uiContext = coroutineContext;
this.savedStateHandle = e0Var;
this.isInstantApp = z2;
this.paymentLauncherResult = new S<>();
}
public final java.lang.Object confirmIntent(com.stripe.android.model.ConfirmStripeIntentParams r6, java.lang.String r7, Kk.c<? super com.stripe.android.model.StripeIntent> r8) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.payments.paymentlauncher.PaymentLauncherViewModel.confirmIntent(com.stripe.android.model.ConfirmStripeIntentParams, java.lang.String, Kk.c):java.lang.Object");
}
private final boolean getHasStarted() {
Boolean bool = (Boolean) this.savedStateHandle.b(KEY_HAS_STARTED);
if (bool == null) {
return false;
}
return bool.booleanValue();
}
public final void logReturnUrl(String str) {
this.analyticsRequestExecutor.executeAsync(PaymentAnalyticsRequestFactory.createRequest$payments_core_release$default(this.paymentAnalyticsRequestFactory, Intrinsics.areEqual(str, this.defaultReturnUrl.getValue()) ? PaymentAnalyticsEvent.ConfirmReturnUrlDefault : str == null ? PaymentAnalyticsEvent.ConfirmReturnUrlNull : PaymentAnalyticsEvent.ConfirmReturnUrlCustom, null, null, null, null, 30, null));
}
public final void postResult(StripeIntentResult<? extends StripeIntent> stripeIntentResult) {
Object obj;
S<PaymentResult> s = this.paymentLauncherResult;
int outcome = stripeIntentResult.getOutcome();
if (outcome == 1) {
obj = PaymentResult.Completed.INSTANCE;
} else if (outcome == 2) {
obj = new PaymentResult.Failed(new APIException(null, null, 0, stripeIntentResult.getFailureMessage(), null, 23, null));
} else if (outcome == 3) {
obj = PaymentResult.Canceled.INSTANCE;
} else if (outcome != 4) {
obj = new PaymentResult.Failed(new APIException(null, null, 0, UNKNOWN_ERROR + stripeIntentResult.getFailureMessage(), null, 23, null));
} else {
obj = new PaymentResult.Failed(new APIException(null, null, 0, TIMEOUT_ERROR + stripeIntentResult.getFailureMessage(), null, 23, null));
}
s.postValue(obj);
}
public final void cleanUp$payments_core_release() {
this.authenticatorRegistry.onLauncherInvalidated();
}
public final void confirmStripeIntent$payments_core_release(@NotNull ConfirmStripeIntentParams confirmStripeIntentParams, @NotNull AuthActivityStarterHost authActivityStarterHost) {
Intrinsics.checkNotNullParameter(confirmStripeIntentParams, "confirmStripeIntentParams");
Intrinsics.checkNotNullParameter(authActivityStarterHost, "host");
if (getHasStarted()) {
return;
}
g.b(s0.a(this), (CoroutineContext) null, (J) null, new PaymentLauncherViewModel$confirmStripeIntent$1(this, confirmStripeIntentParams, authActivityStarterHost, null), 3);
}
@NotNull
public final S<PaymentResult> getPaymentLauncherResult$payments_core_release() {
return this.paymentLauncherResult;
}
public final void handleNextActionForStripeIntent$payments_core_release(@NotNull String str, @NotNull AuthActivityStarterHost authActivityStarterHost) {
Intrinsics.checkNotNullParameter(str, "clientSecret");
Intrinsics.checkNotNullParameter(authActivityStarterHost, "host");
if (getHasStarted()) {
return;
}
g.b(s0.a(this), (CoroutineContext) null, (J) null, new PaymentLauncherViewModel$handleNextActionForStripeIntent$1(this, str, authActivityStarterHost, null), 3);
}
public final void onPaymentFlowResult$payments_core_release(@NotNull PaymentFlowResult.Unvalidated unvalidated) {
Intrinsics.checkNotNullParameter(unvalidated, "paymentFlowResult");
g.b(s0.a(this), (CoroutineContext) null, (J) null, new PaymentLauncherViewModel$onPaymentFlowResult$1(this, unvalidated, null), 3);
}
public final void register$payments_core_release(@NotNull i.b bVar) {
Intrinsics.checkNotNullParameter(bVar, "caller");
this.authenticatorRegistry.onNewActivityResultCaller(bVar, new i.a() {
public final void onActivityResult(Object obj) {
PaymentLauncherViewModel.this.onPaymentFlowResult$payments_core_release((PaymentFlowResult.Unvalidated) obj);
}
});
}
}