public class RefundWithDependentSupportPolicyCmdImpl
extends com.ibm.commerce.returns.commands.RefundByMethodPolicyCmdImpl
implements com.ibm.commerce.returns.commands.RefundByMethodPolicyCmd
Behavior
This command is called by PrimeRefundCmd to create refund instruction and refund information in Payment Rules.
Modifier and Type | Field and Description |
---|---|
static java.lang.String | COPYRIGHT
IBM copyright notice field.
|
Constructor and Description |
---|
RefundWithDependentSupportPolicyCmdImpl() |
Modifier and Type | Method and Description |
---|---|
protected RefundInstruction | composeDependentRefundInstruction(EDPPaymentInstruction pi, java.math.BigDecimal amountForRI)
This method composes the value object RefundInstruction against a given payment instruction for dependent object.
|
protected RefundInstruction | composeIndependentRefundInstruction(EDPPaymentInstruction pi, java.math.BigDecimal amountForRI)
This method composes a value object RefundInstruction against a given payment instruction for independent credit
|
protected java.util.Collection | getPaymentInstructionsInOrder()
This method gets the order which this RMA against, and then returns a collection of PaymentInstruction objects of all the payment instructions which were used in the order.
|
protected java.math.BigDecimal | getRefundableAmountForDependent(EDPPaymentInstruction pi)
This method returns the available amount for refund of the specified payment instruction.
|
protected java.math.BigDecimal | getRefundableAmountForIndependent(EDPPaymentInstruction pi)
This method returns the available amount for refund of the specified payment instruction.
|
void | performExecute()
This method executes the main business logic of this command.
|
void | reset()
This method resets the instance variable of this command.
|
public static final java.lang.String COPYRIGHT
public RefundWithDependentSupportPolicyCmdImpl()
public void performExecute() throws ECException
This method firstly gets all payment instructions as an ArrayList from the order this RMA corresponds to. And then traverses the ArrayList to get the payment instructions used against the order. For each payment instruction, this method checks whether it is dependent credit required, and composes a new refund instruction with appropriate amount accordingly. Then the method sets the necessary attributes to the new refund instructions, then sets it to the ArrayList. Later PrimeRefundCmd creates the Refund Instruction and refund information of Payment Rules in database according to the Refund Instruction in this ArrayList.
protected RefundInstruction composeIndependentRefundInstruction(EDPPaymentInstruction pi, java.math.BigDecimal amountForRI)
protected RefundInstruction composeDependentRefundInstruction(EDPPaymentInstruction pi, java.math.BigDecimal amountForRI)
protected java.math.BigDecimal getRefundableAmountForIndependent(EDPPaymentInstruction pi) throws ECException
In the out of the box implementation, the available amount is the total amount subtracting the consumed amount of this payment instruction.
If this out of the box implementation can not fulfill your requirement, you can implement your logic by extending this method.
protected java.math.BigDecimal getRefundableAmountForDependent(EDPPaymentInstruction pi) throws ECException
In the out of the box implementation, the available amount is the total deposited amount subtracting the credited amount and the consumed but not credited amount.
If this out of the box implementation can not fulfill your requirement, you can implement your logic by extending this method.protected java.util.Collection getPaymentInstructionsInOrder() throws ECException
If you would like to return a list of payment instructions by different priority, you can extend this method to implement your sorting algorithm.
public void reset()