use of com.stripe.model.DeletedBankAccount in project stripe-java by stripe.
the class CustomerTest method testCustomerBankAccountDelete.
@Test
public void testCustomerBankAccountDelete() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams, supportedRequestOptions);
Map<String, Object> creationParams = new HashMap<String, Object>();
creationParams.put("bank_account", defaultBankAccountParams);
BankAccount addedBankAccount = customer.createBankAccount(creationParams);
DeletedBankAccount deletedBankAccount = addedBankAccount.delete();
Customer retrievedCustomer = Customer.retrieve(customer.getId(), supportedRequestOptions);
assertTrue(deletedBankAccount.getDeleted());
assertEquals(deletedBankAccount.getId(), addedBankAccount.getId());
for (ExternalAccount retrievedSource : retrievedCustomer.getSources().getData()) {
assertFalse("Card was not actually deleted: " + addedBankAccount.getId(), addedBankAccount.getId().equals(retrievedSource.getId()));
}
}
Aggregations