Skip to content
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

#1777 - Process MSFAA Cancellation and Reactivation Notification #2063

Merged

Conversation

sh16011993
Copy link
Collaborator

@sh16011993 sh16011993 commented Jun 29, 2023

As a part of this PR:

  • Created a GC Notify template to send emails when a MSFAA record is cancelled.
  • Updated msfaa-number service to save notifications on MSFAA cancellation.
  • MSFAA reactivation template is not required as the federal government will send them notification.

Screenshot of the sent notification email:

image

To be done in a separate PR:

  • E2E tests for MSFAA Cancellation Notification.

NOTE: There is an update in the Acceptance Criteria (point 2) - MSFAA reactivation template is not required as the federal government will send them notification. Only MSFAA cancellation notification needs to be sent.

@sh16011993 sh16011993 added the DB DB migration involved label Jun 29, 2023
});
const systemUser = await this.systemUsersService.systemUser();
// Only if the msfaa record was successfully cancelled, then save the msfaa cancellation notification.
// This also takes care of the scenario where the msfaa record was already cancelled before in which case the record will not be update and hence no notification will be saved.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please change it to "update and hence no notification will be sent"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe saved is right here because here we are saving the notifications only. Sending will happen through the processNotifications job later.

@@ -6,7 +6,11 @@ import {
OfferingIntensity,
} from "@sims/sims-db";
import { getISODateOnlyString } from "@sims/utilities";
Copy link
Collaborator

@dheepak-aot dheepak-aot Jun 29, 2023

Choose a reason for hiding this comment

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

Are we not suppose to send notification when we cancel an MSFAA during re-activation or reissue?
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would say no @dheepak-aot. In my understanding, we are deactivating some MSFAA(s) in order to activate other. The student will receive an email notification about it.
The point about sending a notification during the cancellation is that it may require an action from the student and it will not be communicated in any other way.

Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot left a comment

Choose a reason for hiding this comment

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

Nice work, please take a look at the comments.

const notificationToSend = {
userId: notification.userId,
messageType: NotificationMessageType.MSFAACancellationComplete,
messagePayload: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please have the message payload typed like this.

const messagePayload: NotificationEmailMessage = {
      email_address: notification.toAddress,
      template_id: templateId,
      personalisation: {
        givenNames: notification.givenNames ?? "",
        lastName: notification.lastName,
      },
    };

    const notificationToSend = {
      userId: notification.userId,
      messageType: NotificationMessageType.MSFAACancellationComplete,
      messagePayload: messagePayload,
    };

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

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

Good work @sh16011993 . Pls take a look at the comments

@dheepak-aot
Copy link
Collaborator

Good job on first notification effort. Please have a look at the comments.

}
// Only if the msfaa record was successfully cancelled, then save the msfaa cancellation notification.
// This also takes care of the scenario where the msfaa record was already cancelled before in which case the record will not be updated and hence no notification will be saved.
if (updateResult.affected) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This condition is not required anymore. If code is past line 224 the updateResult.affected cannot be 0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed it. Thanks.

},
);
// In case no MSFAA record was cancelled.
if (!updateResult.affected) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we are throwing the error on the consumers function, so, do we need it here?
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have removed it from the consumer to keep it with msfaa-number.service.ts generating the updateResult.

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

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

Thanks for doing the changes. Good work @sh16011993 👍

Copy link
Collaborator

@andrepestana-aot andrepestana-aot left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Collaborator

@dheepak-aot dheepak-aot left a comment

Choose a reason for hiding this comment

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

Thanks for doing the changes. 👍

Copy link
Collaborator

@guru-aot guru-aot left a comment

Choose a reason for hiding this comment

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

LGTM, nice work @sh16011993

Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot left a comment

Choose a reason for hiding this comment

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

Thanks for doing the changes. There is at least one pending comment. Please take a look.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 17.89% ( 2127 / 11890 )
Methods: 8.32% ( 126 / 1515 )
Lines: 20.68% ( 1863 / 9008 )
Branches: 10.1% ( 138 / 1367 )

@github-actions
Copy link

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 49.81% ( 267 / 536 )
Methods: 41.56% ( 32 / 77 )
Lines: 55.33% ( 218 / 394 )
Branches: 26.15% ( 17 / 65 )

@github-actions
Copy link

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 71% ( 399 / 562 )
Methods: 61.97% ( 44 / 71 )
Lines: 72.97% ( 351 / 481 )
Branches: 40% ( 4 / 10 )

Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot left a comment

Choose a reason for hiding this comment

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

Thanks for doing the changes, looks good 👍

@github-actions
Copy link

E2E SIMS API Coverage Report

Totals Coverage
Statements: 50.18% ( 3543 / 7061 )
Methods: 45.63% ( 418 / 916 )
Lines: 55.38% ( 2915 / 5264 )
Branches: 23.84% ( 210 / 881 )

@sh16011993 sh16011993 merged commit a4bfb41 into main Jun 30, 2023
@sh16011993 sh16011993 deleted the 1777_process_msfaa_cancellation_and_reactivation_notification branch June 30, 2023 18:47
@sh16011993 sh16011993 temporarily deployed to DEV June 30, 2023 19:31 — with GitHub Actions Inactive
@sh16011993 sh16011993 temporarily deployed to DEV June 30, 2023 19:33 — with GitHub Actions Inactive
@sh16011993 sh16011993 temporarily deployed to DEV June 30, 2023 19:33 — with GitHub Actions Inactive
@sh16011993 sh16011993 temporarily deployed to DEV June 30, 2023 19:33 — with GitHub Actions Inactive
@sh16011993 sh16011993 temporarily deployed to DEV June 30, 2023 19:33 — with GitHub Actions Inactive
@sh16011993 sh16011993 temporarily deployed to DEV June 30, 2023 19:34 — with GitHub Actions Inactive
@sh16011993 sh16011993 temporarily deployed to DEV June 30, 2023 19:34 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DB DB migration involved Integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants