use of com.stripe.model.Customer in project stripe-java by stripe.
the class CustomerTest method testCustomerUpdatePerCallAPIKey.
@Test
public void testCustomerUpdatePerCallAPIKey() throws StripeException {
Customer createdCustomer = Customer.create(defaultCustomerParams, Stripe.apiKey);
Map<String, Object> updateParams = new HashMap<String, Object>();
updateParams.put("description", "Updated Description");
Customer updatedCustomer = createdCustomer.update(updateParams, Stripe.apiKey);
assertEquals(updatedCustomer.getDescription(), "Updated Description");
}
use of com.stripe.model.Customer in project stripe-java by stripe.
the class CustomerTest method testCustomerDelete.
@Test
public void testCustomerDelete() throws StripeException {
Customer createdCustomer = Customer.create(defaultCustomerParams);
DeletedCustomer deletedCustomer = createdCustomer.delete();
Customer deletedRetrievedCustomer = Customer.retrieve(createdCustomer.getId());
assertTrue(deletedCustomer.getDeleted());
assertEquals(deletedCustomer.getId(), createdCustomer.getId());
assertTrue(deletedRetrievedCustomer.getDeleted());
}
use of com.stripe.model.Customer 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.Customer 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());
}
use of com.stripe.model.Customer in project stripe-java by stripe.
the class CustomerTest method testCustomerCreate.
@Test
public void testCustomerCreate() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams, supportedRequestOptions);
assertEquals(customer.getDescription(), "J Bindings Customer");
List<ExternalAccount> customerSources = customer.getSources().getData();
assertEquals(1, customerSources.size());
assertThat(customerSources.get(0), instanceOf(Card.class));
assertEquals("4242", ((Card) customerSources.get(0)).getLast4());
}
Aggregations