Search in sources :

Example 1 with RefundReferences

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

the class RefundPaymentExample method example.

@SuppressWarnings("unused")
public void example() throws URISyntaxException, IOException {
    Client client = getClient();
    try {
        AmountOfMoney amountOfMoney = new AmountOfMoney();
        amountOfMoney.setAmount(1L);
        amountOfMoney.setCurrencyCode("EUR");
        BankAccountIban bankAccountIban = new BankAccountIban();
        bankAccountIban.setIban("NL53INGB0000000036");
        BankRefundMethodSpecificInput bankRefundMethodSpecificInput = new BankRefundMethodSpecificInput();
        bankRefundMethodSpecificInput.setBankAccountIban(bankAccountIban);
        PersonalName name = new PersonalName();
        name.setSurname("Coyote");
        AddressPersonal address = new AddressPersonal();
        address.setCountryCode("US");
        address.setName(name);
        ContactDetailsBase contactDetails = new ContactDetailsBase();
        contactDetails.setEmailAddress("wile.e.coyote@acmelabs.com");
        contactDetails.setEmailMessageType("html");
        RefundCustomer customer = new RefundCustomer();
        customer.setAddress(address);
        customer.setContactDetails(contactDetails);
        RefundReferences refundReferences = new RefundReferences();
        refundReferences.setMerchantReference("AcmeOrder0001");
        RefundRequest body = new RefundRequest();
        body.setAmountOfMoney(amountOfMoney);
        body.setBankRefundMethodSpecificInput(bankRefundMethodSpecificInput);
        body.setCustomer(customer);
        body.setRefundDate("20140306");
        body.setRefundReferences(refundReferences);
        try {
            RefundResponse response = client.merchant("merchantId").payments().refund("paymentId", body);
        } catch (DeclinedRefundException e) {
            handleDeclinedRefund(e.getRefundResult());
        } catch (ApiException e) {
            handleApiErrors(e.getErrors());
        }
    } finally {
        client.close();
    }
}
Also used : BankRefundMethodSpecificInput(com.ingenico.connect.gateway.sdk.java.domain.refund.definitions.BankRefundMethodSpecificInput) AddressPersonal(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.AddressPersonal) ContactDetailsBase(com.ingenico.connect.gateway.sdk.java.domain.definitions.ContactDetailsBase) AmountOfMoney(com.ingenico.connect.gateway.sdk.java.domain.definitions.AmountOfMoney) RefundReferences(com.ingenico.connect.gateway.sdk.java.domain.refund.definitions.RefundReferences) RefundRequest(com.ingenico.connect.gateway.sdk.java.domain.refund.RefundRequest) PersonalName(com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.PersonalName) DeclinedRefundException(com.ingenico.connect.gateway.sdk.java.DeclinedRefundException) RefundCustomer(com.ingenico.connect.gateway.sdk.java.domain.refund.definitions.RefundCustomer) BankAccountIban(com.ingenico.connect.gateway.sdk.java.domain.definitions.BankAccountIban) Client(com.ingenico.connect.gateway.sdk.java.Client) RefundResponse(com.ingenico.connect.gateway.sdk.java.domain.refund.RefundResponse) ApiException(com.ingenico.connect.gateway.sdk.java.ApiException)

Aggregations

ApiException (com.ingenico.connect.gateway.sdk.java.ApiException)1 Client (com.ingenico.connect.gateway.sdk.java.Client)1 DeclinedRefundException (com.ingenico.connect.gateway.sdk.java.DeclinedRefundException)1 AmountOfMoney (com.ingenico.connect.gateway.sdk.java.domain.definitions.AmountOfMoney)1 BankAccountIban (com.ingenico.connect.gateway.sdk.java.domain.definitions.BankAccountIban)1 ContactDetailsBase (com.ingenico.connect.gateway.sdk.java.domain.definitions.ContactDetailsBase)1 AddressPersonal (com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.AddressPersonal)1 PersonalName (com.ingenico.connect.gateway.sdk.java.domain.payment.definitions.PersonalName)1 RefundRequest (com.ingenico.connect.gateway.sdk.java.domain.refund.RefundRequest)1 RefundResponse (com.ingenico.connect.gateway.sdk.java.domain.refund.RefundResponse)1 BankRefundMethodSpecificInput (com.ingenico.connect.gateway.sdk.java.domain.refund.definitions.BankRefundMethodSpecificInput)1 RefundCustomer (com.ingenico.connect.gateway.sdk.java.domain.refund.definitions.RefundCustomer)1 RefundReferences (com.ingenico.connect.gateway.sdk.java.domain.refund.definitions.RefundReferences)1