io.sphere.sdk.orders.OrderFromCartDraft Maven / Gradle / Ivy
The 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 io.sphere.sdk.types.CustomFields;
import io.sphere.sdk.types.CustomFieldsDraft;
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();
@Nullable
CustomFieldsDraft getCustom();
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);
}
}