Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Vedal987 committed Jun 10, 2024
2 parents 1da6115 + f05d505 commit ddec0d8
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion ebs/src/modules/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,41 @@ app.post("/public/prepurchase", async (req, res) => {
// TODO: Verify parameters
// TODO: text input moderation

const token = await registerPrepurchase(idCart);
let token: string;
try {
token = await registerPrepurchase(idCart);
} catch (e: any) {
logToDiscord({
transactionToken: null,
userIdInsecure: idCart.userId,
important: true,
fields: [
{
header: "Failed to register prepurchase",
content: {
cart: idCart,
error: e,
}
},
]
}).then();
res.status(500).send("Failed to register prepurchase");
return;
}

logToDiscord({
transactionToken: token,
userIdInsecure: idCart.userId,
important: false,
fields: [
{
header: "Created prepurchase",
content: {
cart: idCart,
}
}
]
}).then();

res.status(200).send(token);
});
Expand Down

0 comments on commit ddec0d8

Please sign in to comment.