Package com.clover.sdk.v3.order
Class OrderCalc
- java.lang.Object
-
- com.clover.sdk.v3.order.OrderCalc
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<com.clover.core.internal.calc.Calc.AdditionalChargeSummary>
getAdditionalChargeSummaries(Collection<LineItem> lines)
Get the Additional charges calculated for passed in line itemslong
getDiscountedSubtotal(Collection<LineItem> lines)
com.clover.core.internal.calc.Decimal
getDiscountMultiplier()
long
getLineExtendedPrice(LineItem line)
long
getLineSubtotal(Collection<LineItem> lines)
long
getLineSubtotalBeforeRefunds(Collection<LineItem> lines)
long
getLineSubtotalWithoutDiscounts(Collection<LineItem> lines)
long
getOrderFeePrice(LineItem orderFeeLineItem)
Get an orderFee price based on passed orderFeeLineItem's percentagecom.clover.core.internal.calc.Calc.PaymentDetails
getPaymentDetails(long paymentAmount)
com.clover.core.internal.calc.Calc.PaymentDetails
getPaymentDetails(long paymentAmount, Collection<LineItem> lines)
long
getPriceWithoutVAT(LineItem lineItem)
Pass VAT inclusive price Line Item and get back VAT exclusive pricelong
getPriceWithVAT(LineItem lineItem)
Pass VAT exclusive price Line Item and get back VAT inclusive pricelong
getServiceCharge()
long
getServiceCharge(Collection<LineItem> lines)
long
getTax()
long
getTax(Collection<LineItem> lines)
List<com.clover.core.internal.calc.Calc.TaxSummary>
getTaxSummaries(Collection<LineItem> lines)
List<com.clover.core.internal.calc.Calc.TaxSummary>
getTaxSummariesBeforeRefunds(Collection<LineItem> lines, com.clover.core.internal.calc.Decimal overrideSplitPercent)
Summarize the taxes for the given line items.long
getTip()
long
getTotal(Collection<LineItem> lines)
long
getTotalBeforeRefunds(Collection<LineItem> lines)
long
getTotalOrderFees()
Get the total orderFee amount for given orderlong
getTotalWithTip(Collection<LineItem> lines)
-
-
-
Constructor Detail
-
OrderCalc
public OrderCalc(Order order)
Constructs a new instance to calculate values for the given order. Does not make a copy of the provided order.
-
-
Method Detail
-
getTax
public long getTax()
-
getTax
public long getTax(Collection<LineItem> lines)
-
getTip
public long getTip()
-
getTotal
public long getTotal(Collection<LineItem> lines)
- Returns:
- The order total for the specified line items, which includes the discounted subtotal, service charge, and tax. Note that tip is not included in the total. If an item was refunded or exchanged, then it does not appear in the total.
-
getTotalBeforeRefunds
public long getTotalBeforeRefunds(Collection<LineItem> lines)
- Returns:
- the order total, which includes the discounted subtotal, service charge, and tax. Note that tip is not included in the total. If an item was refunded, then it DOES appear in the total. If an item was exchanged, then it does not appear in the total.
-
getDiscountedSubtotal
public long getDiscountedSubtotal(Collection<LineItem> lines)
-
getLineSubtotal
public long getLineSubtotal(Collection<LineItem> lines)
-
getLineSubtotalBeforeRefunds
public long getLineSubtotalBeforeRefunds(Collection<LineItem> lines)
-
getLineSubtotalWithoutDiscounts
public long getLineSubtotalWithoutDiscounts(Collection<LineItem> lines)
-
getLineExtendedPrice
public long getLineExtendedPrice(LineItem line)
- Returns:
- the line item price without discounts and modifiers.
-
getServiceCharge
public long getServiceCharge()
-
getServiceCharge
public long getServiceCharge(Collection<LineItem> lines)
-
getTotalWithTip
public long getTotalWithTip(Collection<LineItem> lines)
-
getTaxSummaries
public List<com.clover.core.internal.calc.Calc.TaxSummary> getTaxSummaries(Collection<LineItem> lines)
-
getTaxSummariesBeforeRefunds
public List<com.clover.core.internal.calc.Calc.TaxSummary> getTaxSummariesBeforeRefunds(Collection<LineItem> lines, com.clover.core.internal.calc.Decimal overrideSplitPercent)
Summarize the taxes for the given line items. If an item was refunded, still include it. If an item was exchanged, then ignore it.- Parameters:
lines
- for this subset of line itemsoverrideSplitPercent
- optional. if specified, then assume we're computing a partial payment and this percent is the amount of a partial payment.- Returns:
- summary of the given line items at, optionally, the given partial payment percentage
-
getDiscountMultiplier
public com.clover.core.internal.calc.Decimal getDiscountMultiplier()
-
getPaymentDetails
public com.clover.core.internal.calc.Calc.PaymentDetails getPaymentDetails(long paymentAmount)
-
getPaymentDetails
public com.clover.core.internal.calc.Calc.PaymentDetails getPaymentDetails(long paymentAmount, Collection<LineItem> lines)
-
getPriceWithoutVAT
public long getPriceWithoutVAT(LineItem lineItem)
Pass VAT inclusive price Line Item and get back VAT exclusive price- Parameters:
lineItem
- input Line Item whose VAT exclusive price needs to find out- Returns:
- VAT exclusive price
- Throws:
IllegalArgumentException
- if price on Line item is negative or Flat tax rate on line Item is grater than item itself
-
getPriceWithVAT
public long getPriceWithVAT(LineItem lineItem)
Pass VAT exclusive price Line Item and get back VAT inclusive price- Parameters:
lineItem
- input Line Item whose VAT inclusive price needs to find out- Returns:
- VAT inclusive price
- Throws:
IllegalArgumentException
- if price on Line Item is negative
-
getAdditionalChargeSummaries
public List<com.clover.core.internal.calc.Calc.AdditionalChargeSummary> getAdditionalChargeSummaries(Collection<LineItem> lines)
Get the Additional charges calculated for passed in line items- Parameters:
lines
- line items to be considered while calculating charges- Returns:
- summary of additional charges with final charge value or empty list if additional charges were not present
-
getOrderFeePrice
public long getOrderFeePrice(LineItem orderFeeLineItem)
Get an orderFee price based on passed orderFeeLineItem's percentage- Parameters:
orderFeeLineItem
- order fee line item for which price needs to be calculated- Returns:
- long price for given orderFeeLineItem
-
getTotalOrderFees
public long getTotalOrderFees()
Get the total orderFee amount for given order- Returns:
- long total of order fees applied to given order
-
-