导航菜单

页面标题

页面副标题

Crafto v9.3.3 - GooglePayLauncherViewModel.java 源代码

正在查看: Crafto v9.3.3 应用的 GooglePayLauncherViewModel.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.stripe.android.googlepaylauncher;

import android.app.Application;
import android.content.Intent;
import androidx.lifecycle.N;
import androidx.lifecycle.Q;
import androidx.lifecycle.S;
import androidx.lifecycle.q0;
import androidx.lifecycle.r0;
import androidx.lifecycle.s0;
import androidx.lifecycle.v0;
import androidx.lifecycle.w0;
import com.stripe.android.GooglePayJsonFactory;
import com.stripe.android.PaymentConfiguration;
import com.stripe.android.PaymentController;
import com.stripe.android.StripePaymentController;
import com.stripe.android.core.Logger;
import com.stripe.android.core.networking.ApiRequest;
import com.stripe.android.googlepaylauncher.GooglePayLauncher;
import com.stripe.android.googlepaylauncher.GooglePayLauncherContract;
import com.stripe.android.model.ConfirmPaymentIntentParams;
import com.stripe.android.model.ConfirmSetupIntentParams;
import com.stripe.android.model.ConfirmStripeIntentParams;
import com.stripe.android.model.MandateDataParams;
import com.stripe.android.model.PaymentIntent;
import com.stripe.android.model.PaymentMethodCreateParams;
import com.stripe.android.model.SetupIntent;
import com.stripe.android.model.StripeIntent;
import com.stripe.android.networking.PaymentAnalyticsRequestFactory;
import com.stripe.android.networking.StripeApiRepository;
import com.stripe.android.networking.StripeRepository;
import com.stripe.android.stripe3ds2.transactions.MessageExtension;
import com.stripe.android.view.AuthActivityStarterHost;
import dl.J;
import dl.g;
import gl.h;
import java.util.Set;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.collections.W;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;

@Metadata
public final class GooglePayLauncherViewModel extends r0 {

    @NotNull
    private final S<GooglePayLauncher.Result> _googleResult;

    @NotNull
    private final GooglePayLauncherContract.Args args;

    @NotNull
    private final GooglePayJsonFactory googlePayJsonFactory;

    @NotNull
    private final GooglePayRepository googlePayRepository;

    @NotNull
    private final N<GooglePayLauncher.Result> googlePayResult;
    private boolean hasLaunched;

    @NotNull
    private final PaymentController paymentController;

    @NotNull
    private final Ee.d paymentsClient;

    @NotNull
    private final ApiRequest.Options requestOptions;

    @NotNull
    private final StripeRepository stripeRepository;

    @Metadata
    public static final class Factory implements v0.b {

        @NotNull
        private final Application application;

        @NotNull
        private final GooglePayLauncherContract.Args args;
        private final boolean enableLogging;

        @NotNull
        private final CoroutineContext workContext;

        public Factory(@NotNull Application application, @NotNull GooglePayLauncherContract.Args args, boolean z, @NotNull CoroutineContext coroutineContext) {
            Intrinsics.checkNotNullParameter(application, "application");
            Intrinsics.checkNotNullParameter(args, "args");
            Intrinsics.checkNotNullParameter(coroutineContext, "workContext");
            this.application = application;
            this.args = args;
            this.enableLogging = z;
            this.workContext = coroutineContext;
        }

        @NotNull
        public r0 create(@NotNull al.c cVar, @NotNull y2.a aVar) {
            return w0.a(this, cVar, aVar);
        }

        @NotNull
        public r0 create(@NotNull Class cls, @NotNull y2.a aVar) {
            return w0.b(this, cls, aVar);
        }

