Search in sources :

Example 1 with ShoppingCartItemPopulator

use of com.salesmanager.shop.populator.order.ShoppingCartItemPopulator in project shopizer by shopizer-ecommerce.

the class OrderFacadeImpl method calculateOrderTotal.

@Override
public OrderTotalSummary calculateOrderTotal(MerchantStore store, com.salesmanager.shop.model.order.v0.PersistableOrder order, Language language) throws Exception {
    List<PersistableOrderProduct> orderProducts = order.getOrderProductItems();
    ShoppingCartItemPopulator populator = new ShoppingCartItemPopulator();
    populator.setProductAttributeService(productAttributeService);
    populator.setProductService(productService);
    populator.setShoppingCartService(shoppingCartService);
    List<ShoppingCartItem> items = new ArrayList<ShoppingCartItem>();
    for (PersistableOrderProduct orderProduct : orderProducts) {
        ShoppingCartItem item = populator.populate(orderProduct, new ShoppingCartItem(), store, language);
        items.add(item);
    }
    Customer customer = customer(order.getCustomer(), store, language);
    OrderTotalSummary summary = this.calculateOrderTotal(store, customer, order, language);
    return summary;
}
Also used : ShoppingCartItemPopulator(com.salesmanager.shop.populator.order.ShoppingCartItemPopulator) ReadableCustomer(com.salesmanager.shop.model.customer.ReadableCustomer) Customer(com.salesmanager.core.model.customer.Customer) PersistableCustomer(com.salesmanager.shop.model.customer.PersistableCustomer) OrderTotalSummary(com.salesmanager.core.model.order.OrderTotalSummary) ArrayList(java.util.ArrayList) ShoppingCartItem(com.salesmanager.core.model.shoppingcart.ShoppingCartItem) PersistableOrderProduct(com.salesmanager.shop.model.order.PersistableOrderProduct)

Aggregations

Customer (com.salesmanager.core.model.customer.Customer)1 OrderTotalSummary (com.salesmanager.core.model.order.OrderTotalSummary)1 ShoppingCartItem (com.salesmanager.core.model.shoppingcart.ShoppingCartItem)1 PersistableCustomer (com.salesmanager.shop.model.customer.PersistableCustomer)1 ReadableCustomer (com.salesmanager.shop.model.customer.ReadableCustomer)1 PersistableOrderProduct (com.salesmanager.shop.model.order.PersistableOrderProduct)1 ShoppingCartItemPopulator (com.salesmanager.shop.populator.order.ShoppingCartItemPopulator)1 ArrayList (java.util.ArrayList)1