Skip to main content
added 2354 characters in body
Source Link

Cart Entity

@NoArgsConstructor
@Document("cart")
@JsonInclude(JsonInclude.Include.NON_NULL)
@EqualsAndHashCode(callSuper = true)
public class Cart extends BaseEntity implements Serializable {

    /** The Constant serialVersionUID. */
    private static final long serialVersionUID = 1L;

    /** The id. */
    @NotNull(message = "cartId can not be null", groups = { CartViews.AddonAddView.class })
    @NotBlank(message = "cartId can not be blank", groups = { CartViews.AddonAddView.class })
    @Id
    @JsonView({ CartViews.AddonAddView.class })
    private String id;

    /** The domain id. */
    private String domainId;

    /** The checkout id. */
    private String checkoutId;

    /** The user IP. */
    private String userIP;

    /** The agents. */
    @JsonProperty("agents")
    private List<Agent> agents;

    /** The customer party id. */
    // @JsonView({ CartViews.AddItemDetailsView.class })
    private String customerPartyId;

    /** The guuid. */
    // @JsonView({ CartViews.AddItemDetailsView.class })
    private String guuid;

    /** The sender. */
    @JsonProperty("sender")
    private Sender sender;

    /** The channel id. */
    @NotNull(message = "channelId can not be null", groups = { CartViews.AddItemDetailsView.class })
    @NotBlank(message = "channelId can not be blank", groups = { CartViews.AddItemDetailsView.class })
    @JsonView({ CartViews.AddItemDetailsView.class })
    private String channelId;

    /** The action. */
    private String action;

    /** The reason id. */
    private String reasonId;

    /** The sub reason id. */
    private String subReasonId;

    /** The comments. */
    private String comments;

    /** The cart total. */
    private Float cartTotal;

    /** The tax included in cart total. */
    private Float taxIncludedInCartTotal;

    /** The tax on cart total. */
    private Float taxOnCartTotal;

    /** The adjustment. */
    @JsonProperty("adjustment")
    private List<Adjustment> adjustment;

    /** The status. */
    private String status;

    /** The items. */
    @Valid
    @NotNull(message = "items can not be null", groups = { CartViews.AddItemDetailsView.class,
            CartViews.AddonDeleteView.class, CartViews.AddonAddView.class })
    @JsonProperty("items")
    @JsonView({ CartViews.AddItemDetailsView.class, CartViews.AddonDeleteView.class, CartViews.AddonAddView.class })
    private List<Item> items;

}

Cart Entity

@NoArgsConstructor
@Document("cart")
@JsonInclude(JsonInclude.Include.NON_NULL)
@EqualsAndHashCode(callSuper = true)
public class Cart extends BaseEntity implements Serializable {

    /** The Constant serialVersionUID. */
    private static final long serialVersionUID = 1L;

    /** The id. */
    @NotNull(message = "cartId can not be null", groups = { CartViews.AddonAddView.class })
    @NotBlank(message = "cartId can not be blank", groups = { CartViews.AddonAddView.class })
    @Id
    @JsonView({ CartViews.AddonAddView.class })
    private String id;

    /** The domain id. */
    private String domainId;

    /** The checkout id. */
    private String checkoutId;

    /** The user IP. */
    private String userIP;

    /** The agents. */
    @JsonProperty("agents")
    private List<Agent> agents;

    /** The customer party id. */
    // @JsonView({ CartViews.AddItemDetailsView.class })
    private String customerPartyId;

    /** The guuid. */
    // @JsonView({ CartViews.AddItemDetailsView.class })
    private String guuid;

    /** The sender. */
    @JsonProperty("sender")
    private Sender sender;

    /** The channel id. */
    @NotNull(message = "channelId can not be null", groups = { CartViews.AddItemDetailsView.class })
    @NotBlank(message = "channelId can not be blank", groups = { CartViews.AddItemDetailsView.class })
    @JsonView({ CartViews.AddItemDetailsView.class })
    private String channelId;

    /** The action. */
    private String action;

    /** The reason id. */
    private String reasonId;

    /** The sub reason id. */
    private String subReasonId;

    /** The comments. */
    private String comments;

    /** The cart total. */
    private Float cartTotal;

    /** The tax included in cart total. */
    private Float taxIncludedInCartTotal;

    /** The tax on cart total. */
    private Float taxOnCartTotal;

    /** The adjustment. */
    @JsonProperty("adjustment")
    private List<Adjustment> adjustment;

    /** The status. */
    private String status;

    /** The items. */
    @Valid
    @NotNull(message = "items can not be null", groups = { CartViews.AddItemDetailsView.class,
            CartViews.AddonDeleteView.class, CartViews.AddonAddView.class })
    @JsonProperty("items")
    @JsonView({ CartViews.AddItemDetailsView.class, CartViews.AddonDeleteView.class, CartViews.AddonAddView.class })
    private List<Item> items;

}

added 84 characters in body
Source Link

Adding addon products to cart

Delete item from cart

Delete addon from cart

Adding addon products to cart

Delete item from cart

Delete addon from cart

edited title
Link

Avoiding Java stream code repeated callscode using lambdas

Source Link
Loading