svn: /pear/packages/Payment_Process2/trunk/Payment/Process2/Result/ TrustCommerce.php
| From: | Daniel O'Connor | Date: | Mon, 06 Sep 2010 11:29:56 +0000 |
| Subject: | svn: /pear/packages/Payment_Process2/trunk/Payment/Process2/Result/ TrustCommerce.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-60263@lists.php.net to get a copy of this message | ||
clockwerx Mon, 06 Sep 2010 11:29:56 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=303074
Log:
Line breaks vs test data vs parsing
Changed paths:
U pear/packages/Payment_Process2/trunk/Payment/Process2/Result/TrustCommerce.php
Modified: pear/packages/Payment_Process2/trunk/Payment/Process2/Result/TrustCommerce.php
===================================================================
--- pear/packages/Payment_Process2/trunk/Payment/Process2/Result/TrustCommerce.php 2010-09-06
11:13:37 UTC (rev 303073)
+++ pear/packages/Payment_Process2/trunk/Payment/Process2/Result/TrustCommerce.php 2010-09-06
11:29:56 UTC (rev 303074)
@@ -68,26 +68,22 @@
*/
function parse()
{
- $array = array();
- parse_str(str_replace("\r\n", "&", $this->_rawResponse), $array);
+ $responseArray = array();
+
+ parse_str(str_replace(array("\r", "\n"), "&",
$this->_rawResponse), $responseArray);
- $this->_mapFields($array);
- }
+ if (isset($responseArray['status'])) {
+ $this->code = trim($responseArray['status']);
+ }
- /**
- * @todo Good unit test coverage!
- */
- function _mapFields($responseArray)
- {
- if (empty($responseArray)) {
- return;
+ if (isset($responseArray['avs'])) {
+ $this->avsCode = trim($responseArray['avs']);
}
- foreach ($this->_fieldMap as $key => $val) {
- if (isset($responseArray[$key])) {
- $this->$val = trim($responseArray[$key]);
- }
+ if (isset($responseArray['transid'])) {
+ $this->transactionId = trim($responseArray['transid']);
}
+
if (!isset($this->_statusCodeMessages[$this->messageCode])) {
$message = !empty($responseArray['status']) ?
$this->_statusCodeMessages[trim($responseArray['status'])] : "";