public class Order
extends java.lang.Object
isNet()) and the current currency (getCurrency()) has to be provided during
creation. After this point LineItem or other objects can be created with a different Currency but
when adding it tho the current Order a CurrenciesAreNotEqualException is thrown.
The getTotal...() methods returns the overall calculated Money for the different line item posts or taxes. With
get...Values() a map is returned which shows the concrete single amount for each charge/discount/tax.| Constructor and Description |
|---|
Order(Currency currency,
boolean isNet,
CalculationStrategies calculationStrategies)
Creates a new order calculation object based on a specific currency and bet/gross mode.
|
Order(Currency currency,
CalculationStrategies calculationStrategies)
Creates a new gross order calculation object based on a specific currency.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCharge(int index,
OrderCharge aoc)
Assigns a single charge to this order at a specific position.
|
void |
addCharge(OrderCharge aoc)
Assigns a single charge to this order.
|
void |
addCharges(java.util.List<OrderCharge> charges)
Assigns multiple charges to this order.
|
void |
addCharges(OrderCharge... charges)
Assigns multiple charges to this order.
|
void |
addDiscount(int index,
OrderDiscount discount)
Assigns a discount to this order at a speific position.
|
void |
addDiscount(OrderDiscount discount)
Assigns a discount to this order.
|
void |
addDiscounts(java.util.List<OrderDiscount> discounts)
Assigns multiple discounts to this order.
|
void |
addDiscounts(OrderDiscount... discounts)
Assigns multiple discounts to this order.
|
void |
addLineItem(int index,
LineItem lineitem)
Attaches a line items to this order at the specified position.
|
void |
addLineItem(LineItem lineitem)
Attaches a line items to this order.
|
void |
addLineItems(LineItem... lineItems)
Attaches multiple line items to this order.
|
void |
addLineItems(java.util.List<LineItem> lineItems)
Attaches multiple line items to this order.
|
void |
addTax(Tax tax)
Assigns a tax to this order.
|
void |
addTaxes(java.util.Collection<Tax> taxes)
Assigns multiple taxes to this order.
|
void |
addTaxes(Tax... taxes)
Assigns multiple taxes to this order.
|
protected Money |
calculateOrderCharge(Money currentValue,
OrderCharge addCharge) |
protected Money |
calculateOrderDiscount(Money currentValue,
OrderDiscount discount)
Calculates order discount
|
protected Money |
calculateTaxTotal(Tax tax,
double autoTaxCorrectionFactor) |
void |
clearCharges()
Removes all assigned charges from this order.
|
void |
clearDiscounts()
Removes all assigned discounts from this order.
|
void |
clearLineItems()
Removes all attached line items.
|
void |
clearTaxes()
Removes all attached taxes from this order.
|
protected double |
getAutomaticTaxCorrectionFactor() |
CalculationStrategies |
getCalculationStrategies()
Delegate to all necessary strategies.
|
java.util.List<OrderCharge> |
getCharges()
Returns all charges assigned to this order.
|
Currency |
getCurrency()
Returns the currency which this order is being calculated for.
|
java.util.List<OrderDiscount> |
getDiscounts()
Returns all discounts attached to this order.
|
protected Money |
getFixedTaxedAdditionalCharges(java.util.Map<OrderCharge,Money> aocValues) |
java.util.List<LineItem> |
getLineItems()
Returns all line items attached to this order.
|
Money |
getSubTotal()
Calculates the sum of all line item totals (
LineItem.getTotal(Order)). |
java.util.Collection<Tax> |
getTaxes()
Returns all taxes assigned to this order.
|
java.util.Collection<Tax> |
getTaxesFor(Taxable object)
|
Money |
getTotal()
Calculates the order total.
|
Money |
getTotalCharge()
Calculates the total of all charges which apply to the order at a whole.
|
Money |
getTotalChargeOfType(AbstractCharge.ChargeType chargeType)
Calculates the total of all charges of one specific type which apply to the order at a whole.
|
java.util.Map<OrderCharge,Money> |
getTotalCharges()
Calculates totals of all charges assigned to this order separately.
|
Money |
getTotalDiscount()
Calculates the total of all discounts assigned to this order.
|
java.util.Map<OrderDiscount,Money> |
getTotalDiscounts()
Calculates totals of all discounts assigned to this order separately.
|
Money |
getTotalIncludingTaxes()
Calculates the order total always including taxes.
|
Money |
getTotalTax()
Returns the overall sum of taxes within this order.
|
java.util.Map<Tax,Money> |
getTotalTaxes()
Calculates total taxes for all assigned
Tax object. |
Money |
getTotalTaxFor(Tax tax)
Calculates the total tax for a specific
Tax object. |
boolean |
hasAssignedTaxes(Taxable object) |
boolean |
hasCharges()
Tells whether this order has got assigned charges or not.
|
boolean |
hasDisounts()
Tells whether this order has got assigned discounts or not.
|
boolean |
hasLineItems()
Tells whether or not this order has got line items.
|
boolean |
hasTaxes()
Tells whether this order has got assigned taxes or not.
|
boolean |
isGross() |
boolean |
isNet() |
void |
removeCharge(OrderCharge aoc)
Removes a charge from this order.
|
void |
removeDiscount(OrderDiscount orderDiscount)
Removes a discount from this order.
|
void |
removeLineItem(LineItem lineitem)
Removes a single line item.
|
void |
removeTax(Tax tax)
Removes the given tax from this order.
|
public Order(Currency currency, CalculationStrategies calculationStrategies)
currency - the currency the whole calculation will be incalculationStrategies - some strategiespublic Order(Currency currency, boolean isNet, CalculationStrategies calculationStrategies)
currency - the currency the whole calculation will be inisNet - true for net, false for gross modecalculationStrategies - some strategiespublic Money getTotal()
getTotalIncludingTaxes() will always return the gross total for both modes.public Money getSubTotal()
LineItem.getTotal(Order)).getTotal()public Money getTotalTaxFor(Tax tax)
Tax object.public java.util.Map<Tax,Money> getTotalTaxes()
Tax object.protected double getAutomaticTaxCorrectionFactor()
protected Money getFixedTaxedAdditionalCharges(java.util.Map<OrderCharge,Money> aocValues)
public java.util.Collection<Tax> getTaxesFor(Taxable object)
public boolean hasAssignedTaxes(Taxable object)
public Money getTotalTax()
getTotalTaxes().getTotalTaxes()public Money getTotalCharge()
getTotalCharges(),
#getTotalChargeOfType(ChargeType)public Money getTotalChargeOfType(AbstractCharge.ChargeType chargeType)
chargeType - the type of charge to selectgetTotalCharge(),
getTotalCharges()public Money getTotalDiscount()
getTotalDiscounts()public java.util.Map<OrderCharge,Money> getTotalCharges()
OrderCharge -> Money )public java.util.Map<OrderDiscount,Money> getTotalDiscounts()
OrderDiscount -> Money )protected Money calculateOrderCharge(Money currentValue, OrderCharge addCharge)
protected Money calculateOrderDiscount(Money currentValue, OrderDiscount discount)
currentValue - discount - CurrenciesAreNotEqualExceptionMissingCalculationDataExceptionpublic Money getTotalIncludingTaxes()
getTotal() will show order total without taxes only.public java.util.List<LineItem> getLineItems()
public void addLineItems(LineItem... lineItems)
CurrenciesAreNotEqualException - in case at least one line item has got a base price of different currency than the order currencypublic void addLineItems(java.util.List<LineItem> lineItems)
CurrenciesAreNotEqualException - in case at least one line item has got a base price of different currency than the order currencypublic void addLineItem(LineItem lineitem)
CurrenciesAreNotEqualException - in case the line item has got a base price of different currency than the order currencypublic void addLineItem(int index,
LineItem lineitem)
index - insert the given line item into this position.lineitem - the line item to be addedCurrenciesAreNotEqualException - in case the line item has got a base price of different currency than the order currencypublic void clearLineItems()
public void removeLineItem(LineItem lineitem)
public java.util.Collection<Tax> getTaxes()
public void addTaxes(Tax... taxes)
CurrenciesAreNotEqualException - in case there is at least one absolute tax having a different currency than the one of this orderpublic void addTaxes(java.util.Collection<Tax> taxes)
CurrenciesAreNotEqualException - in case there is at least one absolute tax having a different currency than the one of this orderpublic void addTax(Tax tax)
CurrenciesAreNotEqualException - in case it's a absolute tax having a different currency than the one of this orderpublic void clearTaxes()
public void removeTax(Tax tax)
public java.util.List<OrderDiscount> getDiscounts()
public void addDiscounts(OrderDiscount... discounts)
CurrenciesAreNotEqualException - in case there is at least one absolute discount having a different currency than the one of this orderpublic void addDiscounts(java.util.List<OrderDiscount> discounts)
CurrenciesAreNotEqualException - in case there is at least one absolute discount having a different currency than the one of this orderpublic void addDiscount(OrderDiscount discount)
CurrenciesAreNotEqualException - in case it's a absolute discount having a different currency than the one of this orderpublic void addDiscount(int index,
OrderDiscount discount)
CurrenciesAreNotEqualException - in case it's a absolute discount having a different currency than the one of this orderpublic void clearDiscounts()
public void removeDiscount(OrderDiscount orderDiscount)
public java.util.List<OrderCharge> getCharges()
public void addCharges(OrderCharge... charges)
CurrenciesAreNotEqualException - in case at least one absolute charge is using a different currency than the one used for this orderpublic void addCharges(java.util.List<OrderCharge> charges)
CurrenciesAreNotEqualException - in case at least one absolute charge is using a different currency than the one used for this orderpublic void addCharge(OrderCharge aoc)
CurrenciesAreNotEqualException - in case it's a absolute charge using a different currency than the one used for this orderpublic void addCharge(int index,
OrderCharge aoc)
index - the position to add the charge atCurrenciesAreNotEqualException - in case it's a absolute charge using a different currency than the one used for this orderpublic void clearCharges()
public void removeCharge(OrderCharge aoc)
public boolean hasLineItems()
public boolean hasCharges()
public boolean hasDisounts()
public boolean hasTaxes()
public boolean isNet()
public boolean isGross()
public CalculationStrategies getCalculationStrategies()
public Currency getCurrency()
Copyright © 2018 SAP SE. All Rights Reserved.