use of com.stripe.model.ExternalAccountCollection in project stripe-java by stripe.
the class CustomerTest method testCustomerSourceDelete.
@Test
public void testCustomerSourceDelete() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams);
ExternalAccountCollection customerSources = customer.getSources();
ExternalAccount paymentSource = customerSources.getData().get(0);
paymentSource.delete();
HashMap<String, Object> listParams = new HashMap<String, Object>();
assertEquals(0, customerSources.all(listParams).getData().size());
}
use of com.stripe.model.ExternalAccountCollection in project stripe-java by stripe.
the class CustomerTest method testCustomerSourceUpdate.
@Test
public void testCustomerSourceUpdate() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams);
ExternalAccountCollection customerSources = customer.getSources();
ExternalAccount paymentSource = customerSources.getData().get(0);
assert (paymentSource instanceof Card);
Card card = (Card) paymentSource;
HashMap<String, Object> updateParams = new HashMap<String, Object>();
updateParams.put("address_line1", "some address details");
Card updatedCard = card.update(updateParams);
assertEquals("some address details", updatedCard.getAddressLine1());
}
use of com.stripe.model.ExternalAccountCollection in project stripe-java by stripe.
the class CustomerTest method testCustomerSourceRetrieveCard.
@Test
public void testCustomerSourceRetrieveCard() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams);
ExternalAccountCollection customerSources = customer.getSources();
String paymentSourceId = customerSources.getData().get(0).getId();
ExternalAccount paymentSource = customerSources.retrieve(paymentSourceId);
assertNotNull(paymentSource);
assertEquals(paymentSourceId, paymentSource.getId());
}
Aggregations