public final class ChangeCustomLineItemQuantity extends UpdateActionImpl<Cart>
See also CartInStoreUpdateCommand.
withTaxCategory(client(), taxCategory -> { final Cart cart = createCartWithCountry(client()); assertThat(cart.getCustomLineItems()).hasSize(0); final CustomLineItemDraft draftItem = createCustomLineItemDraft(taxCategory); final Cart cartWithCustomLineItem = client().executeBlocking(CartUpdateCommand.of(cart, AddCustomLineItem.of(draftItem))); assertThat(cartWithCustomLineItem.getCustomLineItems()).hasSize(1); final CustomLineItem customLineItem = cartWithCustomLineItem.getCustomLineItems().get(0); assertThat(customLineItem.getQuantity()).isEqualTo(5L); final Cart updatedCart = client().executeBlocking(CartUpdateCommand.of(cartWithCustomLineItem, ChangeCustomLineItemQuantity.of(customLineItem, 12L))); assertThat(updatedCart.getCustomLineItems().get(0).getQuantity()).isEqualTo(12L); });
See the test code.
CustomLineItem.getQuantity()
Modifier and Type | Method and Description |
---|---|
String |
getCustomLineItemId() |
long |
getQuantity() |
static UpdateAction<Cart> |
of(CustomLineItem lineItem,
long quantity) |
static ChangeCustomLineItemQuantity |
of(String lineItemId,
long quantity) |
getAction
public String getCustomLineItemId()
public long getQuantity()
public static ChangeCustomLineItemQuantity of(String lineItemId, long quantity)
public static UpdateAction<Cart> of(CustomLineItem lineItem, long quantity)