Skip to content
Snippets Groups Projects
Commit 8c1a9fad authored by Aaron Dötsch's avatar Aaron Dötsch
Browse files

Implement voucher use notifications

parent bd17e55a
No related branches found
No related tags found
No related merge requests found
......@@ -89,6 +89,12 @@ export async function POST(event) {
}else if(!result){
return new Response(JSON.stringify({message: "Invalid voucher"}), {headers: {'content-type': 'application/json', 'status': 400}});
}
// no need to await
sendNotification(event.locals.user, NotificationType.USE_VOUCHER, {
voucher: {code: result.code, value: result.amount},
balanceBefore: event.locals.user.balance,
balanceAfter: event.locals.user.balance + result.amount
});
return new Response(JSON.stringify(result), {headers: {'content-type': 'application/json', 'status': 200}});
}catch(e){
console.error(e);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment