Search in sources :

Example 1 with CompanyInformation

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

the class CreatePaymentExample method example.

@SuppressWarnings("unused")
public void example() throws URISyntaxException, IOException {
    Client client = getClient();
    try {
        Card card = new Card();
        card.setCardNumber("4567350000427977");
        card.setCardholderName("Wile E. Coyote");
        card.setCvv("123");
        card.setExpiryDate("1220");
        CardPaymentMethodSpecificInput cardPaymentMethodSpecificInput = new CardPaymentMethodSpecificInput();
        cardPaymentMethodSpecificInput.setCard(card);
        cardPaymentMethodSpecificInput.setPaymentProductId(1);
        cardPaymentMethodSpecificInput.setSkipAuthentication(false);
        AmountOfMoney amountOfMoney = new AmountOfMoney();
        amountOfMoney.setAmount(2980L);
        amountOfMoney.setCurrencyCode("EUR");
        Address billingAddress = new Address();
        billingAddress.setAdditionalInfo("b");
        billingAddress.setCity("Monument Valley");
        billingAddress.setCountryCode("US");
        billingAddress.setHouseNumber("13");
        billingAddress.setState("Utah");
        billingAddress.setStreet("Desertroad");
        billingAddress.setZip("84536");
        CompanyInformation companyInformation = new CompanyInformation();
        companyInformation.setName("Acme Labs");
        ContactDetails contactDetails = new ContactDetails();
        contactDetails.setEmailAddress("wile.e.coyote@acmelabs.com");
        contactDetails.setEmailMessageType("html");
        contactDetails.setFaxNumber("+1234567891");
        contactDetails.setPhoneNumber("+1234567890");
        PersonalName name = new PersonalName();
        name.setFirstName("Wile");
        name.setSurname("Coyote");
        name.setSurnamePrefix("E.");
        name.setTitle("Mr.");
        PersonalInformation personalInformation = new PersonalInformation();
        personalInformation.setDateOfBirth("19490917");
        personalInformation.setGender("M");
        personalInformation.setName(name);
        PersonalName shippingName = new PersonalName();
        shippingName.setFirstName("Road");
        shippingName.setSurname("Runner");
        shippingName.setTitle("Miss");
        AddressPersonal shippingAddress = new AddressPersonal();
        shippingAddress.setAdditionalInfo("Suite II");
        shippingAddress.setCity("Monument Valley");
        shippingAddress.setCountryCode("US");
        shippingAddress.setHouseNumber("1");
        shippingAddress.setName(shippingName);
        shippingAddress.setState("Utah");
        shippingAddress.setStreet("Desertroad");
        shippingAddress.setZip("84536");
        Customer customer = new Customer();
        customer.setBillingAddress(billingAddress);
        customer.setCompanyInformation(companyInformation);
        customer.setContactDetails(contactDetails);
        customer.setLocale("en_US");
        customer.setMerchantCustomerId("1234");
        customer.setPersonalInformation(personalInformation);
        customer.setShippingAddress(shippingAddress);
        customer.setVatNumber("1234AB5678CD");
        OrderInvoiceData invoiceData = new OrderInvoiceData();
        invoiceData.setInvoiceDate("20140306191500");
        invoiceData.setInvoiceNumber("000000123");
        OrderReferences references = new OrderReferences();
        references.setDescriptor("Fast and Furry-ous");
        references.setInvoiceData(invoiceData);
        references.setMerchantOrderId(123456L);
        references.setMerchantReference("AcmeOrder0001");
        List<LineItem> items = new ArrayList<LineItem>();
        AmountOfMoney item1AmountOfMoney = new AmountOfMoney();
        item1AmountOfMoney.setAmount(2500L);
        item1AmountOfMoney.setCurrencyCode("EUR");
        LineItemInvoiceData item1InvoiceData = new LineItemInvoiceData();
        item1InvoiceData.setDescription("ACME Super Outfit");
        item1InvoiceData.setNrOfItems("1");
        item1InvoiceData.setPricePerItem(2500L);
        LineItem item1 = new LineItem();
        item1.setAmountOfMoney(item1AmountOfMoney);
        item1.setInvoiceData(item1InvoiceData);
        items.add(item1);
        AmountOfMoney item2AmountOfMoney = new AmountOfMoney();
        item2AmountOfMoney.setAmount(480L);
        item2AmountOfMoney.setCurrencyCode("EUR");
        LineItemInvoiceData item2InvoiceData = new LineItemInvoiceData();
        item2InvoiceData.setDescription("Aspirin");
        item2InvoiceData.setNrOfItems("12");
        item2InvoiceData.setPricePerItem(40L);
        LineItem item2 = new LineItem();
        item2.setAmountOfMoney(item2AmountOfMoney);
        item2.setInvoiceData(item2InvoiceData);
        items.add(item2);
        ShoppingCart shoppingCart = new ShoppingCart();
        shoppingCart.setItems(items);
        Order order = new Order();
        order.setAmountOfMoney(amountOfMoney);
        order.setCustomer(customer);
        order.setReferences(references);
        order.setShoppingCart(shoppingCart);
        CreatePaymentRequest body = new CreatePaymentRequest();
        body.setCardPaymentMethodSpecificInput(cardPaymentMethodSpecificInput);
        body.setOrder(order);
        try {
            CreatePaymentResponse response = client.merchant("merchantId").payments().create(body);
        } catch (DeclinedPaymentException e) {
            handleDeclinedPayment(e.getCreatePaymentResult());
        } catch (ApiException e) {
            handleApiErrors(e.getErrors());
        }
    } finally {
        client.close();
    }
}
Also used : OrderInvoiceData(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.OrderInvoiceData) Order(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.Order) OrderReferences(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.OrderReferences) DeclinedPaymentException(com.ingenico.connect.gateway.sdk.java.DeclinedPaymentException) Address(com.ingenico.connect.gateway.sdk.java.domain.definitions.Address) Customer(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.Customer) ArrayList(java.util.ArrayList) AddressPersonal(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.AddressPersonal) LineItem(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.LineItem) CreatePaymentRequest(com.ingenico.connect.gateway.sdk.java.domain.payment.CreatePaymentRequest) LineItemInvoiceData(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.LineItemInvoiceData) CreatePaymentResponse(com.ingenico.connect.gateway.sdk.java.domain.payment.CreatePaymentResponse) Card(com.ingenico.connect.gateway.sdk.java.domain.definitions.Card) AmountOfMoney(com.ingenico.connect.gateway.sdk.java.domain.definitions.AmountOfMoney) CompanyInformation(com.ingenico.connect.gateway.sdk.java.domain.definitions.CompanyInformation) PersonalInformation(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.PersonalInformation) ContactDetails(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.ContactDetails) ShoppingCart(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.ShoppingCart) PersonalName(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.PersonalName) Client(com.ingenico.connect.gateway.sdk.java.Client) CardPaymentMethodSpecificInput(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.CardPaymentMethodSpecificInput) ApiException(com.ingenico.connect.gateway.sdk.java.ApiException)

