导航菜单

页面标题

页面副标题

Crafto v9.3.3 - SupportedPaymentMethodKtxKt.java 源代码

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

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


package com.stripe.android.paymentsheet.model;

import com.stripe.android.model.Address;
import com.stripe.android.model.PaymentIntent;
import com.stripe.android.model.StripeIntent;
import com.stripe.android.paymentsheet.PaymentSheet;
import com.stripe.android.paymentsheet.forms.Delayed;
import com.stripe.android.paymentsheet.forms.PIRequirement;
import com.stripe.android.paymentsheet.forms.SIRequirement;
import com.stripe.android.paymentsheet.forms.ShippingAddress;
import com.stripe.android.ui.core.elements.LayoutFormDescriptor;
import com.stripe.android.ui.core.forms.resources.LpmRepository;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.collections.F;
import kotlin.collections.u;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;

@Metadata
public final class SupportedPaymentMethodKtxKt {
    private static final boolean checkPaymentIntentRequirements(Set<? extends PIRequirement> set, PaymentIntent paymentIntent, PaymentSheet.Configuration configuration) {
        Address address;
        Address address2;
        Address address3;
        if (set == null) {
            return false;
        }
        Set<? extends PIRequirement> set2 = set;
        ArrayList arrayList = new ArrayList(u.n(set2, 10));
        Iterator<T> it = set2.iterator();
        while (true) {
            boolean z = true;
            if (!it.hasNext()) {
                return !arrayList.contains(Boolean.FALSE);
            }
            PIRequirement pIRequirement = (PIRequirement) it.next();
            if (Intrinsics.areEqual(pIRequirement, Delayed.INSTANCE)) {
                if (configuration != null && configuration.getAllowsDelayedPaymentMethods()) {
                }
                z = false;
            } else {
                if (!Intrinsics.areEqual(pIRequirement, ShippingAddress.INSTANCE)) {
                    throw new NoWhenBranchMatchedException();
                }
                PaymentIntent.Shipping shipping = paymentIntent.getShipping();
                String str = null;
                if ((shipping != null ? shipping.getName() : null) != null) {
                    PaymentIntent.Shipping shipping2 = paymentIntent.getShipping();
                    if (((shipping2 == null || (address3 = shipping2.getAddress()) == null) ? null : address3.getLine1()) != null) {
                        PaymentIntent.Shipping shipping3 = paymentIntent.getShipping();
                        if (((shipping3 == null || (address2 = shipping3.getAddress()) == null) ? null : address2.getCountry()) != null) {
                            PaymentIntent.Shipping shipping4 = paymentIntent.getShipping();
                            if (shipping4 != null && (address = shipping4.getAddress()) != null) {
                                str = address.getPostalCode();
                            }
                            if (str != null) {
                            }
                        }
                    }
                }
                z = false;
            }
            arrayList.add(Boolean.valueOf(z));
        }
    }

    private static final boolean checkSetupIntentRequirements(Set<? extends SIRequirement> set, PaymentSheet.Configuration configuration) {
        if (set == null) {
            return false;
        }
        Set<? extends SIRequirement> set2 = set;
        ArrayList arrayList = new ArrayList(u.n(set2, 10));
        Iterator<T> it = set2.iterator();
        while (true) {
            boolean z = true;
            if (!it.hasNext()) {
                return !arrayList.contains(Boolean.FALSE);
            }
            if (!Intrinsics.areEqual((SIRequirement) it.next(), Delayed.INSTANCE)) {
                throw new NoWhenBranchMatchedException();
            }
            if (configuration == null || !configuration.getAllowsDelayedPaymentMethods()) {
                z = false;
            }
            arrayList.add(Boolean.valueOf(z));
        }
    }

    @NotNull
    public static final LayoutFormDescriptor getPMAddForm(@NotNull LpmRepository.SupportedPaymentMethod supportedPaymentMethod, @NotNull StripeIntent stripeIntent, PaymentSheet.Configuration configuration) {
        Intrinsics.checkNotNullParameter(supportedPaymentMethod, "<this>");
        Intrinsics.checkNotNullParameter(stripeIntent, "stripeIntent");
        LayoutFormDescriptor specWithFullfilledRequirements = getSpecWithFullfilledRequirements(supportedPaymentMethod, stripeIntent, configuration);
        if (specWithFullfilledRequirements != null) {
            return specWithFullfilledRequirements;
        }
        throw new IllegalArgumentException("Required value was null.".toString());
    }

