public final class SetLineItemPrice extends UpdateActionImpl<Cart>
See also CartInStoreUpdateCommand.
withFilledCart(client(), (Cart cart) -> { final LineItem originalLineItem = cart.getLineItems().get(0); assertThat(originalLineItem.getPrice().getValue()).isEqualTo(MoneyImpl.ofCents(1234, EUR)); assertThat(originalLineItem.getTotalPrice()).isEqualTo(MoneyImpl.ofCents(3702, EUR)); assertThat(originalLineItem.getQuantity()).isEqualTo(3L); assertThat(originalLineItem.getPriceMode()).isEqualTo(LineItemPriceMode.PLATFORM); final String lineItemId = originalLineItem.getId(); final MonetaryAmount externalPrice = EURO_30; final SetLineItemPrice updateAction = SetLineItemPrice.of(lineItemId, externalPrice); final Cart updatedCart = client().executeBlocking(CartUpdateCommand.of(cart, updateAction)); final LineItem lineItem = updatedCart.getLineItems().get(0); assertThat(lineItem.getPrice().getValue()).isEqualTo(externalPrice); assertThat(lineItem.getPriceMode()).isEqualTo(LineItemPriceMode.EXTERNAL_PRICE); });
See the test code.
Modifier and Type | Method and Description |
---|---|
javax.money.MonetaryAmount |
getExternalPrice() |
String |
getLineItemId() |
static SetLineItemPrice |
of(LineItem lineItem) |
static SetLineItemPrice |
of(LineItem lineItem,
javax.money.MonetaryAmount externalPrice) |
static SetLineItemPrice |
of(String lineItemId) |
static SetLineItemPrice |
of(String lineItemId,
javax.money.MonetaryAmount externalPrice) |
getAction
public static SetLineItemPrice of(LineItem lineItem)
public static SetLineItemPrice of(String lineItemId)
public static SetLineItemPrice of(LineItem lineItem, @Nullable javax.money.MonetaryAmount externalPrice)
public static SetLineItemPrice of(String lineItemId, @Nullable javax.money.MonetaryAmount externalPrice)
public String getLineItemId()
@Nullable public javax.money.MonetaryAmount getExternalPrice()