fix: booking_paid webhook and added new payment metadata (#11093)
This commit is contained in:
1 parent
f9eb335d0b
commit
b81b221bf5
3 files changed
+81
-4
No files matched your search
@@ -241,13 +241,13 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (input?.price || input.metadata?.apps?.stripe?.price) {
|
||||
data.price = input.price || input.metadata?.apps?.stripe?.price;
|
||||
if (input.metadata?.apps?.stripe?.price) {
|
||||
data.price = input.metadata?.apps?.stripe?.price;
|
||||
const paymentCredential = await ctx.prisma.credential.findFirst({
|
||||
where: {
|
||||
userId: ctx.user.id,
|
||||
type: {
|
||||
contains: "_payment",
|
||||
equals: "stripe_payment",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
@@ -260,6 +260,22 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
|
||||
const { default_currency } = stripeDataSchema.parse(paymentCredential.key);
|
||||
data.currency = default_currency;
|
||||
}
|
||||
}
|
||||
|
||||
if (input.metadata?.apps?.paypal?.price) {
|
||||
data.price = input.metadata?.apps?.paypal?.price;
|
||||
const paymentCredential = await ctx.prisma.credential.findFirst({
|
||||
where: {
|
||||
userId: ctx.user.id,
|
||||
type: {
|
||||
equals: "paypal_payment",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
type: true,
|
||||
key: true,
|
||||
},
|
||||
});
|
||||
if (paymentCredential?.type === "paypal_payment" && input.metadata?.apps?.paypal?.currency) {
|
||||
data.currency = input.metadata?.apps?.paypal?.currency.toLowerCase();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user