Class: SavedClaim::EducationBenefits::VA5490
- Inherits:
-
SavedClaim::EducationBenefits
- Object
- ActiveRecord::Base
- ApplicationRecord
- SavedClaim
- SavedClaim::EducationBenefits
- SavedClaim::EducationBenefits::VA5490
- Defined in:
- app/models/saved_claim/education_benefits/va_5490.rb
Instance Method Summary collapse
Methods inherited from SavedClaim::EducationBenefits
#add_education_benefits_claim, form_class, #in_progress_form_id, #regional_office_address
Methods inherited from SavedClaim
add_form_and_validation, #after_create_metrics, #after_destroy_metrics, #attachment_keys, #business_line, #confirmation_number, #email, #form_is_string, #form_matches_schema, #form_must_be_string, #insert_notification, #open_struct_form, #parsed_form, #process_attachments!, #submitted_at, #to_pdf, #update_form, #va_notification?, #validate_form, #validate_schema
Methods inherited from ApplicationRecord
descendants_using_encryption, lockbox_options, #timestamp_attributes_for_update_in_model, #valid?
Instance Method Details
#after_submit(_user) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'app/models/saved_claim/education_benefits/va_5490.rb', line 6 def after_submit(_user) parsed_form_data ||= JSON.parse(form) email = parsed_form_data['email'] return if email.blank? return unless Flipper.enabled?(:form5490_confirmation_email) send_confirmation_email(parsed_form_data, email) end |
#send_confirmation_email(parsed_form_data, email) ⇒ Object (private)
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/models/saved_claim/education_benefits/va_5490.rb', line 18 def send_confirmation_email(parsed_form_data, email) benefit = case parsed_form_data['benefit'] when 'chapter35' 'Survivors’ and Dependents’ Educational Assistance (DEA, Chapter 35)' when 'chapter33' 'The Fry Scholarship (Chapter 33)' end VANotify::EmailJob.perform_async( email, Settings.vanotify.services.va_gov.template_id.form5490_confirmation_email, { 'first_name' => parsed_form.dig('relativeFullName', 'first')&.upcase.presence, 'benefit' => benefit, 'date_submitted' => Time.zone.today.strftime('%B %d, %Y'), 'confirmation_number' => education_benefits_claim.confirmation_number, 'regional_office_address' => regional_office_address } ) end |