Class AbstractAPSRequestResponseTransformer

java.lang.Object
com.broadleafcommerce.payment.service.gateway.requestresponse.AbstractAPSRequestResponseTransformer
All Implemented Interfaces:
APSRequestResponseTransformer
Direct Known Subclasses:
APSAuthorizeRequestResponseTransformer, APSCaptureRequestResponseTransformer, APSRefundRequestResponseTransformer, APSReverseAuthorizeRequestResponseTransformer

public abstract class AbstractAPSRequestResponseTransformer extends Object implements APSRequestResponseTransformer
Default Request Response transform that transforms the PaymentRequest object to APS Compatible request map and transforms APS Response map to BLC PaymentResponse object
Author:
Muhammad Salman Farooq
  • Field Details

  • Constructor Details

    • AbstractAPSRequestResponseTransformer

      public AbstractAPSRequestResponseTransformer(com.fasterxml.jackson.databind.ObjectMapper objectMapper, APSConfigurationProperties configProperties)
  • Method Details

    • createAPSRequest

      public Map<String,Object> createAPSRequest(com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
      Specified by:
      createAPSRequest in interface APSRequestResponseTransformer
    • populatePaymentResponse

      public com.broadleafcommerce.paymentgateway.domain.PaymentResponse populatePaymentResponse(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull APSPaymentRequest apsPaymentRequest, @NonNull @NonNull Map<String,Object> apsResponse, @Nullable String applicationId, @Nullable String tenantId)
      MANDATORY SET OF FIELDS ON EVERY TRANSACTION *
      Specified by:
      populatePaymentResponse in interface APSRequestResponseTransformer
    • isSuccess

      protected boolean isSuccess(String responseMessageCode)
    • identifyFailureType

      protected String identifyFailureType(Map<String,Object> apsResponse, String responseCode, String transactionReferenceId, @Nullable String applicationId, @Nullable String tenantId)
    • isTransactionAwaitingAsyncResults

      protected boolean isTransactionAwaitingAsyncResults(String responseCode)
      Checks if the transaction has been processed, but failed to receive confirmation. This happens when there is no response received or recorded back from the processors. There could be a delay or timeout happening. The response code in this case will be typically be 15777. Accordingly, Amazon Payment Services requires recovering this transaction and will eventually update to its final status, the recovery response of the payments will be pushed to notification URL in case of any outages happened on the processor level, the average response of receiving the recovery response within 30 minutes, the initial "response_code" received of the direct feedback URL is 15777, and the recovery will hold the final response of the payment.
      Parameters:
      responseCode - the APS response code
      Returns:
      true if the transaction has been processed, but failed to receive confirmation
    • identifyDeclineType

      protected String identifyDeclineType(Map<String,Object> apsResponse, String responseMessageCode, @Nullable String applicationId, @Nullable String tenantId)
    • getMessageCode

      protected String getMessageCode(String responseCode)
    • getAmountInMinorUnits

      protected Long getAmountInMinorUnits(@NonNull @NonNull javax.money.MonetaryAmount amount)
    • getAmountInMajorUnits

      protected javax.money.MonetaryAmount getAmountInMajorUnits(@NonNull @NonNull Long amount, @NonNull @NonNull String currencyCode)
    • getObjectMapper

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

      protected APSConfigurationProperties getConfigProperties()