txError = $xtr->ewayTrxnError; //$this->txStatus = $xtr->ewayTrxnStatus; //$this->txTransactionNumber = $xtr->ewayTrxnNumber; //$this->txOption1 = $xtr->ewayTrxnOption1; //$this->txOption2 = $xtr->ewayTrxnOption2; //$this->txOption3 = $xtr->ewayTrxnOption3; //$this->txAmount = $xtr->ewayReturnAmount; //$this->txAuthCode = $xtr->ewayAuthCode; //$this->txInvoiceReference = $xtr->ewayTrxnReference; $this->txError = self::GetNodeValue("ewayTrxnError", $Xml); $this->txStatus = self::GetNodeValue("ewayTrxnStatus", $Xml); $this->txTransactionNumber = self::GetNodeValue("ewayTrxnNumber", $Xml); $this->txOption1 = self::GetNodeValue("ewayTrxnOption1", $Xml); $this->txOption2 = self::GetNodeValue("ewayTrxnOption2", $Xml); $this->txOption3 = self::GetNodeValue("ewayTrxnOption3", $Xml); $amount = self::GetNodeValue("ewayReturnAmount", $Xml); $this->txAuthCode = self::GetNodeValue("ewayAuthCode", $Xml); $this->txInvoiceReference = self::GetNodeValue("ewayTrxnReference", $Xml); $this->txBeagleScore = self::GetNodeValue("ewayBeagleScore", $Xml); $this->txAmount = (int) $amount; } /** * Simple function to use in place of the 'simplexml_load_string' call. * * It returns the NodeValue for a given NodeName * or returns and empty string. */ public function GetNodeValue($NodeName, &$strXML) { $OpeningNodeName = "<" . $NodeName . ">"; $ClosingNodeName = ""; $pos1 = stripos($strXML, $OpeningNodeName); $pos2 = stripos($strXML, $ClosingNodeName); if (($pos1 === FALSE) || ($pos2 === FALSE)) { return ""; } $pos1 += strlen($OpeningNodeName); $len = $pos2 - $pos1; $return = substr($strXML, $pos1, $len); return ($return); } public function TransactionNumber() { return $this->txTransactionNumber; } public function InvoiceReference() { return $this->txInvoiceReference; } public function Option1() { return $this->txOption1; } public function Option2() { return $this->txOption2; } public function Option3() { return $this->txOption3; } public function AuthorisationCode() { return $this->txAuthCode; } public function Error() { return $this->txError; } public function Amount() { return $this->txAmount; } public function Status() { return $this->txStatus; } public function BeagleScore () { return $this->txBeagleScore; } }