use of com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration in project connect-sdk-java by Ingenico-ePayments.
the class ItTest method getClient.
protected Client getClient() throws URISyntaxException {
URL propertiesUrl = getClass().getResource(PROPERTIES_URL);
CommunicatorConfiguration configuration = getCommunicatorConfiguration(propertiesUrl);
return Factory.createClient(configuration).withClientMetaInfo("{\"test\":\"test\"}");
}
use of com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration in project connect-sdk-java by Ingenico-ePayments.
the class SystemProxyTest method test.
/**
* Smoke test for using a proxy configured through system properties.
*/
@Test
public void test() throws URISyntaxException, IOException {
final boolean[] authenticationCalled = { false };
final String username = System.getProperty("http.proxyUser");
final String password = System.getProperty("http.proxyPass");
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
authenticationCalled[0] = true;
return new PasswordAuthentication(username, password.toCharArray());
}
});
ConvertAmountParams request = new ConvertAmountParams();
request.setAmount(123L);
request.setSource("USD");
request.setTarget("EUR");
CommunicatorConfiguration configuration = getCommunicatorConfiguration().withProxyConfiguration(null);
Client client = Factory.createClient(configuration);
try {
ConvertAmount response = client.merchant("9991").services().convertAmount(request);
Assert.assertNotNull(response.getConvertedAmount());
} finally {
client.close();
}
// for https, authentication may not be required
if ("http".equalsIgnoreCase(configuration.getApiEndpoint().getScheme())) {
Assert.assertTrue("getPasswordAuthentication() should have been called", authenticationCalled[0]);
}
}
use of com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration in project connect-sdk-client-android by Ingenico-ePayments.
the class BaseAsyncTaskTest method initializeClass.
@BeforeClass
public static void initializeClass() throws IOException {
Properties properties = new Properties();
InputStream inputStream = BaseAsyncTaskTest.class.getResourceAsStream("/itconfiguration.properties");
try {
properties.load(inputStream);
} finally {
inputStream.close();
}
testMerchantId = properties.getProperty("connect.api.merchantId");
environmentType = Environment.EnvironmentType.valueOf(properties.getProperty("connect.api.environmentType", "Sandbox"));
clientBaseUrl = properties.getProperty("connect.api.client.endpoint");
CommunicatorConfiguration communicatorConfiguration = new CommunicatorConfiguration(properties).withApiKeyId(properties.getProperty("connect.api.apiKeyId")).withSecretApiKey(properties.getProperty("connect.api.secretApiKey"));
client = Factory.createClient(communicatorConfiguration);
tokenUtil = new TokenUtil(client);
sessionUtil = new SessionUtil(client);
}
use of com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration in project connect-sdk-java by Ingenico-ePayments.
the class GetPaymentProductsExample 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);
}
use of com.ingenico.connect.gateway.sdk.java.CommunicatorConfiguration in project connect-sdk-java by Ingenico-ePayments.
the class CancelApprovalRefundExample 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);
}
Aggregations