ItemCostAdjustments
are an integral part of the return process as they capture changes in cost for both returned and non-returned items. Non-return items are any item/shipping group relationship combinations that do not have any portion being returned in the current request.
When you work with return items, the sum of the ItemCostAdjustments
sets the refund properties on the return item. Once the return request is saved, the ItemCostAdjustment
for that return item is discarded.
When you work with non-return items, the ItemCostAdjustments
are used to offset the calculations for the total refund value in the ReturnRequest
. Unlike the ItemCostAdjusments
for return items, ItemCostAdjustments
for non-return items are saved, along with the ReturnRequest
, to the repository.
There can be multiple ItemCostAdjustments
per item. Whenever additional ItemCostAdjustments
are generated, for either returned or non-returned items, the refund value for the return will be automatically adjusted.
The following is an example of ItemCostAdjustments
:
public class ItemCostAdjustment { String mItemId – The original commerce item id for the adjustment String mShippingGroupId – The original shipping group for the adjustment double mAmount – the delta amount double mOrderDiscoutnShare – the order discount share delta double mManualAdjustmentShare – the manual adjustment share delta double mTaxShare – the tax share delta double mShippingShare – the shipping share delta }
The ItemCostAdjustments
item descriptor name is configured in the /atg/commerce/custsvc/
file using the
returns/ReturnToolsitemCostAdjustmentDescriptorName
property. For example:
public void setItemCostAdjustmentDescriptorName(String pItemCostAdjustmentDescriptorName) { mItemCostAdjustmentDescriptorName = pItemCostAdjustmentDescriptorName;
An API is available for ItemCostAdjustment
objects and repository items. Refer to the ATG API Reference for Commerce Service Center for additional information.
ReturnTools ItemCostAdjustment Creation
ReturnTools
provides the following methods to generate a new ItemCostAdjustment
object from the given ItemCostAdjustment
repository item:
protected ItemCostAdjustment createItemCostAdjustment()
protected ItemCostAdjustment createItemCostAdjustment
(RepositoryItem pItemCostAdjustmentItem) throws RepositoryException
protected ItemCostAdjustment
createItemCostAdjustmentFromItem(RepositoryItem
pItemCostAdjustmentItem) throws RepositoryException
protected void setBasePropertiesOfItemCostAdjustment(ItemCostAdjustment
pItemCostAdjustment,RepositoryItem pItemCostAdjustmentItem)
protected void saveItemCostAdjustments(ReturnRequest pReturnRequest
MutableRepositoryItem pReturnRequestItem) throws RepositoryException
protected void loadItemCostAdjustments(ReturnRequest pReturnRequest,
RepositoryItem pReturnRequestItem) throws RepositoryException
ReturnManagerItemCostAdjustment Creation
ReturnManager
contains the following method that generates the ItemCostAdjustments
for the return:
protected void generateItemCostAdjustments(ReturnRequest pReturnRequest)
throws ReturnException
The following methods create the ItemCostAdustments
based on the pricing deltas between the Return Adjustment Order and the Return Calculation Order:
protected Collection generateReturnCalculationAdjustments(ReturnRequest
pReturnRequest) throws ReturnException
protected Collection generateOrderComparisonAdjustments(ReturnRequest
pReturnRequest, Order pOrder, Order pCorrespondingOrder,Map
pItemToCorrespondingItemMap,Map
pShippingGroupToCorrespondingShippingGroupMap) throws ReturnException
The following methods identify the need for Promotion and Shipping adjustments:
protected Collection generatePromotionEvaluationAdjustments(ReturnRequest
pReturnRequest) throws ReturnException
protected Collection generateShippingRefundAdjustments(ReturnRequest
pReturnRequest) throws ReturnException
ReturnItem ItemCostAdjustment Creation
ReturnItem
contains the following methods that add a new ItemCostAdjustment
to the return:
public void addItemCostAdjustment(ItemCostAdjustment pItemCostAdjustment)
public void addItemCostAdjustments(Collection pItemCostAdjustments)
public void clearItemCostAdjustments()
public Collection getItemCostAdjustments()
ReturnRequest ItemCostAdjustment Creation
ReturnRequest
contains the following methods that return the collection of ItemCostAdjustment
objects:
public void addNonReturnItemCostAdjustment(ItemCostAdjustment
pItemCostAdjustment)
public void addNonReturnItemCostAdjustments(Collection
pItemCostAdjustments)
public void clearNonReturnItemCostAdjustments()
public Collection getNonReturnItemCostAdjustments()
Order Comparisons
The ItemCostAdjustment
for order comparisons:
Are generated by comparing an order (
FromOrder
) to its clone counterpart order (ToOrder
). The comparison API is given the maps ofFromItem
toToItem
andFromShippingGroup
toToShippingGroup
that were created when the clone was madeIterate over the shipping group relationships in the
FromOrder
and compare its pricing value to the corresponding relationship in theToOrder
. The pricing value of each relationship is limited by the range specified in the relationshipThe
FromRelationship
andToRelationship
obtain the collection ofDetailedItemPriceInfos
for the range, and then aggregate the amount, order discount share, manual adjustment share and tax from the details. ForToItems
orToRelationships
that no longer exist because of items being returned, the aggregate value is zero (0)Capture the deltas in amount, order discount share, manual adjustment share and tax in an
ItemCostAdjustment