Skip to content

Innovation/internal penalty calculator - #4863

Draft
dleard wants to merge 14 commits into
developfrom
innovation/internal-penalty-calculator
Draft

Innovation/internal penalty calculator#4863
dleard wants to merge 14 commits into
developfrom
innovation/internal-penalty-calculator

Conversation

@dleard

@dleard dleard commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

POC for a compliance penalty calculator from Innovation Week.

Pcalc

Notes for actual implementation:

  • Needs a design for the FE calculator page (design)
  • Before the useEffect() that populates the initial data fires, the page shows NaN for penalty amount, could be cleaned up to look smoother
  • The API route is designed to handle both types of penalties, but the FE is currently hardcoded to just return the 'Automatic Overdue' penalty type.
    • Should decide how to display the two penalty types (an obligation could have both types of penalties). (design)
    • Ideas I had were to conditionally create different tabs in the task list for each penalty if that penalty type is accruing. Or to add an input on the single page to allow the user to switch between the penalty types and return something like "No Late Submission Penalty is accruing" if there is no penalty of that type
  • Needs proper types
  • Tests

Setup to see this running locally:

Run the following SQL in the db to quickly create an overdue obligation in our dev data:

delete from erc.compliance_earned_credit where compliance_report_version_id=2;

update erc.compliance_report_version set status='Obligation not met' where id=2;

insert into erc.compliance_obligation(obligation_id, fee_amount_dollars, fee_date, penalty_status, compliance_report_version_id)
values(1, 1000000.00, '2025-11-01', 'ACCRUING', 2);

insert into erc.elicensing_client_operator(client_object_id, client_guid, operator_id)
values(1, '4242ea9d-b917-4129-93c2-db00b7451050', '4242ea9d-b917-4129-93c2-db00b7451051');

insert into erc.elicensing_invoice(invoice_number, due_date, outstanding_balance, invoice_fee_balance, invoice_interest_balance, is_void, last_refreshed, elicensing_client_operator_id)
values ('inv001', '2025-11-30', 1020000.00, 1000000.00, 20000.00, false, now(), 1);

insert into erc.elicensing_line_item(object_id, guid, fee_date, base_amount, line_item_type, elicensing_invoice_id)
values(1, '4242ea9d-b917-4129-93c2-db00b7451052', '2025-11-01', 1000000.00, 'fee', 1);

update erc.compliance_obligation set invoice_number='inv001';
update erc.compliance_obligation set elicensing_invoice_id=1;
  • Either make sure to keep updating elicensing_invoice.last_refreshed to now() if you're going to be looking at it for longer than 15 minutes or increase the time limit in the refresh service before trying to update from elicensing (the invoice created in the dev data does not exist there and will cause an error)
  • As an internal user go to the compliance summaries page and view the obligation. A 'calculate penalty' tab should be on task list
  • The page should load all the data for if the penalty was paid today. Changing the date in the date picker will show the penalty if the penalty was paid on the date chosen.

@zoeyli-46

Copy link
Copy Markdown

Here is the link to the FE design wireframe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants