Search in sources :

Example 1 with ServicesClient

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

Aggregations

Client (com.ingenico.connect.gateway.sdk.java.Client)1 CommunicatorConfiguration (com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration)1 ConvertAmount (com.ingenico.connect.gateway.sdk.java.domain.services.ConvertAmount)1 ConvertAmountParams (com.ingenico.connect.gateway.sdk.java.merchant.services.ConvertAmountParams)1 ServicesClient (com.ingenico.connect.gateway.sdk.java.merchant.services.ServicesClient)1 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1 Test (org.junit.Test)1