Skip to content

#6220 - Block disbursement on withdraw/transfer#6332

Open
weskubo-cgi wants to merge 8 commits into
mainfrom
feature/#6220-withdraw-block-disbursement
Open

#6220 - Block disbursement on withdraw/transfer#6332
weskubo-cgi wants to merge 8 commits into
mainfrom
feature/#6220-withdraw-block-disbursement

Conversation

@weskubo-cgi

@weskubo-cgi weskubo-cgi commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • When an active withdraw, non punitive withdraw, or a transfer of student exists on an application create an additional ecert blocker to prevent further funds from going out.
  • Queue consumers updates, E2E updates.

Scenario

Withdraw scholastic standing event added to Application awaiting disbursement:
image

Execute full-time-e-cert-integration - Blocked:

[2026-07-06 21:25:55]--INFO: Log details
[2026-07-06 21:25:31]--INFO: Processing application number 2025000007, disbursement id 59 scheduled for 2026-07-06.
[2026-07-06 21:25:55]----INFO: Log details
[2026-07-06 21:25:31]----INFO: Executing e-Cert calculation steps.
[2026-07-06 21:25:31]----INFO: Executing step 1 out of 10.
[2026-07-06 21:25:31]----INFO: Executing full-time disbursement validations.
[2026-07-06 21:25:35]----INFO: Student has an active withdraw, non punitive withdraw, or a transfer on their application.
[2026-07-06 21:25:35]----INFO: There are no active restriction bypasses.
[2026-07-06 21:25:35]----INFO: Checking if blocked disbursement notifications should be generated.
[2026-07-06 21:25:55]------INFO: Log details
[2026-07-06 21:25:35]------INFO: Ministry Blocked Disbursement notification created for disbursement ID 59.
[2026-07-06 21:25:55]------INFO: Log details
[2026-07-06 21:25:35]------INFO: Student Blocked Disbursement notification created for disbursement ID 59.
[2026-07-06 21:25:35]--INFO: The step determined that the calculation should be interrupted. This disbursement will not be part of the next e-Cert generation.

Withdrawal reversed:
image

Execute full-time-e-cert-integration - Ready to send:

[2026-07-06 21:54:50]--INFO: Log details
[2026-07-06 21:54:28]--INFO: Processing application number 2025000007, disbursement id 60 scheduled for 2026-07-06.
[2026-07-06 21:54:50]----INFO: Log details
[2026-07-06 21:54:28]----INFO: Executing e-Cert calculation steps.
[2026-07-06 21:54:28]----INFO: Executing step 1 out of 10.
[2026-07-06 21:54:28]----INFO: Executing full-time disbursement validations.
[2026-07-06 21:54:28]----INFO: There are no active restriction bypasses.
[2026-07-06 21:54:28]----INFO: Executing step 2 out of 10.
[2026-07-06 21:54:28]----INFO: Checking if overaward adjustments are needed.
[2026-07-06 21:54:28]----INFO: No overaward adjustments are needed.
[2026-07-06 21:54:28]----INFO: Executing step 3 out of 10.
[2026-07-06 21:54:28]----INFO: Calculating effective values.
[2026-07-06 21:54:28]----INFO: Calculation executed for CSLF.
[2026-07-06 21:54:28]----INFO: Calculation executed for BCSL.
[2026-07-06 21:54:28]----INFO: Calculation executed for BCAG.
...
[2026-07-06 21:54:29]----INFO: All calculations were saved and disbursement was set to 'Ready to send'.
...

E2E Tests

Scheduler queue processor for full-time-e-cert-integration

image

Scheduler queue processor for part-time-e-cert-integration

image

@weskubo-cgi weskubo-cgi self-assigned this Jul 6, 2026
Copilot AI review requested due to automatic review settings July 6, 2026 18:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an additional e-Cert validation blocker to prevent disbursements from being sent when an application has an active withdrawal or school transfer scholastic standing event (i.e., not reversed), and extends queue-consumer e2e coverage for both full-time and part-time e-Cert generation.

Changes:

  • Added a new e-Cert failed validation (ActiveWithdrawOrTransfer) and validation step logic to block eligible disbursements.
  • Extended the eligible disbursement query to detect active withdraw/transfer scholastic standing events and surface that as a boolean on EligibleECertDisbursement.
  • Added e2e scenarios (full-time + part-time) asserting blocking behavior, non-blocking change types, and reversed-event behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sources/packages/backend/libs/integrations/src/services/disbursement-schedule/e-cert-processing-steps/validate-disbursement-base.ts Adds the new withdraw/transfer validation blocker and logs when triggered.
sources/packages/backend/libs/integrations/src/services/disbursement-schedule/e-cert-generation.service.ts Joins scholastic standings to flag applications with active withdraw/transfer events during eligibility selection.
sources/packages/backend/libs/integrations/src/services/disbursement-schedule/e-cert-calculation/e-cert-pre-validation-service.ts Minor DI style change (readonly dataSource).
sources/packages/backend/libs/integrations/src/services/disbursement-schedule/disbursement-schedule.models.ts Extends EligibleECertDisbursement and ECertFailedValidation with the new blocker.
sources/packages/backend/apps/queue-consumers/src/processors/schedulers/esdc-integration/ecert-integration/tests/ecert-part-time-process-integration.scheduler.e2e-spec.ts Adds part-time e2e coverage for withdraw/transfer blocking and non-blocking cases.
sources/packages/backend/apps/queue-consumers/src/processors/schedulers/esdc-integration/ecert-integration/tests/ecert-full-time-process-integration.scheduler.e2e-spec.ts Adds full-time e2e coverage for withdraw/transfer blocking and non-blocking cases.

@weskubo-cgi weskubo-cgi marked this pull request as draft July 6, 2026 21:02
"institutionRestriction.location",
"institutionRestrictionLocation",
)
.leftJoin(

@weskubo-cgi weskubo-cgi Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at using a subquery to return hasActiveWithdrawOrTransfer directly but between query complexity and having to use getRawAndEntities/mapFromRawAndEntities/custom result type, I felt the join was simpler.

@weskubo-cgi weskubo-cgi marked this pull request as ready for review July 7, 2026 15:27
@dheepak-aot

Copy link
Copy Markdown
Collaborator

Great work @weskubo-cgi. Please take a look at the comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

// Assert log messages for the blocked disbursement.
expect(
mockedJob.containLogMessages([
`Student has an active scholastic standing change with change type '${StudentScholasticStandingChangeType.SchoolTransfer}' or '${StudentScholasticStandingChangeType.StudentWithdrewFromProgram}'.`,

@dheepak-aot dheepak-aot Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Student application? Missed to mention the application in my suggestion.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should be consistent.

@dheepak-aot dheepak-aot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes. Looks good 👍

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 20.04% ( 4769 / 23800 )
Methods: 9.77% ( 282 / 2887 )
Lines: 24.38% ( 4077 / 16724 )
Branches: 9.79% ( 410 / 4189 )

@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 47.49% ( 2753 / 5797 )
Methods: 37.27% ( 287 / 770 )
Lines: 54.3% ( 2082 / 3834 )
Branches: 32.19% ( 384 / 1193 )

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 81.25% ( 9646 / 11872 )
Methods: 80.8% ( 1250 / 1547 )
Lines: 84.53% ( 7219 / 8540 )
Branches: 65.94% ( 1177 / 1785 )

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

E2E SIMS API Coverage Report

Totals Coverage
Statements: 69.13% ( 14348 / 20756 )
Methods: 66.65% ( 1705 / 2558 )
Lines: 72.26% ( 10268 / 14210 )
Branches: 59.55% ( 2375 / 3988 )

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants