Merged PR 2236: refactor(newappeal): add side-effect facade wrappers (Slice 3)
refactor(newappeal): add side-effect facade wrappers (Slice 3) Related work items: #22583
This commit is contained in:
@@ -12,9 +12,6 @@ import {
|
|||||||
setFormComplete
|
setFormComplete
|
||||||
} from "../../store/appealType/action";
|
} from "../../store/appealType/action";
|
||||||
import BuildCheckRow from "./buildcheckrow";
|
import BuildCheckRow from "./buildcheckrow";
|
||||||
|
|
||||||
import { generateAppealPDF } from "../../actions/services/documentService";
|
|
||||||
import { sendCaseCompleteMessage } from "../../actions/services/portalService";
|
|
||||||
import {
|
import {
|
||||||
bytesToSize,
|
bytesToSize,
|
||||||
getThumbnailIconByExtension,
|
getThumbnailIconByExtension,
|
||||||
@@ -25,6 +22,10 @@ import {
|
|||||||
dedupeFilesListByName,
|
dedupeFilesListByName,
|
||||||
removeDuplicatesByKey
|
removeDuplicatesByKey
|
||||||
} from "../../lib/newappeal/fileListHelpers";
|
} from "../../lib/newappeal/fileListHelpers";
|
||||||
|
import {
|
||||||
|
generateAppealPDFEffect,
|
||||||
|
sendCaseCompleteMessageEffect
|
||||||
|
} from "../../lib/newappeal/journeyEffects";
|
||||||
|
|
||||||
let BuildCheckSection = (props) => {
|
let BuildCheckSection = (props) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -153,7 +154,7 @@ let BuildCheckSection = (props) => {
|
|||||||
|
|
||||||
confirmSections
|
confirmSections
|
||||||
? (setFinaliseAppealProcess(true),
|
? (setFinaliseAppealProcess(true),
|
||||||
await generateAppealPDF(
|
await generateAppealPDFEffect(
|
||||||
pdfObj,
|
pdfObj,
|
||||||
props.props.accountDetails.containerID,
|
props.props.accountDetails.containerID,
|
||||||
props.appealType.caseReference.ticketnumber,
|
props.appealType.caseReference.ticketnumber,
|
||||||
@@ -163,7 +164,7 @@ let BuildCheckSection = (props) => {
|
|||||||
)
|
)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
console.log("have generated pdf:", data);
|
console.log("have generated pdf:", data);
|
||||||
sendCaseCompleteMessage(
|
sendCaseCompleteMessageEffect(
|
||||||
props.props.accountDetails.containerID,
|
props.props.accountDetails.containerID,
|
||||||
props.appealType.caseReference.ticketnumber,
|
props.appealType.caseReference.ticketnumber,
|
||||||
props.props.accountDetails.accountDetails
|
props.props.accountDetails.accountDetails
|
||||||
@@ -209,7 +210,7 @@ let BuildCheckSection = (props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pdfBlob = await generateAppealPDF(
|
const pdfBlob = await generateAppealPDFEffect(
|
||||||
pdfObj,
|
pdfObj,
|
||||||
containerID,
|
containerID,
|
||||||
caseRef,
|
caseRef,
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import { useRouter } from "next/router";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { formValueSelector, reduxForm } from "redux-form";
|
import { formValueSelector, reduxForm } from "redux-form";
|
||||||
import { uploadFiles } from "../../actions/services/documentService";
|
|
||||||
import { sendEmail } from "../../actions/services/notifyService";
|
|
||||||
import { mergeWithExistingFilesList } from "../../lib/newappeal/fileListHelpers";
|
import { mergeWithExistingFilesList } from "../../lib/newappeal/fileListHelpers";
|
||||||
|
import {
|
||||||
|
uploadAppealFilesEffect,
|
||||||
|
sendPartialSaveEmailEffect
|
||||||
|
} from "../../lib/newappeal/journeyEffects";
|
||||||
import {
|
import {
|
||||||
normalizeYesNoBooleans,
|
normalizeYesNoBooleans,
|
||||||
removeNullKeys,
|
removeNullKeys,
|
||||||
@@ -120,7 +122,7 @@ let BuildSection = (props) => {
|
|||||||
// _.includes(key, "pinswg_fileUpload") == true && delete dataObj[key];
|
// _.includes(key, "pinswg_fileUpload") == true && delete dataObj[key];
|
||||||
// }
|
// }
|
||||||
|
|
||||||
await uploadFiles(
|
await uploadAppealFilesEffect(
|
||||||
dataObj,
|
dataObj,
|
||||||
fileListObj,
|
fileListObj,
|
||||||
props.props.accountDetails.containerID,
|
props.props.accountDetails.containerID,
|
||||||
@@ -271,7 +273,7 @@ let BuildSection = (props) => {
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
sendSavedEmail == true &&
|
sendSavedEmail == true &&
|
||||||
sendEmail(
|
sendPartialSaveEmailEffect(
|
||||||
router.locale != "en" ? templateIdCY : templateId,
|
router.locale != "en" ? templateIdCY : templateId,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
personalisation,
|
personalisation,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { formValueSelector } from "redux-form";
|
import { formValueSelector } from "redux-form";
|
||||||
import { sendEmail } from "../../actions/services/notifyService";
|
import { sendCompletionEmailEffect } from "../../lib/newappeal/journeyEffects";
|
||||||
import { normalizeYesNoBooleans } from "../../lib/newappeal/payloadCleanup";
|
import { normalizeYesNoBooleans } from "../../lib/newappeal/payloadCleanup";
|
||||||
import { setCurrentSection } from "../../store/appealType/action";
|
import { setCurrentSection } from "../../store/appealType/action";
|
||||||
import { getFormCollectionByID } from "../utils";
|
import { getFormCollectionByID } from "../utils";
|
||||||
@@ -50,7 +50,12 @@ let CompleteAppeal = (props) => {
|
|||||||
"emailAddress": props.props.accountDetails.loggedinUserEmail,
|
"emailAddress": props.props.accountDetails.loggedinUserEmail,
|
||||||
"linkExpiry": 10 * 60
|
"linkExpiry": 10 * 60
|
||||||
};
|
};
|
||||||
sendEmail(templateId, emailAddress, personalisation, reference);
|
sendCompletionEmailEffect(
|
||||||
|
templateId,
|
||||||
|
emailAddress,
|
||||||
|
personalisation,
|
||||||
|
reference
|
||||||
|
);
|
||||||
|
|
||||||
// sendCaseCompleteMessage(
|
// sendCaseCompleteMessage(
|
||||||
// props.props.accountDetails.containerID,
|
// props.props.accountDetails.containerID,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Base branch for this tracker: `refactor`
|
|||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
Current slice: Slice 3 — Side Effect Facade
|
Current slice: Slice 4 — BuildSection UI Extraction
|
||||||
Status: READY TO START
|
Status: READY TO START
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -41,7 +41,7 @@ Status: COMPLETE
|
|||||||
|
|
||||||
### Slice 3 — Side Effect Facade
|
### Slice 3 — Side Effect Facade
|
||||||
|
|
||||||
Status: NOT STARTED
|
Status: COMPLETE
|
||||||
|
|
||||||
- Wrap existing service calls
|
- Wrap existing service calls
|
||||||
- No logic changes
|
- No logic changes
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import { uploadFiles } from "../../actions/services/documentService";
|
||||||
|
import { sendEmail } from "../../actions/services/notifyService";
|
||||||
|
import { sendCaseCompleteMessage } from "../../actions/services/portalService";
|
||||||
|
import { generateAppealPDF } from "../../actions/services/documentService";
|
||||||
|
|
||||||
|
export const uploadAppealFilesEffect = (
|
||||||
|
dataObj,
|
||||||
|
fileListObj,
|
||||||
|
containerID,
|
||||||
|
caseReference
|
||||||
|
) => {
|
||||||
|
return uploadFiles(dataObj, fileListObj, containerID, caseReference);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const sendPartialSaveEmailEffect = (
|
||||||
|
templateId,
|
||||||
|
emailAddress,
|
||||||
|
personalisation,
|
||||||
|
reference
|
||||||
|
) => {
|
||||||
|
return sendEmail(templateId, emailAddress, personalisation, reference);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const sendCompletionEmailEffect = (
|
||||||
|
templateId,
|
||||||
|
emailAddress,
|
||||||
|
personalisation,
|
||||||
|
reference
|
||||||
|
) => {
|
||||||
|
return sendEmail(templateId, emailAddress, personalisation, reference);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const generateAppealPDFEffect = (
|
||||||
|
pdfObj,
|
||||||
|
containerID,
|
||||||
|
caseReference,
|
||||||
|
appealType,
|
||||||
|
filesList,
|
||||||
|
options
|
||||||
|
) => {
|
||||||
|
return generateAppealPDF(
|
||||||
|
pdfObj,
|
||||||
|
containerID,
|
||||||
|
caseReference,
|
||||||
|
appealType,
|
||||||
|
filesList,
|
||||||
|
options
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const sendCaseCompleteMessageEffect = (
|
||||||
|
containerID,
|
||||||
|
caseReference,
|
||||||
|
typeOfInvolvement
|
||||||
|
) => {
|
||||||
|
return sendCaseCompleteMessage(
|
||||||
|
containerID,
|
||||||
|
caseReference,
|
||||||
|
typeOfInvolvement
|
||||||
|
);
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user