-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NumberFormatException when voiding a transaction made with Track Data #26
Comments
Also, I wonder why the response code is "1.0" for a transaction with track data versus "1" for a transaction without track data? |
Have you had a chance to look at this? Were you able to reproduce the issue given my test case? This issue is correctly blocking several of my customers from being able to utilize Card Present transactions in Authorize.net's new Blended Account functionality. Thanks! |
Thanks for reporting the issue Alfred. I was able to repro, thanks for providing the complete test case. While I look for the root cause of this, in the mean time you can try voids (and infact all other apis) using the new controller model. |
Hey Rajeev, Thanks for the help! I switched to the new controller model and I can now void card present transactions. Is there any documentation I can reference for the new controller model (besides the test cases)? Thanks! |
Hi Alfred, We wanted to get some more feedback and usage before we go all out to promote the new SDK model but we do hope to do that soon. We'd love to hear any feedback you have and thanks again for raising this issue. Cheers, Brian |
We are still working on documentation on using the controllers. Basically, all the controllers are defined at in the name space net.authorize.api.controller under the source tree src/java/main and all the respective tests including the sample code is under src/test/java under same namespace. Mostly the pattern is:
|
Great job guys, the new API is significantly easier to use! I really disliked having to cast the transaction result in the old one. Here are a few comments I have:
I ended up using the first one to extract the error message. I think in my testing when trying to void a transaction ID that didn't exist, the controller's getErrorResponseCode() returned null. I think there can be some improvement to standardize this.
Is it possible to introduce a service layer? The service layer, say AuthorizeNetService would have methods such as 'createTransaction(CreateTransactionRequest createTransactionRequest)' and that method would be responsible for instantiating the controller and executing the call. That way, we wouldn't deal with a "Controller", we'd deal with a "Service".
Thanks guys -- I am really impressed with the level of support I've received from Authorize.net. Alfred |
Also, one other point: Why does the API require the client to separate track 1 data versus track 2 data? It would be much easier if we could pass the entire track data to the API and the API would have the logic to split track 1 versus track 2 data. The way it is now, every client that wants to use the Authorize.net API needs to implement this logic. I had to go out of my way to figure out the format and the best way of parsing through it and I think it'd be great if the API would just do it for me. |
Hi Alfred, It's been a long time coming but I think we've come up with an explanation for this exception. We were testing your code and we were able to reproduce this same exception (response code = 1.0). As stated by Rajeev and Brian, this is not something that should happen. It appears that the response itself contains a float at that location or it could have been type-casted during the unmarshalling of the response. However, specific to your code, we've found the problem. If you would consider the original post, your code is making a card not present (CNP) transaction for voiding the transaction. This is where the problem resides. Consider the lines: merchant.setDeviceType(net.authorize.DeviceType.VIRTUAL_TERMINAL);
merchant.setMarketType(net.authorize.MarketType.RETAIL); Your code is creating a transaction which is a card present transaction (as evidenced by the class of the response). The two lines above specifically creates a card present transaction. So the transaction ID which you extract using the line transactionId = result.getTransId(); is specific to a card present transaction. Now, in the second part of your code, I assume you want to void this same transaction, since you are using the same transaction ID. However, you are creating a CNP transaction and using it to try to void a card present transaction. This happens because you failed to include the lines that created the card present transaction in the first place (the first code segment specified above). Because of this, the response which you are getting is not a card present response. Kindly note the difference in the class of the responses for the two transactions. The first response is of class Now, however, if you included the lines merchant.setDeviceType(net.authorize.DeviceType.VIRTUAL_TERMINAL);
merchant.setMarketType(net.authorize.MarketType.RETAIL); in the code to void the transaction, just after you created the merchant (as you did in the first part of the code), this exception does not occur. The response code received and unmarshalled is an integer, which is the expected data type. Hope this helps, Gabriel |
I just encountered the same issue. Are there any plans to fix this code? To fix, simply change line 30 of
to
|
Hi Danny, I'm currently working on this. I already have the fix in place and I'm in the process of testing it out. We will keep you updated about this. Thanks, |
A pull request for this issue has been sent. |
Thanks @gnongsie, waiting for release. |
Thanks for reminding me of this. I think the pull request got rejected due to failures in the merge tests. The fix has been merged and will be released in the next version. I must apologize for the lateness. I was not aware that the fix did not go through. Thanks again. |
The issue is within Auth.NET's API. They should NOT be responding with 1.0 as a response code. Their documentation does not tell us how to handle this and the code fix to this projuect masks failed credit card transaction failures. |
Hi,
I tested the use case where a transaction is created using the card's track data (a card present transaction) and then followed up with voiding that transaction. When I void it, it fails with a NumberFormatException. I think I've traced it down to the response code being "1.0" instead of "1", which triggers the exception when trying to convert it to an Integer. It's important to note that if the transaction is created without using the track data, say by setting the card number manually, the void works fine (that's because the response code returns a "1" instead of a "1.0" allowing a successful integer conversion.
Also, note that I'm using a Card Not Present (CNP) Authorize.net account with CIM enabled, if that matters.
Let's start with the test case (substitute your credentials):
Wire log:
Stack trace:
If you look at the last line of the wire log, you'll notice that the response code (the first number in the string) is set to "1.0". That causes line 33 in Result.java to throw an exception. Here's the relevant code (the Integer.parseInt method throws the exception):
Thanks for looking into this.
Alfred
The text was updated successfully, but these errors were encountered: