Skip to content

Commit

Permalink
fix(commerce): only lookup coupon with defined ID
Browse files Browse the repository at this point in the history
  • Loading branch information
jbranchaud authored and kodiakhq[bot] committed Mar 21, 2024
1 parent f14be5c commit 7652584
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/database/src/prisma-api.ts
Expand Up @@ -581,9 +581,11 @@ export function getSdk(
},
})
} else {
const merchantCoupon = await ctx.prisma.merchantCoupon.findFirst({
where: {identifier: stripeCouponId},
})
const merchantCoupon = stripeCouponId
? await ctx.prisma.merchantCoupon.findFirst({
where: {identifier: stripeCouponId},
})
: null

coupon = ctx.prisma.coupon.create({
data: {
Expand Down

0 comments on commit 7652584

Please sign in to comment.