Class PaymentResponse

java.lang.Object
com.broadleafcommerce.paymentgateway.domain.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:
  • Constructor Details

  • Method Details

    • customer

      public PaymentResponse customer(GatewayCustomer<PaymentResponse> customer)
    • customer

      public GatewayCustomer<PaymentResponse> customer()
    • creditCard

      public CreditCard<PaymentResponse> creditCard()
    • shipTo

      public Address<PaymentResponse> shipTo()
    • billTo

      public Address<PaymentResponse> billTo()
    • giftCard

      public GiftCard<PaymentResponse> giftCard()
    • customerCredit

      public CustomerCredit<PaymentResponse> customerCredit()
    • responseMap

      public PaymentResponse responseMap(String key, String value)
    • paymentOwnerType

      public PaymentResponse paymentOwnerType(String ownerType)
    • paymentOwnerId

      public PaymentResponse paymentOwnerId(String ownerId)
    • orderId

      @Deprecated public PaymentResponse orderId(String orderId)
      Deprecated.
      In favor of paymentOwnerType and paymentOwnerId.
      Sets the Order ID that this transaction is associated with.
      Returns:
      the PaymentResponse
    • getOrderId

      @Deprecated public String getOrderId()
      Deprecated.
      In favor of paymentOwnerType and paymentOwnerId.
      Gets the Order ID that this transaction is associated with.
      Returns:
      the Order ID that this transaction is associated with.
    • paymentId

      public PaymentResponse paymentId(String paymentId)
    • amount

      public PaymentResponse amount(javax.money.MonetaryAmount amount)
    • paymentToken

      @Deprecated public PaymentResponse paymentToken(String paymentToken)
      Deprecated.
      Sets the payment transaction that was created during the associated transaction.
      Returns:
      the PaymentResponse
    • 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.
    • paymentMethodProperties

      public PaymentResponse paymentMethodProperties(Map<String,String> paymentMethodProperties)
    • transactionReferenceId

      public PaymentResponse transactionReferenceId(String transactionReferenceId)
    • gatewayTransactionId

      public PaymentResponse gatewayTransactionId(String gatewayTransactionId)
    • gatewayResponseCode

      public PaymentResponse gatewayResponseCode(String gatewayResponseCode)
    • message

      public PaymentResponse message(String message)
    • threeDSecureVerificationUrl

      public PaymentResponse threeDSecureVerificationUrl(String threeDSecureVerificationUrl)
    • failureType

      public PaymentResponse failureType(String failureType)
    • declineType

      public PaymentResponse declineType(String declineType)
    • dateRecorded

      public PaymentResponse dateRecorded(Instant dateRecorded)
    • paymentGatewayType

      public PaymentResponse paymentGatewayType(PaymentGatewayType paymentGatewayType)
    • paymentType

      public PaymentResponse paymentType(PaymentType paymentType)
    • transactionType

      public PaymentResponse transactionType(TransactionType transactionType)
    • gatewayTransactionType

      public PaymentResponse gatewayTransactionType(String gatewayTransactionType)
    • awaitingAsyncResults

      public PaymentResponse awaitingAsyncResults(boolean awaitingAsyncResults)
    • flaggedForManualReview

      public PaymentResponse flaggedForManualReview(@Nullable Boolean flaggedForManualReview)
    • manualReviewResult

      public PaymentResponse manualReviewResult(String manualReviewResult)
    • manualReviewResultReason

      public PaymentResponse manualReviewResultReason(String manualReviewResultReason)
    • successful

      public PaymentResponse successful(boolean successful)
    • completeCheckoutOnCallback

      public PaymentResponse completeCheckoutOnCallback(boolean completeCheckoutOnCallback)
    • valid

      public PaymentResponse valid(boolean valid)
    • rawResponse

      public PaymentResponse rawResponse(String rawResponse)
    • getCustomer

      public GatewayCustomer<PaymentResponse> getCustomer()
      Any customer information that relates to this transaction
    • 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.
    • isAwaitingAsyncResults

      public boolean isAwaitingAsyncResults()
      Declares whether the transaction was executed synchronously, or if the transaction results will be provided asynchronously.

      In the case of an DefaultTransactionTypes.AUTHORIZE_AND_CAPTURE transaction, the authorize transaction may be executed synchronously, but the capture transaction's results will be communicated asynchronously. In that case, a successful DefaultTransactionTypes.AUTHORIZE_AND_CAPTURE transaction's PaymentResponse should include successful = true and awaitingAsyncResults = true. If the DefaultTransactionTypes.AUTHORIZE_AND_CAPTURE transaction is not successful, then the PaymentResponse should include successful = false and awaitingAsyncResults = false.

    • getFlaggedForManualReview

      @Nullable public Boolean getFlaggedForManualReview()
      Indicates that the payment transaction has been flagged for manual review via fraud checks.
      Returns:
      true if the transaction has been flagged for manual review
    • getManualReviewResult

      public String getManualReviewResult()
      Describes the outcome of the manual review of a transaction after it was flagged by fraud checks.
      Returns:
      The outcome of the manual review of a transaction after it was flagged by fraud checks.
      See Also:
    • getManualReviewResultReason

      public String getManualReviewResultReason()
      Describes the reason for approving/rejecting a transaction during a manual fraud review.
      Returns:
      The reason for approving/rejecting a transaction during a manual fraud review.
    • 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.