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