AuthorizeNet / sample-code-php

This repository contains working code samples which demonstrate php integration with the Authorize.Net API
MIT License
175 stars 197 forks source link

ListOfAUDetailsType is incorrectly parsing JSON response #151

Open IDSeal opened 4 years ago

IDSeal commented 4 years ago

When running a GetAUJobDetailsRequest I am receiving a correct total amount, but both AuUpdate and AuDelete are empty. After digging into the raw response, I can see clearly that the auDetails response is populated.

More digging revealed that the response is intended to be delineated into AuUpdate and AuDelete, but there appears to be no code that handles this delineation, so even though there are valid results, the GetAUJobDetailsRequest returns empty values for AuUpdate and AuDelete.

I was able to fix this by adding the following to ListOfAUDetailsType::set() on line 177, which then allows the set to proceed to the custom class parsing for the result set.

            $data = array('AuUpdate' => $data);

I know this is a hack, so I didn't want to submit it as a PR. I imagine there is some missing logic for delineating out which AuDetails is an AuUpdate vs an AuDelete. I was going to build a preparser in the ListOfAUDetailsType class that determines which is which based on the reason_code returned for each AuDetail item.

Can the Authnet team either patch in the correct parsing logic, or provide more detail on the intentions in this ticket so that I may build it.


See the following link that describes this issue submitted by another user from over a year ago: https://community.developer.authorize.net/t5/Integration-and-Testing/Account-Updater-Job-Details-response-data-structure-does-not/td-p/61484