Examples of BandedPriceFulfillmentOption


Examples of org.broadleafcommerce.core.order.fulfillment.domain.BandedPriceFulfillmentOption

* @author Phillip Verheyden
*/
public class BandedPriceFulfillmentTest extends TestCase {

    public void testPriceBandRate() throws Exception {
        BandedPriceFulfillmentOption option = createPriceBands(new String[] { "10", "20", "30" },
                new String[] { "10", "20", "30" },
                new FulfillmentBandResultAmountType[] { FulfillmentBandResultAmountType.RATE,
                        FulfillmentBandResultAmountType.RATE,
                        FulfillmentBandResultAmountType.RATE });
        assertEquals(new Money("20.00"), calculationResponse(option, createCandidateOrder(new BigDecimal("20.00"), 2, option)));
View Full Code Here

Examples of org.broadleafcommerce.core.order.fulfillment.domain.BandedPriceFulfillmentOption

        assertEquals(new Money("20.00"), calculationResponse(option, createCandidateOrder(new BigDecimal("25.00"), 5, option)));
        assertEquals(new Money("30.00"), calculationResponse(option, createCandidateOrder(new BigDecimal("100.00"), 5, option)));
    }

    public void testMinimumAmountsWithZero() throws Exception {
        BandedPriceFulfillmentOption option = createPriceBands(new String[] { "0", "20", "30" },
                new String[] { "10", "20", "30" },
                new FulfillmentBandResultAmountType[] { FulfillmentBandResultAmountType.RATE,
                        FulfillmentBandResultAmountType.RATE,
                        FulfillmentBandResultAmountType.RATE });
        assertEquals(new Money("20.00"), calculationResponse(option, createCandidateOrder(new BigDecimal("20.00"), 2, option)));
View Full Code Here

Examples of org.broadleafcommerce.core.order.fulfillment.domain.BandedPriceFulfillmentOption

        assertEquals(new Money("20.00"), calculationResponse(option, createCandidateOrder(new BigDecimal("25.00"), 5, option)));
        assertEquals(new Money("30.00"), calculationResponse(option, createCandidateOrder(new BigDecimal("100.00"), 5, option)));
    }

    public void testPriceBandPercentage() throws Exception {
        BandedPriceFulfillmentOption option = createPriceBands(new String[] { "10", "30", "20" },
                new String[] { ".10", ".20", ".30" },
                new FulfillmentBandResultAmountType[] { FulfillmentBandResultAmountType.PERCENTAGE,
                        FulfillmentBandResultAmountType.PERCENTAGE,
                        FulfillmentBandResultAmountType.PERCENTAGE });
View Full Code Here

Examples of org.broadleafcommerce.core.order.fulfillment.domain.BandedPriceFulfillmentOption

        assertEquals(new Money("7.50"), calculationResponse(option, createCandidateOrder(new BigDecimal("25.00"), 5, option)));
        assertEquals(new Money("20.00"), calculationResponse(option, createCandidateOrder(new BigDecimal("100.00"), 5, option)));
    }

    public void testPriceBandRatesWithPercentages() throws Exception {
        BandedPriceFulfillmentOption option = createPriceBands(new String[] { "150", "30", "20", "150", "10", "9", "80" },
                new String[] { "50", "20", ".30", "20", ".10", "5", ".5" },
                new FulfillmentBandResultAmountType[] { FulfillmentBandResultAmountType.RATE,
                        FulfillmentBandResultAmountType.RATE,
                        FulfillmentBandResultAmountType.PERCENTAGE,
                        FulfillmentBandResultAmountType.RATE,
View Full Code Here

Examples of org.broadleafcommerce.core.order.fulfillment.domain.BandedPriceFulfillmentOption

    /**
     * If the retail price sum falls within 2 bands but with the same retail minimum, the lowest price should be selected
     */
    public void testLowestPriceSelection() throws Exception {
        BandedPriceFulfillmentOption option = createPriceBands(new String[] { "10", "10", "10" },
                new String[] { "30", "20", "10" },
                new FulfillmentBandResultAmountType[] { FulfillmentBandResultAmountType.RATE,
                        FulfillmentBandResultAmountType.RATE,
                        FulfillmentBandResultAmountType.RATE });
        assertEquals(calculationResponse(option, createCandidateOrder(new BigDecimal("10.00"), 2, option)), new Money("10.00"));
View Full Code Here

Examples of org.broadleafcommerce.core.order.fulfillment.domain.BandedPriceFulfillmentOption

                        FulfillmentBandResultAmountType.RATE });
        assertEquals(calculationResponse(option, createCandidateOrder(new BigDecimal("10.00"), 2, option)), new Money("10.00"));
    }

    public void testFlatRatesExclusive() throws Exception {
        BandedPriceFulfillmentOption option = createPriceBands(new String[] { "100" },
                new String[] { "30" },
                new FulfillmentBandResultAmountType[] { FulfillmentBandResultAmountType.RATE });

        assertEquals(new Money("45"), calculationResponse(option, createCandidateOrder(new BigDecimal("18.00"), 3, new String[] { "10", "15", "20" }, null, option)));
        assertEquals(new Money("5"), calculationResponse(option, createCandidateOrder(new BigDecimal("80.00"), 1, new String[] { "5" }, null, option)));
View Full Code Here

Examples of org.broadleafcommerce.core.order.fulfillment.domain.BandedPriceFulfillmentOption

        assertEquals(new Money("5"), calculationResponse(option, createCandidateOrder(new BigDecimal("80.00"), 1, new String[] { "5" }, null, option)));
        assertEquals(new Money("10"), calculationResponse(option, createCandidateOrder(new BigDecimal("18.00"), 2, new String[] { "8", "2" }, null, option)));
    }

    public void testFlatRatesWithBands() throws Exception {
        BandedPriceFulfillmentOption option = createPriceBands(new String[] { "30", "20", "10" },
                new String[] { "30", "20", "10" },
                new FulfillmentBandResultAmountType[] { FulfillmentBandResultAmountType.RATE,
                        FulfillmentBandResultAmountType.RATE,
                        FulfillmentBandResultAmountType.RATE });
        assertEquals(new Money("35"), calculationResponse(option, createCandidateOrder(new BigDecimal("18.00"), 6, new String[] { "10", "15" }, null, option)));
View Full Code Here

Examples of org.broadleafcommerce.core.order.fulfillment.domain.BandedPriceFulfillmentOption

            band.setResultAmountType(resultAmountTypes[i]);

            bands.add(band);
        }

        BandedPriceFulfillmentOption option = new BandedPriceFulfillmentOptionImpl();
        option.setBands(bands);
        return option;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.