com.ibm.commerce.payments.plugincontroller

Class PaymentInstruction

  • java.lang.Object
    • com.ibm.commerce.payments.plugincontroller.PaymentInstruction
  • All Implemented Interfaces:
    java.io.Serializable


    public class PaymentInstruction
    extends java.lang.Object
    implements java.io.Serializable

    This class is the plugin instruction that represents all the data the plugins will need to issue any payment action, in terms of representing the payment method. It will contain account number, billing address, and so on. It does not contain any information used to track a payment against the back end. For that purpose, the transactions are used.

    The amount on this Payment instruction is not typically used on most plugins. But it will let the plugin know up to the amount the Payment Plugin Controller will allow approve to occurs in the system.

    The plugin controller will look at the amount in the PI and check against the requested approve amount. It will check if the Payment Instruction amount is equal to or greater than the requested approve amount. If the check is good then the approve will continue. If the requested approved amount is greater than the Payment amount it will not allow the approve to happen.

    The extendedData will contain all the data related to the Payment method/Type that is not defined as a field. WebSphere Commerce will have a number of Key Words to identify pieces of the Payment methods or types. The plugin will take those key words and map them to their respective backend definitions. Because Commerce will not be able to define all of the different Key words the system will allow for additional key words to be added. The plugin will be responsible for documenting the additional key words that a store needs to pass down. So a store developer/integrator can configure the system to pass those fields. In addition if the plugin has specific needed during checkPaymentInstruction, verifyPaymentInstruction and ValidatePaymentInstruction. It can add plugin specific keywords and the controller will store those key words and use them in follow-on actions against that Payment Instruction.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static short STATE_CLOSED
      State for paymentInstruction when it is closed, no action can be processed under this PaymentInstruction except deletePaymentInstruction.
      static short STATE_INVALID
      The state of PaymentInstruction after a failed validation.
      static short STATE_NEW
      The state of the PaymentInstruction just after its creation and before validation.
      static short STATE_VALID
      The state of PaymentInstruction after a successful validation.
    • Constructor Summary

      Constructors 
      Constructor and Description
      PaymentInstruction(PaymentInstruction pi)
      This method constructs a Payment Instruction from an existing Payment Instruction.
      PaymentInstruction(java.lang.String id, java.math.BigDecimal amount, java.lang.String currency, java.lang.String store, java.lang.String paymentSystemName, java.util.HashMap extendedData)
      This method constructs a Payment Instruction.
      PaymentInstruction(java.lang.String id, java.lang.String store, java.lang.String paymentSystemName)
      This method constructs a Payment Instruction.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String getAccountNumber()
      This method returns the accountNumber.
      java.math.BigDecimal getAmount()
      This method returns the amount associated to this Payment Instruction.
      java.math.BigDecimal getApprovedAmount()
      This method returns the approvedAmount.
      java.math.BigDecimal getApprovingAmount()
      This method returns the approvingAmount.
      java.math.BigDecimal getCreditedAmount()
      This method returns the total creditedAmount from multiple Credits associated.
      java.math.BigDecimal getCreditingAmount()
      This method returns the total crediting amount from multiple Credits associated.
      java.util.ArrayList getCredits()
      This method returns all the Credits associated.
      java.lang.String getCurrency()
      This method returns the currency.
      java.math.BigDecimal getDepositedAmount()
      This method returns the depositedAmount.
      java.math.BigDecimal getDepositingAmount()
      This method returns the depositingAmount.
      java.util.HashMap getExtendedData()
      This method returns the extendedData.
      java.lang.String getId()
      This method returns the Payments Instruction ID.
      java.lang.String getOrderId()
      This method returns the orderId.
      java.lang.String getPaymentConfigurationId()
      This method returns the payment configuration id.
      java.lang.String getPaymentPluginName()
      This method returns the name of the payment plugin the Payment instructions are associated to.
      java.util.ArrayList getPayments()
      This method sets all the Payments associated.
      java.lang.String getPaymentSystemName()
      This method returns the name of the payment systems the Payment instructions are associated to, this is typically the plugin's name.
      PluginException getPluginException()
      This method returns the plugin exception.
      EDPException getPPCException()
      This method returns the PPC exception.
      java.math.BigDecimal getReversingApprovedAmount()
      This method returns the total reversing approved amount from multiple Payments associated.
      java.math.BigDecimal getReversingCreditedAmount()
      This method returns the total reversing credited amount from multiple Payments associated.
      java.math.BigDecimal getReversingDepositedAmount()
      This method returns the total reversing deposited amount from multiple Payments associated.
      java.lang.String getRmaId()
      This method returns the rmaId.
      short getState()
      This method returns the state of the Payment Instruction.
      java.lang.String getStore()
      This method returns the store the Payment instruction is associated to.
      long getTimeCreated()
      This method returns the time on which the Payment instruction was created.
      long getTimeUpdated()
      This method returns the time on which the Payment instruction was updated.
      boolean isPaymentInstructionRetriable()
      This method checks if this PaymentInstruction is retriable in spite that the previous transaction failed.
      void setAccountNumber(java.lang.String accountNumber)
      This method sets the accountNumber.
      void setAmount(java.math.BigDecimal amount)
      This method sets the amount of this PaymentInstruction.
      void setApprovedAmount(java.math.BigDecimal approvedAmount)
      This method sets the approvedAmount.
      void setApprovingAmount(java.math.BigDecimal approvingAmount)
      This method sets the approvingAmount.
      void setCreditedAmount(java.math.BigDecimal creditedAmount)
      This method sets the creditedAmount.
      void setCreditingAmount(java.math.BigDecimal creditingAmount)
      This method sets the total crediting amount from multiple Credits associated.
      void setCredits(java.util.ArrayList credits)
      This method sets all the Credits associated.
      void setCurrency(java.lang.String currency)
      This method sets the currency.
      void setDepositedAmount(java.math.BigDecimal depositedAmount)
      This method sets the depositedAmount.
      void setDepositingAmount(java.math.BigDecimal depositingAmount)
      This method sets the depositing amount.
      void setExtendedData(java.util.HashMap extendedData)
      This method sets the extendedData.
      void setOrderId(java.lang.String orderId)
      This method sets the orderId.
      void setPaymentConfigurationId(java.lang.String string)
      This method sets the payment configuration id.
      void setPaymentInstructionRetriable(boolean localIsPaymentInstructionRetriable)
      This method sets if this PaymentInstruction is retriable in spite that the previous transaction failed.
      void setPaymentPluginName(java.lang.String paymentPluginName)
      This method sets the name of the payment plugin.
      void setPayments(java.util.ArrayList payments)
      This method sets all the Payments associated.
      void setPaymentSystemName(java.lang.String paymentSystemName)
      This method sets the name of the payment systems.
      void setPluginException(PluginException exception)
      this method sets the plugin exception.
      void setPPCException(EDPException exception)
      This method sets the PPC exception.
      void setReversingApprovedAmount(java.math.BigDecimal reversingApprovedAmount)
      This method sets the total reversing approved amount from multiple Payments associated.
      void setReversingCreditedAmount(java.math.BigDecimal reversingCreditedAmount)
      This method sets the total reversing credited amount from multiple Payments associated.
      void setReversingDepositedAmount(java.math.BigDecimal reversingDepositedAmount)
      This method sets the total reversing deposited amount from multiple Payments associated.
      void setRmaId(java.lang.String rmaId)
      This method sets the rmaId.
      void setState(short state)
      This method sets the state.
      void setStore(java.lang.String store)
      This method sets the store.
      void setTimeCreated(long timeCreated)
      This method sets the create time.
      void setTimeUpdated(long timeUpdated)
      This method sets the update time.
      java.lang.String toString()
      This method returns a readable form of the PaymentInstruction object.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • STATE_NEW

        public static final short STATE_NEW
        The state of the PaymentInstruction just after its creation and before validation.
        See Also:
        Constant Field Values
      • STATE_VALID

        public static final short STATE_VALID
        The state of PaymentInstruction after a successful validation.
        See Also:
        Constant Field Values
      • STATE_INVALID

        public static final short STATE_INVALID
        The state of PaymentInstruction after a failed validation.
        See Also:
        Constant Field Values
      • STATE_CLOSED

        public static final short STATE_CLOSED
        State for paymentInstruction when it is closed, no action can be processed under this PaymentInstruction except deletePaymentInstruction.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PaymentInstruction

        public PaymentInstruction(PaymentInstruction pi)

        This method constructs a Payment Instruction from an existing Payment Instruction.

        Parameters:
        pi - A PaymentInstruction that represents the payment instructions this Payment is associated to.
      • PaymentInstruction

        public PaymentInstruction(java.lang.String id,
                                  java.math.BigDecimal amount,
                                  java.lang.String currency,
                                  java.lang.String store,
                                  java.lang.String paymentSystemName,
                                  java.util.HashMap extendedData)

        This method constructs a Payment Instruction.

        Parameters:
        id - A String that specifies the unique identifier of the Payment.
        amount - A BigDecimal that specifies the maximum amount used for the payment instruction.
        currency - A String that specifies the currency used for the payment instruction per ISO 4217.
        store - A String that represents the store the PI is associated to.
        paymentSystemName - A String that specifies the name of the payment system which PPC used to find out the plugin.
        extendedData - A HashMap that contains all of the data needed by the plugin to process payment actions.
      • PaymentInstruction

        public PaymentInstruction(java.lang.String id,
                                  java.lang.String store,
                                  java.lang.String paymentSystemName)

        This method constructs a Payment Instruction.

        Parameters:
        id - A String that specifies the unique identifier of the Payment.
        store - A String that represents the store the PI is associated to.
        paymentSystemName - A String that specifies the name of the payment system which PPC used to find out the plugin.
    • Method Detail

      • getId

        public java.lang.String getId()
        This method returns the Payments Instruction ID.
        Returns:
        A String that specifies the identifier for the Deposit Instruction.
      • getOrderId

        public java.lang.String getOrderId()

        This method returns the orderId.

        Returns:
        A String that specifies the order id representing the order to which this Payment Instruction is associated to.
      • setOrderId

        public void setOrderId(java.lang.String orderId)

        This method sets the orderId.

        Parameters:
        orderId - A String that specifies the orderId to set.
      • setRmaId

        public void setRmaId(java.lang.String rmaId)

        This method sets the rmaId.

        Parameters:
        rmaId - A String that specifies the rmaId to set.
      • getRmaId

        public java.lang.String getRmaId()

        This method returns the rmaId.

        Returns:
        A String that specifies the RMA to which this Payment Instruction is associated to.
      • getPaymentSystemName

        public java.lang.String getPaymentSystemName()

        This method returns the name of the payment systems the Payment instructions are associated to, this is typically the plugin's name.

        Returns:
        A String that specifies the name of the payment system used to process the Payment instruction.
      • setPaymentSystemName

        public void setPaymentSystemName(java.lang.String paymentSystemName)
        This method sets the name of the payment systems.
        Parameters:
        paymentSystemName - A String that specifies the name of the payment systems to set.
      • getPaymentPluginName

        public java.lang.String getPaymentPluginName()

        This method returns the name of the payment plugin the Payment instructions are associated to.

        Returns:
        A String that specifies the name of the payment plugin used to process the Payment instruction.
      • setPaymentPluginName

        public void setPaymentPluginName(java.lang.String paymentPluginName)
        This method sets the name of the payment plugin.
        Parameters:
        paymentPluginName - A String that specifies the name of the payment plugin to set.
      • getState

        public short getState()

        This method returns the state of the Payment Instruction.

        Returns:
        A short that indicates the state of the payment instruction .
      • setState

        public void setState(short state)

        This method sets the state.

        Parameters:
        state - A short that indicates the state to set.
      • getStore

        public java.lang.String getStore()

        This method returns the store the Payment instruction is associated to.

        Returns:
        A String that specifies the store identifier.
      • setStore

        public void setStore(java.lang.String store)
        This method sets the store.
        Parameters:
        store - A String that specifies the store to set.
      • getAccountNumber

        public java.lang.String getAccountNumber()

        This method returns the accountNumber.

        Returns:
        A String that specifies the account number of the payment Instruction.
      • setAccountNumber

        public void setAccountNumber(java.lang.String accountNumber)

        This method sets the accountNumber. The plugin is mainly responsible of setting this value. Since the plugin is the only entity that will definitely know what the account number real name-value pair is within the protocolData. We will have a commerce keyWord to represent account number for Payment method, the KeyWord is AccountNumber.

        Parameters:
        accountNumber - A String that specifies the value of the account number associated to this PaymentInstruction.
      • getAmount

        public java.math.BigDecimal getAmount()

        This method returns the amount associated to this Payment Instruction. Typically this amount is used if there is some validation the plugin needs to do for the PaymentInstruction base on amount.

        Returns:
        A BigDecimal that specifies the amount of this Payment Instruction.
      • setAmount

        public void setAmount(java.math.BigDecimal amount)

        This method sets the amount of this PaymentInstruction.

        Parameters:
        amount - A BigDecimal that specifies the amount to set.
      • getCurrency

        public java.lang.String getCurrency()

        This method returns the currency.

        Returns:
        A String that specifies the currency of the Payment Instruction.
      • setCurrency

        public void setCurrency(java.lang.String currency)

        This method sets the currency.

        Parameters:
        currency - A String that specifies the currency to set.
      • getExtendedData

        public java.util.HashMap getExtendedData()

        This method returns the extendedData.

        Returns:
        A HashMap that contains the Name-value pairs that gives definition to the PaymentInstruction base on the plugin + payment method information.
      • setExtendedData

        public void setExtendedData(java.util.HashMap extendedData)

        This method sets the extendedData. It should be used to store information associated to the Payment Instruction that is intended to be persisted. The information will be added into the existing map, if any mapped value exist it will be replaced with the new one. The data is expected as name-value pairs with simple data types in order to easily stored them in the database. The expected value types are: Integer, Boolean, BigDecimal, Long, String, Binary.

        Parameters:
        extendedData - A HashMap of name-value pairs representing extended payment information.
      • getApprovedAmount

        public java.math.BigDecimal getApprovedAmount()

        This method returns the approvedAmount. This amount is the total approvedAmount from multiple Payments associated.

        Returns:
        A BigDecimal that specifies the amount approved by the back-end system.
      • setApprovedAmount

        public void setApprovedAmount(java.math.BigDecimal approvedAmount)

        This method sets the approvedAmount. This amount is the total approvedAmount from multiple Payments associated.

        Parameters:
        approvedAmount - A BigDecimal that specifies the amount to be set.
      • getApprovingAmount

        public java.math.BigDecimal getApprovingAmount()

        This method returns the approvingAmount. This amount is the total approvingAmount from multiple Payments associated.

        Returns:
        A BigDecimal that specifies the amount pending to approved.
      • setApprovingAmount

        public void setApprovingAmount(java.math.BigDecimal approvingAmount)

        This method sets the approvingAmount. This amount is the total approvingAmount from multiple Payments associated.

        Parameters:
        approvingAmount - A BigDecimal that specifies the approving amount to be set.
      • getDepositedAmount

        public java.math.BigDecimal getDepositedAmount()

        This method returns the depositedAmount. This amount is the total depositedAmount from multiple Payments associated.

        Returns:
        A BigDecimal that specifies the amount deposited by the back end system.
      • setDepositedAmount

        public void setDepositedAmount(java.math.BigDecimal depositedAmount)

        This method sets the depositedAmount. This amount is the total depositedAmount from multiple Payments associated.

        Parameters:
        depositedAmount - A BigDecimal that specifies the deposited amount to be set.
      • getDepositingAmount

        public java.math.BigDecimal getDepositingAmount()

        This method returns the depositingAmount. This amount is the total depositingAmount from multiple Payments associated.

        Returns:
        A BigDecimal that specifies the amount pending to be deposited.
      • setDepositingAmount

        public void setDepositingAmount(java.math.BigDecimal depositingAmount)

        This method sets the depositing amount. This amount is the total depositing amount from multiple Payments associated.

        Parameters:
        depositingAmount - A BigDecimal that specifies the depositing amount to be set.
      • getCreditedAmount

        public java.math.BigDecimal getCreditedAmount()

        This method returns the total creditedAmount from multiple Credits associated.

        Returns:
        A BigDecimal that specifies the amount credited by the back end system.
      • setCreditedAmount

        public void setCreditedAmount(java.math.BigDecimal creditedAmount)

        This method sets the creditedAmount. This amount is the total creditedAmount from multiple Credits associated.

        Parameters:
        creditedAmount - A BigDecimal that specifies the credited amount to set.
      • getCreditingAmount

        public java.math.BigDecimal getCreditingAmount()

        This method returns the total crediting amount from multiple Credits associated.

        Returns:
        A BigDecimal that specifies the crediting amount.
      • setCreditingAmount

        public void setCreditingAmount(java.math.BigDecimal creditingAmount)

        This method sets the total crediting amount from multiple Credits associated.

        Parameters:
        creditingAmount - A BigDecimal that specifies the crediting amount to set.
      • getReversingApprovedAmount

        public java.math.BigDecimal getReversingApprovedAmount()

        This method returns the total reversing approved amount from multiple Payments associated.

        Returns:
        A BigDecimal that specifies the reversing approved amount.
      • setReversingApprovedAmount

        public void setReversingApprovedAmount(java.math.BigDecimal reversingApprovedAmount)

        This method sets the total reversing approved amount from multiple Payments associated.

        Parameters:
        reversingApprovedAmount - A BigDecimal that specifies the reversing approved amount to set.
      • getReversingDepositedAmount

        public java.math.BigDecimal getReversingDepositedAmount()

        This method returns the total reversing deposited amount from multiple Payments associated.

        Returns:
        A BigDecimal that specifies the reversing deposited amount.
      • setReversingDepositedAmount

        public void setReversingDepositedAmount(java.math.BigDecimal reversingDepositedAmount)

        This method sets the total reversing deposited amount from multiple Payments associated.

        Parameters:
        reversingDepositedAmount - A BigDecimal that specifies the reversing deposited amount to set.
      • getReversingCreditedAmount

        public java.math.BigDecimal getReversingCreditedAmount()

        This method returns the total reversing credited amount from multiple Payments associated.

        Returns:
        A BigDecimal that specifies the reversing credited amount.
      • setReversingCreditedAmount

        public void setReversingCreditedAmount(java.math.BigDecimal reversingCreditedAmount)

        This method sets the total reversing credited amount from multiple Payments associated.

        Parameters:
        reversingCreditedAmount - A BigDecimal that specifies the reversing credited amount to set.
      • getTimeCreated

        public long getTimeCreated()

        This method returns the time on which the Payment instruction was created.

        Returns:
        A long that specifies the time on which the Payment instruction was created.
      • setTimeCreated

        public void setTimeCreated(long timeCreated)

        This method sets the create time.

        Parameters:
        timeCreated - A long that specifies the create time to set.
      • getTimeUpdated

        public long getTimeUpdated()

        This method returns the time on which the Payment instruction was updated.

        Returns:
        A long that specifies the time on which the Payment instruction was updated.
      • setTimeUpdated

        public void setTimeUpdated(long timeUpdated)

        This method sets the update time.

        Parameters:
        timeUpdated - A long that specifies the update time to set.
      • getCredits

        public java.util.ArrayList getCredits()

        This method returns all the Credits associated.

        Returns:
        The arrayList of the associated Credits.
      • setCredits

        public void setCredits(java.util.ArrayList credits)

        This method sets all the Credits associated.

        Parameters:
        credits - the ArrayList that specifies the credits list to be set.
      • getPayments

        public java.util.ArrayList getPayments()

        This method sets all the Payments associated.

        Returns:
        The ArrayList of the associated Payments.
      • setPayments

        public void setPayments(java.util.ArrayList payments)

        This method sets all the Payments associated.

        Parameters:
        payments - The payments ArrayList to be set.
      • isPaymentInstructionRetriable

        public boolean isPaymentInstructionRetriable()

        This method checks if this PaymentInstruction is retriable in spite that the previous transaction failed.

        Returns:
        A boolean that indicates if the PaymentInstruction retriable.
      • setPaymentInstructionRetriable

        public void setPaymentInstructionRetriable(boolean localIsPaymentInstructionRetriable)

        This method sets if this PaymentInstruction is retriable in spite that the previous transaction failed.

        Parameters:
        localIsPaymentInstructionRetriable - A boolean that indicates if the PaymentInstruction retriable.
      • toString

        public java.lang.String toString()

        This method returns a readable form of the PaymentInstruction object.

        Warning: not localized, for debugging purposes only!
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string format of the PaymentInstruction object.
      • getPluginException

        public PluginException getPluginException()
        This method returns the plugin exception.
        Returns:
        A PluginException that represents the plugin exception.
      • setPluginException

        public void setPluginException(PluginException exception)
        this method sets the plugin exception.
        Parameters:
        exception - A PluginException that represents the plugin exception.
      • getPPCException

        public EDPException getPPCException()
        This method returns the PPC exception.
        Returns:
        The PPC exception.
      • setPPCException

        public void setPPCException(EDPException exception)
        This method sets the PPC exception.
        Parameters:
        exception - The EDP exception.
      • getPaymentConfigurationId

        public java.lang.String getPaymentConfigurationId()
        This method returns the payment configuration id.
        Returns:
        A String that specifies the payment configuration id.
      • setPaymentConfigurationId

        public void setPaymentConfigurationId(java.lang.String string)
        This method sets the payment configuration id.
        Parameters:
        string - A String that specifies the payment configuration id.