FeePricingService is an internal service responsible for retrieving and applying fees onto a cart.
Like TaxService, this is not a stand-alone microservice and cannot be accessed directly via a REST API.
Rather, this service is internal to Cart Operations Service and is invoked as part of the Cart Pricing flow.
|
Note
|
For overall pricing, see CartPricingService. |
The default implementation of this interface is DefaultFeePricingService.
The default implementation fetches the fees that will be applied for the application in the current context via the ExternalPricingProvider, and caches the results by application to facilitate easier retrieval and eliminate redundant calls to the Provider.
The default implementation of PricingProvider is ExternalPricingProvider, which handles building out the DTOs and pricing contexts the Broadleaf Pricing Engine requires, but also handles fetching fees based on the the application in the current context.
See the Additional Implementation Details section in PricingProvider to know how fees are retrieved.
The only requirements to ensure fees get calculated are for there to be configured fees for the application, which can be configured via the Admin Portal or by adding seed data, and for the application to be configured to allow fee calculation.
This can be achieved by setting the property broadleaf.cartoperation.service.pricing.feeCalculationEnabled for the desired applications or tenants (which will apply for all applications under it).
See the Configuration section in CartPricingService to know how to set this property.