Class MergeCartDraftBuilder

java.lang.Object
com.commercetools.api.models.cart.MergeCartDraftBuilder
All Implemented Interfaces:
Builder<MergeCartDraft>

public class MergeCartDraftBuilder extends Object implements Builder<MergeCartDraft>
MergeCartDraftBuilder
Example to create an instance using the builder pattern

     MergeCartDraft mergeCartDraft = MergeCartDraft.builder()
             .build()
 
  • Constructor Details

    • MergeCartDraftBuilder

      public MergeCartDraftBuilder()
  • Method Details

    • anonymousCart

      ResourceIdentifier to the anonymous Cart to be merged. Required if anonymousId is not provided.

      Parameters:
      builder - function to build the anonymousCart value
      Returns:
      Builder
    • withAnonymousCart

      ResourceIdentifier to the anonymous Cart to be merged. Required if anonymousId is not provided.

      Parameters:
      builder - function to build the anonymousCart value
      Returns:
      Builder
    • anonymousCart

      public MergeCartDraftBuilder anonymousCart(@Nullable CartResourceIdentifier anonymousCart)

      ResourceIdentifier to the anonymous Cart to be merged. Required if anonymousId is not provided.

      Parameters:
      anonymousCart - value to be set
      Returns:
      Builder
    • mergeMode

      public MergeCartDraftBuilder mergeMode(@Nullable CartMergeMode mergeMode)

      Determines how to merge the anonymous Cart with the existing Customer Cart.

      Parameters:
      mergeMode - value to be set
      Returns:
      Builder
    • updateProductData

      public MergeCartDraftBuilder updateProductData(@Nullable Boolean updateProductData)
      • If true, the LineItem Product data (name, variant, and productType) of the returned Cart will be updated.
      • If false, only the prices, discounts, and tax rates will be updated.
      Parameters:
      updateProductData - value to be set
      Returns:
      Builder
    • anonymousId

      public MergeCartDraftBuilder anonymousId(@Nullable String anonymousId)

      Assigns the Customer to the Carts that have the same anonymousId. Required if anonymousCart is not provided. If both anonymousCart and anonymousId are provided, this value must match the anonymousId of the anonymous Cart otherwise, an InvalidOperation error is returned.

      Parameters:
      anonymousId - value to be set
      Returns:
      Builder
    • getAnonymousCart

      @Nullable public CartResourceIdentifier getAnonymousCart()

      ResourceIdentifier to the anonymous Cart to be merged. Required if anonymousId is not provided.

      Returns:
      anonymousCart
    • getMergeMode

      @Nullable public CartMergeMode getMergeMode()

      Determines how to merge the anonymous Cart with the existing Customer Cart.

      Returns:
      mergeMode
    • getUpdateProductData

      @Nullable public Boolean getUpdateProductData()
      • If true, the LineItem Product data (name, variant, and productType) of the returned Cart will be updated.
      • If false, only the prices, discounts, and tax rates will be updated.
      Returns:
      updateProductData
    • getAnonymousId

      @Nullable public String getAnonymousId()

      Assigns the Customer to the Carts that have the same anonymousId. Required if anonymousCart is not provided. If both anonymousCart and anonymousId are provided, this value must match the anonymousId of the anonymous Cart otherwise, an InvalidOperation error is returned.

      Returns:
      anonymousId
    • build

      public MergeCartDraft build()
      builds MergeCartDraft with checking for non-null required values
      Specified by:
      build in interface Builder<MergeCartDraft>
      Returns:
      MergeCartDraft
    • buildUnchecked

      public MergeCartDraft buildUnchecked()
      builds MergeCartDraft without checking for non-null required values
      Returns:
      MergeCartDraft
    • of

      public static MergeCartDraftBuilder of()
      factory method for an instance of MergeCartDraftBuilder
      Returns:
      builder
    • of

      public static MergeCartDraftBuilder of(MergeCartDraft template)
      create builder for MergeCartDraft instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder