fix paypal minor issues (#11069)

This commit is contained in:
alannnc authored and GitHub committed 2023-09-01 11:03:27 -07:00
1 parent a130804f18
commit 34c2565c70
3 files changed
+4 -8

No files matched your search

-7
View File
@@ -4,7 +4,6 @@ import z from "zod";
import Paypal from "@calcom/app-store/paypal/lib/Paypal";
import { findPaymentCredentials } from "@calcom/features/ee/payments/api/paypal-webhook";
import { IS_PRODUCTION } from "@calcom/lib/constants";
import { getErrorFromUnknown } from "@calcom/lib/errors";
import prisma from "@calcom/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
@@ -78,12 +77,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
return;
} catch (_err) {
const err = getErrorFromUnknown(_err);
res.status(200).send({
message: err.message,
stack: IS_PRODUCTION ? undefined : err.stack,
});
res.redirect(`/booking/${req.query.bookingUid}?paypalPaymentStatus=failed`);
}
}
+1 -1
View File
@@ -173,7 +173,7 @@ class Paypal {
}
} catch (error) {
console.error(error);
return false;
throw error;
}
return false;
}
@@ -260,6 +260,9 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
const { default_currency } = stripeDataSchema.parse(paymentCredential.key);
data.currency = default_currency;
}
if (paymentCredential?.type === "paypal_payment" && input.metadata?.apps?.paypal?.currency) {
data.currency = input.metadata?.apps?.paypal?.currency.toLowerCase();
}
}
const connectedLink = await ctx.prisma.hashedLink.findFirst({