public class Utility extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
AUTH_SERVICE |
static String |
AUTH_SERVICE_NVP |
static String |
AUTH_SERVICE_XML_RUN_ATT |
static String |
CYBS_CERT_AUTH |
static String |
ELEM_CLIENT_ENVIRONMENT |
static String |
ELEM_CLIENT_LIBRARY |
static String |
ELEM_CLIENT_LIBRARY_VERSION |
static String |
ELEM_MERCHANT_ID |
static String |
ELEM_MERCHANT_REFERENCE_CODE |
static String |
ENVIRONMENT
Environment information.
|
static int |
HTTP_BAD_REQUEST
HTTP Status-Code 400: Bad Request.
|
static String |
KEY_ALIAS |
static String |
MERCHANT_TRANSACTION_IDENTIFIER |
static String |
MTI_FIELD_ERR_MSG |
static String |
NVP_LIBRARY
NVP library information.
|
static String |
ORIGIN_TIMESTAMP |
static String |
RESPONSE_TIME_REPLY |
static String |
SDK_ELAPSED_TIMESTAMP |
static String |
SERVER_ALIAS
Version number of this release.
|
static String |
VERSION |
static String |
XML_LIBRARY
XML library information.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
checkIfAuthServiceFieldExist(Document request,
String nsURI)
Checks if the request documents contains ccAuthService element.
|
static String |
checkIfMTIFiledExist(Document request,
String nsURI)
Checks if the request documents contains merchantTransactionIdentifier element.
|
static Element |
createElement(Document owner,
String nsURI,
String elementName,
String textValue)
Creates an Element object in the CyberSource namespace.
|
static Element |
getElement(Document owner,
String elementName,
String nsURI)
Returns the Element object corresponding to the given element name.
|
static String |
getElementText(Document owner,
String elementName,
String nsURI)
Returns the text value of the given element name in the CyberSource
namespace.
|
static long |
getResponseIssuedAtTime(String responseTime) |
static long |
getResponseTransitTime(long resIssuedAtTime)
This is the response transit time in seconds.
|
static String |
getStackTrace(Exception e)
Returns the stack trace of the supplied Exception object.
|
static String |
mapToString(Map src,
boolean mask,
int type)
Converts the contents of a Map object into a string, one name-value pair
to a line and the name and value are separated by an equal sign.
|
static DocumentBuilder |
newDocumentBuilder()
Returns a DocumentBuilder object.
|
static String |
nodeToString(Node node)
Returns the string representation of the given Node object.
|
static String |
nodeToString(Node node,
int type)
Returns the string representation of the given Node object.
|
static byte[] |
read(File file)
Reads the content of the given file into a byte array.
|
static byte[] |
read(InputStream in)
Reads the content of the given file into a byte array.
|
static byte[] |
read(String filename)
Reads the content of the given file into a byte array.
|
static Properties |
readProperties(String[] commandLineArgs)
Reads the properties from a file.
|
static Document |
readRequest(Properties props,
String filename)
Read the request xml file
|
static Document |
readRequest(Properties props,
String filename,
String merchantId)
Read the request xml file
|
static HashMap<String,String> |
stringToMap(String src)
Converts a name-value pair string into a Map object.
|
public static final String SERVER_ALIAS
public static final String CYBS_CERT_AUTH
public static final String VERSION
public static final String ORIGIN_TIMESTAMP
public static final String SDK_ELAPSED_TIMESTAMP
public static final String RESPONSE_TIME_REPLY
public static final String MERCHANT_TRANSACTION_IDENTIFIER
public static final String AUTH_SERVICE
public static final String AUTH_SERVICE_XML_RUN_ATT
public static final String AUTH_SERVICE_NVP
public static final String ELEM_MERCHANT_ID
public static final String KEY_ALIAS
public static final String ELEM_MERCHANT_REFERENCE_CODE
public static final String ELEM_CLIENT_LIBRARY
public static final String ELEM_CLIENT_LIBRARY_VERSION
public static final String ELEM_CLIENT_ENVIRONMENT
public static final int HTTP_BAD_REQUEST
public static final String MTI_FIELD_ERR_MSG
public static final String NVP_LIBRARY
public static final String XML_LIBRARY
public static final String ENVIRONMENT
public static String nodeToString(Node node, int type)
node - the Node object whose string representation is wanted.type - either PCI.REQUEST or PCI.REPLY. Used for masking.public static String nodeToString(Node node)
node - the Node object whose string representation is wanted.public static Properties readProperties(String[] commandLineArgs)
commandLineArgs - the command-line arguments.public static byte[] read(String filename) throws IOException
filename - name of the file to read.IOException - if there was an error reading the file.public static byte[] read(File file) throws IOException
file - File object to read.IOException - if there was an error reading the file.public static byte[] read(InputStream in) throws IOException
in - InputStream object to read.IOException - if there was an error reading the file.public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException
ParserConfigurationException - if no suitable parser
implementation is found.public static Element getElement(Document owner, String elementName, String nsURI)
owner - Document object to search.elementName - local name to search for.nsURI - namespaceURI to used (may be null).null if none is found.public static String getElementText(Document owner, String elementName, String nsURI)
owner - Document object to search.elementName - local name to search for.nsURI - namespaceURI to used (may be null).null if none is found.public static String getStackTrace(Exception e)
e - Exception object.public static HashMap<String,String> stringToMap(String src)
src - String containing name-value pairs.public static String mapToString(Map src, boolean mask, int type)
src - Map object whose contents are being converted.mask - Flag whether or not to mask "unsafe" fields.type - Relevant only when mask is true, indicates whether this
is the request or the reply map. Pass either
PCI.REQUEST or PCI.REPLY.public static Document readRequest(Properties props, String filename)
props - Properties object to lookup properties infilename - Filename of file containing XML requestpublic static Document readRequest(Properties props, String filename, String merchantId)
props - Properties object to lookup properties infilename - Filename of file containing XML requestmerchantId - merchantIdpublic static Element createElement(Document owner, String nsURI, String elementName, String textValue)
owner - Document object to own the Element object.nsURI - Namespace URI to use.elementName - local name of Element object to create.textValue - text value of the new Element object.public static long getResponseIssuedAtTime(String responseTime)
public static long getResponseTransitTime(long resIssuedAtTime)
resIssuedAtTime - public static String checkIfMTIFiledExist(Document request, String nsURI)
request - Document object to own the Element object.nsURI - Namespace URI to use.public static String checkIfAuthServiceFieldExist(Document request, String nsURI)
request - Document object to own the Element object.nsURI - Namespace URI to use.Copyright © 2022. All rights reserved.