Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return us bank account in payment methods #130

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## unreleased
* Include UsBankAccount Accounts in `Customer#getPaymentMethods`

## 3.34.0
* Add domains parameter support to `ClientTokenRequest`
* Add `isNetworkTokenized` to `PaymentMethodNonceDetails`
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/braintreegateway/Customer.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ public List<? extends PaymentMethod> getPaymentMethods() {
paymentMethods.addAll(getSamsungPayCards());
paymentMethods.addAll(getSepaDirectDebitAccounts());
paymentMethods.addAll(getCustomActionsPaymentMethods());
paymentMethods.addAll(getUsBankAccounts());
return Collections.unmodifiableList(paymentMethods);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,14 +621,16 @@ public void createWithUsBankAccountNonce() {

Result<Customer> result = gateway.customer().create(request);
assertTrue(result.isSuccess());
assertEquals(1, result.getTarget().getUsBankAccounts().size());
Customer customer = result.getTarget();
assertEquals(1, customer.getUsBankAccounts().size());

UsBankAccount usBankAccount = result.getTarget().getUsBankAccounts().get(0);
assertEquals("021000021", usBankAccount.getRoutingNumber());
assertEquals("1234", usBankAccount.getLast4());
assertEquals("checking", usBankAccount.getAccountType());
assertEquals("Dan Schulman", usBankAccount.getAccountHolderName());
assertTrue(Pattern.matches(".*CHASE.*", usBankAccount.getBankName()));
assertTrue(customer.getPaymentMethods().contains(usBankAccount));
}

@Test
Expand Down Expand Up @@ -1851,7 +1853,7 @@ public void updateWtihTaxIdentifiers() {
Result<Customer> updateResult = gateway.customer().update(customer.getId(), updateRequest);
assertTrue(updateResult.isSuccess());
}

@Test
public void updateWithAndroidPayCardRequest() {
CustomerRequest createRequest = new CustomerRequest().
Expand Down Expand Up @@ -1946,7 +1948,7 @@ public void updateWithAndroidPayNetworkTokenRequest() {
assertNotNull(androidPayCard.getToken());
assertTrue(androidPayCard.isDefault());
}

@Test
public void updateWithApplePayCardRequest() {
CustomerRequest createRequest = new CustomerRequest().
Expand Down