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 |
|---|---|
static PrivateKey |
buildPrivateKey(char[] privateKey)
Builds the PrivateKey object from the private key provided
|
static org.apache.http.impl.client.CloseableHttpClient |
getCloseableHttpClientWithProxy(ProxySettings proxySettings)
Returns the CloseableHttpClient object based on the given proxy settings.
|
static long |
getExponentialWaitTime(int retryCount)
Returns the next wait interval, in milliseconds, using an exponential
backoff algorithm.
|
static String |
getFormattedTimestamp()
Generates the current time stamp in "yyyyMMdd'T'HHmmss'Z'" format
|
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
char[] - 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 long getExponentialWaitTime(int retryCount)
retryCount - The current retry countpublic 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 URIUnsupportedEncodingExceptionAmazonPayClientExceptionpublic static org.apache.http.impl.client.CloseableHttpClient getCloseableHttpClientWithProxy(ProxySettings proxySettings)
proxySettings - the ProxySettingsCopyright © 2021. All rights reserved.