Class HeaderRequestVersionResolver

java.lang.Object
com.broadleafcommerce.paymenttransaction.web.service.HeaderRequestVersionResolver
All Implemented Interfaces:
RequestVersionResolver

public class HeaderRequestVersionResolver extends Object implements RequestVersionResolver
Resolves the version from a request header for payment and payment transaction.
Author:
Marie Standeven (marieStandeven), Sunny Yu
  • Field Details

    • DEFAULT_HEADER_PAYMENT_VERSION

      protected static final String DEFAULT_HEADER_PAYMENT_VERSION
      See Also:
    • DEFAULT_HEADER_SAVED_PAYMENT_VERSION

      protected static final String DEFAULT_HEADER_SAVED_PAYMENT_VERSION
      See Also:
    • DEFAULT_HEADER_PAYMENT_TRANSACTION_VERSION

      protected static final String DEFAULT_HEADER_PAYMENT_TRANSACTION_VERSION
      See Also:
  • Constructor Details

    • HeaderRequestVersionResolver

      public HeaderRequestVersionResolver()
  • Method Details

    • resolvePaymentVersion

      public Optional<Integer> resolvePaymentVersion(jakarta.servlet.http.HttpServletRequest request)
      Description copied from interface: RequestVersionResolver
      Determines the client's payment version based off of some attribute of the request.
      Specified by:
      resolvePaymentVersion in interface RequestVersionResolver
      Parameters:
      request - the request to examine to determine the client's payment version
      Returns:
      the payment version, or empty if unavailable
    • resolveSavedPaymentVersion

      public Optional<Integer> resolveSavedPaymentVersion(jakarta.servlet.http.HttpServletRequest request)
      Description copied from interface: RequestVersionResolver
      Determines the client's saved payment version based off of some attribute of the request.
      Specified by:
      resolveSavedPaymentVersion in interface RequestVersionResolver
      Parameters:
      request - the request to examine to determine the client's saved payment version
      Returns:
      the saved payment version, or empty if unavailable
    • resolvePaymentTransactionVersion

      public Optional<Integer> resolvePaymentTransactionVersion(jakarta.servlet.http.HttpServletRequest request)
      Description copied from interface: RequestVersionResolver
      Determines the client's payment transaction version based off of some attribute of the request.
      Specified by:
      resolvePaymentTransactionVersion in interface RequestVersionResolver
      Parameters:
      request - the request to examine to determine the client's payment transaction version
      Returns:
      the payment transaction version, or empty if unavailable
    • resolveRequestVersionFromHeader

      protected Optional<Integer> resolveRequestVersionFromHeader(jakarta.servlet.http.HttpServletRequest request, Supplier<String> versionHeaderGetter)
      Resolves the version from the given HttpServletRequest's header, using the given version header getter.
      Parameters:
      request - the HttpServletRequest to resolve the version from
      versionHeaderGetter - the Supplier representing the header name getter for the version
      Returns:
      the version from the given HttpServletRequest
    • getPaymentHeaderName

      protected String getPaymentHeaderName()
      Gets the header name to check the payment version for.
      Returns:
      the payment version header name
    • getSavedPaymentHeaderName

      protected String getSavedPaymentHeaderName()
      Gets the header name to check the saved payment version for.
      Returns:
      the saved payment version header name
    • getPaymentTransactionHeaderName

      protected String getPaymentTransactionHeaderName()
      Gets the header name to check the payment transaction version for.
      Returns:
      the payment transaction version header name