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 18, 2024
2 parents 6c43948 + e459d58 commit 037ade2
Show file tree
Hide file tree
Showing 80 changed files with 18,804 additions and 1,450 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ app/services/mhv_account_type_service.rb @department-of-veterans-affairs/octo-id
app/services/mhv_logging_service.rb @department-of-veterans-affairs/octo-identity
app/services/rapid_ready_for_decision @department-of-veterans-affairs/Disability-Experience @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/services/sign_in @department-of-veterans-affairs/octo-identity
app/services/submission_pdf_url_service.rb @department-of-veterans-affairs/vfs-authenticated-experience-backend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/services/terms_of_use @department-of-veterans-affairs/octo-identity
app/services/users @department-of-veterans-affairs/octo-identity
app/swagger/readme.md @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ GEM
actionpack (>= 5.2, < 8.1)
railties (>= 5.2, < 8.1)
rtesseract (3.1.3)
rubocop (1.69.1)
rubocop (1.69.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -960,7 +960,7 @@ GEM
rubocop-ast (>= 1.36.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.36.2)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/v0/my_va/submission_pdf_urls_controller.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# frozen_string_literal: true

require 'forms/submission_statuses/pdf_urls'

module V0
module MyVA
class SubmissionPdfUrlsController < ApplicationController
before_action :check_flipper_flag
service_tag 'form-submission-pdf'

def create
url = SubmissionPdfUrlService.new(
url = Forms::SubmissionStatuses::PdfUrls.new(
form_id: request_params[:form_id],
submission_guid: request_params[:submission_guid]
).fetch_url
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/submission_status_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
class SubmissionStatusSerializer
include JSONAPI::Serializer

attributes :id, :detail, :form_type, :message, :status, :created_at, :updated_at
attributes :id, :detail, :form_type, :message, :status, :created_at, :updated_at, :pdf_support
end
26 changes: 0 additions & 26 deletions app/services/submission_pdf_url_service.rb

This file was deleted.

2 changes: 1 addition & 1 deletion app/sidekiq/benefits_intake_status_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def monitor_failure(form_id, saved_claim_id, bi_uuid)
}
call_location = caller_locations.first

if %w[21P-530EZ].include?(form_id)
if %w[21P-530EZ 21P-530V2].include?(form_id)
claim = SavedClaim::Burial.find(saved_claim_id)
if claim
Burials::NotificationEmail.new(claim.id).deliver(:error)
Expand Down
4 changes: 3 additions & 1 deletion app/swagger/swagger/requests/my_va/submission_statuses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class SubmissionStatuses
property :detail, type: [:string, 'null'], example: '',
description: 'Error details (only when errors are present)'
property :form_type, type: :string, example: '21-0845', description: 'The type of form'
property :message, type: [:string, 'null']
property :message, type: [:string, 'null'], example: 'Descriptive message'
property :status, type: [:string, 'null'], enum: [
nil,
'pending',
Expand All @@ -115,6 +115,8 @@ class SubmissionStatuses
description: 'The submission record created in VA.gov'
property :updated_at, type: [:string, 'null'], example: '2023-12-15T20:40:54.474Z',
description: 'The last time the submission status was updated'
property :pdf_support, type: :boolean, example: true,
description: 'True if submission supports archived pdf downloads'
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1964,3 +1964,7 @@ features:
benefits_non_disability_ch31_v2:
actor_type: user
description: If enabled, use new form and api endpoint for Ch31 VR&E form
is_updated_gi:
actor_type: user
description: If enabled, use updated gi design

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:
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/
42 changes: 42 additions & 0 deletions db/schema.rb

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

12 changes: 11 additions & 1 deletion lib/forms/submission_statuses/formatter.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require_relative 'pdf_urls'

module Forms
module SubmissionStatuses
class Formatter
Expand Down Expand Up @@ -46,10 +48,18 @@ def build_submissions_map(submissions)
message: nil,
status: nil,
created_at: submission.created_at,
updated_at: nil
updated_at: nil,
pdf_support: pdf_supported?(submission)
)
end
end

def pdf_supported?(submission)
PdfUrls.new(
form_id: submission.form_type,
submission_guid: submission.benefits_intake_uuid
).supported?
end
end
end
end
38 changes: 38 additions & 0 deletions lib/forms/submission_statuses/pdf_urls.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# frozen_string_literal: true

require 'simple_forms_api/form_remediation/configuration/vff_config'

module Forms
module SubmissionStatuses
class PdfUrls
VFF_FORMS = %w[20-10206 20-10207 21-0845 21-0966 21-0972 21-10210 21-4138 21-4142 21P-0847 26-4555 40-0247
40-10007].freeze

def initialize(form_id:, submission_guid:)
@form_id = form_id
@submission_guid = submission_guid
end

def fetch_url
config = determine_config
SimpleFormsApi::FormRemediation::S3Client.fetch_presigned_url(@submission_guid, config:)
end

def supported?
determine_config
rescue Common::Exceptions::Forbidden
false
else
true
end

private

def determine_config
return SimpleFormsApi::FormRemediation::Configuration::VffConfig.new if VFF_FORMS.include?(@form_id)

raise Common::Exceptions::Forbidden, detail: "Form '#{@form_id}' does not support pdf downloads"
end
end
end
end
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
@@ -0,0 +1,10 @@
# frozen_string_literal: true

class CreateArPowerOfAttorneyRequests < ActiveRecord::Migration[7.1]
def change
create_table :ar_power_of_attorney_requests, id: :uuid do |t|
t.references :claimant, type: :uuid, foreign_key: { to_table: :user_accounts }, null: false
t.datetime :created_at, null: false
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

class CreateArPowerOfAttorneyRequestResolutions < ActiveRecord::Migration[7.1]
disable_ddl_transaction! # Required for concurrent index creation

def change
create_table :ar_power_of_attorney_request_resolutions, id: :uuid do |t|
t.references :power_of_attorney_request,
type: :uuid,
foreign_key: { to_table: :ar_power_of_attorney_requests },
null: false,
index: { unique: true }
t.string :resolving_type, null: false
t.uuid :resolving_id, null: false
t.text :reason_ciphertext
t.text :encrypted_kms_key, null: false
t.datetime :created_at, null: false
end

# Add a unique index to ensure one resolution per resolving_type and resolving_id combination
add_index :ar_power_of_attorney_request_resolutions,
[:resolving_type, :resolving_id],
unique: true,
name: 'unique_resolving_type_and_id',
algorithm: :concurrently
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

class CreateArPowerOfAttorneyRequestDecisions < ActiveRecord::Migration[7.1]
disable_ddl_transaction! # Required for concurrent index creation

def change
# Decisions act as a delegated subtype of Resolutions
# This table stores specific 'decision' types for PowerOfAttorneyRequestResolutions
create_table :ar_power_of_attorney_request_decisions, id: :uuid do |t|
t.string 'type', null: false
t.references 'creator', type: :uuid, foreign_key: { to_table: :user_accounts }, null: false
end
end
end

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

class CreateArPowerOfAttorneyRequestExpirations < ActiveRecord::Migration[7.1]
disable_ddl_transaction! # Required for concurrent index creation

def change
# Expirations act as a delegated subtype of Resolutions
# This table tracks expiration records for PowerOfAttorneyRequestResolutions
create_table :ar_power_of_attorney_request_expirations, id: :uuid
end
end

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# frozen_string_literal: true

class CreateArPowerOfAttorneyForms < ActiveRecord::Migration[7.1]
disable_ddl_transaction! # Required for concurrent index creation

def change
create_table :ar_power_of_attorney_forms, id: :uuid do |t|
t.references :power_of_attorney_request,
type: :uuid,
foreign_key: { to_table: :ar_power_of_attorney_requests },
null: false,
index: { unique: true }

t.text :encrypted_kms_key, null: false
t.text :data_ciphertext, null: false
t.string :city_bidx, null: false
t.string :state_bidx, null: false
t.string :zipcode_bidx, null: false
end

# Add additional indexes for city, state, and zipcode
add_index :ar_power_of_attorney_forms,
[:city_bidx, :state_bidx, :zipcode_bidx],
algorithm: :concurrently

add_index :ar_power_of_attorney_forms,
:zipcode_bidx,
algorithm: :concurrently
end
end
Loading

0 comments on commit 037ade2

Please sign in to comment.