+
{poaSyncInfo.poaSyncDate &&
{lastSyncedCopy}
}
diff --git a/client/app/queue/components/PoaRefreshButton.jsx b/client/app/queue/components/PoaRefreshButton.jsx
index 95d1e2e17c8..2b31fe06214 100644
--- a/client/app/queue/components/PoaRefreshButton.jsx
+++ b/client/app/queue/components/PoaRefreshButton.jsx
@@ -5,6 +5,7 @@ import ApiUtil from '../../util/ApiUtil';
import Button from '../../components/Button';
import SmallLoader from '../../components/SmallLoader';
import { setPoaRefreshAlert } from '../uiReducer/uiActions';
+import { setPoaRefreshAlertDecisionReview } from '../../nonComp/actions/task';
import { css } from 'glamor';
export const spacingStyling = css({
@@ -15,11 +16,29 @@ export const PoaRefreshButton = ({ appealId }) => {
const dispatch = useDispatch();
const [buttonText, setButtonText] = useState('Refresh POA');
const viewPoaRefreshButton = useSelector((state) => state.ui.featureToggles.poa_button_refresh);
+ let baseTasksUrl = useSelector((state) => state.baseTasksUrl);
+ const businessLineUrl = useSelector((state) => state.businessLineUrl);
+
+ baseTasksUrl = businessLineUrl === 'vha' ? `${baseTasksUrl}/tasks` : '/appeals';
+
+ const patchUrl = `${baseTasksUrl}/${appealId}/update_power_of_attorney`;
+
+ const callDispatch = (data) => {
+ if (businessLineUrl === 'vha') {
+ dispatch(
+ setPoaRefreshAlertDecisionReview(data.body.alert_type, data.body.message, data.body.power_of_attorney)
+ );
+ } else {
+ dispatch(
+ setPoaRefreshAlert(data.body.alert_type, data.body.message, data.body.power_of_attorney)
+ );
+ }
+ };
const updatePOA = () => {
setButtonText();
- ApiUtil.patch(`/appeals/${appealId}/update_power_of_attorney`).then((data) => {
- dispatch(setPoaRefreshAlert(data.body.alert_type, data.body.message, data.body.power_of_attorney));
+ ApiUtil.patch(patchUrl).then((data) => {
+ callDispatch(data);
setButtonText('Refresh POA');
});
};
diff --git a/client/app/queue/components/TaskRows.jsx b/client/app/queue/components/TaskRows.jsx
index 423aef3772b..343e9db01cd 100644
--- a/client/app/queue/components/TaskRows.jsx
+++ b/client/app/queue/components/TaskRows.jsx
@@ -532,6 +532,7 @@ class TaskRows extends React.PureComponent {
timeline,
taskList,
index,
+ key: `${timelineEvent?.type}-${index}`
});
}
diff --git a/client/app/queue/reducers.js b/client/app/queue/reducers.js
index ed8a7c41092..1fa4850fa4c 100644
--- a/client/app/queue/reducers.js
+++ b/client/app/queue/reducers.js
@@ -339,8 +339,10 @@ const stageAppeal = (state, action) => {
stagedChanges: {
appeals: {
[action.payload.appealId]: {
- $set: { ...state.appeals[action.payload.appealId],
- ...state.appealDetails[action.payload.appealId] }
+ $set: {
+ ...state.appeals[action.payload.appealId],
+ ...state.appealDetails[action.payload.appealId]
+ }
}
}
}
diff --git a/client/test/app/components/__snapshots__/Table.test.js.snap b/client/test/app/components/__snapshots__/Table.test.js.snap
index d91d82fb1ee..6240a48054f 100644
--- a/client/test/app/components/__snapshots__/Table.test.js.snap
+++ b/client/test/app/components/__snapshots__/Table.test.js.snap
@@ -42,6 +42,7 @@ exports[`Table renders correctly 1`] = `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| AnnualMetricsReportJob,
"priority_ep_sync_batch_process_job" => PriorityEpSyncBatchProcessJob,
"batch_process_rescue_job" => BatchProcessRescueJob,
- "calculate_dispatch_stats" => CalculateDispatchStatsJob,
"create_establish_claim" => CreateEstablishClaimTasksJob,
"data_integrity_checks" => DataIntegrityChecksJob,
"delete_conferences_job" => VirtualHearings::DeleteConferencesJob,
diff --git a/config/routes.rb b/config/routes.rb
index 81670f08808..6f3f1c27c28 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -250,6 +250,10 @@
resources :decision_reviews, param: :business_line_slug, only: [] do
resources :tasks, controller: :decision_reviews, param: :task_id, only: [:show, :update] do
+ member do
+ get :power_of_attorney
+ patch :update_power_of_attorney
+ end
end
end
match '/decision_reviews/:business_line_slug' => 'decision_reviews#index', via: [:get]
@@ -360,9 +364,6 @@
get 'whats-new' => 'whats_new#show'
- get 'dispatch/stats(/:interval)', to: 'dispatch_stats#show', as: 'dispatch_stats'
- get 'stats', to: 'stats#show'
-
match '/intake/:any' => 'intakes#index', via: [:get]
get "styleguide", to: "styleguide#show"
diff --git a/db/seeds/intake.rb b/db/seeds/intake.rb
index ba4da438e7f..dab8841dc9b 100644
--- a/db/seeds/intake.rb
+++ b/db/seeds/intake.rb
@@ -94,11 +94,8 @@ def create_higher_level_reviews_and_supplemental_claims
informal_conference: false,
same_office: false,
benefit_type: "compensation",
+ veteran_is_not_claimant: true,
number_of_claimants: 1)
- higher_level_review.claimants.first.update!(
- payee_code: "10",
- type: "DependentClaimant"
- )
create(:end_product_establishment,
source: higher_level_review,
diff --git a/db/seeds/veterans_health_administration.rb b/db/seeds/veterans_health_administration.rb
index e1c951a02d0..100ff0baabb 100644
--- a/db/seeds/veterans_health_administration.rb
+++ b/db/seeds/veterans_health_administration.rb
@@ -12,8 +12,15 @@ class VeteransHealthAdministration < Base
"Prosthetics"
].freeze
- IN_PROCESS_SC_TO_CREATE = 6
- IN_PROCESS_HLR_TO_CREATE = 10
+ CLAIMANT_TYPES = [
+ :veteran_claimant,
+ :dependent_claimant,
+ :attorney_claimant,
+ :healthcare_claimant,
+ :other_claimant
+ ].freeze
+
+ BENEFIT_TYPE_LIST = Constants::BENEFIT_TYPES.keys.map(&:to_s).freeze
def seed!
setup_camo_org
@@ -24,7 +31,7 @@ def seed!
create_vha_caregiver
create_vha_program_office
create_vha_visn_pre_docket_queue
- create_high_level_reviews
+ create_higher_level_reviews
create_supplemental_claims
add_vha_user_to_be_vha_business_line_member
end
@@ -72,7 +79,6 @@ def create_visn_org_teams!
def create_vha_camo
create_vha_camo_queue_assigned
- create_vha_camo_queue_in_progress
create_vha_camo_queue_completed
end
@@ -82,234 +88,113 @@ def create_vha_caregiver
create_vha_caregiver_queue_completed
end
- def create_high_level_reviews
- business_line_list = BusinessLine.all
- business_line_list.each do |bussiness_line|
- benefit_claim_type = { benefit_type: bussiness_line.url.underscore, claim_type: "HLR" }
- create_list(:higher_level_review_vha_task, 5, assigned_to: bussiness_line)
- create_claims_with_dependent_claimants(benefit_claim_type)
- create_claims_with_attorney_claimants(benefit_claim_type)
- create_claims_with_other_claimants(benefit_claim_type)
+ def create_higher_level_reviews
+ BENEFIT_TYPE_LIST.each do |benefit_type|
+ 3.times do
+ CLAIMANT_TYPES.each do |claimant_type|
+ create_hlr_with_claimant(benefit_type, claimant_type)
+ end
+ end
end
- create_claims_with_health_care_claimants("HLR")
end
def create_supplemental_claims
- business_line_list = Organization.where(type: "BusinessLine")
- business_line_list.each do |bussiness_line|
- benefit_claim_type = { benefit_type: bussiness_line.url.underscore, claim_type: "supplemental" }
- create_list(:supplemental_claim_vha_task, 5, assigned_to: bussiness_line)
- create_claims_with_dependent_claimants(benefit_claim_type)
- create_claims_with_attorney_claimants(benefit_claim_type)
- create_claims_with_other_claimants(benefit_claim_type)
- end
- create_claims_with_health_care_claimants("supplemental")
- end
-
- def create_claims_with_dependent_claimants(arg = {})
- veterans = Veteran.limit(10).where.not(participant_id: nil)
- participant_id = rand(1_000_000...999_999_999)
- dependents = create_list(:claimant, 20, type: "DependentClaimant", participant_id: participant_id.to_s)
- dependent_in_progress_scs = Array.new(IN_PROCESS_SC_TO_CREATE).map do
- veteran = veterans[rand(0...veterans.size)]
- dependent = dependents[rand(0...dependents.size)]
- sc = create_claim(arg[:benefit_type], arg[:claim_type], veteran)
-
- DependentClaimant.create!(decision_review: sc, participant_id: dependent.participant_id, payee_code: "10")
- RequestIssue.create!(
- decision_review: sc,
- nonrating_issue_category: "Beneficiary Travel",
- nonrating_issue_description: arg[:benefit_type].to_s,
- benefit_type: arg[:benefit_type],
- decision_date: 1.month.ago
- )
- sc
- end
- name = (arg[:claim_type] == "supplemental") ? SupplementalClaim.name : HigherLevelReview.name
- submit_claims_to_process_and_create_task(dependent_in_progress_scs)
- change_claim_status_to_complete(dependent_in_progress_scs, name)
- end
-
- def create_claims_with_attorney_claimants(benefit_and_claim = {})
- veterans = Veteran.limit(10).where.not(participant_id: nil)
- dependents = create_list(:bgs_attorney, 20)
- dependent_in_progress_scs = Array.new(IN_PROCESS_SC_TO_CREATE).map do
- veteran = veterans[rand(0...veterans.size)]
- dependent = dependents[rand(0...dependents.size)]
-
- sc = create_claim(benefit_and_claim[:benefit_type], benefit_and_claim[:claim_type], veteran)
-
- AttorneyClaimant.create!(decision_review: sc, participant_id: dependent.participant_id, payee_code: "15")
- RequestIssue.create!(
- decision_review: sc,
- nonrating_issue_category: "Beneficiary Travel | Special Mode",
- nonrating_issue_description: "Attorney Claimant #{benefit_and_claim[:benefit_type]}",
- benefit_type: benefit_and_claim[:benefit_type],
- decision_date: 1.month.ago
- )
- sc
- end
- name = (benefit_and_claim[:claim_type] == "supplemental") ? SupplementalClaim.name : HigherLevelReview.name
- submit_claims_to_process_and_create_task(dependent_in_progress_scs)
- change_claim_status_to_complete(dependent_in_progress_scs, name)
- end
-
- def create_claims_with_other_claimants(benefit_and_claim_arg = {})
- veterans = Veteran.limit(10).where.not(participant_id: nil)
- dependents = create_list(:claimant, 10, :with_unrecognized_appellant_detail, type: "OtherClaimant")
- dependent_in_progress_scs = Array.new(IN_PROCESS_SC_TO_CREATE).map do
- veteran = veterans[rand(0...veterans.size)]
- dependent = dependents[rand(0...dependents.size)]
- sc = create_claim(benefit_and_claim_arg[:benefit_type], benefit_and_claim_arg[:claim_type], veteran)
-
- OtherClaimant.create!(decision_review: sc, participant_id: dependent.participant_id, payee_code: "20")
- RequestIssue.create!(
- decision_review: sc,
- nonrating_issue_category: "Beneficiary Travel | Special Mode",
- nonrating_issue_description: "Other Claimant #{benefit_and_claim_arg[:benefit_type]}",
- benefit_type: benefit_and_claim_arg[:benefit_type],
- decision_date: 1.month.ago
- )
- sc
- end
- name = (benefit_and_claim_arg[:claim_type] == "supplemental") ? SupplementalClaim.name : HigherLevelReview.name
- submit_claims_to_process_and_create_task(dependent_in_progress_scs)
- change_claim_status_to_complete(dependent_in_progress_scs, name)
- end
-
- def create_claims_with_health_care_claimants(claim_type = "supplemental")
- veterans = Veteran.limit(10).where.not(participant_id: nil)
- dependents = create_list(:claimant, 10, :with_unrecognized_appellant_detail, type: "HealthcareProviderClaimant")
- dependent_in_progress_scs = Array.new(IN_PROCESS_SC_TO_CREATE).map do
- veteran = veterans[rand(0...veterans.size)]
- dependent = dependents[rand(0...dependents.size)]
- sc = create_claim("vha", claim_type, veteran)
-
- HealthcareProviderClaimant.create!(decision_review: sc, participant_id: dependent.participant_id, payee_code: "12")
- RequestIssue.create!(
- decision_review: sc,
- nonrating_issue_category: "Beneficiary Travel | Special Mode",
- nonrating_issue_description: "Health Provider Climant",
- benefit_type: "vha",
- decision_date: 1.month.ago
- )
- sc
- end
- name = (claim_type == "supplemental") ? SupplementalClaim.name : HigherLevelReview.name
- submit_claims_to_process_and_create_task(dependent_in_progress_scs)
- change_claim_status_to_complete(dependent_in_progress_scs, name)
- end
-
- # submit the hlr and scr to be processed and create task
- def submit_claims_to_process_and_create_task(claim_in_process)
- claim_in_process.each do |cip|
- cip.submit_for_processing!
- cip.create_business_line_tasks!
+ BENEFIT_TYPE_LIST.each do |benefit_type|
+ 3.times do
+ CLAIMANT_TYPES.each do |claimant_type|
+ create_sc_with_claimant(benefit_type, claimant_type)
+ end
+ end
end
end
- # change the status of hlr and scr to completed.
- def change_claim_status_to_complete(in_process_claims, claim_name)
- [0...2].each do |num|
- DecisionReviewTask.where(
- appeal_id: in_process_claims[num],
- appeal_type: [claim_name]
- ).each(&:completed!)
- end
+ def create_hlr_with_claimant(benefit_type, claimant_type)
+ hlr = create(
+ :higher_level_review,
+ :with_request_issue,
+ :processed,
+ benefit_type: benefit_type,
+ claimant_type: claimant_type,
+ number_of_claimants: 1
+ )
+ hlr.create_business_line_tasks!
end
- def create_claim(*arg)
- sc = if arg[1].casecmp("supplemental").zero?
- SupplementalClaim.create!(
- veteran_file_number: arg[2].file_number,
- receipt_date: Time.zone.now,
- benefit_type: arg[0],
- veteran_is_not_claimant: true
- )
- else
- HigherLevelReview.create(
- veteran_file_number: arg[2].file_number,
- receipt_date: Time.zone.now,
- benefit_type: arg[0],
- informal_conference: false,
- same_office: false,
- veteran_is_not_claimant: true
- )
- end
- sc
+ def create_sc_with_claimant(benefit_type, claimant_type)
+ sc = create(
+ :supplemental_claim,
+ :with_request_issue,
+ :processed,
+ benefit_type: benefit_type,
+ claimant_type: claimant_type,
+ number_of_claimants: 1
+ )
+ sc.create_business_line_tasks!
end
+ # :reek:NestedIterators
+ # this method is creating most of the data, but we can't get around it because of how many PO/VISN combos there are
def create_vha_visn_pre_docket_queue
tabs = [:assigned, :completed, :in_progress, :on_hold]
vha_regional_offices = VhaRegionalOffice.all
+ vha_program_offices = VhaProgramOffice.all
+
tabs.each do |status|
vha_regional_offices.each do |regional_office|
- create_list(:assess_documentation_task_predocket, 5, status, assigned_to: regional_office) unless status == :on_hold
- create_list(:assess_documentation_task_predocket, 5, :on_hold, assigned_to: regional_office) if status == :on_hold
+ # We want to also populate the VhaProgramOffice queue's in_progress tabs, so loop through them here also
+ vha_program_offices.each do |program_office|
+ po_task = create(:assess_documentation_task, :assigned, assigned_to: program_office)
+
+ if status == :completed
+ # completed tasks will populate the PO office 'ready for review' tab
+ ro_task = create(:assess_documentation_task, parent: po_task, assigned_to: regional_office)
+ ro_task.completed!
+ else
+ # assigned, in_progress, and on_hold status will populate in the PO office 'on_hold' tab
+ create(:assess_documentation_task, status, parent: po_task, assigned_to: regional_office)
+ end
+ end
end
end
end
def create_vha_camo_queue_assigned
- 5.times do
- create(:vha_document_search_task_with_assigned_to, assigned_to: VhaCamo.singleton)
- end
- end
-
- def create_vha_camo_queue_in_progress
- 5.times do
- appeal = create(:appeal)
- root_task = create(:task, appeal: appeal, assigned_to: VhaCamo.singleton)
- pre_docket_task = FactoryBot.create(
- :pre_docket_task,
- :in_progress,
- assigned_to: VhaCamo.singleton,
- appeal: appeal,
- parent: root_task
- )
- create(:task, :in_progress, assigned_to: VhaCamo.singleton, appeal: appeal, parent: pre_docket_task)
- end
+ 5.times { create(:vha_document_search_task, :assigned, assigned_to: VhaCamo.singleton) }
end
def create_vha_camo_queue_completed
5.times do
- create(
- :vha_document_search_task_with_assigned_to,
- :completed,
- assigned_to: VhaCamo.singleton
- )
+ task = create(:vha_document_search_task, assigned_to: VhaCamo.singleton)
+ task.completed!
end
end
def create_vha_caregiver_queue_assigned
- 5.times do
- create(:vha_document_search_task_with_assigned_to, assigned_to: VhaCaregiverSupport.singleton)
- end
+ 5.times { create(:vha_document_search_task, assigned_to: VhaCaregiverSupport.singleton) }
end
def create_vha_caregiver_queue_in_progress
- 5.times do
- create(:vha_document_search_task_with_assigned_to, :in_progress, assigned_to: VhaCaregiverSupport.singleton)
- end
+ 5.times { create(:vha_document_search_task, :in_progress, assigned_to: VhaCaregiverSupport.singleton) }
end
def create_vha_caregiver_queue_completed
5.times do
- create(:vha_document_search_task_with_assigned_to, :completed, assigned_to: VhaCaregiverSupport.singleton)
+ task = create(:vha_document_search_task, assigned_to: VhaCaregiverSupport.singleton)
+ task.completed!
end
end
+ # :reek:FeatureEnvy
def create_vha_program_office
- tabs = [:assigned, :in_progress, :on_hold, :ready_for_review, :completed]
+ # on_hold and ready_for_review tabs are populated by populating the VISN queues linked to PO orgs
+ tabs = [:assigned, :in_progress, :completed]
program_offices = VhaProgramOffice.all
tabs.each do |status|
program_offices.each do |program_office|
- if status == :on_hold
- create_list(:assess_documentation_task_predocket, 5, :on_hold, assigned_to: program_office)
- elsif status == :ready_for_review
- create_list(:assess_documentation_task_predocket, 5, :completed, :ready_for_review, assigned_to: program_office)
- else
- create_list(:assess_documentation_task_predocket, 5, status, assigned_to: program_office)
+ 3.times do
+ task = create(:assess_documentation_task, assigned_to: program_office)
+ task.in_progress! if status == :in_progress
+ task.completed! if status == :completed
end
end
end
diff --git a/lib/fakes/bgs_service.rb b/lib/fakes/bgs_service.rb
index af5da53d4ac..b09e329c3f7 100644
--- a/lib/fakes/bgs_service.rb
+++ b/lib/fakes/bgs_service.rb
@@ -19,6 +19,7 @@ class Fakes::BGSService
attr_accessor :client
DEFAULT_VSO_POA_FILE_NUMBER = 216_979_849
+ NO_POA_FILE_NUMBER = 111_111_113
VSO_PARTICIPANT_ID = "4623321"
DEFAULT_PARTICIPANT_ID = "781162"
@@ -338,6 +339,7 @@ def can_access_cache_key(user, vbms_id)
# TODO: add more test cases
def fetch_poa_by_file_number(file_number)
return {} if file_number == "no-such-file-number"
+ return {} if file_number == NO_POA_FILE_NUMBER || file_number == NO_POA_FILE_NUMBER.to_s
record = (self.class.power_of_attorney_records || {})[file_number]
record ||= default_vso_power_of_attorney_record if file_number == DEFAULT_VSO_POA_FILE_NUMBER
@@ -371,6 +373,8 @@ def fetch_poas_by_participant_ids(participant_ids)
org_type_nm: Fakes::BGSServicePOA::POA_NATIONAL_ORGANIZATION,
ptcpnt_id: Fakes::BGSServicePOA::PARALYZED_VETERANS_VSO_PARTICIPANT_ID
}
+ elsif participant_id.starts_with?("NO_POA")
+ {}
else
{
legacy_poa_cd: "100",
diff --git a/spec/controllers/decision_reviews_controller_spec.rb b/spec/controllers/decision_reviews_controller_spec.rb
index a4d126525f2..34a0fe1717b 100644
--- a/spec/controllers/decision_reviews_controller_spec.rb
+++ b/spec/controllers/decision_reviews_controller_spec.rb
@@ -520,6 +520,46 @@
end
end
+ describe "#power_of_attorney" do
+ let(:poa_task) do
+ create(:supplemental_claim_poa_task)
+ end
+
+ context "get the appeals POA information" do
+ subject do
+ get :power_of_attorney,
+ params: { use_route: "decision_reviews/#{non_comp_org.url}/tasks", task_id: poa_task.id },
+ format: :json
+ end
+
+ it "returns a successful response" do
+ expect(JSON.parse(subject.body)["representative_type"]).to eq "Attorney"
+ expect(JSON.parse(subject.body)["representative_name"]).to eq "Clarence Darrow"
+ expect(JSON.parse(subject.body)["representative_email_address"]).to eq "jamie.fakerton@caseflowdemo.com"
+ expect(JSON.parse(subject.body)["representative_tz"]).to eq "America/Los_Angeles"
+ expect(JSON.parse(subject.body)["poa_last_synced_at"]).to eq "2018-01-01T07:00:00.000-05:00"
+ end
+ end
+
+ context "update POA Information" do
+ subject do
+ patch :update_power_of_attorney,
+ params: { use_route: "decision_reviews/#{non_comp_org.url}/tasks", task_id: poa_task.id },
+ format: :json
+ end
+
+ it "update and return POA information successfully" do
+ subject
+ assert_response(:success)
+ expect(JSON.parse(subject.body)["power_of_attorney"]["representative_type"]).to eq "Attorney"
+ expect(JSON.parse(subject.body)["power_of_attorney"]["representative_name"]).to eq "Clarence Darrow"
+ expected_email = "jamie.fakerton@caseflowdemo.com"
+ expect(JSON.parse(subject.body)["power_of_attorney"]["representative_email_address"]).to eq expected_email
+ expect(JSON.parse(subject.body)["power_of_attorney"]["representative_tz"]).to eq "America/Los_Angeles"
+ end
+ end
+ end
+
def task_ids_from_response_body(response_body)
response_body["tasks"]["data"].map { |task| task["id"].to_i }
end
diff --git a/spec/factories/claimant.rb b/spec/factories/claimant.rb
index 407155307f0..1d9702aca32 100644
--- a/spec/factories/claimant.rb
+++ b/spec/factories/claimant.rb
@@ -34,6 +34,11 @@
trait :attorney do
initialize_with { AttorneyClaimant.new(attributes) }
type { AttorneyClaimant.name }
+ after(:create) do |claimant, _evaluator|
+ claimant.person
+ name = claimant.person&.name || "Seeded AttyClaimant"
+ create(:bgs_attorney, name: name, participant_id: claimant.participant_id)
+ end
end
after(:create) do |claimant, _evaluator|
diff --git a/spec/factories/higher_level_review.rb b/spec/factories/higher_level_review.rb
index 7f282d7976e..e792d9204e8 100644
--- a/spec/factories/higher_level_review.rb
+++ b/spec/factories/higher_level_review.rb
@@ -6,11 +6,98 @@
receipt_date { 1.month.ago }
benefit_type { "compensation" }
uuid { SecureRandom.uuid }
+ veteran_is_not_claimant { true }
transient do
number_of_claimants { nil }
end
+ transient do
+ claimant_type { :none }
+ end
+
+ transient do
+ veteran do
+ Veteran.find_by(file_number: veteran_file_number) ||
+ create(:veteran, file_number: (generate :veteran_file_number))
+ end
+ end
+
+ after(:build) do |hlr, evaluator|
+ if evaluator.veteran
+ hlr.veteran_file_number = evaluator.veteran.file_number
+ end
+ end
+
+ after(:create) do |hlr, evaluator|
+ payee_code = ClaimantValidator::BENEFIT_TYPE_REQUIRES_PAYEE_CODE.include?(hlr.benefit_type) ? "00" : nil
+
+ if !evaluator.claimants.empty?
+ evaluator.claimants.each do |claimant|
+ claimant.decision_review = hlr
+ claimant.save!
+ end
+ elsif evaluator.claimant_type
+ case evaluator.claimant_type
+ when :dependent_claimant
+ claimants_to_create = evaluator.number_of_claimants || 1
+
+ create_list(
+ :claimant,
+ claimants_to_create,
+ decision_review: hlr,
+ type: "DependentClaimant",
+ # there was previously a HLR created in seeds/intake with payee_code "10", this covers that scenario
+ payee_code: "10"
+ )
+ when :attorney_claimant
+ create(
+ :claimant,
+ :attorney,
+ participant_id: hlr.veteran.participant_id,
+ decision_review: hlr,
+ payee_code: payee_code
+ )
+ when :healthcare_claimant
+ create(
+ :claimant,
+ :with_unrecognized_appellant_detail,
+ participant_id: hlr.veteran.participant_id,
+ decision_review: hlr,
+ type: "HealthcareProviderClaimant",
+ payee_code: payee_code
+ )
+ when :other_claimant
+ create(
+ :claimant,
+ :with_unrecognized_appellant_detail,
+ participant_id: hlr.veteran.participant_id,
+ decision_review: hlr,
+ type: "OtherClaimant",
+ payee_code: payee_code
+ )
+ when :veteran_claimant
+ hlr.update!(veteran_is_not_claimant: false)
+ create(
+ :claimant,
+ participant_id: hlr.veteran.participant_id,
+ decision_review: hlr,
+ payee_code: payee_code,
+ type: "VeteranClaimant"
+ )
+ end
+ elsif !Claimant.exists?(participant_id: hlr.veteran.participant_id, decision_review: hlr)
+ hlr.update!(veteran_is_not_claimant: false)
+ create(
+ :claimant,
+ participant_id: hlr.veteran.participant_id,
+ decision_review: hlr,
+ payee_code: payee_code,
+ type: "VeteranClaimant"
+ )
+ end
+ end
+
trait :with_end_product_establishment do
after(:create) do |higher_level_review|
create(
@@ -21,7 +108,24 @@
end
end
+ trait :with_request_issue do
+ after(:create) do |hlr, evaluator|
+ create(:request_issue,
+ benefit_type: hlr.benefit_type,
+ nonrating_issue_category: Constants::ISSUE_CATEGORIES[hlr.benefit_type].sample,
+ nonrating_issue_description: "#{hlr.business_line.name} Seeded issue",
+ decision_review: hlr,
+ decision_date: 1.month.ago)
+
+ if evaluator.veteran
+ hlr.veteran_file_number = evaluator.veteran.file_number
+ hlr.save
+ end
+ end
+ end
+
trait :with_vha_issue do
+ benefit_type { "vha" }
after(:create) do |higher_level_review, evaluator|
create(:request_issue,
benefit_type: "vha",
@@ -37,14 +141,9 @@
end
end
- transient do
- veteran do
- Veteran.find_by(file_number: veteran_file_number) ||
- create(:veteran, file_number: (generate :veteran_file_number))
- end
- end
-
trait :processed do
+ establishment_submitted_at { Time.zone.now }
+ establishment_last_submitted_at { Time.zone.now }
establishment_processed_at { Time.zone.now }
end
@@ -60,17 +159,5 @@
hlr.create_business_line_tasks!
end
end
-
- after(:create) do |hlr, evaluator|
- if evaluator.number_of_claimants
- create_list(
- :claimant,
- evaluator.number_of_claimants,
- decision_review: hlr,
- payee_code: "00",
- type: "VeteranClaimant"
- )
- end
- end
end
end
diff --git a/spec/factories/supplemental_claim.rb b/spec/factories/supplemental_claim.rb
index 05261b514fd..f2a60cbbc4f 100644
--- a/spec/factories/supplemental_claim.rb
+++ b/spec/factories/supplemental_claim.rb
@@ -6,11 +6,98 @@
receipt_date { 1.month.ago }
benefit_type { "compensation" }
uuid { SecureRandom.uuid }
+ veteran_is_not_claimant { true }
transient do
number_of_claimants { nil }
end
+ transient do
+ claimant_type { :none }
+ end
+
+ transient do
+ veteran do
+ Veteran.find_by(file_number: veteran_file_number) ||
+ create(:veteran, file_number: (generate :veteran_file_number))
+ end
+ end
+
+ after(:build) do |sc, evaluator|
+ if evaluator.veteran
+ sc.veteran_file_number = evaluator.veteran.file_number
+ end
+ end
+
+ after(:create) do |sc, evaluator|
+ payee_code = ClaimantValidator::BENEFIT_TYPE_REQUIRES_PAYEE_CODE.include?(sc.benefit_type) ? "00" : nil
+
+ if !evaluator.claimants.empty?
+ evaluator.claimants.each do |claimant|
+ claimant.decision_review = sc
+ claimant.save
+ end
+ elsif evaluator.claimant_type
+ case evaluator.claimant_type
+ when :dependent_claimant
+ claimants_to_create = evaluator.number_of_claimants || 1
+
+ create_list(
+ :claimant,
+ claimants_to_create,
+ decision_review: sc,
+ type: "DependentClaimant",
+ # there was previously a HLR created in seeds/intake with payee_code "10", this covers that scenario
+ payee_code: "10"
+ )
+ when :attorney_claimant
+ create(
+ :claimant,
+ :attorney,
+ participant_id: sc.veteran.participant_id,
+ decision_review: sc,
+ payee_code: payee_code
+ )
+ when :healthcare_claimant
+ create(
+ :claimant,
+ :with_unrecognized_appellant_detail,
+ participant_id: sc.veteran.participant_id,
+ decision_review: sc,
+ type: "HealthcareProviderClaimant",
+ payee_code: payee_code
+ )
+ when :other_claimant
+ create(
+ :claimant,
+ :with_unrecognized_appellant_detail,
+ participant_id: sc.veteran.participant_id,
+ decision_review: sc,
+ type: "OtherClaimant",
+ payee_code: payee_code
+ )
+ when :veteran_claimant
+ sc.update!(veteran_is_not_claimant: false)
+ create(
+ :claimant,
+ participant_id: sc.veteran.participant_id,
+ decision_review: sc,
+ payee_code: payee_code,
+ type: "VeteranClaimant"
+ )
+ end
+ elsif !Claimant.exists?(participant_id: sc.veteran.participant_id, decision_review: sc)
+ sc.update!(veteran_is_not_claimant: false)
+ create(
+ :claimant,
+ participant_id: sc.veteran.participant_id,
+ decision_review: sc,
+ payee_code: payee_code,
+ type: "VeteranClaimant"
+ )
+ end
+ end
+
trait :with_end_product_establishment do
after(:create) do |supplemental_claim|
create(
@@ -21,7 +108,24 @@
end
end
+ trait :with_request_issue do
+ after(:create) do |sc, evaluator|
+ create(:request_issue,
+ benefit_type: sc.benefit_type,
+ nonrating_issue_category: Constants::ISSUE_CATEGORIES[sc.benefit_type].sample,
+ nonrating_issue_description: "#{sc.business_line.name} Seeded issue",
+ decision_review: sc,
+ decision_date: 1.month.ago)
+
+ if evaluator.veteran
+ sc.veteran_file_number = evaluator.veteran.file_number
+ sc.save
+ end
+ end
+ end
+
trait :with_vha_issue do
+ benefit_type { "vha" }
after(:create) do |supplemental_claim, evaluator|
create(:request_issue,
benefit_type: "vha",
@@ -38,26 +142,15 @@
end
trait :processed do
+ establishment_submitted_at { Time.zone.now }
+ establishment_last_submitted_at { Time.zone.now }
establishment_processed_at { Time.zone.now }
end
- transient do
- veteran do
- Veteran.find_by(file_number: veteran_file_number) ||
- create(:veteran, file_number: (generate :veteran_file_number))
- end
- end
-
- after(:create) do |sc, evaluator|
- if evaluator.number_of_claimants
- create_list(
- :claimant,
- evaluator.number_of_claimants,
- payee_code: "00",
- decision_review: sc,
- type: "VeteranClaimant"
- )
- end
+ trait :requires_processing do
+ establishment_submitted_at { (HigherLevelReview.processing_retry_interval_hours + 1).hours.ago }
+ establishment_last_submitted_at { (HigherLevelReview.processing_retry_interval_hours + 1).hours.ago }
+ establishment_processed_at { nil }
end
end
end
diff --git a/spec/factories/task.rb b/spec/factories/task.rb
index ae31e30d050..f6e58563316 100644
--- a/spec/factories/task.rb
+++ b/spec/factories/task.rb
@@ -307,6 +307,22 @@ def self.find_first_task_or_create(appeal, task_type, **kwargs)
assigned_by { nil }
end
+ factory :supplemental_claim_poa_task, class: DecisionReviewTask do
+ appeal do
+ create(:supplemental_claim,
+ :processed,
+ :with_vha_issue,
+ :with_end_product_establishment,
+ benefit_type: "vha",
+ claimant_type: :veteran_claimant)
+ end
+ assigned_by { nil }
+
+ after(:create) do |task|
+ task.appeal.create_business_line_tasks!
+ end
+ end
+
factory :higher_level_review_vha_task, class: DecisionReviewTask do
appeal { create(:higher_level_review, :with_vha_issue, benefit_type: "vha") }
assigned_by { nil }
@@ -523,12 +539,7 @@ def self.find_first_task_or_create(appeal, task_type, **kwargs)
factory :assess_documentation_task, class: AssessDocumentationTask do
parent { create(:vha_document_search_task, appeal: appeal) }
- assigned_by { nil }
- end
-
- factory :assess_documentation_task_predocket, class: AssessDocumentationTask do
- parent { create(:pre_docket_task, assigned_to: assigned_to, appeal: appeal) }
- assigned_by { nil }
+ assigned_by { parent.assigned_by }
end
factory :vha_document_search_task, class: VhaDocumentSearchTask do
@@ -540,12 +551,6 @@ def self.find_first_task_or_create(appeal, task_type, **kwargs)
end
end
- factory :vha_document_search_task_with_assigned_to, class: VhaDocumentSearchTask do
- parent { create(:pre_docket_task, assigned_to: assigned_to, appeal: appeal) }
- assigned_to { :assigned_to }
- assigned_by { nil }
- end
-
factory :education_document_search_task, class: EducationDocumentSearchTask do
parent { create(:pre_docket_task, appeal: appeal, assigned_to: BvaIntake.singleton) }
assigned_to { EducationEmo.singleton }
diff --git a/spec/feature/api/v2/appeals_spec.rb b/spec/feature/api/v2/appeals_spec.rb
index c305a63237a..635f04d2545 100644
--- a/spec/feature/api/v2/appeals_spec.rb
+++ b/spec/feature/api/v2/appeals_spec.rb
@@ -309,7 +309,7 @@
let!(:hlr) do
create(:higher_level_review,
- veteran_file_number: veteran_file_number,
+ veteran: veteran,
receipt_date: receipt_date,
informal_conference: informal_conference,
same_office: same_office,
@@ -331,7 +331,7 @@
let!(:supplemental_claim_review) do
create(:supplemental_claim,
- veteran_file_number: veteran_file_number,
+ veteran: veteran,
receipt_date: receipt_date,
benefit_type: "pension",
legacy_opt_in_approved: legacy_opt_in_approved,
@@ -563,11 +563,12 @@
let(:veteran_file_number) { "111223333" }
let(:receipt_date) { Time.zone.today - 20.days }
let(:benefit_type) { "compensation" }
+ let(:veteran) { create(:veteran, file_number: veteran_file_number) }
let(:hlr_ep_clr_date) { receipt_date + 30 }
let!(:hlr_with_dta_error) do
create(:higher_level_review,
- veteran_file_number: veteran_file_number,
+ veteran: veteran,
receipt_date: receipt_date)
end
@@ -593,7 +594,7 @@
let!(:dta_sc) do
create(:supplemental_claim,
- veteran_file_number: veteran_file_number,
+ veteran: veteran,
decision_review_remanded: hlr_with_dta_error)
end
diff --git a/spec/feature/intake/add_issues_spec.rb b/spec/feature/intake/add_issues_spec.rb
index 1fe7fc334f6..3e26120436d 100644
--- a/spec/feature/intake/add_issues_spec.rb
+++ b/spec/feature/intake/add_issues_spec.rb
@@ -159,113 +159,135 @@
expect(page).to have_content(COPY::VHA_PRE_DOCKET_ISSUE_BANNER)
end
end
- end
- context "when adding a contested claim to an appeal" do
- def add_contested_claim_issue
- click_intake_add_issue
- click_intake_no_matching_issues
+ context "when adding a contested claim to an appeal" do
+ def add_contested_claim_issue
+ click_intake_add_issue
+ click_intake_no_matching_issues
- # add the cc issue
- dropdown_select_string = "Select or enter..."
- benefit_text = "Insurance"
+ # add the cc issue
+ dropdown_select_string = "Select or enter..."
+ benefit_text = "Insurance"
- # Select the benefit type
- all(".cf-select__control", text: dropdown_select_string).first.click
- find("div", class: "cf-select__option", text: benefit_text).click
+ # Select the benefit type
+ all(".cf-select__control", text: dropdown_select_string).first.click
+ find("div", class: "cf-select__option", text: benefit_text).click
- # Select the issue category
- find(".cf-select__control", text: dropdown_select_string).click
- find("div", class: "cf-select__option", text: "Contested Death Claim | Intent of Insured").click
+ # Select the issue category
+ find(".cf-select__control", text: dropdown_select_string).click
+ find("div", class: "cf-select__option", text: "Contested Death Claim | Intent of Insured").click
- # fill in date and issue description
- fill_in "Decision date", with: 1.day.ago.to_date.mdY.to_s
- fill_in "Issue description", with: "CC Instructions"
+ # fill in date and issue description
+ fill_in "Decision date", with: 1.day.ago.to_date.mdY.to_s
+ fill_in "Issue description", with: "CC Instructions"
- # click buttons
- click_on "Add this issue"
- click_on "Establish appeal"
- end
+ # click buttons
+ click_on "Add this issue"
+ click_on "Establish appeal"
+ end
- before do
- ClerkOfTheBoard.singleton
- FeatureToggle.enable!(:cc_appeal_workflow)
- FeatureToggle.enable!(:indicator_for_contested_claims)
- end
- after do
- FeatureToggle.disable!(:cc_appeal_workflow)
- FeatureToggle.disable!(:indicator_for_contested_claims)
- end
+ before do
+ ClerkOfTheBoard.singleton
+ FeatureToggle.enable!(:cc_appeal_workflow)
+ FeatureToggle.enable!(:indicator_for_contested_claims)
+ end
+ after do
+ FeatureToggle.disable!(:cc_appeal_workflow)
+ FeatureToggle.disable!(:indicator_for_contested_claims)
+ end
- scenario "the appeal is evidence submission" do
- start_appeal(veteran)
- visit "/intake"
- click_intake_continue
- expect(page).to have_current_path("/intake/add_issues")
+ scenario "the appeal is evidence submission" do
+ start_appeal(veteran)
+ visit "/intake"
+ click_intake_continue
+ expect(page).to have_current_path("/intake/add_issues")
- # method to process add issues page with cc issue
- add_contested_claim_issue
+ # method to process add issues page with cc issue
+ add_contested_claim_issue
- appeal = Appeal.find_by(veteran_file_number: veteran.file_number)
- appeal.reload
+ appeal = Appeal.find_by(veteran_file_number: veteran.file_number)
+ appeal.reload
- # expect the SendInitialNotificationLetterHoldingTask to be created and assigned to COB
- expect(page).to have_content("Intake completed")
- expect(appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").nil?).to be false
- expect(
- appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").parent
- ).to eql(appeal.tasks.find_by(type: "EvidenceSubmissionWindowTask"))
- expect(
- appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").assigned_to
- ).to eql(ClerkOfTheBoard.singleton)
- end
+ # expect the SendInitialNotificationLetterHoldingTask to be created and assigned to COB
+ expect(page).to have_content("Intake completed")
+ expect(appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").nil?).to be false
+ expect(
+ appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").parent
+ ).to eql(appeal.tasks.find_by(type: "EvidenceSubmissionWindowTask"))
+ expect(
+ appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").assigned_to
+ ).to eql(ClerkOfTheBoard.singleton)
+ end
- scenario "the appeal is direct review" do
- start_appeal(veteran)
- visit "/intake"
- find("label", text: "Direct Review").click
- click_intake_continue
- expect(page).to have_current_path("/intake/add_issues")
+ scenario "the appeal is direct review" do
+ start_appeal(veteran)
+ visit "/intake"
+ find("label", text: "Direct Review").click
+ click_intake_continue
+ expect(page).to have_current_path("/intake/add_issues")
- # method to process add issues page with cc issue
- add_contested_claim_issue
+ # method to process add issues page with cc issue
+ add_contested_claim_issue
- appeal = Appeal.find_by(veteran_file_number: veteran.file_number)
- appeal.reload
+ appeal = Appeal.find_by(veteran_file_number: veteran.file_number)
+ appeal.reload
- # expect the SendInitialNotificationLetterHoldingTask to be created and assigned to COB
- expect(page).to have_content("Intake completed")
- expect(appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").nil?).to be false
- expect(
- appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").parent
- ).to eql(appeal.tasks.find_by(type: "DistributionTask"))
- expect(
- appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").assigned_to
- ).to eql(ClerkOfTheBoard.singleton)
+ # expect the SendInitialNotificationLetterHoldingTask to be created and assigned to COB
+ expect(page).to have_content("Intake completed")
+ expect(appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").nil?).to be false
+ expect(
+ appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").parent
+ ).to eql(appeal.tasks.find_by(type: "DistributionTask"))
+ expect(
+ appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").assigned_to
+ ).to eql(ClerkOfTheBoard.singleton)
+ end
+
+ scenario "the appeal is a hearing request" do
+ start_appeal(veteran)
+ visit "/intake"
+ find("label", text: "Hearing").click
+ click_intake_continue
+ expect(page).to have_current_path("/intake/add_issues")
+
+ # method to process add issues page with cc issue
+ add_contested_claim_issue
+
+ appeal = Appeal.find_by(veteran_file_number: veteran.file_number)
+ appeal.reload
+
+ # expect the SendInitialNotificationLetterHoldingTask to be created and assigned to COB
+ expect(page).to have_content("Intake completed")
+ expect(appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").nil?).to be false
+ expect(
+ appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").parent
+ ).to eql(appeal.tasks.find_by(type: "ScheduleHearingTask"))
+ expect(
+ appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").assigned_to
+ ).to eql(ClerkOfTheBoard.singleton)
+ end
end
- scenario "the appeal is a hearing request" do
- start_appeal(veteran)
+ context "when the veteran does not have a POA"
+ before { FeatureToggle.enable!(:hlr_sc_unrecognized_claimants) }
+ after { FeatureToggle.disable!(:hlr_sc_unrecognized_claimants) }
+
+ let(:no_poa_veteran) { create(:veteran, participant_id: "NO_POA111111113", file_number: "111111113") }
+
+ scenario "the correct text displays for VHA" do
+ start_claim_review(:higher_level_review, benefit_type: "vha", veteran: no_poa_veteran)
visit "/intake"
- find("label", text: "Hearing").click
click_intake_continue
expect(page).to have_current_path("/intake/add_issues")
+ expect(page).to have_content(COPY::VHA_NO_POA)
+ end
- # method to process add issues page with cc issue
- add_contested_claim_issue
-
- appeal = Appeal.find_by(veteran_file_number: veteran.file_number)
- appeal.reload
-
- # expect the SendInitialNotificationLetterHoldingTask to be created and assigned to COB
- expect(page).to have_content("Intake completed")
- expect(appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").nil?).to be false
- expect(
- appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").parent
- ).to eql(appeal.tasks.find_by(type: "ScheduleHearingTask"))
- expect(
- appeal.reload.tasks.find_by(type: "SendInitialNotificationLetterTask").assigned_to
- ).to eql(ClerkOfTheBoard.singleton)
+ scenario "the correct text displays for non-VHA" do
+ start_claim_review(:higher_level_review, veteran: no_poa_veteran)
+ visit "/intake"
+ click_intake_continue
+ expect(page).to have_current_path("/intake/add_issues")
+ expect(page).to have_content(COPY::ADD_CLAIMANT_CONFIRM_MODAL_NO_POA)
end
end
end
diff --git a/spec/feature/non_comp/dispositions_spec.rb b/spec/feature/non_comp/dispositions_spec.rb
index 6d8a23a7c52..1b507e192e6 100644
--- a/spec/feature/non_comp/dispositions_spec.rb
+++ b/spec/feature/non_comp/dispositions_spec.rb
@@ -46,10 +46,11 @@ def find_disabled_disposition(disposition, description = nil)
let(:decision_review) do
create(
:higher_level_review,
- number_of_claimants: 1,
end_product_establishments: [epe],
veteran_file_number: veteran.file_number,
- benefit_type: non_comp_org.url
+ benefit_type: non_comp_org.url,
+ veteran_is_not_claimant: false,
+ claimant_type: :veteran_claimant
)
end
@@ -90,18 +91,23 @@ def find_disabled_disposition(disposition, description = nil)
non_comp_org.add_user(user)
setup_prior_claim_with_payee_code(decision_review, veteran, "00")
FeatureToggle.enable!(:decision_review_queue_ssn_column)
+ FeatureToggle.enable!(:poa_button_refresh)
end
- after { FeatureToggle.disable!(:decision_review_queue_ssn_column) }
+ after do
+ FeatureToggle.disable!(:decision_review_queue_ssn_column)
+ FeatureToggle.disable!(:poa_button_refresh)
+ end
context "decision_review is a Supplemental Claim" do
let(:decision_review) do
create(
:supplemental_claim,
- number_of_claimants: 1,
end_product_establishments: [epe],
veteran_file_number: veteran.file_number,
- benefit_type: non_comp_org.url
+ benefit_type: non_comp_org.url,
+ veteran_is_not_claimant: false,
+ claimant_type: :veteran_claimant
)
end
@@ -130,6 +136,8 @@ def find_disabled_disposition(disposition, description = nil)
expect(page).to have_content(
"Prior decision date: #{decision_review.request_issues[0].decision_date.strftime('%m/%d/%Y')}"
)
+ expect(page).to have_no_content(COPY::CASE_DETAILS_POA_SUBSTITUTE)
+ expect(page).not_to have_button(COPY::REFRESH_POA)
expect(page).to have_content(Constants.INTAKE_FORM_NAMES.higher_level_review)
end
@@ -143,8 +151,11 @@ def find_disabled_disposition(disposition, description = nil)
context "the complete button enables only after a decision date and disposition are set" do
before do
visit dispositions_url
+ FeatureToggle.enable!(:poa_button_refresh)
end
+ after { FeatureToggle.disable!(:poa_button_refresh) }
+
scenario "neither disposition nor date is set" do
expect(page).to have_button("Complete", disabled: true)
end
@@ -258,6 +269,7 @@ def find_disabled_disposition(disposition, description = nil)
after do
Timecop.return
+ FeatureToggle.disable!(:poa_button_refresh)
end
let!(:vha_org) { create(:business_line, name: "Veterans Health Administration", url: "vha") }
@@ -266,7 +278,17 @@ def find_disabled_disposition(disposition, description = nil)
let(:decision_date) { Time.zone.now + 10.days }
let!(:in_progress_task) do
- create(:higher_level_review, :with_vha_issue, :create_business_line, benefit_type: "vha", veteran: veteran)
+ create(:higher_level_review,
+ :with_vha_issue,
+ :with_end_product_establishment,
+ :create_business_line,
+ benefit_type: "vha",
+ veteran: veteran,
+ claimant_type: :veteran_claimant)
+ end
+
+ let(:poa_task) do
+ create(:supplemental_claim_poa_task)
end
let(:business_line_url) { "decision_reviews/vha" }
@@ -303,5 +325,92 @@ def find_disabled_disposition(disposition, description = nil)
expect(page.find_by_id("decision-date").value).to have_content(decision_date.strftime("%Y-%m-%d"))
end
end
+
+ it "VHA Decision Review should have Power of Attorney Section" do
+ visit dispositions_url
+
+ expect(page).to have_selector("h1", text: "Veterans Health Administration")
+ expect(page).to have_selector("h2", text: COPY::CASE_DETAILS_POA_SUBSTITUTE)
+ expect(page).to have_text("Attorney: #{in_progress_task.representative_name}")
+ expect(page).to have_text("Email Address: #{in_progress_task.representative_email_address}")
+
+ expect(page).to have_text("Address")
+ expect(page).to have_content(COPY::CASE_DETAILS_POA_EXPLAINER_VHA)
+ full_address = in_progress_task.power_of_attorney.representative_address
+ sliced_full_address = full_address.slice!(:country)
+ sliced_full_address.each do |address|
+ expect(page).to have_text(address[1])
+ end
+
+ expect(page).not_to have_button(COPY::REFRESH_POA)
+ end
+
+ scenario "When feature toggle is enabled Refresh button should be visible." do
+ enable_feature_flag_and_redirect_to_disposition
+
+ last_synced_date = in_progress_task.poa_last_synced_at.to_date.strftime("%m/%d/%Y")
+ expect(page).to have_text("POA last refreshed on #{last_synced_date}")
+ expect(page).to have_button(COPY::REFRESH_POA)
+ end
+
+ scenario "when cooldown time is greater than 0 it should return Alert message" do
+ cooldown_period = 7
+ instance_decision_reviews = allow_any_instance_of(DecisionReviewsController)
+ instance_decision_reviews.to receive(:cooldown_period_remaining).and_return(cooldown_period)
+ enable_feature_flag_and_redirect_to_disposition
+ expect(page).to have_text(COPY::CASE_DETAILS_POA_SUBSTITUTE)
+ expect(page).to have_button(COPY::REFRESH_POA)
+
+ click_on COPY::REFRESH_POA
+ expect(page).to have_text("Power of Attorney (POA) data comes from VBMS")
+ expect(page).to have_text("Information is current at this time. Please try again in #{cooldown_period} minutes")
+ end
+
+ scenario "when cooldown time is 0, it should update POA" do
+ allow_any_instance_of(DecisionReviewsController).to receive(:cooldown_period_remaining).and_return(0)
+ enable_feature_flag_and_redirect_to_disposition
+ expect(page).to have_content(COPY::REFRESH_POA)
+ click_on COPY::REFRESH_POA
+ expect(page).to have_text("Power of Attorney (POA) data comes from VBMS")
+ expect(page).to have_content(COPY::POA_UPDATED_SUCCESSFULLY)
+ end
+
+ scenario "when POA record is blank, Refresh button should return not found message" do
+ allow_any_instance_of(Fakes::BGSService).to receive(:fetch_poas_by_participant_ids).and_return({})
+ allow_any_instance_of(Fakes::BGSService).to receive(:fetch_poa_by_file_number).and_return({})
+
+ enable_feature_flag_and_redirect_to_disposition
+ expect(page).to have_content(COPY::REFRESH_POA)
+ click_on COPY::REFRESH_POA
+ expect(page).to have_text(COPY::VHA_NO_POA)
+ expect(page).to have_text(COPY::POA_SUCCESSFULLY_REFRESH_MESSAGE)
+ end
+
+ context "with no POA" do
+ before do
+ allow_any_instance_of(Fakes::BGSService).to receive(:fetch_poas_by_participant_ids).and_return({})
+ allow_any_instance_of(Fakes::BGSService).to receive(:fetch_poa_by_file_number).and_return({})
+ end
+ it "should display the VHA-specific text" do
+ visit dispositions_url
+ expect(page).to have_content(COPY::CASE_DETAILS_NO_POA_VHA)
+ end
+ end
+
+ context "with an unrecognized POA" do
+ let(:poa) { in_progress_task.power_of_attorney }
+ before do
+ poa.update(representative_type: "Unrecognized representative")
+ end
+ it "should display the VHA-specific text" do
+ visit dispositions_url
+ expect(page).to have_content(COPY::CASE_DETAILS_UNRECOGNIZED_POA_VHA)
+ end
+ end
+ end
+
+ def enable_feature_flag_and_redirect_to_disposition
+ FeatureToggle.enable!(:poa_button_refresh)
+ visit dispositions_url
end
end
diff --git a/spec/feature/non_comp/reviews_spec.rb b/spec/feature/non_comp/reviews_spec.rb
index 1bf78c4ca5c..ce2a81942e0 100644
--- a/spec/feature/non_comp/reviews_spec.rb
+++ b/spec/feature/non_comp/reviews_spec.rb
@@ -7,9 +7,15 @@
let(:veteran_a) { create(:veteran, first_name: "Aaa", participant_id: "12345", ssn: "140261454") }
let(:veteran_b) { create(:veteran, first_name: "Bbb", participant_id: "601111772", ssn: "191097395") }
let(:veteran_c) { create(:veteran, first_name: "Ccc", participant_id: "1002345", ssn: "128455943") }
- let(:hlr_a) { create(:higher_level_review, veteran_file_number: veteran_a.file_number) }
- let(:hlr_b) { create(:higher_level_review, veteran_file_number: veteran_b.file_number) }
- let(:hlr_c) { create(:higher_level_review, veteran_file_number: veteran_c.file_number) }
+ let(:hlr_a) do
+ create(:higher_level_review, claimant_type: :veteran_claimant, veteran_file_number: veteran_a.file_number)
+ end
+ let(:hlr_b) do
+ create(:higher_level_review, claimant_type: :veteran_claimant, veteran_file_number: veteran_b.file_number)
+ end
+ let(:hlr_c) do
+ create(:higher_level_review, claimant_type: :veteran_claimant, veteran_file_number: veteran_c.file_number)
+ end
let(:appeal) { create(:appeal, veteran: veteran_c) }
let!(:request_issue_a) do
@@ -164,7 +170,7 @@ def current_table_rows
expect(page).to have_content(
Regexp.new(
/#{veteran_b.name} #{vet_b_id_column_value} 1/,
- /#{request_issue_b.decision_date.strftime("%m\/%d\/%y")} Higher-Level Review/
+ /#{hlr_b.request_issues.first.decision_date.strftime("%m\/%d\/%y")} Higher-Level Review/
)
)
end
@@ -565,10 +571,9 @@ def current_table_rows
let(:veteran_b) { create(:veteran, first_name: "B Veteran", participant_id: "66666", ssn: "140261455") }
let(:veteran_c) { create(:veteran, first_name: "C Veteran", participant_id: "77777", ssn: "140261456") }
let(:veteran_d) { create(:veteran, first_name: "D Veteran", participant_id: "88888", ssn: "140261457") }
- let(:hlr_a) { create(:higher_level_review, veteran_file_number: veteran_a.file_number) }
- let(:hlr_b) { create(:higher_level_review, veteran_file_number: veteran_b.file_number) }
- let(:hlr_c) { create(:higher_level_review, veteran_file_number: veteran_c.file_number) }
- let(:sc_a) { create(:supplemental_claim, veteran_file_number: veteran_d.file_number) }
+ let(:sc_a) do
+ create(:supplemental_claim, claimant_type: :veteran_claimant, veteran_file_number: veteran_d.file_number)
+ end
let!(:hlr_a_request_issues) do
[
diff --git a/spec/feature/queue/case_details_spec.rb b/spec/feature/queue/case_details_spec.rb
index 38086fbdf41..82c8c6383b9 100644
--- a/spec/feature/queue/case_details_spec.rb
+++ b/spec/feature/queue/case_details_spec.rb
@@ -569,7 +569,7 @@ def wait_for_page_render
visit "/queue/appeals/#{appeal.uuid}"
expect(page).to have_content("Refresh POA")
click_on "Refresh POA"
- expect(page).to have_content("POA Updated Successfully")
+ expect(page).to have_content(COPY::POA_UPDATED_SUCCESSFULLY)
expect(page).to have_content("POA last refreshed on 01/01/2020")
end
diff --git a/spec/feature/queue/vha_regional_queue_spec.rb b/spec/feature/queue/vha_regional_queue_spec.rb
index b200959969e..fe3a363f670 100644
--- a/spec/feature/queue/vha_regional_queue_spec.rb
+++ b/spec/feature/queue/vha_regional_queue_spec.rb
@@ -109,21 +109,21 @@ def a_normal_tab(expected_text)
let(:visn_in_progress) do
create(
- :assess_documentation_task_predocket,
+ :assess_documentation_task,
:in_progress,
assigned_to: visn_org
)
end
let(:visn_task_on_hold) do
create(
- :assess_documentation_task_predocket,
+ :assess_documentation_task,
:on_hold,
assigned_to: visn_org
)
end
let(:visn_task) do
create(
- :assess_documentation_task_predocket,
+ :assess_documentation_task,
:assigned,
assigned_to: visn_org
)
diff --git a/spec/models/certification_spec.rb b/spec/models/certification_spec.rb
index 7329f8f16e9..9e43cc99c9c 100644
--- a/spec/models/certification_spec.rb
+++ b/spec/models/certification_spec.rb
@@ -79,56 +79,6 @@
expect(certification.ssocs_matching_at).to be_nil
expect(certification.form8_started_at).to be_nil
end
-
- it "is included in the relevant certification_stats" do
- subject
-
- expect(Certification.was_missing_doc.count).to eq(1)
- expect(Certification.was_missing_nod.count).to eq(0)
- expect(Certification.was_missing_soc.count).to eq(0)
- expect(Certification.was_missing_ssoc.count).to eq(0)
- expect(Certification.was_missing_form9.count).to eq(1)
- end
- end
-
- context "when ssocs are mismatched" do
- let(:certification) do
- create(:certification, vacols_case: vacols_case_ssoc_mismatch)
- end
-
- let(:vacols_case_ssoc_mismatch) do
- create(:case_with_ssoc, bfssoc1: 1.month.ago)
- end
-
- it "is included in the relevant certification_stats" do
- subject
-
- expect(Certification.was_missing_doc.count).to eq(1)
- expect(Certification.was_missing_nod.count).to eq(0)
- expect(Certification.was_missing_soc.count).to eq(0)
- expect(Certification.was_missing_ssoc.count).to eq(1)
- expect(Certification.was_missing_form9.count).to eq(0)
- end
- end
-
- context "when multiple docs are mismatched" do
- let(:certification) do
- create(:certification, vacols_case: vacols_case_multiple_mismatch)
- end
-
- let(:vacols_case_multiple_mismatch) do
- create(:case, bfdnod: 1.month.ago, bfdsoc: 1.month.ago, bfd19: 3.months.ago, bfssoc1: 1.month.ago)
- end
-
- it "is included in the relevant certification_stats" do
- subject
-
- expect(Certification.was_missing_doc.count).to eq(1)
- expect(Certification.was_missing_nod.count).to eq(1)
- expect(Certification.was_missing_soc.count).to eq(1)
- expect(Certification.was_missing_ssoc.count).to eq(1)
- expect(Certification.was_missing_form9.count).to eq(1)
- end
end
context "when appeal is ready to start" do
@@ -152,11 +102,6 @@
expect(certification.form8_started_at).to eq(Time.zone.now)
end
- it "no ssoc does not trip missing ssoc stat" do
- subject
- expect(Certification.was_missing_ssoc.count).to eq(0)
- end
-
context "when appeal has ssoc" do
let(:certification) do
create(:certification, vacols_case: vacols_case)
@@ -241,34 +186,6 @@
end
end
- context "#time_to_certify" do
- subject { certification.time_to_certify }
-
- context "when not completed" do
- it { is_expected.to be_nil }
- end
-
- context "when completed" do
- context "when not created (in db)" do
- let(:certification) do
- build(:certification, vacols_case: vacols_case)
- end
-
- it "is_expected to be_nil" do
- expect(subject).to eq nil
- end
- end
-
- context "when created" do
- before { certification.update!(completed_at: 1.hour.from_now) }
-
- it "returns the time since certification started" do
- expect(subject).to eq(1.hour)
- end
- end
- end
- end
-
context ".complete!" do
let(:certification) do
create(:certification, :default_representative, vacols_case: vacols_case, hearing_preference: "VIDEO")
diff --git a/spec/models/claim_review_intake_spec.rb b/spec/models/claim_review_intake_spec.rb
index 4df69be0feb..820f566e986 100644
--- a/spec/models/claim_review_intake_spec.rb
+++ b/spec/models/claim_review_intake_spec.rb
@@ -4,7 +4,7 @@
let(:veteran_file_number) { "64205555" }
let(:user) { Generators::User.build }
let(:detail) { nil }
- let!(:veteran) { Generators::Veteran.build(file_number: "64205555") }
+ let!(:veteran) { Generators::Veteran.build(file_number: "64205555").save! }
let(:completed_at) { nil }
let(:completion_started_at) { nil }
diff --git a/spec/models/claim_review_spec.rb b/spec/models/claim_review_spec.rb
index e0af22d1789..cd661b30f5c 100644
--- a/spec/models/claim_review_spec.rb
+++ b/spec/models/claim_review_spec.rb
@@ -1064,7 +1064,10 @@ def epe
describe "#search_table_ui_hash" do
let!(:appeal) { create(:appeal) }
let!(:sc) do
- create(:supplemental_claim, veteran_file_number: appeal.veteran_file_number, number_of_claimants: 2)
+ create(:supplemental_claim,
+ veteran_file_number: appeal.veteran_file_number,
+ claimant_type: :dependent_claimant,
+ number_of_claimants: 2)
end
it "returns review type" do
diff --git a/spec/models/claimant_spec.rb b/spec/models/claimant_spec.rb
index a425f0b31c1..b6703c4c2b8 100644
--- a/spec/models/claimant_spec.rb
+++ b/spec/models/claimant_spec.rb
@@ -305,10 +305,6 @@
context "delegate name methods" do
let(:participant_id) { "" }
- let(:name) { "William Jennings Bryan" }
- let!(:bgs_attorney) do
- BgsAttorney.create!(participant_id: participant_id, name: name, record_type: "POA Attorney")
- end
let(:attorney_claimant) { create(:claimant, :attorney, participant_id: participant_id) }
let(:unrecognized_claimant) { create(:claimant, :with_unrecognized_appellant_detail) }
it "returns a nil for first, middle, and last name for an attorney claimant" do
@@ -325,7 +321,8 @@
expect(unrecognized_claimant.name).to eq("Tom Brady")
end
it "returns the correct name for an attorney claimant" do
- expect(attorney_claimant.name).to eq("William Jennings Bryan")
+ # This name value comes from the claimant factory
+ expect(attorney_claimant.name).to eq("Seeded AttyClaimant")
end
end
diff --git a/spec/models/higher_level_review_intake_spec.rb b/spec/models/higher_level_review_intake_spec.rb
index 9444666cdd2..543b573c50d 100644
--- a/spec/models/higher_level_review_intake_spec.rb
+++ b/spec/models/higher_level_review_intake_spec.rb
@@ -9,7 +9,7 @@
let(:veteran_file_number) { "64205555" }
let(:user) { Generators::User.build }
let(:detail) { nil }
- let!(:veteran) { Generators::Veteran.build(file_number: "64205555") }
+ let!(:veteran) { Generators::Veteran.build(file_number: "64205555").save! }
let(:completed_at) { nil }
let(:completion_started_at) { nil }
@@ -128,15 +128,8 @@
receipt_date: 3.days.ago,
legacy_opt_in_approved: legacy_opt_in_approved,
benefit_type: benefit_type,
- veteran_is_not_claimant: false
- )
- end
-
- let!(:claimant) do
- VeteranClaimant.create!(
- decision_review: detail,
- participant_id: veteran.participant_id,
- payee_code: "00"
+ veteran_is_not_claimant: false,
+ claimant_type: :veteran_claimant
)
end
@@ -165,7 +158,7 @@
end_product_code: "030HLRR",
gulf_war_registry: false,
suppress_acknowledgement_letter: false,
- claimant_participant_id: veteran.participant_id
+ claimant_participant_id: detail.claimant.participant_id
),
veteran_hash: intake.veteran.to_vbms_hash,
user: user
diff --git a/spec/models/request_issue_spec.rb b/spec/models/request_issue_spec.rb
index c65d2be57cd..725c89f593f 100644
--- a/spec/models/request_issue_spec.rb
+++ b/spec/models/request_issue_spec.rb
@@ -55,7 +55,11 @@
)
end
- let!(:veteran) { Generators::Veteran.build(file_number: "789987789") }
+ let(:veteran_file_number) { "789987789" }
+ let!(:veteran) do
+ Generators::Veteran.build(file_number: veteran_file_number).save!
+ Veteran.find_by(file_number: veteran_file_number)
+ end
let!(:decision_sync_processed_at) { nil }
let!(:end_product_establishment) { nil }
diff --git a/spec/models/serializers/work_queue/appeal_serializer_spec.rb b/spec/models/serializers/work_queue/appeal_serializer_spec.rb
index 0b956a037fb..790efc935c4 100644
--- a/spec/models/serializers/work_queue/appeal_serializer_spec.rb
+++ b/spec/models/serializers/work_queue/appeal_serializer_spec.rb
@@ -40,10 +40,6 @@
context "when an appeal has an attorney claimant" do
let(:participant_id) { "" }
- let!(:bgs_attorney) do
- BgsAttorney.create!(participant_id: participant_id,
- name: "William Jennings Bryan", record_type: "POA Attorney")
- end
let(:claimant) { create(:claimant, :attorney, participant_id: participant_id) }
let(:appeal) { create(:appeal, claimants: [claimant]) }
subject { described_class.new(appeal, params: { user: user }) }
diff --git a/spec/models/serializers/work_queue/board_grant_effectuation_task_serializer_spec.rb b/spec/models/serializers/work_queue/board_grant_effectuation_task_serializer_spec.rb
index 4babbc198a4..de96b67ba9b 100644
--- a/spec/models/serializers/work_queue/board_grant_effectuation_task_serializer_spec.rb
+++ b/spec/models/serializers/work_queue/board_grant_effectuation_task_serializer_spec.rb
@@ -15,8 +15,25 @@
id: task.id.to_s,
type: :board_grant_effectuation_task,
attributes: {
+ has_poa: true,
claimant: { name: appeal.veteran_full_name, relationship: "self" },
- appeal: { id: appeal.external_id, isLegacyAppeal: false, issueCount: 0, activeRequestIssues: [] },
+ appeal: {
+ id: appeal.external_id,
+ isLegacyAppeal: false,
+ issueCount: 0,
+ activeRequestIssues: [],
+ uuid: appeal.uuid,
+ appellant_type: appeal.claimant.type
+ },
+ power_of_attorney: {
+ representative_address: appeal&.representative_address,
+ representative_email_address: appeal&.representative_email_address,
+ representative_name: appeal&.representative_name,
+ representative_type: appeal&.representative_type,
+ representative_tz: appeal&.representative_tz,
+ poa_last_synced_at: appeal&.poa_last_synced_at
+ },
+ appellant_type: appeal.claimant.type,
veteran_participant_id: veteran.participant_id,
veteran_ssn: veteran.ssn,
assigned_on: task.assigned_at,
@@ -50,8 +67,25 @@
id: task.id.to_s,
type: :board_grant_effectuation_task,
attributes: {
+ has_poa: true,
claimant: { name: "claimant", relationship: "Unknown" },
- appeal: { id: appeal.external_id, isLegacyAppeal: false, issueCount: 0, activeRequestIssues: [] },
+ appeal: {
+ id: appeal.external_id,
+ isLegacyAppeal: false,
+ issueCount: 0,
+ activeRequestIssues: [],
+ uuid: appeal.uuid,
+ appellant_type: appeal.claimant.type
+ },
+ appellant_type: appeal.claimant.type,
+ power_of_attorney: {
+ representative_address: appeal&.representative_address,
+ representative_email_address: appeal&.representative_email_address,
+ representative_name: appeal&.representative_name,
+ representative_type: appeal&.representative_type,
+ representative_tz: appeal&.representative_tz,
+ poa_last_synced_at: appeal&.poa_last_synced_at
+ },
veteran_participant_id: veteran.participant_id,
veteran_ssn: veteran.ssn,
assigned_on: task.assigned_at,
@@ -90,8 +124,25 @@
id: task.id.to_s,
type: :board_grant_effectuation_task,
attributes: {
+ has_poa: true,
claimant: { name: claimant.name, relationship: "Veteran" },
- appeal: { id: appeal.external_id, isLegacyAppeal: false, issueCount: 0, activeRequestIssues: [] },
+ appeal: {
+ id: appeal.external_id,
+ isLegacyAppeal: false,
+ issueCount: 0,
+ activeRequestIssues: [],
+ uuid: appeal.uuid,
+ appellant_type: appeal.claimant.type
+ },
+ appellant_type: appeal.claimant.type,
+ power_of_attorney: {
+ representative_address: appeal&.representative_address,
+ representative_email_address: appeal&.representative_email_address,
+ representative_name: appeal&.representative_name,
+ representative_type: appeal&.representative_type,
+ representative_tz: appeal&.representative_tz,
+ poa_last_synced_at: appeal&.poa_last_synced_at
+ },
veteran_participant_id: veteran.participant_id,
veteran_ssn: veteran.ssn,
assigned_on: task.assigned_at,
diff --git a/spec/models/serializers/work_queue/decision_review_task_serializer_spec.rb b/spec/models/serializers/work_queue/decision_review_task_serializer_spec.rb
index cf4e368b75d..4f74831e6b6 100644
--- a/spec/models/serializers/work_queue/decision_review_task_serializer_spec.rb
+++ b/spec/models/serializers/work_queue/decision_review_task_serializer_spec.rb
@@ -2,26 +2,50 @@
describe WorkQueue::DecisionReviewTaskSerializer, :postgres do
let(:veteran) { create(:veteran) }
- let(:hlr) { create(:higher_level_review, veteran_file_number: veteran.file_number) }
+ let(:claimant_type) { :none }
+ let(:hlr) do
+ create(:higher_level_review,
+ benefit_type: nil,
+ veteran_file_number: veteran.file_number,
+ claimant_type: claimant_type)
+ end
let!(:non_comp_org) { create(:business_line, name: "Non-Comp Org", url: "nco") }
let(:task) { create(:higher_level_review_task, appeal: hlr, assigned_to: non_comp_org) }
subject { described_class.new(task) }
describe "#as_json" do
+ let(:claimant_type) { :veteran_claimant }
it "renders ready for client consumption" do
serializable_hash = {
id: task.id.to_s,
type: :decision_review_task,
attributes: {
+ has_poa: true,
claimant: { name: hlr.veteran_full_name, relationship: "self" },
- appeal: { id: hlr.id.to_s, isLegacyAppeal: false, issueCount: 0, activeRequestIssues: [] },
+ appeal: {
+ id: hlr.id.to_s,
+ isLegacyAppeal: false,
+ issueCount: 0,
+ activeRequestIssues: [],
+ uuid: task.appeal.uuid,
+ appellant_type: "VeteranClaimant"
+ },
+ power_of_attorney: {
+ representative_address: hlr&.representative_address,
+ representative_email_address: hlr&.representative_email_address,
+ representative_name: hlr&.representative_name,
+ representative_type: hlr&.representative_type,
+ representative_tz: hlr&.representative_tz,
+ poa_last_synced_at: hlr&.poa_last_synced_at
+ },
veteran_ssn: veteran.ssn,
veteran_participant_id: veteran.participant_id,
assigned_on: task.assigned_at,
assigned_at: task.assigned_at,
closed_at: task.closed_at,
started_at: task.started_at,
+ appellant_type: "VeteranClaimant",
tasks_url: "/decision_reviews/nco",
id: task.id,
created_at: task.created_at,
@@ -44,8 +68,17 @@
id: task.id.to_s,
type: :decision_review_task,
attributes: {
+ has_poa: false,
claimant: { name: "claimant", relationship: "Unknown" },
- appeal: { id: hlr.id.to_s, isLegacyAppeal: false, issueCount: 0, activeRequestIssues: [] },
+ appeal: {
+ id: hlr.id.to_s,
+ isLegacyAppeal: false,
+ issueCount: 0,
+ activeRequestIssues: [],
+ uuid: task.appeal.uuid,
+ appellant_type: nil
+ },
+ power_of_attorney: hlr.claimant&.power_of_attorney,
veteran_ssn: veteran.ssn,
veteran_participant_id: veteran.participant_id,
assigned_on: task.assigned_at,
@@ -55,6 +88,7 @@
tasks_url: "/decision_reviews/nco",
id: task.id,
created_at: task.created_at,
+ appellant_type: nil,
issue_count: 0,
issue_types: "",
type: "Higher-Level Review",
@@ -84,15 +118,32 @@
id: task.id.to_s,
type: :decision_review_task,
attributes: {
+ has_poa: true,
claimant: { name: claimant.name, relationship: "Veteran" },
- appeal: { id: hlr.id.to_s, isLegacyAppeal: false, issueCount: 0, activeRequestIssues: [] },
+ appeal: {
+ id: hlr.id.to_s,
+ isLegacyAppeal: false,
+ issueCount: 0,
+ activeRequestIssues: [],
+ uuid: task.appeal.uuid,
+ appellant_type: claimant.type
+ },
veteran_ssn: veteran.ssn,
+ power_of_attorney: {
+ representative_address: hlr&.representative_address,
+ representative_email_address: hlr&.representative_email_address,
+ representative_name: hlr&.representative_name,
+ representative_type: hlr&.representative_type,
+ representative_tz: hlr&.representative_tz,
+ poa_last_synced_at: hlr&.poa_last_synced_at
+ },
veteran_participant_id: veteran.participant_id,
assigned_on: task.assigned_at,
assigned_at: task.assigned_at,
closed_at: task.closed_at,
started_at: task.started_at,
tasks_url: "/decision_reviews/nco",
+ appellant_type: "VeteranClaimant",
id: task.id,
created_at: task.created_at,
issue_count: 0,
@@ -106,10 +157,9 @@
end
context "decision review with multiple issues with multiple issue categories" do
+ let(:claimant_type) { :veteran_claimant }
+ let(:benefit_type) { "vha" }
let!(:vha_org) { create(:business_line, name: "Veterans Health Administration", url: "vha") }
- let(:hlr) do
- create(:higher_level_review_vha_task).appeal
- end
let(:request_issues) do
[
create(:request_issue, benefit_type: "vha", nonrating_issue_category: "Beneficiary Travel"),
@@ -127,9 +177,25 @@
id: task.id.to_s,
type: :decision_review_task,
attributes: {
+ has_poa: true,
claimant: { name: hlr.veteran_full_name, relationship: "self" },
- appeal: { id: hlr.id.to_s, isLegacyAppeal: false, issueCount: 3, activeRequestIssues: serialized_issues },
+ appeal: {
+ id: hlr.id.to_s,
+ isLegacyAppeal: false,
+ issueCount: 2,
+ activeRequestIssues: serialized_issues,
+ appellant_type: "VeteranClaimant",
+ uuid: task.appeal.uuid
+ },
veteran_ssn: hlr.veteran.ssn,
+ power_of_attorney: {
+ representative_address: hlr&.representative_address,
+ representative_email_address: hlr&.representative_email_address,
+ representative_name: hlr&.representative_name,
+ representative_type: hlr&.representative_type,
+ representative_tz: hlr&.representative_tz,
+ poa_last_synced_at: hlr&.poa_last_synced_at
+ },
veteran_participant_id: hlr.veteran.participant_id,
assigned_on: task.assigned_at,
assigned_at: task.assigned_at,
@@ -138,10 +204,11 @@
tasks_url: "/decision_reviews/nco",
id: task.id,
created_at: task.created_at,
- issue_count: 3,
+ issue_count: 2,
issue_types: hlr.request_issues.active.pluck(:nonrating_issue_category).join(","),
type: "Higher-Level Review",
- business_line: non_comp_org.url
+ business_line: non_comp_org.url,
+ appellant_type: "VeteranClaimant"
}
}
expect(subject.serializable_hash[:data]).to eq(serializable_hash)
diff --git a/spec/models/serializers/work_queue/veteran_record_request_serializer_spec.rb b/spec/models/serializers/work_queue/veteran_record_request_serializer_spec.rb
index 6568053abf3..990caf7f5c2 100644
--- a/spec/models/serializers/work_queue/veteran_record_request_serializer_spec.rb
+++ b/spec/models/serializers/work_queue/veteran_record_request_serializer_spec.rb
@@ -14,8 +14,18 @@
id: task.id.to_s,
type: :veteran_record_request,
attributes: {
+ has_poa: true,
claimant: { name: appeal.veteran_full_name, relationship: "self" },
appeal: { id: appeal.uuid.to_s, isLegacyAppeal: false, issueCount: 0 },
+ power_of_attorney: {
+ representative_address: appeal&.representative_address,
+ representative_email_address: appeal&.representative_email_address,
+ representative_name: appeal&.representative_name,
+ representative_type: appeal&.representative_type,
+ representative_tz: appeal&.representative_tz,
+ poa_last_synced_at: appeal&.poa_last_synced_at
+ },
+ appellant_type: appeal.claimant.type,
veteran_ssn: veteran.ssn,
veteran_participant_id: veteran.participant_id,
assigned_on: task.assigned_at,
@@ -29,9 +39,9 @@
issue_types: "",
type: "Record Request",
business_line: non_comp_org.url
-
}
}
+
expect(subject.serializable_hash[:data]).to eq(serializable_hash)
end
end
diff --git a/spec/models/supplemental_claim_intake_spec.rb b/spec/models/supplemental_claim_intake_spec.rb
index f83fbc6e142..5680e46766f 100644
--- a/spec/models/supplemental_claim_intake_spec.rb
+++ b/spec/models/supplemental_claim_intake_spec.rb
@@ -9,7 +9,7 @@
let(:veteran_file_number) { "64205555" }
let(:user) { Generators::User.build }
let(:detail) { nil }
- let!(:veteran) { Generators::Veteran.build(file_number: "64205555") }
+ let!(:veteran) { Generators::Veteran.build(file_number: "64205555").save! }
let(:completed_at) { nil }
let(:completion_started_at) { nil }
@@ -94,16 +94,9 @@
veteran_file_number: "64205555",
receipt_date: 3.days.ago,
benefit_type: benefit_type,
- legacy_opt_in_approved: legacy_opt_in_approved
- )
- end
-
- let!(:claimant) do
- create(
- :claimant,
- decision_review: detail,
- payee_code: "00",
- participant_id: "1234"
+ legacy_opt_in_approved: legacy_opt_in_approved,
+ veteran_is_not_claimant: true,
+ claimant_type: :other_claimant
)
end
@@ -132,7 +125,7 @@
end_product_code: "040SCR",
gulf_war_registry: false,
suppress_acknowledgement_letter: false,
- claimant_participant_id: claimant.participant_id,
+ claimant_participant_id: detail.claimant.participant_id,
limited_poa_code: nil,
limited_poa_access: nil,
status_type_code: "PEND"
diff --git a/spec/models/tasks/decision_review_task_spec.rb b/spec/models/tasks/decision_review_task_spec.rb
index ee55a2bb6de..af24b2c94b8 100644
--- a/spec/models/tasks/decision_review_task_spec.rb
+++ b/spec/models/tasks/decision_review_task_spec.rb
@@ -22,9 +22,9 @@
let(:hlr) do
create(
:higher_level_review,
- number_of_claimants: 1,
veteran_file_number: veteran.file_number,
- benefit_type: benefit_type
+ benefit_type: benefit_type,
+ claimant_type: :veteran_claimant
)
end
let(:trait) { :assigned }
@@ -104,7 +104,9 @@
shared_context "decision review task assigned to business line" do
let(:veteran) { create(:veteran) }
- let(:hlr) { create(:higher_level_review, veteran_file_number: veteran.file_number) }
+ let(:hlr) do
+ create(:higher_level_review, claimant_type: :veteran_claimant, veteran_file_number: veteran.file_number)
+ end
let(:business_line) { create(:business_line, name: "National Cemetery Administration", url: "nca") }
let(:decision_review_task) { create(:higher_level_review_task, appeal: hlr, assigned_to: business_line) }
@@ -117,7 +119,16 @@
it "includes only key-values within serialize_task[:data][:attributes]" do
serialized_hash = {
- appeal: { id: hlr.id.to_s, isLegacyAppeal: false, issueCount: 0, activeRequestIssues: [] },
+ appeal: {
+ id: hlr.id.to_s,
+ isLegacyAppeal: false,
+ issueCount: 0,
+ activeRequestIssues: [],
+ appellant_type: "VeteranClaimant",
+ uuid: hlr.uuid
+ },
+ power_of_attorney: power_of_attorney,
+ appellant_type: "VeteranClaimant",
started_at: decision_review_task.started_at,
tasks_url: business_line.tasks_url,
id: decision_review_task.id,
@@ -131,9 +142,9 @@
issue_types: "",
type: "Higher-Level Review",
claimant: { name: hlr.veteran_full_name, relationship: "self" },
- business_line: business_line.url
+ business_line: business_line.url,
+ has_poa: true
}
-
expect(subject).to eq serialized_hash
expect(subject.key?(:attributes)).to eq false
end
@@ -150,7 +161,16 @@
type: :decision_review_task,
attributes: {
claimant: { name: hlr.veteran_full_name, relationship: "self" },
- appeal: { id: hlr.id.to_s, isLegacyAppeal: false, issueCount: 0, activeRequestIssues: [] },
+ appeal: {
+ id: hlr.id.to_s,
+ isLegacyAppeal: false,
+ issueCount: 0,
+ activeRequestIssues: [],
+ uuid: hlr.uuid,
+ appellant_type: "VeteranClaimant"
+ },
+ appellant_type: "VeteranClaimant",
+ power_of_attorney: power_of_attorney,
veteran_participant_id: veteran.participant_id,
veteran_ssn: veteran.ssn,
assigned_on: decision_review_task.assigned_at,
@@ -163,7 +183,8 @@
issue_count: 0,
issue_types: "",
type: "Higher-Level Review",
- business_line: business_line.url
+ business_line: business_line.url,
+ has_poa: true
}
}
@@ -171,4 +192,15 @@
expect(subject.key?(:attributes)).to eq true
end
end
+
+ def power_of_attorney
+ {
+ representative_type: decision_review_task.appeal.representative_type,
+ representative_name: decision_review_task.appeal.representative_name,
+ representative_address: decision_review_task.appeal.representative_address,
+ representative_email_address: decision_review_task.appeal.representative_email_address,
+ representative_tz: decision_review_task.appeal.representative_tz,
+ poa_last_synced_at: decision_review_task.appeal.poa_last_synced_at
+ }
+ end
end
diff --git a/spec/workflows/end_product_code_selector_spec.rb b/spec/workflows/end_product_code_selector_spec.rb
index a767c36b9db..4512d731fbd 100644
--- a/spec/workflows/end_product_code_selector_spec.rb
+++ b/spec/workflows/end_product_code_selector_spec.rb
@@ -159,11 +159,6 @@
decision_date: decision_date
)
end
- let(:date_of_death) { nil }
- let!(:veteran) do
- create(:veteran, file_number: decision_review.veteran_file_number,
- date_of_death: date_of_death)
- end
it "returns the ITF EP code" do
expect(subject).to eq("040SCRGTY")
@@ -172,6 +167,10 @@
context "when the veteran is deceased" do
let(:date_of_death) { Time.zone.yesterday }
+ before do
+ decision_review.veteran.update!(date_of_death: date_of_death)
+ end
+
it "returns the non-ITF EP code" do
expect(subject).to eq("040SCR")
end
|