        @NotNull
        public <T extends r0> T create(@NotNull Class<T> cls) {
            Intrinsics.checkNotNullParameter(cls, "modelClass");
            GooglePayEnvironment environment = this.args.getConfig$payments_core_release().getEnvironment();
            Logger companion = Logger.Companion.getInstance(this.enableLogging);
            PaymentConfiguration companion2 = PaymentConfiguration.Companion.getInstance(this.application);
            final String publishableKey = companion2.getPublishableKey();
            String stripeAccountId = companion2.getStripeAccountId();
            Set b = W.b(GooglePayLauncher.PRODUCT_USAGE);
            StripeApiRepository stripeApiRepository = new StripeApiRepository(this.application, new Function0<String>() {
                {
                    super(0);
                }

                @NotNull
                public final String invoke() {
                    return publishableKey;
                }
            }, null, companion, this.workContext, b, null, null, null, new PaymentAnalyticsRequestFactory(this.application, publishableKey, (Set<String>) b), null, null, null, null, 15812, null);
            return new GooglePayLauncherViewModel(new PaymentsClientFactory(this.application).create(environment), new ApiRequest.Options(publishableKey, stripeAccountId, null, 4, null), this.args, stripeApiRepository, new StripePaymentController(this.application, new Function0<String>() {
                {
                    super(0);
                }

                @NotNull
                public final String invoke() {
                    return publishableKey;
                }
            }, stripeApiRepository, this.enableLogging, this.workContext, null, null, null, null, 480, null), new GooglePayJsonFactory(new com.stripe.android.GooglePayConfig(publishableKey, stripeAccountId), this.args.getConfig$payments_core_release().isJcbEnabled$payments_core_release()), new DefaultGooglePayRepository(this.application, this.args.getConfig$payments_core_release().getEnvironment(), GooglePayConfigConversionKtxKt.convert(this.args.getConfig$payments_core_release().getBillingAddressConfig()), this.args.getConfig$payments_core_release().getExistingPaymentMethodRequired(), this.args.getConfig$payments_core_release().getAllowCreditCards(), companion));
        }

        public Factory(android.app.Application r1, com.stripe.android.googlepaylauncher.GooglePayLauncherContract.Args r2, boolean r3, kotlin.coroutines.CoroutineContext r4, int r5, kotlin.jvm.internal.DefaultConstructorMarker r6) {
            throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.googlepaylauncher.GooglePayLauncherViewModel.Factory.<init>(android.app.Application, com.stripe.android.googlepaylauncher.GooglePayLauncherContract$Args, boolean, kotlin.coroutines.CoroutineContext, int, kotlin.jvm.internal.DefaultConstructorMarker):void");
        }
    }

    @Metadata
    public class WhenMappings {
        public static final int[] $EnumSwitchMapping$0;

        static {
            int[] iArr = new int[GooglePayLauncher.BillingAddressConfig.Format.values().length];
            iArr[GooglePayLauncher.BillingAddressConfig.Format.Min.ordinal()] = 1;
            iArr[GooglePayLauncher.BillingAddressConfig.Format.Full.ordinal()] = 2;
            $EnumSwitchMapping$0 = iArr;
        }
    }

    public GooglePayLauncherViewModel(@NotNull Ee.d dVar, @NotNull ApiRequest.Options options, @NotNull GooglePayLauncherContract.Args args, @NotNull StripeRepository stripeRepository, @NotNull PaymentController paymentController, @NotNull GooglePayJsonFactory googlePayJsonFactory, @NotNull GooglePayRepository googlePayRepository) {
        Intrinsics.checkNotNullParameter(dVar, "paymentsClient");
        Intrinsics.checkNotNullParameter(options, "requestOptions");
        Intrinsics.checkNotNullParameter(args, "args");
        Intrinsics.checkNotNullParameter(stripeRepository, "stripeRepository");
        Intrinsics.checkNotNullParameter(paymentController, "paymentController");
        Intrinsics.checkNotNullParameter(googlePayJsonFactory, "googlePayJsonFactory");
        Intrinsics.checkNotNullParameter(googlePayRepository, "googlePayRepository");
        this.paymentsClient = dVar;
        this.requestOptions = options;
        this.args = args;
        this.stripeRepository = stripeRepository;
        this.paymentController = paymentController;
        this.googlePayJsonFactory = googlePayJsonFactory;
        this.googlePayRepository = googlePayRepository;
        S<GooglePayLauncher.Result> s = new S<>();
        this._googleResult = s;
        Q a = q0.a(s);
        Intrinsics.checkNotNullExpressionValue(a, "distinctUntilChanged(this)");
        this.googlePayResult = a;
    }

    public final Object confirmStripeIntent(@NotNull AuthActivityStarterHost authActivityStarterHost, @NotNull PaymentMethodCreateParams paymentMethodCreateParams, @NotNull Kk.c<? super Unit> cVar) {
        ConfirmStripeIntentParams create$default;
        GooglePayLauncherContract.Args args = this.args;
        if (args instanceof GooglePayLauncherContract.PaymentIntentArgs) {
            create$default = ConfirmPaymentIntentParams.Companion.createWithPaymentMethodCreateParams$default(ConfirmPaymentIntentParams.Companion, paymentMethodCreateParams, args.getClientSecret$payments_core_release(), null, null, null, null, null, null, 252, null);
        } else {
            if (!(args instanceof GooglePayLauncherContract.SetupIntentArgs)) {
                throw new NoWhenBranchMatchedException();
            }
            create$default = ConfirmSetupIntentParams.Companion.create$default(ConfirmSetupIntentParams.Companion, paymentMethodCreateParams, args.getClientSecret$payments_core_release(), (MandateDataParams) null, (String) null, 12, (Object) null);
        }
        Object startConfirmAndAuth = this.paymentController.startConfirmAndAuth(authActivityStarterHost, create$default, this.requestOptions, cVar);
        return startConfirmAndAuth == Lk.a.COROUTINE_SUSPENDED ? startConfirmAndAuth : Unit.a;
    }

