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 Detail

      • 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
        default void commitTaxes​(T1 taxRequest)
        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 the TaxCalculationRequest and computes sales tax. The details of the tax determination are returned via the TaxCalculationResponse.
        Parameters:
        request - TaxCalculationRequest, or details about what needs to be taxes
        contextInfo - 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)
        For Tax 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)
        Some TaxAccessor 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)
        For Tax 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 request
        contextInfo - The ContextInfo that determines which tenant and application are making the request