use of com.ingenico.connect.gateway.sdk.java.Client in project connect-sdk-java by Ingenico-ePayments.
the class TokenTest method test.
/**
* Smoke test for token calls.
*/
@Test
public void test() throws URISyntaxException, IOException {
CreateTokenRequest createTokenRequest = new CreateTokenRequest();
createTokenRequest.setPaymentProductId(1);
TokenCard card = new TokenCard();
createTokenRequest.setCard(card);
CustomerToken customer = new CustomerToken();
card.setCustomer(customer);
Address billingAddress = new Address();
customer.setBillingAddress(billingAddress);
billingAddress.setCountryCode("NL");
TokenCardData mandate = new TokenCardData();
card.setData(mandate);
CardWithoutCvv cardWithoutCvv = new CardWithoutCvv();
mandate.setCardWithoutCvv(cardWithoutCvv);
cardWithoutCvv.setCardholderName("Jan");
cardWithoutCvv.setIssueNumber("12");
cardWithoutCvv.setCardNumber("4567350000427977");
cardWithoutCvv.setExpiryDate("0820");
Client client = getClient();
try {
CreateTokenResponse createTokenResponse = client.merchant("9991").tokens().create(createTokenRequest);
Assert.assertNotNull(createTokenResponse.getToken());
DeleteTokenParams deleteTokenRequest = new DeleteTokenParams();
client.merchant("9991").tokens().delete(createTokenResponse.getToken(), deleteTokenRequest);
} finally {
client.close();
}
}
use of com.ingenico.connect.gateway.sdk.java.Client in project connect-sdk-java by Ingenico-ePayments.
the class TokenizePaymentExample method example.
@SuppressWarnings("unused")
public void example() throws URISyntaxException, IOException {
Client client = getClient();
try {
TokenizePaymentRequest body = new TokenizePaymentRequest();
body.setAlias("Some alias");
CreateTokenResponse response = client.merchant("merchantId").payments().tokenize("paymentId", body);
} finally {
client.close();
}
}
use of com.ingenico.connect.gateway.sdk.java.Client in project connect-sdk-java by Ingenico-ePayments.
the class GetDeviceFingerprintExample method example.
@SuppressWarnings("unused")
public void example() throws URISyntaxException, IOException {
Client client = getClient();
try {
DeviceFingerprintRequest body = new DeviceFingerprintRequest();
DeviceFingerprintResponse response = client.merchant("merchantId").products().deviceFingerprint(1, body);
} finally {
client.close();
}
}
use of com.ingenico.connect.gateway.sdk.java.Client in project connect-sdk-java by Ingenico-ePayments.
the class CapturePaymentExample method example.
@SuppressWarnings("unused")
public void example() throws URISyntaxException, IOException {
Client client = getClient();
try {
CapturePaymentRequest body = new CapturePaymentRequest();
body.setAmount(2980L);
CaptureResponse response = client.merchant("merchantId").payments().capture("paymentId", body);
} finally {
client.close();
}
}
use of com.ingenico.connect.gateway.sdk.java.Client in project connect-sdk-java by Ingenico-ePayments.
the class GetPaymentProductGroupExample method example.
@SuppressWarnings("unused")
public void example() throws URISyntaxException, IOException {
Client client = getClient();
try {
GetProductgroupParams query = new GetProductgroupParams();
query.setCountryCode("US");
query.setCurrencyCode("USD");
query.setLocale("en_US");
query.setAmount(1000L);
query.setIsRecurring(true);
query.addHide("fields");
PaymentProductGroupResponse response = client.merchant("merchantId").productgroups().get("cards", query);
} finally {
client.close();
}
}
Aggregations