Search in sources :

Example 46 with CommunicatorConfiguration

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

the class ApproveSepaDirectDebitTokenExample 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 47 with CommunicatorConfiguration

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

the class GetCustomerDetailsExample 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 48 with CommunicatorConfiguration

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

the class GetDirectoryExample 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 49 with CommunicatorConfiguration

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

the class ConnectionPoolingTest method testConnectionPooling.

private void testConnectionPooling(int requestCount, int maxConnections) throws Exception {
    ExecutorService executorService = Executors.newFixedThreadPool(requestCount);
    try {
        CommunicatorConfiguration configuration = getCommunicatorConfiguration().withMaxConnections(maxConnections);
        Communicator communicator = Factory.createCommunicator(configuration);
        try {
            testConnectionPooling(executorService, communicator, requestCount);
        } finally {
            communicator.close();
        }
    } finally {
        executorService.shutdown();
    }
}
Also used : Communicator(com.ingenico.connect.gateway.sdk.java.Communicator) ExecutorService(java.util.concurrent.ExecutorService) CommunicatorConfiguration(com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration)

Example 50 with CommunicatorConfiguration

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

the class MultiLineHeaderTest method test.

/**
 * Smoke test for products service.
 */
@Test
public void test() throws URISyntaxException, IOException {
    CommunicatorConfiguration configuration = getCommunicatorConfiguration();
    String multiLineHeader = " some value  \r\n \n with  some \r\n  spaces ";
    MetaDataProvider metaDataProvider = new MetaDataProviderBuilder("Ingenico").withAdditionalRequestHeader(new RequestHeader("X-GCS-MultiLineHeader", multiLineHeader)).build();
    DirectoryParams params = new DirectoryParams();
    params.setCountryCode("NL");
    params.setCurrencyCode("EUR");
    Session session = Factory.createSessionBuilder(configuration).withMetaDataProvider(metaDataProvider).build();
    Client client = Factory.createClient(session);
    try {
        Directory response = client.merchant("8500").products().directory(809, params);
        Assert.assertTrue(response.getEntries().size() > 0);
    } finally {
        client.close();
    }
}
Also used : MetaDataProvider(com.ingenico.connect.gateway.sdk.java.MetaDataProvider) MetaDataProviderBuilder(com.ingenico.connect.gateway.sdk.java.MetaDataProviderBuilder) DirectoryParams(com.ingenico.connect.gateway.sdk.java.merchant.products.DirectoryParams) RequestHeader(com.ingenico.connect.gateway.sdk.java.RequestHeader) CommunicatorConfiguration(com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration) Client(com.ingenico.connect.gateway.sdk.java.Client) Session(com.ingenico.connect.gateway.sdk.java.Session) Directory(com.ingenico.connect.gateway.sdk.java.domain.product.Directory) Test(org.junit.Test)

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