Package com.broadleafcommerce.tax
Interface TaxAccessor<T1 extends TaxRequest,T2 extends TaxResponse>
- Type Parameters:
T1
-T2
-
- All Known Subinterfaces:
TaxDelegate<T1,
,T2> TaxProvider<T1,
T2>
- All Known Implementing Classes:
DefaultTaxDelegate
,SimpleTaxProvider
public interface TaxAccessor<T1 extends TaxRequest,T2 extends TaxResponse>
Provides a common interface for components whos job it is to interact with a 1st or 3rd party tax
service or tax data, or whos job it is to delegate to such a component.
- Author:
- Kelly Tisdell (ktisdell)
-
Method Summary
Modifier and TypeMethodDescriptiondefault TaxCalculationResponse
adjustTaxes
(AdjustTaxTransactionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) ForTax Accessors
that support "commitTaxes", this allows for adjustments after taxes have been committed.calculateTaxes
(TaxCalculationRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Takes theTaxCalculationRequest
and computes sales tax.calculateTaxes
(List<T1> taxRequests, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.default T2
calculateTaxes
(T1 taxRequest) Deprecated.default CommitTaxResponse
commitTaxes
(CommitTaxRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) SomeTaxAccessor
instances allow clients to "commit" taxes, which essentially marks them as being collected and owed to a jurisdiction or tax authority.default void
commitTaxes
(T1 taxRequest) Deprecated.Please usecommitTaxes(CommitTaxRequest, ContextInfo)
default ReverseTaxTransactionResponse
reverseTaxTransaction
(ReverseTaxTransactionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) ForTax Accessors
that support "commitTaxes", this allows for reversal after taxes have been committed.default void
voidTaxTransaction
(VoidTransactionRequest voidTransactionRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Typically used in the case of full order cancellations.
-
Method Details
-
calculateTaxes
Deprecated.Calculate taxes for a request that includes a list of items and address(es).- Parameters:
taxRequest
- The request for which to calculate taxes.
-
calculateTaxes
@Deprecated default List<T2> calculateTaxes(List<T1> taxRequests, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Calculate taxes for a request that includes a list of items and address(es).- Parameters:
taxRequests
- The requests for which to calculate taxes.contextInfo
- Context information. May be null.
-
commitTaxes
Deprecated.Please usecommitTaxes(CommitTaxRequest, ContextInfo)
Commit taxes for a request that includes a list of items and address(es). This is intended for 3rd party integrations that support recording of taxes for auditing purposes.- Parameters:
taxRequest
- The request for which to calculate taxes.- Throws:
UnsupportedOperationException
- since not all tax providers will support this.
-
calculateTaxes
TaxCalculationResponse calculateTaxes(TaxCalculationRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Takes theTaxCalculationRequest
and computes sales tax. The details of the tax determination are returned via theTaxCalculationResponse
.- Parameters:
request
- TaxCalculationRequest, or details about what needs to be taxescontextInfo
- The ContextInfo that determines which tenant and application are making the request- Returns:
-
adjustTaxes
default TaxCalculationResponse adjustTaxes(AdjustTaxTransactionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) ForTax Accessors
that support "commitTaxes", this allows for adjustments after taxes have been committed.- Parameters:
request
-contextInfo
-- Returns:
-
commitTaxes
default CommitTaxResponse commitTaxes(CommitTaxRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) SomeTaxAccessor
instances allow clients to "commit" taxes, which essentially marks them as being collected and owed to a jurisdiction or tax authority. This is basically a way of saying, "We collected this much taxes for these products... and therefore we are saving these details for reporting and remittance."- Parameters:
request
-contextInfo
-- Returns:
-
reverseTaxTransaction
default ReverseTaxTransactionResponse reverseTaxTransaction(ReverseTaxTransactionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) ForTax Accessors
that support "commitTaxes", this allows for reversal after taxes have been committed.- Parameters:
request
-contextInfo
-- Returns:
-
voidTaxTransaction
default void voidTaxTransaction(VoidTransactionRequest voidTransactionRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Typically used in the case of full order cancellations. Completely voids a committed tax transaction.- Parameters:
voidTransactionRequest
- The void transaction requestcontextInfo
- The ContextInfo that determines which tenant and application are making the request
-
calculateTaxes(TaxCalculationRequest, ContextInfo)