导航菜单

页面标题

页面副标题

BodyTech v7.6.4 - o1.java 源代码

正在查看: BodyTech v7.6.4 应用的 o1.java JAVA 源代码文件

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


package s2;

import android.os.Handler;
import c2.MetricValue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.mindbodyonline.android.api.sales.model.HttpResponseMessage;
import com.mindbodyonline.android.api.sales.model.enums.CServiceCategoryType;
import com.mindbodyonline.android.api.sales.model.payments.BillingInfoItem;
import com.mindbodyonline.android.api.sales.model.payments.CartPaymentItem;
import com.mindbodyonline.android.api.sales.model.payments.PaymentConfiguration;
import com.mindbodyonline.android.api.sales.model.payments.PaymentMethod;
import com.mindbodyonline.android.api.sales.model.payments.PaymentProcessingFailure;
import com.mindbodyonline.android.api.sales.model.pos.AddPackageToCartRequest;
import com.mindbodyonline.android.api.sales.model.pos.ConsumerCheckoutRequest;
import com.mindbodyonline.android.api.sales.model.pos.ODataFilters;
import com.mindbodyonline.android.api.sales.model.pos.ODataOrderBy;
import com.mindbodyonline.android.api.sales.model.pos.cart.Cart;
import com.mindbodyonline.android.api.sales.model.pos.cart.CartAbandonReason;
import com.mindbodyonline.android.api.sales.model.pos.cart.CartDiscountItem;
import com.mindbodyonline.android.api.sales.model.pos.cart.CartState;
import com.mindbodyonline.android.api.sales.model.pos.catalog.AppointmentSearchDefinition;
import com.mindbodyonline.android.api.sales.model.pos.catalog.CatalogFeedResponse;
import com.mindbodyonline.android.api.sales.model.pos.catalog.CatalogItem;
import com.mindbodyonline.android.api.sales.model.pos.catalog.CatalogItemOrPackageContainer;
import com.mindbodyonline.android.api.sales.model.pos.odata.FilterGrouping;
import com.mindbodyonline.android.api.sales.model.pos.odata.FilterPair;
import com.mindbodyonline.android.api.sales.model.pos.packages.CartPackage;
import com.mindbodyonline.android.api.sales.model.pos.packages.CatalogFeedReference;
import com.mindbodyonline.android.api.sales.model.pos.packages.CatalogPackage;
import com.mindbodyonline.android.util.TaskCallback;
import com.mindbodyonline.connect.utils.POSPaymentUtils;
import com.mindbodyonline.domain.ClassTypeObject;
import com.mindbodyonline.domain.Enrollment;
import com.mindbodyonline.domain.EnrollmentSchedule;
import com.mindbodyonline.domain.EnrollmentScheduleKt;
import com.mindbodyonline.domain.ProgramType;
import com.mindbodyonline.domain.WorldRegionCountry;
import com.mindbodyonline.domain.pos.util.CartItemUtil;
import j$.time.LocalDateTime;
import j$.time.format.DateTimeFormatter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import kotlin.Lazy;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import org.koin.core.Application;
import org.koin.core.core.data.remote.model.Gym;
import org.koin.core.core.data.remote.model.GymSettings;
import org.koin.core.core.data.remote.model.ServiceCategory;
import org.koin.core.core.feature.analytics.metrics.AdditionalValuesKeys;
import org.koin.core.core.feature.analytics.metrics.MetricsName;
import org.koin.core.core.flags.DevelopmentFlags;
import org.koin.core.feature.book.presentation.viewmodel.POSViewModel;
import org.koin.core.feature.checkout.CartServiceType;
import org.koin.core.feature.location.domain.interactor.GetSelectedLocationSubscriberId;
import org.koin.core.model.Appointment;
import org.koin.core.model.ClassSchedule;
import org.koin.core.model.GetClientsResponse;
import org.koin.core.model.enums.CatalogFeedItemPackageSortOrder;
import org.koin.core.util.POSCache;
import org.koin.core.util.p0;
import org.koin.java.KoinJavaComponent;

public class o1 extends p1 {

    private static final Lazy<org.koin.core.feature.familyaccounts.domain.interactor.a> f3615o = KoinJavaComponent.e(org.koin.core.feature.familyaccounts.domain.interactor.a.class);
    private n6.i a;
    private ArrayList<CatalogItemOrPackageContainer> b = new ArrayList<>();
    private ServiceCategory[] c;
    private CatalogFeedResponse d;
    private Calendar e;
    private String f;
    private e g;
    private c h;
    private b i;

    private f f3616j;

    private d f3617k;

    private g f3618l;

    private boolean f3619m;

    private POSViewModel f3620n;

    static class a {
        static final int[] a;

