Class CartCreationRequest

java.lang.Object
com.broadleafcommerce.cartoperation.domain.CartCreationRequest
All Implemented Interfaces:
Serializable

public class CartCreationRequest extends Object implements Serializable
A request DTO used to create a new Cart.
Author:
Nick Crum (ncrum)
See Also:
  • Constructor Details

    • CartCreationRequest

      public CartCreationRequest(AddItemRequest addItemRequest)
    • CartCreationRequest

      public CartCreationRequest(String name, String type, Instant expirationDate, AddItemRequest addItemRequest, List<AddItemRequest> addItemRequests, PriceCartRequest priceCartRequest, String customerTimezone, Map<String,Object> cartInternalAttributes, Map<String,Object> cartAttributes)
      Creates a new CartCreationRequest instance.
      Parameters:
      name - Allows optionally setting a cart name. This is typically blank for standard, in-process carts, and may be set when creating a Quote or Named cart directly.
      type - Allows optionally setting the type of cart to be created. Default is DefaultCartTypes.STANDARD.
      expirationDate - DefaultCartTypes.QUOTE carts can have an expiration date.
      addItemRequest - The initial AddItemRequest to populate the cart.
      addItemRequests - The initial AddItemRequests to populate the cart.

      If addItemRequest is provided, this will not be used.

      priceCartRequest - The initial PriceCartRequest to price the cart.
      customerTimezone - The customer's timezone.

      This gets stored in Cart.getInternalAttributes() to be used by downstream services.

      If this is present in subscription scenarios, then it will be used to truncate the dates to the beginning of the day in customer's timezone as needed. If null, UTC time is used.

      Note that if the provided timezone is invalid, an exception will be thrown. Refer to TimeZone.getAvailableIDs() for valid timezones.

      cartInternalAttributes - Miscellaneous internal attributes that should be copied to Cart.getInternalAttributes()
      cartAttributes - Miscellaneous attributes that should be copied to Cart.getAttributes()
      Since:
      Cart Operation Service 2.3.0, Release Train 2.3.0, Cart Operation Service 2.1.5, Release Train 2.1.5, Cart Operation Service 2.1.5, Release Train 2.1.5
      See Also:
    • CartCreationRequest

      public CartCreationRequest()
  • Method Details

    • getName

      public String getName()
      Allows optionally setting a cart name. This is typically blank for standard, in-process carts, and may be set when creating a Quote or Named cart directly.
    • getType

      public String getType()
      Allows optionally setting the type of cart to be created. Default is DefaultCartTypes.STANDARD.
      See Also:
    • getExpirationDate

      public Instant getExpirationDate()
      DefaultCartTypes.QUOTE carts can have an expiration date.
    • getAddItemRequest

      public AddItemRequest getAddItemRequest()
      The initial AddItemRequest to populate the cart.
    • getAddItemRequests

      public List<AddItemRequest> getAddItemRequests()
      The initial AddItemRequests to populate the cart.

      If addItemRequest is provided, this will not be used.

    • getPriceCartRequest

      public PriceCartRequest getPriceCartRequest()
      The initial PriceCartRequest to price the cart.
    • getCustomerTimezone

      public String getCustomerTimezone()
      The customer's timezone.

      This gets stored in Cart.getInternalAttributes() to be used by downstream services.

      If this is present in subscription scenarios, then it will be used to truncate the dates to the beginning of the day in customer's timezone as needed. If null, UTC time is used.

      Note that if the provided timezone is invalid, an exception will be thrown. Refer to TimeZone.getAvailableIDs() for valid timezones.

      Since:
      Cart Operation Service 2.3.0, Release Train 2.3.0
      See Also:
    • getCartInternalAttributes

      public Map<String,Object> getCartInternalAttributes()
      Miscellaneous internal attributes that should be copied to Cart.getInternalAttributes()
      Since:
      Cart Operation Service 2.1.5, Release Train 2.1.5
    • getCartAttributes

      public Map<String,Object> getCartAttributes()
      Miscellaneous attributes that should be copied to Cart.getAttributes()
      Since:
      Cart Operation Service 2.1.5, Release Train 2.1.5
    • setName

      public void setName(String name)
      Allows optionally setting a cart name. This is typically blank for standard, in-process carts, and may be set when creating a Quote or Named cart directly.
    • setType

      public void setType(String type)
      Allows optionally setting the type of cart to be created. Default is DefaultCartTypes.STANDARD.
      See Also:
    • setExpirationDate

      public void setExpirationDate(Instant expirationDate)
      DefaultCartTypes.QUOTE carts can have an expiration date.
    • setAddItemRequest

      public void setAddItemRequest(AddItemRequest addItemRequest)
      The initial AddItemRequest to populate the cart.
    • setAddItemRequests

      public void setAddItemRequests(List<AddItemRequest> addItemRequests)
      The initial AddItemRequests to populate the cart.

      If addItemRequest is provided, this will not be used.

    • setPriceCartRequest

      public void setPriceCartRequest(PriceCartRequest priceCartRequest)
      The initial PriceCartRequest to price the cart.
    • setCustomerTimezone

      public void setCustomerTimezone(String customerTimezone)
      The customer's timezone.

      This gets stored in Cart.getInternalAttributes() to be used by downstream services.

      If this is present in subscription scenarios, then it will be used to truncate the dates to the beginning of the day in customer's timezone as needed. If null, UTC time is used.

      Note that if the provided timezone is invalid, an exception will be thrown. Refer to TimeZone.getAvailableIDs() for valid timezones.

      Since:
      Cart Operation Service 2.3.0, Release Train 2.3.0
      See Also:
    • setCartInternalAttributes

      public void setCartInternalAttributes(Map<String,Object> cartInternalAttributes)
      Miscellaneous internal attributes that should be copied to Cart.getInternalAttributes()
      Since:
      Cart Operation Service 2.1.5, Release Train 2.1.5
    • setCartAttributes

      public void setCartAttributes(Map<String,Object> cartAttributes)
      Miscellaneous attributes that should be copied to Cart.getAttributes()
      Since:
      Cart Operation Service 2.1.5, Release Train 2.1.5
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object