    @NotNull
    public static final List<LpmRepository.SupportedPaymentMethod> getPMsToAdd(StripeIntent stripeIntent, PaymentSheet.Configuration configuration, @NotNull LpmRepository lpmRepository) {
        List<String> paymentMethodTypes;
        Intrinsics.checkNotNullParameter(lpmRepository, "lpmRepository");
        if (stripeIntent == null || (paymentMethodTypes = stripeIntent.getPaymentMethodTypes()) == null) {
            return F.a;
        }
        ArrayList arrayList = new ArrayList();
        Iterator<T> it = paymentMethodTypes.iterator();
        while (it.hasNext()) {
            LpmRepository.SupportedPaymentMethod fromCode = lpmRepository.fromCode((String) it.next());
            if (fromCode != null) {
                arrayList.add(fromCode);
            }
        }
        ArrayList arrayList2 = new ArrayList();
        for (Object obj : arrayList) {
            if (getSpecWithFullfilledRequirements((LpmRepository.SupportedPaymentMethod) obj, stripeIntent, configuration) != null) {
                arrayList2.add(obj);
            }
        }
        ArrayList arrayList3 = new ArrayList();
        for (Object obj2 : arrayList2) {
            LpmRepository.SupportedPaymentMethod supportedPaymentMethod = (LpmRepository.SupportedPaymentMethod) obj2;
            if (!stripeIntent.isLiveMode() || !stripeIntent.getUnactivatedPaymentMethods().contains(supportedPaymentMethod.getCode())) {
                arrayList3.add(obj2);
            }
        }
        return arrayList3;
    }

    public static final com.stripe.android.ui.core.elements.LayoutFormDescriptor getSpecWithFullfilledRequirements(@org.jetbrains.annotations.NotNull com.stripe.android.ui.core.forms.resources.LpmRepository.SupportedPaymentMethod r6, @org.jetbrains.annotations.NotNull com.stripe.android.model.StripeIntent r7, com.stripe.android.paymentsheet.PaymentSheet.Configuration r8) {
        throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.paymentsheet.model.SupportedPaymentMethodKtxKt.getSpecWithFullfilledRequirements(com.stripe.android.ui.core.forms.resources.LpmRepository$SupportedPaymentMethod, com.stripe.android.model.StripeIntent, com.stripe.android.paymentsheet.PaymentSheet$Configuration):com.stripe.android.ui.core.elements.LayoutFormDescriptor");
    }

    @NotNull
    public static final List<LpmRepository.SupportedPaymentMethod> getSupportedSavedCustomerPMs(StripeIntent stripeIntent, PaymentSheet.Configuration configuration, @NotNull LpmRepository lpmRepository) {
        List<String> paymentMethodTypes;
        Intrinsics.checkNotNullParameter(lpmRepository, "lpmRepository");
        if (stripeIntent == null || (paymentMethodTypes = stripeIntent.getPaymentMethodTypes()) == null) {
            return F.a;
        }
        ArrayList arrayList = new ArrayList();
        Iterator<T> it = paymentMethodTypes.iterator();
        while (it.hasNext()) {
            LpmRepository.SupportedPaymentMethod fromCode = lpmRepository.fromCode((String) it.next());
            if (fromCode != null) {
                arrayList.add(fromCode);
            }
        }
        ArrayList arrayList2 = new ArrayList();
        for (Object obj : arrayList) {
            LpmRepository.SupportedPaymentMethod supportedPaymentMethod = (LpmRepository.SupportedPaymentMethod) obj;
            if (supportedPaymentMethod.supportsCustomerSavedPM() && getSpecWithFullfilledRequirements(supportedPaymentMethod, stripeIntent, configuration) != null) {
                arrayList2.add(obj);
            }
        }
        return arrayList2;
    }

    private static final boolean supportsPaymentIntentSfuNotSettable(LpmRepository.SupportedPaymentMethod supportedPaymentMethod, PaymentIntent paymentIntent, PaymentSheet.Configuration configuration) {
        return checkPaymentIntentRequirements(supportedPaymentMethod.getRequirement().getPiRequirements(), paymentIntent, configuration);
    }

    private static final boolean supportsPaymentIntentSfuSet(LpmRepository.SupportedPaymentMethod supportedPaymentMethod, PaymentIntent paymentIntent, PaymentSheet.Configuration configuration) {
        return supportedPaymentMethod.getRequirement().getConfirmPMFromCustomer(supportedPaymentMethod.getCode()) && checkSetupIntentRequirements(supportedPaymentMethod.getRequirement().getSiRequirements(), configuration) && checkPaymentIntentRequirements(supportedPaymentMethod.getRequirement().getPiRequirements(), paymentIntent, configuration);
    }

    private static final boolean supportsPaymentIntentSfuSettable(LpmRepository.SupportedPaymentMethod supportedPaymentMethod, PaymentIntent paymentIntent, PaymentSheet.Configuration configuration) {
        return (configuration != null ? configuration.getCustomer() : null) != null && supportedPaymentMethod.getRequirement().getConfirmPMFromCustomer(supportedPaymentMethod.getCode()) && checkPaymentIntentRequirements(supportedPaymentMethod.getRequirement().getPiRequirements(), paymentIntent, configuration) && checkSetupIntentRequirements(supportedPaymentMethod.getRequirement().getSiRequirements(), configuration);
    }

    private static final boolean supportsSetupIntent(LpmRepository.SupportedPaymentMethod supportedPaymentMethod, PaymentSheet.Configuration configuration) {
        return supportedPaymentMethod.getRequirement().getConfirmPMFromCustomer(supportedPaymentMethod.getCode()) && checkSetupIntentRequirements(supportedPaymentMethod.getRequirement().getSiRequirements(), configuration);
    }
}