PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Payment » Payment_Process » Bug #2756

Field Encapsulation Character Support

Details

Request #2756Field Encapsulation Character Support
Submitted2004-11-15 15:38 UTC
Fromjosh at trutwins dot homeip dot net
Assignedjstump
StatusClosed
PackagePayment_Process
PHP Version4.3.9
OSLinux Debian Stable
Roadmaps(Not assigned)

Comments

[2004-11-15 15:38 UTC] josh at trutwins dot homeip dot net

Description:
------------
Authorize.NET recommends that a user enable a Field Encapsulation Character so the response is not only delmitted by commas, but in the event of a comma being in one of the return fields it is encapsulted, for example:

[_rawResponse] => |2|,|2|,|45|,|This transaction has been declined.|,|005191|,|A|,|710881561|,|1123451458|,||,|1.00|,|CC|,|auth_only|,|1461264151|,|Joshua|,|D Trutwin|,||,|4342 Fake St N|,|Metropolis|,|NY|,|10101|,|US|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|E508DF8E048CC23DD95AA1E629A21708|,|N|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|"x_delim_data"

I was able to add support for this by modifying the Payment_Process_AuthorizeNet parse method:

function parse()
{
$responseArray = explode(',',$this->_rawResponse);
for($i = 0; $i < count($responseArray); $i++) {
$responseArray[$i] = preg_replace("/^\|(.*)\|$/","\\1",$responseArray[$i]);
}
$this->_mapFields($responseArray);
}

[2004-11-15 15:45 UTC] josh at trutwins dot homeip dot net

Of course this would be configurable as there are more things you can use for a Field Encapsulation Character besides a pipe...

[2005-03-15 17:34 UTC] josh at trutwins dot homeip dot net

I'm not sure why but for some reason explode("|,|", $this->_rawResponse) caused odd behavior. I'm leaving it alone for now, if you implement a patch I'd be more than happy to test it out.

Josh