Class TerminalResult

java.lang.Object
com.codename1.payment.terminal.TerminalResult

public final class TerminalResult extends Object

The outcome of one operation on a PaymentTerminal: a sale, a pre-authorization, a capture, a reversal, a refund or a lookup.

Only TerminalResult.Status.APPROVED means money moved (or, for a pre-authorization, was reserved). The transaction ID is the provider's own -- a Stripe PaymentIntent ID, an Adyen PSP reference, a ZVT receipt number -- and is what the app's server should look the payment up by before it fulfills an order: a result on a device is a report, not proof.

When a terminal cannot tell whether the card was charged, the request completes with a TerminalOutcomeUnknownException instead of a result, so a FAILED result always means no money moved.

  • Constructor Details

    • TerminalResult

      public TerminalResult(TerminalResult.Status status, String transactionId, String message)
      Parameters
      • status: how the operation ended; never null

      • transactionId: the provider's ID for the payment, or null

      • message: the provider's explanation, or null

  • Method Details

    • getStatus

      public TerminalResult.Status getStatus()
      How the operation ended.
    • isApproved

      public boolean isApproved()
    • getTransactionId

      public String getTransactionId()
      The provider's identifier for the payment, or null when the provider gave none. Pass it to capture, reverse or refund the payment later.
    • getMessage

      public String getMessage()
      The provider's explanation (a decline code, an error message), or null.
    • getApprovedAmount

      public long getApprovedAmount()
      The amount the terminal reported approved, in the minor unit, tip and cashback included; -1 when it did not report one. Can be less than requested when the issuer approved part of it.
    • getTipAmount

      public long getTipAmount()
      The tip included in getApprovedAmount(), in the minor unit; 0 for none.
    • getCurrency

      public String getCurrency()
      The ISO 4217 code of the amounts, or null when not reported.
    • getReference

      public String getReference()
      The app's reference for the operation, as the request carried it or a lookup found it; may be null.
    • getReceipt

      public CardReceipt getReceipt()
      The data a card receipt must show, or null when the terminal reported none.
    • toString

      public String toString()
      Description copied from class: Object
      Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
      Overrides:
      toString in class Object