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

io.sphere.sdk.carts.commands.updateactions.AddDiscountCode 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.discountcodes.DiscountCode;

/**
 * Adds a discount code to the cart.
 *
 *  {@doc.gen intro}
 *
 *  {@include.example io.sphere.sdk.carts.commands.CartUpdateCommandTest#removeDiscountCode()}
 */
public class AddDiscountCode extends UpdateActionImpl {
    private final String code;

    private AddDiscountCode(final String code) {
        super("addDiscountCode");
        this.code = code;
    }

    public static AddDiscountCode of(final DiscountCode code) {
        return of(code.getCode());
    }

    public static AddDiscountCode of(final String code) {
        return new AddDiscountCode(code);
    }

    public String getCode() {
        return code;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy