feat: Add more metadata to Stripe transaction (#11221)
* Add booker info, event type title, and organizer info into Stripe metadata * Add back bookingTitle in addition to eventTitle * Remove .tool-versions * Fix typo --------- Co-authored-by: alannnc <alannnc@gmail.com>
This commit is contained in:
parent
efcfd7bb9b
commit
3a05ae6f74
|
@ -49,9 +49,13 @@ export class PaymentService implements IAbstractPaymentService {
|
|||
async create(
|
||||
payment: Pick<Prisma.PaymentUncheckedCreateInput, "amount" | "currency">,
|
||||
bookingId: Booking["id"],
|
||||
userId: Booking["userId"],
|
||||
username: string | null,
|
||||
bookerName: string,
|
||||
bookerEmail: string,
|
||||
paymentOption: PaymentOption,
|
||||
eventTitle?: string
|
||||
eventTitle?: string,
|
||||
bookingTitle?: string
|
||||
) {
|
||||
try {
|
||||
// Ensure that the payment service can support the passed payment option
|
||||
|
@ -82,8 +86,12 @@ export class PaymentService implements IAbstractPaymentService {
|
|||
metadata: {
|
||||
identifier: "cal.com",
|
||||
bookingId,
|
||||
calAccountId: userId,
|
||||
calUsername: username,
|
||||
bookerName,
|
||||
bookerEmail,
|
||||
eventName: eventTitle || "",
|
||||
eventTitle: eventTitle || "",
|
||||
bookingTitle: bookingTitle || "",
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -1722,6 +1722,7 @@ async function handler(
|
|||
eventType,
|
||||
eventTypePaymentAppCredential as IEventTypePaymentCredentialType,
|
||||
booking,
|
||||
fullName,
|
||||
bookerEmail
|
||||
);
|
||||
|
||||
|
@ -1911,7 +1912,7 @@ async function handler(
|
|||
const createBookingObj = {
|
||||
include: {
|
||||
user: {
|
||||
select: { email: true, name: true, timeZone: true },
|
||||
select: { email: true, name: true, timeZone: true, username: true },
|
||||
},
|
||||
attendees: true,
|
||||
payment: true,
|
||||
|
@ -2279,6 +2280,7 @@ async function handler(
|
|||
eventType,
|
||||
eventTypePaymentAppCredential as IEventTypePaymentCredentialType,
|
||||
booking,
|
||||
fullName,
|
||||
bookerEmail
|
||||
);
|
||||
|
||||
|
@ -2466,6 +2468,7 @@ const findBookingQuery = async (bookingId: number) => {
|
|||
name: true,
|
||||
email: true,
|
||||
timeZone: true,
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
eventType: {
|
||||
|
|
|
@ -8,7 +8,7 @@ import type { IAbstractPaymentService, PaymentApp } from "@calcom/types/PaymentS
|
|||
|
||||
const handlePayment = async (
|
||||
evt: CalendarEvent,
|
||||
selectedEventType: Pick<Zod.infer<typeof EventTypeModel>, "metadata">,
|
||||
selectedEventType: Pick<Zod.infer<typeof EventTypeModel>, "metadata" | "title">,
|
||||
paymentAppCredentials: {
|
||||
key: Prisma.JsonValue;
|
||||
appId: EventTypeAppsList;
|
||||
|
@ -18,11 +18,13 @@ const handlePayment = async (
|
|||
} | null;
|
||||
},
|
||||
booking: {
|
||||
user: { email: string | null; name: string | null; timeZone: string } | null;
|
||||
user: { email: string | null; name: string | null; timeZone: string; username: string | null } | null;
|
||||
id: number;
|
||||
userId: number | null;
|
||||
startTime: { toISOString: () => string };
|
||||
uid: string;
|
||||
},
|
||||
bookerName: string,
|
||||
bookerEmail: string
|
||||
) => {
|
||||
const paymentApp = (await appStore[
|
||||
|
@ -58,8 +60,12 @@ const handlePayment = async (
|
|||
currency: selectedEventType?.metadata?.apps?.[paymentAppCredentials.appId].currency,
|
||||
},
|
||||
booking.id,
|
||||
booking.userId,
|
||||
booking.user?.username ?? null,
|
||||
bookerName,
|
||||
bookerEmail,
|
||||
paymentOption,
|
||||
selectedEventType.title,
|
||||
evt.title
|
||||
);
|
||||
}
|
||||
|
|
|
@ -13,9 +13,13 @@ export interface IAbstractPaymentService {
|
|||
create(
|
||||
payment: Pick<Prisma.PaymentUncheckedCreateInput, "amount" | "currency">,
|
||||
bookingId: Booking["id"],
|
||||
userId: Booking["userId"],
|
||||
username: string | null,
|
||||
bookerName: string | null,
|
||||
bookerEmail: string,
|
||||
paymentOption: PaymentOption,
|
||||
eventTitle?: string
|
||||
eventTitle?: string,
|
||||
bookingTitle?: string
|
||||
): Promise<Payment>;
|
||||
/* This method is to collect card details to charge at a later date ex. no-show fees */
|
||||
collectCard(
|
||||
|
|
Loading…
Reference in New Issue
Block a user