From 25970e72dec33cd02a22b7ec26e8d7743e962c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20L=C3=B3pez?= Date: Wed, 7 Aug 2024 03:56:17 -0700 Subject: [PATCH] fix: uncaught errors in PaymentService (#16104) * fix: uncaught errors in PaymentService * fix: uncaught errors in WebhookService (#16105) * fix: uncaught errors in WebhookService * fix: uncaught errors in sendPayload (#16106) --------- Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> --- packages/features/webhooks/lib/WebhookService.ts | 2 +- packages/features/webhooks/lib/sendPayload.ts | 3 ++- packages/types/PaymentService.d.ts | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/features/webhooks/lib/WebhookService.ts b/packages/features/webhooks/lib/WebhookService.ts index f91d7f2365..08d5608ac9 100644 --- a/packages/features/webhooks/lib/WebhookService.ts +++ b/packages/features/webhooks/lib/WebhookService.ts @@ -17,7 +17,7 @@ export class WebhookService { return this; })() as unknown as WebhookService; } - async getWebhooks() { + getWebhooks() { return this.webhooks; } async sendPayload(payload: Parameters[4]) { diff --git a/packages/features/webhooks/lib/sendPayload.ts b/packages/features/webhooks/lib/sendPayload.ts index 50d5c30b4a..86249e0095 100644 --- a/packages/features/webhooks/lib/sendPayload.ts +++ b/packages/features/webhooks/lib/sendPayload.ts @@ -1,4 +1,4 @@ -import type { Webhook } from "@prisma/client"; +import type { Payment, Webhook } from "@prisma/client"; import { createHmac } from "crypto"; import { compile } from "handlebars"; @@ -60,6 +60,7 @@ export type WebhookDataType = CalendarEvent & createdAt: string; downloadLink?: string; paymentId?: number; + paymentData?: Payment; }; function addUTCOffset( diff --git a/packages/types/PaymentService.d.ts b/packages/types/PaymentService.d.ts index c0bc52316b..e9ab38905e 100644 --- a/packages/types/PaymentService.d.ts +++ b/packages/types/PaymentService.d.ts @@ -1,14 +1,17 @@ import type { Payment, Prisma, Booking, PaymentOption } from "@prisma/client"; -import type { PaymentService } from "@calcom/app-store/paypal/lib/PaymentService"; import type { CalendarEvent } from "@calcom/types/Calendar"; export interface PaymentApp { lib?: { - PaymentService: typeof PaymentService; + PaymentService: PaymentService; }; } +interface PaymentService { + new (credentials: { key: Prisma.JsonValue }): IAbstractPaymentService; +} + export interface IAbstractPaymentService { /* This method is for creating charges at the time of booking */ create(