Class DefaultCartTransferService

java.lang.Object
com.broadleafcommerce.cartoperation.service.csr.DefaultCartTransferService
All Implemented Interfaces:
CartTransferService

public class DefaultCartTransferService extends Object implements CartTransferService
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultCartTransferService(CartOperationService cartOperationService, CartProvider cartProvider, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory, TransferCartTokenEncoder transferCartTokenEncoder, TransferCartTokenDecoder transferCartTokenDecoder, PaymentProvider<PaymentSummary> paymentProvider)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    accountMatches(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer)
     
    protected com.broadleafcommerce.cart.client.domain.CartActionAudit
    buildCartActionAuditForClaimDefaultCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer, @NonNull String oldCartStatus)
    Builds a CartActionAudit for claiming default cart.
    buildUpdateCartRequest(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.CartActionAudit audit)
    Builds a UpdateCartRequest from the given Cart and CartActionAudit.
    protected boolean
    cartOwnershipMatchWithCustomerRef(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.order.common.domain.CustomerRef customerRef)
    Determines if the given Cart.getCustomerRef() matches with the given CustomerRef.
    createTransferCartToken(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
    Creates a new TransferCartToken that can be exchanged for proof of access to transfer a particular cart.
    protected boolean
    customerMatches(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer)
     
    protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils
     
     
    protected CartProvider
     
     
     
     
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    protected List<String>
    Retrieve the list of statuses which are considered valid to set a cart to be the default/implicit cart.
    protected void
    makeCurrentDefaultCartNamed(@NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected void
    makeCurrentDefaultCartNamed(String customerId, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Make the current default Cart for the customer or account named to make way for a CSR transferred cart.
    protected void
    moveCustomerCartForCsrTransfer(String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated, for removal: This API element is subject to removal in a future version.
    com.broadleafcommerce.cart.client.domain.Cart
    setCartAsDefault(com.broadleafcommerce.cart.client.domain.Cart cartToMakeDefault, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Transfer the provided cart to be the default/implicit cart for the provided customer.
    protected void
    setNewCartOwnership(com.broadleafcommerce.cart.client.domain.Cart cart)
     
    com.broadleafcommerce.cart.client.domain.Cart
    transferAnonymousCartOwnership(com.broadleafcommerce.cart.client.domain.Cart anonymousCart, com.broadleafcommerce.cart.client.domain.Cart registeredCustomerCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Transfer the provided anonymous cart to be in-process for the currently authenticated customer.
    com.broadleafcommerce.cart.client.domain.Cart
    transferAnonymousCartOwnership(com.broadleafcommerce.cart.client.domain.Cart anonymousCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Transfer the provided anonymous cart to be in-process for the currently authenticated customer.
    com.broadleafcommerce.cart.client.domain.Cart
    transferAnonymousCsrCartToInProcess(com.broadleafcommerce.cart.client.domain.Cart csrCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Transfer the provided anonymous CSR cart to be in-process for the current customer or anonymous user.
    com.broadleafcommerce.cart.client.domain.Cart
    transferAnonymousCsrCartToInProcess(com.broadleafcommerce.cart.client.domain.Cart csrCart, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Transfer the provided anonymous CSR cart to be in-process for the provided customer
    com.broadleafcommerce.cart.client.domain.Cart
    transferAnonymousCsrQuote(com.broadleafcommerce.cart.client.domain.Cart csrQuote, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Transfer the provided anonymous CSR quote to be in drafting status for the provided customer
    com.broadleafcommerce.cart.client.domain.Cart
    transferCsrCartToInProcess(com.broadleafcommerce.cart.client.domain.Cart csrCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Transfer the provided CSR cart to be in-process for its customer.
    protected com.broadleafcommerce.cart.client.domain.Cart
    updateCart(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected com.broadleafcommerce.cart.client.domain.Cart
    updateCart(UpdateCartRequest updateCartRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected void
    updatePaymentManagementStatuses(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Attempts to decode and validate the provided token string into a TransferCartToken.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • transferAnonymousCartOwnership

      public com.broadleafcommerce.cart.client.domain.Cart transferAnonymousCartOwnership(com.broadleafcommerce.cart.client.domain.Cart anonymousCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartTransferService
      Transfer the provided anonymous cart to be in-process for the currently authenticated customer.
      Specified by:
      transferAnonymousCartOwnership in interface CartTransferService
      Parameters:
      anonymousCart - The anonymous cart to transfer ownership
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The cart now owned by the customer
    • transferAnonymousCartOwnership

      public com.broadleafcommerce.cart.client.domain.Cart transferAnonymousCartOwnership(com.broadleafcommerce.cart.client.domain.Cart anonymousCart, @Nullable com.broadleafcommerce.cart.client.domain.Cart registeredCustomerCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartTransferService
      Transfer the provided anonymous cart to be in-process for the currently authenticated customer.
      Specified by:
      transferAnonymousCartOwnership in interface CartTransferService
      Parameters:
      anonymousCart - The anonymous cart to transfer ownership
      registeredCustomerCart - The pre-existing customer's cart
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The cart now owned by the customer
    • setNewCartOwnership

      protected void setNewCartOwnership(com.broadleafcommerce.cart.client.domain.Cart cart)
    • transferCsrCartToInProcess

      public com.broadleafcommerce.cart.client.domain.Cart transferCsrCartToInProcess(com.broadleafcommerce.cart.client.domain.Cart csrCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartTransferService
      Transfer the provided CSR cart to be in-process for its customer.
      Specified by:
      transferCsrCartToInProcess in interface CartTransferService
      Parameters:
      csrCart - The CSR-owned cart to replace the customer's in-process cart
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The in-process cart transferred to the customer
    • createTransferCartToken

      public TransferCartToken createTransferCartToken(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
      Description copied from interface: CartTransferService
      Creates a new TransferCartToken that can be exchanged for proof of access to transfer a particular cart.
      Specified by:
      createTransferCartToken in interface CartTransferService
      Parameters:
      cart - the cart which can be transferred using this token
      Returns:
      a transfer cart token object with an encoded token that is used to prove access to transfer the cart
    • validateTransferCartToken

      public TransferCartToken validateTransferCartToken(String tokenString) throws TransferCartTokenParseException
      Description copied from interface: CartTransferService
      Attempts to decode and validate the provided token string into a TransferCartToken. This is used to provide a way to check that a token is valid and to extract the contents.
      Specified by:
      validateTransferCartToken in interface CartTransferService
      Parameters:
      tokenString - the encoded token string
      Returns:
      a transfer cart token object
      Throws:
      TransferCartTokenParseException
    • transferAnonymousCsrCartToInProcess

      public com.broadleafcommerce.cart.client.domain.Cart transferAnonymousCsrCartToInProcess(com.broadleafcommerce.cart.client.domain.Cart csrCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartTransferService
      Transfer the provided anonymous CSR cart to be in-process for the current customer or anonymous user.
      Specified by:
      transferAnonymousCsrCartToInProcess in interface CartTransferService
      Parameters:
      csrCart - The anonymous CSR-owned cart to transfer
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The in-process cart transferred to the customer or anonymous user
    • transferAnonymousCsrCartToInProcess

      public com.broadleafcommerce.cart.client.domain.Cart transferAnonymousCsrCartToInProcess(com.broadleafcommerce.cart.client.domain.Cart csrCart, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartTransferService
      Transfer the provided anonymous CSR cart to be in-process for the provided customer
      Specified by:
      transferAnonymousCsrCartToInProcess in interface CartTransferService
      Parameters:
      csrCart - the CSR cart
      customer - the customer
      contextInfo - the context info
      Returns:
      the transferred cart
    • transferAnonymousCsrQuote

      public com.broadleafcommerce.cart.client.domain.Cart transferAnonymousCsrQuote(com.broadleafcommerce.cart.client.domain.Cart csrQuote, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartTransferService
      Transfer the provided anonymous CSR quote to be in drafting status for the provided customer
      Specified by:
      transferAnonymousCsrQuote in interface CartTransferService
      Parameters:
      csrQuote - the CSR cart of type DefaultCartTypes.QUOTE
      customer - the customer
      contextInfo - the context info
      Returns:
      the transferred cart
    • setCartAsDefault

      public com.broadleafcommerce.cart.client.domain.Cart setCartAsDefault(com.broadleafcommerce.cart.client.domain.Cart cartToMakeDefault, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartTransferService
      Transfer the provided cart to be the default/implicit cart for the provided customer.

      By default, implicit cart refers to a cart with no name and status of DefaultCartStatuses.IN_PROCESS.

      Specified by:
      setCartAsDefault in interface CartTransferService
      Parameters:
      cartToMakeDefault - the cart to make default
      customer - the current authenticated customer
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      the cart that is set to default
    • moveCustomerCartForCsrTransfer

      @Deprecated(since="1.8.0", forRemoval=true) protected void moveCustomerCartForCsrTransfer(@Nullable String customerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • makeCurrentDefaultCartNamed

      protected void makeCurrentDefaultCartNamed(@NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • makeCurrentDefaultCartNamed

      protected void makeCurrentDefaultCartNamed(@Nullable String customerId, @Nullable String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Make the current default Cart for the customer or account named to make way for a CSR transferred cart.
      Parameters:
      customerId - the id of the customer who owns the cart
      accountId - the id of the account that the cart belongs to
      contextInfo - context surrounding sandboxing and multitenant state
    • updateCart

      protected com.broadleafcommerce.cart.client.domain.Cart updateCart(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • updateCart

      protected com.broadleafcommerce.cart.client.domain.Cart updateCart(UpdateCartRequest updateCartRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getValidSetDefaultCartStatuses

      protected List<String> getValidSetDefaultCartStatuses()
      Retrieve the list of statuses which are considered valid to set a cart to be the default/implicit cart.

      Custom valid statuses should be added here.

      Returns:
      the list of statuses which are considered valid to set a cart to be the default/implicit cart
    • cartOwnershipMatchWithCustomerRef

      protected boolean cartOwnershipMatchWithCustomerRef(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customerRef)
      Determines if the given Cart.getCustomerRef() matches with the given CustomerRef.
      Parameters:
      cart - the Cart to check the ownership
      customerRef - the CustomerRef to check against
      Returns:
      true if the cart ownership matches with the given CustomerRef, otherwise false
    • customerMatches

      protected boolean customerMatches(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer)
    • accountMatches

      protected boolean accountMatches(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer)
    • buildCartActionAuditForClaimDefaultCart

      protected com.broadleafcommerce.cart.client.domain.CartActionAudit buildCartActionAuditForClaimDefaultCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer, @NonNull @NonNull String oldCartStatus)
      Builds a CartActionAudit for claiming default cart.
      Parameters:
      cart - the Cart being claimed as default cart
      customer - the CustomerRef who owns this cart
      oldCartStatus - the Cart.getStatus() prior claiming this cart
      Returns:
      a CartActionAudit built for claiming default cart
    • buildUpdateCartRequest

      protected UpdateCartRequest buildUpdateCartRequest(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartActionAudit audit)
      Builds a UpdateCartRequest from the given Cart and CartActionAudit.
      Parameters:
      cart - the Cart being updated
      audit - the CartActionAudit to create along with the cart update
      Returns:
      a UpdateCartRequest from the given Cart and CartActionAudit
    • updatePaymentManagementStatuses

      @Deprecated protected void updatePaymentManagementStatuses(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getCartOperationService

      protected CartOperationService getCartOperationService()
    • getCartProvider

      protected CartProvider getCartProvider()
    • getAuthenticationUtils

      protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
    • getTransferCartTokenEncoder

      protected TransferCartTokenEncoder getTransferCartTokenEncoder()
    • getTransferCartTokenDecoder

      protected TransferCartTokenDecoder getTransferCartTokenDecoder()
    • getPaymentProvider

      protected PaymentProvider<PaymentSummary> getPaymentProvider()