Class TestPriceFactory

java.lang.Object
de.hybris.platform.order.TestPriceFactory
All Implemented Interfaces:
PriceFactory, FindDiscountValuesStrategy, FindPriceStrategy, FindTaxValuesStrategy, ServiceLayerOnlyCalculationVerifier

Price factory implementation for testing order calculation only. It allows to specify prices, taxes and discounts per order/cart entry or per product.

Please not that price info methods are not implemented yet!

Use like this:

 Cart = ...
 CartEntry e1 = ...
 CartEntry e2 = ...

 TestPriceFactory pf = new TestPriceFactory();
 jaloSession.getSessionContext().setPriceFactory(pf);

 // e1 = 5 EUR
 pf.setBasePrice(e1, new PriceValue("EUR", 5, cart.isNet()));
 // e1 = VAT_FULL 19%
 pf.setTaxes(e1, new TaxValue("VAT_FULL", 19, false, null));

 // e2 = 1.5 EUR
 pf.setBasePrice(e2, new PriceValue("EUR", 1.5, cart.isNet()));
 // e2 = VAT_HALF 7%
 pf.setTaxes(e2, new TaxValue("VAT_HALF", 7, false, null));

 cart.calculate();