Skip to content

Commit

Permalink
Merge branch 'master' into 78427_Adding_CIE_logger_facility_type
Browse files Browse the repository at this point in the history
  • Loading branch information
kanchanasuriya authored Mar 26, 2024
2 parents ee9faf8 + de101d0 commit 34fcaae
Show file tree
Hide file tree
Showing 41 changed files with 1,382 additions and 100 deletions.
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ GEM
factory_bot_rails (6.4.3)
factory_bot (~> 6.4)
railties (>= 5.0.0)
faker (3.2.3)
faker (3.3.0)
i18n (>= 1.8.11, < 2)
faraday (2.9.0)
faraday-net_http (>= 2.0, < 3.2)
Expand Down Expand Up @@ -691,7 +691,7 @@ GEM
os (1.1.4)
ox (2.14.18)
parallel (1.24.0)
parallel_tests (4.5.2)
parallel_tests (4.6.0)
parallel
parser (3.3.0.5)
ast (~> 2.4.1)
Expand Down Expand Up @@ -810,7 +810,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
rchardet (1.8.0)
rdoc (6.6.2)
rdoc (6.6.3.1)
psych (>= 4.0.0)
redis (5.1.0)
redis-client (>= 0.17.0)
Expand Down
12 changes: 9 additions & 3 deletions app/controllers/v0/burial_claims_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@ class BurialClaimsController < ClaimsBaseController

def create
PensionBurial::TagSentry.tag_sentry
claim = claim_class.new(form: filtered_params[:form])

claim = if Flipper.enabled?(:va_burial_v2)
# cannot parse a nil form, to pass unit tests do a check for form presence
form = filtered_params[:form]
claim_class.new(form:, formV2: form.present? ? JSON.parse(form)['formV2'] : nil)
else
claim_class.new(form: filtered_params[:form])
end

unless claim.save
StatsD.increment("#{stats_key}.failure")
Sentry.set_tags(team: 'benefits-memorial-1') # tag sentry logs with team name
raise Common::Exceptions::ValidationErrors, claim
end

# this method also calls claim.process_attachments!
claim.submit_to_structured_data_services!

Rails.logger.info "ClaimID=#{claim.confirmation_number} Form=#{claim.class::FORM}"
Rails.logger.info "ClaimID=#{claim.confirmation_number} Form=#{claim.form_id}"
clear_saved_form(claim.form_id)
render(json: claim)
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v0/claim_documents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create

def klass
case form_id
when '21P-527EZ', '21P-530'
when '21P-527EZ', '21P-530', '21P-530V2'
PensionBurial::TagSentry.tag_sentry
PersistentAttachments::PensionBurial
when '21-686C', '686C-674'
Expand Down
3 changes: 2 additions & 1 deletion app/models/form_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class FormProfile
22-5495 22-0993 22-0994 FEEDBACK-TOOL 22-10203 22-1990S 22-1990EZ],
evss: ['21-526EZ'],
hca: %w[1010ez 10-10EZR],
pension_burial: %w[21P-530 21P-527EZ],
pension_burial: %w[21P-530 21P-527EZ 21P-530V2],
dependents: ['686C-674'],
decision_review: %w[20-0995 20-0996 10182],
mdot: ['MDOT'],
Expand Down Expand Up @@ -121,6 +121,7 @@ class FormProfile
'22-5490E' => ::FormProfiles::VA5490e,
'22-5495' => ::FormProfiles::VA5495,
'21P-530' => ::FormProfiles::VA21p530,
'21P-530V2' => ::FormProfiles::VA21p530v2,
'21-686C' => ::FormProfiles::VA21686c,
'686C-674' => ::FormProfiles::VA686c674,
'40-10007' => ::FormProfiles::VA4010007,
Expand Down
33 changes: 33 additions & 0 deletions app/models/form_profiles/va_21p530v2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# frozen_string_literal: true

require 'iso_country_codes'

class FormProfiles::VA21p530v2 < FormProfile
def metadata
{
version: 0,
prefill: true,
returnUrl: '/claimant-information'
}
end

def prefill
@identity_information = initialize_identity_information
@contact_information = initialize_contact_information
if @contact_information&.address&.country.present?
@contact_information.address.country = convert_to_iso2(@contact_information.address.country)
end
mappings = self.class.mappings_for_form(form_id)

form_data = generate_prefill(mappings) if FormProfile.prefill_enabled_forms.include?(form_id)

{ form_data:, metadata: }
end

private

def convert_to_iso2(country_code)
code = IsoCountryCodes.find(country_code)
code.alpha2
end
end
4 changes: 2 additions & 2 deletions app/models/saved_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SavedClaim < ApplicationRecord
# create a uuid for this second (used in the confirmation number) and store
# the form type based on the constant found in the subclass.
after_initialize do
self.form_id = self.class::FORM.upcase
self.form_id = self.class::FORM.upcase unless instance_of?(SavedClaim::Burial)
end

