@@ -6,161 +6,158 @@ class Va2210272 < FormBase
66 include FormHelper
77 include FormHelper ::PhoneNumberFormatting
88
9+ BENEFIT_PROGRAMS = %w[ chapter33 chapter35 ] . freeze
10+
11+ # rubocop:disable Layout/LineLength
912 KEY = {
13+ 'vaBenefitProgram' => {
14+ key : 'vaBenefitProgram' ,
15+ question_text : 'Select the education benefit under which you are requesting Prep Course fee reimbursement' ,
16+ question_num : 0 ,
17+ 'chapter33' => {
18+ key : 'chapter33' ,
19+ question_text : 'Post-9/11 GI Bill Including Transfer of Entitlement and Fry Scholarship Recipients (Chapter 33)'
20+ } ,
21+ 'chapter35' => {
22+ key : 'chapter35' ,
23+ question_text : 'Survivors\' and Dependents\' Educational Assistance Program (DEA) (Chapter 35)'
24+ }
25+ } ,
1026 'applicantName' => {
1127 key : 'applicantName' ,
1228 question_text : 'APPLICANT\'S NAME (First, Middle Initial, Last Name)' ,
1329 question_num : 1 ,
14- limit : 54
30+ limit : 118
1531 } ,
16- 'address' => {
17- 'mailing' => {
18- key : 'mailingAddress' ,
19- question_text : 'MAILING ADDRESS (Complete Street Address, City, State and 9-Digit ZIP Code)' ,
20- question_num : 2 ,
21- question_suffix : 'A' ,
22- limit : 340 ,
23- multiline_limit : 4
24- } ,
25- 'email' => {
26- key : 'emailAddress' ,
27- question_text : 'APPLICANT\'S EMAIL ADDRESS' ,
28- question_num : 2 ,
29- question_suffix : 'B' ,
30- limit : 65
31- }
32+ 'mailingAddress' => {
33+ key : 'mailingAddress' ,
34+ question_text : 'MAILING ADDRESS (Complete Street Address, City, State and 9-Digit ZIP Code)' ,
35+ question_num : 2 ,
36+ limit : 280 ,
37+ multiline_limit : 4
38+ } ,
39+ 'emailAddress' => {
40+ key : 'emailAddress' ,
41+ question_text : 'APPLICANT\'S EMAIL ADDRESS' ,
42+ question_num : 3 ,
43+ limit : 54
3244 } ,
3345 'phone' => {
3446 question_text : 'TELEPHONE NUMBER (Include Area Code)' ,
35- 'homePhone' => {
36- key : 'homePhone' ,
37- question_text : 'HOME' ,
38- question_num : 3 ,
39- question_suffix : 'A' ,
40- limit : 32
41- } ,
4247 'mobilePhone' => {
4348 key : 'mobilePhone' ,
4449 question_text : 'MOBILE' ,
45- question_num : 3 ,
50+ question_num : 4 ,
51+ question_suffix : 'A' ,
52+ limit : 26
53+ } ,
54+ 'homePhone' => {
55+ key : 'homePhone' ,
56+ question_text : 'HOME' ,
57+ question_num : 4 ,
4658 question_suffix : 'B' ,
47- limit : 46
59+ limit : 34
4860 }
4961 } ,
5062 'vaFileNumber' => {
5163 key : 'vaFileNumber' ,
52- question_text : 'VA FILE NUMBER' ,
53- question_num : 4 ,
54- limit : 42
55- } ,
56- 'payeeNumber' => {
57- key : 'payeeNumber' ,
58- question_text : 'PAYEE NUMBER (if applicable)' ,
64+ question_text : 'VA FILE NUMBER (For chapter 35, enter the Veteran\'s file number and your Payee Number)' ,
5965 question_num : 5 ,
60- limit : 42
66+ limit : 70
6167 } ,
6268 'hasPreviouslyApplied' => {
63- question_text : 'HAVE YOU PREVIOUSLY APPLIED' ,
69+ question_text : 'HAVE YOU PREVIOUSLY APPLIED FOR VA EDUCATION BENEFITS? (Please check the appropriate box below:) ' ,
6470 question_num : 6 ,
65- question_suffix : 'A' ,
66- 'hasPreviouslyAppliedYes' => {
71+ 'yes' => {
6772 key : 'hasPreviouslyAppliedYes' ,
6873 question_text : 'YES'
6974 } ,
70- 'hasPreviouslyAppliedNo ' => {
75+ 'no ' => {
7176 key : 'hasPreviouslyAppliedNo' ,
7277 question_text : 'NO'
7378 }
7479 } ,
75- 'vaBenefitProgram' => {
76- key : 'vaBenefitProgram' ,
77- question_text : 'WHAT EDUCATION BENEFIT(S) HAVE YOU APPLIED FOR PREVIOUSLY?' ,
78- question_num : 6 ,
79- question_suffix : 'B' ,
80- limit : 87
81- } ,
8280 'testName' => {
8381 key : 'testName' ,
84- question_text : 'NAME OF TEST' ,
82+ question_text : 'NAME OF TEST FOR WHICH THE PREP COURSE WILL PREPARE YOU ' ,
8583 question_num : 7 ,
86- limit : 87
84+ limit : 70
8785 } ,
8886 'orgNameAndAddress' => {
8987 key : 'orgNameAndAddress' ,
90- question_text : 'NAME OF ORGANIZATION AWARDING LICENSE OR CERTIFICATION (Include address) ' ,
88+ question_text : 'NAME AND ADDRESS OF ORGANIZATION AWARDING LICENSE OR CERTIFICATION' ,
9189 question_num : 8 ,
92- limit : 340 ,
90+ limit : 280 ,
9391 multiline_limit : 4
9492 } ,
9593 'prepCourseName' => {
9694 key : 'prepCourseName' ,
97- question_text : 'NAME OF COURSE' ,
95+ question_text : 'NAME OF PREP COURSE' ,
9896 question_num : 9 ,
99- limit : 46 ,
97+ limit : 76 ,
10098 multiline_limit : 2
10199 } ,
102100 'prepCourseOrgNameAndAddress' => {
103101 key : 'prepCourseOrgNameAndAddress' ,
104- question_text : 'ORGANIZATION GIVING PREP COURSE (Please include address) ' ,
102+ question_text : 'NAME AND ADDRESS OF ORGANIZATION GIVING PREP COURSE' ,
105103 question_num : 10 ,
106- question_suffix : 'A' ,
107- limit : 234 ,
108- multiline_limit : 5
104+ limit : 448 ,
105+ multiline_limit : 14
106+ } ,
107+ 'prepCourseCost' => {
108+ key : 'prepCourseCost' ,
109+ question_text : 'TOTAL PREP COURSE COST INCLUDING MANDATORY FEES (You must attach a receipt)' ,
110+ question_num : 11 ,
111+ limit : 38
109112 } ,
110113 'prepCourseTakenOnline' => {
111114 question_text : 'TAKEN ONLINE?' ,
112- question_num : 10 ,
113- question_suffix : 'B ' ,
114- 'prepCourseTakenOnlineYes ' => {
115+ question_num : 12 ,
116+ question_suffix : 'A ' ,
117+ 'yes ' => {
115118 key : 'prepCourseTakenOnlineYes' ,
116119 question_text : 'YES'
117120 } ,
118- 'prepCourseTakenOnlineNo ' => {
121+ 'no ' => {
119122 key : 'prepCourseTakenOnlineNo' ,
120123 question_text : 'NO'
121124 }
122125 } ,
123126 'prepCourseStartDate' => {
124127 key : 'prepCourseStartDate' ,
125128 question_text : 'COURSE START DATE (MM/DD/YYYY)' ,
126- question_num : 11 ,
127- question_suffix : 'A ' ,
128- limit : 24
129+ question_num : 12 ,
130+ question_suffix : 'B ' ,
131+ limit : 19
129132 } ,
130133 'prepCourseEndDate' => {
131134 key : 'prepCourseEndDate' ,
132135 question_text : 'COURSE END DATE (MM/DD/YYYY)' ,
133- question_num : 11 ,
134- question_suffix : 'B' ,
135- limit : 23
136- } ,
137- 'prepCourseCost' => {
138- key : 'prepCourseCost' ,
139- question_text : 'ITEMIZE PREP COURSE COST INCLUDING FEES (Attach receipt)' ,
140136 question_num : 12 ,
141- limit : 524 ,
142- multiline_limit : 14
137+ question_suffix : 'C' ,
138+ limit : 19
143139 } ,
144140 'remarks' => {
145141 key : 'remarks' ,
146142 question_text : 'REMARKS' ,
147143 question_num : 14 ,
148- limit : 3200 ,
144+ limit : 2590 ,
149145 multiline_limit : 37
150146 } ,
151147 'statementOfTruthSignature' => {
152148 key : 'statementOfTruthSignature' ,
153149 question_text : 'SIGNATURE OF APPLICANT' ,
154150 question_num : 15 ,
155- limit : 65
151+ limit : 52
156152 } ,
157153 'dateSigned' => {
158154 key : 'dateSigned' ,
159155 question_text : 'DATE SIGNED (MM/DD/YYYY)' ,
160156 question_num : 16 ,
161- limit : 20
157+ limit : 16
162158 }
163159 } . freeze
160+ # rubocop:enable Layout/LineLength
164161
165162 def merge_fields ( _options = { } )
166163 merge_identification_helpers
@@ -176,8 +173,9 @@ def merge_fields(_options = {})
176173
177174 def merge_identification_helpers
178175 format_applicant_name ( @form_data [ 'applicantName' ] )
179- format_address ( @form_data [ 'mailingAddress' ] . dup )
176+ format_address ( @form_data [ 'mailingAddress' ] )
180177 format_phone
178+ format_va_file_number
181179 end
182180
183181 def format_applicant_name ( name )
@@ -186,22 +184,29 @@ def format_applicant_name(name)
186184 @form_data [ 'applicantName' ] = combine_full_name ( name )
187185 end
188186
189- def format_address ( mailing_address )
190- normalize_mailing_address ( mailing_address )
191- @form_data [ 'address' ] = {
192- 'mailing' => combine_full_address_extras ( mailing_address ) ,
193- 'email' => @form_data [ 'emailAddress' ]
194- }
187+ def format_address ( address )
188+ @country = address [ 'country' ]
189+ normalize_mailing_address ( address )
190+ @form_data [ 'mailingAddress' ] = combine_full_address_extras ( address )
195191 end
196192
197193 def format_phone
198194 @form_data [ 'phone' ] = @form_data . slice ( 'homePhone' , 'mobilePhone' )
199- country = @form_data [ 'mailingAddress' ] [ 'country' ]
200- @form_data [ 'phone' ] . transform_values! ( &method ( :format_us_phone ) ) if domestic? ( country )
195+ @form_data [ 'phone' ] . transform_values! ( &method ( :format_us_phone ) ) if domestic? ( @country )
196+ end
197+
198+ def format_va_file_number
199+ append_payee_number = @form_data [ 'vaFileNumber' ] . present? && @form_data [ 'vaBenefitProgram' ] == 'chapter35'
200+ @form_data [ 'vaFileNumber' ] = if append_payee_number
201+ "#{ format_ssn ( @form_data [ 'vaFileNumber' ] ) } #{ @form_data [ 'payeeNumber' ] } "
202+ else
203+ format_ssn ( @form_data [ 'ssn' ] || @form_data [ 'vaFileNumber' ] )
204+ end
201205 end
202206
203207 def merge_education_helpers
204208 format_yes_no_checkbox ( 'hasPreviouslyApplied' )
209+ format_benefit_program_checkbox
205210 end
206211
207212 def merge_licensing_helpers
@@ -222,11 +227,20 @@ def merge_prep_course_helpers
222227 def format_yes_no_checkbox ( boolean_key )
223228 flag = @form_data [ boolean_key ]
224229 @form_data [ boolean_key ] = {
225- " #{ boolean_key } Yes" => flag ? 'Yes' : 'Off' ,
226- " #{ boolean_key } No" => flag ? 'Off' : 'Yes'
230+ 'yes' => flag ? 'Yes' : 'Off' ,
231+ 'no' => flag ? 'Off' : 'Yes'
227232 }
228233 end
229234
235+ def format_benefit_program_checkbox
236+ selected_program = @form_data . delete ( 'vaBenefitProgram' )
237+ @form_data [ 'vaBenefitProgram' ] = { }
238+ BENEFIT_PROGRAMS . each do |program |
239+ flag = program == selected_program
240+ @form_data [ 'vaBenefitProgram' ] [ program ] = flag ? 'Yes' : 'Off'
241+ end
242+ end
243+
230244 def merge_date_helpers
231245 %w[ prepCourseStartDate prepCourseEndDate dateSigned ] . each ( &method ( :format_date ) )
232246 end
@@ -235,6 +249,10 @@ def format_date(key)
235249 str = @form_data [ key ]
236250 @form_data [ key ] = str . to_date . strftime ( self . class . date_strftime )
237251 end
252+
253+ def format_ssn ( ssn )
254+ split_ssn ( ssn ) . values . join ( '-' )
255+ end
238256 end
239257 end
240258end
0 commit comments