🔥 The free & Open Source DocuSign alternative
JavaScript digital-signaturedocument-signingdocusign-alternativedocusign-freee-signatureelectronic-signatureelectronic-signaturesesignesignaturehacktoberfestjavascriptlegaltechmongodbnodejsopen-sourcepdf-signpdf-signaturereactjsself-hostedsign-pdf-files
fix: some webhook event are not working for second signer & add certificate in completed webhook
prafull-opensignlabsd731951159f8
diff --git a/apps/OpenSignServer/cloud/parsefunction/callWebhook.js b/apps/OpenSignServer/cloud/parsefunction/callWebhook.jsindex a9d127c36..eab11e022 100644--- a/apps/OpenSignServer/cloud/parsefunction/callWebhook.js+++ b/apps/OpenSignServer/cloud/parsefunction/callWebhook.js@@ -48,8 +48,11 @@ export default async function callWebhook(request) {}}}+ const docQuery = new Parse.Query('contracts_Document');+ const resDoc = await docQuery.get(docId, { useMasterKey: true });const extendcls = new Parse.Query('contracts_Users');- extendcls.equalTo('UserId', { __type: 'Pointer', className: '_User', objectId: userId });+ extendcls.equalTo('objectId', resDoc.get('ExtUserPtr')?.id);+ // extendcls.equalTo('UserId', { __type: 'Pointer', className: '_User', objectId: userId });const res = await extendcls.first({ useMasterKey: true });if (res) {const extUser = JSON.parse(JSON.stringify(res));diff --git a/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.min.js b/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.min.jsindex fec7ab4ef..f7866d420 100644--- a/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.min.js+++ b/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.min.js@@ -123,9 +123,9 @@ async function sendCompletedMail(e) {},});}-async function sendDoctoWebhook(a, e, t, r) {- let i = [];- (i = r+async function sendDoctoWebhook(a, e, t, r, i) {+ let s = [];+ (s = r? { name: r?.Name, email: r?.Email, phone: r?.Phone }: a?.Signers?.map(e => ({ name: e.Name, email: e.Email, phone: e.Phone })) || [{ name: a?.ExtUserPtr?.Name, email: a?.ExtUserPtr?.Email, phone: a?.ExtUserPtr?.Phone },@@ -133,12 +133,13 @@ async function sendDoctoWebhook(a, e, t, r) {a.ExtUserPtr?.Webhook &&((r ='signed' === t- ? { signer: i, signedAt: new Date() }- : { signers: i, completedAt: new Date() }),+ ? { signer: s, signedAt: new Date() }+ : { signers: s, completedAt: new Date() }),(t = {event: t,objectId: a?.objectId,file: e || '',+ ...(i ? { certificate: i } : {}),name: a?.Name,note: a?.Note || '',description: a?.Description || '',@@ -205,7 +206,7 @@ const sendMailsaveCertifcate = async (e, t, a, r, i, s) => {? console.log("don't send mail"): sendCompletedMail({ url: a, isCustomMail: r, doc: e, mailProvider: i }),saveFileUsage(o.length, t.imageUrl, s),- sendDoctoWebhook(e, a, 'completed');+ sendDoctoWebhook(e, a, 'completed', '', t.imageUrl);};async function PDF(o) {try {