Example 2 with CompanyInformation

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

the class CreatePayoutExample method example.

@SuppressWarnings("unused")
public void example() throws URISyntaxException, IOException {
    Client client = getClient();
    try {
        AmountOfMoney amountOfMoney = new AmountOfMoney();
        amountOfMoney.setAmount(2345L);
        amountOfMoney.setCurrencyCode("EUR");
        BankAccountIban bankAccountIban = new BankAccountIban();
        bankAccountIban.setAccountHolderName("Wile E. Coyote");
        bankAccountIban.setIban("IT60X0542811101000000123456");
        Address address = new Address();
        address.setCity("Burbank");
        address.setCountryCode("US");
        address.setHouseNumber("411");
        address.setState("California");
        address.setStreet("N Hollywood Way");
        address.setZip("91505");
        CompanyInformation companyInformation = new CompanyInformation();
        companyInformation.setName("Acme Labs");
        ContactDetailsBase contactDetails = new ContactDetailsBase();
        contactDetails.setEmailAddress("wile.e.coyote@acmelabs.com");
        PersonalName name = new PersonalName();
        name.setFirstName("Wile");
        name.setSurname("Coyote");
        name.setSurnamePrefix("E.");
        name.setTitle("Mr.");
        PayoutCustomer customer = new PayoutCustomer();
        customer.setAddress(address);
        customer.setCompanyInformation(companyInformation);
        customer.setContactDetails(contactDetails);
        customer.setName(name);
        BankTransferPayoutMethodSpecificInput bankTransferPayoutMethodSpecificInput = new BankTransferPayoutMethodSpecificInput();
        bankTransferPayoutMethodSpecificInput.setBankAccountIban(bankAccountIban);
        bankTransferPayoutMethodSpecificInput.setCustomer(customer);
        bankTransferPayoutMethodSpecificInput.setPayoutDate("20150102");
        bankTransferPayoutMethodSpecificInput.setPayoutText("Payout Acme");
        bankTransferPayoutMethodSpecificInput.setSwiftCode("swift");
        PayoutReferences references = new PayoutReferences();
        references.setMerchantReference("AcmeOrder001");
        CreatePayoutRequest body = new CreatePayoutRequest();
        body.setAmountOfMoney(amountOfMoney);
        body.setBankTransferPayoutMethodSpecificInput(bankTransferPayoutMethodSpecificInput);
        body.setReferences(references);
        try {
            PayoutResponse response = client.merchant("merchantId").payouts().create(body);
        } catch (DeclinedPayoutException e) {
            handleDeclinedPayout(e.getPayoutResult());
        } catch (ApiException e) {
            handleApiErrors(e.getErrors());
        }
    } finally {
        client.close();
    }
}
Also used : PayoutCustomer(com.ingenico.connect.gateway.sdk.java.domain.payout.definitions.PayoutCustomer) CreatePayoutRequest(com.ingenico.connect.gateway.sdk.java.domain.payout.CreatePayoutRequest) PayoutReferences(com.ingenico.connect.gateway.sdk.java.domain.payout.definitions.PayoutReferences) Address(com.ingenico.connect.gateway.sdk.java.domain.definitions.Address) ContactDetailsBase(com.ingenico.connect.gateway.sdk.java.domain.definitions.ContactDetailsBase) AmountOfMoney(com.ingenico.connect.gateway.sdk.java.domain.definitions.AmountOfMoney) DeclinedPayoutException(com.ingenico.connect.gateway.sdk.java.DeclinedPayoutException) CompanyInformation(com.ingenico.connect.gateway.sdk.java.domain.definitions.CompanyInformation) BankTransferPayoutMethodSpecificInput(com.ingenico.connect.gateway.sdk.java.domain.payout.definitions.BankTransferPayoutMethodSpecificInput) PersonalName(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.PersonalName) BankAccountIban(com.ingenico.connect.gateway.sdk.java.domain.definitions.BankAccountIban) Client(com.ingenico.connect.gateway.sdk.java.Client) PayoutResponse(com.ingenico.connect.gateway.sdk.java.domain.payout.PayoutResponse) ApiException(com.ingenico.connect.gateway.sdk.java.ApiException)

