mirror of
https://github.com/documenso/documenso.git
synced 2026-06-22 04:12:06 +10:00
fix: include envelopeId in webhook payload (#2998)
This commit is contained in:
@@ -17,6 +17,7 @@ export const generateSampleWebhookPayload = (event: WebhookTriggerEvents, webhoo
|
||||
const now = new Date();
|
||||
const basePayload = {
|
||||
id: 10,
|
||||
envelopeId: 'env_123',
|
||||
externalId: null,
|
||||
userId: 1,
|
||||
authOptions: null,
|
||||
@@ -52,6 +53,7 @@ export const generateSampleWebhookPayload = (event: WebhookTriggerEvents, webhoo
|
||||
recipients: [
|
||||
{
|
||||
id: 52,
|
||||
envelopeId: 'env_123',
|
||||
documentId: 10,
|
||||
templateId: null,
|
||||
email: 'signer@documenso.com',
|
||||
@@ -73,6 +75,7 @@ export const generateSampleWebhookPayload = (event: WebhookTriggerEvents, webhoo
|
||||
Recipient: [
|
||||
{
|
||||
id: 52,
|
||||
envelopeId: 'env_123',
|
||||
documentId: 10,
|
||||
templateId: null,
|
||||
email: 'signer@documenso.com',
|
||||
@@ -269,6 +272,7 @@ export const generateSampleWebhookPayload = (event: WebhookTriggerEvents, webhoo
|
||||
recipients: [
|
||||
{
|
||||
id: 50,
|
||||
envelopeId: 'env_123',
|
||||
documentId: 10,
|
||||
templateId: null,
|
||||
email: 'signer2@documenso.com',
|
||||
@@ -291,6 +295,7 @@ export const generateSampleWebhookPayload = (event: WebhookTriggerEvents, webhoo
|
||||
},
|
||||
{
|
||||
id: 51,
|
||||
envelopeId: 'env_123',
|
||||
documentId: 10,
|
||||
templateId: null,
|
||||
email: 'signer1@documenso.com',
|
||||
@@ -315,6 +320,7 @@ export const generateSampleWebhookPayload = (event: WebhookTriggerEvents, webhoo
|
||||
Recipient: [
|
||||
{
|
||||
id: 50,
|
||||
envelopeId: 'env_123',
|
||||
documentId: 10,
|
||||
templateId: null,
|
||||
email: 'signer2@documenso.com',
|
||||
@@ -337,6 +343,7 @@ export const generateSampleWebhookPayload = (event: WebhookTriggerEvents, webhoo
|
||||
},
|
||||
{
|
||||
id: 51,
|
||||
envelopeId: 'env_123',
|
||||
documentId: 10,
|
||||
templateId: null,
|
||||
email: 'signer1@documenso.com',
|
||||
@@ -444,6 +451,7 @@ export const generateSampleWebhookPayload = (event: WebhookTriggerEvents, webhoo
|
||||
recipients: [
|
||||
{
|
||||
id: 7,
|
||||
envelopeId: 'env_123',
|
||||
documentId: 7,
|
||||
templateId: null,
|
||||
email: 'signer1@documenso.com',
|
||||
@@ -468,6 +476,7 @@ export const generateSampleWebhookPayload = (event: WebhookTriggerEvents, webhoo
|
||||
Recipient: [
|
||||
{
|
||||
id: 7,
|
||||
envelopeId: 'env_123',
|
||||
documentId: 7,
|
||||
templateId: null,
|
||||
email: 'signer@documenso.com',
|
||||
|
||||
@@ -21,6 +21,7 @@ import { mapSecondaryIdToDocumentId, mapSecondaryIdToTemplateId } from '../utils
|
||||
*/
|
||||
export const ZWebhookRecipientSchema = z.object({
|
||||
id: z.number(),
|
||||
envelopeId: z.string(),
|
||||
documentId: z.number().nullable(),
|
||||
templateId: z.number().nullable(),
|
||||
email: z.string(),
|
||||
@@ -64,6 +65,7 @@ export const ZWebhookDocumentMetaSchema = z.object({
|
||||
*/
|
||||
export const ZWebhookDocumentSchema = z.object({
|
||||
id: z.number(),
|
||||
envelopeId: z.string(),
|
||||
externalId: z.string().nullable(),
|
||||
userId: z.number(),
|
||||
authOptions: z.any().nullable(),
|
||||
@@ -117,6 +119,7 @@ export const mapEnvelopeToWebhookDocumentPayload = (
|
||||
|
||||
const mappedRecipients = rawRecipients.map((recipient) => ({
|
||||
id: recipient.id,
|
||||
envelopeId: envelope.id,
|
||||
documentId: envelope.type === EnvelopeType.DOCUMENT ? legacyId : null,
|
||||
templateId: envelope.type === EnvelopeType.TEMPLATE ? legacyId : null,
|
||||
email: recipient.email,
|
||||
@@ -137,6 +140,7 @@ export const mapEnvelopeToWebhookDocumentPayload = (
|
||||
|
||||
return {
|
||||
id: legacyId,
|
||||
envelopeId: envelope.id,
|
||||
externalId: envelope.externalId,
|
||||
userId: envelope.userId,
|
||||
authOptions: envelope.authOptions,
|
||||
|
||||
Reference in New Issue
Block a user