public final class RemoveCustomLineItem 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);
final Cart emptyCart = client().executeBlocking(CartUpdateCommand.of(cartWithCustomLineItem, RemoveCustomLineItem.of(customLineItem)));
assertThat(emptyCart.getCustomLineItems()).hasSize(0);
});
See the test code.
Modifier and Type | Method and Description |
---|---|
String |
getCustomLineItemId() |
static RemoveCustomLineItem |
of(CustomLineItem customLineItem) |
static RemoveCustomLineItem |
of(String customLineItemId) |
getAction
public static RemoveCustomLineItem of(String customLineItemId)
public static RemoveCustomLineItem of(CustomLineItem customLineItem)
public String getCustomLineItemId()