private static void removeLineItemFromOrder(LineItemDomain lineItem, OrderDomain order) { if (order.getLineItems().remove(lineItem)) { order.setGrossValue(order.getGrossValue() - lineItem.getGrossValue()); order.setNetValue(order.getNetValue() - lineItem.getNetValue()); order.setGeneralDiscount(order.getGeneralDiscount() - lineItem.getGeneralDiscount()); } }
private static void addLineItemIntoOrder(LineItemDomain lineItem, OrderDomain order) { if (order.getLineItems().add(lineItem)) { order.setGrossValue(order.getGrossValue() + lineItem.getGrossValue()); order.setNetValue(order.getNetValue() + lineItem.getNetValue()); order.setGeneralDiscount(order.getGeneralDiscount() + lineItem.getGeneralDiscount()); } }
public static void archiveLineItem(OrderDomain order, LineItemDomain item) throws Exception { final LineItem dfpItem = performLineItemAction(item, new ArchiveLineItems()); item.setArchived(dfpItem.getIsArchived()); if (item.isArchived()) { order.setGrossValue(order.getGrossValue() - item.getGrossValue()); order.setNetValue(order.getNetValue() - item.getNetValue()); order.setGeneralDiscount(order.getGeneralDiscount() - item.getGeneralDiscount()); } }