导航菜单

页面标题

页面副标题

Crafto v9.3.3 - StripeIntentValidator.java 源代码

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

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


package com.stripe.android.paymentsheet.model;

import com.stripe.android.model.PaymentIntent;
import com.stripe.android.model.SetupIntent;
import com.stripe.android.model.StripeIntent;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.j;

@Metadata
public final class StripeIntentValidator {
    public final StripeIntent requireValid(StripeIntent stripeIntent) {
        Intrinsics.checkNotNullParameter(stripeIntent, "stripeIntent");
        boolean z = stripeIntent instanceof PaymentIntent;
        if (z) {
            PaymentIntent paymentIntent = (PaymentIntent) stripeIntent;
            if (paymentIntent.getConfirmationMethod() != PaymentIntent.ConfirmationMethod.Automatic) {
                throw new IllegalStateException(j.b("\n                        PaymentIntent with confirmation_method='automatic' is required.\n                        The current PaymentIntent has confirmation_method '" + paymentIntent.getConfirmationMethod() + "'.\n                        See https://stripe.com/docs/api/payment_intents/object#payment_intent_object-confirmation_method.\n                    ").toString());
            }
        }
        if (z && (stripeIntent.getStatus() == StripeIntent.Status.Canceled || stripeIntent.getStatus() == StripeIntent.Status.Succeeded || stripeIntent.getStatus() == StripeIntent.Status.RequiresCapture)) {
            throw new IllegalStateException(j.b("\n                        PaymentSheet cannot set up a PaymentIntent in status '" + stripeIntent.getStatus() + "'.\n                        See https://stripe.com/docs/api/payment_intents/object#payment_intent_object-status.\n                    ").toString());
        }
        if (!(stripeIntent instanceof SetupIntent) || (stripeIntent.getStatus() != StripeIntent.Status.Canceled && stripeIntent.getStatus() != StripeIntent.Status.Succeeded)) {
            return stripeIntent;
        }
        throw new IllegalStateException(j.b("\n                        PaymentSheet cannot set up a SetupIntent in status '" + stripeIntent.getStatus() + "'.\n                        See https://stripe.com/docs/api/setup_intents/object#setup_intent_object-status\n                    ").toString());
    }
}