Class DefaultConsignmentAmountCalculationStrategy
- java.lang.Object
-
- de.hybris.platform.warehousing.consignment.strategies.impl.DefaultConsignmentAmountCalculationStrategy
-
- All Implemented Interfaces:
ConsignmentAmountCalculationStrategy
public class DefaultConsignmentAmountCalculationStrategy extends java.lang.Object implements ConsignmentAmountCalculationStrategy
Default implementation forConsignmentAmountCalculationStrategy
-
-
Constructor Summary
Constructors Constructor Description DefaultConsignmentAmountCalculationStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigDecimalcalculateAlreadyCapturedAmount(ConsignmentModel consignment)Calculates the amount which has been already captured on theOrderModelof the givenConsignmentModelprotected java.math.BigDecimalcalculateAmountCaptured(ConsignmentModel consignment)Calculates amount already captured for the givenConsignmentModelprotected java.math.BigDecimalcalculateAmountToCapture(ConsignmentModel consignment, java.math.BigDecimal alreadyCapturedAmount, java.math.BigDecimal totalOrderAmount)Calculates the amount to capture.java.math.BigDecimalcalculateCaptureAmount(ConsignmentModel consignment)Calculates the amount to be captured for the givenConsignmentModelprotected java.math.BigDecimalcalculateConsignmentAmount(ConsignmentModel consignment, boolean includeTaxes)Calculates the amount of theConsignmentModelbased on the appropriateAbstractOrderEntryModel.TOTALPRICEjava.math.BigDecimalcalculateConsignmentEntryAmount(ConsignmentEntryModel consignmentEntry, boolean includeTaxes)Calculates amount forConsignmentEntryModelprotected java.math.BigDecimalcalculateConsignmentEntryTaxAmount(ConsignmentEntryModel consignmentEntry)Calculates Tax amount forConsignmentEntryModeljava.math.BigDecimalcalculateDiscountAmount(ConsignmentModel consignment)Calculates the discount amount for theConsignmentModeltaking a part ofAbstractOrderModel.TOTALDISCOUNTSprotected java.math.BigDecimalcalculateDiscountAmountForConsignment(ConsignmentModel consignment)Calculates discount amount forConsignmentModelby taking a proportional part ofAbstractOrderModel.TOTALDISCOUNTS.protected java.math.BigDecimalcalculateOrderAmountWithoutDeliveryCostAndDeliveryTax(ConsignmentModel consignment)Calculates order amount without delivery cost and its corresponding taxjava.math.BigDecimalcalculateTotalOrderAmount(ConsignmentModel consignment)Calculates the order total of the givenConsignmentModelprotected booleanisOnlyOrLastConsignment(ConsignmentModel consignment)Decides if thisConsignmentModelis the only or last one to be captured
-
-
-
Method Detail
-
calculateCaptureAmount
public java.math.BigDecimal calculateCaptureAmount(ConsignmentModel consignment)
Description copied from interface:ConsignmentAmountCalculationStrategyCalculates the amount to be captured for the givenConsignmentModel- Specified by:
calculateCaptureAmountin interfaceConsignmentAmountCalculationStrategy- Parameters:
consignment- givenConsignmentModel- Returns:
- the amount to be captured for the given
ConsignmentModel
-
calculateAlreadyCapturedAmount
public java.math.BigDecimal calculateAlreadyCapturedAmount(ConsignmentModel consignment)
Description copied from interface:ConsignmentAmountCalculationStrategyCalculates the amount which has been already captured on theOrderModelof the givenConsignmentModel- Specified by:
calculateAlreadyCapturedAmountin interfaceConsignmentAmountCalculationStrategy- Parameters:
consignment- givenConsignmentModel- Returns:
BigDecimalthe sum of all previously captured amount
-
calculateTotalOrderAmount
public java.math.BigDecimal calculateTotalOrderAmount(ConsignmentModel consignment)
Description copied from interface:ConsignmentAmountCalculationStrategyCalculates the order total of the givenConsignmentModel- Specified by:
calculateTotalOrderAmountin interfaceConsignmentAmountCalculationStrategy- Parameters:
consignment- givenConsignmentModel- Returns:
BigDecimalthe order total
-
calculateDiscountAmount
public java.math.BigDecimal calculateDiscountAmount(ConsignmentModel consignment)
Description copied from interface:ConsignmentAmountCalculationStrategyCalculates the discount amount for theConsignmentModeltaking a part ofAbstractOrderModel.TOTALDISCOUNTS- Specified by:
calculateDiscountAmountin interfaceConsignmentAmountCalculationStrategy- Parameters:
consignment- givenConsignmentModel- Returns:
BigDecimalthe discount for the give consignment
-
calculateConsignmentEntryAmount
public java.math.BigDecimal calculateConsignmentEntryAmount(ConsignmentEntryModel consignmentEntry, boolean includeTaxes)
Description copied from interface:ConsignmentAmountCalculationStrategyCalculates amount forConsignmentEntryModel- Specified by:
calculateConsignmentEntryAmountin interfaceConsignmentAmountCalculationStrategy- Parameters:
consignmentEntry- givenConsignmentEntryModelincludeTaxes- if true returns the amount with taxes otherwise - without taxes- Returns:
BigDecimalamount of the consignment entry
-
calculateDiscountAmountForConsignment
protected java.math.BigDecimal calculateDiscountAmountForConsignment(ConsignmentModel consignment)
Calculates discount amount forConsignmentModelby taking a proportional part ofAbstractOrderModel.TOTALDISCOUNTS. Returns the discount value without taking into account if it's the last consignment- Parameters:
consignment-ConsignmentModelto calculate discount- Returns:
BigDecimalthe discount amount
-
isOnlyOrLastConsignment
protected boolean isOnlyOrLastConsignment(ConsignmentModel consignment)
Decides if thisConsignmentModelis the only or last one to be captured- Parameters:
consignment- givenConsignmentModel- Returns:
- true if the given
ConsignmentModelis the only one or the last one to be captured
-
calculateAmountToCapture
protected java.math.BigDecimal calculateAmountToCapture(ConsignmentModel consignment, java.math.BigDecimal alreadyCapturedAmount, java.math.BigDecimal totalOrderAmount)
Calculates the amount to capture. Takes into account the amount which has been already captured and the order total so that the result never exceeds the order total.- Parameters:
consignment- givenConsignmentModelalreadyCapturedAmount- the amount which has been already capturedtotalOrderAmount- the order total- Returns:
BigDecimalamount to be captured on this consignment
-
calculateConsignmentAmount
protected java.math.BigDecimal calculateConsignmentAmount(ConsignmentModel consignment, boolean includeTaxes)
Calculates the amount of theConsignmentModelbased on the appropriateAbstractOrderEntryModel.TOTALPRICE- Parameters:
consignment- givenConsignmentModelincludeTaxes- if true returns the amount with taxes otherwise - without taxes- Returns:
BigDecimalthe cost of the consignment
-
calculateConsignmentEntryTaxAmount
protected java.math.BigDecimal calculateConsignmentEntryTaxAmount(ConsignmentEntryModel consignmentEntry)
Calculates Tax amount forConsignmentEntryModel- Parameters:
consignmentEntry- givenConsignmentEntryModel- Returns:
BigDecimalamount of the consignment entry
-
calculateAmountCaptured
protected java.math.BigDecimal calculateAmountCaptured(ConsignmentModel consignment)
Calculates amount already captured for the givenConsignmentModel- Parameters:
consignment- the givenConsignmentModel- Returns:
BigDecimalamount captured for the consignment
-
calculateOrderAmountWithoutDeliveryCostAndDeliveryTax
protected java.math.BigDecimal calculateOrderAmountWithoutDeliveryCostAndDeliveryTax(ConsignmentModel consignment)
Calculates order amount without delivery cost and its corresponding tax- Parameters:
consignment-- Returns:
BigDecimalorder amount for the consignment
-
-