Search in sources :

Example 51 with CommunicatorConfiguration

use of com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration in project connect-sdk-java by Ingenico-ePayments.

the class SDKProxyTest method test.

/**
 * Smoke test for using a proxy configured through SDK properties.
 */
@Test
public void test() throws URISyntaxException, IOException {
    ConvertAmountParams request = new ConvertAmountParams();
    request.setAmount(123L);
    request.setSource("USD");
    request.setTarget("EUR");
    Client client = getClientWithProxy();
    try {
        ServicesClient services = client.merchant("9991").services();
        CommunicatorConfiguration configuration = getCommunicatorConfigurationWithProxy();
        Assert.assertNotNull(configuration.getProxyConfiguration());
        assertProxySet(services, configuration.getProxyConfiguration());
        ConvertAmount response = services.convertAmount(request);
        Assert.assertNotNull(response.getConvertedAmount());
    } finally {
        client.close();
    }
}
Also used : ConvertAmountParams(com.ingenico.connect.gateway.sdk.java.merchant.services.ConvertAmountParams) ConvertAmount(com.ingenico.connect.gateway.sdk.java.domain.services.ConvertAmount) ServicesClient(com.ingenico.connect.gateway.sdk.java.merchant.services.ServicesClient) CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) Client(com.ingenico.connect.gateway.sdk.java.Client) ServicesClient(com.ingenico.connect.gateway.sdk.java.merchant.services.ServicesClient) CommunicatorConfiguration(com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration) Test(org.junit.Test)

Example 52 with CommunicatorConfiguration

use of com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration in project connect-sdk-java by Ingenico-ePayments.

the class GetPaymentExample method getClient.

private Client getClient() throws URISyntaxException {
    String apiKeyId = System.getProperty("connect.api.apiKeyId", "someKey");
    String secretApiKey = System.getProperty("connect.api.secretApiKey", "someSecret");
    URL propertiesUrl = getClass().getResource("/example-configuration.properties");
    CommunicatorConfiguration configuration = Factory.createConfiguration(propertiesUrl.toURI(), apiKeyId, secretApiKey);
    return Factory.createClient(configuration);
}
Also used : CommunicatorConfiguration(com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration) URL(java.net.URL)

Example 53 with CommunicatorConfiguration

use of com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration in project connect-sdk-java by Ingenico-ePayments.

the class CreatePayoutExample method getClient.

private Client getClient() throws URISyntaxException {
    String apiKeyId = System.getProperty("connect.api.apiKeyId", "someKey");
    String secretApiKey = System.getProperty("connect.api.secretApiKey", "someSecret");
    URL propertiesUrl = getClass().getResource("/example-configuration.properties");
    CommunicatorConfiguration configuration = Factory.createConfiguration(propertiesUrl.toURI(), apiKeyId, secretApiKey);
    return Factory.createClient(configuration);
}
Also used : CommunicatorConfiguration(com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration) URL(java.net.URL)

Example 54 with CommunicatorConfiguration

use of com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration in project connect-sdk-java by Ingenico-ePayments.

the class GetPaymentProductGroupsExample method getClient.

private Client getClient() throws URISyntaxException {
    String apiKeyId = System.getProperty("connect.api.apiKeyId", "someKey");
    String secretApiKey = System.getProperty("connect.api.secretApiKey", "someSecret");
    URL propertiesUrl = getClass().getResource("/example-configuration.properties");
    CommunicatorConfiguration configuration = Factory.createConfiguration(propertiesUrl.toURI(), apiKeyId, secretApiKey);
    return Factory.createClient(configuration);
}
Also used : CommunicatorConfiguration(com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration) URL(java.net.URL)

Example 55 with CommunicatorConfiguration

use of com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration in project connect-sdk-java by Ingenico-ePayments.

the class GetDeviceFingerprintExample method getClient.

private Client getClient() throws URISyntaxException {
    String apiKeyId = System.getProperty("connect.api.apiKeyId", "someKey");
    String secretApiKey = System.getProperty("connect.api.secretApiKey", "someSecret");
    URL propertiesUrl = getClass().getResource("/example-configuration.properties");
    CommunicatorConfiguration configuration = Factory.createConfiguration(propertiesUrl.toURI(), apiKeyId, secretApiKey);
    return Factory.createClient(configuration);
}
Also used : CommunicatorConfiguration(com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration) URL(java.net.URL)

Aggregations

CommunicatorConfiguration (com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration)61 URL (java.net.URL)55 Client (com.ingenico.connect.gateway.sdk.java.Client)3 Test (org.junit.Test)3 ConvertAmount (com.ingenico.connect.gateway.sdk.java.domain.services.ConvertAmount)2 ConvertAmountParams (com.ingenico.connect.gateway.sdk.java.merchant.services.ConvertAmountParams)2 SessionUtil (com.globalcollect.gateway.sdk.client.android.integrationtest.sessions.SessionUtil)1 TokenUtil (com.globalcollect.gateway.sdk.client.android.integrationtest.sessions.TokenUtil)1 C2sCommunicatorConfiguration (com.globalcollect.gateway.sdk.client.android.sdk.communicate.C2sCommunicatorConfiguration)1 Communicator (com.ingenico.connect.gateway.sdk.java.Communicator)1 MetaDataProvider (com.ingenico.connect.gateway.sdk.java.MetaDataProvider)1 MetaDataProviderBuilder (com.ingenico.connect.gateway.sdk.java.MetaDataProviderBuilder)1 RequestHeader (com.ingenico.connect.gateway.sdk.java.RequestHeader)1 Session (com.ingenico.connect.gateway.sdk.java.Session)1 Directory (com.ingenico.connect.gateway.sdk.java.domain.product.Directory)1 DirectoryParams (com.ingenico.connect.gateway.sdk.java.merchant.products.DirectoryParams)1 ServicesClient (com.ingenico.connect.gateway.sdk.java.merchant.services.ServicesClient)1 InputStream (java.io.InputStream)1 Authenticator (java.net.Authenticator)1 PasswordAuthentication (java.net.PasswordAuthentication)1