From 6cd097c058012680c3bb21285ec0b6c946b7f0ee Mon Sep 17 00:00:00 2001 From: Annie Tran Date: Mon, 25 Mar 2024 11:56:32 -0500 Subject: [PATCH] use Benefits Intake API key in production; default to DR API key in lower environments as originally designed --- .../utilities/pdf_validation/configuration.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/decision_review/utilities/pdf_validation/configuration.rb b/lib/decision_review/utilities/pdf_validation/configuration.rb index 80f93c24878..7e38325517a 100644 --- a/lib/decision_review/utilities/pdf_validation/configuration.rb +++ b/lib/decision_review/utilities/pdf_validation/configuration.rb @@ -4,7 +4,7 @@ module DecisionReview module PdfValidation class Configuration < DecisionReview::Configuration ## - # @return [String] Base path for decision review URLs. + # @return [String] Base path for PDF validation URL. # def base_path Settings.decision_review.pdf_validation.url @@ -17,6 +17,18 @@ def service_name 'DecisionReview::PDFValidation' end + ## + # @return [Hash] The basic headers required for any decision review API call. + # + def self.base_request_headers + # Can use regular Decision Reviews API key in lower environments + return super unless Rails.env.production? + # Since we're using the `uploads/validate_document` endpoint under Benefits Intake API, + # we need to use their API key. This is pulled from BenefitsIntakeService::Configuration + api_key = Settings.benefits_intake_service.api_key || Settings.form526_backup.api_key + super.merge('apiKey' => api_key) + end + ## # Creates the a connection with parsing json and adding breakers functionality. #