Class DefaultExternalTransactionResultService
java.lang.Object
com.broadleafcommerce.paymenttransaction.service.DefaultExternalTransactionResultService
- All Implemented Interfaces:
ExternalTransactionResultService
public class DefaultExternalTransactionResultService
extends Object
implements ExternalTransactionResultService
The default implementation for
ExternalTransactionResultService
.- Author:
- LSPL385
-
Constructor Summary
ConstructorDescriptionDefaultExternalTransactionResultService
(com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider paymentGatewayResourceProvider, TransactionExecutionUtil transactionExecutionUtil, TransactionResultService transactionResultService) -
Method Summary
Modifier and TypeMethodDescriptionprotected Payment
determinePaymentFromCallbackRequest
(@NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull PaymentCallbackValidationRequest validationRequest, @NonNull String requestTokenId) protected com.broadleafcommerce.paymentgateway.util.PaymentCallbackSecurityTokenUtil
protected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider
protected PaymentService<Payment>
protected String
getSecureTokenKeyFromRequest
(@NonNull PaymentCallbackValidationRequest validationRequest) protected TransactionExecutionUtil
protected TransactionResultService
protected com.broadleafcommerce.common.extension.TypeFactory
handleTransactionResult
(@NonNull String gatewayType, @NonNull Map<String, String> requestParams, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads the transaction result usingPaymentGatewayTransactionLookupService
, records the result to the appropriate transaction and payment.protected PaymentTransaction
identifyExternalTransaction
(@NonNull com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier transactionIdentifier, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) identifyTransactionRequiringExternalInteraction
(@NonNull Payment payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds the transaction that required external results.lookupAndRecordExternalTransactionResult
(@NonNull Payment payment, @NonNull PaymentTransaction transactionRequiringExternal, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads the transaction result usingPaymentGatewayTransactionLookupService
, records the result to the appropriate transaction and payment.protected String
parseTokenIdFromSecureTokenKey
(String secureTokenKey) protected TransactionExecutionResponse
recordExternalTransactionResults
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull Payment payment, @NonNull PaymentTransaction transactionRequiringExternalInteraction, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) void
setPaymentCallbackSecurityTokenUtil
(com.broadleafcommerce.paymentgateway.util.PaymentCallbackSecurityTokenUtil paymentCallbackSecurityTokenUtil) void
setPaymentService
(PaymentService<Payment> paymentService) void
setTypeFactory
(com.broadleafcommerce.common.extension.TypeFactory typeFactory) validatePaymentCallbackToken
(@NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull PaymentCallbackValidationRequest validationRequest, PaymentLockTokens paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates thecallback request
and returns the result of that validation.protected void
validateTransactionResults
(@NonNull TransactionExecutionResponse transactionResponse, @NonNull PaymentTransaction transactionRequiringExternal, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-
Constructor Details
-
DefaultExternalTransactionResultService
public DefaultExternalTransactionResultService(com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider paymentGatewayResourceProvider, TransactionExecutionUtil transactionExecutionUtil, TransactionResultService transactionResultService)
-
-
Method Details
-
identifyTransactionRequiringExternalInteraction
public PaymentTransaction identifyTransactionRequiringExternalInteraction(@NonNull @NonNull Payment payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ExternalTransactionResultService
Finds the transaction that required external results.- Specified by:
identifyTransactionRequiringExternalInteraction
in interfaceExternalTransactionResultService
- Parameters:
payment
- the payment object that contains a reference to the required transactioncontext
- context information related to multitenancy- Returns:
- the transaction that required external results
-
lookupAndRecordExternalTransactionResult
public TransactionExecutionResponse lookupAndRecordExternalTransactionResult(@NonNull @NonNull Payment payment, @NonNull @NonNull PaymentTransaction transactionRequiringExternal, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ExternalTransactionResultService
Reads the transaction result usingPaymentGatewayTransactionLookupService
, records the result to the appropriate transaction and payment.This can be used, for example, to verify that a customer has approved a payment for transactions that requires to add bank details.
- Specified by:
lookupAndRecordExternalTransactionResult
in interfaceExternalTransactionResultService
- Parameters:
payment
- the payment gateway type that is used to identify the appropriatePaymentGatewayTransactionLookupService
transactionRequiringExternal
- the transaction that requires external resultslockToken
- Token granted to resource that owns the payment lock.context
- context information related to multitenancy- Returns:
- the
TransactionExecutionResponse
describing the resulting transaction andPaymentSummary
-
validatePaymentCallbackToken
public PaymentCallbackValidationResponse validatePaymentCallbackToken(@NonNull @NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull @NonNull PaymentCallbackValidationRequest validationRequest, @Nullable PaymentLockTokens paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ExternalTransactionResultService
Validates thecallback request
and returns the result of that validation.- Specified by:
validatePaymentCallbackToken
in interfaceExternalTransactionResultService
- Parameters:
payments
- the page of payments for the requestvalidationRequest
- thecallback validation request
paymentLockTokens
- thePaymentLockTokens
, if anycontextInfo
- context information related to multitenancy.- Returns:
the payment callback validation response
-
handleTransactionResult
public TransactionExecutionResponse handleTransactionResult(@NonNull @NonNull String gatewayType, @NonNull @NonNull Map<String, String> requestParams, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ExternalTransactionResultService
Reads the transaction result usingPaymentGatewayTransactionLookupService
, records the result to the appropriate transaction and payment.This can be used, for example, to verify that a customer has approved a payment for transactions that require to add bank details.
- Specified by:
handleTransactionResult
in interfaceExternalTransactionResultService
- Parameters:
gatewayType
- the payment gateway type that is used to identify the appropriatePaymentGatewayTransactionLookupService
requestParams
- the parameters for requestcontext
- context information related to multitenancy- Returns:
- the
TransactionExecutionDetail
describing the resulting transaction andPaymentSummary
-
identifyExternalTransaction
protected PaymentTransaction identifyExternalTransaction(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier transactionIdentifier, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
recordExternalTransactionResults
protected TransactionExecutionResponse recordExternalTransactionResults(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull Payment payment, @NonNull @NonNull PaymentTransaction transactionRequiringExternalInteraction, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
validateTransactionResults
protected void validateTransactionResults(@NonNull @NonNull TransactionExecutionResponse transactionResponse, @NonNull @NonNull PaymentTransaction transactionRequiringExternal, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getSecureTokenKeyFromRequest
protected String getSecureTokenKeyFromRequest(@NonNull @NonNull PaymentCallbackValidationRequest validationRequest) -
parseTokenIdFromSecureTokenKey
-
determinePaymentFromCallbackRequest
protected Payment determinePaymentFromCallbackRequest(@NonNull @NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull @NonNull PaymentCallbackValidationRequest validationRequest, @NonNull @NonNull String requestTokenId) -
getPaymentGatewayResourceProvider
protected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider getPaymentGatewayResourceProvider() -
getTransactionExecutionUtil
-
getTransactionResultService
-
getPaymentService
-
setPaymentService
-
getPaymentCallbackSecurityTokenUtil
@Nullable protected com.broadleafcommerce.paymentgateway.util.PaymentCallbackSecurityTokenUtil getPaymentCallbackSecurityTokenUtil() -
setPaymentCallbackSecurityTokenUtil
@Autowired(required=false) public void setPaymentCallbackSecurityTokenUtil(@Nullable com.broadleafcommerce.paymentgateway.util.PaymentCallbackSecurityTokenUtil paymentCallbackSecurityTokenUtil) -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-