Search in sources :

Example 1 with CreateHostedCheckoutRequest

use of com.ingenico.connect.gateway.sdk.java.domain.hostedcheckout.CreateHostedCheckoutRequest in project connect-sdk-java by Ingenico-ePayments.

the class CreateHostedCheckoutExample method example.

@SuppressWarnings("unused")
public void example() throws URISyntaxException, IOException {
    Client client = getClient();
    try {
        HostedCheckoutSpecificInput hostedCheckoutSpecificInput = new HostedCheckoutSpecificInput();
        hostedCheckoutSpecificInput.setLocale("en_GB");
        hostedCheckoutSpecificInput.setVariant("testVariant");
        AmountOfMoney amountOfMoney = new AmountOfMoney();
        amountOfMoney.setAmount(2345L);
        amountOfMoney.setCurrencyCode("USD");
        Address billingAddress = new Address();
        billingAddress.setCountryCode("US");
        Customer customer = new Customer();
        customer.setBillingAddress(billingAddress);
        Order order = new Order();
        order.setAmountOfMoney(amountOfMoney);
        order.setCustomer(customer);
        CreateHostedCheckoutRequest body = new CreateHostedCheckoutRequest();
        body.setHostedCheckoutSpecificInput(hostedCheckoutSpecificInput);
        body.setOrder(order);
        CreateHostedCheckoutResponse response = client.merchant("merchantId").hostedcheckouts().create(body);
    } finally {
        client.close();
    }
}
Also used : Order(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.Order) CreateHostedCheckoutRequest(com.ingenico.connect.gateway.sdk.java.domain.hostedcheckout.CreateHostedCheckoutRequest) CreateHostedCheckoutResponse(com.ingenico.connect.gateway.sdk.java.domain.hostedcheckout.CreateHostedCheckoutResponse) Address(com.ingenico.connect.gateway.sdk.java.domain.definitions.Address) Customer(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.Customer) HostedCheckoutSpecificInput(com.ingenico.connect.gateway.sdk.java.domain.hostedcheckout.definitions.HostedCheckoutSpecificInput) Client(com.ingenico.connect.gateway.sdk.java.Client) AmountOfMoney(com.ingenico.connect.gateway.sdk.java.domain.definitions.AmountOfMoney)

Aggregations

Client (com.ingenico.connect.gateway.sdk.java.Client)1 Address (com.ingenico.connect.gateway.sdk.java.domain.definitions.Address)1 AmountOfMoney (com.ingenico.connect.gateway.sdk.java.domain.definitions.AmountOfMoney)1 CreateHostedCheckoutRequest (com.ingenico.connect.gateway.sdk.java.domain.hostedcheckout.CreateHostedCheckoutRequest)1 CreateHostedCheckoutResponse (com.ingenico.connect.gateway.sdk.java.domain.hostedcheckout.CreateHostedCheckoutResponse)1 HostedCheckoutSpecificInput (com.ingenico.connect.gateway.sdk.java.domain.hostedcheckout.definitions.HostedCheckoutSpecificInput)1 Customer (com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.Customer)1 Order (com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.Order)1