    public final java.lang.Object createLoadPaymentDataTask(@org.jetbrains.annotations.NotNull Kk.c<? super com.google.android.gms.tasks.Task<com.google.android.gms.wallet.PaymentData>> r7) {
        throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.googlepaylauncher.GooglePayLauncherViewModel.createLoadPaymentDataTask(Kk.c):java.lang.Object");
    }

    public final java.lang.Object createPaymentDataRequest(@org.jetbrains.annotations.NotNull com.stripe.android.googlepaylauncher.GooglePayLauncherContract.Args r15, @org.jetbrains.annotations.NotNull Kk.c<? super org.json.JSONObject> r16) {
        throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.googlepaylauncher.GooglePayLauncherViewModel.createPaymentDataRequest(com.stripe.android.googlepaylauncher.GooglePayLauncherContract$Args, Kk.c):java.lang.Object");
    }

    @NotNull
    public final GooglePayJsonFactory.TransactionInfo createTransactionInfo$payments_core_release(@NotNull StripeIntent stripeIntent, @NotNull String str) {
        Intrinsics.checkNotNullParameter(stripeIntent, "stripeIntent");
        Intrinsics.checkNotNullParameter(str, "currencyCode");
        if (!(stripeIntent instanceof PaymentIntent)) {
            if (stripeIntent instanceof SetupIntent) {
                return new GooglePayJsonFactory.TransactionInfo(str, GooglePayJsonFactory.TransactionInfo.TotalPriceStatus.Estimated, this.args.getConfig$payments_core_release().getMerchantCountryCode(), stripeIntent.getId(), 0, null, GooglePayJsonFactory.TransactionInfo.CheckoutOption.Default, 32, null);
            }
            throw new NoWhenBranchMatchedException();
        }
        GooglePayJsonFactory.TransactionInfo.TotalPriceStatus totalPriceStatus = GooglePayJsonFactory.TransactionInfo.TotalPriceStatus.Final;
        String merchantCountryCode = this.args.getConfig$payments_core_release().getMerchantCountryCode();
        String id = stripeIntent.getId();
        Long amount = ((PaymentIntent) stripeIntent).getAmount();
        return new GooglePayJsonFactory.TransactionInfo(str, totalPriceStatus, merchantCountryCode, id, amount != null ? Integer.valueOf((int) amount.longValue()) : null, null, GooglePayJsonFactory.TransactionInfo.CheckoutOption.CompleteImmediatePurchase, 32, null);
    }

    @NotNull
    public final N<GooglePayLauncher.Result> getGooglePayResult$payments_core_release() {
        return this.googlePayResult;
    }

    public final boolean getHasLaunched() {
        return this.hasLaunched;
    }

    public final java.lang.Object getResultFromConfirmation$payments_core_release(int r6, @org.jetbrains.annotations.NotNull android.content.Intent r7, @org.jetbrains.annotations.NotNull Kk.c<? super com.stripe.android.googlepaylauncher.GooglePayLauncher.Result> r8) {
        throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.googlepaylauncher.GooglePayLauncherViewModel.getResultFromConfirmation$payments_core_release(int, android.content.Intent, Kk.c):java.lang.Object");
    }

    public final Object isReadyToPay(@NotNull Kk.c<? super Boolean> cVar) {
        return h.g(this.googlePayRepository.isReady(), cVar);
    }

    public final void onConfirmResult(int i, @NotNull Intent intent) {
        Intrinsics.checkNotNullParameter(intent, MessageExtension.FIELD_DATA);
        g.b(s0.a(this), (CoroutineContext) null, (J) null, new GooglePayLauncherViewModel$onConfirmResult$1(this, i, intent, null), 3);
    }

    public final void setHasLaunched(boolean z) {
        this.hasLaunched = z;
    }

    public final void updateResult(@NotNull GooglePayLauncher.Result result) {
        Intrinsics.checkNotNullParameter(result, "result");
        this._googleResult.setValue(result);
    }
}