diff --git a/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts b/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts index 092ea8854e..4f9b934fb7 100644 --- a/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts +++ b/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts @@ -43,6 +43,7 @@ const createPaymentSendEvents = async ( } // Find this sessions Send component, determine which "destinations" we need to queue up events for + // REMINDER to keep these destinations in sync with api.planx.uk/modules/send/createSendEvents/controller.ts const sendNode: [string, Node] | undefined = Object.entries( publishedFlowData, ).find(([_nodeId, nodeData]) => nodeData.type === ComponentType.Send); @@ -54,7 +55,7 @@ const createPaymentSendEvents = async ( if (destinations.includes("bops")) { const bopsEvent = await createScheduledEvent({ webhook: `{{HASURA_PLANX_API_URL}}/bops/${teamSlug}`, - schedule_at: now, + schedule_at: new Date(now.getTime() + 15 * 1000), payload: eventPayload, comment: `bops_submission_${payload.sessionId}`, }); @@ -91,13 +92,23 @@ const createPaymentSendEvents = async ( const uniformEvent = await createScheduledEvent({ webhook: `{{HASURA_PLANX_API_URL}}/uniform/${teamSlug}`, - schedule_at: now, + schedule_at: new Date(now.getTime() + 30 * 1000), payload: eventPayload, comment: `uniform_submission_${payload.sessionId}`, }); combinedResponse["uniform"] = uniformEvent; } + if (destinations.includes("s3")) { + const s3Event = await createScheduledEvent({ + webhook: `{{HASURA_PLANX_API_URL}}/upload-submission/${teamSlug}`, + schedule_at: now, + payload: eventPayload, + comment: `upload_submission_${payload.sessionId}`, + }); + combinedResponse["s3"] = s3Event; + } + return res.json(combinedResponse); } catch (error) { return next({ diff --git a/api.planx.uk/modules/send/createSendEvents/controller.ts b/api.planx.uk/modules/send/createSendEvents/controller.ts index d2cb83e9a9..bf50a134ee 100644 --- a/api.planx.uk/modules/send/createSendEvents/controller.ts +++ b/api.planx.uk/modules/send/createSendEvents/controller.ts @@ -3,6 +3,7 @@ import { createScheduledEvent } from "../../../lib/hasura/metadata/index.js"; import type { CreateSendEventsController } from "./types.js"; // Create "One-off Scheduled Events" in Hasura from Send component for selected destinations +// REMINDER to keep these destinations in sync with api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts const createSendEvents: CreateSendEventsController = async ( _req, res,