brainTree/Backendless Null pointer (2nd method)

Hello,
Braintree involves integration of 2 methods. We solved the issue of the first method, however I am facing a different issue with the second method.
The method name is called PerformTransaction

public boolean performTransaction( String paymentNonce , double amount, String deviceData )
{
TransactionRequest request = new TransactionRequest()
.amount(new BigDecimal(amount))
.paymentMethodNonce(paymentNonce)
.deviceData(deviceData)
.options()
.submitForSettlement(true)
.done();

Result result = gateway.transaction().sale(request);
Transaction transaction = result.getTarget();
Status status = transaction.getStatus();
return result.isSuccess();
}

I was able to run the code in debug mode (on the servver) and when I call it with the following param (from the console)
with PaymentNonce:
tokencc_bd_xcb823_sndybq_h3zjtq_sg26vm_k82
Amount: 2.0
DeviceData: deviceTest

Then it all works well and I get success.

When I deploy it to production and I call the code with the same param I get

400 - Type:"java.lang.NullPointerException", Description:"exception during method invocation", ExceptionClass:"ServiceException" {Msg:"none", Cause:"none"}

{
    "code": 0,
    "message": "Type:\"java.lang.NullPointerException\", Description:\"exception during method invocation\", ExceptionClass:\"ServiceException\"  {Msg:\"none\", Cause:\"none\"}",
    "errorData": {}
}

Attached is the zip filesample.zip (1.6 MB)

Can you please help me? Once I get that done then the integration is complete
Thank you

Hello @snakeeyes

Thank you for discovering this problem.
This does not sound like a trivial problem, but we will do what we can to find a resolution.

Hello @snakeeyes

I have reproduced the given problem.
Created a ticket for research and bug fixes - BKNDLSS-23382.

I need to ask you a few more questions so I can understand the problem better.
Is there any difference in the parameters passed to the method or there is no difference what values to pass?

{
    "paymentNonce": "string",
    "amount": 0,
    "deviceData": "string"
}

Hello @snakeeyes

  1. I ran your logic in debug mode (./CodeRunner.sh).
  2. INVOKE performTransaction method.
  3. Here’s what I found:

    In response from BrainThree result - target = null, so when you try transaction.getStatus (); and NPE occurs.

This is the problem of what BrainTree returns, or how you handle this response without checking for null.

Hi @Vladimir_Yalovy
Either you guys fixed it with the ticket (Thank you!) Or something happened that it works now. It was an extremely hard issue to debug as it was yielding random results. The token I sent you apperently expires after few usages so I was able to obtain a static test token. I can call the service in deployment and it works.

Thank you
I have Braintree fully integrated now
Adam