* trpc procedures an middleware refactor * allow use sessionMiddleware without a req object * sync with the new tRPC structure * tRPC refactor on routing form app * import Prisma from @prisma/client * Lazy load apps from appstore * remove unrelated changes * Add types for PaymentService * type fixes * Merge branch 'main' into roae85/cal-1514-set-the-user-session-only-on-the * fix typo * remove console.log * remove explicit types from apstore object * linter fixes --------- Co-authored-by: Keith Williams <keithwillcode@gmail.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import type { Payment, Prisma, Booking, PaymentOption } from "@prisma/client";
|
|
|
|
import type { CalendarEvent } from "@calcom/types/Calendar";
|
|
|
|
export interface IAbstractPaymentService {
|
|
/* This method is for creating charges at the time of booking */
|
|
create(
|
|
payment: Pick<Prisma.PaymentUncheckedCreateInput, "amount" | "currency">,
|
|
bookingId: Booking["id"],
|
|
bookerEmail: string,
|
|
paymentOption: PaymentOption
|
|
): Promise<Payment>;
|
|
/* This method is to collect card details to charge at a later date ex. no-show fees */
|
|
collectCard(
|
|
payment: Pick<Prisma.PaymentUncheckedCreateInput, "amount" | "currency">,
|
|
bookingId: Booking["id"],
|
|
bookerEmail: string,
|
|
paymentOption: PaymentOption
|
|
): Promise<Payment>;
|
|
chargeCard(
|
|
payment: Pick<Prisma.PaymentUncheckedCreateInput, "amount" | "currency">,
|
|
bookingId?: Booking["id"]
|
|
): Promise<Payment>;
|
|
update(paymentId: Payment["id"], data: Partial<Prisma.PaymentUncheckedCreateInput>): Promise<Payment>;
|
|
refund(paymentId: Payment["id"]): Promise<Payment>;
|
|
getPaymentPaidStatus(): Promise<string>;
|
|
getPaymentDetails(): Promise<Payment>;
|
|
afterPayment(
|
|
event: CalendarEvent,
|
|
booking: {
|
|
user: { email: string | null; name: string | null; timeZone: string } | null;
|
|
id: number;
|
|
startTime: { toISOString: () => string };
|
|
uid: string;
|
|
},
|
|
paymentData: Payment
|
|
): Promise<void>;
|
|
deletePayment(paymentId: Payment["id"]): Promise<boolean>;
|
|
}
|