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

io.sphere.sdk.productdiscounts.AbsoluteProductDiscount Maven / Gradle / Ivy

The newest version!
package io.sphere.sdk.productdiscounts;

import javax.money.MonetaryAmount;
import java.util.List;

import static java.util.Arrays.asList;

public class AbsoluteProductDiscount extends ProductDiscountValue {
    private final List money;

    private AbsoluteProductDiscount(final List money) {
        this.money = money;
    }

    /**
     * The array contains money values in different currencies. An absolute product discount will only match a price if this array contains a value with the same currency. If it contains 10€ and 15$, the matching € price will be decreased by 10€ and the matching $ price will be decreased by 15$.
     * @return list of discount values
     */
    public List getMoney() {
        return money;
    }

    public static AbsoluteProductDiscount of(final List money) {
        return new AbsoluteProductDiscount(money);
    }

    public static AbsoluteProductDiscount of(final MonetaryAmount money) {
        return new AbsoluteProductDiscount(asList(money));
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy