All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.orders.OrderFromCartDraft Maven / Gradle / Ivy

There is a newer version: 2.16.0
Show newest version
package io.sphere.sdk.orders;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.sphere.sdk.annotations.FactoryMethod;
import io.sphere.sdk.annotations.ResourceDraftValue;
import io.sphere.sdk.carts.Cart;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.ResourceIdentifier;
import io.sphere.sdk.models.Versioned;
import io.sphere.sdk.states.State;

import javax.annotation.Nullable;

@JsonDeserialize(as = OrderFromCartDraftDsl.class)
@ResourceDraftValue(factoryMethods =
        {
                @FactoryMethod(parameterNames = {"id", "version", "orderNumber", "paymentState"}),
                @FactoryMethod(parameterNames = {"id", "version"}),
                @FactoryMethod(parameterNames = {"cart", "version", "orderNumber", "paymentState"}),
                @FactoryMethod(parameterNames = {"cart", "version"})
        })
public interface OrderFromCartDraft {

    /**
     * @deprecated use {@link OrderFromCartDraft#getCart()} instead
     */
    @Deprecated
    @Nullable
    String getId();

    ResourceIdentifier getCart();

    Long getVersion();

    @Nullable
    String getOrderNumber();

    @Nullable
    PaymentState getPaymentState();

    @Nullable
    OrderState getOrderState();

    @Nullable
    Reference getState();

    @Nullable
    ShipmentState getShipmentState();

    static OrderFromCartDraft of(final Versioned cart, @Nullable final String orderNumber, @Nullable final PaymentState paymentState) {
        return OrderFromCartDraftDsl.of(ResourceIdentifier.ofId(cart.getId()), cart.getVersion(), orderNumber, paymentState);
    }

    static OrderFromCartDraft of(final Versioned cart) {
        return OrderFromCartDraftDsl.of(ResourceIdentifier.ofId(cart.getId()), cart.getVersion(), null, null);
    }

    static OrderFromCartDraft of(final ResourceIdentifier cartResourceIdentifier, final Long version, @Nullable final String orderNumber, @Nullable final PaymentState paymentState) {
        return OrderFromCartDraftDsl.of(cartResourceIdentifier, version, orderNumber, paymentState);
    }

    static OrderFromCartDraft of(final ResourceIdentifier cartResourceIdentifier, final Long version) {
        return OrderFromCartDraftDsl.of(cartResourceIdentifier, version, null, null);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy