From 7e3dbd767bbd3f57909ed67cd5c12785ec02c50b Mon Sep 17 00:00:00 2001 From: laurent-yoti Date: Mon, 13 May 2024 15:13:13 +0100 Subject: [PATCH] Release support - examples update (#471) Updated examples of digital identity and idv flows to surface and display the errors raised during identity profile checks. --- .../controllers/profile.controller.js | 6 +++++- .../views/pages/partials/identity-profile.ejs | 21 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/examples/digital-identity/controllers/profile.controller.js b/examples/digital-identity/controllers/profile.controller.js index 6499da37..72488b84 100644 --- a/examples/digital-identity/controllers/profile.controller.js +++ b/examples/digital-identity/controllers/profile.controller.js @@ -263,9 +263,13 @@ module.exports = async (req, res) => { } const receipt = await sdkDigitalIdentityClient.getShareReceipt(receiptId); + const receiptError = receipt.getError(); + const receiptErrorReason = receipt.getErrorReason(); if (receiptError) { - throw new Error(`The receipt was fetched correctly, yet it indicates that an error occurred during the share: ${receiptError}.`); + throw new Error(receiptErrorReason + ? `${receiptError}\nError reason: ${JSON.stringify(receiptErrorReason, null, 2)}` + : `${receiptError}`); } const profile = receipt.getProfile(); diff --git a/examples/idv-identity-checks/views/pages/partials/identity-profile.ejs b/examples/idv-identity-checks/views/pages/partials/identity-profile.ejs index 362fbf76..89f2b85e 100644 --- a/examples/idv-identity-checks/views/pages/partials/identity-profile.ejs +++ b/examples/idv-identity-checks/views/pages/partials/identity-profile.ejs @@ -12,6 +12,26 @@ <%= identityProfile.getResult(); %> + <% if (identityProfile.getFailureReason()) { %> + + Error details: + + + + + + + + + + + + +
Error code<%= identityProfile.getFailureReason().getReasonCode(); %>
Additional details
<%= JSON.stringify(identityProfile.getFailureReason().getRequirementsNotMetDetails(), null, 2); %>
+ + + <% } %> + <% if (identityProfile.getIdentityProfileReport()) { %>> Identity Profile Report @@ -43,5 +63,6 @@ + <% } %>