fix: Remove hardcoded stripe.. (#14549)

This commit is contained in:
Alex van Andel
2024-04-12 15:50:02 +01:00
committed by GitHub
parent 53c1bc45d6
commit ad844f5e51
@@ -6,7 +6,6 @@ import { sendCancelledEmails } from "@calcom/emails";
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
import { cancelScheduledJobs } from "@calcom/features/webhooks/lib/scheduleTrigger";
import { isPrismaObjOrUndefined, parseRecurringEvent } from "@calcom/lib";
import getPaymentAppData from "@calcom/lib/getPaymentAppData";
import { deletePayment } from "@calcom/lib/payment/deletePayment";
import { getTranslation } from "@calcom/lib/server/i18n";
import { bookingMinimalSelect, prisma } from "@calcom/prisma";
@@ -137,13 +136,11 @@ export const deleteCredentialHandler = async ({ ctx, input }: DeleteCredentialOp
}
}
const metadata = EventTypeMetaDataSchema.parse(eventType.metadata);
const stripeAppData = getPaymentAppData({ ...eventType, metadata });
// If it's a payment, hide the event type and set the price to 0. Also cancel all pending bookings
if (credential.app?.categories.includes(AppCategories.payment)) {
if (stripeAppData.price) {
const metadata = EventTypeMetaDataSchema.parse(eventType.metadata);
const appSlug = credential.app?.slug;
if (appSlug) {
await prisma.$transaction(async () => {
await prisma.eventType.update({
where: {
@@ -155,11 +152,7 @@ export const deleteCredentialHandler = async ({ ctx, input }: DeleteCredentialOp
...metadata,
apps: {
...metadata?.apps,
stripe: {
...metadata?.apps?.stripe,
enabled: false,
price: 0,
},
[appSlug]: null,
},
},
},