Skip to content

Commit

Permalink
Merge branch 'master' into API-42025-update-v2-poa-schema-to-allow-em…
Browse files Browse the repository at this point in the history
…pty-string-email
  • Loading branch information
rockwellwindsor-va committed Nov 18, 2024
2 parents 60cd4dc + b150d7c commit 65b1d36
Show file tree
Hide file tree
Showing 77 changed files with 1,757 additions and 1,892 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ app/controllers/v1/decision_review_evidences_controller.rb @department-of-vetera
app/controllers/v1/decision_review_notification_callbacks_controller.rb @department-of-veterans-affairs/benefits-decision-reviews-be @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v1/apidocs_controller.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v1/notice_of_disagreements_controller.rb @department-of-veterans-affairs/benefits-decision-reviews-be @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v1/pension_ipf_callbacks_controller.rb @department-of-veterans-affairs/pension-and-burials @department-of-veterans-affairs/backend-review-group
app/controllers/v1/sessions_controller.rb @department-of-veterans-affairs/octo-identity
app/controllers/v1/supplemental_claims_controller.rb @department-of-veterans-affairs/benefits-decision-reviews-be @department-of-veterans-affairs/backend-review-group
app/controllers/v1/supplemental_claims @department-of-veterans-affairs/benefits-decision-reviews-be @department-of-veterans-affairs/backend-review-group
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/be_review_prs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Require backend-review-group approval
on:
pull_request:
types: [opened, reopened, review_requested, synchronize, ready_for_review]
pull_request_review:
types: [submitted]

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ gem 'connect_vbms', git: 'https://github.com/adhocteam/connect_vbms', tag: 'v2.1
gem 'csv'
gem 'date_validator'
gem 'ddtrace'
gem 'dogstatsd-ruby', '5.6.2'
gem 'dogstatsd-ruby', '5.6.3'
gem 'dry-struct'
gem 'dry-types'
gem 'ethon', '>=0.13.0'
Expand Down
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ GEM
thread_safe (~> 0.3, >= 0.3.1)
diff-lcs (1.5.1)
docile (1.4.0)
dogstatsd-ruby (5.6.2)
dogstatsd-ruby (5.6.3)
domain_name (0.6.20240107)
down (5.4.2)
addressable (~> 2.8)
Expand Down Expand Up @@ -898,9 +898,9 @@ GEM
rspec-instrumentation-matcher (0.0.9)
activesupport
rspec-expectations
rspec-its (1.3.1)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-its (2.0.0)
rspec-core (>= 3.13.0)
rspec-expectations (>= 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
Expand Down Expand Up @@ -1162,7 +1162,7 @@ DEPENDENCIES
ddtrace
debts_api!
dhp_connected_devices!
dogstatsd-ruby (= 5.6.2)
dogstatsd-ruby (= 5.6.3)
dry-struct
dry-types
ethon (>= 0.13.0)
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/v0/health_care_applications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ class HealthCareApplicationsController < ApplicationController
before_action(only: :rating_info) { authorize(:hca_disability_rating, :access?) }

def rating_info
if Flipper.enabled?(:hca_disable_bgs_service)
# Return 0 when not calling the actual BGS::Service
render json: HCARatingInfoSerializer.new({ user_percent_of_disability: 0 })
return
end

service = BGS::Service.new(current_user)
disability_rating = service.find_rating_data[:disability_rating_record][:service_connected_combined_degree]

Expand Down
79 changes: 0 additions & 79 deletions app/controllers/v1/pension_ipf_callbacks_controller.rb

This file was deleted.

25 changes: 14 additions & 11 deletions app/controllers/v1/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def authenticate
def user_login(saml_response)
user_session_form = UserSessionForm.new(saml_response)
raise_saml_error(user_session_form) unless user_session_form.valid?
mhv_unverified_validation(user_session_form)

mhv_unverified_validation(user_session_form.user)
create_user_verification(user_session_form.user)
@current_user, @session_object = user_session_form.persist
set_cookies
after_login_actions
Expand All @@ -158,8 +158,18 @@ def user_login(saml_response)
login_stats(:success)
end

def mhv_unverified_validation(user_session_form)
if html_escaped_relay_state['type'] == 'mhv_verified' && user_session_form.user.loa[:current] < LOA::THREE
def create_user_verification(user)
user_verifier_object = OpenStruct.new({ sign_in: user.identity.sign_in,
mhv_correlation_id: user.mhv_correlation_id,
idme_uuid: user.idme_uuid,
edipi: user.identity.edipi,
logingov_uuid: user.logingov_uuid,
icn: user.icn })
Login::UserVerifier.new(user_verifier_object).perform
end

def mhv_unverified_validation(user)
if html_escaped_relay_state['type'] == 'mhv_verified' && user.loa[:current] < LOA::THREE
mhv_unverified_error = SAML::UserAttributeError::ERRORS[:mhv_unverified_blocked]
Rails.logger.warn("SessionsController version:v1 #{mhv_unverified_error[:message]}")
raise SAML::UserAttributeError.new(message: mhv_unverified_error[:message],
Expand Down Expand Up @@ -398,13 +408,6 @@ def set_cookies
end

def after_login_actions
user_verifier_object = OpenStruct.new({ sign_in: @current_user.identity.sign_in,
mhv_correlation_id: @current_user.mhv_correlation_id,
idme_uuid: @current_user.idme_uuid,
edipi: @current_user.identity.edipi,
logingov_uuid: @current_user.logingov_uuid,
icn: @current_user.icn })
Login::UserVerifier.new(user_verifier_object).perform
Login::AfterLoginActions.new(@current_user).perform
log_persisted_session_and_warnings
end
Expand Down
20 changes: 0 additions & 20 deletions app/models/pension_ipf_notification.rb

This file was deleted.

28 changes: 28 additions & 0 deletions app/models/saved_claim/dependency_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,34 @@ def to_pdf(form_id: FORM)
PdfFill::Filler.fill_form(self, nil, { created_at: })
end

# this failure email is not the ideal way to handle the Notification Emails as
# part of the ZSF work, but with the initial timeline it handles the email as intended.
# Future work will be integrating into the Va Notify common lib:
# https://github.com/department-of-veterans-affairs/vets-api/blob/master/lib/va_notify/notification_email.rb

def send_failure_email(encrypted_user_struct = nil)
user_struct = encrypted_user_struct.present? ? JSON.parse(KmsEncrypted::Box.new.decrypt(encrypted_user_struct)) : nil # rubocop:disable Layout/LineLength
email = parsed_form.dig('dependents_application', 'veteran_contact_information', 'email_address') ||
user_struct.try(:va_profile_email)
template_ids = []
template_ids << Settings.vanotify.services.va_gov.template_id.form21_686c_action_needed_email if submittable_686?
template_ids << Settings.vanotify.services.va_gov.template_id.form21_674_action_needed_email if submittable_674?

template_ids.each do |template_id|
if email.present?
VANotify::EmailJob.perform_async(
email,
template_id,
{
'first_name' => parsed_form.dig('veteran_information', 'full_name', 'first')&.upcase.presence,
'date_submitted' => Time.zone.today.strftime('%B %d, %Y'),
'confirmation_number' => confirmation_number
}
)
end
end
end

private

def partitioned_686_674_params
Expand Down
19 changes: 19 additions & 0 deletions app/models/saved_claim/education_career_counseling_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,23 @@ def process_attachments!
def business_line
'EDU'
end

# this failure email is not the ideal way to handle the Notification Emails as
# part of the ZSF work, but with the initial timeline it handles the email as intended.
# Future work will be integrating into the Va Notify common lib:
# https://github.com/department-of-veterans-affairs/vets-api/blob/master/lib/va_notify/notification_email.rb
def send_failure_email
email = parsed_form.dig('claimantInformation', 'emailAddress')
if email.present?
VANotify::EmailJob.perform_async(
email,
Settings.vanotify.services.va_gov.template_id.form27_8832_action_needed_email,
{
'first_name' => parsed_form.dig('claimantInformation', 'fullName', 'first')&.upcase.presence,
'date_submitted' => Time.zone.today.strftime('%B %d, %Y'),
'confirmation_number' => confirmation_number
}
)
end
end
end
20 changes: 20 additions & 0 deletions app/models/saved_claim/veteran_readiness_employment_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,26 @@ def business_line
'VRE'
end

# this failure email is not the ideal way to handle the Notification Emails as
# part of the ZSF work, but with the initial timeline it handles the email as intended.
# Future work will be integrating into the Va Notify common lib:
# https://github.com/department-of-veterans-affairs/vets-api/blob/master/lib/va_notify/notification_email.rb
def send_failure_email(encrypted_user = nil)
user = encrypted_user.present? ? OpenStruct.new(JSON.parse(KmsEncrypted::Box.new.decrypt(encrypted_user))) : nil
email = parsed_form['email'] || user.try(:va_profile_email)
if email.present?
VANotify::EmailJob.perform_async(
email,
Settings.vanotify.services.va_gov.template_id.form1900_action_needed_email,
{
'first_name' => parsed_form.dig('veteranInformation', 'fullName', 'first'),
'date_submitted' => Time.zone.today.strftime('%B %d, %Y'),
'confirmation_number' => confirmation_number
}
)
end
end

private

def check_office_location
Expand Down
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ def needs_accepted_terms_of_use
end

def user_verification
@user_verification ||= get_user_verification
@user_verification ||= UserVerification.find_by(id: user_verification_id)
end

def user_account
@user_account ||= user_verification&.user_account
end

def user_verification_id
@user_verification_id ||= user_verification&.id
@user_verification_id ||= get_user_verification&.id
end

def user_account_uuid
Expand Down
25 changes: 22 additions & 3 deletions app/services/medical_copays/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,32 @@ def initialize
# @return [Faraday::Response]
#
def post(path, params)
with_monitoring do
connection.post(path) do |req|
req.body = Oj.dump(params)
if Flipper.enabled?(:debts_copay_logging) && !Rails.env.development?
with_monitoring_and_error_handling do
connection.post(path) do |req|
req.body = Oj.dump(params)
end
end
else
with_monitoring do
connection.post(path) do |req|
req.body = Oj.dump(params)
end
end
end
end

def with_monitoring_and_error_handling(&)
with_monitoring(2, &)
rescue => e
handle_error(e)
end

def handle_error(error)
Rails.logger.error("MedicalCopays::Request error: #{error.message}")
raise error
end

##
# Make a HTTP GET call to the VBS service in order to obtain copays or PDFs by id
#
Expand Down
4 changes: 4 additions & 0 deletions app/services/medical_copays/vbs/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ def get_pdf_statement_by_id(statement_id)
end

def get_copay_response
if Flipper.enabled?(:debts_copay_logging)
Rails.logger.info("MedicalCopays::VBS::Service#get_copay_response request data: #{@user.uuid}")
end

request.post("#{settings.base_path}/GetStatementsByEDIPIAndVistaAccountNumber", request_data.to_hash)
end

Expand Down
Loading

0 comments on commit 65b1d36

Please sign in to comment.