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

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

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

import com.fasterxml.jackson.annotation.JsonCreator;
import io.sphere.sdk.models.SphereEnumeration;
import io.sphere.sdk.taxcategories.TaxCategory;

public enum TaxMode implements SphereEnumeration {
    /**
     * The tax rates are selected by the platform from the {@link TaxCategory tax categories} based on the cart shipping address.
     */
    PLATFORM,

    /**
     * The tax rates are set externally. A cart with this tax mode can only be ordered if all line items, all custom line items and the shipping method have an external tax rate set.
     *
     * 

Create a cart with external tax mode

* *

Cart creation with line item

* * {@include.example io.sphere.sdk.carts.ExternalTaxRatesIntegrationTest#createCartWithALineItemWithAnExternalTaxRate()} * *

Create empty cart

* * {@include.example io.sphere.sdk.carts.ExternalTaxRatesIntegrationTest#createEmptyCart()} * *

Add a LineItem with an external tax rate

* * {@include.example io.sphere.sdk.carts.ExternalTaxRatesIntegrationTest#addLineItem()} * *

Error case when the cart does not have the external tax but a line item is added

* * {@include.example io.sphere.sdk.carts.ExternalTaxRatesIntegrationTest#addLineItemOnPlatformCart()} * *

Add a LineItem and add the external tax rate later

* * {@include.example io.sphere.sdk.carts.ExternalTaxRatesIntegrationTest#setLineItemTaxRate()} * *

Add a CustomLineItem with an external tax rate

* * {@include.example io.sphere.sdk.carts.ExternalTaxRatesIntegrationTest#addCustomLineItem()} * *

Add a CustomLineItem and add the external tax rate later

* * {@include.example io.sphere.sdk.carts.ExternalTaxRatesIntegrationTest#setCustomLineItemTaxRate()} * *

Add a custom shipping method with an external tax rate

* * {@include.example io.sphere.sdk.carts.ExternalTaxRatesIntegrationTest#addCustomShippingMethod()} * *

Add a custom shipping method and add the external tax rate later

* * {@include.example io.sphere.sdk.carts.ExternalTaxRatesIntegrationTest#setShippingMethodTaxRate()} * *

Change the tax mode of a cart

*

Example

* {@include.example io.sphere.sdk.carts.ExternalTaxRatesIntegrationTest#changeTaxMode()} * *

It fails if the products does not have a tax category set

* {@include.example io.sphere.sdk.carts.ExternalTaxRatesIntegrationTest#errorMovingFromExternalToPlatformTaxMode()} * *

In case you use {@link CustomLineItem}s as well as external and the platform tax mode it is advised to * add the tax category at the time of the creation of the custom line item if you don't know which tax mode will be used later. * A cart with an external tax mode having a custom line item without a tax category cannot transformed into a cart with platform tax calculation, * to recover from this the custom object needs to be removed and added with a tax category.

* */ EXTERNAL, /** * The tax amounts and the tax rates as well as the tax portions are set externally per {@link ExternalTaxAmountDraft}. * * A cart with this tax mode can only be ordered if the cart itself and all line items, * all custom line items and the shipping method have an external tax amount and rate set. */ EXTERNAL_AMOUNT, /** * No taxes are added to the cart. */ DISABLED; @JsonCreator public static TaxMode ofSphereValue(final String value) { return SphereEnumeration.findBySphereName(values(), value).get(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy