Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use param store values in AccreditationService #19588

Merged
merged 7 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1856,10 +1856,15 @@ vaos:
base_path: "care-navigation/v1"
scopes: "care-nav"

ogc:
form21a_service_url:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change this name to form21a_service or form21a_api instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url: http://localhost:5000/api/v1/accreditation/applications/form21a
api_key: fake_key

accredited_representative_portal:
pilot_users_email_poa_codes: ~

banners:
drupal_username: banners_api
drupal_password: test
drupal_url: https://test.cms.va.gov/
drupal_url: https://test.cms.va.gov/
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class AccreditationService
def self.submit_form21a(parsed_body, user_uuid)
Rails.logger.info("Accreditation Service attempting submit_form21a with service_url: #{service_url}")
connection.post do |req|
req.headers['x-api-key'] = Settings.ogc.form21a_service_url.api_key
req.body = parsed_body.to_json
end
rescue Faraday::ConnectionFailed => e
Expand All @@ -34,22 +35,8 @@ def self.connection
end
end

# NOTE: The interface between GCLAWS/OGC and vets-api is not yet established due to ongoing ESECC and MOU requests.
# TODO: Update the service URL based on the actual production and QA URLs once the below issue is resolved. See:
# https://github.com/department-of-veterans-affairs/va.gov-team/issues/85933
# https://dsva.slack.com/archives/C06ABHUNBRS/p1721769692072489
# self.service_url: Determines and returns the service URL based on the current environment.
def self.service_url
case Rails.env
when 'development', 'test'
# NOTE: the below is a temporary URL for development purposes only.
# TODO: Update this once ESECC request goes through. See: https://github.com/department-of-veterans-affairs/va.gov-team/issues/88288
'http://localhost:5000/api/v1/accreditation/applications/form21a'
when 'production'
# TODO: Update this once MOU has been signed and the ESECC request has gone through. See:
# https://dsva.slack.com/archives/C06ABHUNBRS/p1721769692072489
# https://github.com/department-of-veterans-affairs/va.gov-team/issues/85933
raise 'Accreditation service URL not configured for production'
end
Settings.ogc.form21a_service_url.url
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
describe '#submit_form21a' do
context 'when the request is successful' do
it 'returns a successful response' do
stub_request(:post, 'http://localhost:5000/api/v1/accreditation/applications/form21a')
stub_request(:post, Settings.ogc.form21a_service_url.url)
.to_return(status: 200, body: parsed_body.to_json, headers: { 'Content-Type' => 'application/json' })

response = described_class.submit_form21a(parsed_body, user_uuid)
Expand All @@ -23,12 +23,12 @@

context 'when the connection fails' do
it 'logs the error and returns a service unavailable status' do
stub_request(:post, 'http://localhost:5000/api/v1/accreditation/applications/form21a')
stub_request(:post, Settings.ogc.form21a_service_url.url)
.to_raise(Faraday::ConnectionFailed.new('Accreditation Service connection failed'))

expect(Rails.logger).to receive(:error).with(
"Accreditation Service connection failed for user with user_uuid=#{user_uuid}: " \
'Accreditation Service connection failed, URL: http://localhost:5000/api/v1/accreditation/applications/form21a'
"Accreditation Service connection failed, URL: #{Settings.ogc.form21a_service_url.url}"
)

response = described_class.submit_form21a(parsed_body, user_uuid)
Expand All @@ -40,7 +40,7 @@

context 'when the request times out' do
it 'logs the error and returns a request timeout status' do
stub_request(:post, 'http://localhost:5000/api/v1/accreditation/applications/form21a')
stub_request(:post, Settings.ogc.form21a_service_url.url)
.to_raise(Faraday::TimeoutError.new('Request timed out'))

expect(Rails.logger).to receive(:error).with(
Expand Down
Loading