        static {
            int[] iArr = new int[CartState.values().length];
            a = iArr;
            try {
                iArr[CartState.Finalized.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[CartState.Created.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[CartState.Creating.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[CartState.Locked.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                a[CartState.OrderCreated.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                a[CartState.PaymentAuthenticationRequired.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                a[CartState.PaymentAuthenticationFailed.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                a[CartState.OrderProcessingFailed.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                a[CartState.Abandoned.ordinal()] = 9;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                a[CartState.Active.ordinal()] = 10;
            } catch (NoSuchFieldError unused10) {
            }
        }
    }

    public interface b {
        void f(Cart cart);

        void k(Exception exc);

        void l(Exception exc);

        void m();
    }

    public interface c {
        void a(Exception exc);

        void d();

        void h();

        void o(String str);
    }

    public interface d {
        void g(List<WorldRegionCountry> list, int i);

        void n(Exception exc);
    }

    public interface e extends h {
        void g(ServiceCategory serviceCategory, List<CatalogItemOrPackageContainer> list);
    }

    public interface f {
        void e(Exception exc);

        void i(PaymentConfiguration paymentConfiguration);
    }

    public interface g {
        void b(Exception exc);

        void j(PaymentMethod paymentMethod, String str);
    }

    public interface h {
        void n(Exception exc);
    }

    public o1() {
    }

    public static void B0(df.a aVar, Response.Listener listener, CatalogFeedResponse catalogFeedResponse) {
        if (catalogFeedResponse.requestPending()) {
            aVar.d();
        } else {
            listener.onResponse(catalogFeedResponse);
        }
    }

    public void D0(HttpResponseMessage httpResponseMessage) {
        this.f3619m = false;
        new Handler().postDelayed(new Runnable() {
            @Override
            public final void run() {
                o1.this.C0();
            }
        }, 500L);
    }

    public void E0(VolleyError volleyError) {
        c cVar = this.h;
        if (cVar != null) {
            cVar.a(volleyError);
        }
    }

    public Unit F0(String str, String str2, Long l8) {
        je.a.x(l8.intValue(), str, new ConsumerCheckoutRequest((Integer) null, Boolean.TRUE, str2, l8.toString()), new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.D0((HttpResponseMessage) obj);
            }
        }, new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.E0(volleyError);
            }
        });
        return Unit.a;
    }

    public Unit G0(Exception exc) {
        mo.a.f(exc);
        this.h.a(exc);
        return Unit.a;
    }

    public void H0(List list) {
        if (this.f3617k != null) {
            this.f3617k.g(list, qf.d.A(list));
        }
    }

    public void I0(VolleyError volleyError) {
        d dVar = this.f3617k;
        if (dVar != null) {
            dVar.n(volleyError);
        }
    }

    public void J0(String str, PaymentMethod paymentMethod) {
        g gVar = this.f3618l;
        if (gVar != null) {
            gVar.j(paymentMethod, str);
        }
    }

    public void K0(VolleyError volleyError) {
        g gVar = this.f3618l;
        if (gVar != null) {
            gVar.b(volleyError);
        }
    }

    public void L0(Cart cart) {
        b bVar = this.i;
        if (bVar != null) {
            bVar.f(cart);
        }
    }

    public void M0(VolleyError volleyError) {
        b bVar = this.i;
        if (bVar != null) {
            bVar.k(volleyError);
        }
    }

    public void N0(VolleyError volleyError) {
        this.a = null;
        c cVar = this.h;
        if (cVar != null) {
            cVar.h();
        }
    }

    public void O0(h1.a aVar, GetClientsResponse getClientsResponse) {
        this.a = null;
        aVar.x(getClientsResponse.getClient().getUniqueId());
        c cVar = this.h;
        if (cVar != null) {
            cVar.h();
        }
    }

    public void P0(PaymentConfiguration paymentConfiguration, BillingInfoItem[] billingInfoItemArr) {
        paymentConfiguration.assignBillingInfoItemIds(billingInfoItemArr);
        f fVar = this.f3616j;
        if (fVar != null) {
            fVar.i(paymentConfiguration);
        }
    }

    public void Q0(VolleyError volleyError) {
        f fVar = this.f3616j;
        if (fVar != null) {
            fVar.e(volleyError);
        }
    }

    public void R0(final PaymentConfiguration paymentConfiguration) {
        qf.f.n().s().c(new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.P0(paymentConfiguration, (BillingInfoItem[]) obj);
            }
        }, new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.Q0(volleyError);
            }
        });
    }

    public void S0(VolleyError volleyError) {
        f fVar = this.f3616j;
        if (fVar != null) {
            fVar.e(volleyError);
        }
    }

