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 9147e82 commit b28b5a6
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Yoti\Profile\Attribute;
use Yoti\Profile\UserProfile;
use Yoti\Util\Logger;
use Yoti\Exception\ActivityDetailsException;
class ReceiptController extends BaseController
{
public function show(Request $request, DigitalIdentityClient $client, ?LoggerInterface $logger = null)
Expand All @@ -17,12 +18,25 @@ public function show(Request $request, DigitalIdentityClient $client, ?LoggerInt

$logger->warning("Unknown Content Type parsing as a String");
$shareReceipt = $client->fetchShareReceipt($request->query('ReceiptID'));
$profile = $shareReceipt->getProfile();
return view('receipt', [
'fullName' => $profile->getFullName(),
'selfie' => $profile->getSelfie(),
'profileAttributes' => $this->createAttributesDisplayList($profile),
]);
if ($shareReceipt->getError() != null)
{
error_log($shareReceipt->getErrorReason()->getRequirementNotMetDetails()->getDocumentCountryIsoCode());
return view('receipt', [
'fullName' => null,
'selfie' => null,
'profileAttributes' => null,
'error' => $shareReceipt->getErrorReason()
]);
}
else {
$profile = $shareReceipt->getProfile();
return view('receipt', [
'fullName' => $profile->getFullName(),
'selfie' => $profile->getSelfie(),
'profileAttributes' => $this->createAttributesDisplayList($profile),
'error' => null
]);
}
}

/**
Expand Down
29 changes: 29 additions & 0 deletions examples/digitalidentity/resources/views/receipt.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,37 @@
</section>

<section class="yoti-attributes-section">

<a href="/">
<img class="yoti-company-logo" src="/assets/images/company-logo.jpg" alt="company logo">
</a>
@if ($error)
<div class="yoti-attribute-list-header">
<div class="yoti-attribute-list-header-attribute"><b>Errors</b></div>
<div class="yoti-attribute-list-header-value"> </div>
</div>
<div class="yoti-attribute-list-header">
<div class="yoti-attribute-list-header-attribute">Audit Id</div>
<div class="yoti-attribute-list-header-value">{{ $error->getRequirementNotMetDetails()->getAuditId() }}</div>
</div>
<div class="yoti-attribute-list-header">
<div class="yoti-attribute-list-header-attribute">Details</div>
<div class="yoti-attribute-list-header-value">{{ $error->getRequirementNotMetDetails()->getDetails() }}</div>
</div>
<div class="yoti-attribute-list-header">
<div class="yoti-attribute-list-header-attribute">Failure Type</div>
<div class="yoti-attribute-list-header-value">{{ $error->getRequirementNotMetDetails()->getFailureType() }}</div>
</div>
<div class="yoti-attribute-list-header">
<div class="yoti-attribute-list-header-attribute">Document Type</div>
<div class="yoti-attribute-list-header-value">{{ $error->getRequirementNotMetDetails()->getDocumentType() }}</div>
</div>
<div class="yoti-attribute-list-header">
<div class="yoti-attribute-list-header-attribute">Country</div>
<div class="yoti-attribute-list-header-value">{{ $error->getRequirementNotMetDetails()->getDocumentCountryIsoCode() }}</div>
</div>

@endif
<div class="yoti-attribute-list-header">
<div class="yoti-attribute-list-header-attribute">Attribute</div>
<div class="yoti-attribute-list-header-value">Value</div>
Expand All @@ -55,6 +82,7 @@
</div>

<div class="yoti-attribute-list">
@if(@$profileAttributes)
@foreach($profileAttributes as $item)
@if ($item['obj'])
<div class="yoti-attribute-list-item">
Expand Down Expand Up @@ -96,6 +124,7 @@
</div>
@endif
@endforeach
@endif
</div>
</section>
</main>
Expand Down

0 comments on commit b28b5a6

Please sign in to comment.