use of org.broadleafcommerce.core.order.service.call.DiscreteOrderItemRequest in project BroadleafCommerce by BroadleafCommerce.
the class OrderItemServiceImpl method createBundleOrderItem.
@Override
public BundleOrderItem createBundleOrderItem(final BundleOrderItemRequest itemRequest) {
final BundleOrderItem item = (BundleOrderItem) orderItemDao.create(OrderItemType.BUNDLE);
item.setQuantity(itemRequest.getQuantity());
item.setCategory(itemRequest.getCategory());
item.setName(itemRequest.getName());
item.setBundleOrderItemFeePrices(itemRequest.getBundleOrderItemFeePrices());
item.setOrder(itemRequest.getOrder());
if (itemRequest.getSalePriceOverride() != null) {
item.setSalePriceOverride(Boolean.TRUE);
item.setSalePrice(itemRequest.getSalePriceOverride());
item.setBaseSalePrice(itemRequest.getSalePriceOverride());
}
if (itemRequest.getRetailPriceOverride() != null) {
item.setRetailPriceOverride(Boolean.TRUE);
item.setRetailPrice(itemRequest.getRetailPriceOverride());
item.setBaseRetailPrice(itemRequest.getRetailPriceOverride());
}
for (DiscreteOrderItemRequest discreteItemRequest : itemRequest.getDiscreteOrderItems()) {
discreteItemRequest.setBundleOrderItem(item);
DiscreteOrderItem discreteOrderItem;
if (discreteItemRequest instanceof GiftWrapOrderItemRequest) {
discreteOrderItem = createGiftWrapOrderItem((GiftWrapOrderItemRequest) discreteItemRequest);
} else {
discreteOrderItem = createDiscreteOrderItem(discreteItemRequest);
}
item.getDiscreteOrderItems().add(discreteOrderItem);
}
applyAdditionalOrderItemProperties(item);
return item;
}
Aggregations