@Test public void testTotal() throws Exception { final ExtendedModelMap model = new ExtendedModelMap(); miniCartComponentModel.setTotalDisplay(CartTotalDisplayType.TOTAL); given(cmsComponentService.getAbstractCMSComponent(TEST_COMPONENT_UID)) .willReturn(miniCartComponentModel); miniCartComponentController.handleGet(request, response, model); final PriceData priceData = (PriceData) model.get(MiniCartComponentController.TOTAL_PRICE); Assert.assertEquals(TOTAL_VALUE, priceData.getValue()); }
@Test public void testTotalWithoutDelivery() throws Exception { final ExtendedModelMap model = new ExtendedModelMap(); miniCartComponentModel.setTotalDisplay(CartTotalDisplayType.TOTAL_WITHOUT_DELIVERY); given(cmsComponentService.getSimpleCMSComponent(TEST_COMPONENT_UID)) .willReturn(miniCartComponentModel); miniCartComponentController.handleGet(request, response, model); final PriceData priceData = (PriceData) model.get(MiniCartComponentController.TOTAL_NO_DELIVERY); Assert.assertEquals(TOTAL_VALUE.subtract(DELIVERY_VALUE), priceData.getValue()); }
protected void calculateRefundAmount() { BigDecimal refundAmountValue = BigDecimal.ZERO; PriceData totalPrice = null; for (final ConsignmentEntryData consignmentEntry : getConsignment().getEntries()) { totalPrice = consignmentEntry.getOrderEntry().getTotalPrice(); refundAmountValue = refundAmountValue.add(totalPrice.getValue()); } if (totalPrice != null) { refundAmount = getPriceDataFactory() .create(totalPrice.getPriceType(), refundAmountValue, totalPrice.getCurrencyIso()); } }