Spaces:
Paused
Paused
Update server.js
Browse files
server.js
CHANGED
|
@@ -431,7 +431,7 @@ app.post('/api/gift-cards', checkOtpAuth, async (req, res) => {
|
|
| 431 |
gc_code,
|
| 432 |
gc_phone,
|
| 433 |
ticket_number,
|
| 434 |
-
|
| 435 |
amount,
|
| 436 |
proof_video_url,
|
| 437 |
card_type, // new field
|
|
@@ -442,10 +442,10 @@ app.post('/api/gift-cards', checkOtpAuth, async (req, res) => {
|
|
| 442 |
// Generate ticket number if not provided
|
| 443 |
const finalTicketNumber = ticket_number || `TKT-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
| 444 |
|
| 445 |
-
if (!ticket_user_name || !gc_code || !gc_phone || !
|
| 446 |
return res.status(400).json({
|
| 447 |
success: false,
|
| 448 |
-
error: 'All fields are required including the video URL, card type, and payment method'
|
| 449 |
});
|
| 450 |
}
|
| 451 |
|
|
@@ -457,13 +457,13 @@ app.post('/api/gift-cards', checkOtpAuth, async (req, res) => {
|
|
| 457 |
gc_code,
|
| 458 |
gc_phone,
|
| 459 |
ticket_number,
|
| 460 |
-
|
| 461 |
amount,
|
| 462 |
proof_video_url,
|
| 463 |
card_type,
|
| 464 |
payment_method
|
| 465 |
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING id`,
|
| 466 |
-
[userId, ticket_user_name, gc_code, gc_phone, finalTicketNumber,
|
| 467 |
);
|
| 468 |
res.json({
|
| 469 |
success: true,
|
|
|
|
| 431 |
gc_code,
|
| 432 |
gc_phone,
|
| 433 |
ticket_number,
|
| 434 |
+
payment_address,
|
| 435 |
amount,
|
| 436 |
proof_video_url,
|
| 437 |
card_type, // new field
|
|
|
|
| 442 |
// Generate ticket number if not provided
|
| 443 |
const finalTicketNumber = ticket_number || `TKT-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
| 444 |
|
| 445 |
+
if (!ticket_user_name || !gc_code || !gc_phone || !payment_address || !amount || !proof_video_url || !card_type || !payment_method) {
|
| 446 |
return res.status(400).json({
|
| 447 |
success: false,
|
| 448 |
+
error: 'All fields are required including the video URL, card type, payment address, and payment method'
|
| 449 |
});
|
| 450 |
}
|
| 451 |
|
|
|
|
| 457 |
gc_code,
|
| 458 |
gc_phone,
|
| 459 |
ticket_number,
|
| 460 |
+
payment_address,
|
| 461 |
amount,
|
| 462 |
proof_video_url,
|
| 463 |
card_type,
|
| 464 |
payment_method
|
| 465 |
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING id`,
|
| 466 |
+
[userId, ticket_user_name, gc_code, gc_phone, finalTicketNumber, payment_address, amount, proof_video_url, card_type, payment_method]
|
| 467 |
);
|
| 468 |
res.json({
|
| 469 |
success: true,
|