com.ibm.commerce.payment.rules

Class PaymentDataAnalyzer

  • java.lang.Object
    • com.ibm.commerce.payment.rules.PaymentDataAnalyzer


  • public class PaymentDataAnalyzer
    extends java.lang.Object
    A helper class to analyze backend payment and credit objects.
    • Field Detail

      • COPYRIGHT

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

        public static final int PAYMENT_STATE_NEW
        PAYMENT_STATE_NEW
        See Also:
        Constant Field Values
      • CREDIT_STATE_NEW

        public static final int CREDIT_STATE_NEW
        CREDIT_STATE_NEW
        See Also:
        Constant Field Values
      • PAYMENT_STATE_CANCELED

        public static final int PAYMENT_STATE_CANCELED
        PAYMENT_STATE_CANCELED
        See Also:
        Constant Field Values
      • CREDIT_STATE_CANCELED

        public static final int CREDIT_STATE_CANCELED
        CREDIT_STATE_CANCELED
        See Also:
        Constant Field Values
      • PAYMENT_STATE_EXPIRED

        public static final int PAYMENT_STATE_EXPIRED
        PAYMENT_STATE_EXPIRED
        See Also:
        Constant Field Values
      • PAYMENT_STATE_FAILED

        public static final int PAYMENT_STATE_FAILED
        PAYMENT_STATE_FAILED
        See Also:
        Constant Field Values
      • CREDIT_STATE_FAILED

        public static final int CREDIT_STATE_FAILED
        CREDIT_STATE_FAILED
        See Also:
        Constant Field Values
      • PAYMENT_STATE_APPROVING

        public static final int PAYMENT_STATE_APPROVING
        PAYMENT_STATE_APPROVINFG
        See Also:
        Constant Field Values
      • PAYMENT_STATE_APPROVED

        public static final int PAYMENT_STATE_APPROVED
        PAYMENT_STATE_APPROVED
        See Also:
        Constant Field Values
      • PAYMENT_STATE_DEPOSITING

        public static final int PAYMENT_STATE_DEPOSITING
        PAYMENT_STATE_DEPOSITING
        See Also:
        Constant Field Values
      • PAYMENT_STATE_DEPOSITED

        public static final int PAYMENT_STATE_DEPOSITED
        PAYMENT_STATE_DEPOSITED
        See Also:
        Constant Field Values
      • PAYMENT_STATE_REVERSING_APPROVAL

        public static final int PAYMENT_STATE_REVERSING_APPROVAL
        PAYMENT_STATE_REVERSING_APPROVAL
        See Also:
        Constant Field Values
      • PAYMENT_STATE_REVERSING_DEPOSIT

        public static final int PAYMENT_STATE_REVERSING_DEPOSIT
        PAYMENT_STATE_REVERSING_DEPOSIT
        See Also:
        Constant Field Values
      • PI_STATE_INVALID

        public static final int PI_STATE_INVALID
        PI_STATE_INVALID
        See Also:
        Constant Field Values
      • CREDIT_STATE_CREDITING

        public static final int CREDIT_STATE_CREDITING
        CREDIT_STATE_CREDITING
        See Also:
        Constant Field Values
      • CREDIT_STATE_CREDITED

        public static final int CREDIT_STATE_CREDITED
        CREDIT_STATE_CREDITED
        See Also:
        Constant Field Values
      • CREDIT_STATE_REVERSING_CREDIT

        public static final int CREDIT_STATE_REVERSING_CREDIT
        CREDIT_STATE_REVERSING_CREDIT
        See Also:
        Constant Field Values
    • Constructor Detail

      • PaymentDataAnalyzer

        public PaymentDataAnalyzer(Payment localPayment)
                            throws InvalidDataException
        This method creates a new analyzer from a payment object.
        Parameters:
        localPayment - The payment to be set
        Throws:
        InvalidDataException - Thrown if null is passed in
      • PaymentDataAnalyzer

        public PaymentDataAnalyzer(Credit localCredit)
                            throws InvalidDataException
        This method creates a new analyzer from a credit object.
        Parameters:
        localCredit - The new analyzer from a credit object
        Throws:
        InvalidDataException - In case of invalid data
    • Method Detail

      • isApproved

        public boolean isApproved()
        This method checks if payment is in approved state.
        Returns:
        A boolean indicating if payment is in approved state
      • hasExpired

        public boolean hasExpired()
        This method checks if payment approval is expired.
        Returns:
        boolean If payment approval has expired
      • getApprovedAmount

        public java.math.BigDecimal getApprovedAmount()
        This method returns the approved amount.
        Returns:
        The approved amount
      • getApprovingAmount

        public java.math.BigDecimal getApprovingAmount()
        This method returns the approving amount.
        Returns:
        The approving amount
      • getCredit

        public Credit getCredit()
        This method returns the backend credit object.
        Returns:
        The backend credit object
      • getCreditState

        public int getCreditState()
        This method returns the backend credit state.
        Returns:
        The backend credit state
      • getDepositedAmount

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

        public java.math.BigDecimal getDepositingAmount()
        This method returns the depositing amount of the payment.
        Returns:
        The depositing amount of the payment
      • isFullyDeposited

        public boolean isFullyDeposited()
        This method checks if the payment is fully deposited.
        Returns:
        If the payment is fully deposited.
      • getLocalizedCreditState

        public java.lang.String getLocalizedCreditState(java.util.Locale locale)
        This method returns the backend credit state as a localize human-readable string.
        Parameters:
        locale - Locale
        Returns:
        The backend credit state as a localize human-readable string
      • getLocalizedPaymentState

        public java.lang.String getLocalizedPaymentState(java.util.Locale locale)
        This method returns the backend payment state as a localize human-readable string.
        Parameters:
        locale - Locale
        Returns:
        The backend payment state as a localize human-readable string
      • getPayment

        public Payment getPayment()
        This method returns the backend payment object.
        Returns:
        The backend payment object
      • getPaymentState

        public int getPaymentState()
        This method returns the payment backend state.
        Returns:
        The payment backend state
      • isPending

        public boolean isPending()
        This method checks if the payment (or credit) backend object is in pending.
        Returns:
        A boolean indicating if the payment (or credit) backend object is in pending
      • toString

        public java.lang.String toString()
        This method converts the payment (or credit) into a readable string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A readable string of the payment (or credit) backend object
      • getCreditStateAsString

        public static java.lang.String getCreditStateAsString(int state)
        This method returns a non-globalized human-readable representation of a credit state.
        Parameters:
        state - The credit state
        Returns:
        A non-globalized human-readable representation of a credit state
      • getPaymentStateAsString

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