Class DefaultTaxRequestService

java.lang.Object
com.broadleafcommerce.orderoperation.service.messaging.tax.DefaultTaxRequestService
All Implemented Interfaces:
TaxRequestService

public class DefaultTaxRequestService extends Object implements TaxRequestService
Service class to create tax requests to be sent to the TaxDelegate
  • Field Summary

    Fields inherited from interface com.broadleafcommerce.orderoperation.service.messaging.tax.TaxRequestService

    TAX_ID_KEY, TAX_PROVIDER_ID_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultTaxRequestService(FromTaxAddressResolver fromTaxAddressResolver, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addFulfillmentTaxItem(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment, List<com.broadleafcommerce.tax.domain.TaxItem> taxItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected com.broadleafcommerce.tax.domain.TaxItem
    buildTaxItemForAdjustment(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> fulfillmentItems)
     
    protected String
    determineTaxProviderIdForCommit(com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.order.client.domain.OrderFulfillment cancelledFulfillment, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> nonCancelledFulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Extension point to determine the tax provider ID.
    protected String
    determineTaxProviderIdForCommit(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> orderFulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Extension point to determine the tax provider ID.
    protected String
    determineTaxProviderIdForCommit(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, com.broadleafcommerce.order.client.domain.ReturnAuthorization returnAuthorization, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Extension point to determine the tax provider ID.
    protected com.broadleafcommerce.order.client.domain.OrderFulfillment
    findFulfillmentForReturnItem(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> orderFulfillments, com.broadleafcommerce.order.client.domain.ReturnAuthorization returnAuthorization)
     
    com.broadleafcommerce.tax.domain.AdjustTaxTransactionRequest
    getAdjustTaxRequest(com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.order.client.domain.OrderFulfillment cancelledFulfillment, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> nonCancelledFulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Create an adjusted transaction based on the supplied order and fulfillments
    com.broadleafcommerce.tax.domain.CommitTaxRequest
    getCommitTaxRequest(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> orderFulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Create a commit tax request for used when committing taxes.
    protected String
    getCustomer(com.broadleafcommerce.order.client.domain.Order order)
     
    protected com.broadleafcommerce.tax.domain.TaxAddress
    getFromAddress(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
     
    protected Map<String,List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>>
    getOrderFulfillmentItemMap(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
     
    protected Map<String,com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>
    getOrderItemMap(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment)
     
    protected com.broadleafcommerce.tax.domain.TaxCalculationGroup
    getReturnTaxCalculationGroup(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> orderFulfillments, com.broadleafcommerce.order.client.domain.ReturnAuthorization returnAuthorization, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    com.broadleafcommerce.tax.domain.ReverseTaxTransactionRequest
    getReverseTransactionRequest(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, com.broadleafcommerce.order.client.domain.ReturnAuthorization returnAuthorization, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Create a reverse tax transaction request.
    protected List<com.broadleafcommerce.tax.domain.TaxCalculationGroup>
    getTaxGroupsForCommit(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> orderFulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected List<com.broadleafcommerce.tax.domain.TaxItem>
    getTaxItemsForAdjustment(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> nonCancelledFulfillments, com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected List<com.broadleafcommerce.tax.domain.TaxItem>
    getTaxItemsForCommit(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected List<com.broadleafcommerce.tax.domain.TaxItem>
    getTaxItemsForReturn(com.broadleafcommerce.order.client.domain.ReturnAuthorization returnAuthorization, Map<String,com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> orderItemMap)
     
    protected com.broadleafcommerce.tax.domain.TaxAddress
    getToAddress(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    com.broadleafcommerce.tax.domain.VoidTransactionRequest
    getVoidTransaction(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Create a void transaction request.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultTaxRequestService

      public DefaultTaxRequestService(@Nullable FromTaxAddressResolver fromTaxAddressResolver, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • getCommitTaxRequest

      public com.broadleafcommerce.tax.domain.CommitTaxRequest getCommitTaxRequest(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> orderFulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: TaxRequestService
      Create a commit tax request for used when committing taxes.
      Specified by:
      getCommitTaxRequest in interface TaxRequestService
      Parameters:
      order - The submitted order
      orderFulfillments - The order fulfillments
      contextInfo - The context
      Returns:
      A commit tax request
    • getAdjustTaxRequest

      public com.broadleafcommerce.tax.domain.AdjustTaxTransactionRequest getAdjustTaxRequest(com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.order.client.domain.OrderFulfillment cancelledFulfillment, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> nonCancelledFulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Create an adjusted transaction based on the supplied order and fulfillments
      Specified by:
      getAdjustTaxRequest in interface TaxRequestService
      Parameters:
      order - The original order
      cancelledFulfillment - The cancelled fulfillment
      nonCancelledFulfillments - The non-cancelled fulfillments
      contextInfo - The context
      Returns:
      A populated adjust transaction request
    • getReverseTransactionRequest

      public com.broadleafcommerce.tax.domain.ReverseTaxTransactionRequest getReverseTransactionRequest(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, com.broadleafcommerce.order.client.domain.ReturnAuthorization returnAuthorization, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: TaxRequestService
      Create a reverse tax transaction request. Used to submit reverse transactions to the tax provider.
      Specified by:
      getReverseTransactionRequest in interface TaxRequestService
      Parameters:
      order - The original order
      fulfillments - The order's fulfillments
      returnAuthorization - The return authorization. If null, it's assumed this is an order that has been cancelled without ever fulfilling
      contextInfo - The current context
      Returns:
      A reverse tax transaction request
    • getVoidTransaction

      public com.broadleafcommerce.tax.domain.VoidTransactionRequest getVoidTransaction(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: TaxRequestService
      Create a void transaction request.
      Specified by:
      getVoidTransaction in interface TaxRequestService
      Parameters:
      order - The original order
      fulfillments - The fulfillments
      contextInfo - The current context
      Returns:
      A void transaction request
    • getTaxGroupsForCommit

      protected List<com.broadleafcommerce.tax.domain.TaxCalculationGroup> getTaxGroupsForCommit(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> orderFulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getTaxItemsForCommit

      protected List<com.broadleafcommerce.tax.domain.TaxItem> getTaxItemsForCommit(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • addFulfillmentTaxItem

      protected void addFulfillmentTaxItem(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment, List<com.broadleafcommerce.tax.domain.TaxItem> taxItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getCustomer

      protected String getCustomer(com.broadleafcommerce.order.client.domain.Order order)
    • getTaxItemsForAdjustment

      protected List<com.broadleafcommerce.tax.domain.TaxItem> getTaxItemsForAdjustment(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> nonCancelledFulfillments, com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • buildTaxItemForAdjustment

      protected com.broadleafcommerce.tax.domain.TaxItem buildTaxItemForAdjustment(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> fulfillmentItems)
    • getOrderFulfillmentItemMap

      protected Map<String,List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>> getOrderFulfillmentItemMap(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    • getToAddress

      protected com.broadleafcommerce.tax.domain.TaxAddress getToAddress(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getFromAddress

      protected com.broadleafcommerce.tax.domain.TaxAddress getFromAddress(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getReturnTaxCalculationGroup

      protected com.broadleafcommerce.tax.domain.TaxCalculationGroup getReturnTaxCalculationGroup(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> orderFulfillments, com.broadleafcommerce.order.client.domain.ReturnAuthorization returnAuthorization, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getOrderItemMap

      protected Map<String,com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> getOrderItemMap(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment)
    • getTaxItemsForReturn

      protected List<com.broadleafcommerce.tax.domain.TaxItem> getTaxItemsForReturn(com.broadleafcommerce.order.client.domain.ReturnAuthorization returnAuthorization, Map<String,com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> orderItemMap)
    • findFulfillmentForReturnItem

      protected com.broadleafcommerce.order.client.domain.OrderFulfillment findFulfillmentForReturnItem(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> orderFulfillments, com.broadleafcommerce.order.client.domain.ReturnAuthorization returnAuthorization)
    • determineTaxProviderIdForCommit

      protected String determineTaxProviderIdForCommit(com.broadleafcommerce.order.client.domain.Order order, @Nullable List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, @Nullable com.broadleafcommerce.order.client.domain.ReturnAuthorization returnAuthorization, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Extension point to determine the tax provider ID. Defaults to return the same tax provider ID that was used for commit.
      Parameters:
      order - The order
      fulfillments - The order's fulfillment
      returnAuthorization - The return authorization
      contextInfo - The current context
      Returns:
      The ID of the tax provider to use.
    • determineTaxProviderIdForCommit

      protected String determineTaxProviderIdForCommit(com.broadleafcommerce.order.client.domain.Order order, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> orderFulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Extension point to determine the tax provider ID. Defaults to return null.
      Parameters:
      order - The order
      orderFulfillments - The order's fulfillments
      contextInfo - The current context
      Returns:
      The ID of the tax provider to use.
    • determineTaxProviderIdForCommit

      protected String determineTaxProviderIdForCommit(com.broadleafcommerce.order.client.domain.Order order, @Nullable com.broadleafcommerce.order.client.domain.OrderFulfillment cancelledFulfillment, @Nullable List<com.broadleafcommerce.order.client.domain.OrderFulfillment> nonCancelledFulfillments, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Extension point to determine the tax provider ID. Defaults to return the same tax provider ID used during commit
      Parameters:
      order - The order
      cancelledFulfillment - The cancelled fulfillment
      nonCancelledFulfillments - The still active fulfillments
      contextInfo - The current context
      Returns:
      The ID of the tax provider to use.
    • getFromTaxAddressResolver

      @Nullable protected FromTaxAddressResolver getFromTaxAddressResolver()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()