Package de.firstdata.ipg.api.client
Class IPGApiClient
- java.lang.Object
-
- de.firstdata.ipg.api.client.IPGApiClient
-
public class IPGApiClient extends Object
IPGApiClient
represents the core class of the client package. Transaction or Action instances can be passed to theIPGApiClient#commitTransaction(IPGApiTransactionObject)
operation or theIPGApiClient#commitAction(IPGApiActionObject)
operation which builds a SOAP message and sends it to the First Data API Web Service.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.http.impl.client.CloseableHttpClient
client
-
Constructor Summary
Constructors Constructor Description IPGApiClient()
IPGApiClient(String ipgApiUrl, String storeId, String password, byte[] keyStore, String keyStorePW)
creates an instance of the IPGApiClient taking all parameters which are necessary for communicating with the First Data API Web Service
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
commit(byte[] requestBytes)
protected Object
commit(Object request)
de.firstdata.ipg.api.schema.IPGApiActionResponse
commitAction(IPGApiAction ipgApiAction)
commits an action on the First Data API by performing a Web Service call with the action data passedde.firstdata.ipg.api.schema.IPGApiActionResponse
commitAction(IPGApiAction ipgApiAction, IPGApiMerchantDetailsObject merchantDetails)
commits an action on the First Data API by performing a Web Service call with the action data passedIPGApiResult
commitTransaction(IPGApiSubsequentTransaction ipgApiSubsequentTransaction, IPGApiMerchantDetailsObject ipgApiMerchantDetails)
IPGApiResult
commitTransaction(IPGApiTransaction ipgApiTransaction)
commits a transaction on the First Data API by performing a Web Service call with the transaction data passedIPGApiResult
commitTransaction(IPGApiTransaction ipgApiTransaction, IPGApiMerchantDetailsObject ipgApiMerchantDetails)
commits a transaction on the First Data API by performing a Web Service call with the transaction data passedString
getIpgApiUrl()
byte[]
getKeyStore()
String
getKeyStorePassword()
int
getMaxConnectionsPerRoute()
int
getMaxTotalConnections()
String
getPassword()
int
getSocketTimeout()
String
getStoreID()
int
getTimeout()
byte[]
getTrustStore()
String
getTrustStorePassword()
URI
getURI()
String
getUserID()
String
getUserMidfix()
String
getUserPrefix()
void
init()
If you used a setter method, you must call the init method to create a new connection to the web service.void
setConnectionPoolTimeout(int value)
This method sets the ConnManagerPNames.TIMEOUT.void
setIpgApiUrl(String value)
This method has no effect without calling the method init().void
setKeyStore(byte[] value)
This method has no effect without calling the method init().void
setKeyStorePassword(String value)
This method has no effect without calling the method init().void
setMaxConnectionsPerRoute(int value)
This should be set to the numbers of terminal You have.void
setMaxTotalConnections(int value)
For detail information see the apache http client 4.0.3 doc.void
setPassword(String value)
The API store password.void
setProxy(String host, Integer port, String user, String password, String workstation, String domain)
Sets the proxy.void
setSocketTimeout(int value)
This method sets the CoreConnectionPNames.SO_TIMEOUT.void
setStoreID(String value)
StoreID or technical user.void
setTrustStore(byte[] value)
This method has no effect without calling the method init().void
setTrustStorePassword(String value)
This method has no effect without calling the method init().void
setUserID(String value)
We set this to 1 This method has no effect without calling the method init().void
setUserMidfix(String value)
We set this to ._.void
setUserPrefix(String value)
We set this to WS.
-
-
-
Constructor Detail
-
IPGApiClient
public IPGApiClient()
-
IPGApiClient
public IPGApiClient(String ipgApiUrl, String storeId, String password, byte[] keyStore, String keyStorePW) throws IOException, javax.xml.bind.JAXBException, URISyntaxException
creates an instance of the IPGApiClient taking all parameters which are necessary for communicating with the First Data API Web Service- Parameters:
ipgApiUrl
- the URL of the First Data API Web ServicestoreId
- your store IDpassword
- your passwordkeyStore
- a byte array containing your key storekeyStorePW
- the password with which your key store can be accessed- Throws:
IOException
javax.xml.bind.JAXBException
URISyntaxException
GeneralSecurityException
-
-
Method Detail
-
getURI
public URI getURI()
-
init
public void init() throws IOException, javax.xml.bind.JAXBException, URISyntaxException, GeneralSecurityException
If you used a setter method, you must call the init method to create a new connection to the web service. Using the setter methods without the init method have no effect.- Throws:
MalformedURLException
IOException
javax.xml.bind.JAXBException
URISyntaxException
GeneralSecurityException
ClientException
-
setProxy
public void setProxy(String host, Integer port, String user, String password, String workstation, String domain)
Sets the proxy. If host or port is null no proxy will be set. If user or password is null no credentials (authorisation) will be set. If workstation and domain are not null a windows credentials will be set otherwise a normal credentials. This method has no effect without calling the method init().- Parameters:
host
- name or ip of the proxy machineport
- port of the proxyuser
- authorisated userpassword
- of the authorisated userworkstation
- name or ip of the local machinedomain
- windows domain
-
commitTransaction
public IPGApiResult commitTransaction(IPGApiTransaction ipgApiTransaction) throws ServerException, ClientException, javax.xml.soap.SOAPException, org.apache.http.HttpException, MerchantException, ProcessingException, InternalException, IOException, javax.xml.bind.JAXBException
commits a transaction on the First Data API by performing a Web Service call with the transaction data passed- Parameters:
ipgApiTransaction
- the transaction to be committed- Returns:
- the transaction result indicating that the transaction has been approved by the credit card processor
- Throws:
ClientException
- thrown when finding problems in processing the transaction dataMerchantException
- thrown in case the First Data API has registered your store as being closedProcessingException
- thrown in case the credit card processor has failed to process your transaction due to invalid transaction data - for details check the exception instance's attributes by calling the appropriategetter
methodsjavax.xml.soap.SOAPException
- thrown when finding problems in building/reading the SOAP request/response messageIOException
- thrown when finding internal problems in processing the request/response dataValidationError
- thrown in case your transaction data is not valid according to the XML Schema defining the request/response XML structuresServerException
- thrown when finding problems in processing the returned server response dataorg.apache.http.HttpException
- thrown in case the server responds with an HTTP code other than200
or500
InternalException
- thrown in case of processing your transaction has resulted in an internal system error - note that you should never receive this exception, however, if so, please contact supportjavax.xml.bind.JAXBException
TransformerException
-
commitTransaction
public IPGApiResult commitTransaction(IPGApiTransaction ipgApiTransaction, IPGApiMerchantDetailsObject ipgApiMerchantDetails) throws ServerException, ClientException, javax.xml.soap.SOAPException, org.apache.http.HttpException, MerchantException, ProcessingException, InternalException, IOException, javax.xml.bind.JAXBException
commits a transaction on the First Data API by performing a Web Service call with the transaction data passed- Parameters:
ipgApiTransaction
- the transaction to be committedipgApiMerchantDetails
- the merchant information to be committed- Returns:
- the transaction result indicating that the transaction has been approved by the credit card processor
- Throws:
ClientException
- thrown when finding problems in processing the transaction dataMerchantException
- thrown in case the First Data API has registered your store as being closedProcessingException
- thrown in case the credit card processor has failed to process your transaction due to invalid transaction data - for details check the exception instance's attributes by calling the appropriategetter
methodsjavax.xml.soap.SOAPException
- thrown when finding problems in building/reading the SOAP request/response messageIOException
- thrown when finding internal problems in processing the request/response dataValidationError
- thrown in case your transaction data is not valid according to the XML Schema defining the request/response XML structuresServerException
- thrown when finding problems in processing the returned server response dataorg.apache.http.HttpException
- thrown in case the server responds with an HTTP code other than200
or500
InternalException
- thrown in case of processing your transaction has resulted in an internal system error - note that you should never receive this exception, however, if so, please contact supportjavax.xml.bind.JAXBException
TransformerException
-
commitTransaction
public IPGApiResult commitTransaction(IPGApiSubsequentTransaction ipgApiSubsequentTransaction, IPGApiMerchantDetailsObject ipgApiMerchantDetails) throws ServerException, ClientException, javax.xml.soap.SOAPException, org.apache.http.HttpException, MerchantException, ProcessingException, InternalException, IOException, javax.xml.bind.JAXBException
- Throws:
ServerException
ClientException
javax.xml.soap.SOAPException
org.apache.http.HttpException
MerchantException
ProcessingException
InternalException
IOException
javax.xml.bind.JAXBException
-
commitAction
public de.firstdata.ipg.api.schema.IPGApiActionResponse commitAction(IPGApiAction ipgApiAction) throws MerchantException, ProcessingException, javax.xml.bind.JAXBException, javax.xml.soap.SOAPException, IOException, ServerException, org.apache.http.HttpException
commits an action on the First Data API by performing a Web Service call with the action data passed- Parameters:
ipgApiAction
- the action to be committed- Returns:
- the action result indicating that the action has been approved
- Throws:
ClientException
- thrown when finding problems in processing the action dataMerchantException
- thrown in case the First Data API has registered your store as being closedProcessingException
- thrown in case the credit card processor has failed to process your action due to invalid transaction data - for details check the exception instance's attributes by calling the appropriategetter
methodsjavax.xml.soap.SOAPException
- thrown when finding problems in building/reading the SOAP request/response messageIOException
- thrown when finding internal problems in processing the request/response dataValidationError
- thrown in case your action data is not valid according to the XML Schema defining the request/response XML structuresServerException
- thrown when finding problems in processing the returned server response dataorg.apache.http.HttpException
- thrown in case the server responds with an HTTP code other than200
or500
InternalException
- thrown in case of processing your action has resulted in an internal system error - note that you should never receive this exception, however, if so, please contact supportjavax.xml.bind.JAXBException
org.apache.http.HttpException
TransformerException
-
commitAction
public de.firstdata.ipg.api.schema.IPGApiActionResponse commitAction(IPGApiAction ipgApiAction, IPGApiMerchantDetailsObject merchantDetails) throws MerchantException, ProcessingException, javax.xml.bind.JAXBException, javax.xml.soap.SOAPException, IOException, ServerException, org.apache.http.HttpException
commits an action on the First Data API by performing a Web Service call with the action data passed- Parameters:
ipgApiAction
- the action to be committedipgApiMerchantDetails
- the merchant information to be committed- Returns:
- the action result indicating that the action has been approved
- Throws:
ClientException
- thrown when finding problems in processing the action dataMerchantException
- thrown in case the First Data API has registered your store as being closedProcessingException
- thrown in case the credit card processor has failed to process your action due to invalid transaction data - for details check the exception instance's attributes by calling the appropriategetter
methodsjavax.xml.soap.SOAPException
- thrown when finding problems in building/reading the SOAP request/response messageIOException
- thrown when finding internal problems in processing the request/response dataValidationError
- thrown in case your action data is not valid according to the XML Schema defining the request/response XML structuresServerException
- thrown when finding problems in processing the returned server response dataorg.apache.http.HttpException
- thrown in case the server responds with an HTTP code other than200
or500
InternalException
- thrown in case of processing your action has resulted in an internal system error - note that you should never receive this exception, however, if so, please contact supportjavax.xml.bind.JAXBException
org.apache.http.HttpException
TransformerException
-
commit
protected Object commit(Object request) throws javax.xml.bind.JAXBException, javax.xml.soap.SOAPException, IOException, MerchantException, ProcessingException, ServerException, org.apache.http.HttpException
- Throws:
javax.xml.bind.JAXBException
javax.xml.soap.SOAPException
IOException
MerchantException
ProcessingException
ServerException
org.apache.http.HttpException
-
commit
protected Object commit(byte[] requestBytes) throws IOException, javax.xml.soap.SOAPException, javax.xml.bind.JAXBException, ServerException, MerchantException, ProcessingException, org.apache.http.HttpException
- Throws:
IOException
javax.xml.soap.SOAPException
javax.xml.bind.JAXBException
ServerException
MerchantException
ProcessingException
org.apache.http.HttpException
-
setIpgApiUrl
public void setIpgApiUrl(String value)
This method has no effect without calling the method init().
-
getIpgApiUrl
public String getIpgApiUrl()
-
setKeyStore
public void setKeyStore(byte[] value)
This method has no effect without calling the method init().
-
getKeyStore
public byte[] getKeyStore()
-
setKeyStorePassword
public void setKeyStorePassword(String value)
This method has no effect without calling the method init().
-
getKeyStorePassword
public String getKeyStorePassword()
-
setMaxConnectionsPerRoute
public void setMaxConnectionsPerRoute(int value)
This should be set to the numbers of terminal You have. We set this to 2. For detail information see the apache http client 4.0.3 doc. This method has no effect without calling the method init().
-
getMaxConnectionsPerRoute
public int getMaxConnectionsPerRoute()
-
setPassword
public void setPassword(String value)
The API store password. This method has no effect without calling the method init().
-
getPassword
public String getPassword()
-
setSocketTimeout
public void setSocketTimeout(int value)
This method sets the CoreConnectionPNames.SO_TIMEOUT. The apache http client waits this time after the message is sent to IPG. We set this to 60 seconds. You should not set this less than 60 seconds. For detail information see the apache http client 4.0.3 doc. This method has no effect without calling the method init().
-
getSocketTimeout
public int getSocketTimeout()
-
setStoreID
public void setStoreID(String value)
StoreID or technical user. If you use the technical user, than you must put the storeID into the transactions. This method has no effect without calling the method init().
-
getStoreID
public String getStoreID()
-
setTrustStore
public void setTrustStore(byte[] value)
This method has no effect without calling the method init().
-
getTrustStore
public byte[] getTrustStore()
-
setTrustStorePassword
public void setTrustStorePassword(String value)
This method has no effect without calling the method init().
-
getTrustStorePassword
public String getTrustStorePassword()
-
setUserID
public void setUserID(String value)
We set this to 1 This method has no effect without calling the method init().
-
getUserID
public String getUserID()
-
setUserMidfix
public void setUserMidfix(String value)
We set this to ._. This method has no effect without calling the method init().
-
getUserMidfix
public String getUserMidfix()
-
setUserPrefix
public void setUserPrefix(String value)
We set this to WS. This method has no effect without calling the method init().
-
getUserPrefix
public String getUserPrefix()
-
setMaxTotalConnections
public void setMaxTotalConnections(int value)
For detail information see the apache http client 4.0.3 doc. This method has no effect without calling the method init().
-
getMaxTotalConnections
public int getMaxTotalConnections()
-
setConnectionPoolTimeout
public void setConnectionPoolTimeout(int value)
This method sets the ConnManagerPNames.TIMEOUT. The apache http client waits this time for a connection in the connection pool. We set this to 15 seconds. For detail information see the apache http client 4.0.3 doc. This method has no effect without calling the method init().
-
getTimeout
public int getTimeout()
-
-