Class TaxCalculationProcessorHandler<P extends TaxCalculationHandlerRequests>
java.lang.Object
com.broadleafcommerce.billing.job.module.TaxCalculationProcessorHandler<P>
Receives requests to calculate tax and delegates to the
TaxService to find and call tax
providers. Then, reacts to tax calculation results by adding details to
the request DTO and creating a
TaxProcessingResult. If calculation was unsuccessful, creates a
TaxProcessingResult for the thrown exception.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BillingEventPricingService<BillingEventDTO,BillingEvent, BillingEventAdjustment, BillingEventItemWithTaxDetails, BillingEventPaymentWithTransaction> protected BillingJobMessageSenderprotected com.broadleafcommerce.common.extension.TypeFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateTaxForBillingEventItems(BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected Map<BillingEventItem,List<BillingTaxDetail>> callTaxCalculationProcess(BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) This method is solely responsible for calling theTaxServiceto calculate taxes.protected intgetGatewayErrorCount(BillingProcessingRequest billingProcessingRequest) protected TaxProcessingResulthandleTaxCalculationException(Exception exception, BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO) protected TaxProcessingResulthandleTaxCalculationFailure(BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO) Deprecated.protected TaxProcessingResulthandleTaxSuccess(BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO) protected voidlogPostTaxProcessingData(BillingEventDTO billingEventDTO) protected voidlogPreTaxProcessingData(BillingEventDTO billingEventDTO) protected booleanmapDoesNotContainTaxDetails(Map<BillingEventItem, List<BillingTaxDetail>> itemsWithTaxDetailsMap) Determines whether the tax calculation was successful.voidDeprecated.voidprocess(P taxCalculationHandlerRequests, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected booleantaxCalculationWasSuccessful(BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO) protected voidupdateRequestDTOWithTaxResultsMap(Map<BillingEventItem, List<BillingTaxDetail>> itemsWithTaxDetailsMap, BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO) Handles updating the given DTO with results of the tax calculation stored on the map.
-
Field Details
-
billingEventPricingService
@Autowired protected BillingEventPricingService<BillingEventDTO,BillingEvent, billingEventPricingServiceBillingEventAdjustment, BillingEventItemWithTaxDetails, BillingEventPaymentWithTransaction> -
sender
-
taxService
@Autowired protected TaxService<BillingEventItem,BillingTaxDetail, taxServiceBillingProcessingRequestWithBillingEventDTO> -
typeFactory
@Autowired protected com.broadleafcommerce.common.extension.TypeFactory typeFactory
-
-
Constructor Details
-
TaxCalculationProcessorHandler
public TaxCalculationProcessorHandler()
-
-
Method Details
-
process
Deprecated. -
process
public void process(P taxCalculationHandlerRequests, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
logPreTaxProcessingData
-
logPostTaxProcessingData
-
calculateTaxForBillingEventItems
protected BillingProcessingRequestWithBillingEventDTO calculateTaxForBillingEventItems(BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
callTaxCalculationProcess
protected Map<BillingEventItem,List<BillingTaxDetail>> callTaxCalculationProcess(BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) This method is solely responsible for calling theTaxServiceto calculate taxes. The return value from the service is returned unchanged. -
updateRequestDTOWithTaxResultsMap
protected void updateRequestDTOWithTaxResultsMap(Map<BillingEventItem, List<BillingTaxDetail>> itemsWithTaxDetailsMap, BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO) Handles updating the given DTO with results of the tax calculation stored on the map. Aside from theBillingTaxDetail, it also features updated tax totals onitems. -
mapDoesNotContainTaxDetails
protected boolean mapDoesNotContainTaxDetails(Map<BillingEventItem, List<BillingTaxDetail>> itemsWithTaxDetailsMap) Determines whether the tax calculation was successful. If the given map is empty or does not contain anytax details, it must not have been.- Parameters:
itemsWithTaxDetailsMap- map of items with their tax details after tax calculation- Returns:
- whether this map contains tax details, and by extension, had its taxes calculated successfully
-
taxCalculationWasSuccessful
protected boolean taxCalculationWasSuccessful(BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO) -
handleTaxSuccess
protected TaxProcessingResult handleTaxSuccess(BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO) -
handleTaxCalculationFailure
@Deprecated(since="1.0.0") protected TaxProcessingResult handleTaxCalculationFailure(BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO) Deprecated.Current implementation does not useTaxProcessingResultEnum.FAILUREstates -
handleTaxCalculationException
protected TaxProcessingResult handleTaxCalculationException(Exception exception, BillingProcessingRequestWithBillingEventDTO billingProcessingRequestWithBillingEventDTO) -
getGatewayErrorCount
-
TaxProcessingResultEnum.FAILUREstates