Skip to content

Commit 7a5cdef

Browse files
fix: document completion webhook not working in selfsign
1 parent 2d7571a commit 7a5cdef

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

apps/OpenSign/src/routes/LoadMf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ function RemoteApp({ app }) {
3232
width: "100%",
3333
overflow: "hidden",
3434
borderRadius: 3,
35-
minHeight: "70vh"
35+
height: "100%",
36+
minHeight: "100vh"
3637
}}
3738
>
3839
{RemoteComponent && <RemoteComponent />}

apps/OpenSignServer/cloud/parsefunction/pdf/PDF.min.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,20 @@ async function sendCompletedMail(e) {
9595
},
9696
});
9797
}
98-
async function sendDoctoWebhook(t) {
99-
var e;
98+
async function sendDoctoWebhook(t, e) {
10099
t.data.ExtUserPtr?.Webhook &&
101100
((e = {
102-
File: t?.data?.SignedUrl,
101+
File: e || '',
103102
Name: t?.data?.Name,
104-
Note: t?.data?.Note,
105-
Description: t?.data?.Description,
106-
Signers: t?.data?.Signers?.map(e => e.Name),
103+
Note: t?.data?.Note || '',
104+
Description: t?.data?.Description || '',
105+
Signers: t?.data?.Signers?.map(e => ({ Name: e.Name, Email: e.Email, Phone: e.Phone })) || [
106+
{
107+
Name: t?.data?.ExtUserPtr?.Name,
108+
Email: t?.data?.ExtUserPtr?.Email,
109+
Phone: t?.data?.ExtUserPtr?.Phone,
110+
},
111+
],
107112
Completed: !0,
108113
CompletedAt: new Date(),
109114
CreatedAt: t?.data?.createdAt,
@@ -217,17 +222,17 @@ async function PDF(i, o) {
217222
(n.data.Signers && 0 < n.data.Signers.length && y.length !== n.data.Signers.length) ||
218223
!(t = !0)
219224
);
220-
var v,
221-
P,
225+
var P,
226+
v,
222227
x = `./exports/exported_file_${Math.floor(5e3 * Math.random())}.pdf`,
223228
b =
224229
(t
225-
? ((v = n.data.Signers?.map(e => e.Name + ' <' + e.Email + '>')),
230+
? ((P = n.data.Signers?.map(e => e.Name + ' <' + e.Email + '>')),
226231
(e =
227-
v && 0 < v.length
232+
P && 0 < P.length
228233
? plainAddPlaceholder({
229234
pdfBuffer: e,
230-
reason: 'Digitally signed by Open sign for ' + v?.join(', '),
235+
reason: 'Digitally signed by Open sign for ' + P?.join(', '),
231236
location: 'location',
232237
signatureLength: 1e4,
233238
})
@@ -237,8 +242,8 @@ async function PDF(i, o) {
237242
location: 'location',
238243
signatureLength: 1e4,
239244
})),
240-
(P = await new SignPDF(e, u).signPDF()),
241-
fs.writeFileSync(x, P))
245+
(v = await new SignPDF(e, u).signPDF()),
246+
fs.writeFileSync(x, v))
242247
: fs.writeFileSync(x, e),
243248
await uploadFile(x));
244249
if (b && b.imageUrl) {
@@ -265,7 +270,7 @@ async function PDF(i, o) {
265270
pdfName: n.data.Name,
266271
receiver: n.data.ExtUserPtr.Email,
267272
}),
268-
sendDoctoWebhook(n)),
273+
sendDoctoWebhook(n, b.imageUrl)),
269274
fs.unlinkSync(x),
270275
console.log('New Signed PDF created called: ' + x),
271276
'success' === o.message

0 commit comments

Comments
 (0)