diff --git a/src/Handlers/HMAC/Validator.php b/src/Handlers/HMAC/Validator.php index 92560cb..b3efd00 100644 --- a/src/Handlers/HMAC/Validator.php +++ b/src/Handlers/HMAC/Validator.php @@ -49,7 +49,7 @@ class Validator extends Hmac /** * @var string */ - protected string $hash; + protected string $hash = ''; /** * @param Config $config @@ -102,4 +102,12 @@ public function validateOrFail(string $header, string $uri, string $method, $dat throw new BuckarooException($this->config->getLogger(), "HMAC validation failed."); } + + /** + * @return string + */ + public function getHash(): string + { + return $this->hash; + } } diff --git a/src/Transaction/Response/TransactionResponse.php b/src/Transaction/Response/TransactionResponse.php index c6b9bbf..0c41959 100644 --- a/src/Transaction/Response/TransactionResponse.php +++ b/src/Transaction/Response/TransactionResponse.php @@ -105,9 +105,14 @@ public function isValidationFailure(): bool */ public function data(?string $key = null) { - if ($key && isset($this->data[$key])) + if ($key) { - return $this->data[$key]; + if (isset($this->data[$key])) + { + return $this->data[$key]; + } + + return null; } return $this->data;