Class DefaultConsignmentAmountCalculationStrategy
java.lang.Object
de.hybris.platform.warehousing.consignment.strategies.impl.DefaultConsignmentAmountCalculationStrategy
- All Implemented Interfaces:
ConsignmentAmountCalculationStrategy
public class DefaultConsignmentAmountCalculationStrategy
extends Object
implements ConsignmentAmountCalculationStrategy
Default implementation for
ConsignmentAmountCalculationStrategy-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateAlreadyCapturedAmount(ConsignmentModel consignment) Calculates the amount which has been already captured on theOrderModelof the givenConsignmentModelprotected BigDecimalcalculateAmountCaptured(ConsignmentModel consignment) Calculates amount already captured for the givenConsignmentModelprotected BigDecimalcalculateAmountToCapture(ConsignmentModel consignment, BigDecimal alreadyCapturedAmount, BigDecimal totalOrderAmount) Calculates the amount to capture.calculateCaptureAmount(ConsignmentModel consignment) Calculates the amount to be captured for the givenConsignmentModelprotected BigDecimalcalculateConsignmentAmount(ConsignmentModel consignment, boolean includeTaxes) Calculates the amount of theConsignmentModelbased on the appropriateAbstractOrderEntryModel.TOTALPRICEcalculateConsignmentEntryAmount(ConsignmentEntryModel consignmentEntry, boolean includeTaxes) Calculates amount forConsignmentEntryModelprotected BigDecimalcalculateConsignmentEntryTaxAmount(ConsignmentEntryModel consignmentEntry) Calculates Tax amount forConsignmentEntryModelcalculateDiscountAmount(ConsignmentModel consignment) Calculates the discount amount for theConsignmentModeltaking a part ofAbstractOrderModel.TOTALDISCOUNTSprotected BigDecimalcalculateDiscountAmountForConsignment(ConsignmentModel consignment) Calculates discount amount forConsignmentModelby taking a proportional part ofAbstractOrderModel.TOTALDISCOUNTS.protected BigDecimalCalculates order amount without delivery cost and its corresponding taxcalculateTotalOrderAmount(ConsignmentModel consignment) Calculates the order total of the givenConsignmentModelprotected booleanisOnlyOrLastConsignment(ConsignmentModel consignment) Decides if thisConsignmentModelis the only or last one to be captured
-
Constructor Details
-
DefaultConsignmentAmountCalculationStrategy
public DefaultConsignmentAmountCalculationStrategy()
-
-
Method Details
-
calculateCaptureAmount
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
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
Description copied from interface:ConsignmentAmountCalculationStrategyCalculates the order total of the givenConsignmentModel- Specified by:
calculateTotalOrderAmountin interfaceConsignmentAmountCalculationStrategy- Parameters:
consignment- givenConsignmentModel- Returns:
BigDecimalthe order total
-
calculateDiscountAmount
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 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
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
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 BigDecimal calculateAmountToCapture(ConsignmentModel consignment, BigDecimal alreadyCapturedAmount, 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
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
Calculates Tax amount forConsignmentEntryModel- Parameters:
consignmentEntry- givenConsignmentEntryModel- Returns:
BigDecimalamount of the consignment entry
-
calculateAmountCaptured
Calculates amount already captured for the givenConsignmentModel- Parameters:
consignment- the givenConsignmentModel- Returns:
BigDecimalamount captured for the consignment
-
calculateOrderAmountWithoutDeliveryCostAndDeliveryTax
protected BigDecimal calculateOrderAmountWithoutDeliveryCostAndDeliveryTax(ConsignmentModel consignment) Calculates order amount without delivery cost and its corresponding tax- Parameters:
consignment-- Returns:
BigDecimalorder amount for the consignment
-