def self.add_form_and_validation(form_id)
Expand All @@ -51,7 +51,7 @@ def process_attachments!

def submit_to_structured_data_services!
# Only 21P-530 burial forms are supported at this time
if form_id != '21P-530'
unless %w[21P-530 21P-530V2].include?(form_id)
err_message = "Unsupported form id: #{form_id}"
raise Common::Exceptions::UnprocessableEntity.new(detail: err_message), err_message
end
Expand Down
19 changes: 19 additions & 0 deletions app/models/saved_claim/burial.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
class SavedClaim::Burial < CentralMailClaim
FORM = '21P-530'

# attribute name is passed from the FE as a flag, maintaining camel case
attr_accessor :formV2 # rubocop:disable Naming/MethodName

after_initialize do
self.form_id = if Flipper.enabled?(:va_burial_v2)
formV2 || form_id == '21P-530V2' ? '21P-530V2' : self.class::FORM.upcase
else
self.class::FORM.upcase
end
end

def process_attachments!
refs = attachment_keys.map { |key| Array(open_struct_form.send(key)) }.flatten
files = PersistentAttachment.where(guid: refs.map(&:confirmationCode))
Expand All @@ -25,6 +36,14 @@ def email
parsed_form['claimantEmail']
end

def form_matches_schema
return unless form_is_string

JSON::Validator.fully_validate(VetsJsonSchema::SCHEMAS[form_id], parsed_form).each do |v|
errors.add(:form, v.to_s)
end
end

def business_line
'NCA'
end
Expand Down
3 changes: 1 addition & 2 deletions app/sidekiq/structured_data/process_data_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def perform(saved_claim_id)
ensure
@claim.process_attachments! # upload claim and attachments to Central Mail

send_confirmation_email if @claim.form_id == '21P-530'

send_confirmation_email if %w[21P-530 21P-530V2].include?(@claim.form_id)
# veteran lookup for hit/miss metrics in support of Automation work
StatsD.increment("#{stats_key}.success",
tags: %W[relationship:#{relationship_type} veteranInMVI:#{veteran&.participant_id}])
Expand Down
7 changes: 3 additions & 4 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1020,10 +1020,6 @@ features:
actor_type: user
description: Allows veterans to cancel VA appointments
enable_in_development: true
va_online_scheduling_clinic_filtering:
actor_type: user
description: Allows clinic selection filtering by stop codes
enable_in_development: true
va_online_scheduling_community_care:
actor_type: user
description: Allows veterans to submit requests for Community Care appointments
Expand Down Expand Up @@ -1139,6 +1135,9 @@ features:
va_view_dependents_access:
actor_type: user
description: Allows us to gate the View/ Modify dependents content in a progressive rollout
va_burial_v2:
actor_type: user
description: Allows us to toggle between 21-P530 and 21-P530V2
show_edu_benefits_1990EZ_Wizard:
actor_type: user
description: Navigates user to 1990EZ or 1990 depending on form questions.
Expand Down
2 changes: 1 addition & 1 deletion lib/bip_claims/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Service < Common::Client::Base

def veteran_attributes(claim)
case claim.form_id
when '21P-530'
when '21P-530', '21P-530V2'
ssn, full_name, bday = claim.parsed_form.values_at(
'veteranSocialSecurityNumber',
'veteranFullName',
Expand Down
15 changes: 14 additions & 1 deletion lib/decision_review/utilities/pdf_validation/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -17,6 +17,19 @@ 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.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require 'pdf_fill/forms/va21p527ez'
require 'pdf_fill/forms/va21p530'
require 'pdf_fill/forms/va21p530v2'
require 'pdf_fill/forms/va214142'
require 'pdf_fill/forms/va210781a'
require 'pdf_fill/forms/va210781'
Expand Down
2 changes: 2 additions & 0 deletions lib/pdf_fill/filler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require 'pdf_fill/forms/va21p527ez'
require 'pdf_fill/forms/va21p530'
require 'pdf_fill/forms/va21p530v2'
require 'pdf_fill/forms/va214142'
require 'pdf_fill/forms/va210781a'
require 'pdf_fill/forms/va210781'
Expand All @@ -25,6 +26,7 @@ module Filler
FORM_CLASSES = {
'21P-527EZ' => PdfFill::Forms::Va21p527ez,
'21P-530' => PdfFill::Forms::Va21p530,
'21P-530V2' => PdfFill::Forms::Va21p530v2,
'21-4142' => PdfFill::Forms::Va214142,
'21-0781a' => PdfFill::Forms::Va210781a,
'21-0781' => PdfFill::Forms::Va210781,
Expand Down
Binary file added lib/pdf_fill/forms/pdfs/21P-530V2.pdf
Binary file not shown.
Loading

0 comments on commit 34fcaae

Please sign in to comment.