braintree / braintree_java

Braintree Java library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
158 stars 99 forks source link

3.16.0 - transaction search doesn't work (0 results always) #108

Closed ubeogesh closed 2 years ago

ubeogesh commented 2 years ago
braintreeGateway.transaction().search(new TransactionSearchRequest().orderId().is(orderId)).getFirst()

This works perfectly on 3.15.0 but gives me the following exception on 3.16.0:

java.lang.IndexOutOfBoundsException: toIndex = 1
at java.base/java.util.AbstractList.subListRangeCheck(AbstractList.java:507)
at java.base/java.util.ArrayList.subList(ArrayList.java:1138)
at com.braintreegateway.ResourceCollection.getFirst(ResourceCollection.java:93)

There is exactly 1 transaction in the search results for 3.15, but on 3.16 the collection is empty

hollabaq86 commented 2 years ago

👋 @ubeogesh can you contact Support referencing this issue and give them your merchant ID and the exact order ID you’re searching for?

I’m not seeing any changes in 3.16.0 that would directly impact this behavior, but replicating search issues can sometimes be tricky.

jmsjr commented 2 years ago

I second this ... This also happens with search by ID itself, not just by orderID:

braintreeGateway.transaction().search(new TransactionSearchRequest().id().is('xxxx'))

... where xxxx is a transactionId that was just recently created at Braintree, and I can verify it exists ( by checking on the Braintree portal's Transaction search itself ).

Thank goodness for my integration tests. My integration tests ( which were passing with 3.15.0 and now fails with 3.16.0 ) creates transactions in sandbox and then search them.

jmsjr commented 2 years ago

Rolled back braintree-java in my Maven POM file to 3.15.0 and my integration tests are working again.

jmsjr commented 2 years ago

I found the issue. It is the following change in NodeWrapper in 3.16.0 that broke the behaviour :

https://github.com/braintree/braintree_java/compare/3.15.0...3.16.0#diff-e277bcd14027f28f5bd9ea5a79c2b2c5f37c5ee7a6e2e875dfa3672a38a05cb9

image

From the above screenshot, there is nothing returned from node.getChildren() and so the strings are empty.

In 3.15.0, the value of the id are added to the strings.

jmsjr commented 2 years ago

Can we rename this issue to search in general ? Also, given that this method in NodeWrapper is also called by other classes, I presume other behaviours are also now broken :

image

crookedneighbor commented 2 years ago

Sorry, we forgot to update here. Yes! We came to the same conclusion on that and have opened a fix internally. We expect the release to go out early next week.

hollabaq86 commented 2 years ago

Hi folks, we just released 3.16.1 with a fix to this issue. I'm going to close this, please feel free to open a new issue if you encounter any other problems (🙏 ). Thanks for your patience!