com.ibm.commerce.payment.actions.commands

Class DoPaymentActionsPolicyCmdImpl

  • 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 DoPaymentActionsPolicyCmdImpl
    extends BusinessPolicyCommandImpl
    implements DoPaymentActionsPolicyCmd
    The DoPaymentActionsPolicyCmd implementation class for payment processing component being used. When PaymentEventListenerCmdImpl listens a payment event raised by payment rules component. It will call this class to execute the corresponding payment action through calling the API of payment processing component according to the payment/refund action data.

    This class is used with payment processing component.

    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

      • DoPaymentActionsPolicyCmdImpl

        public DoPaymentActionsPolicyCmdImpl()
    • 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
      • getLocale

        public final java.util.Locale getLocale()
        This method gets the current locale to be used in the action. The locale is an attribute of PaymentContext, when an object of PaymentContext is tried to constructed, it will get the locale to set it to the payment context object as the attribute locale through this method.
        Returns:
        locale The locale used in the action
      • setPamyentContext

        public void setPamyentContext(PaymentContext ctx)
        This method sets the payment context on this action.
        Parameters:
        ctx - The payment context to be used in the action.
      • setPaymentActionDataList

        public void setPaymentActionDataList(java.util.List dataList)
        This method sets the list of payment action data that 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 that 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.
      • getRefundActionDataList

        public java.util.List getRefundActionDataList()
        This method gets the list of refund action data that 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.
      • setRefundActionDataList

        public void setRefundActionDataList(java.util.List list)
        This method sets the list of refund action data that 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:
        list - The list of refund action data to be used in the actions.
      • performExecute

        public void performExecute()
                            throws ECException
        This method performs the payment actions through calling the API of payment processing component by 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 - If something goes wrong
      • updateActionStatusFromBackendResult

        public void updateActionStatusFromBackendResult(ActionData actionData,
                                                        ActionResults actionResult,
                                                        Result ppcBackendResult)
                                                 throws CommunicationException
        This method determines action result status based on the status in backend result returned from payment processing component. It's set from the Plugin financial transaction status. It also set readable status for activity log.
        Parameters:
        actionData - The action data of the action
        actionResult - The results of the action
        ppcBackendResult - The backend result coming from payment processing component
        Throws:
        CommunicationException
      • validate

        public void validate()
                      throws EDPException
        This method validates if the payment action is valid. Here we just provide a null implementation.
        Throws:
        EDPException - thrown if payment id is null
      • approve

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

        This action verifies that the customer should be allowed to make the purchase to reduce the risk of not receiving payment for the order. The approve action helps to ensure that a customer has adequate funds available to make the purchase. Depending on the payment type and business policy, varying actions will be performed. For example. In the case of credit cards, a credit card authorization request is sent and a transaction is approved, thereby ensuring the merchant will receive payment. A positive approval results in an authorization code being generated, and those funds being set aside. The cardholder's credit limit is then reduced by the authorized or approved amount. The intention is that payment problems that are detected can be communicated back to the customer while the customer is online. The approve action does not apply to all payment methods. For instance, it would not make sense for an approve action to occur for electronic check (ACH) transactions. The approve action can occur during the following business events: primePayment, reservePayment, and finalizePayment.

        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 the API approve of payment processing component. The payment processing component further calls the API approve of Plugin 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 of the action
        Returns:
        ActionResults The results of the action
        Throws:
        EDPException
        ECException
      • 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 back-end system or payment processor 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 through the payment rules configuration. And currently the payment action name in payment action data equals "DepositAction". Then the this method is called, which calls the API deposit of payment processing component. The payment processing component further calls the API deposit of Plugin 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 action data of the action
        Returns:
        ActionResults The results of the action
        Throws:
        ECException
        EDPException - thrown in the event of any failure
      • approveAndDeposit

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

        approveAndDeposit verifies that the customer should be allowed to make the purchase and captures payment for the order. Some payment systems do not implement an approve payment action by itself. It uses a process that performs both the approval and deposit as a single process. For example, electronic fund transfers and electronic checks). This action can occur during the following business events: primePayment, reservePayment, and finalizePayment.

        The payment rules component decides the approveAndDeposit action should be executed through the payment rules configuration. And currently the payment action name in payment action data equals "ApproveAndDepositAction". Then this method is called, which calls the API approveAndDeposit of payment processing component. The payment processing component further calls the API approveAndDeposit of Plugin to actually execute the approveAndDeposit action.

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

        Parameters:
        actionData - The action data of the action
        Returns:
        ActionResults The results of the action
        Throws:
        ECException
        EDPException - Thrown in the event of any failure
      • reverseApprove

        public ActionResults reverseApprove(PaymentActionData actionData)
                                     throws ECException,
                                            EDPException
        This methods executes the reverse approve action.

        The reverseApprove action voids an approval. Only full reversals are supported; the reversal 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 reserveApprove 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 the API reverseApproval of payment processing component. The payment processing component further calls the API reverseApproval of Plugin to actually execute the reverseApprove action.

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

        Parameters:
        actionData - The action data of the action
        Returns:
        ActionResults The results of the action
        Throws:
        ECException
        EDPException - thrown in the event of any failure
      • reverseDeposit

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

        Voids a deposit. Only full deposits are supported; the reversal of partial amounts is not supported.

        The payment rules component decides the reserveDeposit action should be executed in the specific business events. And currently the payment action name in payment action data equals "ReverseDepositAction". Then this method is called, which calls the API reverseDeposit of payment processing component. The payment processing component further calls the API reverseDeposit of Plugin to actually execute the reverseDeposit action.

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

        Parameters:
        actionData - The payment action data of this action
        Returns:
        ActionResults The results of the action
        Throws:
        ECException
        EDPException - thrown in the event of any failure
      • refundDeposit

        public ActionResults refundDeposit(RefundActionData refundActionData)
                                    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 refundDeposit 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 the API credit of payment processing component. The payment processing component further calls the API credit of Plugin to actually execute the credit action.

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

        Parameters:
        refundActionData - The action data of the action
        Returns:
        ActionResults The results of the action
        Throws:
        ECException
        EDPException - thrown in the event of any failure
      • getOrderChannel

        public java.lang.String getOrderChannel()
        This method gets the current order channel, which will be put into payment context where there is a corresponding attribute.
        Returns:
        orderChannel The current order channel.
      • getPaymentGroupId

        public java.lang.String getPaymentGroupId()
        This method gets the current payment group id, which will be put into payment context where there is a corresponding attribute.
        Returns:
        paymentGroupId The current payment group id.
      • setLocale

        public void setLocale(java.util.Locale localeLocal)
        This method sets the current locale, which will be put into payment context where there is a corresponding attribute. You must set the current locale to put it into the payment context before processing the payment
        Specified by:
        setLocale in interface DoPaymentActionsPolicyCmd
        Parameters:
        localeLocal - The current locale.
      • setOrderChannel

        public void setOrderChannel(java.lang.String string)
        This method sets the current order channel, which will be put into payment context where there is a corresponding attribute. You must set the current order channel to put it into the payment context before processing the payment.
        Specified by:
        setOrderChannel in interface DoPaymentActionsPolicyCmd
        Parameters:
        string - The current order channel.
      • setPaymentGroupId

        public void setPaymentGroupId(java.lang.String string)
        This method sets the payment group id, which will be put into payment context where there is a corresponding attribute. You must set the current payment group id to put it into the payment context before processing the payment.
        Specified by:
        setPaymentGroupId in interface DoPaymentActionsPolicyCmd
        Parameters:
        string - The current payment group id.
      • getStoreId

        public java.lang.Integer getStoreId()
        This method gets the store id, which will be put into payment context where there is a corresponding attribute.
        Specified by:
        getStoreId in interface ECCommand
        Overrides:
        getStoreId in class AbstractECTargetableCommand
        Returns:
        storeId The current payment store id.
      • setStoreId

        public void setStoreId(java.lang.Integer integer)
        This method sets the store id, which will be put into payment context where there is a corresponding attribute. You must set the current store id to put it into the payment context before processing the payment.
        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()