diff --git a/controllers/agreementController.js b/controllers/agreementController.js index 373a0c3..420d8d1 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 ba7510f..e83ca9c 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 e6e648f..87307b2 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 fdacbc0..ba4751d 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...");