release/2025-04-25 - Add logging around handleInvoiceBasePayment paymentResponse, toned logs down. fixed issue in paymentResponseResults

This commit is contained in:
Dave Richer
2025-04-25 11:54:36 -04:00
parent 468b42abd2
commit d61b89a1e5
2 changed files with 49 additions and 30 deletions

View File

@@ -107,18 +107,25 @@ const handleInvoiceBasedPayment = async (values, logger, logMeta, res) => {
}); });
// Create payment response record // Create payment response record
const responseResults = await gqlClient.request(INSERT_PAYMENT_RESPONSE, { const responseResults = await gqlClient
paymentResponse: { .request(INSERT_PAYMENT_RESPONSE, {
amount: values.total, paymentResponse: {
bodyshopid: bodyshop.id, amount: values.total,
paymentid: paymentResult.id, bodyshopid: bodyshop.id,
jobid: job.id, paymentid: paymentResult.insert_payments.returning[0].id,
declinereason: "Approved", jobid: job.id,
ext_paymentid: values.paymentid, declinereason: "Approved",
successful: true, ext_paymentid: values.paymentid,
response: values successful: true,
} response: values
}); }
})
.catch((err) => {
logger.log("intellipay-postback-invoice-response-error", "ERROR", "api", null, {
err,
...logMeta
});
});
logger.log("intellipay-postback-invoice-response-success", "DEBUG", "api", null, { logger.log("intellipay-postback-invoice-response-success", "DEBUG", "api", null, {
responseResults, responseResults,

View File

@@ -63,7 +63,9 @@ const scenarioParser = async (req, jobIdField) => {
} }
if (!jobId) { if (!jobId) {
logger.log(`No jobId found using path "${jobIdField}", skipping notification parsing`, "info", "notifications"); if (process?.env?.NODE_ENV === "development") {
logger.log(`No jobId found using path "${jobIdField}", skipping notification parsing`, "info", "notifications");
}
return; return;
} }
@@ -88,7 +90,9 @@ const scenarioParser = async (req, jobIdField) => {
// Exit early if no job watchers are found for this job // Exit early if no job watchers are found for this job
if (isEmpty(jobWatchers)) { if (isEmpty(jobWatchers)) {
logger.log(`No watchers found for jobId "${jobId}", skipping notification parsing`, "info", "notifications"); if (process?.env?.NODE_ENV === "development") {
logger.log(`No watchers found for jobId "${jobId}", skipping notification parsing`, "info", "notifications");
}
return; return;
} }
@@ -130,11 +134,13 @@ const scenarioParser = async (req, jobIdField) => {
// Exit early if no matching scenarios are identified // Exit early if no matching scenarios are identified
if (isEmpty(matchingScenarios)) { if (isEmpty(matchingScenarios)) {
logger.log( if (process?.env?.NODE_ENV === "development") {
`No matching scenarios found for jobId "${jobId}", skipping notification dispatch`, logger.log(
"info", `No matching scenarios found for jobId "${jobId}", skipping notification dispatch`,
"notifications" "info",
); "notifications"
);
}
return; return;
} }
@@ -157,11 +163,13 @@ const scenarioParser = async (req, jobIdField) => {
// Exit early if no notification associations are found // Exit early if no notification associations are found
if (isEmpty(associationsData?.associations)) { if (isEmpty(associationsData?.associations)) {
logger.log( if (process?.env?.NODE_ENV === "development") {
`No notification associations found for jobId "${jobId}", skipping notification dispatch`, logger.log(
"info", `No notification associations found for jobId "${jobId}", skipping notification dispatch`,
"notifications" "info",
); "notifications"
);
}
return; return;
} }
@@ -196,11 +204,13 @@ const scenarioParser = async (req, jobIdField) => {
// Exit early if no scenarios have eligible watchers after filtering // Exit early if no scenarios have eligible watchers after filtering
if (isEmpty(finalScenarioData?.matchingScenarios)) { if (isEmpty(finalScenarioData?.matchingScenarios)) {
logger.log( if (process?.env?.NODE_ENV === "development") {
`No eligible watchers after filtering for jobId "${jobId}", skipping notification dispatch`, logger.log(
"info", `No eligible watchers after filtering for jobId "${jobId}", skipping notification dispatch`,
"notifications" "info",
); "notifications"
);
}
return; return;
} }
@@ -259,7 +269,9 @@ const scenarioParser = async (req, jobIdField) => {
} }
if (isEmpty(scenariosToDispatch)) { if (isEmpty(scenariosToDispatch)) {
logger.log(`No scenarios to dispatch for jobId "${jobId}" after building`, "info", "notifications"); if (process?.env?.NODE_ENV === "development") {
logger.log(`No scenarios to dispatch for jobId "${jobId}" after building`, "info", "notifications");
}
return; return;
} }