diff --git a/src/Http/XMLHttp.php b/src/Http/XMLHttp.php
index fe47451..3ddfc03 100644
--- a/src/Http/XMLHttp.php
+++ b/src/Http/XMLHttp.php
@@ -38,7 +38,7 @@ public static function request(string $url, array $headers, mixed $body, bool $w
return [
$errno,
$error,
- TransactionResponse::fromXMLResponse(XMLResponse::parse("$response"))
+ XMLResponse::parse("$response")
];
}
diff --git a/src/Sdk/Transaction.php b/src/Sdk/Transaction.php
index a4159e3..75219ba 100644
--- a/src/Sdk/Transaction.php
+++ b/src/Sdk/Transaction.php
@@ -37,12 +37,15 @@ public function on(callable $success, callable $error): mixed
/**
* @var $errno int
* @var $error string
- * @var $response TransactionResponse
+ * @var $response mixed
*/
[$errno, $errorMessage, $response] = $this->processRequest();
if ($errno > 0) {
return $error($errorMessage, $errno);
}
+
+ $response = TransactionResponse::fromXMLResponse($response);
+
if ($response->getStatus() !== 200) {
return $error($response->getMessage(), $response->getStatus());
}
@@ -58,12 +61,15 @@ public function handleTransaction(): TransactionResponse
/**
* @var $errno int
* @var $errorMessage string
- * @var $response TransactionResponse
+ * @var $response mixed
*/
[$errno, $errorMessage, $response] = $this->processRequest();
if ($errno > 0) {
throw new TransactionException($errorMessage, $errno);
}
+
+ $response = TransactionResponse::fromXMLResponse($response);
+
if ($response->getStatus() !== 200) {
throw new TransactionException($response->getMessage(), $response->getStatus());
}