Class PaymentResponse

  • All Implemented Interfaces:
    Serializable

    public class PaymentResponse
    extends Object
    implements Serializable

    The DTO object that represents the response coming back from any call to the Gateway. This can either wrap an API result call or a translated HTTP Web response. This can not only be the results of a transaction, but also a request for a Secure Token etc...

    Note: the success and validity flags are set to true by default, unless otherwise overridden by specific gateway implementations

    Author:
    Elbert Bautista (elbertbautista)
    See Also:
    Serialized Form
    • Constructor Detail

      • PaymentResponse

        public PaymentResponse()
    • Method Detail

      • getOrderId

        @Deprecated
        public String getOrderId()
        Deprecated.
        Gets the Order ID that this transaction is associated with.
        Returns:
        the Order ID that this transaction is associated with.
      • amount

        public PaymentResponse amount​(javax.money.MonetaryAmount amount)
      • getPaymentToken

        @Deprecated
        public String getPaymentToken()
        Deprecated.
        Gets the payment transaction that was created during the associated transaction.
        Returns:
        the payment transaction that was created during the associated transaction.
      • transactionReferenceId

        public PaymentResponse transactionReferenceId​(String transactionReferenceId)
      • threeDSecureVerificationUrl

        public PaymentResponse threeDSecureVerificationUrl​(String threeDSecureVerificationUrl)
      • gatewayTransactionType

        public PaymentResponse gatewayTransactionType​(String gatewayTransactionType)
      • awaitingAsyncResults

        public PaymentResponse awaitingAsyncResults​(boolean awaitingAsyncResults)
      • completeCheckoutOnCallback

        public PaymentResponse completeCheckoutOnCallback​(boolean completeCheckoutOnCallback)
      • getShipTo

        public Address<PaymentResponse> getShipTo()
        If shipping information is captured on the gateway, the values sent back will be put here
      • getBillTo

        public Address<PaymentResponse> getBillTo()
        The billing address associated with this transaction
      • getCreditCard

        public CreditCard<PaymentResponse> getCreditCard()
        for sale/authorize transactions, this will be the Credit Card object that was charged. This data is useful for showing on an order confirmation screen.
      • getGiftCards

        public List<GiftCard<PaymentResponse>> getGiftCards()
        Any gift cards that have been processed. This data is useful for showing on an order confirmation screen
      • getCustomerCredits

        public List<CustomerCredit<PaymentResponse>> getCustomerCredits()
        Any customer credit accounts that have been processed. This data is useful for showing on an order confirmation screen
      • getPaymentGatewayType

        public PaymentGatewayType getPaymentGatewayType()
        The Payment Gateway Type that this transaction response represents
      • getPaymentType

        public PaymentType getPaymentType()
        The Type of Payment that this transaction response represents
      • getTransactionType

        public TransactionType getTransactionType()
        The Transaction Type of the Payment that this response represents
      • getGatewayTransactionType

        public String getGatewayTransactionType()
        The executed transaction type, as described by the gateway. For example, the transactionType may be DefaultTransactionTypes.REFUND, while the gateway transaction is called a "VOID" in their system.
      • getTransactionReferenceId

        public String getTransactionReferenceId()
        The transaction reference that is passed to the payment gateway. This reference can be used to link the request to the gateway's record of the transaction in the case that the calling application does not receive a response from the gateway.
        Returns:
        The transaction reference that is passed to the payment gateway.
      • getGatewayTransactionId

        public String getGatewayTransactionId()
        The transaction id that is returned by the payment gateway.
        Returns:
        The transaction id that is returned by the payment gateway
      • getPaymentOwnerType

        public String getPaymentOwnerType()
        Describes the owner of the payment. For example, the payment could have originated with a cart or a subscription, therefore this value might be CART or SUBSCRIPTION.
        Returns:
        The type describing the owner of the payment.
      • getPaymentOwnerId

        public String getPaymentOwnerId()
        The id of the entity that owns the payment. For example, this may be a cart id, or a subscription billing cycle id.
        Returns:
        The id of the entity that owns the payment.
      • getPaymentOwnerDescription

        public String getPaymentOwnerDescription()
        A description of the payment owner associated with this transaction
        Returns:
        A description of the payment owner associated with this transaction.
      • getPaymentId

        public String getPaymentId()
        The Payment ID that this transaction is associated with
      • getAmount

        public javax.money.MonetaryAmount getAmount()
      • isSuccessful

        public boolean isSuccessful()
        Whether or not the transaction on the gateway was successful. This should be provided by the gateway alone.
      • isValid

        public boolean isValid()
        Whether or not this response was tampered with. This used to verify that the response that was received on the endpoint (which is intended to only be invoked from the payment gateway) actually came from the gateway and was not otherwise maliciously invoked by a 3rd-party.
      • getGatewayResponseCode

        public String getGatewayResponseCode()
        The response code provided by the payment gateway which may represent a success or failure
        Returns:
        The response code provided by the payment gateway which may represent a success or failure
      • getMessage

        public String getMessage()
        Message describing the result of the transaction
        Returns:
        Message describing the result of the transaction
      • getPaymentMethodProperties

        public Map<String,​String> getPaymentMethodProperties()
        Map to capture any information about the payment method needed to perform gateway transactions. This map should be empty unless a transaction also included the creation of a multi-use payment method.
        Returns:
        Map to capture any information about the payment method needed to perform gateway transactions
      • getThreeDSecureVerificationUrl

        public String getThreeDSecureVerificationUrl()
        The gateway-provided url where the customer must verify that they are in fact the owner of the payment method. The customer is typically redirected to this location, but the page can also be rendered within an iframe if you'd like.
        Returns:
        The gateway-provided url where the customer must verify that they are in fact the owner of the payment method.
      • getFailureType

        public String getFailureType()
        The type of transaction failure (TransactionFailureType).
        Returns:
        The type of transaction failure
      • getDeclineType

        public String getDeclineType()
        The type of transaction decline (hard vs soft decline)
        Returns:
        The type of transaction decline (hard vs soft decline)
      • getDateRecorded

        public Instant getDateRecorded()
        The timestamp when this transaction response was recorded
        Returns:
        The timestamp when this transaction response was recorded
      • isCompleteCheckoutOnCallback

        public boolean isCompleteCheckoutOnCallback()

        Sets whether or not this module should complete checkout on callback. In most Credit Card gateway implementation, this should be set to 'TRUE' and should not be configurable as the gateway expects it to tbe the final step in the checkout process.

        In gateways where it does not expect to be the last step in the checkout process, for example BLC Gift Card Module, PayPal Express Checkout, etc... The callback from the gateway can be configured whether or not to complete checkout.

      • getRawResponse

        public String getRawResponse()
        A string representation of the response that came from the gateway. This should be a string serialization of responseMap.
      • getResponseMap

        public Map<String,​String> getResponseMap()
        A more convenient representation of rawResponse to hold the response from the gateway.