com.ibm.commerce.payment.actions.commands

Class DoPaymentActionsCompatiblePolicyCmdImpl

  • All Implemented Interfaces:
    BusinessPolicyCommand, com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, DoPaymentActionsPolicyCmd, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable


    public class DoPaymentActionsCompatiblePolicyCmdImpl
    extends BusinessPolicyCommandImpl
    implements DoPaymentActionsPolicyCmd
    The DoPaymentActionsPolicyCmd implementation class for existing policy commands in classical payments. The existing payment policy commands are not allowed to use together with payment plug-in controller or other payment processing system for the same order. The reason is that these payment policies commands are always designed with the an assumption. The assumption is that only one payment instruction is allowed for one order and every payment actions are executed against the order total amount.

    This class is used with Classical Payments.

    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DoPaymentActionsCompatiblePolicyCmdImpl

        public DoPaymentActionsCompatiblePolicyCmdImpl()
    • Method Detail

      • getEDPResults

        public EDPResults getEDPResults()
        This method gets the payment action execution results, which indicates the payment action execution results is successful, pending or failed.
        Specified by:
        getEDPResults in interface DoPaymentActionsPolicyCmd
        Returns:
        edpResults
      • getOrderAccessBean

        public OrderAccessBean getOrderAccessBean()
        This method gets the order access bean of current order. Since this command is used with classical_payments, when you execute the payment actions, the corresponding payment processing commands in classical_payments need to be called. You should set the order access bean of current order to these commands, so you must get the order access bean of current order firstly.
        Returns:
        orderAccessBean The order access bean of current order.
      • setOrderAccessBean

        public void setOrderAccessBean(OrderAccessBean localOrderAccessBean)
        This method sets the order access bean of current order.
        Parameters:
        localOrderAccessBean - The order access bean of current order.
      • getRMAAccessBean

        public RMAAccessBean getRMAAccessBean()
        This method gets the Return Mechanise Authorization(RMA) access bean of current RMA. Since this command is used with classical payments, when you execute the refund actions, the corresponding credit commands in classical payments need to be called. You should set the RMA access bean of current RMA to these commands, so you must get the RMA access bean of current RMA firstly.
        Returns:
        aRMAAccessBean The RMA access bean of current RMA.
      • setRMAAccessBean

        public void setRMAAccessBean(RMAAccessBean localRMAAccessBean)
        This method sets the RMA access bean of current RMA.
        Parameters:
        localRMAAccessBean - The RMA access bean of current RMA.
      • setPaymentActionDataList

        public void setPaymentActionDataList(java.util.List dataList)
        This method sets the list of payment action data. It contains the necessary information for the payment action. The list of payment action data is determined by payment rules component and passed to this command through the event data.
        Specified by:
        setPaymentActionDataList in interface DoPaymentActionsPolicyCmd
        Parameters:
        dataList - The list of payment action data to be used in the actions.
      • getPaymentActionDataList

        public java.util.List getPaymentActionDataList()
        This method gets the list of payment action data. It contains the necessary information for the payment action. The list of payment action data is determined by payment rules component and passed to this command through the event data.
        Returns:
        payActionDataList The list of payment action data to be used in the actions.
      • setRefundActionDataList

        public void setRefundActionDataList(java.util.List dataList)
        This method sets the list of refund action data. It contains the necessary information for the refund action. The list of refund action data is determined by payment rules component and passed to this command through the event data.
        Specified by:
        setRefundActionDataList in interface DoPaymentActionsPolicyCmd
        Parameters:
        dataList - The list of refund action data to be used in the actions.
      • getRefundActionDataList

        public java.util.List getRefundActionDataList()
        This method gets the list of refund action data. It contains the necessary information for the refund action. The list of refund action data is determined by payment rules component and passed to this command through the event data.
        Returns:
        refundActionDataList The list of refund action data to be used in the actions.
      • performExecute

        public void performExecute()
                            throws ECException
        This method performs classic payment action per action data type.

        This method will be called by the PaymentEventListenerImpl that listens the payment event and executes the corresponding payment action.

        There is the list of payment/refund action data contains the necessary information for payment/refund action that is passed to this command. Then this command executes each payment/refund action in this list, respectively.

        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException
      • approve

        public ActionResults approve(PaymentActionData actionData)
                              throws ECException,
                                     EDPException
        This method does the approve action. It will first check if there exists any record in the table ORDPAYMTHD. If there is not, which means there is no previous approve action against this order. Then DoPaymentCmd is called to do the approve action. If the corresponding record for this order has existed in the database, which means the approve action for this order has been executed previously. Then CheckPaymentAcceptCmd is called to execute the correct action.

        The payment rules component decides the approve action should be executed through the payment rules configuration. And currently the payment cation name in payment action data equals "ApproveAction". Then this method is called, which calls DoPaymentCmd or CheckPaymentAcceptCmd which further calls the policy command in classical payments. The policy command in classical payments communicates with payment manager to actually execute the approve action.

        Regardless of the results of the approve action, this execution will be stored in the database to record the history the payment/refund action.

        Parameters:
        actionData - The action data which will supply the data to perform approve.
        Returns:
        ActionResults The results of executing the approve action
        Throws:
        ECException
        EDPException
      • deposit

        public ActionResults deposit(PaymentActionData actionData)
                              throws ECException,
                                     EDPException
        This method executes the deposit action.

        The deposit action captures a payment for an order. In general, communication with a payment manager occurs at this stage. This action can occur during the following events: primePayment, reservePayment, and finalizePayment.

        The payment rules component decides the deposit action should be executed in the specific business events. And currently the payment action name in payment action data equals "DepositAction". Then this method is called, which calls DoDepositCmd which further calls the policy command in classical payments.The policy command in classical payments communicates with payment manager to actually execute the deposit action.

        Regardless of the results of the deposit action, this execution will be stored in the database to record the history the payment/refund action.

        Parameters:
        actionData - The payment action data which will supply the data to perform deposit.
        Returns:
        ActionResults The results of executing this deposit action.
        Throws:
        ECException
        EDPException
      • cancel

        public ActionResults cancel(PaymentActionData actionData)
                             throws ECException,
                                    EDPException
        This method executes the cancel action.

        The cancel action voids an approval. Only full cancel is supported; the cancel of partial amounts is not supported. This action can occur during the following business events: reservePayment, finalizePayment, cancelOrder and edit.

        The payment rules component decides the cancel action should be executed in the specific business events. And currently the payment action name in payment action data equals "ReverseApprovalAction", then this method is called, which calls DoCancelCmd which further calls the policy command in classical payments.The policy command in classical payments communicates with payment manager to actually execute the cancel action.

        Regardless of the results of the cancel action, this execution will be stored in the database to record the history the payment/refund action.

        Parameters:
        actionData - the payment action data which supply some data to perform cancel action
        Returns:
        ActionResults the results of executing this cancel action.
        Throws:
        ECException
        EDPException
      • refund

        public ActionResults refund(RefundActionData actionData)
                             throws ECException,
                                    EDPException
        This method executes the refund action.

        The refundDeposit action issues a refund to return money to the customer, usually as a result of returning merchandise that was purchased. This action can occur during the following business events: finalizeRefund.

        The payment rules component decides the refund action should be executed in the specific business events. And currently the payment action name in payment action data equals "Refund". Then this method is called, which calls DoRefundCmd which further calls the policy command in classical payments.The policy command in classical payments communicates with payment manager to actually execute the refund action.

        Regardless of the results of the refund action, this execution will be stored in the database to record the history the payment/refund action.

        Parameters:
        actionData - The refund action data which supply some data information to perform refund
        Returns:
        ActionResults The action results of executing this refund action.
        Throws:
        ECException
        EDPException
      • updateActionStatusFromOrderStatus

        public void updateActionStatusFromOrderStatus(ActionData actionData,
                                                      ActionResults actionResults,
                                                      OrderAccessBean iabOrder)
                                               throws ECException,
                                                      EDPException
        This method sets the corresponding status of action data and action results according to the order status.

        If the result of order.getStatus() is: 1. 'C' or 'D', it will be treated as successful. 2. 'M', it will be treated as pending. 3. 'A', This is more complex because each store has different definition for the acceptable avs code. We will create a tickler for the 'A' status and block orders. 4. Other status: ignore it

        Parameters:
        actionData - The action transferred to the command to execute the payment action.
        actionResults - The actionResults returned by the payment action.
        iabOrder - The order access bean associated with this payment action.
        Throws:
        ECException
        EDPException
      • consumeAmount

        public ActionResults consumeAmount(PaymentActionData actionData)
                                    throws ECException,
                                           EDPException
        This method does consume amount action. Use CheckPaymentAcceptCmd command to check if the current order is available, And set the ActioinResult according with the result of CheckPaymentAcceptCmd. If the amount in the action data equals to zero, then do nothing.

        The payment rules component decides the consume action should be executed in the specific business events. And currently the payment action name in payment action data equals "ConsumeAmount". Then this method is called, which calls CheckPaymentAcceptCmd which further calls the policy command in classical payments.The policy command in classical payments communicate with payment manager to actually execute the consume action.

        Regardless of the results of the consume action, this execution will be stored in the database to record the history the payment/refund action.

        Parameters:
        actionData - The action data which will supply the data to perform approve.
        Returns:
        ActionResults The results of executing this cosumeAmount action.
        Throws:
        ECException
        EDPException
      • getOrderChannel

        public java.lang.String getOrderChannel()
        This method gets the current order channel.
        Returns:
        orderChannel The current order channel
      • getPaymentGroupId

        public java.lang.String getPaymentGroupId()
        The method gets the current payment group id.
        Returns:
        paymentGroupId The current payment group id
      • setLocale

        public void setLocale(java.util.Locale currentLocale)
        This method sets the current locale.
        Specified by:
        setLocale in interface DoPaymentActionsPolicyCmd
        Parameters:
        currentLocale - The current locale
      • setOrderChannel

        public void setOrderChannel(java.lang.String string)
        This method sets the current order channel.
        Specified by:
        setOrderChannel in interface DoPaymentActionsPolicyCmd
        Parameters:
        string - The current order channel.
      • setPaymentGroupId

        public void setPaymentGroupId(java.lang.String string)
        This method sets the current payment group id.
        Specified by:
        setPaymentGroupId in interface DoPaymentActionsPolicyCmd
        Parameters:
        string - The current payment group id.
      • setStoreId

        public void setStoreId(java.lang.Integer integer)
        This method sets the current store id.
        Specified by:
        setStoreId in interface DoPaymentActionsPolicyCmd
        Parameters:
        integer - The current store id.
      • reset

        public void reset()
        Description copied from class: AbstractECTargetableCommand
        This method is called after a command has been executed. It is used to reset its states variables. After the call to reset, the command should be able to be executed again.
        Specified by:
        reset in interface com.ibm.websphere.command.Command
        Overrides:
        reset in class AbstractECTargetableCommand
        See Also:
        Command.reset()