From d11f180f762e77ade0bfa586739dcf2165c424c0 Mon Sep 17 00:00:00 2001 From: Ankit Kumar Chakraborty Date: Wed, 25 Feb 2026 20:07:24 +0530 Subject: [PATCH] Feature/item289 (#306) * update branch * handled changes in order model * Refining Checkout and Order Logic * non mandate email * bug fix --- controllers/agreementController.js | 6 +++--- controllers/cashfree.js | 15 +++++++++------ controllers/verificationController.js | 4 ++-- invoicing-service/index.js | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/controllers/agreementController.js b/controllers/agreementController.js index 373a0c3a..420d8d11 100644 --- a/controllers/agreementController.js +++ b/controllers/agreementController.js @@ -11,7 +11,7 @@ const sqs = new SQSClient({ }, }); -const queueUrl = process.env.IS_DEV ? "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-test-queue": +const queueUrl = process.env.IS_DEV === "true" ? "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-test-queue" : "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-queue"; const generateAndStoreAgreement = async (req, res) => { @@ -39,7 +39,7 @@ const generateAndStoreAgreement = async (req, res) => { } const sqsMessage = { - type: 2, + type: 2, serviceType, vendorId, agreementData, @@ -94,7 +94,7 @@ const addVendorAgreement = async (req, res) => { "../models/reduxModels/djArtist.js" ); const DJArtist = (await import("../models/djArtist.js")).default; - const { ReduxMakeupArtistModel } = await import("../models/reduxModels/makeupArtist.js"); + const { ReduxMakeupArtistModel } = await import("../models/reduxModels/makeupArtist.js"); const { ReduxPhotographerVideographerModel } = await import( "../models/reduxModels/photographerVideographer.js" ); diff --git a/controllers/cashfree.js b/controllers/cashfree.js index ba7510ff..e83ca9cf 100644 --- a/controllers/cashfree.js +++ b/controllers/cashfree.js @@ -174,8 +174,9 @@ export const verifyPayment = async (req, res) => { await sqs.send( new SendMessageCommand({ - QueueUrl: - "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-queue", + QueueUrl: process.env.INVOICE_QUEUE_URL || (process.env.IS_DEV === "true" + ? "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-test-queue" + : "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-queue"), MessageBody: JSON.stringify(sqsMessage), }), ); @@ -212,8 +213,9 @@ async function sendInvoice(req, res) { await sqs.send( new SendMessageCommand({ - QueueUrl: - "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-queue", + QueueUrl: process.env.INVOICE_QUEUE_URL || (process.env.IS_DEV === "true" + ? "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-test-queue" + : "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-queue"), MessageBody: JSON.stringify(sqsMessage), }), ); @@ -1184,8 +1186,9 @@ const verifyCustomerPayment = async (req, res) => { }; await sqs.send(new SendMessageCommand({ - QueueUrl: process.env.INVOICE_QUEUE_URL - || "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-queue", + QueueUrl: process.env.INVOICE_QUEUE_URL || (process.env.IS_DEV === "true" + ? "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-test-queue" + : "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-queue"), MessageBody: JSON.stringify(sqsMessage), })); diff --git a/controllers/verificationController.js b/controllers/verificationController.js index e6e648ff..87307b2f 100644 --- a/controllers/verificationController.js +++ b/controllers/verificationController.js @@ -14,7 +14,7 @@ const verifyGSTIN = async (req, res) => { const gstinPattern = /^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[A-Z0-9]{1}[Z]{1}[A-Z0-9]{1}$/; - if (!process.env.IS_DEV && !gstinPattern.test(gstIn)) { + if (process.env.IS_DEV !== "true" && !gstinPattern.test(gstIn)) { return res.status(400).json({ message: "Invalid GSTIN format" }); } try { @@ -135,7 +135,7 @@ const verifyPAN = async (req, res) => { // PAN card format validation - 5 letters followed by 4 numbers and then 1 letter const panPattern = /^[A-Z]{5}[0-9]{4}[A-Z]{1}$/; - if (!process.env.IS_DEV && !panPattern.test(panNo)) { + if (process.env.IS_DEV !== "true" && !panPattern.test(panNo)) { return res.status(400).json({ message: "Invalid PAN card format" }); } diff --git a/invoicing-service/index.js b/invoicing-service/index.js index fdacbc03..ba4751d0 100644 --- a/invoicing-service/index.js +++ b/invoicing-service/index.js @@ -13,7 +13,7 @@ const sqs = new SQSClient({ }, }); -const queueUrl = process.env.IS_DEV ? "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-test-queue" : +const queueUrl = process.env.IS_DEV === "true" ? "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-test-queue" : "https://sqs.ap-south-1.amazonaws.com/637423195802/invoice-queue"; console.log("Starting SQS polling service for invoicing and agreements...");