From 172c7d995ea8ea39a075d3889605efb6417aa579 Mon Sep 17 00:00:00 2001 From: Carnell Washington Date: Mon, 22 Jul 2024 13:58:40 -0500 Subject: [PATCH 1/2] Return US Bank Accounts in Customer.getPaymentMethods fixes #126 --- src/main/java/com/braintreegateway/Customer.java | 1 + .../com/braintreegateway/integrationtest/CustomerIT.java | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/braintreegateway/Customer.java b/src/main/java/com/braintreegateway/Customer.java index 3803811d..3a4b99de 100644 --- a/src/main/java/com/braintreegateway/Customer.java +++ b/src/main/java/com/braintreegateway/Customer.java @@ -213,6 +213,7 @@ public List getPaymentMethods() { paymentMethods.addAll(getSamsungPayCards()); paymentMethods.addAll(getSepaDirectDebitAccounts()); paymentMethods.addAll(getCustomActionsPaymentMethods()); + paymentMethods.addAll(getUsBankAccounts()); return Collections.unmodifiableList(paymentMethods); } diff --git a/src/test/java/com/braintreegateway/integrationtest/CustomerIT.java b/src/test/java/com/braintreegateway/integrationtest/CustomerIT.java index 8a422aa7..0a7eae7d 100644 --- a/src/test/java/com/braintreegateway/integrationtest/CustomerIT.java +++ b/src/test/java/com/braintreegateway/integrationtest/CustomerIT.java @@ -621,7 +621,8 @@ public void createWithUsBankAccountNonce() { Result 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()); @@ -629,6 +630,7 @@ public void createWithUsBankAccountNonce() { assertEquals("checking", usBankAccount.getAccountType()); assertEquals("Dan Schulman", usBankAccount.getAccountHolderName()); assertTrue(Pattern.matches(".*CHASE.*", usBankAccount.getBankName())); + assertTrue(customer.getPaymentMethods().contains(usBankAccount)); } @Test @@ -1851,7 +1853,7 @@ public void updateWtihTaxIdentifiers() { Result updateResult = gateway.customer().update(customer.getId(), updateRequest); assertTrue(updateResult.isSuccess()); } - + @Test public void updateWithAndroidPayCardRequest() { CustomerRequest createRequest = new CustomerRequest(). @@ -1946,7 +1948,7 @@ public void updateWithAndroidPayNetworkTokenRequest() { assertNotNull(androidPayCard.getToken()); assertTrue(androidPayCard.isDefault()); } - + @Test public void updateWithApplePayCardRequest() { CustomerRequest createRequest = new CustomerRequest(). From 4deb4860f5084afee5c559eb0bfad71d4ecc1028 Mon Sep 17 00:00:00 2001 From: Carnell Washington Date: Mon, 22 Jul 2024 14:04:54 -0500 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 690c3ec9..108c86cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`