feat: SMTP integration, dynamic app_settings for email, and email verification enforcement for tier upgrades
This commit is contained in:
@@ -1,10 +1,29 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const { Pool } = require('pg');
|
||||
|
||||
const pgPool = new Pool({
|
||||
host: process.env.PGHOST || 'postgres',
|
||||
port: process.env.PGPORT || 5432,
|
||||
user: process.env.PGUSER || 'postgres',
|
||||
password: process.env.PGPASSWORD || 'postgres',
|
||||
database: process.env.PGDATABASE || 'ckqr',
|
||||
});
|
||||
|
||||
// Placeholder for ICICI Payment Gateway initialization
|
||||
router.post('/icici/initiate', async (req, res) => {
|
||||
const { amount, plan, userId } = req.body;
|
||||
|
||||
try {
|
||||
const userCheck = await pgPool.query('SELECT is_email_verified FROM users WHERE id = $1', [userId]);
|
||||
if (userCheck.rows.length > 0 && !userCheck.rows[0].is_email_verified) {
|
||||
return res.status(400).json({ error: 'Please verify your email address before upgrading your plan.' });
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error checking verification status', err);
|
||||
return res.status(500).json({ error: 'Server error' });
|
||||
}
|
||||
|
||||
// Here you would construct the ICICI request payload, compute checksums, etc.
|
||||
// and return the URL or parameters for the frontend to redirect the user to ICICI.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user