Example 3 with CompanyInformation

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

the class UpdateTokenExample method example.

public void example() throws URISyntaxException, IOException {
    Client client = getClient();
    try {
        Address billingAddress = new Address();
        billingAddress.setAdditionalInfo("b");
        billingAddress.setCity("Monument Valley");
        billingAddress.setCountryCode("US");
        billingAddress.setHouseNumber("13");
        billingAddress.setState("Utah");
        billingAddress.setStreet("Desertroad");
        billingAddress.setZip("84536");
        CompanyInformation companyInformation = new CompanyInformation();
        companyInformation.setName("Acme Labs");
        PersonalNameToken name = new PersonalNameToken();
        name.setFirstName("Wile");
        name.setSurname("Coyote");
        name.setSurnamePrefix("E.");
        PersonalInformationToken personalInformation = new PersonalInformationToken();
        personalInformation.setName(name);
        CustomerToken customer = new CustomerToken();
        customer.setBillingAddress(billingAddress);
        customer.setCompanyInformation(companyInformation);
        customer.setMerchantCustomerId("1234");
        customer.setPersonalInformation(personalInformation);
        CardWithoutCvv cardWithoutCvv = new CardWithoutCvv();
        cardWithoutCvv.setCardNumber("4567350000427977");
        cardWithoutCvv.setCardholderName("Wile E. Coyote");
        cardWithoutCvv.setExpiryDate("0820");
        cardWithoutCvv.setIssueNumber("12");
        TokenCardData data = new TokenCardData();
        data.setCardWithoutCvv(cardWithoutCvv);
        TokenCard card = new TokenCard();
        card.setCustomer(customer);
        card.setData(data);
        UpdateTokenRequest body = new UpdateTokenRequest();
        body.setCard(card);
        body.setPaymentProductId(1);
        client.merchant("merchantId").tokens().update("tokenId", body);
    } finally {
        client.close();
    }
}
Also used : TokenCard(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.TokenCard) CardWithoutCvv(com.ingenico.connect.gateway.sdk.java.domain.definitions.CardWithoutCvv) TokenCardData(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.TokenCardData) UpdateTokenRequest(com.ingenico.connect.gateway.sdk.java.domain.token.UpdateTokenRequest) CompanyInformation(com.ingenico.connect.gateway.sdk.java.domain.definitions.CompanyInformation) Address(com.ingenico.connect.gateway.sdk.java.domain.definitions.Address) PersonalInformationToken(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.PersonalInformationToken) CustomerToken(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.CustomerToken) Client(com.ingenico.connect.gateway.sdk.java.Client) PersonalNameToken(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.PersonalNameToken)

