Skip to content

Commit

Permalink
updated failure details error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmet-yoti committed Jul 24, 2024
1 parent b28b5a6 commit 1602ce2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/Identity/Receipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/Identity/ReceiptBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
15 changes: 7 additions & 8 deletions src/Identity/WrappedReceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Yoti\Exception\EncryptedDataException;
use Yoti\Identity\Content\Content;
use Yoti\Util\DateTime;

class WrappedReceipt
{
private string $id;
Expand All @@ -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;

Expand All @@ -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(
Expand All @@ -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"]
);
}
}
Expand Down

0 comments on commit 1602ce2

Please sign in to comment.