-
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 arf.80297/ARP-OGC-number
* 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
Showing
31 changed files
with
1,274 additions
and
120 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -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] |
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
124 changes: 124 additions & 0 deletions
124
modules/claims_api/app/clients/claims_api/bgs_client.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
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 |
28 changes: 28 additions & 0 deletions
28
modules/claims_api/app/clients/claims_api/bgs_client/service_action/definition.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
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 |
15 changes: 15 additions & 0 deletions
15
modules/claims_api/app/clients/claims_api/bgs_client/service_action/external_id.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
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 |
Oops, something went wrong.