From 080cb9db6902e7f71213707417caa19fdb0a6d35 Mon Sep 17 00:00:00 2001 From: Matheus Marques Date: Thu, 13 Jul 2023 10:43:11 -0300 Subject: [PATCH 1/3] Ajustes --- src/Rede/Brand.php | 23 +++++++++++++++ src/Rede/Exception/RedeException.php | 29 +++++++++++++++++++ .../Service/AbstractTransactionsService.php | 4 ++- 3 files changed, 55 insertions(+), 1 deletion(-) 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 ); } From 2c143d2fdeeb5b894ec175bda04969f9a1c92ef6 Mon Sep 17 00:00:00 2001 From: Matheus Marques Date: Thu, 13 Jul 2023 11:26:19 -0300 Subject: [PATCH 2/3] Ajsutes --- src/Rede/Authorization.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Rede/Authorization.php b/src/Rede/Authorization.php index b254d9c..3732393 100644 --- a/src/Rede/Authorization.php +++ b/src/Rede/Authorization.php @@ -94,6 +94,11 @@ class Authorization */ private $tid; + /** + * @var array + */ + private $brand; + /** * @return string */ @@ -417,4 +422,20 @@ public function setTid($tid) $this->tid = $tid; return $this; } + + /** + * @return array + */ + public function getBrand(): ?array + { + return $this->brand; + } + + /** + * @param array $brand + */ + public function setBrand(array $brand): void + { + $this->brand = $brand; + } } \ No newline at end of file From 7834cf243fa74dd0a90b1a62d1e4598f8c527b89 Mon Sep 17 00:00:00 2001 From: Matheus Marques Date: Thu, 13 Jul 2023 11:36:17 -0300 Subject: [PATCH 3/3] Mais ajustes --- src/Rede/Authorization.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Rede/Authorization.php b/src/Rede/Authorization.php index 3732393..389732b 100644 --- a/src/Rede/Authorization.php +++ b/src/Rede/Authorization.php @@ -95,7 +95,7 @@ class Authorization private $tid; /** - * @var array + * @var object */ private $brand; @@ -424,17 +424,17 @@ public function setTid($tid) } /** - * @return array + * @return object */ - public function getBrand(): ?array + public function getBrand() { return $this->brand; } /** - * @param array $brand + * @param object $brand */ - public function setBrand(array $brand): void + public function setBrand($brand): void { $this->brand = $brand; }