导航菜单

页面标题

页面副标题

Rilo v2.0.21 - ElementsSessionRepositoryKt.java 源代码

正在查看: Rilo v2.0.21 应用的 ElementsSessionRepositoryKt.java JAVA 源代码文件

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


package com.stripe.android.paymentsheet.repositories;

import com.stripe.android.model.DeferredIntentParams;
import com.stripe.android.model.ElementsSessionParams;
import com.stripe.android.model.PaymentIntent;
import com.stripe.android.model.StripeIntent;
import com.stripe.android.paymentsheet.PaymentSheet;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Result;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;

@Metadata(d1 = {"\u0000:\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0003\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\u001aA\u0010\u0000\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0001\"\u0004\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u0002H\u00020\u00012\u0018\u0010\u0003\u001a\u0014\u0012\u0004\u0012\u00020\u0005\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\u00020\u00010\u0004H\u0082\bø\u0001\u0000¢\u0006\u0002\u0010\u0006\u001a\f\u0010\u0007\u001a\u00020\b*\u00020\tH\u0002\u001a\f\u0010\u0007\u001a\u00020\n*\u00020\u000bH\u0002\u001a\f\u0010\u0007\u001a\u00020\f*\u00020\rH\u0002\u001a\f\u0010\u000e\u001a\u00020\u000f*\u00020\u0010H\u0000\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u0011"}, d2 = {"getResultOrElse", "Lkotlin/Result;", "T", "transform", "Lkotlin/Function1;", "", "(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "toElementsSessionParam", "Lcom/stripe/android/model/PaymentIntent$CaptureMethod;", "Lcom/stripe/android/paymentsheet/PaymentSheet$IntentConfiguration$CaptureMethod;", "Lcom/stripe/android/model/DeferredIntentParams$Mode;", "Lcom/stripe/android/paymentsheet/PaymentSheet$IntentConfiguration$Mode;", "Lcom/stripe/android/model/StripeIntent$Usage;", "Lcom/stripe/android/paymentsheet/PaymentSheet$IntentConfiguration$SetupFutureUse;", "toElementsSessionParams", "Lcom/stripe/android/model/ElementsSessionParams;", "Lcom/stripe/android/paymentsheet/PaymentSheet$InitializationMode;", "paymentsheet_release"}, k = 2, mv = {1, 8, 0}, xi = 48)
public final class ElementsSessionRepositoryKt {

    @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
    public class WhenMappings {
        public static final int[] $EnumSwitchMapping$0;
        public static final int[] $EnumSwitchMapping$1;

        static {
            int[] iArr = new int[PaymentSheet.IntentConfiguration.SetupFutureUse.values().length];
            try {
                iArr[PaymentSheet.IntentConfiguration.SetupFutureUse.OnSession.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[PaymentSheet.IntentConfiguration.SetupFutureUse.OffSession.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            $EnumSwitchMapping$0 = iArr;
            int[] iArr2 = new int[PaymentSheet.IntentConfiguration.CaptureMethod.values().length];
            try {
                iArr2[PaymentSheet.IntentConfiguration.CaptureMethod.Automatic.ordinal()] = 1;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                iArr2[PaymentSheet.IntentConfiguration.CaptureMethod.AutomaticAsync.ordinal()] = 2;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                iArr2[PaymentSheet.IntentConfiguration.CaptureMethod.Manual.ordinal()] = 3;
            } catch (NoSuchFieldError unused5) {
            }
            $EnumSwitchMapping$1 = iArr2;
        }
    }

    public static final ElementsSessionParams toElementsSessionParams(PaymentSheet.InitializationMode initializationMode) {
        Intrinsics.checkNotNullParameter(initializationMode, "<this>");
        if (initializationMode instanceof PaymentSheet.InitializationMode.PaymentIntent) {
            return new ElementsSessionParams.PaymentIntentType(((PaymentSheet.InitializationMode.PaymentIntent) initializationMode).getClientSecret(), null, 2, null);
        }
        if (initializationMode instanceof PaymentSheet.InitializationMode.SetupIntent) {
            return new ElementsSessionParams.SetupIntentType(((PaymentSheet.InitializationMode.SetupIntent) initializationMode).getClientSecret(), null, 2, null);
        }
        if (!(initializationMode instanceof PaymentSheet.InitializationMode.DeferredIntent)) {
            throw new NoWhenBranchMatchedException();
        }
        PaymentSheet.InitializationMode.DeferredIntent deferredIntent = (PaymentSheet.InitializationMode.DeferredIntent) initializationMode;
        return new ElementsSessionParams.DeferredIntentType(null, new DeferredIntentParams(toElementsSessionParam(deferredIntent.getIntentConfiguration().getMode()), deferredIntent.getIntentConfiguration().getPaymentMethodTypes(), deferredIntent.getIntentConfiguration().getOnBehalfOf()), 1, null);
    }

    private static final DeferredIntentParams.Mode toElementsSessionParam(PaymentSheet.IntentConfiguration.Mode mode) {
        if (mode instanceof PaymentSheet.IntentConfiguration.Mode.Payment) {
            PaymentSheet.IntentConfiguration.Mode.Payment payment = (PaymentSheet.IntentConfiguration.Mode.Payment) mode;
            long amount = payment.getAmount();
            String currency = payment.getCurrency();
            PaymentSheet.IntentConfiguration.SetupFutureUse setupFutureUse = mode.getSetupFutureUse();
            return new DeferredIntentParams.Mode.Payment(amount, currency, setupFutureUse != null ? toElementsSessionParam(setupFutureUse) : null, toElementsSessionParam(payment.getCaptureMethod()));
        }
        if (!(mode instanceof PaymentSheet.IntentConfiguration.Mode.Setup)) {
            throw new NoWhenBranchMatchedException();
        }
        PaymentSheet.IntentConfiguration.Mode.Setup setup = (PaymentSheet.IntentConfiguration.Mode.Setup) mode;
        return new DeferredIntentParams.Mode.Setup(setup.getCurrency(), toElementsSessionParam(setup.getSetupFutureUse()));
    }

    private static final StripeIntent.Usage toElementsSessionParam(PaymentSheet.IntentConfiguration.SetupFutureUse setupFutureUse) {
        int i2 = WhenMappings.$EnumSwitchMapping$0[setupFutureUse.ordinal()];
        if (i2 == 1) {
            return StripeIntent.Usage.OnSession;
        }
        if (i2 == 2) {
            return StripeIntent.Usage.OffSession;
        }
        throw new NoWhenBranchMatchedException();
    }

    private static final PaymentIntent.CaptureMethod toElementsSessionParam(PaymentSheet.IntentConfiguration.CaptureMethod captureMethod) {
        int i2 = WhenMappings.$EnumSwitchMapping$1[captureMethod.ordinal()];
        if (i2 == 1) {
            return PaymentIntent.CaptureMethod.Automatic;
        }
        if (i2 == 2) {
            return PaymentIntent.CaptureMethod.AutomaticAsync;
        }
        if (i2 == 3) {
            return PaymentIntent.CaptureMethod.Manual;
        }
        throw new NoWhenBranchMatchedException();
    }

    private static final <T> Object getResultOrElse(Object obj, Function1<? super Throwable, ? extends Result<? extends T>> function1) {
        Throwable m1550exceptionOrNullimpl = Result.m1550exceptionOrNullimpl(obj);
        return m1550exceptionOrNullimpl != null ? ((Result) function1.invoke(m1550exceptionOrNullimpl)).getValue() : obj;
    }
}