Appellant Notification Module - department-of-veterans-affairs/caseflow GitHub Wiki

Appellant Notification Module

This module is what each of the individual event modules inherit from. Each event module has access to its own methods and the ones defined in this parent module.

The AppellantNotification module contains three custom errors, an error handling method, a method that creates the payload, and a method that sends the payload. Each event module will call AppellantNotification.notify_appellant(appeal, @@template_name) with the appeal that is having an event triggered and the template name coming from the event module. This method internally calls the error handling method first and will return a status of "Success" if there are no errors. If there is no participant_id or no claimant found, it will return "No participant_id" or "No claimant" respectively. In the worst case scenario, when this method is somehow called without being passed an appeal, it will raise a NoAppealError exception and stop execution.

After a status is created and returned as part of a hash that contains all necessary information for creating the payload, an object is instantiated from within #create_payload. This object (VANotifySendMessageTemplate) is what is returned from #create_payload and gets converted to JSON as it is passed to SendNotificationJob where it is eventually pushed to the SQS queue for VA Notify to access.