4 +--------------------------------------------------------------------+
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 /**************************************************************************************************************************
28 * Licensed to CiviCRM under the Academic Free License version 3.0
29 * Written & Contributed by Dolphin Software P/L - March 2008
31 * 'eWAY_GatewayResponse.php' - Loosley based on the standard supplied eWay sample code 'GatewayResponse.php'
33 * The 'simplexml_load_string' has been removed as it was causing major issues
34 * with Drupal V5.7 / CiviCRM 1.9 installtion's Home page.
35 * Filling the Home page with "Warning: session_start() [function.session-start]: Node no longer exists in ..." messages
37 * Found web reference indicating 'simplexml_load_string' was a probable cause.
38 * As soon as 'simplexml_load_string' was removed the problem fixed itself.
40 * Additionally the '$txStatus' var has been set as a string rather than a boolean.
41 * This is because the returned $params['trxn_result_code'] is in fact a string and not a boolean.
42 **************************************************************************************************************************/
47 var $txTransactionNumber = "";
48 var $txInvoiceReference = "";
55 var $txBeagleScore = "";
57 function __construct()
62 function ProcessResponse($Xml)
64 #####################################################################################
66 # $xtr = simplexml_load_string($Xml) or die ("Unable to load XML string!"); #
68 # $this->txError = $xtr->ewayTrxnError; #
69 # $this->txStatus = $xtr->ewayTrxnStatus; #
70 # $this->txTransactionNumber = $xtr->ewayTrxnNumber; #
71 # $this->txOption1 = $xtr->ewayTrxnOption1; #
72 # $this->txOption2 = $xtr->ewayTrxnOption2; #
73 # $this->txOption3 = $xtr->ewayTrxnOption3; #
74 # $this->txAmount = $xtr->ewayReturnAmount; #
75 # $this->txAuthCode = $xtr->ewayAuthCode; #
76 # $this->txInvoiceReference = $xtr->ewayTrxnReference; #
78 #####################################################################################
80 $this->txError
= self
::GetNodeValue("ewayTrxnError", $Xml);
81 $this->txStatus
= self
::GetNodeValue("ewayTrxnStatus", $Xml);
82 $this->txTransactionNumber
= self
::GetNodeValue("ewayTrxnNumber", $Xml);
83 $this->txOption1
= self
::GetNodeValue("ewayTrxnOption1", $Xml);
84 $this->txOption2
= self
::GetNodeValue("ewayTrxnOption2", $Xml);
85 $this->txOption3
= self
::GetNodeValue("ewayTrxnOption3", $Xml);
86 $amount = self
::GetNodeValue("ewayReturnAmount", $Xml);
87 $this->txAuthCode
= self
::GetNodeValue("ewayAuthCode", $Xml);
88 $this->txInvoiceReference
= self
::GetNodeValue("ewayTrxnReference", $Xml);
89 $this->txBeagleScore
= self
::GetNodeValue("ewayBeagleScore", $Xml);
90 $this->txAmount
= (int) $amount;
94 /************************************************************************
95 * Simple function to use in place of the 'simplexml_load_string' call.
97 * It returns the NodeValue for a given NodeName
98 * or returns and empty string.
99 ************************************************************************/
100 function GetNodeValue($NodeName, &$strXML)
102 $OpeningNodeName = "<" . $NodeName . ">";
103 $ClosingNodeName = "</" . $NodeName . ">";
105 $pos1 = stripos($strXML, $OpeningNodeName);
106 $pos2 = stripos($strXML, $ClosingNodeName);
108 if ( ($pos1 === false) ||
($pos2 === false) )
111 $pos1 +
= strlen($OpeningNodeName);
112 $len = $pos2 - $pos1;
114 $return = substr($strXML, $pos1, $len);
120 function TransactionNumber()
122 return $this->txTransactionNumber
;
125 function InvoiceReference()
127 return $this->txInvoiceReference
;
132 return $this->txOption1
;
137 return $this->txOption2
;
142 return $this->txOption3
;
145 function AuthorisationCode()
147 return $this->txAuthCode
;
152 return $this->txError
;
157 return $this->txAmount
;
162 return $this->txStatus
;
165 function BeagleScore ()
167 return $this->txBeagleScore
;