public static SetCustomLineItemCustomField ofJson(final String name, final JsonNode value, final String customLineItemId) { return new SetCustomLineItemCustomField(name, value, customLineItemId); }
public static SetCustomLineItemCustomField ofUnset(final String name, final String customLineItemId) { return ofJson(name, null, customLineItemId); }
@Test public void setCustomType() { withUpdateableType(client(), type -> { withLineItemAndCustomLineItemFilledCart(client(), cart -> { final String customLineItemId = cart.getCustomLineItems().get(0).getId(); final SetCustomLineItemCustomType updateAction = SetCustomLineItemCustomType. ofTypeIdAndObjects(type.getId(), STRING_FIELD_NAME, "a value", customLineItemId); final CartUpdateCommand cartUpdateCommand = CartUpdateCommand.of(cart, updateAction); final Cart updatedCart = client().executeBlocking(cartUpdateCommand); final CustomLineItem lineItem = updatedCart.getCustomLineItems().get(0); assertThat(lineItem.getCustom().getField(STRING_FIELD_NAME, TypeReferences.stringTypeReference())) .isEqualTo("a value"); final Cart updated2 = client().executeBlocking(CartUpdateCommand.of(updatedCart, SetCustomLineItemCustomField.ofObject(STRING_FIELD_NAME, "a new value", lineItem.getId()))); assertThat(updated2.getCustomLineItems().get(0).getCustom().getField(STRING_FIELD_NAME, TypeReferences.stringTypeReference())) .isEqualTo("a new value"); return updated2; }); return type; }); } }
public static SetCustomLineItemCustomField ofUnset(final String name, final String customLineItemId) { return ofJson(name, null, customLineItemId); }
public static SetCustomLineItemCustomField ofJson(final String name, final JsonNode value, final String customLineItemId) { return new SetCustomLineItemCustomField(name, value, customLineItemId); }
public static SetCustomLineItemCustomField ofUnset(final String name, final String customLineItemId) { return ofJson(name, null, customLineItemId); }
public static SetCustomLineItemCustomField ofJson(final String name, final JsonNode value, final String customLineItemId) { return new SetCustomLineItemCustomField(name, value, customLineItemId); }
public static SetCustomLineItemCustomField ofObject(final String name, final Object value, final String customLineItemId) { final JsonNode jsonNode = SphereJsonUtils.toJsonNode(value); return ofJson(name, jsonNode, customLineItemId); }
public static SetCustomLineItemCustomField ofObject(final String name, final Object value, final String customLineItemId) { final JsonNode jsonNode = SphereJsonUtils.toJsonNode(value); return ofJson(name, jsonNode, customLineItemId); }
public static SetCustomLineItemCustomField ofObject(final String name, final Object value, final String customLineItemId) { final JsonNode jsonNode = SphereJsonUtils.toJsonNode(value); return ofJson(name, jsonNode, customLineItemId); }