Search in sources :

Example 1 with BandedWeightFulfillmentOptionImpl

use of org.broadleafcommerce.core.order.fulfillment.domain.BandedWeightFulfillmentOptionImpl in project BroadleafCommerce by BroadleafCommerce.

the class BandedPriceFulfillmentTest method createWeightBands.

protected BandedWeightFulfillmentOption createWeightBands(String[] minimumAmounts, String[] resultAmounts, FulfillmentBandResultAmountType[] resultAmountTypes) {
    if ((minimumAmounts.length != resultAmounts.length) || (resultAmounts.length != resultAmountTypes.length)) {
        throw new IllegalStateException("All lists should be the same length");
    }
    List<FulfillmentWeightBand> bands = new ArrayList<FulfillmentWeightBand>();
    for (int i = 0; i < minimumAmounts.length; i++) {
        FulfillmentWeightBand band = new FulfillmentWeightBandImpl();
        band.setMinimumWeight(new BigDecimal(minimumAmounts[i]));
        band.setWeightUnitOfMeasure(WeightUnitOfMeasureType.POUNDS);
        band.setResultAmount(new BigDecimal(resultAmounts[i]));
        band.setResultAmountType(resultAmountTypes[i]);
        bands.add(band);
    }
    BandedWeightFulfillmentOption option = new BandedWeightFulfillmentOptionImpl();
    option.setBands(bands);
    return option;
}
Also used : FulfillmentWeightBandImpl(org.broadleafcommerce.core.order.fulfillment.domain.FulfillmentWeightBandImpl) ArrayList(java.util.ArrayList) BandedWeightFulfillmentOption(org.broadleafcommerce.core.order.fulfillment.domain.BandedWeightFulfillmentOption) FulfillmentWeightBand(org.broadleafcommerce.core.order.fulfillment.domain.FulfillmentWeightBand) BigDecimal(java.math.BigDecimal) BandedWeightFulfillmentOptionImpl(org.broadleafcommerce.core.order.fulfillment.domain.BandedWeightFulfillmentOptionImpl)

Aggregations

BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1 BandedWeightFulfillmentOption (org.broadleafcommerce.core.order.fulfillment.domain.BandedWeightFulfillmentOption)1 BandedWeightFulfillmentOptionImpl (org.broadleafcommerce.core.order.fulfillment.domain.BandedWeightFulfillmentOptionImpl)1 FulfillmentWeightBand (org.broadleafcommerce.core.order.fulfillment.domain.FulfillmentWeightBand)1 FulfillmentWeightBandImpl (org.broadleafcommerce.core.order.fulfillment.domain.FulfillmentWeightBandImpl)1