Suggested refund amount
When you update an existing return, a suggested refund will be calculated. A Customer Service Representative can modify a suggested amount on a case-by-case basis. The suggested credit including adjustments, charges, and taxes is summed in the ReturnPrepare command after taxes are calculated.
Two task commands control the product portion of a suggested refund amount: CalculateReturnItemCreditCmd and CalculateReturnItemCreditForCatEntryCmd. Within both commands, there is logic for calculating a refund when an individual product component is specified.
For returned products that are specified by an order item, the CalculateReturnItemCreditCmd task command is called. The default implementation of this command is as follows: the amount to credit is based on the value of the PRICE column in the ORDERITEMS table multiplied by the quantity being returned and roundCustomized. The adjustment credit is calculated from each of the OrderItem adjustments made against an OrderItem. Refer to the ORDIADJUST table for details. Each OrderItem adjustment is pro-rated based on the quantity being returned, up to the amount of the OrderItem adjustment, and a record is created in the RMAIADJCRD table. The total of each adjustment credit is calculated and placed in the ADJUSTMENTCREDIT column of the RMAITEM table. The CREDITAMOUNT and the ADJUSTMENTCREDIT represent what the customer originally paid for the items being returned. These calculations are implemented in a set of task commands. Refer to the CalculateReturnItemProductCreditCmdImpl and CalculateReturnItemAdjustmentCreditCmdImpl task commands for details.
For returned products that are specified by a catalog entry instead of an order item, the CalculateReturnItemCreditForCatEntryCmd. The default implementation of this command is that the credit amount and adjustment credit for a catalog entry are set to 0.
After the credit amount and adjustment credit have been calculated, any additional adjustments or charges are calculated. The code that calculates this is a policy command that is attached to the contract of the return. The default policies calculate the charge against the CREDITAMOUNT and ADJUSTMENTCREDIT, but this can be modified. To support policy extensions, refer to the policy commands CalculateReturnItemAdjustmentFlatPolicyCmdImpl or CalculateReturnItemAdjustmentPercentagePolicyCmdImpl for details about charges to render against a returned item, such as a restocking fee.
Any tax to be credited is calculated on the whole return. Refer to the CalculateReturnTaxCmd task command, which is called from the ReturnPrepare command.