IO-256 Exporting of payments
This commit is contained in:
@@ -80,7 +80,7 @@ exports.default = async (req, res) => {
|
||||
);
|
||||
}
|
||||
}
|
||||
console.log(insCoCustomerTier);
|
||||
|
||||
if (isThreeTier || twoTierPref === "name") {
|
||||
//Insert the name/owner and account for whether the source should be the ins co in 3 tier..
|
||||
ownerCustomerTier = await QueryOwner(oauthClient, req, job);
|
||||
@@ -95,7 +95,7 @@ exports.default = async (req, res) => {
|
||||
);
|
||||
}
|
||||
}
|
||||
console.log(ownerCustomerTier);
|
||||
|
||||
//Query for the Job or Create it.
|
||||
jobTier = await QueryJob(oauthClient, req, job);
|
||||
|
||||
@@ -110,14 +110,15 @@ exports.default = async (req, res) => {
|
||||
ownerCustomerTier
|
||||
);
|
||||
}
|
||||
console.log(jobTier);
|
||||
|
||||
await InsertInvoice(oauthClient, req, job, bodyshop, jobTier);
|
||||
ret.push({ jobid: job.id, success: true });
|
||||
} catch (error) {
|
||||
ret.push({
|
||||
jobid: job.id,
|
||||
success: false,
|
||||
errorMessage: error.message,
|
||||
errorMessage:
|
||||
(error && error.authResponse.body) || JSON.stringify(error),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -160,6 +161,7 @@ async function QueryInsuranceCo(oauthClient, req, job) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
exports.QueryInsuranceCo = QueryInsuranceCo;
|
||||
async function InsertInsuranceCo(oauthClient, req, job, bodyshop) {
|
||||
const insCo = bodyshop.md_ins_cos.find((i) => i.name === job.ins_co_nm);
|
||||
|
||||
@@ -192,7 +194,7 @@ async function InsertInsuranceCo(oauthClient, req, job, bodyshop) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
exports.InsertInsuranceCo = InsertInsuranceCo;
|
||||
async function QueryOwner(oauthClient, req, job) {
|
||||
const ownerName = generateOwnerTier(job, true, null);
|
||||
const result = await oauthClient.makeApiCall({
|
||||
@@ -214,7 +216,7 @@ async function QueryOwner(oauthClient, req, job) {
|
||||
result.json.QueryResponse.Customer[0]
|
||||
);
|
||||
}
|
||||
|
||||
exports.QueryOwner = QueryOwner;
|
||||
async function InsertOwner(oauthClient, req, job, isThreeTier, parentTierRef) {
|
||||
const ownerName = generateOwnerTier(job, true, null);
|
||||
const Customer = {
|
||||
@@ -254,7 +256,7 @@ async function InsertOwner(oauthClient, req, job, isThreeTier, parentTierRef) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
exports.InsertOwner = InsertOwner;
|
||||
async function QueryJob(oauthClient, req, job) {
|
||||
const result = await oauthClient.makeApiCall({
|
||||
url: urlBuilder(
|
||||
@@ -275,7 +277,7 @@ async function QueryJob(oauthClient, req, job) {
|
||||
result.json.QueryResponse.Customer[0]
|
||||
);
|
||||
}
|
||||
|
||||
exports.QueryJob = QueryJob;
|
||||
async function InsertJob(oauthClient, req, job, isThreeTier, parentTierRef) {
|
||||
const Customer = {
|
||||
DisplayName: job.ro_number,
|
||||
@@ -314,7 +316,7 @@ async function InsertJob(oauthClient, req, job, isThreeTier, parentTierRef) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
exports.InsertJob = InsertJob;
|
||||
async function QueryMetaData(oauthClient, req) {
|
||||
const items = await oauthClient.makeApiCall({
|
||||
url: urlBuilder(req.cookies.qbo_realmId, "query", `select * From Item`),
|
||||
|
||||
Reference in New Issue
Block a user