use of org.broadleafcommerce.core.order.fulfillment.domain.BandedPriceFulfillmentOptionImpl in project BroadleafCommerce by BroadleafCommerce.
the class BandedPriceFulfillmentTest method createPriceBands.
/**
* Creates price bands with the given minimum amounts, results and result types. All of the lists should be the same size
* @param minimumAmounts
* @param resultAmounts
* @param resultAmountTypes
* @return
*/
protected BandedPriceFulfillmentOption createPriceBands(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<FulfillmentPriceBand> bands = new ArrayList<FulfillmentPriceBand>();
for (int i = 0; i < minimumAmounts.length; i++) {
FulfillmentPriceBand band = new FulfillmentPriceBandImpl();
band.setRetailPriceMinimumAmount(new BigDecimal(minimumAmounts[i]));
band.setResultAmount(new BigDecimal(resultAmounts[i]));
band.setResultAmountType(resultAmountTypes[i]);
bands.add(band);
}
BandedPriceFulfillmentOption option = new BandedPriceFulfillmentOptionImpl();
option.setBands(bands);
return option;
}
Aggregations