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 return request. Unlike the ItemCostAdjusments for return items, ItemCostAdjustments for non-return items are saved, along with the return request, 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/
returns/ReturnTools
file using the itemCostAdjustmentDescriptorName 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: