Search in sources :

Example 1 with DeletedBankAccount

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()));
    }
}
Also used : Customer(com.stripe.model.Customer) DeletedCustomer(com.stripe.model.DeletedCustomer) HashMap(java.util.HashMap) DeletedBankAccount(com.stripe.model.DeletedBankAccount) DeletedBankAccount(com.stripe.model.DeletedBankAccount) BankAccount(com.stripe.model.BankAccount) ExternalAccount(com.stripe.model.ExternalAccount) DeletedExternalAccount(com.stripe.model.DeletedExternalAccount) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Aggregations

BaseStripeFunctionalTest (com.stripe.BaseStripeFunctionalTest)1 BankAccount (com.stripe.model.BankAccount)1 Customer (com.stripe.model.Customer)1 DeletedBankAccount (com.stripe.model.DeletedBankAccount)1 DeletedCustomer (com.stripe.model.DeletedCustomer)1 DeletedExternalAccount (com.stripe.model.DeletedExternalAccount)1 ExternalAccount (com.stripe.model.ExternalAccount)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1