fix: uncaught PaymentService typings in payment utils (#16107)

* fix: uncaught errors in PaymentService

* fix: uncaught errors in WebhookService

* fix: uncaught errors in sendPayload

* fix: uncaught PaymentService typings in payment utils

* fix: Remove missing users from assignment (#16115)

* remove missing users from assignment

* early return

* fix: use organization default fixedPrice if self-serve/default price is passed in (#15966)

* Use fixed price if default (selfserve) is used

* fix conditional

* use .env instead of hard coded values

* feedback

* fix: display skeleton loader (#16114)

* fix: display loader

* fix: updated skelton loader

* feat: create new markNoShow endpoint (#15738)

* feat: create new markNoShow endpoint

* chore: add schema

* chore: update name

* chore: save progress

* refactor: improve code and types

* fix: unit test

* chore: improvements

* chore: move query to booking repository

* fix: type error

* chore: Remove cal.ai email assistant (#16003)

* Delete apps/ai directory

* removed cal-ai app from app store

---------

Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>

* feat: Add upcoming bookings feature to GET /api/bookings endpoint (#16060)

* feat: Add upcoming bookings feature to GET /api/bookings endpoint

- Added support for filtering upcoming bookings by adding the `upcoming` query parameter to the GET /api/bookings endpoint.
- When `upcoming` is set to "true", only upcoming bookings are returned.
- Regular users can now retrieve only their upcoming bookings by setting `upcoming` to "true".
- System-wide admins and organization admins can also retrieve only upcoming bookings by setting `upcoming` to "true".

* feat: Add status filter to booking API endpoint

This commit adds a new `status` filter to the booking API endpoint. The `status` filter allows filtering bookings by their status, overriding the `dateFrom` and `dateTo` filters. The only valid value for the `status` filter is "upcoming".

* Update _get.ts

---------

Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>

* fix: Hide personal booking theme when in an organization (#16117)

Co-authored-by: Peer Richelsen <peeroke@gmail.com>

* fix: uncaught errors in WebhookService

* fix: uncaught errors in sendPayload

---------

Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
Co-authored-by: Imamuzzaki Abu Salam <imamuzzaki@gmail.com>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
This commit is contained in:
Omar López
2024-08-08 20:15:44 +02:00
committed by GitHub
co-authored by Anik Dhabal Babu Peer Richelsen Syed Ali Shahbaz sean-brydon Udit Takkar Carina Wollendorfer Hariom Balhara Imamuzzaki Abu Salam Joe Au-Yeung
parent 2b9bdb9c80
commit 3e28160fa7
@@ -9,6 +9,7 @@ import { getTranslation } from "@calcom/lib/server/i18n";
import sendPayload from "@calcom/lib/server/webhooks/sendPayload";
import { WebhookTriggerEvents } from "@calcom/prisma/enums";
import type { CalendarEvent } from "@calcom/types/Calendar";
import type { PaymentApp } from "@calcom/types/PaymentService";
import { TRPCError } from "@trpc/server";
@@ -25,7 +26,7 @@ export const paymentsRouter = router({
.mutation(async ({ ctx, input }) => {
const { prisma } = ctx;
const booking = await prisma.booking.findFirst({
const booking = await prisma.booking.findFirstOrThrow({
where: {
id: input.bookingId,
},
@@ -46,10 +47,6 @@ export const paymentsRouter = router({
const payment = booking.payment[0];
if (!booking) {
throw new Error("Booking not found");
}
if (payment.success) {
throw new TRPCError({
code: "BAD_REQUEST",
@@ -110,9 +107,11 @@ export const paymentsRouter = router({
throw new TRPCError({ code: "BAD_REQUEST", message: "Invalid payment credential" });
}
const paymentApp = await appStore[paymentCredential?.app?.dirName as keyof typeof appStore];
const paymentApp = (await appStore[
paymentCredential?.app?.dirName as keyof typeof appStore
]?.()) as PaymentApp | null;
if (!("lib" in paymentApp && "PaymentService" in paymentApp.lib)) {
if (!(paymentApp && paymentApp.lib && "lib" in paymentApp && "PaymentService" in paymentApp.lib)) {
throw new TRPCError({ code: "BAD_REQUEST", message: "Payment service not found" });
}