Skip to content
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
* Add support to search by 'venmoUsername' in advanced search for transactions

## 3.48.0
* Add `acceptPartialAuthorization` in `TransactionRequest` and `partiallyAuthorized` in `Transaction`
* Deprecate transactions for `visa_checkout_card` and maintain search functionality
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ public TextNode<TransactionSearchRequest> shippingStreetAddress() {
return textNode("shipping_street_address");
}

public TextNode<TransactionSearchRequest> venmoUsername() {
return textNode("venmo_username");
}

public MultipleValueNode<TransactionSearchRequest, String> paymentInstrumentType() {
return multiTypeNode("payment_instrument_type");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5354,6 +5354,36 @@ public void searchOnAllTextFields() {
assertEquals(transaction.getId(), collection.getFirst().getId());
}

@Test
public void searchOnVenmoUsername() {
TransactionRequest request = new TransactionRequest()
.merchantAccountId(FAKE_VENMO_ACCOUNT_MERCHANT_ACCOUNT_ID)
.amount(SandboxValues.TransactionAmount.AUTHORIZE.amount)
.paymentMethodNonce(Nonce.VenmoAccount);

Result<Transaction> result = gateway.transaction().sale(request);
assertTrue(result.isSuccess());

Transaction transaction = result.getTarget();
String venmoUsername = transaction.getVenmoAccountDetails().getUsername();
assertNotNull(venmoUsername);

TransactionSearchRequest matchingSearchRequest = new TransactionSearchRequest()
.id().is(transaction.getId())
.venmoUsername().is(venmoUsername);

ResourceCollection<Transaction> matchingCollection = gateway.transaction().search(matchingSearchRequest);
assertEquals(1, matchingCollection.getMaximumSize());
assertEquals(transaction.getId(), matchingCollection.getFirst().getId());

TransactionSearchRequest nonMatchingSearchRequest = new TransactionSearchRequest()
.id().is(transaction.getId())
.venmoUsername().is(venmoUsername + "-does-not-match");

ResourceCollection<Transaction> nonMatchingCollection = gateway.transaction().search(nonMatchingSearchRequest);
assertEquals(0, nonMatchingCollection.getMaximumSize());
}

@Test
public void searchWithCreditCardNumberStartsWithEndsWith() {
String creditCardToken = String.valueOf(new Random().nextInt());
Expand Down