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 customTypesForLineItems() { withUpdateableType(client(), type -> { withOrderOfCustomLineItems(client(), order -> { final String customLineItemId = order.getCustomLineItems().get(0).getId(); final Order orderWithType = client().executeBlocking(OrderUpdateCommand.of(order, SetCustomLineItemCustomType.ofTypeIdAndObjects(type.getId(), CUSTOM_FIELDS_MAP, customLineItemId))); assertThat(orderWithType.getCustomLineItems().get(0).getCustom().getType()).isEqualTo(type.toReference()); assertThat(orderWithType.getCustomLineItems().get(0).getCustom().getField(STRING_FIELD_NAME, TypeReferences.stringTypeReference())).isEqualTo("hello"); final Order updatedOrder = client().executeBlocking(OrderUpdateCommand.of(orderWithType, SetCustomLineItemCustomField.ofObject(STRING_FIELD_NAME, "other", customLineItemId))); assertThat(updatedOrder.getCustomLineItems().get(0).getCustom().getField(STRING_FIELD_NAME, TypeReferences.stringTypeReference())).isEqualTo("other"); //test clean up client().executeBlocking(OrderUpdateCommand.of(updatedOrder, SetCustomLineItemCustomType.ofRemoveType(customLineItemId))); }); 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); }