Class DefaultTaxRequestService
java.lang.Object
com.broadleafcommerce.orderoperation.service.messaging.tax.DefaultTaxRequestService
- All Implemented Interfaces:
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
ConstructorDescriptionDefaultTaxRequestService
(FromTaxAddressResolver fromTaxAddressResolver, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 fulfillmentscom.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 FromTaxAddressResolver
getOrderFulfillmentItemMap
(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) 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.
-
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 interfaceTaxRequestService
- Parameters:
order
- The submitted orderorderFulfillments
- The order fulfillmentscontextInfo
- 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 interfaceTaxRequestService
- Parameters:
order
- The original ordercancelledFulfillment
- The cancelled fulfillmentnonCancelledFulfillments
- The non-cancelled fulfillmentscontextInfo
- 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 interfaceTaxRequestService
- Parameters:
order
- The original orderfulfillments
- The order's fulfillmentsreturnAuthorization
- The return authorization. If null, it's assumed this is an order that has been cancelled without ever fulfillingcontextInfo
- 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 interfaceTaxRequestService
- Parameters:
order
- The original orderfulfillments
- The fulfillmentscontextInfo
- 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
-
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
-
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
-
getTaxItemsForReturn
-
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 orderfulfillments
- The order's fulfillmentreturnAuthorization
- The return authorizationcontextInfo
- 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 orderorderFulfillments
- The order's fulfillmentscontextInfo
- 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 ordercancelledFulfillment
- The cancelled fulfillmentnonCancelledFulfillments
- The still active fulfillmentscontextInfo
- The current context- Returns:
- The ID of the tax provider to use.
-
getFromTaxAddressResolver
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-