Class DefaultCheckoutCom3DSTransactionLookupService
java.lang.Object
com.broadleafcommerce.payment.service.gateway.DefaultCheckoutCom3DSTransactionLookupService
- All Implemented Interfaces:
CheckoutCom3DSTransactionLookupService
,com.broadleafcommerce.paymentgateway.service.PaymentGateway3DSTransactionLookupService
,com.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware
public class DefaultCheckoutCom3DSTransactionLookupService
extends Object
implements CheckoutCom3DSTransactionLookupService
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCheckoutCom3DSTransactionLookupService
(CheckoutApiInitService checkoutApiInitService, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.paymentgateway.domain.PaymentResponse
buildPaymentResponse
(@NonNull com.checkout.payments.four.response.GetPaymentResponse checkoutPaymentResponse, @NonNull com.checkout.four.CheckoutApi api) Builds aPaymentResponse
based on the givenGetPaymentResponse
.protected com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier
buildTransactionIdentifier
(@NonNull com.checkout.payments.four.response.GetPaymentResponse getPaymentResponse) Builds aTransactionIdentifier
based on the givenGetPaymentResponse
.protected javax.money.MonetaryAmount
getAmountInMajorUnits
(@NonNull Long amount, @NonNull String currencyCode) protected CheckoutApiInitService
protected String
getCheckoutPaymentId
(@NonNull com.broadleafcommerce.paymentgateway.domain.TransactionLookupRequest transactionLookupRequest) Gets the id of the Checkout.com payment from the givenTransactionLookupRequest
.protected String
getTenantId
(@NonNull com.checkout.payments.four.response.GetPaymentResponse getPaymentResponse) Gets the tenant id from the givenGetPaymentResponse.getMetadata()
.org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse> getTransactionDetails
(@NonNull Map<String, String> requestParams, String tenantId, String applicationId) protected com.broadleafcommerce.common.extension.TypeFactory
com.broadleafcommerce.paymentgateway.domain.PaymentResponse
lookupTransactionDetails
(@NonNull com.broadleafcommerce.paymentgateway.domain.TransactionLookupRequest transactionLookupRequest, String tenantId, String applicationId) protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse
populate3DSData
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull com.checkout.payments.ThreeDSData threeDSData) Populates the 3DS data for the givenPaymentResponse
.protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse
populateActionData
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull com.checkout.payments.four.response.GetPaymentResponse checkoutComPayment, @NonNull com.checkout.four.CheckoutApi api) Identifies a Checkout.comPaymentAction
using thePaymentResponse.getTransactionReferenceId()
& adds data from thePaymentAction
to thePaymentResponse
.protected void
populateTransactionTypeIfPossible
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull com.checkout.payments.four.PaymentAction paymentAction) Populates thePaymentResponse.getTransactionType()
with the givenPaymentAction
if possible.protected boolean
transactionResultsAreAvailable
(@NonNull com.checkout.payments.four.response.GetPaymentResponse checkoutPaymentResponse) Determines if the 3DS transaction results are available for the givenGetPaymentResponse
.void
validateRequestParams
(@NonNull Map<String, String> requestParams)
-
Constructor Details
-
DefaultCheckoutCom3DSTransactionLookupService
public DefaultCheckoutCom3DSTransactionLookupService(CheckoutApiInitService checkoutApiInitService, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
validateRequestParams
- Specified by:
validateRequestParams
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGateway3DSTransactionLookupService
-
getTransactionDetails
public org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,com.broadleafcommerce.paymentgateway.domain.PaymentResponse> getTransactionDetails(@NonNull @NonNull Map<String, String> requestParams, @Nullable String tenantId, @Nullable String applicationId) - Specified by:
getTransactionDetails
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGateway3DSTransactionLookupService
-
lookupTransactionDetails
public com.broadleafcommerce.paymentgateway.domain.PaymentResponse lookupTransactionDetails(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.TransactionLookupRequest transactionLookupRequest, @Nullable String tenantId, @Nullable String applicationId) - Specified by:
lookupTransactionDetails
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGateway3DSTransactionLookupService
-
transactionResultsAreAvailable
protected boolean transactionResultsAreAvailable(@NonNull @NonNull com.checkout.payments.four.response.GetPaymentResponse checkoutPaymentResponse) Determines if the 3DS transaction results are available for the givenGetPaymentResponse
.- Parameters:
checkoutPaymentResponse
- theGetPaymentResponse
to determine if the 3DS transaction results are available- Returns:
- true if the 3DS transaction results are available for the given
GetPaymentResponse
, otherwise false
-
buildTransactionIdentifier
protected com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier buildTransactionIdentifier(@NonNull @NonNull com.checkout.payments.four.response.GetPaymentResponse getPaymentResponse) Builds aTransactionIdentifier
based on the givenGetPaymentResponse
.- Parameters:
getPaymentResponse
- theGetPaymentResponse
to build theTransactionIdentifier
from- Returns:
- a
TransactionIdentifier
based on the givenGetPaymentResponse
-
getTenantId
protected String getTenantId(@NonNull @NonNull com.checkout.payments.four.response.GetPaymentResponse getPaymentResponse) Gets the tenant id from the givenGetPaymentResponse.getMetadata()
.- Parameters:
getPaymentResponse
- theGetPaymentResponse
to get the tenant id from- Returns:
- the tenant id from the given
GetPaymentResponse.getMetadata()
-
buildPaymentResponse
protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse buildPaymentResponse(@NonNull @NonNull com.checkout.payments.four.response.GetPaymentResponse checkoutPaymentResponse, @NonNull @NonNull com.checkout.four.CheckoutApi api) Builds aPaymentResponse
based on the givenGetPaymentResponse
.- Parameters:
checkoutPaymentResponse
- theGetPaymentResponse
to build thePaymentResponse
fromapi
- theCheckoutApi
used to gather the latest action data for theGetPaymentResponse
with- Returns:
- a
PaymentResponse
based on the givenGetPaymentResponse
-
getAmountInMajorUnits
protected javax.money.MonetaryAmount getAmountInMajorUnits(@NonNull @NonNull Long amount, @NonNull @NonNull String currencyCode) - Parameters:
amount
- the amount to convert toMonetaryAmount
in major units fromcurrencyCode
- the currency code of theMonetaryAmount
- Returns:
- the
MonetaryAmount
in major units from the givenamount
andcurrencyCode
- See Also:
-
Money.ofMinor(CurrencyUnit, long)
-
populate3DSData
protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse populate3DSData(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull com.checkout.payments.ThreeDSData threeDSData) Populates the 3DS data for the givenPaymentResponse
.- Parameters:
paymentResponse
- thePaymentResponse
to populate the 3DS data forthreeDSData
- theThreeDSData
to populate the 3DS data from- Returns:
- the
PaymentResponse
with the populated 3DS data
-
populateActionData
protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse populateActionData(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull com.checkout.payments.four.response.GetPaymentResponse checkoutComPayment, @NonNull @NonNull com.checkout.four.CheckoutApi api) Identifies a Checkout.comPaymentAction
using thePaymentResponse.getTransactionReferenceId()
& adds data from thePaymentAction
to thePaymentResponse
.- Parameters:
paymentResponse
- thePaymentResponse
to populate the action data forcheckoutComPayment
- theGetPaymentResponse
correlates to the Checkout.com paymentapi
- theCheckoutApi
to get the payment actions from- Returns:
- the
PaymentResponse
with the payment action data included
-
populateTransactionTypeIfPossible
protected void populateTransactionTypeIfPossible(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull com.checkout.payments.four.PaymentAction paymentAction) Populates thePaymentResponse.getTransactionType()
with the givenPaymentAction
if possible.- Parameters:
paymentResponse
- thePaymentResponse
to populate the transaction type forpaymentAction
- thePaymentAction
to populate the transaction type from. This is typically the latest payment action
-
getCheckoutPaymentId
@Nullable protected String getCheckoutPaymentId(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.TransactionLookupRequest transactionLookupRequest) Gets the id of the Checkout.com payment from the givenTransactionLookupRequest
.Note that this is not the id of the Broadleaf payment.
- Parameters:
transactionLookupRequest
- theTransactionLookupRequest
to get the Checkout.com payment id from- Returns:
- the id of the Checkout.com payment from the given
TransactionLookupRequest
-
getGatewayType
- Specified by:
getGatewayType
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware
-
getCheckoutApiInitService
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-