Skip to content

Commit

Permalink
Merge branch 'master' into hh-78731-create-org-rep-tables
Browse files Browse the repository at this point in the history
  • Loading branch information
holdenhinkle committed Apr 8, 2024
2 parents 3e9e00a + ad95440 commit 29e6991
Show file tree
Hide file tree
Showing 57 changed files with 2,163 additions and 897 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ app/models/rate_limited_search.rb @department-of-veterans-affairs/va-api-enginee
app/models/saml_request_tracker.rb @department-of-veterans-affairs/octo-identity
app/models/saved_claim.rb @department-of-veterans-affairs/Benefits-Team-1 @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/session.rb @department-of-veterans-affairs/octo-identity
app/models/saved_claim/burial.rb @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/pensions @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/saved_claim/pension.rb @department-of-veterans-affairs/pensions @department-of-veterans-affairs/backend-review-group
app/models/saved_claim/veteran_readiness_employment_claim.rb @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/sign_in @department-of-veterans-affairs/octo-identity
Expand Down
7 changes: 3 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ GIT

GIT
remote: https://github.com/department-of-veterans-affairs/vets-json-schema
revision: 7892dc348677325cc57712ff4a12d6a78f024315
revision: 0277d5bcddf48894d22b45f3618bca33e82a8ca4
branch: master
specs:
vets_json_schema (21.5.5)
vets_json_schema (22.0.1)
multi_json (~> 1.0)
script_utils (= 0.0.4)

Expand Down Expand Up @@ -890,7 +890,7 @@ GEM
rswag-ui (2.13.0)
actionpack (>= 3.1, < 7.2)
railties (>= 3.1, < 7.2)
rubocop (1.62.1)
rubocop (1.63.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand Down Expand Up @@ -1283,4 +1283,3 @@ RUBY VERSION

BUNDLED WITH
2.4.9

2 changes: 1 addition & 1 deletion app/models/saved_claim/burial.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def regional_office
end

def attachment_keys
%i[transportationReceipts deathCertificate].freeze
%i[transportationReceipts deathCertificate militarySeparationDocuments additionalEvidence].freeze
end

def email
Expand Down
2 changes: 2 additions & 0 deletions app/policies/mhv_messaging_policy.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'sm/client'

MHVMessagingPolicy = Struct.new(:user, :mhv_messaging) do
def access?
return false unless user.mhv_correlation_id
Expand Down
7 changes: 6 additions & 1 deletion app/services/users/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def initialize(user)
#
def authorizations
@list << BackendServices::RX if user.authorize :mhv_prescriptions, :access?
@list << BackendServices::MESSAGING if user.authorize :legacy_mhv_messaging, :access?
@list << BackendServices::MESSAGING if user.authorize messaging_service, :access?
@list << BackendServices::MEDICAL_RECORDS if user.authorize :mhv_medical_records, :access?
@list << BackendServices::HEALTH_RECORDS if user.authorize :mhv_health_records, :access?
@list << BackendServices::EVSS_CLAIMS if user.authorize :evss, :access?
Expand All @@ -30,6 +30,7 @@ def authorizations
@list << BackendServices::ID_CARD if user.can_access_id_card?
@list << BackendServices::IDENTITY_PROOFED if user.loa3?
@list << BackendServices::VET360 if user.can_access_vet360?

@list
end

Expand All @@ -44,5 +45,9 @@ def auth_free_services
BackendServices::FORM_PREFILL
]
end

def messaging_service
Flipper.enabled?(:mhv_sm_session_policy, user) ? :mhv_messaging : :legacy_mhv_messaging
end
end
end
8 changes: 6 additions & 2 deletions app/sidekiq/lighthouse/submit_benefits_intake_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ def generate_metadata
'veteranFirstName' => veteran_full_name['first'],
'veteranLastName' => veteran_full_name['last'],
'fileNumber' => form['vaFileNumber'] || form['veteranSocialSecurityNumber'],
'zipCode' => address['country'] == 'USA' ? address['postalCode'] : FOREIGN_POSTALCODE,
'zipCode' => address['postalCode'],
'source' => "#{@claim.class} va.gov",
'docType' => @claim.form_id,
'businessLine' => @claim.business_line
}

SimpleFormsApiSubmission::MetadataValidator.validate(metadata)
SimpleFormsApiSubmission::MetadataValidator.validate(metadata, zip_code_is_us_based: check_zipcode(address))
end

# rubocop:disable Metrics/MethodLength
Expand Down Expand Up @@ -149,5 +149,9 @@ def cleanup_file_paths
Common::FileHelpers.delete_file_if_exists(@pdf_path) if @pdf_path
@attachment_paths&.each { |p| Common::FileHelpers.delete_file_if_exists(p) }
end

