From 1602ce2512743114e97f913d8241055c5a51f7fb Mon Sep 17 00:00:00 2001 From: mehmet-yoti Date: Wed, 24 Jul 2024 16:40:56 +0100 Subject: [PATCH] updated failure details error handling --- src/Identity/Receipt.php | 8 ++++---- src/Identity/ReceiptBuilder.php | 4 ++-- src/Identity/WrappedReceipt.php | 15 +++++++-------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/Identity/Receipt.php b/src/Identity/Receipt.php index 162761f2..737fadc2 100644 --- a/src/Identity/Receipt.php +++ b/src/Identity/Receipt.php @@ -12,8 +12,8 @@ class Receipt private string $id; private string $sessionId; private \DateTime $timestamp; - private ApplicationContent $applicationContent; - private UserContent $userContent; + private ?ApplicationContent $applicationContent; + private ?UserContent $userContent; private ?string $rememberMeId; private ?string $parentRememberMeId; private ?string $error; @@ -23,8 +23,8 @@ public function __construct( string $id, string $sessionId, \DateTime $timestamp, - ApplicationContent $applicationContent, - UserContent $userContent, + ?ApplicationContent $applicationContent, + ?UserContent $userContent, ?string $rememberMeId, ?string $parentRememberMeId, ?string $error, diff --git a/src/Identity/ReceiptBuilder.php b/src/Identity/ReceiptBuilder.php index 7a091388..0851a088 100644 --- a/src/Identity/ReceiptBuilder.php +++ b/src/Identity/ReceiptBuilder.php @@ -16,9 +16,9 @@ class ReceiptBuilder private \DateTime $timestamp; - private ApplicationContent $applicationContent; + private ?ApplicationContent $applicationContent = null; - private UserContent $userContent; + private ?UserContent $userContent = null; private ?string $rememberMeId = null; diff --git a/src/Identity/WrappedReceipt.php b/src/Identity/WrappedReceipt.php index 7d1f4b74..f433c505 100644 --- a/src/Identity/WrappedReceipt.php +++ b/src/Identity/WrappedReceipt.php @@ -6,7 +6,6 @@ use Yoti\Exception\EncryptedDataException; use Yoti\Identity\Content\Content; use Yoti\Util\DateTime; - class WrappedReceipt { private string $id; @@ -19,9 +18,9 @@ class WrappedReceipt private Content $otherPartyContent; - private string $wrappedItemKeyId; + private ?string $wrappedItemKeyId = null; - private string $wrappedKey; + private ?string $wrappedKey; private ?string $rememberMeId = null; @@ -38,8 +37,8 @@ public function __construct(array $sessionData) $this->id = $sessionData['id']; $this->sessionId = $sessionData['sessionId']; $this->timestamp = DateTime::stringToDateTime($sessionData['timestamp']); - $this->wrappedItemKeyId = $sessionData['wrappedItemKeyId']; - $this->wrappedKey = $sessionData['wrappedKey']; + $this->wrappedItemKeyId = $sessionData['wrappedItemKeyId'] ?? null; + $this->wrappedKey = $sessionData['wrappedKey'] ?? null; if (isset($sessionData['content'])) { $this->content = new Content( @@ -63,10 +62,10 @@ public function __construct(array $sessionData) if (isset($sessionData['error'])) { $this->error = $sessionData['error']; } - if (isset($sessionData['errorDetails'])) { - if (isset($sessionData["error_details"]["error_reason"]["requirements_not_met_details"])) { + if (isset($sessionData['errorReason'])) { + if (isset($sessionData["errorReason"]["requirements_not_met_details"])) { $this->errorReason = new ErrorReason( - $sessionData['errorDetails']['error_reason']['requirements_not_met_details'] + $sessionData["errorReason"]["requirements_not_met_details"] ); } }