public class DefaultCartTotalsCalculator extends Object implements CartTotalsCalculator
Constructor and Description |
---|
DefaultCartTotalsCalculator() |
Modifier and Type | Method and Description |
---|---|
protected void |
calculateCartItemsTotals(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
Calculates and sets
CartItem.getAdjustmentsTotal() and CartItem.getTotal()
for all items. |
protected void |
calculateCartItemTotals(@NonNull com.broadleafcommerce.cart.client.domain.CartItem item,
javax.money.CurrencyUnit expectedCurrency)
Calculates and sets
CartItem.getAdjustmentsTotal() and CartItem.getTotal() . |
javax.money.MonetaryAmount |
calculateCartSubtotal(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
Calculates
CartPricing.getSubtotal() . |
javax.money.MonetaryAmount |
calculateCartTotalAfterTax(@NonNull com.broadleafcommerce.cart.client.domain.CartPricing cartPricing)
Calculates the
CartPricing.getTotal() including tax. |
javax.money.MonetaryAmount |
calculateCartTotalBeforeTax(@NonNull com.broadleafcommerce.cart.client.domain.CartPricing cartPricing)
Calculates the
CartPricing.getTotal() without tax. |
protected void |
calculateFulfillmentGroupsTotals(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
Calculates and sets
FulfillmentGroup.getTotalFulfillmentPrice() for the group and
FulfillmentItem.getFulfillmentTotal() and
FulfillmentItem.getMerchandiseTotalAmount() for all items. |
protected void |
calculateFulfillmentGroupTotal(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup)
Calculates and sets
FulfillmentGroup.getTotalFulfillmentPrice() for each group and
FulfillmentItem.getFulfillmentTotal() and
FulfillmentItem.getMerchandiseTotalAmount() for all items. |
protected void |
calculateFulfillmentItemsTotals(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup)
Calculates and sets
FulfillmentItem.getFulfillmentTotal() and
FulfillmentItem.getMerchandiseTotalAmount() for all items in the group. |
protected javax.money.MonetaryAmount |
calculateFulfillmentItemTotal(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem,
javax.money.CurrencyUnit expectedCurrency)
Calculates the
FulfillmentItem.getFulfillmentTotal() for an item. |
javax.money.MonetaryAmount |
calculateFulfillmentTotal(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
Calculates
CartPricing.getFulfillmentTotal() . |
public javax.money.MonetaryAmount calculateCartSubtotal(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
CartTotalsCalculator
CartPricing.getSubtotal()
. This will also calculate and set
CartItem.getAdjustmentsTotal()
and CartItem.getTotal()
.calculateCartSubtotal
in interface CartTotalsCalculator
cart
- Cart for which to calculate a subtotalpublic javax.money.MonetaryAmount calculateFulfillmentTotal(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
CartTotalsCalculator
CartPricing.getFulfillmentTotal()
. This will also calculate and set the
totals for FulfillmentGroups
and FulfillmentItems
.calculateFulfillmentTotal
in interface CartTotalsCalculator
cart
- Cart for which to calculate a subtotalpublic javax.money.MonetaryAmount calculateCartTotalBeforeTax(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartPricing cartPricing)
CartTotalsCalculator
CartPricing.getTotal()
without tax. This will include the subtotal,
adjustments total, and fulfillment total.calculateCartTotalBeforeTax
in interface CartTotalsCalculator
cartPricing
- The pricing fields of a Cart to total.public javax.money.MonetaryAmount calculateCartTotalAfterTax(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartPricing cartPricing)
CartTotalsCalculator
CartPricing.getTotal()
including tax. This will include the subtotal,
adjustments total, total tax, and fulfillment total.calculateCartTotalAfterTax
in interface CartTotalsCalculator
cartPricing
- The pricing fields of a Cart to total.protected void calculateCartItemsTotals(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
CartItem.getAdjustmentsTotal()
and CartItem.getTotal()
for all items.cart
- whose items to total.protected void calculateCartItemTotals(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem item, javax.money.CurrencyUnit expectedCurrency)
CartItem.getAdjustmentsTotal()
and CartItem.getTotal()
.item
- Item to total.protected void calculateFulfillmentGroupsTotals(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
FulfillmentGroup.getTotalFulfillmentPrice()
for the group and
FulfillmentItem.getFulfillmentTotal()
and
FulfillmentItem.getMerchandiseTotalAmount()
for all items.cart
- Cart whose fulfillment groups to totalprotected void calculateFulfillmentGroupTotal(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup)
FulfillmentGroup.getTotalFulfillmentPrice()
for each group and
FulfillmentItem.getFulfillmentTotal()
and
FulfillmentItem.getMerchandiseTotalAmount()
for all items.cart
- Cart with the CartItems
related to the group's
FulfillmentItems
.fulfillmentGroup
- Fulfillment group to totalprotected void calculateFulfillmentItemsTotals(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup)
FulfillmentItem.getFulfillmentTotal()
and
FulfillmentItem.getMerchandiseTotalAmount()
for all items in the group.cart
- Cart with the CartItems
related to the group's
FulfillmentItems
.fulfillmentGroup
- Fulfillment group with items to totalprotected javax.money.MonetaryAmount calculateFulfillmentItemTotal(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, javax.money.CurrencyUnit expectedCurrency)
FulfillmentItem.getFulfillmentTotal()
for an item.fulfillmentItem
- Item to totalFulfillmentItem.getFulfillmentTotal()
for an item.Copyright © 2021. All rights reserved.