com.ibm.commerce.payment.actions.commands

Class EditPaymentInstructionPolicyCmdImpl

  • All Implemented Interfaces:
    BusinessPolicyCommand, com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, EditPaymentInstructionPolicyCmd, 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 EditPaymentInstructionPolicyCmdImpl
    extends BusinessPolicyCommandImpl
    implements EditPaymentInstructionPolicyCmd
    The EditPaymentInstructionPolicyCmd implementation class when new payment processing component is used. This command edit payment instruction stored in payment processing component tables. When payment rules component edits the payment instruction in payment rules related tables. It then calls this command to edit the payment instruction in payment processing related tables.

    This class is used with new 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

      • EditPaymentInstructionPolicyCmdImpl

        public EditPaymentInstructionPolicyCmdImpl()
    • Method Detail

      • getLocale

        public final java.util.Locale getLocale()
        This method gets the locale from the CommandContext to be used in the action.
        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 instruction edit action. The payment action data is determined by payment rules component.
        Specified by:
        setPaymentActionData in interface EditPaymentInstructionPolicyCmd
        Parameters:
        ac - The payment action data to be used in the edit payment action.
      • getPaymentActionData

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

        public void performExecute()
                            throws ECException
        This method performs the actions edit payment instruction through calling the edit API of payment processing component by per action data type.

        This method is called by the commands of payment rules component. It's called when they decide to execute the actions edit the payment instructions in payment processing component.

        There is the payment action data contains the necessary information for the payment instruction edit action that is passed to this command. Then this command execute the create/update/cancel operation according to the action name in the payment action data.

        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(PaymentActionResults actionResult,
                                                        Result ppcBackendResult)
                                                 throws CommunicationException
        This method determines action result status based on the status in backend result returned from payment processing component, which set from Plugin financial transaction status. It also set readable status for activity log.
        Parameters:
        actionResult - The results of the action
        ppcBackendResult - The backend result coming from PPC
        Throws:
        CommunicationException
      • validate

        public void validate()
                      throws EDPException
        This method validates if the edit 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
      • cancelPaymentInstruction

        public ActionResults cancelPaymentInstruction()
                                               throws EDPException,
                                                      ECException,
                                                      PluginException
        This method cancels a payment instruction in payment processing component. When the action name in the payment action data is "CancelPaymentInstructionAction", then this method is called. It further calls the API cancelPaymentInstruction of payment processing component to cancel the specific payment instruction and mark it deleted in payment processing component.

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

        Returns:
        ActionResult The results of after executing this cancel action
        Throws:
        EDPException - Thrown in the event of any failure
        PluginException
        ECException
      • getActionResults

        public ActionResults getActionResults()
        This method gets the action results after the corresponding edit action is executed.
        Specified by:
        getActionResults in interface EditPaymentInstructionPolicyCmd
        Returns:
        policyActionResults The action results after the edit action is executed.
      • 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 localLocal)
        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 EditPaymentInstructionPolicyCmd
        Parameters:
        localLocal - 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 EditPaymentInstructionPolicyCmd
        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 EditPaymentInstructionPolicyCmd
        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 gets the store id, which will be put into payment context where there is a corresponding attribute.
        Specified by:
        setStoreId in interface EditPaymentInstructionPolicyCmd
        Parameters:
        integer - The current payment store id.
      • isCardExpiryDateValid

        public static boolean isCardExpiryDateValid(int expiryMonth,
                                                    int expiryYear)
        This method checks if the specified expiry date (expiryMonth and expiryYear) is valid.
        Parameters:
        expiryMonth - The calender month of the expiry date (1 for January, 2 for February, and so on.)
        expiryYear - The calender year of the expiry date
        Returns:
        true If the expiry date is valid.
      • removeSpaceAndHyphenFromString

        public static java.lang.String removeSpaceAndHyphenFromString(java.lang.String aCardNumber)
        The method returns a new string that is free of any spaces and hyphenated characters. If the supplied string is already free of spaces and hyphens the same string may be returned.
        Parameters:
        aCardNumber - The card number to be examined and stripped
        Returns:
        String A string free of spaces and hyphenated characters ('-')
      • 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()