Class PaymentResponse
- All Implemented Interfaces:
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionamount
(javax.money.MonetaryAmount amount) awaitingAsyncResults
(boolean awaitingAsyncResults) billTo()
completeCheckoutOnCallback
(boolean completeCheckoutOnCallback) customer()
customer
(GatewayCustomer<PaymentResponse> customer) customerNotification
(PaymentCustomerNotification customerNotification) dateRecorded
(Instant dateRecorded) declineType
(String declineType) failureType
(String failureType) flaggedForManualReview
(Boolean flaggedForManualReview) gatewayResponseCode
(String gatewayResponseCode) gatewayTransactionId
(String gatewayTransactionId) gatewayTransactionType
(String gatewayTransactionType) javax.money.MonetaryAmount
The billing address associated with this transactionfor sale/authorize transactions, this will be the Credit Card object that was charged.Any customer information that relates to this transactionAny customer credit accounts that have been processed.The notification that should be sent to the customer.The timestamp when this transaction response was recordedThe type of transaction decline (hard vs soft decline)The type of transaction failure (TransactionFailureType
).Indicates that the payment transaction has been flagged for manual review via fraud checks.The response code provided by the payment gateway which may represent a success or failureThe transaction id that is returned by the payment gateway.The executed transaction type, as described by the gateway.Any gift cards that have been processed.Describes the outcome of the manual review of a transaction after it was flagged by fraud checks.Describes the reason for approving/rejecting a transaction during a manual fraud review.Message describing the result of the transactionDeprecated.The Payment Gateway Type that this transaction response representsThe Payment ID that this transaction is associated withMap to capture any information about the payment method needed to perform gateway transactions.A description of the payment owner associated with this transactionThe id of the entity that owns the payment.Describes the owner of the payment.Deprecated.in favor ofgetPaymentMethodProperties()
The Type of Payment that this transaction response representsA string representation of the response that came from the gateway.Assuming that a saved payment method was used for the interaction, this field provides a recommendedSavedPaymentMethodStatus
based on the results of the interaction.A more convenient representation ofrawResponse
to hold the response from the gateway.If shipping information is captured on the gateway, the values sent back will be put hereThe transaction reference that is passed to the payment gateway.The Transaction Type of the Payment that this response representsgiftCard()
boolean
Declares whether the transaction was executed synchronously, or if the transaction results will be provided asynchronously.boolean
Sets whether or not this module should complete checkout on callback.boolean
Whether or not the transaction on the gateway was successful.boolean
isValid()
Whether or not this response was tampered with.manualReviewResult
(String manualReviewResult) manualReviewResultReason
(String manualReviewResultReason) nextAction
(NextAction nextAction) Deprecated.In favor ofpaymentOwnerType
andpaymentOwnerId
.paymentGatewayType
(PaymentGatewayType paymentGatewayType) paymentMethodProperties
(Map<String, String> paymentMethodProperties) paymentOwnerId
(String ownerId) paymentOwnerType
(String ownerType) paymentToken
(String paymentToken) Deprecated.in favor ofpaymentMethodProperties(Map)
paymentType
(PaymentType paymentType) rawResponse
(String rawResponse) recommendedSavedPaymentMethodStatus
(String recommendedSavedPaymentMethodStatus) responseMap
(String key, String value) shipTo()
successful
(boolean successful) threeDSecureVerificationUrl
(String threeDSecureVerificationUrl) transactionReferenceId
(String transactionReferenceId) transactionType
(TransactionType transactionType) valid
(boolean valid)
-
Constructor Details
-
PaymentResponse
-
PaymentResponse
public PaymentResponse()
-
-
Method Details
-
customer
-
customer
-
creditCard
-
shipTo
-
billTo
-
giftCard
-
customerCredit
-
responseMap
-
paymentOwnerType
-
paymentOwnerId
-
orderId
Deprecated.In favor ofpaymentOwnerType
andpaymentOwnerId
.Sets the Order ID that this transaction is associated with.- Returns:
- the
PaymentResponse
-
getOrderId
Deprecated.In favor ofpaymentOwnerType
andpaymentOwnerId
.Gets the Order ID that this transaction is associated with.- Returns:
- the Order ID that this transaction is associated with.
-
paymentId
-
amount
-
paymentToken
Deprecated.in favor ofpaymentMethodProperties(Map)
Sets the payment transaction that was created during the associated transaction.- Returns:
- the
PaymentResponse
-
getPaymentToken
Deprecated.in favor ofgetPaymentMethodProperties()
Gets the payment transaction that was created during the associated transaction.- Returns:
- the payment transaction that was created during the associated transaction.
-
paymentMethodProperties
-
transactionReferenceId
-
gatewayTransactionId
-
gatewayResponseCode
-
message
-
threeDSecureVerificationUrl
-
failureType
-
declineType
-
dateRecorded
-
paymentGatewayType
-
paymentType
-
transactionType
-
gatewayTransactionType
-
awaitingAsyncResults
-
recommendedSavedPaymentMethodStatus
public PaymentResponse recommendedSavedPaymentMethodStatus(String recommendedSavedPaymentMethodStatus) -
flaggedForManualReview
-
manualReviewResult
-
manualReviewResultReason
-
successful
-
completeCheckoutOnCallback
-
valid
-
rawResponse
-
nextAction
-
getThreeDSecureVerificationUrl
-
getNextAction
-
customerNotification
-
getCustomer
Any customer information that relates to this transaction -
getShipTo
If shipping information is captured on the gateway, the values sent back will be put here -
getBillTo
The billing address associated with this transaction -
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
Any gift cards that have been processed. This data is useful for showing on an order confirmation screen -
getCustomerCredits
Any customer credit accounts that have been processed. This data is useful for showing on an order confirmation screen -
getPaymentGatewayType
The Payment Gateway Type that this transaction response represents -
getPaymentType
The Type of Payment that this transaction response represents- See Also:
-
getTransactionType
The Transaction Type of the Payment that this response represents -
getGatewayTransactionType
The executed transaction type, as described by the gateway. For example, thetransactionType
may beDefaultTransactionTypes.REFUND
, while the gateway transaction is called a "VOID" in their system. -
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
The transaction id that is returned by the payment gateway.- Returns:
- The transaction id that is returned by the payment gateway
-
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
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
A description of the payment owner associated with this transaction- Returns:
- A description of the payment owner associated with this transaction.
-
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 successfulDefaultTransactionTypes.AUTHORIZE_AND_CAPTURE
transaction's PaymentResponse should includesuccessful
= true and awaitingAsyncResults = true. If theDefaultTransactionTypes.AUTHORIZE_AND_CAPTURE
transaction is not successful, then the PaymentResponse should includesuccessful
= false and awaitingAsyncResults = false. -
getRecommendedSavedPaymentMethodStatus
Assuming that a saved payment method was used for the interaction, this field provides a recommendedSavedPaymentMethodStatus
based on the results of the interaction. -
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
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
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
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
Message describing the result of the transaction- Returns:
- Message describing the result of the transaction
-
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
-
getFailureType
The type of transaction failure (TransactionFailureType
).- Returns:
- The type of transaction failure
-
getDeclineType
The type of transaction decline (hard vs soft decline)- Returns:
- The type of transaction decline (hard vs soft decline)
-
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
A string representation of the response that came from the gateway. This should be a string serialization ofresponseMap
. -
getResponseMap
A more convenient representation ofrawResponse
to hold the response from the gateway. -
getCustomerNotification
The notification that should be sent to the customer.- Returns:
- The notification that should be sent to the customer
-
paymentOwnerType
andpaymentOwnerId
.