    public void U0(Cart cart) {
        if (cart == null) {
            c cVar = this.h;
            if (cVar != null) {
                cVar.a(new VolleyError("Null cart returned"));
            }
            return;
        }
        CartState state = cart.getState();
        if (state == null) {
            c cVar2 = this.h;
            if (cVar2 != null) {
                cVar2.a(new VolleyError("Cart State is [null]"));
                return;
            }
            return;
        }
        mo.a.d("State of cart: %s (%d)", new Object[]{state.name(), Integer.valueOf(cart.getState().ordinal())});
        switch (a.a[state.ordinal()]) {
            case 1:
            case 2:
            case 3:
                s0();
                break;
            case 4:
            case 5:
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        o1.this.T0();
                    }
                }, 500L);
                break;
            case 6:
                for (PaymentProcessingFailure paymentProcessingFailure : cart.getPaymentProcessingFailures().values()) {
                    if (this.h != null && paymentProcessingFailure.getAuthenticationRedirectUrl() != null) {
                        this.h.o(paymentProcessingFailure.getAuthenticationRedirectUrl());
                        break;
                    }
                }
                break;
            case 7:
                c cVar3 = this.h;
                if (cVar3 != null) {
                    cVar3.d();
                    break;
                }
                break;
            default:
                c cVar4 = this.h;
                if (cVar4 != null) {
                    cVar4.a(new VolleyError("Cart state: " + cart.getState().toString()));
                    break;
                }
                break;
        }
    }

    public void V0(VolleyError volleyError) {
        c cVar = this.h;
        if (cVar != null) {
            cVar.a(volleyError);
        }
    }

    public void W0(Void r12) {
        b bVar = this.i;
        if (bVar != null) {
            bVar.m();
        }
    }

    public void X0(VolleyError volleyError) {
        b bVar = this.i;
        if (bVar != null) {
            bVar.k(volleyError);
        }
    }

    public void Y0(ServiceCategory serviceCategory, CatalogFeedResponse catalogFeedResponse) {
        this.d = catalogFeedResponse;
        if (catalogFeedResponse.getExpirationDate() != null) {
            this.e = catalogFeedResponse.getExpirationDate();
        }
        if (catalogFeedResponse.getCatalogFeedId() != null) {
            this.f = catalogFeedResponse.getCatalogFeedId();
        }
        f0(CartItemUtil.getListFromCatalogFeedResponse(catalogFeedResponse), serviceCategory, false);
    }

    public void Z0(VolleyError volleyError) {
        if (u0() != null) {
            u0().n(volleyError);
        }
    }

    public Unit a1(final ServiceCategory serviceCategory, String str, ODataFilters oDataFilters, Long l8) {
        Response.Listener listener = new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.Y0(serviceCategory, (CatalogFeedResponse) obj);
            }
        };
        Response.ErrorListener errorListener = new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.Z0(volleyError);
            }
        };
        if (this.d == null || !this.e.after(Calendar.getInstance())) {
            je.a.n(l8.intValue(), str, oDataFilters, (ODataOrderBy) null, 0, 50, listener, errorListener);
        } else {
            je.a.w(l8.intValue(), str, this.f, this.d.getSkip() + 50, 50, listener, errorListener);
        }
        return Unit.a;
    }

    public Unit b1(Exception exc) {
        if (u0() != null) {
            u0().n(exc);
        }
        return Unit.a;
    }

    public void c1(VolleyError volleyError) {
        if (u0() != null) {
            u0().n(volleyError);
        }
    }

    public void d1(CatalogFeedReference catalogFeedReference, ServiceCategory serviceCategory, CatalogFeedResponse catalogFeedResponse) {
        if (catalogFeedResponse != null) {
            catalogFeedResponse.setCatalogFeedId(catalogFeedReference.getCatalogFeedId());
            catalogFeedResponse.setExpirationTime(catalogFeedReference.getExpiresIn(), 30);
        }
        f0(CartItemUtil.getListFromCatalogFeedResponse(catalogFeedResponse), serviceCategory, false);
    }

    public void e1(df.a aVar, int i, final CatalogFeedReference catalogFeedReference, final ServiceCategory serviceCategory, Response.ErrorListener errorListener) {
        j0(aVar, i, catalogFeedReference.getCatalogFeedId(), new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.d1(catalogFeedReference, serviceCategory, (CatalogFeedResponse) obj);
            }
        }, errorListener);
    }

    private void f0(List<CatalogItemOrPackageContainer> list, ServiceCategory serviceCategory, boolean z7) {
        GymSettings i = Application.d().c().i();
        Collections.sort(list, CatalogFeedItemPackageSortOrder.DEALS_FIRST.getComparator((i == null ? CatalogFeedItemPackageSortOrder.PRICE_ASC : okhttp3.h.a(i)).getComparator()));
        for (CatalogItemOrPackageContainer catalogItemOrPackageContainer : list) {
            if (catalogItemOrPackageContainer.getPackage() != null) {
                if (!z7 || !catalogItemOrPackageContainer.getPackage().isContract()) {
                    if (!catalogItemOrPackageContainer.getPackage().isContract()) {
                    }
                }
            }
            this.b.add(catalogItemOrPackageContainer);
        }
        if (u0() != null) {
            u0().g(serviceCategory, this.b);
        }
    }

    public void f1(final int i, final ServiceCategory serviceCategory, final Response.ErrorListener errorListener, final CatalogFeedReference catalogFeedReference) {
        final df.a aVar = new df.a();
        aVar.a(new Runnable() {
            @Override
            public final void run() {
                o1.this.e1(aVar, i, catalogFeedReference, serviceCategory, errorListener);
            }
        });
        aVar.e();
    }

    private MetricValue g0(MetricsName metricsName, boolean z7, boolean z8) {
        MetricValue e8 = c2.c.a.e(System.currentTimeMillis(), metricsName);
        if (e8 == null) {
            return null;
        }
        e8.a(AdditionalValuesKeys.IS_CART_REFACTORED.getKey(), Boolean.FALSE);
        e8.a(AdditionalValuesKeys.CART_SERVICE_TYPE.getKey(), CartServiceType.CONNECT.name());
        if (metricsName != MetricsName.ADD_GC || metricsName != MetricsName.ADD_PROMO_CODE) {
            e8.a(AdditionalValuesKeys.CHECKOUT_TYPE.getKey(), z7 ? "Appointment" : z8 ? "Enrollment" : "Class");
        }
        return e8;
    }

    public void g1(VolleyError volleyError) {
        if (u0() != null) {
            u0().n(volleyError);
        }
    }

    private void h0(String str, int i, String str2) {
        je.a.f(i, str2, str, new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.x0((CartDiscountItem) obj);
            }
        }, new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.y0(volleyError);
            }
        });
    }

    public void h1(CatalogFeedReference catalogFeedReference, ServiceCategory serviceCategory, CServiceCategoryType cServiceCategoryType, CatalogFeedResponse catalogFeedResponse) {
        if (catalogFeedResponse != null) {
            catalogFeedResponse.setCatalogFeedId(catalogFeedReference.getCatalogFeedId());
            catalogFeedResponse.setExpirationTime(catalogFeedReference.getExpiresIn(), 30);
        }
        f0(CartItemUtil.getListFromCatalogFeedResponse(catalogFeedResponse), serviceCategory, cServiceCategoryType == CServiceCategoryType.Enrollment);
    }

    public void i1(df.a aVar, int i, final CatalogFeedReference catalogFeedReference, final ServiceCategory serviceCategory, final CServiceCategoryType cServiceCategoryType, Response.ErrorListener errorListener) {
        j0(aVar, i, catalogFeedReference.getCatalogFeedId(), new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.h1(catalogFeedReference, serviceCategory, cServiceCategoryType, (CatalogFeedResponse) obj);
            }
        }, errorListener);
    }

    private static ff.c<CatalogFeedResponse> j0(final df.a aVar, int i, String str, final Response.Listener<CatalogFeedResponse> listener, Response.ErrorListener errorListener) {
        return je.a.w(i, ((org.koin.core.feature.familyaccounts.domain.interactor.a) f3615o.getValue()).a(), str, 0, 50, new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.B0(aVar, listener, (CatalogFeedResponse) obj);
            }
        }, errorListener);
    }

    public void j1(final int i, final ServiceCategory serviceCategory, final CServiceCategoryType cServiceCategoryType, final Response.ErrorListener errorListener, final CatalogFeedReference catalogFeedReference) {
        final df.a aVar = new df.a();
        aVar.a(new Runnable() {
            @Override
            public final void run() {
                o1.this.i1(aVar, i, catalogFeedReference, serviceCategory, cServiceCategoryType, errorListener);
            }
        });
        aVar.e();
    }

    public static Unit k1(String str) {
        return Unit.a;
    }

    public Unit l1(List list) {
        if (!list.isEmpty()) {
            Enrollment enrollment = new Enrollment();
            enrollment.setId(org.koin.core.util.u0.d(((EnrollmentSchedule) list.get(0)).getClassInstanceId()));
            B1(enrollment, Integer.valueOf(list.size()));
        }
        return Unit.a;
    }

    public Unit m1(CatalogItem catalogItem, org.koin.core.util.p0 p0Var, int i, String str, List list) {
        p0Var.c(je.a.b(i, str, Integer.parseInt(catalogItem.getId()), Integer.valueOf(v0(EnrollmentScheduleKt.getActiveCount(list), catalogItem.getSessionCount())), p0Var.f(), p0Var.e()));
        return Unit.a;
    }

    private AppointmentSearchDefinition n0(Appointment appointment) {
        AppointmentSearchDefinition appointmentSearchDefinition = new AppointmentSearchDefinition();
        LocalDateTime localStartDateTime = appointment.getLocalStartDateTime();
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
        appointmentSearchDefinition.setStart(localStartDateTime.format(dateTimeFormatter));
        if (appointment.getLocalEndDateTime() != null) {
            appointmentSearchDefinition.setEnd(appointment.getLocalEndDateTime().format(dateTimeFormatter));
        }
        if (appointment.getStaff() != null) {
            appointmentSearchDefinition.setStaffId(Integer.valueOf(appointment.getStaff().getId().intValue()));
        }
        if (appointment.getLocation() != null) {
            appointmentSearchDefinition.setLocationId(appointment.getLocation().getId());
        }
        appointmentSearchDefinition.setSessionTypeId(appointment.getSessionType().getId());
        return appointmentSearchDefinition;
    }

    public static Unit n1(String str) {
        return Unit.a;
    }

    public void o1(p0.a aVar, final CatalogItem catalogItem, ClassSchedule classSchedule, final int i, final String str, Long l8, CatalogPackage catalogPackage, HttpResponseMessage httpResponseMessage) {
        final org.koin.core.util.p0 p0Var = new org.koin.core.util.p0(aVar);
        if (catalogItem != null) {
            POSViewModel pOSViewModel = this.f3620n;
            if (pOSViewModel == null || classSchedule == null) {
                p0Var.c(je.a.c(i, str, catalogItem, p0Var.f(), p0Var.e()));
            } else {
                pOSViewModel.f(classSchedule, new Function1() {
                    public final Object invoke(Object obj) {
                        Unit m12;
                        m12 = o1.this.m1(catalogItem, p0Var, i, str, (List) obj);
                        return m12;
                    }
                }, new Function1() {
                    public final Object invoke(Object obj) {
                        Unit n12;
                        n12 = o1.n1((String) obj);
                        return n12;
                    }
                });
            }
        }
        if (l8 != null) {
            p0Var.c(je.a.a(i, str, l8.intValue(), p0Var.f(), p0Var.e()));
        }
        if (catalogPackage != null) {
            AddPackageToCartRequest addPackageToCartRequest = new AddPackageToCartRequest();
            addPackageToCartRequest.setCatalogPackage(catalogPackage);
            p0Var.c(je.a.d(i, str, addPackageToCartRequest, p0Var.f(), p0Var.e()));
        }
    }

    public void p1(VolleyError volleyError) {
        b bVar = this.i;
        if (bVar != null) {
            bVar.k(volleyError);
        }
    }

    public void q1(CartPackage cartPackage) {
        b bVar = this.i;
        if (bVar != null) {
            bVar.m();
        }
    }

    public void r1(VolleyError volleyError) {
        b bVar = this.i;
        if (bVar != null) {
            bVar.k(volleyError);
        }
    }

    private void s0() {
        final h1.a c8 = Application.d().c();
        n6.i iVar = this.a;
        if (iVar != null) {
            iVar.cancel();
        }
        if (c8.e() == null) {
            n6.i iVar2 = new n6.i(new Response.ErrorListener() {
                @Override
                public final void onErrorResponse(VolleyError volleyError) {
                    o1.this.N0(volleyError);
                }
            }, new Response.Listener() {
                @Override
                public final void onResponse(Object obj) {
                    o1.this.O0(c8, (GetClientsResponse) obj);
                }
            }, false);
            this.a = iVar2;
            iVar2.i();
        } else {
            c cVar = this.h;
            if (cVar != null) {
                cVar.h();
            }
        }
    }

    public void s1(Boolean bool) {
        b bVar = this.i;
        if (bVar != null) {
            bVar.m();
        }
    }

    public void t1(Cart cart, Map map, int i, CartPackage cartPackage) {
        POSPaymentUtils.p0(cart, map, i, new TaskCallback() {
            public final void a(Object obj) {
                o1.this.s1((Boolean) obj);
            }

            public void b() {
                cf.e.a(this);
            }
        });
    }

    public void u1(VolleyError volleyError) {
        b bVar = this.i;
        if (bVar != null) {
            bVar.k(volleyError);
        }
    }

    private int v0(int i, int i8) {
        return (int) Math.ceil(i / i8);
    }

    public void v1(Boolean bool) {
        b bVar = this.i;
        if (bVar != null) {
            bVar.m();
        }
    }

    public void T0() {
        if (this.f3619m) {
            return;
        }
        je.a.m(Integer.parseInt(Application.d().c().f().getSiteId()), new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.U0((Cart) obj);
            }
        }, new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.V0(volleyError);
            }
        }, ((org.koin.core.feature.familyaccounts.domain.interactor.a) f3615o.getValue()).a());
    }

    public void x0(CartDiscountItem cartDiscountItem) {
        b bVar = this.i;
        if (bVar != null) {
            bVar.m();
        }
    }

    public void y0(VolleyError volleyError) {
        c2.c cVar = c2.c.a;
        MetricsName metricsName = MetricsName.ADD_PROMO_CODE;
        if (cVar.c(metricsName)) {
            k0(metricsName, false, false, false);
        }
        b bVar = this.i;
        if (bVar != null) {
            bVar.l(volleyError);
        }
    }

    public void z0(String str, int i, String str2, CartPaymentItem cartPaymentItem) {
        h0(str, i, str2);
    }

    public boolean A1(ClassTypeObject classTypeObject) {
        return B1(classTypeObject, null);
    }

    public boolean B1(ClassTypeObject classTypeObject, Integer num) {
        CServiceCategoryType cServiceCategoryType = classTypeObject instanceof Enrollment ? CServiceCategoryType.Enrollment : CServiceCategoryType.Class;
        final ServiceCategory t02 = t0();
        this.c = new ServiceCategory[]{t02};
        if (this.b.size() != 0) {
            return true;
        }
        final Response.ErrorListener errorListener = new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.g1(volleyError);
            }
        };
        final int d8 = org.koin.core.util.u0.d(Application.d().c().f().getSiteId());
        final CServiceCategoryType cServiceCategoryType2 = cServiceCategoryType;
        je.a.k(d8, ((org.koin.core.feature.familyaccounts.domain.interactor.a) f3615o.getValue()).a(), classTypeObject.getId(), num, cServiceCategoryType2, new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.j1(d8, t02, cServiceCategoryType2, errorListener, (CatalogFeedReference) obj);
            }
        }, errorListener);
        return false;
    }

    public void C1(ClassSchedule classSchedule) {
        POSViewModel pOSViewModel = this.f3620n;
        if (pOSViewModel != null) {
            pOSViewModel.f(classSchedule, new Function1() {
                public final Object invoke(Object obj) {
                    Unit l12;
                    l12 = o1.this.l1((List) obj);
                    return l12;
                }
            }, new Function1() {
                public final Object invoke(Object obj) {
                    Unit k12;
                    k12 = o1.k1((String) obj);
                    return k12;
                }
            });
        }
    }

    public void D1() {
        this.b.clear();
    }

    public void E1() {
        this.c = null;
        this.d = null;
        this.e = null;
        this.f = null;
        D1();
    }

    public void F1(b bVar) {
        this.i = bVar;
    }

    public void G1(c cVar) {
        this.h = cVar;
    }

    public void H1(d dVar) {
        this.f3617k = dVar;
    }

    public void I1(f fVar) {
        this.f3616j = fVar;
    }

    public void J1(g gVar) {
        this.f3618l = gVar;
    }

    public void K1(e eVar) {
        this.g = eVar;
    }

    public void L1(final CatalogItem catalogItem, final Long l8, final CatalogPackage catalogPackage, final ClassSchedule classSchedule, final p0.a aVar) {
        final int parseInt = Integer.parseInt(Application.d().c().f().getSiteId());
        final String a8 = ((org.koin.core.feature.familyaccounts.domain.interactor.a) f3615o.getValue()).a();
        je.a.l(parseInt, new CartAbandonReason(), new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.o1(aVar, catalogItem, classSchedule, parseInt, a8, l8, catalogPackage, (HttpResponseMessage) obj);
            }
        }, new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.p1(volleyError);
            }
        }, a8);
    }

    public void M1(boolean z7, boolean z8) {
        c2.c cVar = c2.c.a;
        long currentTimeMillis = System.currentTimeMillis();
        MetricsName metricsName = MetricsName.CHECKOUT_STANDARD;
        cVar.a(currentTimeMillis, metricsName, null);
        cVar.b(metricsName, AdditionalValuesKeys.IS_CART_REFACTORED.getKey(), Boolean.FALSE);
        cVar.b(metricsName, AdditionalValuesKeys.CART_SERVICE_TYPE.getKey(), CartServiceType.CONNECT.name());
        cVar.b(metricsName, AdditionalValuesKeys.CHECKOUT_TYPE.getKey(), z7 ? "Appointment" : z8 ? "Enrollment" : "Class");
    }

    public void N1(CartPackage cartPackage, String str) {
        je.a.F(Integer.parseInt(Application.d().c().f().getSiteId()), cartPackage, str, new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.q1((CartPackage) obj);
            }
        }, new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.r1(volleyError);
            }
        });
    }

    public void O1(final Cart cart, final Map<PaymentMethod, BigDecimal> map) {
        final int parseInt = Integer.parseInt(Application.d().c().f().getSiteId());
        CartPackage o02 = POSPaymentUtils.o0(cart);
        String a8 = ((org.koin.core.feature.familyaccounts.domain.interactor.a) f3615o.getValue()).a();
        if (o02 != null) {
            je.a.F(parseInt, o02, a8, new Response.Listener() {
                @Override
                public final void onResponse(Object obj) {
                    o1.this.t1(cart, map, parseInt, (CartPackage) obj);
                }
            }, new Response.ErrorListener() {
                @Override
                public final void onErrorResponse(VolleyError volleyError) {
                    o1.this.u1(volleyError);
                }
            });
            return;
        }
        PaymentMethod paymentMethod = (PaymentMethod) kotlin.collections.m.u0(map.keySet(), new Function1() {
            public final Object invoke(Object obj) {
                return Boolean.valueOf(((PaymentMethod) obj).isAlternatePayment());
            }
        });
        if (paymentMethod != null) {
            of.a0.a.o(cart, paymentMethod, parseInt, new TaskCallback() {
                public final void a(Object obj) {
                    o1.this.v1((Boolean) obj);
                }

                public void b() {
                    cf.e.a(this);
                }
            });
        } else {
            POSPaymentUtils.p0(cart, map, parseInt, new TaskCallback() {
                public final void a(Object obj) {
                    o1.this.v1((Boolean) obj);
                }

                public void b() {
                    cf.e.a(this);
                }
            });
        }
    }

    @Override
    public void e() {
        super.e();
        K1(null);
        H1(null);
        J1(null);
        I1(null);
        F1(null);
    }

    public void i0(final String str, POSCache pOSCache) {
        final int parseInt = Integer.parseInt(Application.d().c().f().getSiteId());
        final String a8 = ((org.koin.core.feature.familyaccounts.domain.interactor.a) f3615o.getValue()).a();
        if (!DevelopmentFlags.A.d() || pOSCache.c().getPayments().length != 1 || pOSCache.c().getPayments()[0].getPaymentMethod().isAlternatePayment()) {
            h0(str, parseInt, a8);
            return;
        }
        CartPaymentItem cartPaymentItem = (CartPaymentItem) of.b0.b(pOSCache.c(), "CreditCard").get(0);
        if (cartPaymentItem != null) {
            je.a.D(parseInt, a8, cartPaymentItem, new Response.Listener() {
                @Override
                public final void onResponse(Object obj) {
                    o1.this.z0(str, parseInt, a8, (CartPaymentItem) obj);
                }
            }, new Response.ErrorListener() {
                @Override
                public final void onErrorResponse(VolleyError volleyError) {
                    o1.A0(volleyError);
                }
            });
        }
    }

    public void k0(MetricsName metricsName, boolean z7, boolean z8, boolean z9) {
        MetricValue g02 = g0(metricsName, z7, z8);
        if (g02 == null) {
            return;
        }
        if (metricsName != MetricsName.CHANGE_PAYMENT_METHOD) {
            g02.a(((metricsName == MetricsName.ADD_GC || metricsName == MetricsName.ADD_PROMO_CODE) ? AdditionalValuesKeys.IS_VALID : AdditionalValuesKeys.IS_SUCCESS).getKey(), Boolean.valueOf(z9));
        }
        vf.f.C(metricsName, g02);
    }

    public void l0(POSCache pOSCache, boolean z7, boolean z8) {
        MetricsName metricsName = MetricsName.OPEN_CHECKOUT_REQUEST;
        MetricValue g02 = g0(metricsName, z7, z8);
        if (g02 == null || pOSCache == null || pOSCache.c() == null) {
            return;
        }
        g02.a(AdditionalValuesKeys.HAS_PAYMENT_METHOD.getKey(), Boolean.valueOf(pOSCache.c().hasPaymentItems()));
        vf.f.C(metricsName, g02);
    }

    public void m0(final String str) {
        final String a8 = ((org.koin.core.feature.familyaccounts.domain.interactor.a) f3615o.getValue()).a();
        ((GetSelectedLocationSubscriberId) KoinJavaComponent.e(GetSelectedLocationSubscriberId.class).getValue()).b(new Function1() {
            public final Object invoke(Object obj) {
                Unit F0;
                F0 = o1.this.F0(a8, str, (Long) obj);
                return F0;
            }
        }, new Function1() {
            public final Object invoke(Object obj) {
                Unit G0;
                G0 = o1.this.G0((Exception) obj);
                return G0;
            }
        });
    }

    public void o0() {
        je.a.l(Integer.parseInt(Application.d().c().f().getSiteId()), new CartAbandonReason(), (Response.Listener) null, (Response.ErrorListener) null, ((org.koin.core.feature.familyaccounts.domain.interactor.a) f3615o.getValue()).a());
    }

    public void p0() {
        qf.d.E().x(new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.H0((List) obj);
            }
        }, new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.I0(volleyError);
            }
        });
    }

    public void q0(final String str) {
        je.a.o(str, Integer.parseInt(Application.d().c().f().getSiteId()), new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.J0(str, (PaymentMethod) obj);
            }
        }, new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.K0(volleyError);
            }
        });
    }

    public void r0() {
        je.a.m(Integer.parseInt(Application.d().c().f().getSiteId()), new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.L0((Cart) obj);
            }
        }, new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.M0(volleyError);
            }
        }, ((org.koin.core.feature.familyaccounts.domain.interactor.a) f3615o.getValue()).a());
    }

    public ServiceCategory t0() {
        String string = Application.d().getString(2132018165);
        String name = ProgramType.OTHER.name();
        Boolean bool = Boolean.TRUE;
        Boolean bool2 = Boolean.FALSE;
        return new ServiceCategory(0, string, name, bool, bool2, bool2);
    }

    public e u0() {
        return this.g;
    }

    public void w0() {
        POSPaymentUtils.u(Integer.parseInt(Application.d().c().f().getSiteId()), new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.R0((PaymentConfiguration) obj);
            }
        }, new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.S0(volleyError);
            }
        });
    }

    public void x1(CartDiscountItem cartDiscountItem) {
        if (cartDiscountItem != null) {
            je.a.u(Integer.parseInt(Application.d().c().f().getSiteId()), ((org.koin.core.feature.familyaccounts.domain.interactor.a) f3615o.getValue()).a(), cartDiscountItem.getId(), new Response.Listener() {
                @Override
                public final void onResponse(Object obj) {
                    o1.this.W0((Void) obj);
                }
            }, new Response.ErrorListener() {
                @Override
                public final void onErrorResponse(VolleyError volleyError) {
                    o1.this.X0(volleyError);
                }
            });
            return;
        }
        b bVar = this.i;
        if (bVar != null) {
            bVar.m();
        }
    }

    public void y1(final ServiceCategory serviceCategory) {
        final ODataFilters oDataFilters = new ODataFilters();
        Integer id = serviceCategory.getId();
        if (id == null || id.intValue() != 42096) {
            oDataFilters.addOrSet(new FilterPair("ServiceCategoryId", ODataFilters.FilterType.EQ, id));
        } else {
            FilterGrouping filterGrouping = new FilterGrouping(ODataFilters.Operator.AND);
            ODataFilters.FilterType filterType = ODataFilters.FilterType.EQ;
            oDataFilters.addOrSet(filterGrouping.add(new FilterPair("ItemType", filterType, "Package")).add(new FilterPair("HasContract", filterType, Boolean.TRUE)));
        }
        Gym e8 = Application.d().e();
        Integer num = null;
        Integer locationId = e8 != null ? e8.getLocationId() : null;
        if (locationId != null && locationId.intValue() != 0) {
            num = locationId;
        }
        if (num != null) {
            oDataFilters.addOrSet(new FilterPair("UsedAtLocationId", ODataFilters.FilterType.EQ, num));
        }
        final String a8 = ((org.koin.core.feature.familyaccounts.domain.interactor.a) f3615o.getValue()).a();
        ((GetSelectedLocationSubscriberId) KoinJavaComponent.e(GetSelectedLocationSubscriberId.class).getValue()).b(new Function1() {
            public final Object invoke(Object obj) {
                Unit a12;
                a12 = o1.this.a1(serviceCategory, a8, oDataFilters, (Long) obj);
                return a12;
            }
        }, new Function1() {
            public final Object invoke(Object obj) {
                Unit b12;
                b12 = o1.this.b1((Exception) obj);
                return b12;
            }
        });
    }

    public boolean z1(Appointment appointment) {
        final ServiceCategory t02 = t0();
        this.c = new ServiceCategory[]{t02};
        if (this.b.size() != 0) {
            return true;
        }
        final Response.ErrorListener errorListener = new Response.ErrorListener() {
            @Override
            public final void onErrorResponse(VolleyError volleyError) {
                o1.this.c1(volleyError);
            }
        };
        final int d8 = org.koin.core.util.u0.d(Application.d().c().f().getSiteId());
        je.a.j(d8, (String) null, n0(appointment), new Response.Listener() {
            @Override
            public final void onResponse(Object obj) {
                o1.this.f1(d8, t02, errorListener, (CatalogFeedReference) obj);
            }
        }, errorListener);
        return false;
    }

    public o1(POSViewModel pOSViewModel) {
        this.f3620n = pOSViewModel;
    }

    public static void A0(VolleyError volleyError) {
    }
}