Skip to content

Commit

Permalink
Merge branch 'master' into ip/1429-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ianperera authored Dec 17, 2024
2 parents 625850a + ef3c028 commit a6a2d7f
Show file tree
Hide file tree
Showing 43 changed files with 711 additions and 175 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,7 @@ spec/lib/pdf_info/metadata_spec.rb @department-of-veterans-affairs/va-api-engine
spec/lib/pdf_utilities @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/pension_burial @department-of-veterans-affairs/mbs-core-team @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/pension21p527ez/pension_military_information_spec.rb @department-of-veterans-affairs/pension-and-burials @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/periodic_jobs_spec.rb @department-of-veterans-affairs/govcio-vfep-codereviewers @department-of-veterans-affairs/backend-review-group
spec/lib/preneeds @department-of-veterans-affairs/mbs-core-team @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/post911_sob @department-of-veterans-affairs/govcio-vfep-codereviewers @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/rx @department-of-veterans-affairs/vfs-mhv-medications
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ group :development, :test do
gem 'byebug', platforms: :ruby # Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'danger'
gem 'database_cleaner'
gem 'debug'
gem 'factory_bot_rails'
gem 'faker'
# CAUTION: faraday_curl may not provide all headers used in the actual faraday request. Be cautious if using this to
Expand Down
6 changes: 5 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ GEM
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
colored2 (3.1.2)
combine_pdf (1.0.26)
combine_pdf (1.0.29)
matrix
ruby-rc4 (>= 0.1.5)
committee (5.4.0)
Expand Down Expand Up @@ -375,6 +375,9 @@ GEM
libddwaf (~> 1.14.0.0.0)
msgpack
debase-ruby_core_source (3.3.1)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
declarative (0.0.20)
deep_merge (1.2.2)
descendants_tracker (0.0.4)
Expand Down Expand Up @@ -1181,6 +1184,7 @@ DEPENDENCIES
date_validator
ddtrace
debts_api!
debug
decision_reviews!
dhp_connected_devices!
dogstatsd-ruby (= 5.6.3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ def separation_locations
:all_users,
:get_separation_locations
) do
provider = Flipper.enabled?(:disability_compensation_staging_lighthouse_brd) ? :lighthouse_staging : nil
api_provider = ApiProviderFactory.call(
type: ApiProviderFactory::FACTORIES[:brd],
provider: nil,
provider:,
options: {},
current_user: @current_user,
feature_toggle: ApiProviderFactory::FEATURE_TOGGLE_BRD
Expand Down
3 changes: 3 additions & 0 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ features:
caregiver_retry_form_validation:
actor_type: user
description: Enables 1010CG to retry schema validation
disability_compensation_staging_lighthouse_brd:
actor_type: user
description: Switches to Lighthouse Staging BRD Service. NEVER ENABLE IN PRODUCTION.
hca_browser_monitoring_enabled:
actor_type: user
description: Enables browser monitoring for the health care application.
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20241213171608_add_path_to_banners.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPathToBanners < ActiveRecord::Migration[7.2]
def change
add_column :banners, :path, :string
end
end
7 changes: 7 additions & 0 deletions db/migrate/20241213173113_add_index_to_banners_path.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class AddIndexToBannersPath < ActiveRecord::Migration[7.2]
disable_ddl_transaction!

def change
add_index :banners, :path, algorithm: :concurrently
end
end
4 changes: 3 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
require 'disability_compensation/providers/brd/brd_provider'
require 'disability_compensation/providers/brd/evss_brd_provider'
require 'disability_compensation/providers/brd/lighthouse_brd_provider'
require 'disability_compensation/providers/brd/lighthouse_staging_brd_provider'
require 'disability_compensation/providers/generate_pdf/generate_pdf_provider'
require 'disability_compensation/providers/generate_pdf/evss_generate_pdf_provider'
require 'disability_compensation/providers/generate_pdf/lighthouse_generate_pdf_provider'
Expand All @@ -28,7 +29,8 @@ class UndefinedFactoryTypeError < StandardError; end

API_PROVIDER = {
evss: :evss,
lighthouse: :lighthouse
lighthouse: :lighthouse,
lighthouse_staging: :lighthouse_staging
}.freeze

FACTORIES = {
Expand Down Expand Up @@ -166,6 +168,8 @@ def brd_service_provider
EvssBRDProvider.new(@current_user)
when API_PROVIDER[:lighthouse]
LighthouseBRDProvider.new(@current_user)
when API_PROVIDER[:lighthouse_staging]
LighthouseStagingBRDProvider.new(@current_user)
else
raise NotImplementedError, 'No known BRD Api Provider type provided'
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

require 'disability_compensation/providers/brd/lighthouse_brd_provider'
require 'lighthouse/benefits_reference_data_staging/service'

class LighthouseStagingBRDProvider < LighthouseBRDProvider
def initialize(_current_user)
super
@service = BenefitsReferenceData::Staging::Service.new
end
end
68 changes: 68 additions & 0 deletions lib/lighthouse/benefits_reference_data_staging/configuration.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# frozen_string_literal: true

require 'common/client/configuration/rest'
require 'faraday/multipart'

module BenefitsReferenceData
##
# HTTP client configuration for the {BenefitsReferenceData::Service},
# sets the base path, the base request headers, and a service name for breakers and metrics.

module Staging
class Configuration < Common::Client::Configuration::REST
self.read_timeout = Settings.lighthouse.benefits_reference_data.timeout || 20

##
# @return [String] Base path for benefits_reference_data URLs.
#
def base_path
settings = Settings.lighthouse.benefits_reference_data
url = settings.staging_url
path = settings.path
version = settings.version
safe_slash_merge(url, path, version)
end

##
# @return [String] Service name to use in breakers and metrics.
#
def service_name
'BenefitsReferenceDataStaging'
end

##
# @return [Hash] The basic headers required for any benefits_reference_data API call.
#
def self.base_request_headers
key = Settings.lighthouse.staging_api_key
message = "No api_key set for LH benefits_reference_data_staging. Please set 'lighthouse.staging_api_key'"
raise message if key.nil?

super.merge('apiKey' => key)
end

##
# Creates the a connection with parsing json and adding breakers functionality.
#
# @return [Faraday::Connection] a Faraday connection instance.
#
def connection
@conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|
faraday.use :breakers
faraday.use Faraday::Response::RaiseError

faraday.request :multipart
faraday.request :json
faraday.response :json
faraday.adapter Faraday.default_adapter
end
end

private

def safe_slash_merge(*url_segments)
url_segments.map { |segment| segment.sub(%r{^/}, '').chomp('/') }.join('/')
end
end
end
end
45 changes: 45 additions & 0 deletions lib/lighthouse/benefits_reference_data_staging/service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# frozen_string_literal: true

require 'common/client/base'
require 'common/client/concerns/monitoring'
require 'common/client/errors'
require 'common/exceptions/forbidden'
require 'common/exceptions/schema_validation_errors'
require 'lighthouse/benefits_reference_data_staging/configuration'
require 'lighthouse/benefits_reference_data/service_exception'

module BenefitsReferenceData
##
# Proxy Service for the Lighthouse Benefits Reference Data API.

module Staging
class Service < Common::Client::Base
include SentryLogging
include Common::Client::Concerns::Monitoring

configuration BenefitsReferenceData::Staging::Configuration

# ap @configuration.base_request_headers; exit

STATSD_KEY_PREFIX = 'api.benefits_reference_data_staging'

##
# Hit a Benefits Reference Data End-point
#
# @path end-point [string|symbol] a string or symbol of the end-point you wish to hit.
# @params params hash [Hash] a hash of key-value pairs of parameters
#
# @return [Faraday::Response]
#
def get_data(path:, params: {})
headers = config.base_request_headers
begin
response = perform :get, path, params, headers
rescue => e
raise BenefitsReferenceData::ServiceException.new(e), 'Lighthouse Error'
end
response
end
end
end
end
6 changes: 3 additions & 3 deletions lib/periodic_jobs.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'holidays'

# @see https://crontab.guru/
# @see https://en.wikipedia.org/wiki/Cron
PERIODIC_JOBS = lambda { |mgr| # rubocop:disable Metrics/BlockLength
Expand Down Expand Up @@ -249,10 +251,8 @@
# Daily 0000 hrs job for Vye: performs ingress of state from BDN & TIMS.
mgr.register('15 00 * * 1-5', 'Vye::MidnightRun::IngressBdn')
mgr.register('45 03 * * 1-5', 'Vye::MidnightRun::IngressTims')

# Daily 0600 hrs job for Vye: activates ingressed state, and egresses the changes for the day.
mgr.register('45 05 * * 1-5', 'Vye::DawnDash')

# Daily job for Vye: clears deactivated BDNs every evening.
# Daily 1900 job for Vye: clears deactivated BDNs every evening.
mgr.register('00 19 * * 1-5', 'Vye::SundownSweep')
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ End-to-end claims tracking provides the status of claims as they move through th

### Claim statuses

After you submit a disability compensation claim with the `POST /veterans/{veteranId}/526` synchronous endpoint, it is then established in Veterans Benefits Management System (VBMS). A `202` response means that the claim was successfully submitted by the API. However, it does not mean VA has received the required 526EZ PDF.
After you submit a disability compensation claim with the `POST /veterans/{veteranId}/526/synchronous` endpoint, it is then established in Veterans Benefits Management System (VBMS). A `202` response means that the claim was successfully submitted by the API. However, it does not mean VA has received the required 526EZ PDF.

To confirm the status of your submission, use the `GET /veterans/{veteranId}/claims/{id}` endpoint and the ID returned with your submission response. Statuses are:

Expand Down
Loading

0 comments on commit a6a2d7f

Please sign in to comment.