-
Notifications
You must be signed in to change notification settings - Fork 14
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
#1777 - Process MSFAA Cancellation and Reactivation Notification #2063
Conversation
}); | ||
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. |
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.
Please change it to "update and hence no notification will be sent"
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.
I believe saved
is right here because here we are saving the notifications only. Sending will happen through the processNotifications
job later.
sources/packages/backend/libs/integrations/src/services/msfaa-number/msfaa-number.service.ts
Outdated
Show resolved
Hide resolved
sources/packages/backend/libs/sims-db/src/entities/notification.model.ts
Outdated
Show resolved
Hide resolved
sources/packages/backend/libs/integrations/src/services/msfaa-number/msfaa-number.service.ts
Outdated
Show resolved
Hide resolved
sources/packages/backend/libs/integrations/src/services/msfaa-number/msfaa-number.service.ts
Outdated
Show resolved
Hide resolved
@@ -6,7 +6,11 @@ import { | |||
OfferingIntensity, | |||
} from "@sims/sims-db"; | |||
import { getISODateOnlyString } from "@sims/utilities"; |
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.
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.
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.
sources/packages/backend/libs/integrations/src/services/msfaa-number/msfaa-number.service.ts
Outdated
Show resolved
Hide resolved
sources/packages/backend/libs/integrations/src/services/msfaa-number/msfaa-number.service.ts
Show resolved
Hide resolved
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.
Nice work, please take a look at the comments.
const notificationToSend = { | ||
userId: notification.userId, | ||
messageType: NotificationMessageType.MSFAACancellationComplete, | ||
messagePayload: { |
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.
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,
};
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.
Good work @sh16011993 . Pls take a look at the comments
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) { |
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.
This condition is not required anymore. If code is past line 224 the updateResult.affected cannot be 0.
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.
Removed it. Thanks.
}, | ||
); | ||
// In case no MSFAA record was cancelled. | ||
if (!updateResult.affected) { |
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.
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.
I have removed it from the consumer to keep it with msfaa-number.service.ts
generating the updateResult
.
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.
Thanks for doing the changes. Good work @sh16011993 👍
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.
Looks good!
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.
Thanks for doing the changes. 👍
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.
LGTM, nice work @sh16011993
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.
Thanks for doing the changes. There is at least one pending comment. Please take a look.
Kudos, SonarCloud Quality Gate passed!
|
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.
Thanks for doing the changes, looks good 👍
As a part of this PR:
Screenshot of the sent notification email:
To be done in a separate PR:
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.