@@ -138,7 +138,7 @@ export function App({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentEula && !currentUser.eulaIsAccepted) {
|
if (!isPartsEntry && currentEula && !currentUser.eulaIsAccepted) {
|
||||||
return <Eula />;
|
return <Eula />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ const Eula = ({ currentEula, currentUser, acceptEula }) => {
|
|||||||
const useremail = currentUser.email;
|
const useremail = currentUser.email;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { ...otherFormValues } = formValues;
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
const { accepted_terms, ...otherFormValues } = formValues;
|
||||||
|
|
||||||
// Trim the values of the fields before submitting
|
// Trim the values of the fields before submitting
|
||||||
const trimmedFormValues = Object.entries(otherFormValues).reduce((acc, [key, value]) => {
|
const trimmedFormValues = Object.entries(otherFormValues).reduce((acc, [key, value]) => {
|
||||||
|
|||||||
@@ -117,44 +117,46 @@ async function processShopData(shopsToProcess, start, end, skipUpload, ignoreDat
|
|||||||
imexshopid: shopid,
|
imexshopid: shopid,
|
||||||
json: JSON.stringify(carfaxObject, null, 2),
|
json: JSON.stringify(carfaxObject, null, 2),
|
||||||
filename: `${shopid}_${moment().format("DDMMYYYY_HHMMss")}.json`,
|
filename: `${shopid}_${moment().format("DDMMYYYY_HHMMss")}.json`,
|
||||||
count: carfaxObject.job.length
|
count: carfaxObject?.job?.length || 0
|
||||||
};
|
};
|
||||||
|
|
||||||
if (skipUpload) {
|
if (skipUpload) {
|
||||||
fs.writeFileSync(`./logs/${jsonObj.filename}`, jsonObj.json);
|
fs.writeFileSync(`./logs/${jsonObj.filename}`, jsonObj.json);
|
||||||
uploadToS3(jsonObj, S3_BUCKET_NAME);
|
uploadToS3(jsonObj, S3_BUCKET_NAME);
|
||||||
} else {
|
} else {
|
||||||
await uploadViaSFTP(jsonObj);
|
if (jsonObj.count > 0) {
|
||||||
|
await uploadViaSFTP(jsonObj);
|
||||||
|
|
||||||
await sendMexicoBillingEmail({
|
await sendMexicoBillingEmail({
|
||||||
subject: `${shopid.replace(/_/g, "").toUpperCase()}_MexicoRPS_${moment().format("MMDDYYYY")} ROs ${jsonObj.count} Error ${errorCode(jsonObj)}`,
|
subject: `${shopid.replace(/_/g, "").toUpperCase()}_MexicoRPS_${moment().format("MMDDYYYY")} ROs ${jsonObj.count} Error ${errorCode(jsonObj)}`,
|
||||||
text: `Errors:\n${JSON.stringify(
|
text: `Errors:\n${JSON.stringify(
|
||||||
erroredJobs.map((ej) => ({
|
erroredJobs.map((ej) => ({
|
||||||
jobid: ej.job?.id,
|
jobid: ej.job?.id,
|
||||||
error: ej.error
|
error: ej.error
|
||||||
})),
|
})),
|
||||||
null,
|
null,
|
||||||
2
|
2
|
||||||
)}\n\nUploaded:\n${JSON.stringify(
|
)}\n\nUploaded:\n${JSON.stringify(
|
||||||
{
|
{
|
||||||
bodyshopid: bodyshop.id,
|
bodyshopid: bodyshop.id,
|
||||||
imexshopid: shopid,
|
imexshopid: shopid,
|
||||||
count: jsonObj.count,
|
count: jsonObj.count,
|
||||||
filename: jsonObj.filename,
|
filename: jsonObj.filename,
|
||||||
result: jsonObj.result
|
result: jsonObj.result
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
2
|
2
|
||||||
)}`
|
)}`
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allJSONResults.push({
|
jsonObj.count > 0 && allJSONResults.push({
|
||||||
bodyshopid: bodyshop.id,
|
bodyshopid: bodyshop.id,
|
||||||
imexshopid: shopid,
|
imexshopid: shopid,
|
||||||
count: jsonObj.count,
|
count: jsonObj.count,
|
||||||
filename: jsonObj.filename,
|
filename: jsonObj.filename,
|
||||||
result: jsonObj.result
|
result: jsonObj.result || "No Upload Result Available"
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.log("CARFAX-RPS-end-shop-extract", "DEBUG", "api", bodyshop.id, {
|
logger.log("CARFAX-RPS-end-shop-extract", "DEBUG", "api", bodyshop.id, {
|
||||||
|
|||||||
@@ -160,40 +160,42 @@ async function processShopData(shopsToProcess, start, end, skipUpload, ignoreDat
|
|||||||
imexshopid: shopid,
|
imexshopid: shopid,
|
||||||
json: JSON.stringify(carfaxObject, null, 2),
|
json: JSON.stringify(carfaxObject, null, 2),
|
||||||
filename: `${shopid}_${moment().format("DDMMYYYY_HHMMss")}.json`,
|
filename: `${shopid}_${moment().format("DDMMYYYY_HHMMss")}.json`,
|
||||||
count: carfaxObject.job.length
|
count: carfaxObject?.job?.length || 0
|
||||||
};
|
};
|
||||||
|
|
||||||
if (skipUpload) {
|
if (skipUpload) {
|
||||||
fs.writeFileSync(`./logs/${jsonObj.filename}`, jsonObj.json);
|
fs.writeFileSync(`./logs/${jsonObj.filename}`, jsonObj.json);
|
||||||
uploadToS3(jsonObj);
|
uploadToS3(jsonObj);
|
||||||
} else {
|
} else {
|
||||||
await uploadViaSFTP(jsonObj);
|
if (jsonObj.count > 0) {
|
||||||
|
await uploadViaSFTP(jsonObj);
|
||||||
|
|
||||||
await sendMexicoBillingEmail({
|
await sendMexicoBillingEmail({
|
||||||
subject: `${shopid.replace(/_/g, "").toUpperCase()}_Mexico${InstanceManager({
|
subject: `${shopid.replace(/_/g, "").toUpperCase()}_Mexico${InstanceManager({
|
||||||
imex: "IO",
|
imex: "IO",
|
||||||
rome: "RO"
|
rome: "RO"
|
||||||
})}_${moment().format("MMDDYYYY")} ROs ${jsonObj.count} Error ${errorCode(jsonObj)}`,
|
})}_${moment().format("MMDDYYYY")} ROs ${jsonObj.count} Error ${errorCode(jsonObj)}`,
|
||||||
text: `Errors:\n${JSON.stringify(
|
text: `Errors:\n${JSON.stringify(
|
||||||
erroredJobs.map((ej) => ({
|
erroredJobs.map((ej) => ({
|
||||||
ro_number: ej.job?.ro_number,
|
ro_number: ej.job?.ro_number,
|
||||||
jobid: ej.job?.id,
|
jobid: ej.job?.id,
|
||||||
error: ej.error
|
error: ej.error
|
||||||
})),
|
})),
|
||||||
null,
|
null,
|
||||||
2
|
2
|
||||||
)}\n\nUploaded:\n${JSON.stringify(
|
)}\n\nUploaded:\n${JSON.stringify(
|
||||||
{
|
{
|
||||||
bodyshopid: bodyshop.id,
|
bodyshopid: bodyshop.id,
|
||||||
imexshopid: shopid,
|
imexshopid: shopid,
|
||||||
count: jsonObj.count,
|
count: jsonObj.count,
|
||||||
filename: jsonObj.filename,
|
filename: jsonObj.filename,
|
||||||
result: jsonObj.result
|
result: jsonObj.result
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
2
|
2
|
||||||
)}`
|
)}`
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allJSONResults.push({
|
allJSONResults.push({
|
||||||
@@ -201,7 +203,7 @@ async function processShopData(shopsToProcess, start, end, skipUpload, ignoreDat
|
|||||||
imexshopid: shopid,
|
imexshopid: shopid,
|
||||||
count: jsonObj.count,
|
count: jsonObj.count,
|
||||||
filename: jsonObj.filename,
|
filename: jsonObj.filename,
|
||||||
result: jsonObj.result
|
result: jsonObj.result || "No Upload Result Available"
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.log("CARFAX-end-shop-extract", "DEBUG", "api", bodyshop.id, {
|
logger.log("CARFAX-end-shop-extract", "DEBUG", "api", bodyshop.id, {
|
||||||
|
|||||||
Reference in New Issue
Block a user