diff --git a/src/Rede/Authorization.php b/src/Rede/Authorization.php index b254d9c..389732b 100644 --- a/src/Rede/Authorization.php +++ b/src/Rede/Authorization.php @@ -94,6 +94,11 @@ class Authorization */ private $tid; + /** + * @var object + */ + private $brand; + /** * @return string */ @@ -417,4 +422,20 @@ public function setTid($tid) $this->tid = $tid; return $this; } + + /** + * @return object + */ + public function getBrand() + { + return $this->brand; + } + + /** + * @param object $brand + */ + public function setBrand($brand): void + { + $this->brand = $brand; + } } \ No newline at end of file diff --git a/src/Rede/Brand.php b/src/Rede/Brand.php index 97caeb5..f2cbaf4 100644 --- a/src/Rede/Brand.php +++ b/src/Rede/Brand.php @@ -21,6 +21,11 @@ class Brand */ private $returnMessage; + /** + * @var string + */ + private $authorizationCode; + /** * @return string */ @@ -78,5 +83,23 @@ public function setReturnMessage(string $returnMessage): Brand return $this; } + /** + * @param string $authorizationCode + * + * @return Brand + */ + public function setAuthorizationCode(string $authorizationCode): Brand + { + $this->authorizationCode = $authorizationCode; + return $this; + } + + /** + * @return string + */ + public function getAuthorizationCode(): string + { + return $this->authorizationCode; + } } \ No newline at end of file diff --git a/src/Rede/Exception/RedeException.php b/src/Rede/Exception/RedeException.php index 41d6f3e..77e388c 100644 --- a/src/Rede/Exception/RedeException.php +++ b/src/Rede/Exception/RedeException.php @@ -2,8 +2,37 @@ namespace Rede\Exception; +use Rede\Transaction; use RuntimeException; +use Throwable; class RedeException extends RuntimeException { + private ?string $response = null; + + private ?Transaction $transaction = null; + + public function __construct($message = "", $code = 0, ?Throwable $previous = null, string $response = null, ?Transaction $transaction = null) + { + parent::__construct($message, $code, $previous); + + $this->response = $response; + $this->transaction = $transaction; + } + + /** + * @return string|null + */ + public function getResponse(): ?string + { + return $this->response; + } + + /** + * @return Transaction|null + */ + public function getTransaction(): ?Transaction + { + return $this->transaction; + } } diff --git a/src/Rede/Service/AbstractTransactionsService.php b/src/Rede/Service/AbstractTransactionsService.php index 24297a3..a1bcacc 100644 --- a/src/Rede/Service/AbstractTransactionsService.php +++ b/src/Rede/Service/AbstractTransactionsService.php @@ -100,7 +100,9 @@ protected function parseResponse($response, $statusCode) throw new RedeException( $this->transaction->getReturnMessage(), $this->transaction->getReturnCode(), - $previous + $previous, + $response, + $this->transaction ); }