Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions apps/api-edge/src/routes/merchants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,19 @@ router.post('/register', async (c) => {
if (!name || typeof name !== 'string' || name.length < 3 || name.length > 255) {
return c.json({ error: 'Validation error', details: ['"name" must be 3–255 characters'] }, 400);
}
if (!email || !isValidEmail(email)) {
if (typeof email !== 'string' || !isValidEmail(email)) {
return c.json({ error: 'Validation error', details: ['"email" must be a valid email'] }, 400);
}
// walletAddress is optional — only validate format when provided
if (walletAddress !== undefined && walletAddress !== null &&
(typeof walletAddress !== 'string' || walletAddress.length < 32 || walletAddress.length > 44)) {
return c.json({ error: 'Validation error', details: ['"walletAddress" must be a valid Solana address (32–44 characters)'] }, 400);
}
if (webhookUrl !== undefined && webhookUrl !== null && !isValidUri(webhookUrl as string)) {
if (
webhookUrl !== undefined &&
webhookUrl !== null &&
(typeof webhookUrl !== 'string' || !isValidUri(webhookUrl))
) {
return c.json({ error: 'Validation error', details: ['"webhookUrl" must be a valid URI'] }, 400);
}

Expand Down