use of com.stripe.model.DeletedExternalAccount in project stripe-java by stripe.
the class CustomerTest method testCustomerCardDelete.
@Test
public void testCustomerCardDelete() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams, supportedRequestOptions);
Map<String, Object> creationParams = new HashMap<String, Object>();
creationParams.put("source", "tok_visa");
customer.createCard(creationParams);
ExternalAccount card = customer.getSources().getData().get(0);
DeletedExternalAccount deletedCard = card.delete();
Customer retrievedCustomer = Customer.retrieve(customer.getId(), supportedRequestOptions);
assertTrue(deletedCard.getDeleted());
assertEquals(deletedCard.getId(), card.getId());
for (ExternalAccount retrievedCard : retrievedCustomer.getSources().getData()) {
assertFalse("Card was not actually deleted: " + card.getId(), card.getId().equals(retrievedCard.getId()));
}
}
Aggregations