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

io.sphere.sdk.carts.commands.updateactions.SetCustomShippingMethod Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.carts.commands.updateactions;

import io.sphere.sdk.carts.Cart;
import io.sphere.sdk.commands.UpdateActionImpl;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;
import io.sphere.sdk.shippingmethods.ShippingRate;
import io.sphere.sdk.taxcategories.TaxCategory;

/**
 Sets a custom shipping method (independent of the shipping methods defined in the project). The custom shipping method can be unset with the setShippingMethod action without the shippingMethod.

 {@doc.gen intro}

 {@include.example io.sphere.sdk.carts.commands.CartUpdateCommandTest#setCustomShippingMethod()}
 */
public class SetCustomShippingMethod extends UpdateActionImpl {

    private final String shippingMethodName;
    private final ShippingRate shippingRate;
    private final Reference taxCategory;

    private SetCustomShippingMethod(final String shippingMethodName, final ShippingRate shippingRate,
                                   final Referenceable taxCategory) {
        super("setCustomShippingMethod");
        this.shippingMethodName = shippingMethodName;
        this.shippingRate = shippingRate;
        this.taxCategory = taxCategory.toReference();
    }

    public static SetCustomShippingMethod of(final String shippingMethodName, final ShippingRate shippingRate,
                                      final Referenceable taxCategory) {
        return new SetCustomShippingMethod(shippingMethodName, shippingRate, taxCategory);
    }

    public String getShippingMethodName() {
        return shippingMethodName;
    }

    public ShippingRate getShippingRate() {
        return shippingRate;
    }

    public Reference getTaxCategory() {
        return taxCategory;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy