-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into art/poa-requests/part-3/migrations.2
- Loading branch information
Showing
97 changed files
with
2,325 additions
and
519 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
class CreateExcelFilesMailer < ApplicationMailer | ||
def build(filename) | ||
date = Time.zone.now.strftime('%m/%d/%Y') | ||
file_contents = File.read("tmp/#{filename}") | ||
headers['Content-Disposition'] = "attachment; filename=#{filename}" | ||
|
||
# rubocop:disable Layout/LineLength | ||
recipients = Settings.vsp_environment.eql?('production') ? Settings.edu.production_excel_contents.emails : Settings.edu.staging_excel_contents.emails | ||
subject = Settings.vsp_environment.eql?('production') ? "22-10282 Form CSV file for #{date}" : "Staging CSV file for #{date}" | ||
# rubocop:enable Layout/LineLength | ||
|
||
mail( | ||
to: recipients, | ||
subject: subject, | ||
content_type: 'text/csv', | ||
body: file_contents | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
class ExcelFileEvent < ApplicationRecord | ||
validates :filename, uniqueness: true | ||
|
||
# Look for an existing row with same filename | ||
# and increase retry attempt if wasn't successful from previous attempt | ||
# Otherwise create a new event | ||
def self.build_event(filename) | ||
filename_date = filename.match(/(.+)_/)[1] | ||
event = find_by('filename like ?', "#{filename_date}%") | ||
|
||
if event.present? | ||
event.update(retry_attempt: event.retry_attempt + 1) if event.successful_at.nil? | ||
return event | ||
end | ||
|
||
create(filename: filename) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
class FormProfiles::VA10282 < FormProfile | ||
def metadata | ||
{ | ||
version: 0, | ||
prefill: true, | ||
returnUrl: '/applicant/information' | ||
} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
class SavedClaim::EducationBenefits::VA10282 < SavedClaim::EducationBenefits | ||
add_form_and_validation('22-10282') | ||
|
||
def after_submit(_user) | ||
return unless Flipper.enabled?(:form22_10282_confirmation_email) | ||
|
||
parsed_form_data = JSON.parse(form) | ||
email = parsed_form_data['email'] | ||
return if email.blank? | ||
|
||
send_confirmation_email(parsed_form_data, email) | ||
end | ||
|
||
private | ||
|
||
def send_confirmation_email(parsed_form_data, email) | ||
VANotify::EmailJob.perform_async( | ||
email, | ||
Settings.vanotify.services.va_gov.template_id.form22_10282_confirmation_email, | ||
{ | ||
'first_name' => parsed_form_data.dig('veteranFullName', 'first')&.upcase.presence, | ||
'date_submitted' => Time.zone.today.strftime('%B %d, %Y'), | ||
'confirmation_number' => education_benefits_claim.confirmation_number | ||
} | ||
) | ||
end | ||
end |
2 changes: 1 addition & 1 deletion
2
...ers/central_mail_submission_serializer.rb → .../benefits_intake_submission_serializer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.