public final class RemoveDiscountCode extends UpdateActionImpl<Cart>
See also CartInStoreUpdateCommand.
withCartAndDiscountCode(client(), (cart, discountCode) -> { //addDiscountCode final Cart cartWithCode = client().executeBlocking(CartUpdateCommand.of(cart, AddDiscountCode.of(discountCode))); final DiscountCodeInfo discountCodeInfo = cartWithCode.getDiscountCodes().get(0); assertThat(discountCodeInfo.getDiscountCode()).isEqualTo(discountCode.toReference()); //removeDiscountCode final Cart updatedCart = client().executeBlocking(CartUpdateCommand.of(cartWithCode, RemoveDiscountCode.of(discountCode))); assertThat(updatedCart.getDiscountCodes()).isEmpty(); return updatedCart; });
See the test code.
Modifier and Type | Method and Description |
---|---|
Reference<DiscountCode> |
getDiscountCode() |
static RemoveDiscountCode |
of(Referenceable<DiscountCode> discountCode) |
getAction
public static RemoveDiscountCode of(Referenceable<DiscountCode> discountCode)
public Reference<DiscountCode> getDiscountCode()