public final class SetProductPriceCustomType extends SetCustomTypeBase<Product>
See also ProductUpdateCommand.
withUpdateableType(client(), type -> { withUpdateablePricedProduct(client(), product -> { final String priceId = getFirstPrice(product).getId(); final UpdateAction<Product> updateAction = SetProductPriceCustomType. ofTypeIdAndObjects(type.getId(), STRING_FIELD_NAME, "a value", priceId); final ProductUpdateCommand productUpdateCommand = ProductUpdateCommand.of(product, updateAction); final Product updatedProduct = client().executeBlocking(productUpdateCommand); final Price price = getFirstPrice(updatedProduct); assertThat(price.getCustom().getFieldAsString(STRING_FIELD_NAME)) .isEqualTo("a value"); final Product updated2 = client().executeBlocking(ProductUpdateCommand.of(updatedProduct, SetProductPriceCustomField.ofObject(STRING_FIELD_NAME, "a new value", priceId))); assertThat(getFirstPrice(updated2).getCustom().getFieldAsString(STRING_FIELD_NAME)) .isEqualTo("a new value"); return updated2; }); return type; });
See the test code.
Custom
getFields, getType, mapObjectToJsonMap
getAction
public static SetProductPriceCustomType ofTypeKeyAndObjects(String typeKey, Map<String,Object> fields, String priceId)
public static SetProductPriceCustomType ofTypeKeyAndObjects(String typeKey, Map<String,Object> fields, String priceId, @Nullable Boolean staged)
public static SetProductPriceCustomType ofTypeIdAndObjects(String typeId, Map<String,Object> fields, String priceId)
public static SetProductPriceCustomType ofTypeIdAndObjects(String typeId, Map<String,Object> fields, String priceId, @Nullable Boolean staged)
public static SetProductPriceCustomType ofTypeIdAndObjects(String typeId, String fieldName, Object value, String priceId)
public static SetProductPriceCustomType ofTypeIdAndObjects(String typeId, String fieldName, Object value, String priceId, @Nullable Boolean staged)
public static SetProductPriceCustomType ofTypeIdAndJson(String typeId, Map<String,com.fasterxml.jackson.databind.JsonNode> fields, String priceId)
public static SetProductPriceCustomType ofTypeIdAndJson(String typeId, Map<String,com.fasterxml.jackson.databind.JsonNode> fields, String priceId, @Nullable Boolean staged)
public static SetProductPriceCustomType ofTypeKeyAndJson(String typeKey, Map<String,com.fasterxml.jackson.databind.JsonNode> fields, String priceId)
public static SetProductPriceCustomType ofTypeKeyAndJson(String typeKey, Map<String,com.fasterxml.jackson.databind.JsonNode> fields, String priceId, @Nullable Boolean staged)
public static SetProductPriceCustomType ofRemoveType(String priceId)
public static SetProductPriceCustomType ofRemoveType(String priceId, @Nullable Boolean staged)
public String getPriceId()