public final class ChangeCustomLineItemMoney 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.getMoney()
Modifier and Type | Method and Description |
---|---|
String |
getCustomLineItemId() |
javax.money.MonetaryAmount |
getMoney() |
static UpdateAction<Cart> |
of(CustomLineItem lineItem,
javax.money.MonetaryAmount money) |
static ChangeCustomLineItemMoney |
of(String lineItemId,
javax.money.MonetaryAmount money) |
getAction
public String getCustomLineItemId()
public javax.money.MonetaryAmount getMoney()
public static ChangeCustomLineItemMoney of(String lineItemId, javax.money.MonetaryAmount money)
public static UpdateAction<Cart> of(CustomLineItem lineItem, javax.money.MonetaryAmount money)