Search in sources :

Example 1 with MetaDataProvider

use of com.ingenico.connect.gateway.sdk.java.MetaDataProvider 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)

Example 2 with MetaDataProvider

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

the class DefaultConnectionLoggerTest method createClient.

@SuppressWarnings("resource")
private Client createClient(HttpHost host, int connectTimeout, int socketTimeout) throws URISyntaxException {
    URI uri = new URI(host.getSchemeName(), null, host.getHostName(), host.getPort(), null, null, null);
    Connection connection = new DefaultConnection(connectTimeout, socketTimeout);
    Authenticator authenticator = new DefaultAuthenticator(AuthorizationType.V1HMAC, "apiKey", "secret");
    MetaDataProvider metaDataProvider = new MetaDataProvider("Ingenico");
    Session session = new Session(uri, connection, authenticator, metaDataProvider);
    Communicator communicator = Factory.createCommunicator(session);
    Client client = Factory.createClient(communicator);
    return client;
}
Also used : MetaDataProvider(com.ingenico.connect.gateway.sdk.java.MetaDataProvider) Communicator(com.ingenico.connect.gateway.sdk.java.Communicator) Connection(com.ingenico.connect.gateway.sdk.java.Connection) TestConnection(com.ingenico.connect.gateway.sdk.java.domain.services.TestConnection) Client(com.ingenico.connect.gateway.sdk.java.Client) URI(java.net.URI) Authenticator(com.ingenico.connect.gateway.sdk.java.Authenticator) Session(com.ingenico.connect.gateway.sdk.java.Session)

Example 3 with MetaDataProvider

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

the class PaymentsClientTest method initializeSession.

@Before
public void initializeSession() {
    URI apiEndpoint = URI.create("http://localhost");
    session = new Session(apiEndpoint, connection, new DefaultAuthenticator(AuthorizationType.V1HMAC, "test", "test"), new MetaDataProvider("Ingenico"));
}
Also used : MetaDataProvider(com.ingenico.connect.gateway.sdk.java.MetaDataProvider) DefaultAuthenticator(com.ingenico.connect.gateway.sdk.java.defaultimpl.DefaultAuthenticator) URI(java.net.URI) Session(com.ingenico.connect.gateway.sdk.java.Session) Before(org.junit.Before)

Example 4 with MetaDataProvider

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

the class DefaultConnectionIdempotenceTest method createClient.

@SuppressWarnings("resource")
private Client createClient(HttpHost host) {
    Connection connection = new DefaultConnection(500, 500);
    Authenticator authenticator = new DefaultAuthenticator(AuthorizationType.V1HMAC, "apiKey", "secret");
    MetaDataProvider metaDataProvider = new MetaDataProvider("Ingenico");
    Session session = new Session(URI.create(host.toURI()), connection, authenticator, metaDataProvider);
    Communicator communicator = Factory.createCommunicator(session);
    Client client = Factory.createClient(communicator);
    return client;
}
Also used : MetaDataProvider(com.ingenico.connect.gateway.sdk.java.MetaDataProvider) Communicator(com.ingenico.connect.gateway.sdk.java.Communicator) Connection(com.ingenico.connect.gateway.sdk.java.Connection) Client(com.ingenico.connect.gateway.sdk.java.Client) Authenticator(com.ingenico.connect.gateway.sdk.java.Authenticator) Session(com.ingenico.connect.gateway.sdk.java.Session)

Aggregations

MetaDataProvider (com.ingenico.connect.gateway.sdk.java.MetaDataProvider)4 Session (com.ingenico.connect.gateway.sdk.java.Session)4 Client (com.ingenico.connect.gateway.sdk.java.Client)3 Authenticator (com.ingenico.connect.gateway.sdk.java.Authenticator)2 Communicator (com.ingenico.connect.gateway.sdk.java.Communicator)2 Connection (com.ingenico.connect.gateway.sdk.java.Connection)2 URI (java.net.URI)2 CommunicatorConfiguration (com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration)1 MetaDataProviderBuilder (com.ingenico.connect.gateway.sdk.java.MetaDataProviderBuilder)1 RequestHeader (com.ingenico.connect.gateway.sdk.java.RequestHeader)1 DefaultAuthenticator (com.ingenico.connect.gateway.sdk.java.defaultimpl.DefaultAuthenticator)1 Directory (com.ingenico.connect.gateway.sdk.java.domain.product.Directory)1 TestConnection (com.ingenico.connect.gateway.sdk.java.domain.services.TestConnection)1 DirectoryParams (com.ingenico.connect.gateway.sdk.java.merchant.products.DirectoryParams)1 Before (org.junit.Before)1 Test (org.junit.Test)1