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 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

      protected String getMerchantAccount(@NonNull @NonNull AdyenPaymentRequest adyenPaymentRequest)
    • getPlatformStore

      @Nullable protected String getPlatformStore(@NonNull @NonNull AdyenPaymentRequest adyenPaymentRequest)
    • getTransactionTotal

      protected AdyenAmount getTransactionTotal(@NonNull @NonNull AdyenPaymentRequest request)
    • convertAmount

      protected AdyenAmount convertAmount(@NonNull @NonNull javax.money.MonetaryAmount amount)
    • getAmountInMinorUnits

      protected Long getAmountInMinorUnits(@NonNull @NonNull javax.money.MonetaryAmount amount)
    • 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 API
      adyenPaymentRequest - the Adyen payment request
      Returns:
      the modified request
    • getRecurringProcessingModel

      @NotNull protected String getRecurringProcessingModel(@NonNull @NonNull AdyenPaymentRequest adyenPaymentRequest)
    • addBroadleafMultiTenantMetadata

      protected Map<String,Object> addBroadleafMultiTenantMetadata(@NonNull @NonNull Map<String,Object> adyenRequest, @NonNull @NonNull AdyenPaymentRequest adyenPaymentRequest)
    • 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 the AdyenResponse.

      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

      protected String identifyDeclineType(@NonNull @NonNull AdyenResponse notification)
    • buildRawResponse

      protected String buildRawResponse(@NonNull @NonNull AdyenResponse adyenResponse)
    • populateLineItemsIfNeeded

      protected void populateLineItemsIfNeeded(@NotNull AdyenPaymentRequest adyenPaymentRequest, Map<String,Object> request)
    • getConfigProperties

      protected AdyenConfigurationProperties getConfigProperties()
    • getObjectMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()