com.ibm.commerce.payment.actions.commands

Class QueryPaymentsInfoCompatiblePolicyCmdImpl

  • All Implemented Interfaces:
    BusinessPolicyCommand, com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, QueryPaymentsInfoPolicyCmd, 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 QueryPaymentsInfoCompatiblePolicyCmdImpl
    extends BusinessPolicyCommandImpl
    implements QueryPaymentsInfoPolicyCmd
    The QueryPaymentsInfoPolicyCmd implementation class when classical payment is used. When the payment rules component wants to get the up to date backend payment information, it calls this command by QueryHandler. And this command gets the payment information through analyzing current status of the order and max amount and actual amount in the table ORDPAYMTHD.

    This class is used with classical payment.

    See Also:
    Serialized Form
    • Constructor Detail

      • QueryPaymentsInfoCompatiblePolicyCmdImpl

        public QueryPaymentsInfoCompatiblePolicyCmdImpl()
    • Method Detail

      • getLocale

        public final java.util.Locale getLocale()
        The method gets the current locale .
        Returns:
        locale The locale used in the action
      • setPaymentActionData

        public void setPaymentActionData(PaymentActionData ac)
        This method sets the payment action data that contains the necessary information for the payment query action. The payment action data is determined by payment rules component.
        Specified by:
        setPaymentActionData in interface QueryPaymentsInfoPolicyCmd
        Parameters:
        ac - The payment action data to be used in the query payment action.
      • getPaymentActionData

        public PaymentActionData getPaymentActionData()
        This method gets the payment action data that contains the necessary information for the payment query action. The payment action data is determined by payment rules component.
        Returns:
        payActionData The payment action data to be used in the query payment action.
      • setRefundActionData

        public void setRefundActionData(RefundActionData ac)
        This method sets the refund action data that contains the necessary information for the credit query action. The refund action data is determined by payment rules component.
        Specified by:
        setRefundActionData in interface QueryPaymentsInfoPolicyCmd
        Parameters:
        ac - The refund action data to be used in the query payment action.
      • getRefundActionData

        public RefundActionData getRefundActionData()
        This method gets the refund action data that contains the necessary information for the credit query action. The refund action data is determined by payment rules component.
        Specified by:
        getRefundActionData in interface QueryPaymentsInfoPolicyCmd
        Returns:
        refundActionData The refund action data to be used in the query payment action.
      • isOrderEditable

        public boolean isOrderEditable()
        This method gets the OrderEditable flag.
        Specified by:
        isOrderEditable in interface QueryPaymentsInfoPolicyCmd
        Returns:
        orderEditable If order is editable
      • performExecute

        public void performExecute()
                            throws ECException
        This method executes the query action. When payment rules component wants to get the payment information, it calls the command QueryHandler that further calls this command, and by the action name in the action data, the corresponding method is called. Because here classical payment is used. We get the payment information through analyzing the status of current order and the max amount and actual amount in ORDPAYMTHD. This represents the approving/approved amount and depositing/deposited amount, respectively.

        Note that if you need check if order is editable, the result is decided by the deposited amount of current order. This means if the order has not been deposited yet, then the order is editable; otherwise it is not.

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

        public void validate()
                      throws EDPException
        This method validates if the query action is valid. Here it judges if the atomic payment is null in the payment action data. And if it is, then an EDPException is thrown.
        Throws:
        EDPException - Thrown if payment id is null
      • getPaymentInstructionWithBackend

        public PaymentInstruction getPaymentInstructionWithBackend()
                                                            throws ECException
        This method gets the backend payment instruction. When the action name in the payment action data is "QueryPaymentInstructionAction", then this method is called, which further calls the method getPaymentInstruction(Long orderId) to get the backend payment instruction.
        Returns:
        PaymentInstruction The backend payment instruction information
        Throws:
        ECException
      • getPaymentWithBackend

        public PaymentDataAnalyzer getPaymentWithBackend()
                                                  throws ObjectCannotBeFoundException,
                                                         ECException
        This method gets the backend payment information. When the action name in the payment action data is "QueryPaymentActione". Then this method is called, which firstly calls the method getPaymentInstruction(Long orderId) to get the backend payment instruction. And then get the payment information for this payment instruction.
        Returns:
        PaymentDataAnalyzer The container of the payment information
        Throws:
        ObjectCannotBeFoundException - Thrown if there is no payments for the current payment instruction
        ECException
      • getCreditWithBackend

        public PaymentDataAnalyzer getCreditWithBackend()
                                                 throws ObjectCannotBeFoundException,
                                                        ECException
        This method gets the backend credit information. When the action name in the payment action data is "QueryCreditAction". Then this method is called, which firstly calls the method getPaymentInstruction(Long orderId) to get the backend payment instruction. And then get the credit information for this payment instruction.
        Returns:
        PaymentDataAnalyzer The container of the credit information
        Throws:
        ObjectCannotBeFoundException - Thrown if there is no credits for the current payment instruction
        ECException
      • getActionResults

        public ActionResults getActionResults()
        This method gets the action results after the corresponding query action is executed.
        Specified by:
        getActionResults in interface QueryPaymentsInfoPolicyCmd
        Returns:
        policyActionResults The action results after the query action is executed.
      • checkIfOrderEditable

        public boolean checkIfOrderEditable()
                                     throws ECException
        This method checks if Order is editable. When the action name in the payment action data is "QueryOrderEditable", then this method is called. And if the deposited amount for current order equals to zero, then true is returned and the order is editable; otherwise false.
        Returns:
        boolean If the order is editable
        Throws:
        ECException
      • getPaymentInstruction

        public PaymentInstruction getPaymentInstruction(java.lang.Long orderId)
                                                 throws ECException
        This method gets payment instruction by order Id. Through the order status and information in the table ORDPAYMTHD, and the payment state is identified for this payment instruction.

        Firstly this method constructs a backend payment instruction through retrieving the properties stored in the table ORDPAYINFO. Then this method analyzes the payment state for this payment instruction, and the criteria are as follows: 1. If actual amount in ORDPAYMTHD is null, and the order status is "M" or "I", it means the payment state is approving. 2. If actual amount in ORDPAYMTHD is null ,and the order status is not "M"/"I"/"D", it means the payment state is approved. 3. If actual amount in ORDPAYMTHD is not null, and the order status is "D", it means the payment state is deposited. 4. If actual amount in ORDPAYMTHD is not null, and the order status is not "D", it means the payment state is depositing.

        Parameters:
        orderId -
        Returns:
        PaymentInstruction A PaymentInstruction object that are constructed through accessing the information in ORDPAYINFO and ORDPAYMTHD table.
        Throws:
        ECException
      • getErrorDetail

        public java.lang.String getErrorDetail()
        This method gets the detailed error information.
        Specified by:
        getErrorDetail in interface QueryPaymentsInfoPolicyCmd
        Returns:
        errorDetail The detailed error information
      • 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()
        This method gets the current payment group id.
        Returns:
        paymentGroupId The current payment group id
      • setLocale

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

        public void setOrderChannel(java.lang.String string)
        This method sets the current order channel.
        Specified by:
        setOrderChannel in interface QueryPaymentsInfoPolicyCmd
        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 QueryPaymentsInfoPolicyCmd
        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 QueryPaymentsInfoPolicyCmd
        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()