ReturnRequests
represent Shipping Groups as a ReturnShippingGroup
and Commerce Items as a ReturnItem
. The return refund amount is distributed from RefundMethods
If you extend a repository item object, you may need to extend these return objects, as well as the load and save methods.
You can modify the following methods to load and save return objects in ReturnRequest
:
atg.commerce.csr.returns.ReturnRequest.loadReturnRequest
– (Repository Item) This method loads information from theReturnRequest
repository item to the instanceatg.commerce.csr.returns.ReturnRequest.saveReturnRequest
– (Mutable Repository Item) This method is saves information from theReturnRequest
instance to the repository item
You can modify the following methods to load and save return objects in ReturnItem
:
atg.commerce.csr.returns.ReturnItem.loadReturnItem
– (Repository Item) This method loads information from theReturnItem
repository item to the instanceatg.commerce.csr.returns.ReturnItem.saveReturnItem
– (Mutable Repository Item) This method saves information from theReturnItem
instance to the repository item
You can modify the following methods to load and save return objects in RefundMethod
:
atg.commerce.csr.returns.RefundMethod.loadRefundMethod
– (Repository Item, Order) This method loads information from theRefundMethod
repository item to the instanceatg.commerce.csr.returns.RefundMethod.saveRefundMethod
– (Mutable Repository Item) This method saves information from theRefundMethod
instance to the repository item
Creating a Return Request Instance
A returnRequest
can be based upon the returnRequestClass
property values listed in /atg/commerce/custsvc/returns/ReturnTools.properties
file. The default for the returnRequestClass
property is:
returnRequestClass=atg.commerce.csr.returns.ReturnRequest
Use the atg.commerce.scr.returns.ReturnTools.createReturnRequestInstance(0rder)
method to create the instance.
Creating a Return Shipping Group Instance
The atg.commercecsr.returns.ReturnTools.createReturnShippingGroupInstance
method creates a return shipping group instance based on the
(ShippingGroup)returnShippingTypeClassMap
property value. If a shipping group type is configured with a ReturnShippingGroup
class, a return shipping group instance is created. If not, a default value instance is created. This method calls the ReturnShippingGroup(ShippingGroup)
constructor to load return items.
The default configuration for the returnShippingTypeClassMap
property is:
/atg/commerce/custsvc/returns/ReturnTools.properties
returnShippingTypeClassMap=\
default=atg.commerce.csr.returns.ReturnShippingGroup,\
hardgoodShippingGroup=atg.commerce.csr.returns.ReturnShippingGroup
Creating a Return Item Instance
The atg.commerce.csr.returns.ReturnTools.createReturnItemInstance(CommerceItem)
method creates a return item instance based on the returnItemTypeClassMap
property value. If a commerce item type is configured with a return item class, a return item instance is created. This method calls the ReturnItem(CommerceItem)
constructor and sets the commerce item property.
The default configuration for the returnItemTypeClassMap
property is:
/atg/commerce/custsvc/returns/ReturnTools.properties
returnItemTypeClassMap=\
default=atg.commerce.csr.returns.ReturnItem
Creating a Refund Method Instance
The atg.commerce.csr.returns.ReturnTools.createRefundMethodInstance(String)
method creates a refund method instance based on the refundMethodTypeClassMap
property value. If the given type is configured with a refund method class, a refund method instance is created. The payment group class type is used to create refund method instances.
The default configuration for refundMethodTypeClassMap
property is:
/atg/commerce/custsvc/returns/ReturnTools.properties
refundMethodTypeClassMap=\
default=atg.commerce.csr.returns.RefundMethod,\
creditCard=atg.commerce.csr.returns.CreditCardRefundMethod,\
storeCredit=atg.commerce.csr.returns.StoreCreditRefundMethod
Creating Item Descriptor Mapping
The beanNameToItemDescriptorMap
property creates a repository item based on the return-related class. If a class is not configured the item will not be saved in the repository.
The default configuration for the beanNameToItemDescriptorMap
property is:
/atg/commerce/custsvc/returns/ReturnTools.properties
beanNameToItemDescriptorMap=\
atg.commerce.csr.returns.ReturnRequest=returnRequest,\
atg.commerce.csr.returns.ReturnItem=returnItem,\
atg.commerce.csr.returns.RefundMethod=refundMethod,\
atg.commerce.csr.returns.CreditCardRefundMethod=creditCard,\
atg.commerce.csr.returns.StoreCreditRefundMethod=storeCredit
Extending Amount Distribution Methods
The atg.commerce.csr.returns.ReturnManager.buildRefundMethodList(Order, ReturnRequest,double,double)
builds the refund methods from an order and allocates the refund amount. The refund methods are generated using the generateRefundMethodsForReturn
method.
(ReturnRequest)
The total refund amount is distributed as follows:
The
buildRefundMethodList
method uses the store credit amount and the total refund amount to determine what should be allocated to a store credit refund method. ThegetRefundAmountRemaningRefundMethod
returns the store credit refund method.The remaining refund amount from the total refund amount is distributed across other refund methods, using the
allocateRefundAmountForReturn
method.If there is still a remaining refund amount to be allocated, it is added to the
getRefundAmountRemaningRefundMethod
.
For example, you can extend the getRefundAmountRemaningRefundMethod
to return any of the supported refund method types, if the buildRefundMethodList
method receives a zero store credit amount.
Creating a Return Request Immediate Exchange
The ReturnManager.submitReplacementOrder
calls into the normal processOrderpipeline
change when an exchange replacement order is ready for submission. If the return request’s processImmediately
is true, the exchange order is submitted immediately. If the processImmediately
flag is set to false, the exchange replacement order is held until the returned goods have been received.