Class DefaultReturnConfirmationGenerationService
- java.lang.Object
-
- com.broadleafcommerce.orderoperation.service.generate.DefaultReturnConfirmationGenerationService
-
- All Implemented Interfaces:
ReturnConfirmationGenerationService
public class DefaultReturnConfirmationGenerationService extends Object implements ReturnConfirmationGenerationService
-
-
Constructor Summary
Constructors Constructor Description DefaultReturnConfirmationGenerationService(SplitRoundingHelper roundingHelper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.money.MonetaryAmount
calculateRemainderOfTotal(com.broadleafcommerce.order.client.domain.ReturnAuthorizationItem returnItem, javax.money.MonetaryAmount itemTotal, Function<com.broadleafcommerce.order.client.domain.ReturnConfirmation,javax.money.MonetaryAmount> getConfirmationTotal)
Calculate the remaining amount for theitemTotal
which has not already been accounted for by the sum of thegetConfirmationTotal
of the existingReturnAuthorizationItem.confirmations
.com.broadleafcommerce.order.client.domain.ReturnConfirmation
generateReturnConfirmation(com.broadleafcommerce.order.client.domain.ReturnAuthorizationItem returnItem, ConfirmReturnItemRequest confirmReturnItemRequest)
Generates a newReturnConfirmation
for the givenReturnConfirmation
requested byconfirmReturnRequest
.protected SplitRoundingHelper
getRoundingHelper()
protected com.broadleafcommerce.common.extension.TypeFactory
getTypeFactory()
protected void
populateTotals(com.broadleafcommerce.order.client.domain.ReturnConfirmation returnConfirmation, com.broadleafcommerce.order.client.domain.ReturnAuthorizationItem returnItem)
Calculate and assign the totals within theReturnConfirmation
based on the quantity of theReturnAuthorizationItem
it contains.protected void
populateTotalsBasedOnQuantity(com.broadleafcommerce.order.client.domain.ReturnConfirmation returnConfirmation, com.broadleafcommerce.order.client.domain.ReturnAuthorizationItem returnItem)
Calculate and assign the totals within aReturnConfirmation
based on the fraction of theReturnAuthorizationItem.quantity
it contains.protected void
populateTotalsWithRemainders(com.broadleafcommerce.order.client.domain.ReturnConfirmation returnConfirmation, com.broadleafcommerce.order.client.domain.ReturnAuthorizationItem returnItem)
Calculate and assign the totals withinReturnConfirmation
as the remainder of the totals in theReturnAuthorizationItem
which have not already been confirmed.
-
-
-
Constructor Detail
-
DefaultReturnConfirmationGenerationService
public DefaultReturnConfirmationGenerationService(SplitRoundingHelper roundingHelper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Detail
-
generateReturnConfirmation
public com.broadleafcommerce.order.client.domain.ReturnConfirmation generateReturnConfirmation(com.broadleafcommerce.order.client.domain.ReturnAuthorizationItem returnItem, ConfirmReturnItemRequest confirmReturnItemRequest)
Description copied from interface:ReturnConfirmationGenerationService
Generates a newReturnConfirmation
for the givenReturnConfirmation
requested byconfirmReturnRequest
.- Specified by:
generateReturnConfirmation
in interfaceReturnConfirmationGenerationService
- Parameters:
returnItem
- the return authorization item to confirmconfirmReturnItemRequest
- the request to confirm an item- Returns:
- the generated
ReturnConfirmation
-
populateTotals
protected void populateTotals(com.broadleafcommerce.order.client.domain.ReturnConfirmation returnConfirmation, com.broadleafcommerce.order.client.domain.ReturnAuthorizationItem returnItem)
Calculate and assign the totals within theReturnConfirmation
based on the quantity of theReturnAuthorizationItem
it contains.- Parameters:
returnConfirmation
- the confirmation to calculate and assign totals withinreturnItem
- the item which the confirmation applies to
-
populateTotalsWithRemainders
protected void populateTotalsWithRemainders(com.broadleafcommerce.order.client.domain.ReturnConfirmation returnConfirmation, com.broadleafcommerce.order.client.domain.ReturnAuthorizationItem returnItem)
Calculate and assign the totals withinReturnConfirmation
as the remainder of the totals in theReturnAuthorizationItem
which have not already been confirmed.- Parameters:
returnConfirmation
- the confirmation to calculate and assign totals withinreturnItem
- the item which the confirmation applies to
-
calculateRemainderOfTotal
protected javax.money.MonetaryAmount calculateRemainderOfTotal(com.broadleafcommerce.order.client.domain.ReturnAuthorizationItem returnItem, javax.money.MonetaryAmount itemTotal, Function<com.broadleafcommerce.order.client.domain.ReturnConfirmation,javax.money.MonetaryAmount> getConfirmationTotal)
Calculate the remaining amount for theitemTotal
which has not already been accounted for by the sum of thegetConfirmationTotal
of the existingReturnAuthorizationItem.confirmations
.- Parameters:
returnItem
- the item containing confirmationsitemTotal
- the item total to get the remainder of by subtracting the confirmation totalsgetConfirmationTotal
- the function to get the total off a confirmation- Returns:
- remaining amount for the
itemTotal
not already accounted for by the confirmation totals
-
populateTotalsBasedOnQuantity
protected void populateTotalsBasedOnQuantity(com.broadleafcommerce.order.client.domain.ReturnConfirmation returnConfirmation, com.broadleafcommerce.order.client.domain.ReturnAuthorizationItem returnItem)
Calculate and assign the totals within aReturnConfirmation
based on the fraction of theReturnAuthorizationItem.quantity
it contains.- Parameters:
returnConfirmation
- the confirmation to calculate and assign totals withinreturnItem
- the item which the confirmation applies to
-
getRoundingHelper
protected SplitRoundingHelper getRoundingHelper()
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
-