Example 4 with CompanyInformation

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

the class CreateTokenExample method example.

@SuppressWarnings("unused")
public void example() throws URISyntaxException, IOException {
    Client client = getClient();
    try {
        Address billingAddress = new Address();
        billingAddress.setAdditionalInfo("Suite II");
        billingAddress.setCity("Monument Valley");
        billingAddress.setCountryCode("US");
        billingAddress.setHouseNumber("1");
        billingAddress.setState("Utah");
        billingAddress.setStreet("Desertroad");
        billingAddress.setZip("84536");
        CompanyInformation companyInformation = new CompanyInformation();
        companyInformation.setName("Acme Labs");
        PersonalNameToken name = new PersonalNameToken();
        name.setFirstName("Wile");
        name.setSurname("Coyote");
        name.setSurnamePrefix("E.");
        PersonalInformationToken personalInformation = new PersonalInformationToken();
        personalInformation.setName(name);
        CustomerToken customer = new CustomerToken();
        customer.setBillingAddress(billingAddress);
        customer.setCompanyInformation(companyInformation);
        customer.setMerchantCustomerId("1234");
        customer.setPersonalInformation(personalInformation);
        BankAccountBban bankAccountBban = new BankAccountBban();
        bankAccountBban.setAccountNumber("000000123456");
        bankAccountBban.setBankCode("05428");
        bankAccountBban.setBranchCode("11101");
        bankAccountBban.setCheckDigit("X");
        bankAccountBban.setCountryCode("IT");
        TokenNonSepaDirectDebitPaymentProduct705SpecificData paymentProduct705SpecificData = new TokenNonSepaDirectDebitPaymentProduct705SpecificData();
        paymentProduct705SpecificData.setAuthorisationId("123456");
        paymentProduct705SpecificData.setBankAccountBban(bankAccountBban);
        MandateNonSepaDirectDebit mandate = new MandateNonSepaDirectDebit();
        mandate.setPaymentProduct705SpecificData(paymentProduct705SpecificData);
        TokenNonSepaDirectDebit nonSepaDirectDebit = new TokenNonSepaDirectDebit();
        nonSepaDirectDebit.setCustomer(customer);
        nonSepaDirectDebit.setMandate(mandate);
        CreateTokenRequest body = new CreateTokenRequest();
        body.setNonSepaDirectDebit(nonSepaDirectDebit);
        body.setPaymentProductId(705);
        CreateTokenResponse response = client.merchant("merchantId").tokens().create(body);
    } finally {
        client.close();
    }
}
Also used : CreateTokenRequest(com.ingenico.connect.gateway.sdk.java.domain.token.CreateTokenRequest) TokenNonSepaDirectDebitPaymentProduct705SpecificData(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.TokenNonSepaDirectDebitPaymentProduct705SpecificData) CompanyInformation(com.ingenico.connect.gateway.sdk.java.domain.definitions.CompanyInformation) Address(com.ingenico.connect.gateway.sdk.java.domain.definitions.Address) PersonalInformationToken(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.PersonalInformationToken) CustomerToken(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.CustomerToken) BankAccountBban(com.ingenico.connect.gateway.sdk.java.domain.definitions.BankAccountBban) MandateNonSepaDirectDebit(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.MandateNonSepaDirectDebit) TokenNonSepaDirectDebit(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.TokenNonSepaDirectDebit) Client(com.ingenico.connect.gateway.sdk.java.Client) CreateTokenResponse(com.ingenico.connect.gateway.sdk.java.domain.token.CreateTokenResponse) PersonalNameToken(com.ingenico.connect.gateway.sdk.java.domain.token.definitions.PersonalNameToken)

