use of com.ingenico.connect.gateway.sdk.java.domain.refund.RefundRequest 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();
}
}
Aggregations