public final class ChangePrice extends UpdateActionImpl<T>
See also ProductUpdateCommand.
withUpdateablePricedProduct(client(), product -> {
final PriceDraft newPrice = PriceDraft.of(MoneyImpl.of(234, EUR));
final List<Price> prices = product.getMasterData().getStaged().getMasterVariant()
.getPrices();
assertThat(prices.stream().anyMatch(p -> p.equals(newPrice))).isFalse();
final Product updatedProduct = client()
.executeBlocking(ProductUpdateCommand.of(product, ChangePrice.of(prices.get(0), newPrice)));
final Price actualPrice = getFirstPrice(updatedProduct);
assertThat(PriceDraft.of(actualPrice)).isEqualTo(newPrice);
return updatedProduct;
});
See the test code.
Modifier and Type | Method and Description |
---|---|
PriceDraft |
getPrice() |
String |
getPriceId() |
Boolean |
isStaged() |
static ChangePrice |
of(Price oldPrice,
PriceDraft price) |
static ChangePrice |
of(Price oldPrice,
PriceDraft price,
Boolean staged) |
static ChangePrice |
of(String priceId,
PriceDraft price) |
static ChangePrice |
of(String priceId,
PriceDraft price,
Boolean staged) |
getAction
public String getPriceId()
public PriceDraft getPrice()
public static ChangePrice of(Price oldPrice, PriceDraft price)
public static ChangePrice of(Price oldPrice, PriceDraft price, @Nullable Boolean staged)
public static ChangePrice of(String priceId, PriceDraft price)
public static ChangePrice of(String priceId, PriceDraft price, @Nullable Boolean staged)