diff --git a/src/xml/Error.php b/src/xml/Error.php new file mode 100644 index 0000000..42bd1f0 --- /dev/null +++ b/src/xml/Error.php @@ -0,0 +1,43 @@ +code)) { + $this->code = (string) $xmlElement->code; + } + if (isset($xmlElement->message)) { + $this->message = (string) $xmlElement->message; + } + } + + public function getCode() { + return $this->code; + } + + public function getMessage() { + return $this->message; + } + + public function toString() { + return 'Error[code='.$this->code.', message='.$this->message.']'; + } + + public function toXML() { + $xmlString = ''; + if (null !== $this->code) { + $xmlString .= ''.htmlspecialchars($this->code).''; + } + if (null !== $this->message) { + $xmlString .= ''.htmlspecialchars($this->message).''; + } + $xmlString .= ''; + + return new \SimpleXMLElement($xmlString); + } +} diff --git a/src/xml/XMLDeserializer.php b/src/xml/XMLDeserializer.php index faca829..b3d293c 100644 --- a/src/xml/XMLDeserializer.php +++ b/src/xml/XMLDeserializer.php @@ -370,6 +370,9 @@ public static function deserialize($xmlElement) } return $result; + case "error": + $result = new Error(); + break; case "account_placeholder": $result = new AccountPlaceholder();