Aggregations

Client (com.ingenico.connect.gateway.sdk.java.Client)4 Address (com.ingenico.connect.gateway.sdk.java.domain.definitions.Address)4 CompanyInformation (com.ingenico.connect.gateway.sdk.java.domain.definitions.CompanyInformation)4 ApiException (com.ingenico.connect.gateway.sdk.java.ApiException)2 AmountOfMoney (com.ingenico.connect.gateway.sdk.java.domain.definitions.AmountOfMoney)2 PersonalName (com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.PersonalName)2 CustomerToken (com.ingenico.connect.gateway.sdk.java.domain.token.definitions.CustomerToken)2 PersonalInformationToken (com.ingenico.connect.gateway.sdk.java.domain.token.definitions.PersonalInformationToken)2 PersonalNameToken (com.ingenico.connect.gateway.sdk.java.domain.token.definitions.PersonalNameToken)2 DeclinedPaymentException (com.ingenico.connect.gateway.sdk.java.DeclinedPaymentException)1 DeclinedPayoutException (com.ingenico.connect.gateway.sdk.java.DeclinedPayoutException)1 BankAccountBban (com.ingenico.connect.gateway.sdk.java.domain.definitions.BankAccountBban)1 BankAccountIban (com.ingenico.connect.gateway.sdk.java.domain.definitions.BankAccountIban)1 Card (com.ingenico.connect.gateway.sdk.java.domain.definitions.Card)1 CardWithoutCvv (com.ingenico.connect.gateway.sdk.java.domain.definitions.CardWithoutCvv)1 ContactDetailsBase (com.ingenico.connect.gateway.sdk.java.domain.definitions.ContactDetailsBase)1 CreatePaymentRequest (com.ingenico.connect.gateway.sdk.java.domain.payment.CreatePaymentRequest)1 CreatePaymentResponse (com.ingenico.connect.gateway.sdk.java.domain.payment.CreatePaymentResponse)1 AddressPersonal (com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.AddressPersonal)1 CardPaymentMethodSpecificInput (com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.CardPaymentMethodSpecificInput)1