Actualizar server.js
This commit is contained in:
@@ -4958,7 +4958,7 @@ app.get("/public/portal/:token/protection", async (req, res) => {
|
||||
app.post("/public/portal/:token/protection/subscribe", async (req, res) => {
|
||||
try {
|
||||
const { token } = req.params;
|
||||
const { plan_id, signature, pdf_document } = req.body; // pdf_document trae el archivo firmado real
|
||||
const { plan_id, signature, pdf_document, dni } = req.body;
|
||||
|
||||
// 1. Validar cliente
|
||||
const clientQ = await pool.query("SELECT * FROM clients WHERE portal_token = $1", [token]);
|
||||
@@ -4977,7 +4977,7 @@ app.post("/public/portal/:token/protection/subscribe", async (req, res) => {
|
||||
INSERT INTO protection_subscriptions (company_id, plan_id, client_name, client_dni, client_phone, payment_status, status)
|
||||
VALUES ($1, $2, $3, $4, $5, 'impagado', 'suspendido')
|
||||
RETURNING id
|
||||
`, [ownerId, plan.id, client.full_name, null, client.phone]);
|
||||
`, [ownerId, plan.id, client.full_name, dni || null, client.phone]);
|
||||
|
||||
const subscriptionId = subInsert.rows[0].id;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user