Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions controllers/agreementController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -39,7 +39,7 @@ const generateAndStoreAgreement = async (req, res) => {
}

const sqsMessage = {
type: 2,
type: 2,
serviceType,
vendorId,
agreementData,
Expand Down Expand Up @@ -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"
);
Expand Down
15 changes: 9 additions & 6 deletions controllers/cashfree.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}),
);
Expand Down Expand Up @@ -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),
}),
);
Expand Down Expand Up @@ -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),
}));

Expand Down
4 changes: 2 additions & 2 deletions controllers/verificationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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" });
}

Expand Down
2 changes: 1 addition & 1 deletion invoicing-service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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...");
Expand Down