导航菜单

页面标题

页面副标题

Biko v2.0.23 - PaymentFlowActivity.java 源代码

正在查看: Biko v2.0.23 应用的 PaymentFlowActivity.java JAVA 源代码文件

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


package com.stripe.android.view;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.View;
import android.view.ViewGroup;
import androidx.activity.ComponentActivity;
import androidx.activity.OnBackPressedCallback;
import androidx.activity.OnBackPressedDispatcher;
import androidx.activity.OnBackPressedDispatcherKt;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.viewpager.widget.ViewPager;
import com.stripe.android.CustomerSession;
import com.stripe.android.PaymentSessionConfig;
import com.stripe.android.PaymentSessionData;
import com.stripe.android.R;
import com.stripe.android.databinding.StripePaymentFlowActivityBinding;
import com.stripe.android.model.PaymentMethod;
import com.stripe.android.model.ShippingInformation;
import com.stripe.android.model.ShippingMethod;
import com.stripe.android.utils.ActivityUtilsKt;
import com.stripe.android.view.PaymentFlowActivityStarter;
import com.stripe.android.view.PaymentFlowViewModel;
import java.util.List;
import java.util.Set;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart;

@Metadata(d1 = {"\u0000\u0092\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0003\n\u0002\b\u0003\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0007\u0018\u0000 M2\u00020\u0001:\u0001MB\u0005¢\u0006\u0002\u0010\u0002J\u0010\u00100\u001a\u0002012\u0006\u00102\u001a\u000203H\u0002J\b\u00104\u001a\u000205H\u0002J\b\u00106\u001a\u000205H\u0002J\b\u00107\u001a\u000201H\u0016J\u0012\u00108\u001a\u0002012\b\u00109\u001a\u0004\u0018\u00010:H\u0014J\u0010\u0010;\u001a\u0002012\u0006\u0010<\u001a\u00020=H\u0002J'\u0010>\u001a\u0002012\b\u0010?\u001a\u0004\u0018\u00010\u001e2\u000e\b\u0002\u0010@\u001a\b\u0012\u0004\u0012\u00020B0AH\u0000¢\u0006\u0002\bCJ\b\u0010D\u001a\u000201H\u0002J\u0016\u0010E\u001a\u0002012\f\u0010@\u001a\b\u0012\u0004\u0012\u00020B0AH\u0002J\b\u0010F\u001a\u000201H\u0002J\u0016\u0010G\u001a\u0002012\f\u0010@\u001a\b\u0012\u0004\u0012\u00020B0AH\u0002J\"\u0010H\u001a\u0002012\u0006\u0010I\u001a\u00020J2\b\u0010K\u001a\u0004\u0018\u00010L2\u0006\u0010?\u001a\u00020\u001eH\u0002R\u001b\u0010\u0003\u001a\u00020\u00048BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0007\u0010\b\u001a\u0004\b\u0005\u0010\u0006R\u001b\u0010\t\u001a\u00020\n8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\r\u0010\b\u001a\u0004\b\u000b\u0010\fR\u001b\u0010\u000e\u001a\u00020\u000f8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0012\u0010\b\u001a\u0004\b\u0010\u0010\u0011R\u001b\u0010\u0013\u001a\u00020\u00148BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0017\u0010\b\u001a\u0004\b\u0015\u0010\u0016R\u001b\u0010\u0018\u001a\u00020\u00198BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u001c\u0010\b\u001a\u0004\b\u001a\u0010\u001bR\u0016\u0010\u001d\u001a\u0004\u0018\u00010\u001e8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u001f\u0010 R\u001b\u0010!\u001a\u00020\"8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b%\u0010\b\u001a\u0004\b#\u0010$R\u001b\u0010&\u001a\u00020'8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b*\u0010\b\u001a\u0004\b(\u0010)R\u001b\u0010+\u001a\u00020,8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b/\u0010\b\u001a\u0004\b-\u0010.¨\u0006N"}, d2 = {"Lcom/stripe/android/view/PaymentFlowActivity;", "Lcom/stripe/android/view/StripeActivity;", "()V", "args", "Lcom/stripe/android/view/PaymentFlowActivityStarter$Args;", "getArgs", "()Lcom/stripe/android/view/PaymentFlowActivityStarter$Args;", "args$delegate", "Lkotlin/Lazy;", "customerSession", "Lcom/stripe/android/CustomerSession;", "getCustomerSession", "()Lcom/stripe/android/CustomerSession;", "customerSession$delegate", "keyboardController", "Lcom/stripe/android/view/KeyboardController;", "getKeyboardController", "()Lcom/stripe/android/view/KeyboardController;", "keyboardController$delegate", "paymentFlowPagerAdapter", "Lcom/stripe/android/view/PaymentFlowPagerAdapter;", "getPaymentFlowPagerAdapter", "()Lcom/stripe/android/view/PaymentFlowPagerAdapter;", "paymentFlowPagerAdapter$delegate", "paymentSessionConfig", "Lcom/stripe/android/PaymentSessionConfig;", "getPaymentSessionConfig", "()Lcom/stripe/android/PaymentSessionConfig;", "paymentSessionConfig$delegate", "shippingInfo", "Lcom/stripe/android/model/ShippingInformation;", "getShippingInfo", "()Lcom/stripe/android/model/ShippingInformation;", "viewBinding", "Lcom/stripe/android/databinding/StripePaymentFlowActivityBinding;", "getViewBinding", "()Lcom/stripe/android/databinding/StripePaymentFlowActivityBinding;", "viewBinding$delegate", "viewModel", "Lcom/stripe/android/view/PaymentFlowViewModel;", "getViewModel", "()Lcom/stripe/android/view/PaymentFlowViewModel;", "viewModel$delegate", "viewPager", "Lcom/stripe/android/view/PaymentFlowViewPager;", "getViewPager", "()Lcom/stripe/android/view/PaymentFlowViewPager;", "viewPager$delegate", "finishWithData", "", "paymentSessionData", "Lcom/stripe/android/PaymentSessionData;", "hasNextPage", "", "hasPreviousPage", "onActionSave", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onShippingInfoError", "error", "", "onShippingInfoSaved", "shippingInformation", "shippingMethods", "", "Lcom/stripe/android/model/ShippingMethod;", "onShippingInfoSaved$payments_core_release", "onShippingInfoSubmitted", "onShippingInfoValidated", "onShippingMethodSave", "onShippingMethodsReady", "validateShippingInformation", "shippingInfoValidator", "Lcom/stripe/android/PaymentSessionConfig$ShippingInformationValidator;", "shippingMethodsFactory", "Lcom/stripe/android/PaymentSessionConfig$ShippingMethodsFactory;", "Companion", "payments-core_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class PaymentFlowActivity extends StripeActivity {
    public static final String PRODUCT_TOKEN = "PaymentFlowActivity";

    private final Lazy viewModel;
    public static final int $stable = 8;

    private final Lazy viewBinding = LazyKt.lazy(new Function0<StripePaymentFlowActivityBinding>() {
        {
            super(0);
        }

        public final StripePaymentFlowActivityBinding m1007invoke() {
            PaymentFlowActivity.this.getViewStub$payments_core_release().setLayoutResource(R.layout.stripe_payment_flow_activity);
            View inflate = PaymentFlowActivity.this.getViewStub$payments_core_release().inflate();
            Intrinsics.checkNotNull(inflate, "null cannot be cast to non-null type android.view.ViewGroup");
            StripePaymentFlowActivityBinding bind = StripePaymentFlowActivityBinding.bind((ViewGroup) inflate);
            Intrinsics.checkNotNullExpressionValue(bind, "bind(root)");
            return bind;
        }
    });

    private final Lazy viewPager = LazyKt.lazy(new Function0<PaymentFlowViewPager>() {
        {
            super(0);
        }

        public final PaymentFlowViewPager m1009invoke() {
            StripePaymentFlowActivityBinding viewBinding;
            viewBinding = PaymentFlowActivity.this.getViewBinding();
            PaymentFlowViewPager paymentFlowViewPager = viewBinding.shippingFlowViewpager;
            Intrinsics.checkNotNullExpressionValue(paymentFlowViewPager, "viewBinding.shippingFlowViewpager");
            return paymentFlowViewPager;
        }
    });

    private final Lazy customerSession = LazyKt.lazy(new Function0<CustomerSession>() {
        public final CustomerSession m1002invoke() {
            return CustomerSession.Companion.getInstance();
        }
    });

    private final Lazy args = LazyKt.lazy(new Function0<PaymentFlowActivityStarter.Args>() {
        {
            super(0);
        }

        public final PaymentFlowActivityStarter.Args m1001invoke() {
            PaymentFlowActivityStarter.Args.Companion companion = PaymentFlowActivityStarter.Args.INSTANCE;
            Intent intent = PaymentFlowActivity.this.getIntent();
            Intrinsics.checkNotNullExpressionValue(intent, "intent");
            return companion.create(intent);
        }
    });

    private final Lazy paymentSessionConfig = LazyKt.lazy(new Function0<PaymentSessionConfig>() {
        {
            super(0);
        }

        public final PaymentSessionConfig m1006invoke() {
            PaymentFlowActivityStarter.Args args;
            args = PaymentFlowActivity.this.getArgs();
            return args.getPaymentSessionConfig$payments_core_release();
        }
    });

    private final Lazy paymentFlowPagerAdapter = LazyKt.lazy(new Function0<PaymentFlowPagerAdapter>() {
        {
            super(0);
        }

        public final PaymentFlowPagerAdapter m1005invoke() {
            PaymentSessionConfig paymentSessionConfig;
            PaymentSessionConfig paymentSessionConfig2;
            PaymentFlowActivity paymentFlowActivity = PaymentFlowActivity.this;
            Context context = (Context) paymentFlowActivity;
            paymentSessionConfig = paymentFlowActivity.getPaymentSessionConfig();
            paymentSessionConfig2 = PaymentFlowActivity.this.getPaymentSessionConfig();
            Set allowedShippingCountryCodes = paymentSessionConfig2.getAllowedShippingCountryCodes();
            final PaymentFlowActivity paymentFlowActivity2 = PaymentFlowActivity.this;
            return new PaymentFlowPagerAdapter(context, paymentSessionConfig, allowedShippingCountryCodes, new Function1<ShippingMethod, Unit>() {
                {
                    super(1);
                }

                public Object invoke(Object obj) {
                    invoke((ShippingMethod) obj);
                    return Unit.INSTANCE;
                }

                public final void invoke(ShippingMethod shippingMethod) {
                    PaymentFlowViewModel viewModel;
                    Intrinsics.checkNotNullParameter(shippingMethod, "it");
                    viewModel = PaymentFlowActivity.this.getViewModel();
                    viewModel.setSelectedShippingMethod$payments_core_release(shippingMethod);
                }
            });
        }
    });

    private final Lazy keyboardController = LazyKt.lazy(new Function0<KeyboardController>() {
        {
            super(0);
        }

        public final KeyboardController m1003invoke() {
            return new KeyboardController((Activity) PaymentFlowActivity.this);
        }
    });

    public PaymentFlowActivity() {
        final ComponentActivity componentActivity = (ComponentActivity) this;
        final Function0 function0 = null;
        this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(PaymentFlowViewModel.class), new Function0<ViewModelStore>() {
            {
                super(0);
            }

            public final ViewModelStore m999invoke() {
                ViewModelStore viewModelStore = componentActivity.getViewModelStore();
                Intrinsics.checkNotNullExpressionValue(viewModelStore, "viewModelStore");
                return viewModelStore;
            }
        }, new Function0<ViewModelProvider.Factory>() {
            {
                super(0);
            }

            public final ViewModelProvider.Factory m1008invoke() {
                CustomerSession customerSession;
                PaymentFlowActivityStarter.Args args;
                customerSession = PaymentFlowActivity.this.getCustomerSession();
                args = PaymentFlowActivity.this.getArgs();
                return new PaymentFlowViewModel.Factory(customerSession, args.getPaymentSessionData$payments_core_release());
            }
        }, new Function0<CreationExtras>() {
            {
                super(0);
            }

            public final CreationExtras m1000invoke() {
                CreationExtras creationExtras;
                Function0 function02 = function0;
                if (function02 != null && (creationExtras = (CreationExtras) function02.invoke()) != null) {
                    return creationExtras;
                }
                CreationExtras defaultViewModelCreationExtras = componentActivity.getDefaultViewModelCreationExtras();
                Intrinsics.checkNotNullExpressionValue(defaultViewModelCreationExtras, "this.defaultViewModelCreationExtras");
                return defaultViewModelCreationExtras;
            }
        });
    }

    public final StripePaymentFlowActivityBinding getViewBinding() {
        return (StripePaymentFlowActivityBinding) this.viewBinding.getValue();
    }

    public final PaymentFlowViewPager getViewPager() {
        return (PaymentFlowViewPager) this.viewPager.getValue();
    }

    public final CustomerSession getCustomerSession() {
        return (CustomerSession) this.customerSession.getValue();
    }

    public final PaymentFlowActivityStarter.Args getArgs() {
        return (PaymentFlowActivityStarter.Args) this.args.getValue();
    }

    public final PaymentSessionConfig getPaymentSessionConfig() {
        return (PaymentSessionConfig) this.paymentSessionConfig.getValue();
    }

    public final PaymentFlowViewModel getViewModel() {
        return (PaymentFlowViewModel) this.viewModel.getValue();
    }

    public final PaymentFlowPagerAdapter getPaymentFlowPagerAdapter() {
        return (PaymentFlowPagerAdapter) this.paymentFlowPagerAdapter.getValue();
    }

    private final KeyboardController getKeyboardController() {
        return (KeyboardController) this.keyboardController.getValue();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (ActivityUtilsKt.argsAreInvalid((Activity) this, new Function0<Unit>() {
            {
                super(0);
            }

            public Object invoke() {
                m1004invoke();
                return Unit.INSTANCE;
            }

            public final void m1004invoke() {
                PaymentFlowActivity.this.getArgs();
            }
        })) {
            return;
        }
        PaymentFlowActivityStarter.Args.Companion companion = PaymentFlowActivityStarter.Args.INSTANCE;
        Intent intent = getIntent();
        Intrinsics.checkNotNullExpressionValue(intent, "intent");
        Integer windowFlags$payments_core_release = companion.create(intent).getWindowFlags$payments_core_release();
        if (windowFlags$payments_core_release != null) {
            getWindow().addFlags(windowFlags$payments_core_release.intValue());
        }
        ShippingInformation submittedShippingInfo = getViewModel().getSubmittedShippingInfo();
        if (submittedShippingInfo == null) {
            submittedShippingInfo = getPaymentSessionConfig().getPrepopulatedShippingInfo();
        }
        getPaymentFlowPagerAdapter().setShippingMethods$payments_core_release(getViewModel().getShippingMethods$payments_core_release());
        getPaymentFlowPagerAdapter().setShippingInfoSubmitted$payments_core_release(getViewModel().getIsShippingInfoSubmitted());
        getPaymentFlowPagerAdapter().setShippingInformation$payments_core_release(submittedShippingInfo);
        getPaymentFlowPagerAdapter().setSelectedShippingMethod$payments_core_release(getViewModel().getSelectedShippingMethod());
        OnBackPressedDispatcher onBackPressedDispatcher = getOnBackPressedDispatcher();
        Intrinsics.checkNotNullExpressionValue(onBackPressedDispatcher, "onBackPressedDispatcher");
        final OnBackPressedCallback addCallback$default = OnBackPressedDispatcherKt.addCallback$default(onBackPressedDispatcher, (LifecycleOwner) null, false, new Function1<OnBackPressedCallback, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((OnBackPressedCallback) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(OnBackPressedCallback onBackPressedCallback) {
                PaymentFlowViewModel viewModel;
                PaymentFlowViewPager viewPager;
                PaymentFlowViewModel viewModel2;
                Intrinsics.checkNotNullParameter(onBackPressedCallback, "$this$addCallback");
                viewModel = PaymentFlowActivity.this.getViewModel();
                viewModel.setCurrentPage$payments_core_release(viewModel.getCurrentPage() - 1);
                viewPager = PaymentFlowActivity.this.getViewPager();
                viewModel2 = PaymentFlowActivity.this.getViewModel();
                viewPager.setCurrentItem(viewModel2.getCurrentPage());
            }
        }, 3, (Object) null);
        getViewPager().setAdapter(getPaymentFlowPagerAdapter());
        getViewPager().addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            public void onPageScrollStateChanged(int i2) {
            }

            public void onPageScrolled(int i2, float v, int i1) {
            }

            public void onPageSelected(int i2) {
                PaymentFlowPagerAdapter paymentFlowPagerAdapter;
                PaymentFlowPagerAdapter paymentFlowPagerAdapter2;
                boolean hasPreviousPage;
                PaymentFlowViewModel viewModel;
                PaymentFlowPagerAdapter paymentFlowPagerAdapter3;
                PaymentFlowActivity paymentFlowActivity = PaymentFlowActivity.this;
                paymentFlowPagerAdapter = paymentFlowActivity.getPaymentFlowPagerAdapter();
                paymentFlowActivity.setTitle(paymentFlowPagerAdapter.getPageTitle(i2));
                paymentFlowPagerAdapter2 = PaymentFlowActivity.this.getPaymentFlowPagerAdapter();
                if (paymentFlowPagerAdapter2.getPageAt$payments_core_release(i2) == PaymentFlowPage.ShippingInfo) {
                    viewModel = PaymentFlowActivity.this.getViewModel();
                    viewModel.setShippingInfoSubmitted$payments_core_release(false);
                    paymentFlowPagerAdapter3 = PaymentFlowActivity.this.getPaymentFlowPagerAdapter();
                    paymentFlowPagerAdapter3.setShippingInfoSubmitted$payments_core_release(false);
                }
                OnBackPressedCallback onBackPressedCallback = addCallback$default;
                hasPreviousPage = PaymentFlowActivity.this.hasPreviousPage();
                onBackPressedCallback.setEnabled(hasPreviousPage);
            }
        });
        getViewPager().setCurrentItem(getViewModel().getCurrentPage());
        addCallback$default.setEnabled(hasPreviousPage());
        setTitle(getPaymentFlowPagerAdapter().getPageTitle(getViewPager().getCurrentItem()));
    }

    @Override
    public void onActionSave() {
        if (PaymentFlowPage.ShippingInfo == getPaymentFlowPagerAdapter().getPageAt$payments_core_release(getViewPager().getCurrentItem())) {
            onShippingInfoSubmitted();
        } else {
            onShippingMethodSave();
        }
    }

    public static void onShippingInfoSaved$payments_core_release$default(PaymentFlowActivity paymentFlowActivity, ShippingInformation shippingInformation, List list, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            list = CollectionsKt.emptyList();
        }
        paymentFlowActivity.onShippingInfoSaved$payments_core_release(shippingInformation, list);
    }

    public final void onShippingInfoSaved$payments_core_release(ShippingInformation shippingInformation, List shippingMethods) {
        Intrinsics.checkNotNullParameter(shippingMethods, "shippingMethods");
        onShippingMethodsReady(shippingMethods);
        getViewModel().setPaymentSessionData$payments_core_release(PaymentSessionData.copy$default(getViewModel().getPaymentSessionData(), false, false, 0L, 0L, shippingInformation, (ShippingMethod) null, (PaymentMethod) null, false, 239, (Object) null));
    }

    public final void onShippingInfoValidated(List<ShippingMethod> shippingMethods) {
        ShippingInformation shippingInformation = getViewModel().getPaymentSessionData().getShippingInformation();
        if (shippingInformation != null) {
            BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new PaymentFlowActivity$onShippingInfoValidated$1$1(this, shippingInformation, shippingMethods, null), 3, (Object) null);
        }
    }

    private final void onShippingMethodsReady(List<ShippingMethod> shippingMethods) {
        setProgressBarVisible(false);
        getPaymentFlowPagerAdapter().setShippingMethods$payments_core_release(shippingMethods);
        getPaymentFlowPagerAdapter().setShippingInfoSubmitted$payments_core_release(true);
        if (hasNextPage()) {
            PaymentFlowViewModel viewModel = getViewModel();
            viewModel.setCurrentPage$payments_core_release(viewModel.getCurrentPage() + 1);
            getViewPager().setCurrentItem(getViewModel().getCurrentPage());
            return;
        }
        finishWithData(getViewModel().getPaymentSessionData());
    }

    private final void onShippingInfoSubmitted() {
        getKeyboardController().hide();
        ShippingInformation shippingInfo = getShippingInfo();
        if (shippingInfo != null) {
            getViewModel().setPaymentSessionData$payments_core_release(PaymentSessionData.copy$default(getViewModel().getPaymentSessionData(), false, false, 0L, 0L, shippingInfo, (ShippingMethod) null, (PaymentMethod) null, false, 239, (Object) null));
            setProgressBarVisible(true);
            validateShippingInformation(getPaymentSessionConfig().getShippingInformationValidator$payments_core_release(), getPaymentSessionConfig().getShippingMethodsFactory$payments_core_release(), shippingInfo);
        }
    }

    private final ShippingInformation getShippingInfo() {
        return ((ShippingInfoWidget) getViewPager().findViewById(R.id.shipping_info_widget)).getShippingInformation();
    }

    private final boolean hasNextPage() {
        return getViewPager().getCurrentItem() + 1 < getPaymentFlowPagerAdapter().getCount();
    }

    public final boolean hasPreviousPage() {
        return getViewPager().getCurrentItem() != 0;
    }

    private final void onShippingMethodSave() {
        finishWithData(PaymentSessionData.copy$default(getViewModel().getPaymentSessionData(), false, false, 0L, 0L, (ShippingInformation) null, ((SelectShippingMethodWidget) getViewPager().findViewById(R.id.select_shipping_method_widget)).getSelectedShippingMethod(), (PaymentMethod) null, false, 223, (Object) null));
    }

    private final void validateShippingInformation(PaymentSessionConfig.ShippingInformationValidator shippingInfoValidator, PaymentSessionConfig.ShippingMethodsFactory shippingMethodsFactory, ShippingInformation shippingInformation) {
        BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new PaymentFlowActivity$validateShippingInformation$1(this, shippingInfoValidator, shippingMethodsFactory, shippingInformation, null), 3, (Object) null);
    }

    public final void onShippingInfoError(Throwable error) {
        String message = error.getMessage();
        setProgressBarVisible(false);
        String str = message;
        if (!(str == null || str.length() == 0)) {
            showError(message);
        } else {
            String string = getString(R.string.stripe_invalid_shipping_information);
            Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.strip…lid_shipping_information)");
            showError(string);
        }
        getViewModel().setPaymentSessionData$payments_core_release(PaymentSessionData.copy$default(getViewModel().getPaymentSessionData(), false, false, 0L, 0L, (ShippingInformation) null, (ShippingMethod) null, (PaymentMethod) null, false, 239, (Object) null));
    }

    private final void finishWithData(PaymentSessionData paymentSessionData) {
        setResult(-1, new Intent().putExtra("extra_payment_session_data", (Parcelable) paymentSessionData));
        finish();
    }
}