com.ibm.commerce.payment.rules

Class AtomicPaymentToBackendLinkObject

  • java.lang.Object
    • com.ibm.commerce.payment.rules.AtomicPaymentToBackendLinkObject
  • All Implemented Interfaces:
    java.lang.Comparable


    public class AtomicPaymentToBackendLinkObject
    extends java.lang.Object
    implements java.lang.Comparable

    This class maintains the link information between an atomic payment in Payment Rules and its corresponding representation in the Payment Backend System. Thus the attributes of this class include a reference to an atomic payment, as well as state and amount attributes for the corresponding backend payment object.

    It is used by PaymentSorter to provide a list of Backend Payment objects on which the payment action rule must take some action on. An attribute, availableAmount, is a placeholder for the amount of an atomic payment that is still available for allocation for a given phase of the operation. Thus if the total amount of the atomic payment is 30.00, and the reservation amount is 10.00, the availableAmount would be 20.00 in the reservation phase.
    Another attribute, requestAmount, is the cumulative sum of the amounts that are allocated for a given phase of operation for a given atomic payment. Thus if total amount of the atomic payment is 30.00, and reservation amount is 10.00, and an additional 15.00 is allocated to this atomic payment. The requestAmount would now be 25.00. The availableAmount is used by the PaymentSorter in making its decision regarding which Backend Payment objects should be passed to the payment action rule, and the requestAmount is used by the payment action rule to determine the actual payment actions (and amount).

    See Also:
    PaymentSorterHelper
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int compareTo(java.lang.Object arg0)
      This method first compares the backendPaymentState, the object whose backendPaymentState is in "Deposited" state will before the one whose backendPaymentState is not in "Deposited" state.
      boolean equals(java.lang.Object arg0)
      This method returns if the available amount of the AtomicPaymentToBackendLinkObject object in the parameter equals to the available amount of current object
      java.lang.String[] getAssociatedItems()
      This method returns order items associated with this payment object.
      com.ibm.commerce.edp.model.AtomicPaymentData getAtomicPayment()
      This method returns the atomic payment.
      java.math.BigDecimal getAvailableAmount()
      This method returns the available amount of this atomic payment.
      int getBackendPaymentState()
      This method returns the backend payment state.
      java.math.BigDecimal getBackendTotalPaymentAmount()
      This method returns the backend total payment amount.
      java.math.BigDecimal getDepositedAmount()
      This method returns the deposited amount of the backend payment.
      java.math.BigDecimal getRequestAmount()
      This method returns the request amount of the atomic payment.
      int hashCode()
      This method returns the hashcode of the available amount.
      boolean isAtomicPaymentPresent()
      This method returns if the atomic payment is present.
      void setAssociatedItems(java.lang.String[] associatedOrderItems)
      This method sets the order items associated with this payment object.
      void setAtomicPayment(com.ibm.commerce.edp.model.AtomicPaymentData localAtomicPayment)
      This method sets the atomic payment.
      void setAvailableAmount(java.math.BigDecimal localAvailableAmount)
      This method sets the available amount of this atomic payment.
      void setBackendPaymentState(int localMpfPaymentState)
      This method sets the backend payment state.
      void setBackendTotalPaymentAmount(java.math.BigDecimal localMpfPaymentAmount)
      This method sets the backend total payment amount.
      void setDepositedAmount(java.math.BigDecimal decimal)
      This method sets the deposited amount of the backend payment.
      void setIsAtomicPaymentPresent(boolean localIsAtomicPaymentPresent)
      This method sets if the atomic payment present.
      void setRequestAmount(java.math.BigDecimal localRequestAmount)
      This method sets the request amount of the atomic payment.
      java.lang.String toString()
      This method dumps this object as non-globalized human-readable string.
      • Methods inherited from class java.lang.Object

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

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AtomicPaymentToBackendLinkObject

        public AtomicPaymentToBackendLinkObject()
        This method is the constructor of this class. It initializes amounts to zero, backend Payment states to correspond with the situation that they do not exist yet in the backend.
    • Method Detail

      • setAtomicPayment

        public void setAtomicPayment(com.ibm.commerce.edp.model.AtomicPaymentData localAtomicPayment)
        This method sets the atomic payment.
        Parameters:
        localAtomicPayment - The atomic payment to set
      • getAtomicPayment

        public com.ibm.commerce.edp.model.AtomicPaymentData getAtomicPayment()
        This method returns the atomic payment.
        Returns:
        atomicPayment The atomic payment
      • isAtomicPaymentPresent

        public boolean isAtomicPaymentPresent()
        This method returns if the atomic payment is present.
        Returns:
        A boolean indicating if the atomic payment is present
      • setAvailableAmount

        public void setAvailableAmount(java.math.BigDecimal localAvailableAmount)
        This method sets the available amount of this atomic payment.
        Parameters:
        localAvailableAmount - The available amount to set
      • getAvailableAmount

        public java.math.BigDecimal getAvailableAmount()
        This method returns the available amount of this atomic payment.
        Returns:
        availableAmount The available amount of this atomic payment
      • setBackendPaymentState

        public void setBackendPaymentState(int localMpfPaymentState)
        This method sets the backend payment state.
        Parameters:
        localMpfPaymentState - The backend payment state
      • getBackendPaymentState

        public int getBackendPaymentState()
        This method returns the backend payment state.
        Returns:
        backendPaymentState The backend payment state
      • setBackendTotalPaymentAmount

        public void setBackendTotalPaymentAmount(java.math.BigDecimal localMpfPaymentAmount)
        This method sets the backend total payment amount.
        Parameters:
        localMpfPaymentAmount - The backend total payment amount to set
      • getBackendTotalPaymentAmount

        public java.math.BigDecimal getBackendTotalPaymentAmount()
        This method returns the backend total payment amount.
        Returns:
        backendPaymentAmount The backend total payment amount
      • setDepositedAmount

        public void setDepositedAmount(java.math.BigDecimal decimal)
        This method sets the deposited amount of the backend payment.
        Parameters:
        decimal - a BigDecimal of deposited amount
      • getDepositedAmount

        public java.math.BigDecimal getDepositedAmount()
        This method returns the deposited amount of the backend payment.
        Returns:
        depostiedAmount The deposited amount of the backend payment
      • setIsAtomicPaymentPresent

        public void setIsAtomicPaymentPresent(boolean localIsAtomicPaymentPresent)
        This method sets if the atomic payment present.
        Parameters:
        localIsAtomicPaymentPresent - If the atomic payment is present
      • setRequestAmount

        public void setRequestAmount(java.math.BigDecimal localRequestAmount)
        This method sets the request amount of the atomic payment.
        Parameters:
        localRequestAmount - The request amount of the atomic payment to set
      • getRequestAmount

        public java.math.BigDecimal getRequestAmount()
        This method returns the request amount of the atomic payment.
        Returns:
        requestAmount The request amount of the atomic payment
      • getAssociatedItems

        public java.lang.String[] getAssociatedItems()
        This method returns order items associated with this payment object.
        Returns:
        order items associated with this payment object
      • setAssociatedItems

        public void setAssociatedItems(java.lang.String[] associatedOrderItems)
        This method sets the order items associated with this payment object.
        Parameters:
        associatedOrderItems - The associatedItems to set.
      • compareTo

        public int compareTo(java.lang.Object arg0)

        This method first compares the backendPaymentState, the object whose backendPaymentState is in "Deposited" state will before the one whose backendPaymentState is not in "Deposited" state. If the two objects' backendPaymentState are both or neither in "Deposited" state, this method compares the available amount fields, and in the reverse order from the caller's comparison. If the available amount is same and the atomic payment is not null, this method compares the identifiers of the atomic payment. The object with smaller atomic payment identifier will be before the one with larger atomic payment

        That is, this call would be invoked when the caller says, say,:

        this.compareTo(parmOfSameType ) > 0 

        implying when the current object is greater than the parmOfSameType object. This test is successful if the available amount field in current object is less than this field in parmOfSameType . The PaymentSorter object uses this comparison field when preparing a sorted list of atomic payments.

        Specified by:
        compareTo in interface java.lang.Comparable
        Parameters:
        arg0 - Expected to be of typeAPRequestAmountContainer
        Returns:
        0 If the two objects' priorities are equal. 1 If the current object after the parameter. -1 If the current object before parameter
        See Also:
        Comparable.compareTo(Object), PaymentSorterHelper
      • equals

        public boolean equals(java.lang.Object arg0)
        This method returns if the available amount of the AtomicPaymentToBackendLinkObject object in the parameter equals to the available amount of current object
        Overrides:
        equals in class java.lang.Object
        Parameters:
        arg0 - expected to be of type APRequestAmountContainer
        Returns:
        true if availableAmount are equal
        See Also:

      • hashCode

        public int hashCode()
        This method returns the hashcode of the available amount.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode The availableAmount field
      • toString

        public java.lang.String toString()
        This method dumps this object as non-globalized human-readable string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A non-globalized human-readable string representation of this object