Search in sources :

Example 51 with Client

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();
    }
}
Also used : CreateTokenRequest(com.ingenico.connect.gateway.sdk.java.domain.token.CreateTokenRequest) TokenCard(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.TokenCard) TokenCardData(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.TokenCardData) CardWithoutCvv(com.ingenico.connect.gateway.sdk.java.domain.definitions.CardWithoutCvv) Address(com.ingenico.connect.gateway.sdk.java.domain.definitions.Address) CustomerToken(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.CustomerToken) DeleteTokenParams(com.ingenico.connect.gateway.sdk.java.merchant.tokens.DeleteTokenParams) Client(com.ingenico.connect.gateway.sdk.java.Client) CreateTokenResponse(com.ingenico.connect.gateway.sdk.java.domain.token.CreateTokenResponse) Test(org.junit.Test)

Example 52 with Client

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();
    }
}
Also used : TokenizePaymentRequest(com.ingenico.connect.gateway.sdk.java.domain.payment.TokenizePaymentRequest) Client(com.ingenico.connect.gateway.sdk.java.Client) CreateTokenResponse(com.ingenico.connect.gateway.sdk.java.domain.token.CreateTokenResponse)

Example 53 with Client

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();
    }
}
Also used : DeviceFingerprintResponse(com.ingenico.connect.gateway.sdk.java.domain.product.DeviceFingerprintResponse) Client(com.ingenico.connect.gateway.sdk.java.Client) DeviceFingerprintRequest(com.ingenico.connect.gateway.sdk.java.domain.product.DeviceFingerprintRequest)

Example 54 with Client

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();
    }
}
Also used : CaptureResponse(com.ingenico.connect.gateway.sdk.java.domain.capture.CaptureResponse) CapturePaymentRequest(com.ingenico.connect.gateway.sdk.java.domain.payment.CapturePaymentRequest) Client(com.ingenico.connect.gateway.sdk.java.Client)

Example 55 with Client

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();
    }
}
Also used : PaymentProductGroupResponse(com.ingenico.connect.gateway.sdk.java.domain.product.PaymentProductGroupResponse) Client(com.ingenico.connect.gateway.sdk.java.Client)

Aggregations

Client (com.ingenico.connect.gateway.sdk.java.Client)70 Test (org.junit.Test)35 CreatePaymentRequest (com.ingenico.connect.gateway.sdk.java.domain.payment.CreatePaymentRequest)19 HttpHost (org.apache.http.HttpHost)17 CreatePaymentResponse (com.ingenico.connect.gateway.sdk.java.domain.payment.CreatePaymentResponse)14 Address (com.ingenico.connect.gateway.sdk.java.domain.definitions.Address)12 AmountOfMoney (com.ingenico.connect.gateway.sdk.java.domain.definitions.AmountOfMoney)11 Response (com.ingenico.connect.gateway.sdk.java.Response)9 CallContext (com.ingenico.connect.gateway.sdk.java.CallContext)7 Customer (com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.Customer)6 Order (com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.Order)6 DeclinedPaymentException (com.ingenico.connect.gateway.sdk.java.DeclinedPaymentException)5 ConvertAmount (com.ingenico.connect.gateway.sdk.java.domain.services.ConvertAmount)5 HashMap (java.util.HashMap)5 ApiException (com.ingenico.connect.gateway.sdk.java.ApiException)4 Card (com.ingenico.connect.gateway.sdk.java.domain.definitions.Card)4 CompanyInformation (com.ingenico.connect.gateway.sdk.java.domain.definitions.CompanyInformation)4 TestConnection (com.ingenico.connect.gateway.sdk.java.domain.services.TestConnection)4 ConvertAmountParams (com.ingenico.connect.gateway.sdk.java.merchant.services.ConvertAmountParams)4 ArrayList (java.util.ArrayList)4