From 0f8fc932e7bc91bec8da943a5ea7fa3efc1435d4 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Fri, 29 Nov 2024 13:11:26 +0000 Subject: [PATCH] new appeals change involvment to appellant --- actions/index.js | 8 +++- components/myportal/topthree.js | 2 +- .../file/createappealcompletemessage_api.js | 43 ++++++++++++++++--- 3 files changed, 43 insertions(+), 10 deletions(-) diff --git a/actions/index.js b/actions/index.js index f971f0ff..bdca89ae 100644 --- a/actions/index.js +++ b/actions/index.js @@ -1081,8 +1081,11 @@ export const updatePassword = (contactId, newpassword) => { }); }; -export const updateAccount = async (contactId, updateBody) => { - var queryUrl = "/api/endpoint/updateaccount_api?contactId=" + contactId; +export const updateAccount = async (contactId, updateBody, ssr) => { + var queryUrl = + (ssr ? BASE_URL : "") + + "/api/endpoint/updateaccount_api?contactId=" + + contactId; var data = updateBody; var config = { method: "post", @@ -1095,6 +1098,7 @@ export const updateAccount = async (contactId, updateBody) => { }) .catch((error) => { //console.log("this error:", error); + consoleLogger(error); }); }; diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index 9747fa94..d4dee548 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -283,7 +283,7 @@ const TopThree = (props) => {
{showTopThreeArr[key].pinswg_appellantagent != 846040000 && ( - {t("myportal:raised-by-label")} + {t("myportal:raised-by-label")}: )} {showTopThreeArr[key].pinswg_appellantagent != 846040000 && diff --git a/pages/api/file/createappealcompletemessage_api.js b/pages/api/file/createappealcompletemessage_api.js index 148edf71..a0c80a35 100644 --- a/pages/api/file/createappealcompletemessage_api.js +++ b/pages/api/file/createappealcompletemessage_api.js @@ -1,9 +1,10 @@ -import { hashAPIPath } from "../../../actions"; +import { hashAPIPath, updateAccount } from "../../../actions"; import { createCaseCompleteMessage, getProgressBlobs, downloadProgressFile, createBlob, + getCaseBlob, } from "../../../actions/azurestorage"; import nextConnect from "next-connect"; @@ -34,9 +35,15 @@ ApiProxy.get(async (req, res) => { return downloadProgressFile(containerName, data.path, tempCaseRef); }); - Object.assign(blobProgress, { - "appealComplete": tempCaseRef, - }); + const caseObj = await downloadProgressFile( + containerName, + tempCaseRef + "/" + tempCaseRef + "_case.json", + tempCaseRef + ); + + // Object.assign(blobProgress, { + // "appealComplete": tempCaseRef, + // }); delete blobProgress["pinswg_name"]; @@ -44,9 +51,31 @@ ApiProxy.get(async (req, res) => { await createBlob(JSON.stringify(blobProgress), containerName, tempCaseRef) .then(() => { - createCaseCompleteMessage(containerName, tempCaseRef); - return res.status(200).json({ - status: "success", + //update case.json with lpa ref and description + Object.assign(caseObj, { + "pinswg_lpareference": + blobProgress.pinswg_lpaapplicationreference, + "description": blobProgress.pinswg_developmentdescription, + }); + + //send update case.json and then create queue message + getCaseBlob(containerName, tempCaseRef, caseObj).then(() => { + let contactId = caseObj["customerid_contact@odata.bind"]; + contactId = contactId.match(/\(([^)]+)\)/); + updateAccount( + contactId[1], + { + "pinswg_typeofinvolvement": 846040001, + }, + true + ).then((data) => { + console.log("uopdated account: ", data); + }); + + createCaseCompleteMessage(containerName, tempCaseRef); + return res.status(200).json({ + status: "success", + }); }); }) .catch((error) => {