public class Util extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_ENCODING |
static String |
JAVA_VERSION |
static String |
OS_NAME |
static String |
OS_VERSION |
| Constructor and Description |
|---|
Util() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
applyRequestConfig(org.apache.http.impl.client.HttpClientBuilder httpClientBuilder,
PayConfiguration payConfiguration)
Apply request config to http client request config
|
static PrivateKey |
buildPrivateKey(char[] privateKey)
Builds the PrivateKey object from the private key provided
|
static AmazonPayResponse |
enhanceResponseWithShippingAddressList(AmazonPayResponse amazonPayResponse)
Enhances checkoutSession response by parsing shippingAddressList to JSONObject
|
static String |
getFormattedTimestamp()
Generates the current time stamp in "yyyyMMdd'T'HHmmss'Z'" format
|
static org.apache.http.impl.client.HttpClientBuilder |
getHttpClientBuilderWithProxy(ProxySettings proxySettings,
PayConfiguration payConfiguration)
Returns the HttpClientBuilder object based on the given proxy settings.
|
static org.apache.http.client.methods.HttpUriRequest |
getHttpUriRequest(URI uri,
String httpMethodName,
String payload)
Returns the HttpUriRequest object based on the given HTTP Method Name and URI specification.
|
static URI |
getServiceURI(PayConfiguration payConfiguration,
String action)
To get the service URI
|
static String |
lowerCase(String str)
Generates a lower case string from the given string
|
static Map<String,String> |
updateHeader(Map<String,String> header)
Returns the header with idempotency key, if not provided by the Merchant.
|
static String |
urlEncode(String value,
boolean path)
Generates a url encoded string from the given string
|
public static final String JAVA_VERSION
public static final String OS_NAME
public static final String OS_VERSION
public static final String DEFAULT_ENCODING
public static String urlEncode(String value, boolean path) throws AmazonPayClientException
value - the string to be encodedpath - to determine if the given value is a string or notAmazonPayClientException - When an error response is returned by Amazon Pay due to bad request or other issuepublic static String lowerCase(String str)
str - the string to be convertedpublic static String getFormattedTimestamp()
public static PrivateKey buildPrivateKey(char[] privateKey) throws AmazonPayClientException
privateKey - the private key providedAmazonPayClientException - When an error response is returned by Amazon Pay due to bad request or other issuepublic static URI getServiceURI(PayConfiguration payConfiguration, String action) throws AmazonPayClientException
payConfiguration - the PayConfiguration objectaction - the action to be performed by the requestAmazonPayClientException - When an error response is returned by Amazon Pay due to bad request or other issuepublic static Map<String,String> updateHeader(Map<String,String> header)
header - Header sent by the merchantpublic static org.apache.http.client.methods.HttpUriRequest getHttpUriRequest(URI uri, String httpMethodName, String payload) throws AmazonPayClientException, UnsupportedEncodingException
httpMethodName - the HTTP methoduri - the URIUnsupportedEncodingExceptionAmazonPayClientException - When an error response is returned by Amazon Pay due to bad request or other issuepublic static org.apache.http.impl.client.HttpClientBuilder getHttpClientBuilderWithProxy(ProxySettings proxySettings, PayConfiguration payConfiguration)
proxySettings - the ProxySettingspayConfiguration - the PayConfigurationpublic static AmazonPayResponse enhanceResponseWithShippingAddressList(AmazonPayResponse amazonPayResponse) throws AmazonPayClientException
amazonPayResponse - the response of the API requestAmazonPayClientException - When an error response is returned by Amazon Pay due to bad request or other issueprotected static void applyRequestConfig(org.apache.http.impl.client.HttpClientBuilder httpClientBuilder,
PayConfiguration payConfiguration)
Copyright © 2025. All rights reserved.