Merged in hotfix/IO-3001-null-cieca-scrubbing (pull request #2026)

Hotfix/IO-3001 null cieca scrubbing
This commit is contained in:
Patrick Fic
2024-12-16 16:33:42 +00:00
2 changed files with 56 additions and 49 deletions

View File

@@ -16,7 +16,7 @@ const { sendServerEmail } = require("../email/sendemail");
const DineroFormat = "0,0.00"; const DineroFormat = "0,0.00";
const DateFormat = "MM/DD/YYYY"; const DateFormat = "MM/DD/YYYY";
const kaizenShopsIDs = ["SUMMIT", "STRATHMORE", "SUNRIDGE", "SHAW"]; const kaizenShopsIDs = ["SUMMIT", "STRATHMORE", "SUNRIDGE", "SHAW", "DEERFOOT"];
const ftpSetup = { const ftpSetup = {
host: process.env.KAIZEN_HOST, host: process.env.KAIZEN_HOST,

View File

@@ -49,7 +49,8 @@ exports.totalsSsu = async function (req, res) {
} catch (error) { } catch (error) {
logger.log("job-totals-ssu-USA-error", "ERROR", req?.user?.email, id, { logger.log("job-totals-ssu-USA-error", "ERROR", req?.user?.email, id, {
jobid: id, jobid: id,
error: error.message error: error.message,
stack: error.stack
}); });
res.status(503).send(); res.status(503).send();
} }
@@ -68,6 +69,8 @@ async function TotalsServerSide(req, res) {
ret.additional = CalculateAdditional(job); ret.additional = CalculateAdditional(job);
ret.totals = CalculateTaxesTotals(job, ret); ret.totals = CalculateTaxesTotals(job, ret);
//If we don't have the CIECA_TTL, we can't scrub. E.g. a private estimate.
if (job.cieca_ttl) {
// Sub total scrubbbing. // Sub total scrubbbing.
const emsTotal = const emsTotal =
job.cieca_ttl.data.n_ttl_amt === job.cieca_ttl.data.g_ttl_amt //It looks like sometimes, gross and net are the same, but they shouldn't be. job.cieca_ttl.data.n_ttl_amt === job.cieca_ttl.data.g_ttl_amt //It looks like sometimes, gross and net are the same, but they shouldn't be.
@@ -115,12 +118,14 @@ async function TotalsServerSide(req, res) {
adjAmount: ttlTaxDifference adjAmount: ttlTaxDifference
}); });
} }
}
return ret; return ret;
} catch (error) { } catch (error) {
logger.log("job-totals-ssu-USA-error", "ERROR", req.user?.email, job.id, { logger.log("job-totals-ssu-USA-error", "ERROR", req.user?.email, job.id, {
jobid: job.id, jobid: job.id,
error error: error.message,
stack: error.stack
}); });
res.status(400).send(JSON.stringify(error)); res.status(400).send(JSON.stringify(error));
} }
@@ -150,7 +155,8 @@ async function Totals(req, res) {
} catch (error) { } catch (error) {
logger.log("job-totals-USA-error", "ERROR", req.user.email, job.id, { logger.log("job-totals-USA-error", "ERROR", req.user.email, job.id, {
jobid: job.id, jobid: job.id,
error error: error.message,
stack: error.stack
}); });
res.status(400).send(JSON.stringify(error)); res.status(400).send(JSON.stringify(error));
} }
@@ -1075,7 +1081,8 @@ function CalculateTaxesTotals(job, otherTotals) {
} }
} catch (error) { } catch (error) {
logger.log("job-totals-USA - PFP Calculation Error", "error", null, job.id, { logger.log("job-totals-USA - PFP Calculation Error", "error", null, job.id, {
error: error.message error: error.message,
stack: error.stack
}); });
} }
}); });