Skip to content

Commit

Permalink
Merge pull request #249 from Eastern-Research-Group/feature/inject-sa…
Browse files Browse the repository at this point in the history
…m-gov-contacts-in-payment-request-form-submissions

Feature/inject sam gov contacts in payment request form submissions
  • Loading branch information
courtneymyers authored Nov 4, 2022
2 parents 0af2a51 + 146d86a commit 717156a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/client/src/routes/allRebates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ function PaymentRequestSubmission({ rebate }: { rebate: Rebate }) {
email,
title,
name,
entity,
comboKey: application.bap.comboKey,
rebateId: application.bap.rebateId, // CSB Rebate ID (6 digits)
reviewItemId: application.bap.reviewItemId, // CSB Rebate ID w/ form/version ID (9 digits)
Expand Down
15 changes: 15 additions & 0 deletions app/client/src/routes/paymentRequestForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ function PaymentRequestFormContent({ email }: { email: string }) {
// TODO: do we need to account for when ENTITY_STATUS__c does not equal "Active" (e.g. its expired)?
if (!entity) return null;

const {
UNIQUE_ENTITY_ID__c,
ENTITY_EFT_INDICATOR__c,
ELEC_BUS_POC_EMAIL__c,
ALT_ELEC_BUS_POC_EMAIL__c,
GOVT_BUS_POC_EMAIL__c,
ALT_GOVT_BUS_POC_EMAIL__c,
} = entity;

const { title, name } = getUserInfo(email, entity);

return (
Expand Down Expand Up @@ -206,6 +215,12 @@ function PaymentRequestFormContent({ email }: { email: string }) {
hidden_current_user_email: email,
hidden_current_user_title: title,
hidden_current_user_name: name,
hidden_sam_uei: UNIQUE_ENTITY_ID__c,
hidden_sam_efti: ENTITY_EFT_INDICATOR__c || "0000",
hidden_sam_elec_bus_poc_email: ELEC_BUS_POC_EMAIL__c,
hidden_sam_alt_elec_bus_poc_email: ALT_ELEC_BUS_POC_EMAIL__c,
hidden_sam_govt_bus_poc_email: GOVT_BUS_POC_EMAIL__c,
hidden_sam_alt_govt_bus_poc_email: ALT_GOVT_BUS_POC_EMAIL__c,
...pendingSubmissionData,
},
}}
Expand Down
16 changes: 16 additions & 0 deletions app/server/app/routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ router.post(
email,
title,
name,
entity,
comboKey,
rebateId,
reviewItemId,
Expand All @@ -446,6 +447,15 @@ router.post(
return res.status(401).json({ message: "Unauthorized" });
}

const {
UNIQUE_ENTITY_ID__c,
ENTITY_EFT_INDICATOR__c,
ELEC_BUS_POC_EMAIL__c,
ALT_ELEC_BUS_POC_EMAIL__c,
GOVT_BUS_POC_EMAIL__c,
ALT_GOVT_BUS_POC_EMAIL__c,
} = entity;

return getApplicationSubmission(req, reviewItemId)
.then(({ formsTableRecordQuery, busTableRecordsQuery }) => {
const {
Expand Down Expand Up @@ -479,6 +489,12 @@ router.post(
hidden_current_user_email: email,
hidden_current_user_title: title,
hidden_current_user_name: name,
hidden_sam_uei: UNIQUE_ENTITY_ID__c,
hidden_sam_efti: ENTITY_EFT_INDICATOR__c || "0000",
hidden_sam_elec_bus_poc_email: ELEC_BUS_POC_EMAIL__c,
hidden_sam_alt_elec_bus_poc_email: ALT_ELEC_BUS_POC_EMAIL__c,
hidden_sam_govt_bus_poc_email: GOVT_BUS_POC_EMAIL__c,
hidden_sam_alt_govt_bus_poc_email: ALT_GOVT_BUS_POC_EMAIL__c,
hidden_bap_rebate_id: rebateId,
hidden_bap_district_id: CSB_NCES_ID__c,
hidden_bap_primary_name: Primary_Applicant__r?.Name,
Expand Down
15 changes: 15 additions & 0 deletions app/server/app/routes/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const {
axiosFormio,
formioProjectUrl,
formioApplicationFormPath,
formioPaymentRequestFormPath,
} = require("../config/formio");
const { getSamEntities } = require("../utilities/bap");

Expand All @@ -28,6 +29,7 @@ router.get("/bap-sam-data", (req, res) => {
});

const applicationFormApiPath = `${formioProjectUrl}/${formioApplicationFormPath}`;
const paymentRequestFormApiPath = `${formioProjectUrl}/${formioPaymentRequestFormPath}`;

router.get("/formio-application-schema", (req, res) => {
axiosFormio(req)
Expand All @@ -42,4 +44,17 @@ router.get("/formio-application-schema", (req, res) => {
});
});

router.get("/formio-payment-request-schema", (req, res) => {
axiosFormio(req)
.get(paymentRequestFormApiPath)
.then((axiosRes) => axiosRes.data)
.then((schema) => {
// Verify that schema has type of form and a title exists (confirming formio returned a valid schema)
return res.json({ status: schema.type === "form" && !!schema.title });
})
.catch(() => {
return res.json({ status: false });
});
});

module.exports = router;

0 comments on commit 717156a

Please sign in to comment.