public static AddCustomLineItem of(final LocalizedString name, final String slug, final MonetaryAmount money, final Referenceable<TaxCategory> taxCategory, final long quantity) { return of(name, slug, money, taxCategory, quantity, null); }
public AddCustomLineItem withExternalTaxRate(@Nullable final ExternalTaxRateDraft externalTaxRate) { return new AddCustomLineItem(getName(), getSlug(), getMoney(), getTaxCategory(), getQuantity(), getCustom(), externalTaxRate); } }
public static AddCustomLineItem of(final LocalizedStrings name, final String slug, final MonetaryAmount money, final Referenceable<TaxCategory> taxCategory, final long quantity) { return new AddCustomLineItem(name, slug, money, taxCategory, quantity); }
@Test public void creation() { withUpdateableType(client(), type -> { withCartAndTaxedProduct(client(), (cart, product) -> { final CustomFieldsDraft customFieldsDraft = CustomFieldsDraftBuilder .ofType(type) .addObject(STRING_FIELD_NAME, "a value") .build(); final AddCustomLineItem updateAction = AddCustomLineItem.of(en("custom line item"), "foo", EURO_30, product.getTaxCategory(), 3L).withCustom(customFieldsDraft); final Cart updatedCart = client().executeBlocking(CartUpdateCommand.of(cart, updateAction)); final CustomFields customFields = updatedCart.getCustomLineItems().get(0).getCustom(); assertThat(customFields.getFieldAsString(STRING_FIELD_NAME)).isEqualTo("a value"); return updatedCart; }); return type; }); }
public static AddCustomLineItem of(final LocalizedStrings name, final String slug, final MonetaryAmount money, final Referenceable<TaxCategory> taxCategory, final int quantity) { return new AddCustomLineItem(name, slug, money, taxCategory, quantity); }
public AddCustomLineItem withCustom(@Nullable final CustomFieldsDraft custom) { return new AddCustomLineItem(getName(), getSlug(), getMoney(), getTaxCategory(), getQuantity(), custom, getExternalTaxRate()); }
public static AddCustomLineItem of(final LocalizedString name, final String slug, final MonetaryAmount money, final Referenceable<TaxCategory> taxCategory, final long quantity) { return of(name, slug, money, taxCategory, quantity, null); }
public static AddCustomLineItem of(final LocalizedString name, final String slug, final MonetaryAmount money, final ResourceIdentifier<TaxCategory> taxCategory, final long quantity, @Nullable final CustomFieldsDraft custom) { return new AddCustomLineItem(name, slug, money, taxCategory, quantity, custom, null); }
public AddCustomLineItem withExternalTaxRate(@Nullable final ExternalTaxRateDraft externalTaxRate) { return new AddCustomLineItem(getName(), getSlug(), getMoney(), getTaxCategory(), getQuantity(), getCustom(), externalTaxRate); } }
public static AddCustomLineItem of(final LocalizedString name, final String slug, final MonetaryAmount money, final Referenceable<TaxCategory> taxCategory, final long quantity) { return of(name, slug, money, taxCategory, quantity, null); }
public static AddCustomLineItem of(final LocalizedString name, final String slug, final MonetaryAmount money, final Referenceable<TaxCategory> taxCategory, final long quantity, @Nullable final CustomFieldsDraft custom) { return new AddCustomLineItem(name, slug, money, taxCategory, quantity, custom); }
public AddCustomLineItem withCustom(@Nullable final CustomFieldsDraft custom) { return new AddCustomLineItem(getName(), getSlug(), getMoney(), getTaxCategory(), getQuantity(), custom); } }
public static AddCustomLineItem of(final CustomLineItemDraft draft) { return of(draft.getName(), draft.getSlug(), draft.getMoney(), draft.getTaxCategory(), draft.getQuantity()); }
public static AddCustomLineItem of(final LocalizedString name, final String slug, final MonetaryAmount money, final ResourceIdentifier<TaxCategory> taxCategory, final long quantity, @Nullable final CustomFieldsDraft custom) { return new AddCustomLineItem(name, slug, money, taxCategory, quantity, custom, null); }
public AddCustomLineItem withCustom(@Nullable final CustomFieldsDraft custom) { return new AddCustomLineItem(getName(), getSlug(), getMoney(), getTaxCategory(), getQuantity(), custom, getExternalTaxRate()); }
public static AddCustomLineItem of(final CustomLineItemDraft draft) { return of(draft.getName(), draft.getSlug(), draft.getMoney(), draft.getTaxCategory(), draft.getQuantity()); }
public static AddCustomLineItem of(final LocalizedString name, final String slug, final MonetaryAmount money, final Referenceable<TaxCategory> taxCategory, final long quantity, @Nullable final CustomFieldsDraft custom) { return new AddCustomLineItem(name, slug, money, taxCategory != null ? taxCategory.toResourceIdentifier() : null, quantity, custom, null); }
public static AddCustomLineItem of(final CustomLineItemDraft draft) { return of(draft.getName(), draft.getSlug(), draft.getMoney(), draft.getTaxCategory(), draft.getQuantity(), draft.getCustom()); }
public static AddCustomLineItem of(final LocalizedString name, final String slug, final MonetaryAmount money, final Referenceable<TaxCategory> taxCategory, final long quantity, @Nullable final CustomFieldsDraft custom) { return new AddCustomLineItem(name, slug, money, taxCategory != null ? taxCategory.toResourceIdentifier() : null, quantity, custom, null); }
@Test public void changeCustomLineItemQuantity() throws Exception { withTaxCategory(client(), taxCategory -> { final Cart cart = createCartWithCountry(client()); assertThat(cart.getCustomLineItems()).hasSize(0); final CustomLineItemDraft draftItem = createCustomLineItemDraft(taxCategory); final Cart cartWithCustomLineItem = client().executeBlocking(CartUpdateCommand.of(cart, AddCustomLineItem.of(draftItem))); assertThat(cartWithCustomLineItem.getCustomLineItems()).hasSize(1); final CustomLineItem customLineItem = cartWithCustomLineItem.getCustomLineItems().get(0); assertThat(customLineItem.getQuantity()).isEqualTo(5L); final Cart updatedCart = client().executeBlocking(CartUpdateCommand.of(cartWithCustomLineItem, ChangeCustomLineItemQuantity.of(customLineItem, 12L))); assertThat(updatedCart.getCustomLineItems().get(0).getQuantity()).isEqualTo(12L); }); }