-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: conditional verification routing #2598
Conversation
eda1257
to
a4b1611
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work as usual! I'll open a tech debt card for the one comment left
let needsVerification = false; | ||
//🔍 Check if registration purpose is OBPS Regulated Operation, Opt-in or New Entrants | ||
const registrationPurpose = (await getRegistrationPurpose(version_id)) | ||
?.registration_purpose; | ||
needsVerification = regulatedOperationPurposes.includes( | ||
registrationPurpose as RegistrationPurposes, | ||
); | ||
if ( | ||
needsVerification === false && | ||
registrationPurpose === RegistrationPurposes.REPORTING_OPERATION | ||
) { | ||
//🔍 Check if the registration purpose is Reporting Operation AND their total emissions attributable for reporting threshold is = or > than 25,000 TCo2 | ||
const attributableEmissionThreshold = 25000000; | ||
const attributableEmissions = await getAttributableEmissions(version_id); | ||
needsVerification = attributableEmissions >= attributableEmissionThreshold; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do this on the API side, otherwise technically an individual with malicious intentions might bypass it on the client.
It'll also allow us to refactor that logic for other forms under a service of some sorts, like a follow up to bcgov/cas-reporting#445 and bcgov/cas-reporting#450
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For your consideration, as this component is a server side component; perhaps, it is as safe from mal-intent as an API ?
e9c2d59
to
58d4f6c
Compare
chore: prettier chore: update vitest chore: prettier chore: prettier chore: prettier chore: prettier
58d4f6c
to
195b0b3
Compare
chore: prettier chore: prettier chore: cleanup chore: bump next.js to pass yarn audit chore: cleanup
8ff64d5
to
95a8c6f
Compare
Addresses 405
🚀 Impact:
Compliance Summary Form
buttonContinue
to eitherVerification
orFinal Review
🔬 Local Testing:
Test Registration Purpose = "OBPS Regulated Operation"
Operation 3
, click buttonStart
Expected Results
Review operation information
page displaysRegistration Purpose
= "OBPS Regulated Operation"Expected Results
Compliance Summary
page displaysContinue
Continue
Expected Results
Verification
page displays becauseOperation 3/Registration Purpose
= "OBPS Regulated Operation"Test Registration Purpose = "Electricity Import Operation"
Operation 14
, click buttonStart
Expected Results
Review operation information
page displaysRegistration Purpose
= "Electricity Import Operation"Continue
Expected Results
Final
page displays becauseOperation 14/Registration Purpose
!= ("OBPS Regulated Operation":"Opt-in"; "New Entrant") AND total emissions attributable < 25,000 TCo2Optional: Test Registration Purpose = "Electricity Import Operation" total emissions attributable >=25,000 TCo2
Operation 14
, click buttonStart
Continue
Expected Results
Verification
page displays becauseOperation 14/ total emissions attributable >=25,000 TCo2