com.ibm.commerce.payments.plugin.impl

Class PaymentInstructionImpl

  • java.lang.Object
    • com.ibm.commerce.payments.plugin.impl.PaymentInstructionImpl
  • All Implemented Interfaces:
    PaymentInstruction, java.io.Serializable, java.lang.Cloneable


    public class PaymentInstructionImpl
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Cloneable, PaymentInstruction

    This class is a value object containing detailed information required by plug-ins to process financial transactions (FinancialTransaction).

    The PaymentInstruction(PI) is a container that aggregates the data the plug-ins need to execute financial transactions while processing payment-related and credit-related transactions. It contains account, billing address, amounts, and so on. It does not contain any specific information used to track a particular financial transaction with the back-end system, though. For tracking purposes, the Payment, Credit and FinancialTransaction are used instead.

    The amount on the PaymentInstruction can be used by plug-ins to determine what is the maximum target amount the Payment Plug-in Controller intends to collectively consume. PPC often compares the amount in the PaymentInstruction with the requested amount for approve and credit transactions. PPC has to make sure that the PaymentInstruction amount is always equal or greater than the requested amount.

    The ExtendedData contains all the data related to the a payment instruction that is not defined as an attribute in PaymentInstruction. This is required because all the protocol parameters for a Plugin are not known beforehand by the Payment Plugin Controller. WebSphere Commerce defines a number of keywords to identify common protocol parameters that are not part of the PaymentInstruction set of attributes. The Plugin should take these keywords and map them to their own back-end system definitions. Because it is not possibly to define all the possible keywords for all potential plug-ins, additional keywords might need to be defined by the plug-ins. Plug-ins are responsible for documenting these additional keywords. So that a store might be able to pass these attributes down to the Payment Plugin Controller and then to the Plugin. Then, ExtendedData is in summary, the mechanism by which WebSphere Commerce passes all information related to a PaymentInstruction and required for financial transactions. In addition, if the Plugin has specific needs during Plugin.checkPaymentInstruction(PluginContext, PaymentInstruction) and Plugin.validatePaymentInstruction(PluginContext, PaymentInstruction), the Plugin can add specific keywords and the Payment Plugin Controller will store those keywords and use them in subsequent transactions against that PaymentInstruction.

    Containers: Class Diagram

                                      --------------------
                 --------------------| PaymentInstruction |<------------
                |                     --------------------              |
                |                         ^ 1                           |
                |                         |                             |
                |                         |-----------                  |
                v  1                      |           |                 |
          --------------                  |           |                 | 
         | ExtendedData |                 v 0..n      v 0..n            |
          --------------             ---------       --------           |
                ^  1                | Payment |     | Credit |          |
                |                    ---------       --------           |
                |                        | 1           | 1              |
                |                        |             |                |
                |                        |             |                |
                |                        v 0..n        v 0..n           |
                |                    ----------------------             |
                 -------------------| FinancialTransaction |------------
                                     ----------------------
     
     

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      PaymentInstructionImpl(java.lang.String piId, java.lang.String currency, java.math.BigDecimal amount, ExtendedData extendedData, java.lang.String store)
      This method constructs a PaymentInstruction uniquely identified with an associated amount.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.Object clone()
      This method returns a shallow copy of this PaymentInstructionImpl instance.
      java.lang.String getAccount()
      This method gets the account associated with the PaymentInstruction.
      java.math.BigDecimal getAmount()
      This method gets the target amount to be processed by associated financial transactions.
      java.math.BigDecimal getApprovedAmount()
      This method gets the currently approved amount on this PaymentInstruction.
      java.math.BigDecimal getApprovingAmount()
      This method gets the amount being approved.
      java.math.BigDecimal getCreditedAmount()
      This method gets the currently credited amount on this PaymentInstruction.
      java.math.BigDecimal getCreditingAmount()
      This method gets the amount being credited.
      java.util.ArrayList getCredits()
      This method gets the list of associated Credit containers.
      java.lang.String getCurrency()
      This method gets the currency of the PaymentInstruction.
      java.math.BigDecimal getDepositedAmount()
      This method gets the currently deposited amount on this PaymentInstruction.
      java.math.BigDecimal getDepositingAmount()
      This method gets the amount being deposited.
      ExtendedData getExtendedData()
      This method gets the extra protocol data associated with this PaymentInstruction.
      java.lang.String getId()
      This method gets the unique identifier of the PaymentInstruction container.
      java.lang.String getOrderId()
      This method gets the order associated with the PaymentInstruction.
      java.util.ArrayList getPayments()
      This method gets a list of Payment containers associated with this PaymentInstruction.
      java.lang.String getPaymentSystemName()
      This method gets the payment system name to which the PaymentInstruction is associated with.
      java.lang.String getRmaId()
      This method gets the Return Merchandizing Authorization ID associated with the PaymentInstruction.
      short getState()
      This method gets the current state of the PaymentInstruction.
      static java.lang.String getStateAsString(int state)
      This method gets a non-globalized human-readable representation of a payment instruction state.
      java.lang.String getStore()
      This method gets the merchant's store to which the PaymentInstruction belongs to.
      long getTimeCreated()
      This method gets the time when the PaymentInstruction was created.
      long getTimeUpdate()
      This method gets the most recent time that the PaymentInstruction was updated.
      void setAccount(java.lang.String accountNumber)
      This method sets the account of the PaymentInstruction.
      void setAmount(java.math.BigDecimal amount)
      This method sets the target amount to be processed on one or more payment or credit transactions.
      void setApprovedAmount(java.math.BigDecimal approvedAmount)
      This method sets the currently approved amount on this PaymentInstruction.
      void setApprovingAmount(java.math.BigDecimal approvingAmount)
      This method sets the current amount being approved.
      void setCreditedAmount(java.math.BigDecimal creditAmount)
      This method sets the currently credited amount on this PaymentInstruction.
      void setCreditingAmount(java.math.BigDecimal creditingAmount)
      This method sets the amount being credited.
      void setCredits(java.util.ArrayList credits)
      This method sets a list of Credit containers associated with this .
      void setCurrency(java.lang.String currency)
      This method sets the currency to be used in financial transactions associated with the PaymentInstruction.
      void setDepositedAmount(java.math.BigDecimal depositedAmount)
      This method sets the currently deposited amount on this PaymentInstruction.
      void setDepositingAmount(java.math.BigDecimal depositingAmount)
      This method sets the amount being deposited.
      void setExtendedData(ExtendedData extendedData)
      This method sets the extra protocol data associated with the PaymentInstruction.
      void setOrderId(java.lang.String orderId)
      This method sets the unique order identifier associated with the PaymentInstruction.
      void setPayments(java.util.ArrayList payments)
      This method sets the list of Payment containers associated with this PaymentInstruction.
      void setPaymentSystemName(java.lang.String paymentSystemName)
      This method sets the payment system that will process this PaymentInstruction.
      void setRmaId(java.lang.String rmaId)
      This method sets the Return Merchandizing Authorization ID associated with the PaymentInstruction.
      void setState(short state)
      This method sets the state of the PaymentInstruction.
      void setStore(java.lang.String storeId)
      This method sets the unique identifier of the merchant's store.
      void setTimeCreated(long timeCreated)
      This method sets the time that the PaymentInstruction was created.
      void setTimeUpdate(long timeUpdate)
      This method sets the time the PaymentInstruction was last changed.
      java.lang.String toString()
      This method obtains a human-readable representation of the PaymentInstruction financial container.
      • Methods inherited from class java.lang.Object

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

      • PaymentInstructionImpl

        public PaymentInstructionImpl(java.lang.String piId,
                                      java.lang.String currency,
                                      java.math.BigDecimal amount,
                                      ExtendedData extendedData,
                                      java.lang.String store)

        This method constructs a PaymentInstruction uniquely identified with an associated amount.

        Parameters:
        piId - Uniquely identifies of the PaymentInstruction container.
        currency - The currency to be used for the PaymentInstruction as specified by ISO 4217.
        amount - The maximum amount to be used for the PaymentInstruction
        extendedData - Contains all the data needed by the Plugin to process payment transactions.
        store - The store identifier to which the PI is associated with.
    • Method Detail

      • setAccount

        public void setAccount(java.lang.String accountNumber)

        This method sets the account of the PaymentInstruction.

        The Plugin is responsible for setting the account based on the name-value pairs in extended data.

        The default reserved keyword for the account is as defined in keywords.xml.

        Specified by:
        setAccount in interface PaymentInstruction
        Parameters:
        accountNumber - The account associated with this container.
        See Also:
        getExtendedData()., getAccount().
      • getAccount

        public java.lang.String getAccount()

        This method gets the account associated with the PaymentInstruction.

        Specified by:
        getAccount in interface PaymentInstruction
        Returns:
        The account of the PaymentInstruction.
        See Also:
        setAccount(String).
      • setAmount

        public void setAmount(java.math.BigDecimal amount)

        This method sets the target amount to be processed on one or more payment or credit transactions.

        This amount is usually a hint for the actual amount to be processed. Plugin implementations might decide to support amounts exceeding the target amount or not.

        Parameters:
        amount - The total target amount to be processed in transactions associated with this PaymentInstruction.
      • getAmount

        public java.math.BigDecimal getAmount()

        This method gets the target amount to be processed by associated financial transactions.

        Specified by:
        getAmount in interface PaymentInstruction
        Returns:
        The target amount.
        See Also:
        setAmount(BigDecimal).
      • setApprovedAmount

        public void setApprovedAmount(java.math.BigDecimal approvedAmount)

        This method sets the currently approved amount on this PaymentInstruction.

        Parameters:
        approvedAmount - The currently approvedAmount.
      • setApprovingAmount

        public void setApprovingAmount(java.math.BigDecimal approvingAmount)

        This method sets the current amount being approved.

        Parameters:
        approvingAmount - Decimal value representing the currently approvingAmount.
      • setCreditedAmount

        public void setCreditedAmount(java.math.BigDecimal creditAmount)

        This method sets the currently credited amount on this PaymentInstruction.

        Parameters:
        creditAmount - Decimal value representing the currently creditedAmount.
      • setCreditingAmount

        public void setCreditingAmount(java.math.BigDecimal creditingAmount)

        This method sets the amount being credited.

        Parameters:
        creditingAmount - The amount being credited.
      • setCredits

        public void setCredits(java.util.ArrayList credits)

        This method sets a list of Credit containers associated with this .

        Parameters:
        credits - The list of associated Credit containers .
      • setCurrency

        public void setCurrency(java.lang.String currency)

        This method sets the currency to be used in financial transactions associated with the PaymentInstruction.

        Parameters:
        currency - The currency associated with this PaymentInstruction.
      • getCurrency

        public java.lang.String getCurrency()

        This method gets the currency of the PaymentInstruction.

        Specified by:
        getCurrency in interface PaymentInstruction
        Returns:
        The currency associated with the PaymentInstruction
        See Also:
        setCurrency(String).
      • setDepositedAmount

        public void setDepositedAmount(java.math.BigDecimal depositedAmount)

        This method sets the currently deposited amount on this PaymentInstruction.

        Parameters:
        depositedAmount - The currently deposited amount.
      • setDepositingAmount

        public void setDepositingAmount(java.math.BigDecimal depositingAmount)

        This method sets the amount being deposited.

        Parameters:
        depositingAmount - The amount being deposited.
      • setExtendedData

        public void setExtendedData(ExtendedData extendedData)

        This method sets the extra protocol data associated with the PaymentInstruction.

        Parameters:
        extendedData - The map of name-value pairs representing extended payment information
        See Also:
        getExtendedData().
      • getId

        public java.lang.String getId()
        This method gets the unique identifier of the PaymentInstruction container.
        Specified by:
        getId in interface PaymentInstruction
        Returns:
        The identifier for the PaymentInstruction.
      • setOrderId

        public void setOrderId(java.lang.String orderId)

        This method sets the unique order identifier associated with the PaymentInstruction.

        This is an optional field, since there might not be any order associated with the PaymentInstruction.

        Parameters:
        orderId - The identifier of the associated order.
      • getOrderId

        public java.lang.String getOrderId()

        This method gets the order associated with the PaymentInstruction.

        Specified by:
        getOrderId in interface PaymentInstruction
        Returns:
        The associated order; null if there is no order associated with the PaymentInstruction .
        See Also:
        setOrderId(String).
      • getRmaId

        public java.lang.String getRmaId()

        This method gets the Return Merchandizing Authorization ID associated with the PaymentInstruction.

        Specified by:
        getRmaId in interface PaymentInstruction
        Returns:
        The associated Return Merchandizing Authorization ID; null if not present .
        See Also:
        setOrderId(String).
      • setRmaId

        public void setRmaId(java.lang.String rmaId)

        This method sets the Return Merchandizing Authorization ID associated with the PaymentInstruction.

        This is an optional field, since there might not be any returns associated with the PaymentInstruction.

        Parameters:
        rmaId - The Return Merchandizing Authorization ID.
      • setPaymentSystemName

        public void setPaymentSystemName(java.lang.String paymentSystemName)

        This method sets the payment system that will process this PaymentInstruction.

        The payment system name is typically the name of the plugin implementation defined in the Plugin configuration. However, since multiple payment systems can be associated with the same Plugin. The payment system name can be used by the Plugin to distinguish which back-end system or protocol the Plugin needs to use. This n-to-1 mapping is relevant only to plug-ins that support multiple payment protocols.

        Parameters:
        paymentSystemName - The name of the payment system to process financial transactions.
      • getPaymentSystemName

        public java.lang.String getPaymentSystemName()

        This method gets the payment system name to which the PaymentInstruction is associated with.

        Specified by:
        getPaymentSystemName in interface PaymentInstruction
        Returns:
        The name of the payment system used to process the PaymentInstruction.
        See Also:
        setPaymentSystemName(String).
      • setPayments

        public void setPayments(java.util.ArrayList payments)

        This method sets the list of Payment containers associated with this PaymentInstruction.

        Parameters:
        payments - The list of Credit containers associated with this .
      • getPayments

        public java.util.ArrayList getPayments()

        This method gets a list of Payment containers associated with this PaymentInstruction.

        Specified by:
        getPayments in interface PaymentInstruction
        Returns:
        The list containing the associated Payment containers; this list might be empty.
        See Also:
        setPayments(ArrayList)
      • setStore

        public void setStore(java.lang.String storeId)

        This method sets the unique identifier of the merchant's store.

        Parameters:
        storeId - The unique identifier of the merchant's store.
      • getStore

        public java.lang.String getStore()

        This method gets the merchant's store to which the PaymentInstruction belongs to.

        Specified by:
        getStore in interface PaymentInstruction
        Returns:
        The unique identifier of the merchant's store.
      • setTimeCreated

        public void setTimeCreated(long timeCreated)

        This method sets the time that the PaymentInstruction was created.

        The time should follow GMT standard time.

        Parameters:
        timeCreated - The creation time in milliseconds.
      • getTimeCreated

        public long getTimeCreated()

        This method gets the time when the PaymentInstruction was created.

        Specified by:
        getTimeCreated in interface PaymentInstruction
        Returns:
        The time in milliseconds that the PaymentInstruction was created.
      • setTimeUpdate

        public void setTimeUpdate(long timeUpdate)

        This method sets the time the PaymentInstruction was last changed.

        Parameters:
        timeUpdate - The update time in milliseconds.
      • getTimeUpdate

        public long getTimeUpdate()

        This method gets the most recent time that the PaymentInstruction was updated.

        Specified by:
        getTimeUpdate in interface PaymentInstruction
        Returns:
        The time in milliseconds that the PaymentInstruction last updated.
      • toString

        public java.lang.String toString()

        This method obtains a human-readable representation of the PaymentInstruction financial container.

        Specified by:
        toString in interface PaymentInstruction
        Overrides:
        toString in class java.lang.Object
        Returns:
        A human-readable representation of the PaymentInstruction container.
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException

        This method returns a shallow copy of this PaymentInstructionImpl instance.

        Overrides:
        clone in class java.lang.Object
        Returns:
        A shallow copy of this PaymentInstructionImpl instance.
        Throws:
        java.lang.CloneNotSupportedException - If the instance cannot be cloned.
      • getStateAsString

        public static java.lang.String getStateAsString(int state)
        This method gets a non-globalized human-readable representation of a payment instruction state.
        Parameters:
        state - The payment instruction state.
        Returns:
        A non-globalized human-readable representation of a payment instruction state.