diff --git a/routes/api/trigger-donation/vipps.ts b/routes/api/trigger-donation/vipps.ts index 76b44e4..7d20900 100644 --- a/routes/api/trigger-donation/vipps.ts +++ b/routes/api/trigger-donation/vipps.ts @@ -18,7 +18,12 @@ export const handler = async function (req: Request): Promise { } const existingAgreement = await storage.readVippsAgreement({ id: email }); - if (existingAgreement && existingAgreement.revokedAt === null) { + const hasActiveAgreement = existingAgreement && + existingAgreement.validAt !== null && + existingAgreement.revokedAt === null; + if ( + hasActiveAgreement + ) { console.error("Agreement already exists", email); return Response.redirect(errorPage); }