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

io.sphere.client.shop.OrderService Maven / Gradle / Ivy

There is a newer version: 0.72.1
Show newest version
package io.sphere.client.shop;

import io.sphere.client.CommandRequest;
import io.sphere.client.FetchRequest;
import io.sphere.client.QueryRequest;
import io.sphere.client.model.VersionedId;
import io.sphere.client.shop.model.Order;
import io.sphere.client.shop.model.PaymentState;
import io.sphere.client.shop.model.ShipmentState;

/** Sphere HTTP API for working with orders in a given project. */
public interface OrderService {
    /** Finds an order by an id. */
    FetchRequest byId(String id);

    /** Queries all orders in current project. */
    QueryRequest all();

    /** Queries all orders of given customer. */
    public QueryRequest forCustomer(String customerId);

    /** Sets the payment state of an order. */
    public CommandRequest updatePaymentState(VersionedId orderId, PaymentState paymentState);

    /** Sets the shipment state of an order. */
    public CommandRequest updateShipmentState(VersionedId orderId, ShipmentState shipmentState);

    /** Creates an order based on a cart, and deletes the cart.
     *  The created order object has the same id as the cart it was created from.
     *
     *  @return A command request which can fail with the following exceptions:
     *  
    *
  • {@link io.sphere.client.exceptions.OutOfStockException OutOfStockException} if some of the products * in the cart are not available anymore. * This can only happen if the cart is in the * {@link io.sphere.client.shop.model.Cart.InventoryMode#ReserveOnOrder ReserveOnOrder} mode. *
  • {@link io.sphere.client.exceptions.PriceChangedException PriceChangedException} if the price, tax or * shipping of some line items changed since the items were added to the cart. *
*/ CommandRequest createOrder(VersionedId cartId); /** Creates an order based on a cart, and deletes the cart. * The created order object has the same id as the cart it was created from. * * @return A command request which can fail with the following exceptions: *
    *
  • {@link io.sphere.client.exceptions.OutOfStockException OutOfStockException} if some of the products * in the cart are not available anymore. * This can only happen if the cart is in the * {@link io.sphere.client.shop.model.Cart.InventoryMode#ReserveOnOrder ReserveOnOrder} mode. *
  • {@link io.sphere.client.exceptions.PriceChangedException PriceChangedException} if the price, tax or * shipping of some line items changed since the items were added to the cart. *
*/ CommandRequest createOrder(VersionedId cartId, PaymentState paymentState); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy