era_835_parser 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ module Era835Parser
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,633 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Era835Parser::Parser do
4
+
5
+ describe '#parse' do
6
+ before :all do
7
+ @era = Era835Parser::Parser.new(file_path: "../era_835_parser/spec/test_era.txt").parse
8
+ end
9
+
10
+ # context 'Aggregate totals' do
11
+ # it 'returns the correct number of checks' do
12
+ # expect(@era[:checks].count).to eq(3)
13
+ # end
14
+ # it 'returns the correct number of adjustments' do
15
+ # expect(@era[:adjustments].count).to eq(3)
16
+ # end
17
+
18
+ # it 'returns the correct number of line items' do
19
+ # expect(@era[:checks]['201812215555555555'][:eras][0][:line_items].count).to eq(1)
20
+ # end
21
+ # it 'returns the correct number of line items' do
22
+ # expect(@era[:checks]['201812215555555556'][:eras][0][:line_items].count).to eq(2)
23
+ # end
24
+ # it 'returns the correct number of line items' do
25
+ # expect(@era[:checks]['201812215555555556'][:eras][1][:line_items].count).to eq(1)
26
+ # end
27
+ # it 'returns the correct number of line items' do
28
+ # expect(@era[:checks]['201812215555555557'][:eras][0][:line_items].count).to eq(1)
29
+ # end
30
+ # it 'returns the correct number of line items' do
31
+ # expect(@era[:checks]['201812215555555557'][:eras][1][:line_items].count).to eq(1)
32
+ # end
33
+
34
+ # it 'returns the correct number of adjustment groups' do
35
+ # expect(@era[:checks]['201812215555555555'][:eras][0][:line_items][0][:adjustment_groups].count).to eq(1)
36
+ # end
37
+ # it 'returns the correct number of adjustment groups' do
38
+ # expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][0][:adjustment_groups].count).to eq(1)
39
+ # end
40
+ # it 'returns the correct number of adjustment groups' do
41
+ # expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][1][:adjustment_groups].count).to eq(1)
42
+ # end
43
+ # it 'returns the correct number of adjustment groups' do
44
+ # expect(@era[:checks]['201812215555555556'][:eras][1][:line_items][0][:adjustment_groups].count).to eq(0)
45
+ # end
46
+ # it 'returns the correct number of adjustment groups' do
47
+ # expect(@era[:checks]['201812215555555557'][:eras][0][:line_items][0][:adjustment_groups].count).to eq(1)
48
+ # end
49
+ # it 'returns the correct number of adjustment groups' do
50
+ # expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:adjustment_groups].count).to eq(2)
51
+ # end
52
+ # end
53
+
54
+ context 'Check #201812215555555555' do
55
+ it 'returns the check number' do
56
+ expect(@era[:checks]['201812215555555555'][:check_number]).to eq('201812215555555555')
57
+ end
58
+ it 'returns the amount' do
59
+ expect(@era[:checks]['201812215555555555'][:amount]).to eq(4880)
60
+ end
61
+ it 'returns the number of claims' do
62
+ expect(@era[:checks]['201812215555555555'][:number_of_claims]).to eq(1)
63
+ end
64
+ it 'returns the NPI or Tax ID' do
65
+ expect(@era[:checks]['201812215555555555'][:npi_tax_id]).to eq('1212121212')
66
+ end
67
+ it 'returns the payee' do
68
+ expect(@era[:checks]['201812215555555555'][:payee]).to eq('ABC COMPANY LLC')
69
+ end
70
+ it 'returns the date' do
71
+ expect(@era[:checks]['201812215555555555'][:date]).to eq('12/21/2018')
72
+ end
73
+
74
+ context 'ERA #0' do
75
+ it 'returns the Patient ID' do
76
+ expect(@era[:checks]['201812215555555555'][:eras][0][:patient_id]).to eq('M11111110')
77
+ end
78
+ it 'returns the Patient name' do
79
+ expect(@era[:checks]['201812215555555555'][:eras][0][:patient_name]).to eq('DOE JR,DAVIS')
80
+ end
81
+ it 'returns the Patient last name (titlized)' do
82
+ expect(@era[:checks]['201812215555555555'][:eras][0][:patient_last_name]).to eq('Doe Jr')
83
+ end
84
+ it 'returns the Patient first name (titlized)' do
85
+ expect(@era[:checks]['201812215555555555'][:eras][0][:patient_first_name]).to eq('Davis')
86
+ end
87
+ it 'returns the Total charge amount (integer)' do
88
+ expect(@era[:checks]['201812215555555555'][:eras][0][:charge_amount]).to eq(6500)
89
+ end
90
+ it 'returns the Total payment amount (integer)' do
91
+ expect(@era[:checks]['201812215555555555'][:eras][0][:payment_amount]).to eq(4880)
92
+ end
93
+ it 'returns the Account number' do
94
+ expect(@era[:checks]['201812215555555555'][:eras][0][:account_number]).to eq('1112')
95
+ end
96
+ it 'returns the Status' do
97
+ expect(@era[:checks]['201812215555555555'][:eras][0][:status]).to eq('PROCESSED AS PRIMARY')
98
+ end
99
+ it 'returns the Payer name' do
100
+ expect(@era[:checks]['201812215555555555'][:eras][0][:payer_name]).to eq('ABC HEALTHCARE EAST')
101
+ end
102
+ it 'returns the Payer address' do
103
+ expect(@era[:checks]['201812215555555555'][:eras][0][:payer_address]).to eq('ONE CIRCLE RD')
104
+ end
105
+ it 'returns the Payer city' do
106
+ expect(@era[:checks]['201812215555555555'][:eras][0][:payer_city]).to eq('SOMEWHERE')
107
+ end
108
+ it 'returns the Payer state' do
109
+ expect(@era[:checks]['201812215555555555'][:eras][0][:payer_state]).to eq('GA')
110
+ end
111
+ it 'returns the Payer zip code' do
112
+ expect(@era[:checks]['201812215555555555'][:eras][0][:payer_zip_code]).to eq('11111')
113
+ end
114
+ it 'returns the Payer tax id' do
115
+ expect(@era[:checks]['201812215555555555'][:eras][0][:payer_tax_id]).to eq('11-1111110')
116
+ end
117
+ it 'returns the Payer claim control number' do
118
+ expect(@era[:checks]['201812215555555555'][:eras][0][:payer_claim_control_number]).to eq('111111111000')
119
+ end
120
+ it 'returns the Claim statement period start' do
121
+ expect(@era[:checks]['201812215555555555'][:eras][0][:claim_statement_period_start]).to eq(nil)
122
+ end
123
+ it 'returns the Claim statement period end' do
124
+ expect(@era[:checks]['201812215555555555'][:eras][0][:claim_statement_period_end]).to eq(nil)
125
+ end
126
+
127
+ context 'Line item #0' do
128
+ it 'returns the Date of service (string mm/dd/yyyy)' do
129
+ expect(@era[:checks]['201812215555555555'][:eras][0][:line_items][0][:service_date]).to eq('10/25/2018')
130
+ end
131
+ it 'returns the CPT code' do
132
+ expect(@era[:checks]['201812215555555555'][:eras][0][:line_items][0][:cpt_code]).to eq('92507')
133
+ end
134
+ it 'returns the Charge amount (integer)' do
135
+ expect(@era[:checks]['201812215555555555'][:eras][0][:line_items][0][:charge_amount]).to eq(6500)
136
+ end
137
+ it 'returns the Payment amount (integer)' do
138
+ expect(@era[:checks]['201812215555555555'][:eras][0][:line_items][0][:payment_amount]).to eq(4880)
139
+ end
140
+ it 'returns the Total adjustment amount (integer)' do
141
+ expect(@era[:checks]['201812215555555555'][:eras][0][:line_items][0][:total_adjustment_amount]).to eq(1620)
142
+ end
143
+ it 'returns the Remarks' do
144
+ expect(@era[:checks]['201812215555555555'][:eras][0][:line_items][0][:remarks]).to eq('NO REMARKS')
145
+ end
146
+ context 'Adjustment group #0' do
147
+ it 'returns the Adjustment group' do
148
+ expect(@era[:checks]['201812215555555555'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq('CONTRACTUAL OBLIGATIONS')
149
+ end
150
+ it 'returns the Adjustment amount (integer)' do
151
+ expect(@era[:checks]['201812215555555555'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_amount]).to eq(1620)
152
+ end
153
+ it 'returns the Translated reason code' do
154
+ expect(@era[:checks]['201812215555555555'][:eras][0][:line_items][0][:adjustment_groups][0][:translated_reason_code]).to eq('CHARGES EXCEED YOUR CONTRACTED/LEGISLATED FEE ARRANGEMENT.')
155
+ end
156
+ end
157
+ end
158
+ end
159
+ end
160
+
161
+ context 'Check #201812215555555556' do
162
+ it 'returns the check number' do
163
+ expect(@era[:checks]['201812215555555556'][:check_number]).to eq('201812215555555556')
164
+ end
165
+ it 'returns the amount' do
166
+ expect(@era[:checks]['201812215555555556'][:amount]).to eq(5120)
167
+ end
168
+ it 'returns the number of claims' do
169
+ expect(@era[:checks]['201812215555555556'][:number_of_claims]).to eq(2)
170
+ end
171
+ it 'returns the NPI or Tax ID' do
172
+ expect(@era[:checks]['201812215555555556'][:npi_tax_id]).to eq('1212121213')
173
+ end
174
+ it 'returns the payee' do
175
+ expect(@era[:checks]['201812215555555556'][:payee]).to eq('ABC COMPANY')
176
+ end
177
+ it 'returns the date' do
178
+ expect(@era[:checks]['201812215555555556'][:date]).to eq('12/22/2018')
179
+ end
180
+
181
+ context 'ERA #0' do
182
+ it 'returns the Patient ID' do
183
+ expect(@era[:checks]['201812215555555556'][:eras][0][:patient_id]).to eq('ZECM11111111')
184
+ end
185
+ it 'returns the Patient name' do
186
+ expect(@era[:checks]['201812215555555556'][:eras][0][:patient_name]).to eq('DOE,JANE')
187
+ end
188
+ it 'returns the Patient last name (titlized)' do
189
+ expect(@era[:checks]['201812215555555556'][:eras][0][:patient_last_name]).to eq('Doe')
190
+ end
191
+ it 'returns the Patient first name (titlized)' do
192
+ expect(@era[:checks]['201812215555555556'][:eras][0][:patient_first_name]).to eq('Jane')
193
+ end
194
+ it 'returns the Total charge amount (integer)' do
195
+ expect(@era[:checks]['201812215555555556'][:eras][0][:charge_amount]).to eq(-6500)
196
+ end
197
+ it 'returns the Total payment amount (integer)' do
198
+ expect(@era[:checks]['201812215555555556'][:eras][0][:payment_amount]).to eq(-4880)
199
+ end
200
+ it 'returns the Account number' do
201
+ expect(@era[:checks]['201812215555555556'][:eras][0][:account_number]).to eq('L111')
202
+ end
203
+ it 'returns the Status' do
204
+ expect(@era[:checks]['201812215555555556'][:eras][0][:status]).to eq('OTHER')
205
+ end
206
+ it 'returns the Payer name' do
207
+ expect(@era[:checks]['201812215555555556'][:eras][0][:payer_name]).to eq('ABC HEALTHCARE WEST')
208
+ end
209
+ it 'returns the Payer address' do
210
+ expect(@era[:checks]['201812215555555556'][:eras][0][:payer_address]).to eq('50 EAST RD')
211
+ end
212
+ it 'returns the Payer city' do
213
+ expect(@era[:checks]['201812215555555556'][:eras][0][:payer_city]).to eq('ANYWHERE')
214
+ end
215
+ it 'returns the Payer state' do
216
+ expect(@era[:checks]['201812215555555556'][:eras][0][:payer_state]).to eq('TN')
217
+ end
218
+ it 'returns the Payer zip code' do
219
+ expect(@era[:checks]['201812215555555556'][:eras][0][:payer_zip_code]).to eq('00002-1111')
220
+ end
221
+ it 'returns the Payer tax id' do
222
+ expect(@era[:checks]['201812215555555556'][:eras][0][:payer_tax_id]).to eq('11-1111111')
223
+ end
224
+ it 'returns the Payer claim control number' do
225
+ expect(@era[:checks]['201812215555555556'][:eras][0][:payer_claim_control_number]).to eq('BTBBB1111100')
226
+ end
227
+ it 'returns the Claim statement period start' do
228
+ expect(@era[:checks]['201812215555555556'][:eras][0][:claim_statement_period_start]).to eq(nil)
229
+ end
230
+ it 'returns the Claim statement period end' do
231
+ expect(@era[:checks]['201812215555555556'][:eras][0][:claim_statement_period_end]).to eq(nil)
232
+ end
233
+
234
+ context 'Line item #0' do
235
+ it 'returns the Date of service (string mm/dd/yyyy)' do
236
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][0][:service_date]).to eq('10/27/2017')
237
+ end
238
+ it 'returns the CPT code' do
239
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][0][:cpt_code]).to eq('92507')
240
+ end
241
+ it 'returns the Charge amount (integer)' do
242
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][0][:charge_amount]).to eq(-6500)
243
+ end
244
+ it 'returns the Payment amount (integer)' do
245
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][0][:payment_amount]).to eq(-4880)
246
+ end
247
+ it 'returns the Total adjustment amount (integer)' do
248
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][0][:total_adjustment_amount]).to eq(-1620)
249
+ end
250
+ it 'returns the Remarks' do
251
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][0][:remarks]).to eq('NO REMARKS')
252
+ end
253
+ context 'Adjustment group #0' do
254
+ it 'returns the Adjustment group' do
255
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq('OTHER ADJUSTMENTS')
256
+ end
257
+ it 'returns the Adjustment amount (integer)' do
258
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_amount]).to eq(-1620)
259
+ end
260
+ it 'returns the Translated reason code' do
261
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][0][:adjustment_groups][0][:translated_reason_code]).to eq('CHARGES EXCEED YOUR CONTRACTED/LEGISLATED FEE ARRANGEMENT.')
262
+ end
263
+ end
264
+ end
265
+
266
+ context 'Line item #1' do
267
+ it 'returns the Date of service (string mm/dd/yyyy)' do
268
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][1][:service_date]).to eq('11/09/2017')
269
+ end
270
+ it 'returns the CPT code' do
271
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][1][:cpt_code]).to eq('92507')
272
+ end
273
+ it 'returns the Charge amount (integer)' do
274
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][1][:charge_amount]).to eq(-500)
275
+ end
276
+ it 'returns the Payment amount (integer)' do
277
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][1][:payment_amount]).to eq(0)
278
+ end
279
+ it 'returns the Total adjustment amount (integer)' do
280
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][1][:total_adjustment_amount]).to eq(-500)
281
+ end
282
+ it 'returns the Remarks' do
283
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][1][:remarks]).to eq('NO REMARKS')
284
+ end
285
+ context 'Adjustment group #0' do
286
+ it 'returns the Adjustment group' do
287
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group]).to eq('OTHER ADJUSTMENTS')
288
+ end
289
+ it 'returns the Adjustment amount (integer)' do
290
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_amount]).to eq(-500)
291
+ end
292
+ it 'returns the Translated reason code' do
293
+ expect(@era[:checks]['201812215555555556'][:eras][0][:line_items][1][:adjustment_groups][0][:translated_reason_code]).to eq('PAYMENT ADJUSTED BECAUSE CHARGES HAVE BEEN PAID BY ANOTHER PAYER.')
294
+ end
295
+ end
296
+ end
297
+ end
298
+
299
+ context 'ERA #1' do
300
+ it 'returns the Patient ID' do
301
+ expect(@era[:checks]['201812215555555556'][:eras][1][:patient_id]).to eq('ZECM11111112')
302
+ end
303
+ it 'returns the Patient name' do
304
+ expect(@era[:checks]['201812215555555556'][:eras][1][:patient_name]).to eq('SMITH,JOSEPH')
305
+ end
306
+ it 'returns the Patient last name (titlized)' do
307
+ expect(@era[:checks]['201812215555555556'][:eras][1][:patient_last_name]).to eq('Smith')
308
+ end
309
+ it 'returns the Patient first name (titlized)' do
310
+ expect(@era[:checks]['201812215555555556'][:eras][1][:patient_first_name]).to eq('Joseph')
311
+ end
312
+ it 'returns the Total charge amount (integer)' do
313
+ expect(@era[:checks]['201812215555555556'][:eras][1][:charge_amount]).to eq(10000)
314
+ end
315
+ it 'returns the Total payment amount (integer)' do
316
+ expect(@era[:checks]['201812215555555556'][:eras][1][:payment_amount]).to eq(10000)
317
+ end
318
+ it 'returns the Account number' do
319
+ expect(@era[:checks]['201812215555555556'][:eras][1][:account_number]).to eq('M111')
320
+ end
321
+ it 'returns the Status' do
322
+ expect(@era[:checks]['201812215555555556'][:eras][1][:status]).to eq('PROCESSED AS SECONDARY')
323
+ end
324
+ it 'returns the Payer name' do
325
+ expect(@era[:checks]['201812215555555556'][:eras][1][:payer_name]).to eq('ABC HEALTHCARE WEST')
326
+ end
327
+ it 'returns the Payer address' do
328
+ expect(@era[:checks]['201812215555555556'][:eras][1][:payer_address]).to eq('50 EAST RD')
329
+ end
330
+ it 'returns the Payer city' do
331
+ expect(@era[:checks]['201812215555555556'][:eras][1][:payer_city]).to eq('ANYWHERE')
332
+ end
333
+ it 'returns the Payer state' do
334
+ expect(@era[:checks]['201812215555555556'][:eras][1][:payer_state]).to eq('TN')
335
+ end
336
+ it 'returns the Payer zip code' do
337
+ expect(@era[:checks]['201812215555555556'][:eras][1][:payer_zip_code]).to eq('00002')
338
+ end
339
+ it 'returns the Payer tax id' do
340
+ expect(@era[:checks]['201812215555555556'][:eras][1][:payer_tax_id]).to eq('11-1111111')
341
+ end
342
+ it 'returns the Payer claim control number' do
343
+ expect(@era[:checks]['201812215555555556'][:eras][1][:payer_claim_control_number]).to eq('BT1111111141')
344
+ end
345
+ it 'returns the Claim statement period start' do
346
+ expect(@era[:checks]['201812215555555556'][:eras][1][:claim_statement_period_start]).to eq(nil)
347
+ end
348
+ it 'returns the Claim statement period end' do
349
+ expect(@era[:checks]['201812215555555556'][:eras][1][:claim_statement_period_end]).to eq(nil)
350
+ end
351
+
352
+ context 'Line item #0' do
353
+ it 'returns the Date of service (string mm/dd/yyyy)' do
354
+ expect(@era[:checks]['201812215555555556'][:eras][1][:line_items][0][:service_date]).to eq('10/25/2017')
355
+ end
356
+ it 'returns the CPT code' do
357
+ expect(@era[:checks]['201812215555555556'][:eras][1][:line_items][0][:cpt_code]).to eq('92507')
358
+ end
359
+ it 'returns the Charge amount (integer)' do
360
+ expect(@era[:checks]['201812215555555556'][:eras][1][:line_items][0][:charge_amount]).to eq(10000)
361
+ end
362
+ it 'returns the Payment amount (integer)' do
363
+ expect(@era[:checks]['201812215555555556'][:eras][1][:line_items][0][:payment_amount]).to eq(10000)
364
+ end
365
+ it 'returns the Total adjustment amount (integer)' do
366
+ expect(@era[:checks]['201812215555555556'][:eras][1][:line_items][0][:total_adjustment_amount]).to eq(0)
367
+ end
368
+ it 'returns the Remarks' do
369
+ expect(@era[:checks]['201812215555555556'][:eras][1][:line_items][0][:remarks]).to eq('NO REMARKS')
370
+ end
371
+ end
372
+ end
373
+ end
374
+
375
+ context 'Check #201812215555555557' do
376
+ it 'returns the check number' do
377
+ expect(@era[:checks]['201812215555555557'][:check_number]).to eq('201812215555555557')
378
+ end
379
+ it 'returns the amount' do
380
+ expect(@era[:checks]['201812215555555557'][:amount]).to eq(500)
381
+ end
382
+ it 'returns the number of claims' do
383
+ expect(@era[:checks]['201812215555555557'][:number_of_claims]).to eq(2)
384
+ end
385
+ it 'returns the NPI or Tax ID' do
386
+ expect(@era[:checks]['201812215555555557'][:npi_tax_id]).to eq('1212121212')
387
+ end
388
+ it 'returns the payee' do
389
+ expect(@era[:checks]['201812215555555557'][:payee]).to eq('ABC COMPANY LLC')
390
+ end
391
+ it 'returns the date' do
392
+ expect(@era[:checks]['201812215555555557'][:date]).to eq('12/21/2018')
393
+ end
394
+
395
+ context 'ERA #0' do
396
+ it 'returns the Patient ID' do
397
+ expect(@era[:checks]['201812215555555557'][:eras][0][:patient_id]).to eq('ZECM11111112')
398
+ end
399
+ it 'returns the Patient name' do
400
+ expect(@era[:checks]['201812215555555557'][:eras][0][:patient_name]).to eq('LASTNAME,FIRST')
401
+ end
402
+ it 'returns the Patient last name (titlized)' do
403
+ expect(@era[:checks]['201812215555555557'][:eras][0][:patient_last_name]).to eq('Lastname')
404
+ end
405
+ it 'returns the Patient first name (titlized)' do
406
+ expect(@era[:checks]['201812215555555557'][:eras][0][:patient_first_name]).to eq('First')
407
+ end
408
+ it 'returns the Total charge amount (integer)' do
409
+ expect(@era[:checks]['201812215555555557'][:eras][0][:charge_amount]).to eq(4500)
410
+ end
411
+ it 'returns the Total payment amount (integer)' do
412
+ expect(@era[:checks]['201812215555555557'][:eras][0][:payment_amount]).to eq(0)
413
+ end
414
+ it 'returns the Account number' do
415
+ expect(@era[:checks]['201812215555555557'][:eras][0][:account_number]).to eq('M111')
416
+ end
417
+ it 'returns the Status' do
418
+ expect(@era[:checks]['201812215555555557'][:eras][0][:status]).to eq('DENIED')
419
+ end
420
+ it 'returns the Payer name' do
421
+ expect(@era[:checks]['201812215555555557'][:eras][0][:payer_name]).to eq('ABC HEALTHCARE EAST')
422
+ end
423
+ it 'returns the Payer address' do
424
+ expect(@era[:checks]['201812215555555557'][:eras][0][:payer_address]).to eq('ONE CIRCLE RD')
425
+ end
426
+ it 'returns the Payer city' do
427
+ expect(@era[:checks]['201812215555555557'][:eras][0][:payer_city]).to eq('SOMEWHERE')
428
+ end
429
+ it 'returns the Payer state' do
430
+ expect(@era[:checks]['201812215555555557'][:eras][0][:payer_state]).to eq('GA')
431
+ end
432
+ it 'returns the Payer zip code' do
433
+ expect(@era[:checks]['201812215555555557'][:eras][0][:payer_zip_code]).to eq('11111')
434
+ end
435
+ it 'returns the Payer tax id' do
436
+ expect(@era[:checks]['201812215555555557'][:eras][0][:payer_tax_id]).to eq('11-1111110')
437
+ end
438
+ it 'returns the Payer claim control number' do
439
+ expect(@era[:checks]['201812215555555557'][:eras][0][:payer_claim_control_number]).to eq('BT1111111131')
440
+ end
441
+ it 'returns the Claim statement period start' do
442
+ expect(@era[:checks]['201812215555555557'][:eras][0][:claim_statement_period_start]).to eq('01/30/2019')
443
+ end
444
+ it 'returns the Claim statement period end' do
445
+ expect(@era[:checks]['201812215555555557'][:eras][0][:claim_statement_period_end]).to eq('01/30/2019')
446
+ end
447
+
448
+ context 'Line item #0' do
449
+ it 'returns the Date of service (string mm/dd/yyyy)' do
450
+ expect(@era[:checks]['201812215555555557'][:eras][0][:line_items][0][:service_date]).to eq('10/28/2017')
451
+ end
452
+ it 'returns the CPT code' do
453
+ expect(@era[:checks]['201812215555555557'][:eras][0][:line_items][0][:cpt_code]).to eq('92507')
454
+ end
455
+ it 'returns the Charge amount (integer)' do
456
+ expect(@era[:checks]['201812215555555557'][:eras][0][:line_items][0][:charge_amount]).to eq(4500)
457
+ end
458
+ it 'returns the Payment amount (integer)' do
459
+ expect(@era[:checks]['201812215555555557'][:eras][0][:line_items][0][:payment_amount]).to eq(0)
460
+ end
461
+ it 'returns the Total adjustment amount (integer)' do
462
+ expect(@era[:checks]['201812215555555557'][:eras][0][:line_items][0][:total_adjustment_amount]).to eq(4500)
463
+ end
464
+ it 'returns the Remarks' do
465
+ expect(@era[:checks]['201812215555555557'][:eras][0][:line_items][0][:remarks]).to eq('NO REMARKS')
466
+ end
467
+ context 'Adjustment group #0' do
468
+ it 'returns the Adjustment group' do
469
+ expect(@era[:checks]['201812215555555557'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq('CONTRACTUAL OBLIGATIONS')
470
+ end
471
+ it 'returns the Adjustment amount (integer)' do
472
+ expect(@era[:checks]['201812215555555557'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_amount]).to eq(4500)
473
+ end
474
+ it 'returns the Translated reason code' do
475
+ expect(@era[:checks]['201812215555555557'][:eras][0][:line_items][0][:adjustment_groups][0][:translated_reason_code]).to eq('CHARGES EXCEED YOUR CONTRACTED/LEGISLATED FEE ARRANGEMENT.')
476
+ end
477
+ end
478
+ end
479
+ end
480
+
481
+ context 'ERA #1' do
482
+ it 'returns the Patient ID' do
483
+ expect(@era[:checks]['201812215555555557'][:eras][1][:patient_id]).to eq('ZECM11111112')
484
+ end
485
+ it 'returns the Patient name' do
486
+ expect(@era[:checks]['201812215555555557'][:eras][1][:patient_name]).to eq('WORLD,HELLO')
487
+ end
488
+ it 'returns the Patient last name (titlized)' do
489
+ expect(@era[:checks]['201812215555555557'][:eras][1][:patient_last_name]).to eq('World')
490
+ end
491
+ it 'returns the Patient first name (titlized)' do
492
+ expect(@era[:checks]['201812215555555557'][:eras][1][:patient_first_name]).to eq('Hello')
493
+ end
494
+ it 'returns the Total charge amount (integer)' do
495
+ expect(@era[:checks]['201812215555555557'][:eras][1][:charge_amount]).to eq(6500)
496
+ end
497
+ it 'returns the Total payment amount (integer)' do
498
+ expect(@era[:checks]['201812215555555557'][:eras][1][:payment_amount]).to eq(500)
499
+ end
500
+ it 'returns the Account number' do
501
+ expect(@era[:checks]['201812215555555557'][:eras][1][:account_number]).to eq('M111')
502
+ end
503
+ it 'returns the Status' do
504
+ expect(@era[:checks]['201812215555555557'][:eras][1][:status]).to eq('PROCESSED AS PRIMARY, FWDED')
505
+ end
506
+ it 'returns the Payer name' do
507
+ expect(@era[:checks]['201812215555555557'][:eras][1][:payer_name]).to eq('ABC HEALTHCARE EAST')
508
+ end
509
+ it 'returns the Payer address' do
510
+ expect(@era[:checks]['201812215555555557'][:eras][1][:payer_address]).to eq('ONE CIRCLE RD')
511
+ end
512
+ it 'returns the Payer city' do
513
+ expect(@era[:checks]['201812215555555557'][:eras][1][:payer_city]).to eq('SOMEWHERE')
514
+ end
515
+ it 'returns the Payer state' do
516
+ expect(@era[:checks]['201812215555555557'][:eras][1][:payer_state]).to eq('GA')
517
+ end
518
+ it 'returns the Payer zip code' do
519
+ expect(@era[:checks]['201812215555555557'][:eras][1][:payer_zip_code]).to eq('11111')
520
+ end
521
+ it 'returns the Payer tax id' do
522
+ expect(@era[:checks]['201812215555555557'][:eras][1][:payer_tax_id]).to eq('11-1111110')
523
+ end
524
+ it 'returns the Payer claim control number' do
525
+ expect(@era[:checks]['201812215555555557'][:eras][1][:payer_claim_control_number]).to eq('BT1111111121')
526
+ end
527
+ it 'returns the Claim statement period start' do
528
+ expect(@era[:checks]['201812215555555557'][:eras][1][:claim_statement_period_start]).to eq(nil)
529
+ end
530
+ it 'returns the Claim statement period end' do
531
+ expect(@era[:checks]['201812215555555557'][:eras][1][:claim_statement_period_end]).to eq(nil)
532
+ end
533
+
534
+ context 'Line item #0' do
535
+ it 'returns the Date of service (string mm/dd/yyyy)' do
536
+ expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:service_date]).to eq('10/30/2017')
537
+ end
538
+ it 'returns the CPT code' do
539
+ expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:cpt_code]).to eq('92507')
540
+ end
541
+ it 'returns the Charge amount (integer)' do
542
+ expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:charge_amount]).to eq(6500)
543
+ end
544
+ it 'returns the Payment amount (integer)' do
545
+ expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:payment_amount]).to eq(500)
546
+ end
547
+ it 'returns the Total adjustment amount (integer)' do
548
+ expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:total_adjustment_amount]).to eq(6000)
549
+ end
550
+ it 'returns the Remarks' do
551
+ expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:remarks]).to eq('NO REMARKS')
552
+ end
553
+ context 'Adjustment group #0' do
554
+ it 'returns the Adjustment group' do
555
+ expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq('CONTRACTUAL OBLIGATIONS')
556
+ end
557
+ it 'returns the Adjustment amount (integer)' do
558
+ expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:adjustment_groups][0][:adjustment_amount]).to eq(1620)
559
+ end
560
+ it 'returns the Translated reason code' do
561
+ expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:adjustment_groups][0][:translated_reason_code]).to eq('CHARGES EXCEED YOUR CONTRACTED/LEGISLATED FEE ARRANGEMENT.')
562
+ end
563
+ end
564
+ context 'Adjustment group #1' do
565
+ it 'returns the Adjustment group' do
566
+ expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:adjustment_groups][1][:adjustment_group]).to eq('OTHER ADJUSTMENTS')
567
+ end
568
+ it 'returns the Adjustment amount (integer)' do
569
+ expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:adjustment_groups][1][:adjustment_amount]).to eq(4380)
570
+ end
571
+ it 'returns the Translated reason code' do
572
+ expect(@era[:checks]['201812215555555557'][:eras][1][:line_items][0][:adjustment_groups][1][:translated_reason_code]).to eq('PAYMENT ADJUSTED BECAUSE CHARGES HAVE BEEN PAID BY ANOTHER PAYER.')
573
+ end
574
+ end
575
+ end
576
+ end
577
+ end
578
+
579
+ context 'Adjustments' do
580
+ context 'Adjustment #0' do
581
+ it 'returns Adjustment date (string mm/dd/yyyy)' do
582
+ expect(@era[:adjustments][0][:adjustment_date]).to eq('12/30/2018')
583
+ end
584
+ it 'returns Provider ID' do
585
+ expect(@era[:adjustments][0][:provider_id]).to eq('1111111111')
586
+ end
587
+ it 'returns Reference ID' do
588
+ expect(@era[:adjustments][0][:reference_id]).to eq('BBBBBBVP31M0')
589
+ end
590
+ it 'returns Adjustment amount (integer)' do
591
+ expect(@era[:adjustments][0][:adjustment_amount]).to eq(-4281)
592
+ end
593
+ it 'returns reason' do
594
+ expect(@era[:adjustments][0][:reason]).to eq('Overpayment Recover')
595
+ end
596
+ end
597
+ context 'Adjustment #1' do
598
+ it 'returns Adjustment date (string mm/dd/yyyy)' do
599
+ expect(@era[:adjustments][1][:adjustment_date]).to eq('12/31/2018')
600
+ end
601
+ it 'returns Provider ID' do
602
+ expect(@era[:adjustments][1][:provider_id]).to eq('1111111112')
603
+ end
604
+ it 'returns Reference ID' do
605
+ expect(@era[:adjustments][1][:reference_id]).to eq('BBBBBBVP31M1')
606
+ end
607
+ it 'returns Adjustment amount (integer)' do
608
+ expect(@era[:adjustments][1][:adjustment_amount]).to eq(-3344)
609
+ end
610
+ it 'returns reason' do
611
+ expect(@era[:adjustments][1][:reason]).to eq('Overpayment Recover')
612
+ end
613
+ end
614
+ context 'Adjustment #2' do
615
+ it 'returns Adjustment date (string mm/dd/yyyy)' do
616
+ expect(@era[:adjustments][2][:adjustment_date]).to eq('12/30/2018')
617
+ end
618
+ it 'returns Provider ID' do
619
+ expect(@era[:adjustments][2][:provider_id]).to eq('1111111113')
620
+ end
621
+ it 'returns Reference ID' do
622
+ expect(@era[:adjustments][2][:reference_id]).to eq('BBBBBBVP31M2')
623
+ end
624
+ it 'returns Adjustment amount (integer)' do
625
+ expect(@era[:adjustments][2][:adjustment_amount]).to eq(3345)
626
+ end
627
+ it 'returns reason' do
628
+ expect(@era[:adjustments][2][:reason]).to eq('Overpayment Recover')
629
+ end
630
+ end
631
+ end
632
+ end
633
+ end