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