Skip to content

Commit

Permalink
Merge branch 'master' into arf.80297/ARP-OGC-number
Browse files Browse the repository at this point in the history
* master:
  Dash/oren/api 34439/local bgs refactor (#16526)
  Bump rubocop-rspec from 2.29.1 to 2.29.2 (#16622)
  Revert "Removed feature toggle profile_show_proof_of_veteran_status (#16368)" (#16617)
  Simple Forms: Pull pdf upload out into a service (#16615)
  80367 add prefill 10 7959f 1 (#16499)
  arf-80297 add ARP verified_representative migration (#16494)
  • Loading branch information
gabezurita committed May 3, 2024
2 parents 0e7dd7c + 0a481bd commit b3def1c
Show file tree
Hide file tree
Showing 31 changed files with 1,274 additions and 120 deletions.
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ GEM
parallel (1.24.0)
parallel_tests (4.7.1)
parallel
parser (3.3.0.5)
parser (3.3.1.0)
ast (~> 2.4.1)
racc
patience_diff (1.2.0)
Expand Down Expand Up @@ -920,8 +920,8 @@ GEM
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
Expand All @@ -932,12 +932,12 @@ GEM
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.29.1)
rubocop-rspec (2.29.2)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.2)
rubocop-rspec_rails (2.28.3)
rubocop (~> 1.40)
rubocop-thread_safety (0.5.1)
rubocop (>= 0.90.0)
Expand Down
3 changes: 3 additions & 0 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,9 @@ features:
profile_show_quick_submit_notification_setting:
actor_type: user
description: Show/Hide the quick submit section of notification settings in profile
profile_show_proof_of_veteran_status:
actor_type: user
description: Show/Hide the proof of veteran status page and links
profile_use_experimental:
description: Use experimental features for Profile application - Do not remove
enable_in_development: true
Expand Down
27 changes: 6 additions & 21 deletions config/form_profile_mappings/10-7959F-1.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@

veteran:
date_of_birth: [identity_information, date_of_birth]
full_name: [identity_information, full_name]
first: [identity_information, first]
middle: [identity_information, middle]
last: [identity_information, last]
physical_address:
country: [contact_information, country]
street: [contact_information, street]
city: [contact_information, city]
state: [contact_information, state]
postal_code: [contact_information, postal_code]
mailing_address:
country: [contact_information, country]
street: [contact_information, street]
city: [contact_information, city]
state: [contact_information, state]
postal_code: [contact_information, postal_code]
ssn: [identity_information, ssn]
phone_number: [contact_information, us_phone]
email_address: [contact_information, email]
veteranFullName: [identity_information, full_name]
veteranAddress: [contact_information, address]
veteranDateOfBirth: [identity_information, date_of_birth]
veteranSocialSecurityNumber: [identity_information, ssn]
veteranPhoneNumber: [contact_information, us_phone]
veteranEmailAddress: [contact_information, email]
4 changes: 2 additions & 2 deletions modules/claims_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ ssh -L 4447:localhost:4447 {{aws-url}}
ssh -L 4431:localhost:4431 {{aws-url}}

## Testing
### Unit testing BGS service operation wrappers
### Unit testing BGS service action wrappers
If using cassettes, make sure to only make or use ones under [spec/support/vcr_cassettes/claims_api](spec/support/vcr_cassettes/claims_api)
Check out documentation in comments for the spec helper `BGSClientHelpers#use_bgs_cassette`
Check out documentation in comments for the spec helper `BGSClientSpecHelpers#use_bgs_cassette`

## OpenApi/Swagger Doc Generation
This api uses [rswag](https://github.com/rswag/rswag) to build the OpenApi/Swagger docs that are displayed in the [VA|Lighthouse APIs Documentation](https://developer.va.gov/explore/benefits/docs/claims?version=current). To generate/update the docs for this api, navigate to the root directory of `vets-api` and run the following command ::
Expand Down
124 changes: 124 additions & 0 deletions modules/claims_api/app/clients/claims_api/bgs_client.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# frozen_string_literal: true

module ClaimsApi
module BGSClient
class << self
##
# Invokes the given BGS SOAP service action with the given payload and
# returns a result containing a success payload or a fault.
#
# @example Perform a request to BGS at:
# /VDC/ManageRepresentativeService(readPOARequest)
#
# body = <<~EOXML
# <data:SecondaryStatusList>
# <SecondaryStatus>New</SecondaryStatus>
# </data:SecondaryStatusList>
# <data:POACodeList>
# <POACode>012</POACode>
# </data:POACodeList>
# EOXML
#
# definition =
# BGSClient::ServiceAction::Definition::
# ManageRepresentativeService::
# ReadPoaRequest
#
# BGSClient.perform_request(
# definition:,
# body:
# )
#
# @param definition [BGSClient::ServiceAction::Definition] a value object
# that identifies a particular BGS SOAP service action by way of:
# `{.service_path, .service_namespaces, .action_name}`
#
# @param body [String, #to_xml, #to_s] the action payload
#
# @param external_id [BGSClient::ServiceAction::ExternalId] a value object
# that arbitrarily self-identifies ourselves to BGS as its caller by:
# `{.external_uid, .external_key}`
#
# @return [BGSClient::ServiceAction::Request::Result<Hash, BGSClient::ServiceAction::Request::Fault>]
# the response payload of a successful request, or the fault object of a
# failed request
def perform_request(
definition:, body:,
external_id: ServiceAction::ExternalId::DEFAULT
)
ServiceAction
.const_get(:Request)
.new(definition:, external_id:)
.perform(body)
end

##
# Reveals the momentary health of a BGS service by attempting to request
# its WSDL and returning the HTTP status code of the response.
#
# @example
# definition =
# BGSClient::ServiceAction::Definition::
# ManageRepresentativeService::
# ReadPoaRequest
#
# BGSClient.healthcheck(definition)
#
# @param definition [BGSClient::ServiceAction::Definition] a value object
# that identifies a particular BGS SOAP service action by way of:
# `{.service_path, .service_namespaces, .action_name}`
#
# @return [Integer] HTTP status code
#
# @todo We could also introduce the notion of just the service definition
# in our central repository of definitions so that:
# 1. Service action definitions and other code would be able to refer to
# them
# 2. We could improve this API so that it doesn't need to receive
# extraneous action information.
# But this is fine for now.
def healthcheck(definition)
connection = build_connection
response = fetch_wsdl(connection, definition)
response.status
end

def breakers_service
url = URI.parse(Settings.bgs.url)
request_matcher =
proc do |request_env|
request_env.url.host == url.host &&
request_env.url.port == url.port &&
request_env.url.path =~ /^#{url.path}/
end

Breakers::Service.new(
name: 'BGS/Claims',
request_matcher:
)
end

private

def fetch_wsdl(connection, definition)
connection.get(definition.service_path) do |req|
req.params['WSDL'] = nil
end
end

def build_connection
ssl_verify_mode =
if Settings.bgs.ssl_verify_mode == 'none'
OpenSSL::SSL::VERIFY_NONE
else
OpenSSL::SSL::VERIFY_PEER
end

Faraday.new(Settings.bgs.url) do |conn|
conn.ssl.verify_mode = ssl_verify_mode
yield(conn) if block_given?
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

module ClaimsApi
module BGSClient
module ServiceAction
class Definition <
Data.define(
:service_path,
:service_namespaces,
:action_name
)

module ManageRepresentativeService
service = {
service_path: 'VDC/ManageRepresentativeService',
service_namespaces: { 'data' => '/data' }
}

ReadPoaRequest =
Definition.new(
action_name: 'readPOARequest',
**service
)
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

module ClaimsApi
module BGSClient
module ServiceAction
class ExternalId < Data.define(:external_uid, :external_key)
DEFAULT =
new(
external_uid: Settings.bgs.external_uid,
external_key: Settings.bgs.external_key
)
end
end
end
end
Loading

0 comments on commit b3def1c

Please sign in to comment.