Class HeaderRequestVersionResolver
java.lang.Object
com.broadleafcommerce.paymenttransaction.web.service.HeaderRequestVersionResolver
- All Implemented Interfaces:
RequestVersionResolver
Resolves the version from a request header for payment and payment transaction.
- Author:
- Marie Standeven (marieStandeven), Sunny Yu
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
Gets the header name to check the payment version for.protected String
Gets the header name to check the payment transaction version for.protected String
Gets the header name to check the saved payment version for.resolvePaymentTransactionVersion
(jakarta.servlet.http.HttpServletRequest request) Determines the client's payment transaction version based off of some attribute of the request.resolvePaymentVersion
(jakarta.servlet.http.HttpServletRequest request) Determines the client's payment version based off of some attribute of the request.resolveRequestVersionFromHeader
(jakarta.servlet.http.HttpServletRequest request, Supplier<String> versionHeaderGetter) Resolves the version from the givenHttpServletRequest
's header, using the given version header getter.resolveSavedPaymentVersion
(jakarta.servlet.http.HttpServletRequest request) Determines the client's saved payment version based off of some attribute of the request.
-
Field Details
-
DEFAULT_HEADER_PAYMENT_VERSION
- See Also:
-
DEFAULT_HEADER_SAVED_PAYMENT_VERSION
- See Also:
-
DEFAULT_HEADER_PAYMENT_TRANSACTION_VERSION
- See Also:
-
-
Constructor Details
-
HeaderRequestVersionResolver
public HeaderRequestVersionResolver()
-
-
Method Details
-
resolvePaymentVersion
Description copied from interface:RequestVersionResolver
Determines the client's payment version based off of some attribute of the request.- Specified by:
resolvePaymentVersion
in interfaceRequestVersionResolver
- 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 interfaceRequestVersionResolver
- 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 interfaceRequestVersionResolver
- 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 givenHttpServletRequest
's header, using the given version header getter.- Parameters:
request
- theHttpServletRequest
to resolve the version fromversionHeaderGetter
- theSupplier
representing the header name getter for the version- Returns:
- the version from the given
HttpServletRequest
-
getPaymentHeaderName
Gets the header name to check the payment version for.- Returns:
- the payment version header name
-
getSavedPaymentHeaderName
Gets the header name to check the saved payment version for.- Returns:
- the saved payment version header name
-
getPaymentTransactionHeaderName
Gets the header name to check the payment transaction version for.- Returns:
- the payment transaction version header name
-