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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PaymentResponse()
PaymentResponse(PaymentType paymentType, PaymentGatewayType gatewayType)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PaymentResponse
amount(javax.money.MonetaryAmount amount)
PaymentResponse
awaitingAsyncResults(boolean awaitingAsyncResults)
Address<PaymentResponse>
billTo()
PaymentResponse
completeCheckoutOnCallback(boolean completeCheckoutOnCallback)
CreditCard<PaymentResponse>
creditCard()
GatewayCustomer<PaymentResponse>
customer()
PaymentResponse
customer(GatewayCustomer<PaymentResponse> customer)
CustomerCredit<PaymentResponse>
customerCredit()
PaymentResponse
dateRecorded(Instant dateRecorded)
PaymentResponse
declineType(String declineType)
PaymentResponse
failureType(String failureType)
PaymentResponse
gatewayResponseCode(String gatewayResponseCode)
PaymentResponse
gatewayTransactionId(String gatewayTransactionId)
PaymentResponse
gatewayTransactionType(String gatewayTransactionType)
javax.money.MonetaryAmount
getAmount()
Address<PaymentResponse>
getBillTo()
The billing address associated with this transactionCreditCard<PaymentResponse>
getCreditCard()
for sale/authorize transactions, this will be the Credit Card object that was charged.GatewayCustomer<PaymentResponse>
getCustomer()
Any customer information that relates to this transactionList<CustomerCredit<PaymentResponse>>
getCustomerCredits()
Any customer credit accounts that have been processed.Instant
getDateRecorded()
The timestamp when this transaction response was recordedString
getDeclineType()
The type of transaction decline (hard vs soft decline)String
getFailureType()
The type of transaction failure (TransactionFailureType
).String
getGatewayResponseCode()
The response code provided by the payment gateway which may represent a success or failureString
getGatewayTransactionId()
The transaction id that is returned by the payment gateway.String
getGatewayTransactionType()
The executed transaction type, as described by the gateway.List<GiftCard<PaymentResponse>>
getGiftCards()
Any gift cards that have been processed.String
getMessage()
Message describing the result of the transactionString
getOrderId()
Deprecated.In favor ofpaymentOwnerType
andpaymentOwnerId
.PaymentGatewayType
getPaymentGatewayType()
The Payment Gateway Type that this transaction response representsString
getPaymentId()
The Payment ID that this transaction is associated withMap<String,String>
getPaymentMethodProperties()
Map to capture any information about the payment method needed to perform gateway transactions.String
getPaymentOwnerDescription()
A description of the payment owner associated with this transactionString
getPaymentOwnerId()
The id of the entity that owns the payment.String
getPaymentOwnerType()
Describes the owner of the payment.String
getPaymentToken()
Deprecated.in favor ofgetPaymentMethodProperties()
PaymentType
getPaymentType()
The Type of Payment that this transaction response representsString
getRawResponse()
A string representation of the response that came from the gateway.Map<String,String>
getResponseMap()
A more convenient representation ofrawResponse
to hold the response from the gateway.Address<PaymentResponse>
getShipTo()
If shipping information is captured on the gateway, the values sent back will be put hereString
getThreeDSecureVerificationUrl()
The gateway-provided url where the customer must verify that they are in fact the owner of the payment method.String
getTransactionReferenceId()
The transaction reference that is passed to the payment gateway.TransactionType
getTransactionType()
The Transaction Type of the Payment that this response representsGiftCard<PaymentResponse>
giftCard()
boolean
isAwaitingAsyncResults()
Declares whether the transaction was executed synchronously, or if the transaction results will be provided asynchronously.boolean
isCompleteCheckoutOnCallback()
Sets whether or not this module should complete checkout on callback.boolean
isSuccessful()
Whether or not the transaction on the gateway was successful.boolean
isValid()
Whether or not this response was tampered with.PaymentResponse
message(String message)
PaymentResponse
orderId(String orderId)
Deprecated.In favor ofpaymentOwnerType
andpaymentOwnerId
.PaymentResponse
paymentGatewayType(PaymentGatewayType paymentGatewayType)
PaymentResponse
paymentId(String paymentId)
PaymentResponse
paymentMethodProperties(Map<String,String> paymentMethodProperties)
PaymentResponse
paymentOwnerId(String ownerId)
PaymentResponse
paymentOwnerType(String ownerType)
PaymentResponse
paymentToken(String paymentToken)
Deprecated.in favor ofpaymentMethodProperties(Map)
PaymentResponse
paymentType(PaymentType paymentType)
PaymentResponse
rawResponse(String rawResponse)
PaymentResponse
responseMap(String key, String value)
Address<PaymentResponse>
shipTo()
PaymentResponse
successful(boolean successful)
PaymentResponse
threeDSecureVerificationUrl(String threeDSecureVerificationUrl)
PaymentResponse
transactionReferenceId(String transactionReferenceId)
PaymentResponse
transactionType(TransactionType transactionType)
PaymentResponse
valid(boolean valid)
-
-
-
Constructor Detail
-
PaymentResponse
public PaymentResponse(PaymentType paymentType, PaymentGatewayType gatewayType)
-
PaymentResponse
public PaymentResponse()
-
-
Method Detail
-
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 ofpaymentOwnerType
andpaymentOwnerId
.Sets the Order ID that this transaction is associated with.- Returns:
- the
PaymentResponse
-
getOrderId
@Deprecated public String 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
public PaymentResponse paymentId(String paymentId)
-
amount
public PaymentResponse amount(javax.money.MonetaryAmount amount)
-
paymentToken
@Deprecated public PaymentResponse paymentToken(String paymentToken)
Deprecated.in favor ofpaymentMethodProperties(Map)
Sets the payment transaction that was created during the associated transaction.- Returns:
- the
PaymentResponse
-
getPaymentToken
@Deprecated public String 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
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)
-
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, thetransactionType
may beDefaultTransactionTypes.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 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.
-
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 ofresponseMap
.
-
getResponseMap
public Map<String,String> getResponseMap()
A more convenient representation ofrawResponse
to hold the response from the gateway.
-
-