From 2c2a4e737d7041946eb1131ba653a0eebe27b856 Mon Sep 17 00:00:00 2001 From: Christoph Reiter <reiter.christoph@gmail.com> Date: Mon, 16 Aug 2021 17:06:44 +0200 Subject: [PATCH] Adjust for API entity renames Handle the new and old naming for now --- src/dbp-official-signature-pdf-upload.js | 7 ++++++- src/dbp-qualified-signature-pdf-upload.js | 16 ++++++++++++++-- src/dbp-signature-verification-full.js | 7 ++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/dbp-official-signature-pdf-upload.js b/src/dbp-official-signature-pdf-upload.js index 1afbe41..5fa4626 100644 --- a/src/dbp-official-signature-pdf-upload.js +++ b/src/dbp-official-signature-pdf-upload.js @@ -268,7 +268,12 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem break; case "entryPointUrl": JSONLD.getInstance(this.entryPointUrl).then((jsonld) => { - let apiUrlBase = jsonld.getApiUrlForEntityName("AdvancedlySignedDocument"); + let apiUrlBase; + try { + apiUrlBase = jsonld.getApiUrlForEntityName("EsignAdvancedlySignedDocument"); + } catch (error) { + apiUrlBase = jsonld.getApiUrlForEntityName("AdvancedlySignedDocument"); + } this.fileSourceUrl = apiUrlBase; }); break; diff --git a/src/dbp-qualified-signature-pdf-upload.js b/src/dbp-qualified-signature-pdf-upload.js index c2e1997..6d769da 100644 --- a/src/dbp-qualified-signature-pdf-upload.js +++ b/src/dbp-qualified-signature-pdf-upload.js @@ -285,7 +285,14 @@ class QualifiedSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitEle // fetch pdf from api gateway with sessionId JSONLD.getInstance(this.entryPointUrl).then((jsonld) => { - const apiUrl = jsonld.getApiUrlForEntityName("QualifiedlySignedDocument") + '/' + encodeURIComponent(sessionId) + '?fileName=' + + let apiUrlBase; + try { + apiUrlBase = jsonld.getApiUrlForEntityName("EsignQualifiedlySignedDocument"); + } catch (error) { + apiUrlBase = jsonld.getApiUrlForEntityName("QualifiedlySignedDocument"); + } + + const apiUrl = apiUrlBase + '/' + encodeURIComponent(sessionId) + '?fileName=' + encodeURIComponent(fileName); fetch(apiUrl, { @@ -378,7 +385,12 @@ class QualifiedSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitEle break; case "entryPointUrl": JSONLD.getInstance(this.entryPointUrl).then((jsonld) => { - const apiUrlBase = jsonld.getApiUrlForEntityName("QualifiedSigningRequest"); + let apiUrlBase; + try { + apiUrlBase = jsonld.getApiUrlForEntityName("EsignQualifiedSigningRequest"); + } catch (error) { + apiUrlBase = jsonld.getApiUrlForEntityName("QualifiedSigningRequest"); + } this.fileSourceUrl = apiUrlBase ; }); break; diff --git a/src/dbp-signature-verification-full.js b/src/dbp-signature-verification-full.js index a152eff..ccd1808 100644 --- a/src/dbp-signature-verification-full.js +++ b/src/dbp-signature-verification-full.js @@ -215,7 +215,12 @@ class SignatureVerificationFull extends ScopedElementsMixin(DBPSignatureLitEleme break; case "entryPointUrl": JSONLD.getInstance(this.entryPointUrl).then((jsonld) => { - const apiUrlBase = jsonld.getApiUrlForEntityName("ElectronicSignatureVerificationReport"); + let apiUrlBase; + try { + apiUrlBase = jsonld.getApiUrlForEntityName("EsignElectronicSignatureVerificationReport"); + } catch (error) { + apiUrlBase = jsonld.getApiUrlForEntityName("ElectronicSignatureVerificationReport"); + } this.fileSourceUrl = apiUrlBase; }); break; -- GitLab