def check_zipcode(address)
address['country'].upcase.in?(%w[USA US])
end
end
end
8 changes: 6 additions & 2 deletions app/swagger/swagger/schemas/contacts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Contacts
key :required, [:data]
property :data, type: :array do
items do
property :id, type: :string, example: 'dbbf9a58-41e5-40c0-bdb5-fc1407aa1f05'
property :id, type: :string
property :type, type: :string
property :attributes do
key :$ref, :Contact
Expand All @@ -21,7 +21,11 @@ class Contacts

swagger_schema :Contact do
key :required, %i[contact_type given_name family_name primary_phone]
property :contact_type, type: :string, enum: VAProfile::Models::AssociatedPerson::CONTACT_TYPES
property(
:contact_type,
type: :string,
enum: VAProfile::Models::AssociatedPerson::PERSONAL_HEALTH_CARE_CONTACT_TYPES
)
property :given_name, type: %i[string null]
property :family_name, type: %i[string null]
property :relationship, type: %i[string null]
Expand Down
4 changes: 4 additions & 0 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,10 @@ features:
actor_type: user
description: Enables/disables Secure Messaging Cerner Transition Pilot environment on VA.gov
enable_in_development: true
mhv_sm_session_policy:
actor_type: user
description: changes secure messaging policy to use sm sessions endpoint for authorization
enable_in_development: true
mhv_medical_records_allow_txt_downloads:
actor_type: user
description: Allows users to download Medical Records data in TXT format
Expand Down
8 changes: 8 additions & 0 deletions lib/lighthouse/benefits_claims/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ def get_claim(id, lighthouse_client_id = nil, lighthouse_rsa_key_path = nil, opt
raise BenefitsClaims::ServiceException.new(e.response), 'Lighthouse Error'
end

def get_power_of_attorney(lighthouse_client_id = nil, lighthouse_rsa_key_path = nil, options = {})
config.get("#{@icn}/power-of-attorney", lighthouse_client_id, lighthouse_rsa_key_path, options).body
rescue Faraday::TimeoutError
raise BenefitsClaims::ServiceException.new({ status: 504 }), 'Lighthouse Error'
rescue Faraday::ClientError, Faraday::ServerError => e
raise BenefitsClaims::ServiceException.new(e.response), 'Lighthouse Error'
end

def submit5103(user, id, options = {})
params = {}
is_dependent = SponsorResolver.dependent?(user)
Expand Down
12 changes: 10 additions & 2 deletions lib/va_profile/models/associated_person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,27 @@ class AssociatedPerson < Base
OTHER_EMERGENCY_CONTACT = 'Other emergency contact'
PRIMARY_NEXT_OF_KIN = 'Primary Next of Kin'
OTHER_NEXT_OF_KIN = 'Other Next of Kin'
DESIGNEE = 'Designee'
POWER_OF_ATTORNEY = 'Power of Attorney'

CONTACT_TYPES = [
PERSONAL_HEALTH_CARE_CONTACT_TYPES = [
EMERGENCY_CONTACT,
OTHER_EMERGENCY_CONTACT,
PRIMARY_NEXT_OF_KIN,
OTHER_NEXT_OF_KIN
].freeze

CONTACT_TYPES = [
*PERSONAL_HEALTH_CARE_CONTACT_TYPES,
DESIGNEE,
POWER_OF_ATTORNEY
].freeze

attribute :contact_type, String
attribute :given_name, Common::TitlecaseString
attribute :middle_name, Common::TitlecaseString
attribute :family_name, Common::TitlecaseString
attribute :relationship, Common::TitlecaseString
attribute :relationship, String
attribute :address_line1, String
attribute :address_line2, String
attribute :address_line3, String
Expand Down
30 changes: 18 additions & 12 deletions lib/va_profile/profile/v3/health_benefit_bio_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,39 @@ module VAProfile
module Profile
module V3
class HealthBenefitBioResponse < VAProfile::Response
attr_reader :body

attribute :contacts, Array[VAProfile::Models::AssociatedPerson]
attribute :messages, Array[VAProfile::Models::Message]
attribute :va_profile_tx_audit_id, String

def initialize(response)
@body = response.body
body = response.body
contacts = body.dig('profile', 'health_benefit', 'associated_persons')
&.select { |p| valid_contact_types.include?(p['contact_type']) }
&.sort_by { |p| valid_contact_types.index(p['contact_type']) }
messages = body['messages']
super(response.status, { contacts:, messages: })
va_profile_tx_audit_id = response.response_headers['vaprofiletxauditid']
super(response.status, { contacts:, messages:, va_profile_tx_audit_id: })
end

def metadata
{ status:, messages: }
def debug_data
{
status:,
message:,
va_profile_tx_audit_id:
}
end

private

def valid_contact_types
[
VAProfile::Models::AssociatedPerson::EMERGENCY_CONTACT,
VAProfile::Models::AssociatedPerson::OTHER_EMERGENCY_CONTACT,
VAProfile::Models::AssociatedPerson::PRIMARY_NEXT_OF_KIN,
VAProfile::Models::AssociatedPerson::OTHER_NEXT_OF_KIN
]
VAProfile::Models::AssociatedPerson::PERSONAL_HEALTH_CARE_CONTACT_TYPES
end

def message
m = messages&.first
return '' unless m

"#{m.code} #{m.key} #{m.text}"
end
end
end
Expand Down
6 changes: 4 additions & 2 deletions lib/va_profile/profile/v3/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ def initialize(user)
def get_health_benefit_bio
oid = MPI::Constants::VA_ROOT_OID
path = "#{oid}/#{ERB::Util.url_encode(icn_with_aaid)}"
response = perform(:post, path, { bios: [{ bioPath: 'healthBenefit' }] })
VAProfile::Profile::V3::HealthBenefitBioResponse.new(response)
service_response = perform(:post, path, { bios: [{ bioPath: 'healthBenefit' }] })
response = VAProfile::Profile::V3::HealthBenefitBioResponse.new(service_response)
Sentry.set_extras(response.debug_data) unless response.ok?
response
end

def get_military_info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,8 @@ def pdf_constructor(form_number)
#
# @return [Hash] All data to be inserted into pdf
def data(power_of_attorney, form_number, rep)
res = power_of_attorney
.form_data.deep_merge({
'veteran' => {
'firstName' => power_of_attorney.auth_headers['va_eauth_firstName'],
'lastName' => power_of_attorney.auth_headers['va_eauth_lastName'],
'ssn' => power_of_attorney.auth_headers['va_eauth_pnid'],
'birthdate' => power_of_attorney.auth_headers['va_eauth_birthdate']
}
})
res = power_of_attorney.form_data
res.deep_merge!(veteran_attributes(power_of_attorney))

signatures = if form_number == '2122A'
individual_signatures(power_of_attorney, rep)
Expand All @@ -65,10 +58,24 @@ def data(power_of_attorney, form_number, rep)
'firstName' => rep.first_name,
'lastName' => rep.last_name
} })

