use of com.stripe.model.ExternalAccount in project stripe-java by stripe.
the class ExternalAccountTest method testVerify.
@Test
public void testVerify() throws StripeException, IOException {
stubNetwork(Customer.class, resource("customer_with_external_account.json"));
Customer cus = Customer.retrieve("cus_123");
verifyGet(Customer.class, "https://api.stripe.com/v1/customers/cus_123");
ExternalAccount bankAccount = cus.getSources().getData().get(0);
assertEquals(true, bankAccount instanceof ExternalAccount);
stubNetwork(ExternalAccount.class, "{\"id\": \"extacct_123\", \"object\": \"unknown_external_account\"}");
Map params = new HashMap<String, Object>();
Integer[] amounts = { 32, 45 };
params.put("amounts", amounts);
bankAccount.verify(params);
verifyPost(ExternalAccount.class, "https://api.stripe.com/v1/customers/cus_123/sources/extacct_123/verify", params);
}
use of com.stripe.model.ExternalAccount in project stripe-java by stripe.
the class ExternalAccountTest method testUnknownExternalAccountDeletion.
@Test
public void testUnknownExternalAccountDeletion() throws StripeException, IOException {
stubNetwork(Customer.class, resource("customer_with_external_account.json"));
Customer cus = Customer.retrieve("cus_123");
verifyGet(Customer.class, "https://api.stripe.com/v1/customers/cus_123");
ExternalAccount ea = cus.getSources().getData().get(0);
stubNetwork(DeletedExternalAccount.class, "{\"id\": \"extacct_123\", \"object\": \"unknown_external_account\"}");
ea.delete();
verifyRequest(APIResource.RequestMethod.DELETE, DeletedExternalAccount.class, "https://api.stripe.com/v1/customers/cus_123/sources/extacct_123", null, APIResource.RequestType.NORMAL, RequestOptions.getDefault());
}
Aggregations