Class: BGS::Form674
Instance Attribute Summary collapse
Instance Method Summary
collapse
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Constructor Details
#initialize(user, saved_claim) ⇒ Form674
Returns a new instance of Form674.
19
20
21
22
23
24
25
|
# File 'lib/bgs/form674.rb', line 19
def initialize(user, saved_claim)
@user = user
@proc_id = vnp_proc_id
@saved_claim = saved_claim
@end_product_name = '130 - Automated School Attendance 674'
@end_product_code = '130SCHATTEBN'
end
|
Instance Attribute Details
#proc_id ⇒ Object
Returns the value of attribute proc_id.
17
18
19
|
# File 'lib/bgs/form674.rb', line 17
def proc_id
@proc_id
end
|
#saved_claim ⇒ Object
Returns the value of attribute saved_claim.
17
18
19
|
# File 'lib/bgs/form674.rb', line 17
def saved_claim
@saved_claim
end
|
#user ⇒ Object
Returns the value of attribute user.
17
18
19
|
# File 'lib/bgs/form674.rb', line 17
def user
@user
end
|
Instance Method Details
#benefit_claim_args(vnp_benefit_claim_record, veteran) ⇒ Object
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/bgs/form674.rb', line 59
def benefit_claim_args(vnp_benefit_claim_record, veteran)
{
vnp_benefit_claim: vnp_benefit_claim_record,
veteran:,
user:,
proc_id:,
end_product_name: @end_product_name,
end_product_code: @end_product_code
}
end
|
#bgs_service ⇒ Object
137
138
139
|
# File 'lib/bgs/form674.rb', line 137
def bgs_service
BGS::Service.new(@user)
end
|
#bid_service ⇒ Object
141
142
143
|
# File 'lib/bgs/form674.rb', line 141
def bid_service
BID::Awards::Service.new(@user)
end
|
#log_submit_failure(error) ⇒ Object
127
128
129
130
131
132
133
134
135
|
# File 'lib/bgs/form674.rb', line 127
def log_submit_failure(error)
Rails.logger.warning('BGS::Form674.submit failed after creating benefit claim in BGS',
{
user_uuid: user.uuid,
saved_claim_id: saved_claim.id,
icn: user.icn,
error: error.message
})
end
|
#process_674(proc_id, dependent, payload) ⇒ Object
84
85
86
87
88
89
90
91
|
# File 'lib/bgs/form674.rb', line 84
def process_674(proc_id, dependent, payload)
StudentSchool.new(
proc_id:,
vnp_participant_id: dependent[:vnp_participant_id],
payload:,
user: @user
).create
end
|
#process_relationships(proc_id, veteran, payload) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/bgs/form674.rb', line 70
def process_relationships(proc_id, veteran, payload)
dependent = DependentHigherEdAttendance.new(proc_id:, payload:, user: @user).create
VnpRelationships.new(
proc_id:,
veteran:,
dependents: [dependent],
step_children: [],
user: @user
).create_all
process_674(proc_id, dependent, payload)
end
|
#set_claim_type(proc_state) ⇒ Object
the default claim type is 130SCHATTEBN (eBenefits School Attendance) if we are setting the claim to be manually reviewed (we are temporarily doing this for all submissions) and the Veteran is currently receiving pension benefits set the claim type to 130SCAEBPMCR (PMC eBenefits School Attendance Reject) else use 130SCHEBNREJ (eBenefits School Attendance Reject)
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# File 'lib/bgs/form674.rb', line 108
def set_claim_type(proc_state)
if proc_state == 'MANUAL_VAGOV'
receiving_pension = false
if Flipper.enabled?(:dependents_pension_check)
pension_response = bid_service.get_awards_pension
receiving_pension = pension_response.body['awards_pension']['is_in_receipt_of_pension']
end
if receiving_pension
@end_product_name = 'PMC eBenefits School Attendance Reject'
@end_product_code = '130SCAEBPMCR'
else
@end_product_name = 'eBenefits School Attendance Reject'
@end_product_code = '130SCHEBNREJ'
end
end
end
|
#submit(payload) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/bgs/form674.rb', line 27
def submit(payload)
veteran = VnpVeteran.new(proc_id:, payload:, user:, claim_type: '130SCHATTEBN').create
process_relationships(proc_id, veteran, payload)
vnp_benefit_claim = VnpBenefitClaim.new(proc_id:, veteran:, user:)
vnp_benefit_claim_record = vnp_benefit_claim.create
set_claim_type('MANUAL_VAGOV')
log_message_to_sentry("#{proc_id} - #{@end_product_code}", :warn, '', { team: 'vfs-ebenefits' })
benefit_claim_record = BenefitClaim.new(args: benefit_claim_args(vnp_benefit_claim_record, veteran)).create
begin
vnp_benefit_claim.update(benefit_claim_record, vnp_benefit_claim_record)
note_text = 'Claim set to manual by VA.gov: This application needs manual review because a 674 was submitted.'
bgs_service.create_note(benefit_claim_record[:benefit_claim_id], note_text)
bgs_service.update_proc(proc_id, proc_state: 'MANUAL_VAGOV')
rescue
log_submit_failure(error)
end
end
|
#vnp_proc_id ⇒ Object
93
94
95
96
97
98
99
100
101
|
# File 'lib/bgs/form674.rb', line 93
def vnp_proc_id
vnp_response = bgs_service.create_proc(proc_state: 'MANUAL_VAGOV')
bgs_service.create_proc_form(
vnp_response[:vnp_proc_id],
'21-674'
)
vnp_response[:vnp_proc_id]
end
|