res.deep_merge!(organization_name(power_of_attorney)) if form_number == '2122'

res.merge!({ 'text_signatures' => signatures })
res
end

def veteran_attributes(power_of_attorney)
{
'veteran' => {
'firstName' => power_of_attorney.auth_headers['va_eauth_firstName'],
'lastName' => power_of_attorney.auth_headers['va_eauth_lastName'],
'ssn' => power_of_attorney.auth_headers['va_eauth_pnid'],
'birthdate' => power_of_attorney.auth_headers['va_eauth_birthdate']
}
}
end

def organization_signatures(power_of_attorney, rep)
first_name, last_name = veteran_or_claimant_signature(power_of_attorney)
{
Expand All @@ -89,11 +96,11 @@ def organization_signatures(power_of_attorney, rep)
end

def individual_signatures(power_of_attorney, rep)
first_name, last_name = veteran_or_claimant_signature(power_of_attorney)
{
'page2' => [
{
'signature' => "#{power_of_attorney.auth_headers['va_eauth_firstName']} " \
"#{power_of_attorney.auth_headers['va_eauth_lastName']} - signed via api.va.gov",
'signature' => "#{first_name} #{last_name} - signed via api.va.gov",
'x' => 35,
'y' => 306
},
Expand All @@ -117,6 +124,18 @@ def veteran_or_claimant_signature(power_of_attorney)
end
[first_name, last_name]
end

def organization_name(power_of_attorney)
poa_code = power_of_attorney.form_data.dig('serviceOrganization', 'poaCode')

name = ::Veteran::Service::Organization.find_by(poa: poa_code).name

{
'serviceOrganization' => {
'organizationName' => name
}
}
end
end
end
end
20 changes: 0 additions & 20 deletions modules/claims_api/app/swagger/claims_api/v2/dev/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -9198,11 +9198,6 @@
"example": "6789"
}
}
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
}
}
},
Expand Down Expand Up @@ -9832,11 +9827,6 @@
"type": "string",
"example": "A1Q"
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
},
"registrationNumber": {
"description": "Registration Number of representative.",
"type": "string",
Expand Down Expand Up @@ -10526,11 +10516,6 @@
"example": "6789"
}
}
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
}
}
},
Expand Down Expand Up @@ -11151,11 +11136,6 @@
"type": "string",
"example": "A1Q"
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
},
"registrationNumber": {
"description": "Registration Number of representative.",
"type": "string",
Expand Down
Loading

0 comments on commit 29e6991

Please sign in to comment.