All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.carts.CustomLineItemDraft Maven / Gradle / Ivy

There is a newer version: 2.16.0
Show newest version
package io.sphere.sdk.carts;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.sphere.sdk.models.LocalizedString;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;
import io.sphere.sdk.taxcategories.TaxCategory;
import io.sphere.sdk.types.CustomDraft;
import io.sphere.sdk.types.CustomFieldsDraft;

import javax.annotation.Nullable;
import javax.money.MonetaryAmount;

/**
 * 

Draft for adding a custom line item to the cart.

* *

Example for adding a {@link CustomLineItem} to a {@link Cart}:

{@include.example io.sphere.sdk.carts.commands.CartUpdateCommandIntegrationTest#addCustomLineItem()} @see CustomLineItem */ @JsonDeserialize(as = CustomLineItemDraftImpl.class) public interface CustomLineItemDraft extends CustomDraft { LocalizedString getName(); MonetaryAmount getMoney(); String getSlug(); Reference getTaxCategory(); Long getQuantity(); @Nullable @Override CustomFieldsDraft getCustom(); static CustomLineItemDraft of(final LocalizedString name, final String slug, final MonetaryAmount money, final Referenceable taxCategory, final long quantity) { return of(name, slug, money, taxCategory, quantity, null); } static CustomLineItemDraft of(final LocalizedString name, final String slug, final MonetaryAmount money, final Referenceable taxCategory, final long quantity, @Nullable final CustomFieldsDraft custom) { return new CustomLineItemDraftImpl(name, slug, money, taxCategory.toReference(), quantity, custom); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy