Class AbstractRequestResponseTransformer
java.lang.Object
com.broadleafcommerce.adyen.service.requestresponse.AbstractRequestResponseTransformer
- All Implemented Interfaces:
RequestResponseTransformer
- Direct Known Subclasses:
AdyenAuthorizeAndCaptureRequestResponseTransformer
,AdyenAuthorizeRequestResponseTransformer
,AdyenCaptureRequestResponseTransformer
,AdyenRefundRequestResponseTransformer
,AdyenReverseAuthorizeRequestResponseTransformer
public abstract class AbstractRequestResponseTransformer
extends Object
implements RequestResponseTransformer
An abstract class that creates the Adyen request and populates the response with the common
parameters.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractRequestResponseTransformer
(AdyenConfigurationProperties configProperties, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionaddBroadleafMultiTenantMetadata
(@NonNull Map<String, Object> adyenRequest, @NonNull AdyenPaymentRequest adyenPaymentRequest) addThreeDSData
(@NonNull Map<String, Object> adyenRequest, @NonNull AdyenPaymentRequest adyenPaymentRequest) Adds the "authenticationData.threeDSRequestData.nativeThreeDS=preferred" to the request.protected String
buildRawResponse
(@NonNull AdyenResponse adyenResponse) protected AdyenAmount
convertAmount
(@NonNull javax.money.MonetaryAmount amount) protected <T> T
convertValue
(Object fromValue, com.fasterxml.jackson.core.type.TypeReference<T> toValueTypeRef) getAdyenPaymentData
(@NonNull AdyenPaymentRequest adyenPaymentRequest) protected String
getAdyenPspReference
(AdyenPaymentRequest adyenPaymentRequest, AdyenResponse adyenResponse) Gathers the PspResponse from theAdyenResponse
.protected javax.money.MonetaryAmount
getAmountInMajorUnits
(AdyenAmount adyenAmount) protected Long
getAmountInMinorUnits
(@NonNull javax.money.MonetaryAmount amount) getBroadleafMultiTenantMetadata
(@NonNull AdyenPaymentRequest adyenPaymentRequest) protected AdyenConfigurationProperties
protected String
getMerchantAccount
(@NonNull AdyenPaymentRequest adyenPaymentRequest) protected com.fasterxml.jackson.databind.ObjectMapper
protected String
getPlatformStore
(@NonNull AdyenPaymentRequest adyenPaymentRequest) protected @NotNull String
getRecurringProcessingModel
(@NonNull AdyenPaymentRequest adyenPaymentRequest) protected AdyenAmount
getTransactionTotal
(@NonNull AdyenPaymentRequest request) protected com.broadleafcommerce.common.extension.TypeFactory
protected String
identifyDeclineType
(@NonNull AdyenResponse notification) protected String
identifyFailureType
(@NonNull AdyenResponse notification, String transactionReferenceId) protected void
populateLineItemsIfNeeded
(@NotNull AdyenPaymentRequest adyenPaymentRequest, Map<String, Object> request) protected <T> T
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.adyen.service.requestresponse.RequestResponseTransformer
canHandle, createAdyenRequest, populatePaymentResponse
-
Constructor Details
-
AbstractRequestResponseTransformer
protected AbstractRequestResponseTransformer(AdyenConfigurationProperties configProperties, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
getAdyenPaymentData
protected Map<String,Object> getAdyenPaymentData(@NonNull @NonNull AdyenPaymentRequest adyenPaymentRequest) -
getMerchantAccount
-
getPlatformStore
@Nullable protected String getPlatformStore(@NonNull @NonNull AdyenPaymentRequest adyenPaymentRequest) -
getTransactionTotal
-
convertAmount
-
getAmountInMinorUnits
-
addThreeDSData
protected Map<String,Object> addThreeDSData(@NonNull @NonNull Map<String, Object> adyenRequest, @NonNull @NonNull AdyenPaymentRequest adyenPaymentRequest) Adds the "authenticationData.threeDSRequestData.nativeThreeDS=preferred" to the request. It indicates that the payment page can handle 3D Secure 2 transactions natively.- Parameters:
adyenRequest
- the request to send to the Adyen APIadyenPaymentRequest
- the Adyen payment request- Returns:
- the modified request
-
getRecurringProcessingModel
@NotNull protected @NotNull String getRecurringProcessingModel(@NonNull @NonNull AdyenPaymentRequest adyenPaymentRequest) -
addBroadleafMultiTenantMetadata
-
getBroadleafMultiTenantMetadata
protected Map<String,String> getBroadleafMultiTenantMetadata(@NonNull @NonNull AdyenPaymentRequest adyenPaymentRequest) -
convertValue
protected <T> T convertValue(Object fromValue, com.fasterxml.jackson.core.type.TypeReference<T> toValueTypeRef) -
readValue
protected <T> T readValue(String fromValue, com.fasterxml.jackson.core.type.TypeReference<T> toValueTypeRef) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getAdyenPspReference
protected String getAdyenPspReference(AdyenPaymentRequest adyenPaymentRequest, AdyenResponse adyenResponse) Gathers the PspResponse from theAdyenResponse
. Sometimes (so far for PayPal only) in the response body there will be no psp reference but there will be a psp reference in a response header. It is not really the same as it would be in the body(it is there for other payment methods as well), but it is the only reference in case of PayPal Adyen returns.- Parameters:
adyenPaymentRequest
-adyenResponse
-- Returns:
- the PspResponse from the
AdyenResponse
.
-
getAmountInMajorUnits
@Nullable protected javax.money.MonetaryAmount getAmountInMajorUnits(@Nullable AdyenAmount adyenAmount) -
identifyFailureType
protected String identifyFailureType(@NonNull @NonNull AdyenResponse notification, String transactionReferenceId) -
identifyDeclineType
-
buildRawResponse
-
populateLineItemsIfNeeded
protected void populateLineItemsIfNeeded(@NotNull @NotNull AdyenPaymentRequest adyenPaymentRequest, Map<String, Object> request) -
getConfigProperties
-
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-