Skip to content

Commit 7bf95ef

Browse files
committed
advanced-search transactions: support venmoUsername search
1 parent 2966971 commit 7bf95ef

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## unreleased
4+
* Add support to search by 'venmoUsername' in advanced search for transactions
5+
36
## 3.48.0
47
* Add `acceptPartialAuthorization` in `TransactionRequest` and `partiallyAuthorized` in `Transaction`
58
* Deprecate transactions for `visa_checkout_card` and maintain search functionality

src/main/java/com/braintreegateway/TransactionSearchRequest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ public TextNode<TransactionSearchRequest> paypalAuthorizationId() {
125125
return textNode("paypal_authorization_id");
126126
}
127127

128+
public TextNode<TransactionSearchRequest> venmoUsername() {
129+
return textNode("venmo_username");
130+
}
131+
128132
public TextNode<TransactionSearchRequest> processorAuthorizationCode() {
129133
return textNode("processor_authorization_code");
130134
}

src/test/java/com/braintreegateway/integrationtest/TransactionIT.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5354,6 +5354,36 @@ public void searchOnAllTextFields() {
53545354
assertEquals(transaction.getId(), collection.getFirst().getId());
53555355
}
53565356

5357+
@Test
5358+
public void searchOnVenmoUsername() {
5359+
TransactionRequest request = new TransactionRequest()
5360+
.merchantAccountId(FAKE_VENMO_ACCOUNT_MERCHANT_ACCOUNT_ID)
5361+
.amount(SandboxValues.TransactionAmount.AUTHORIZE.amount)
5362+
.paymentMethodNonce(Nonce.VenmoAccount);
5363+
5364+
Result<Transaction> result = gateway.transaction().sale(request);
5365+
assertTrue(result.isSuccess());
5366+
5367+
Transaction transaction = result.getTarget();
5368+
String venmoUsername = transaction.getVenmoAccountDetails().getUsername();
5369+
assertNotNull(venmoUsername);
5370+
5371+
TransactionSearchRequest matchingSearchRequest = new TransactionSearchRequest()
5372+
.id().is(transaction.getId())
5373+
.venmoUsername().is(venmoUsername);
5374+
5375+
ResourceCollection<Transaction> matchingCollection = gateway.transaction().search(matchingSearchRequest);
5376+
assertEquals(1, matchingCollection.getMaximumSize());
5377+
assertEquals(transaction.getId(), matchingCollection.getFirst().getId());
5378+
5379+
TransactionSearchRequest nonMatchingSearchRequest = new TransactionSearchRequest()
5380+
.id().is(transaction.getId())
5381+
.venmoUsername().is(venmoUsername + "-does-not-match");
5382+
5383+
ResourceCollection<Transaction> nonMatchingCollection = gateway.transaction().search(nonMatchingSearchRequest);
5384+
assertEquals(0, nonMatchingCollection.getMaximumSize());
5385+
}
5386+
53575387
@Test
53585388
public void searchWithCreditCardNumberStartsWithEndsWith() {
53595389
String creditCardToken = String.valueOf(new Random().nextInt());

0 commit comments

Comments
 (0)