era_835_parser 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee6d77b1fca8cdd052544e74a5932c84a01ead1ef7bca1c1270a7c9ba397b804
4
- data.tar.gz: c0cb958f109b14f7cee14e1f80799e58ccdddbff95c5e7478747c21c07527fc7
3
+ metadata.gz: 27c9972b427c29ab16fc6977570044045f0064db4e42cdd06e5ee02c2aaf8d05
4
+ data.tar.gz: 308eadea4e7c01d786898f52576b378e0caf62edf56fecc146bd569068badb4d
5
5
  SHA512:
6
- metadata.gz: c0ecd8a5bf21446057624dce13d87b26c7c6a8b370dbbdf4871280b35b056da3d05fe71c9813610f6f14af3f905924d89d3119a947bf696bdeb8ee34bf649e03
7
- data.tar.gz: d5b0d016634ef6d2f177462f8cf8f9285e5b7ad820efa094f815e90fe2ec284a93680a5c1f1782ac0a61e872a2b5d879120af19849227c4c8e588a4eb4e7ae60
6
+ metadata.gz: d322bb6e647d262130e37069a05944f71f8befae9452516e54f0895fc9c43897844beab38f06ef76687de8054c1f9eec4d0b159760bd5ca168d8441c18ca3cea
7
+ data.tar.gz: 2abee925027773e179f967614b4cadb47ef9186708e208a3c3126b0fabc1f30b79996b2f89b54758843931a158a87efc7178392da0b0561939b740a3fca5a9bf
data/README.md CHANGED
@@ -28,6 +28,9 @@ puts era[:addressed_to] # The person/name the ERA is addressed to
28
28
  if !era[:checks].nil?
29
29
  era[:checks].each do |check_number, check|
30
30
  puts check[:check_number] # Check number
31
+ puts check[:transaction_handling_code] # Transaction handling code
32
+ puts check[:credit_debit_flag] # Credit/debit flag
33
+ puts check[:payment_method_code] # Payment method code
31
34
  puts check[:amount] # Check amount
32
35
  puts check[:number_of_claims] # Number of claims this check covers (integer)
33
36
  puts check[:npi_tax_id] # NPI or Tax ID of payee
@@ -40,6 +43,17 @@ if !era[:checks].nil?
40
43
  puts check[:payer_tax_id] # Payer tax id
41
44
  puts check[:payer_edi_id] # Payer EDI id
42
45
  puts check[:date] # Check date (string mm/dd/yyyy)
46
+ # Provider level adjustments (PLB) attributed to this check
47
+ if !check[:provider_adjustments].nil?
48
+ check[:provider_adjustments].each do |adjustment|
49
+ puts adjustment[:adjustment_date] # Adjustment date (string mm/dd/yyyy)
50
+ puts adjustment[:provider_id] # Provider ID
51
+ puts adjustment[:reference_id] # Reference ID
52
+ puts adjustment[:adjustment_amount] # Adjustment amount (integer)
53
+ puts adjustment[:reason] # Reason
54
+ puts adjustment[:reason_code] # Reason code
55
+ end
56
+ end
43
57
  if !check[:eras].nil?
44
58
  check[:eras].each do |era_counter, individual_era|
45
59
  puts individual_era[:era_text] # ERA text
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.7"
21
+ spec.add_development_dependency "bundler", ">= 1.7"
22
22
  spec.add_development_dependency "rake", ">= 12.3.3"
23
23
  spec.add_development_dependency "rspec"
24
24
  end
@@ -35,6 +35,11 @@ module Era835Parser
35
35
  adjustment_counter_a = -1
36
36
  svc_counter = 0
37
37
 
38
+ # PLB (provider level adjustment) segment state
39
+ plb_provider_id = ''
40
+ plb_adjustment_date = ''
41
+ plb_pair_open = false
42
+
38
43
  # trigger variables
39
44
  adjustments_start = false
40
45
  checks_start = false
@@ -62,6 +67,9 @@ module Era835Parser
62
67
  service_payment_information_loop = false
63
68
  bpr_amount = ''
64
69
  bpr_date = ''
70
+ transaction_handling_code = ''
71
+ credit_debit_flag = ''
72
+ payment_method_code = ''
65
73
  receive_date = false
66
74
  claim_date_start = false
67
75
  claim_date_end = false
@@ -361,6 +369,7 @@ module Era835Parser
361
369
  when 1
362
370
  # Transaction Handling Code
363
371
  # puts "Transaction Handling Code: #{element}"
372
+ transaction_handling_code = element.strip
364
373
  when 2
365
374
  # Monetary Amount
366
375
  # puts "Monetary Amount: #{element}"
@@ -368,9 +377,11 @@ module Era835Parser
368
377
  when 3
369
378
  # Credit/Debit Flag
370
379
  # puts "Credit/Debit Flag: #{element}"
380
+ credit_debit_flag = element.strip
371
381
  when 4
372
382
  # PAYMENT METHOD CODE
373
383
  # puts "PAYMENT METHOD CODE: #{element}"
384
+ payment_method_code = element.strip
374
385
  when 5
375
386
  # PAYMENT FORMAT CODE
376
387
  # puts "PAYMENT FORMAT CODE: #{element}"
@@ -444,13 +455,20 @@ module Era835Parser
444
455
  when 2
445
456
  # REFERENCE IDENTIFICATION
446
457
  # puts "REFERENCE IDENTIFICATION: #{element}"
447
- check = Hash.new
448
- check[:check_number] = element.strip
449
- check[:amount] = (bpr_amount.to_f * 100).round().to_i
458
+ check = {
459
+ check_number: element.strip,
460
+ amount: (bpr_amount.to_f * 100).round().to_i,
461
+ date: bpr_date,
462
+ transaction_handling_code: transaction_handling_code,
463
+ credit_debit_flag: credit_debit_flag,
464
+ payment_method_code: payment_method_code,
465
+ }
466
+ checks[check[:check_number]] = check
450
467
  bpr_amount = ''
451
- check[:date] = bpr_date
452
468
  bpr_date = ''
453
- checks[check[:check_number]] = check
469
+ transaction_handling_code = ''
470
+ credit_debit_flag = ''
471
+ payment_method_code = ''
454
472
  when 3
455
473
  # ORIGINATING COMPANY IDENTIFIER
456
474
  # puts "ORIGINATING COMPANY IDENTIFIER: #{element}"
@@ -664,121 +682,49 @@ module Era835Parser
664
682
  case index
665
683
  when 1
666
684
  # Provider Identifier
667
- adjustment_counter_a += 1
668
- adjustment = Hash.new
669
- adjustment[:provider_id] = element.strip
685
+ plb_provider_id = element.strip
686
+ plb_pair_open = false
670
687
  when 2
671
688
  # Fiscal Period Date
672
- adjustment[:adjustment_date] = element.strip[4..5] + "/" + element.strip[6..7] + "/" + element.strip[0..3]
673
- when 3
674
- element.split(":").each_with_index do |subelement, i|
675
- case i
676
- when 0
677
- # PROVIDER ADJUSTMENT REASON CODE
678
- # puts "PROVIDER ADJUSTMENT REASON CODE: #{subelement}"
679
- adjustment[:reason_code] = subelement.strip
680
- adjustment[:reason] = PROVIDER_LEVEL_ADJUSTMENTS[subelement.strip]
681
- when 1
682
- # Provider Adjustment Identifier
683
- # puts "Provider Adjustment Identifier: #{subelement}"
684
- adjustment[:reference_id] = subelement.strip
685
- end
686
- end
687
- when 4
688
- # Provider Adjustment Amount
689
- adjustment[:adjustment_amount] = (element.to_f * 100).round().to_i
690
- when 5
691
- adjustment_counter_a += 1
692
- element.split(":").each_with_index do |subelement, i|
693
- case i
694
- when 0
695
- # PROVIDER ADJUSTMENT REASON CODE
696
- # puts "PROVIDER ADJUSTMENT REASON CODE: #{subelement}"
697
- adjustment[:reason_code] = subelement.strip
698
- adjustment[:reason] = PROVIDER_LEVEL_ADJUSTMENTS[subelement.strip]
699
- when 1
700
- # Provider Adjustment Identifier
701
- # puts "Provider Adjustment Identifier: #{subelement}"
702
- adjustment[:reference_id] = subelement.strip
703
- end
704
- end
705
- when 6
706
- # Provider Adjustment Amount
707
- adjustment[:adjustment_amount] = (element.to_f * 100).round().to_i
708
- when 7
709
- adjustment_counter_a += 1
710
- element.split(":").each_with_index do |subelement, i|
711
- case i
712
- when 0
713
- # PROVIDER ADJUSTMENT REASON CODE
714
- # puts "PROVIDER ADJUSTMENT REASON CODE: #{subelement}"
715
- adjustment[:reason_code] = subelement.strip
716
- adjustment[:reason] = PROVIDER_LEVEL_ADJUSTMENTS[subelement.strip]
717
- when 1
718
- # Provider Adjustment Identifier
719
- # puts "Provider Adjustment Identifier: #{subelement}"
720
- adjustment[:reference_id] = subelement.strip
721
- end
722
- end
723
- when 8
724
- # Provider Adjustment Amount
725
- adjustment[:adjustment_amount] = (element.to_f * 100).round().to_i
726
- when 9
727
- adjustment_counter_a += 1
728
- element.split(":").each_with_index do |subelement, i|
729
- case i
730
- when 0
731
- # PROVIDER ADJUSTMENT REASON CODE
732
- # puts "PROVIDER ADJUSTMENT REASON CODE: #{subelement}"
733
- adjustment[:reason_code] = subelement.strip
734
- adjustment[:reason] = PROVIDER_LEVEL_ADJUSTMENTS[subelement.strip]
735
- when 1
736
- # Provider Adjustment Identifier
737
- # puts "Provider Adjustment Identifier: #{subelement}"
738
- adjustment[:reference_id] = subelement.strip
739
- end
740
- end
741
- when 10
742
- # Provider Adjustment Amount
743
- adjustment[:adjustment_amount] = (element.to_f * 100).round().to_i
744
- when 11
745
- adjustment_counter_a += 1
746
- element.split(":").each_with_index do |subelement, i|
747
- case i
748
- when 0
749
- # PROVIDER ADJUSTMENT REASON CODE
750
- # puts "PROVIDER ADJUSTMENT REASON CODE: #{subelement}"
751
- adjustment[:reason_code] = subelement.strip
752
- adjustment[:reason] = PROVIDER_LEVEL_ADJUSTMENTS[subelement.strip]
753
- when 1
754
- # Provider Adjustment Identifier
755
- # puts "Provider Adjustment Identifier: #{subelement}"
756
- adjustment[:reference_id] = subelement.strip
689
+ plb_adjustment_date = element.strip[4..5] + "/" + element.strip[6..7] + "/" + element.strip[0..3]
690
+ when 3, 5, 7, 9, 11, 13
691
+ # Start of an adjustment reason/amount pair (PLB03-04 through PLB13-14).
692
+ # A single PLB segment carries up to 6 pairs; each pair is its own adjustment.
693
+ if element.strip.empty?
694
+ plb_pair_open = false
695
+ else
696
+ plb_pair_open = true
697
+ adjustment_counter_a += 1
698
+ adjustment = Hash.new
699
+ adjustment[:provider_id] = plb_provider_id
700
+ adjustment[:adjustment_date] = plb_adjustment_date
701
+ element.split(":").each_with_index do |subelement, i|
702
+ case i
703
+ when 0
704
+ # PROVIDER ADJUSTMENT REASON CODE
705
+ # puts "PROVIDER ADJUSTMENT REASON CODE: #{subelement}"
706
+ adjustment[:reason_code] = subelement.strip
707
+ adjustment[:reason] = PROVIDER_LEVEL_ADJUSTMENTS[subelement.strip]
708
+ when 1
709
+ # Provider Adjustment Identifier
710
+ # puts "Provider Adjustment Identifier: #{subelement}"
711
+ adjustment[:reference_id] = subelement.strip
712
+ end
757
713
  end
758
714
  end
759
- when 12
715
+ when 4, 6, 8, 10, 12, 14
760
716
  # Provider Adjustment Amount
761
- adjustment[:adjustment_amount] = (element.to_f * 100).round().to_i
762
- when 13
763
- adjustment_counter_a += 1
764
- element.split(":").each_with_index do |subelement, i|
765
- case i
766
- when 0
767
- # PROVIDER ADJUSTMENT REASON CODE
768
- # puts "PROVIDER ADJUSTMENT REASON CODE: #{subelement}"
769
- adjustment[:reason_code] = subelement.strip
770
- adjustment[:reason] = PROVIDER_LEVEL_ADJUSTMENTS[subelement.strip]
771
- when 1
772
- # Provider Adjustment Identifier
773
- # puts "Provider Adjustment Identifier: #{subelement}"
774
- adjustment[:reference_id] = subelement.strip
775
- end
717
+ adjustment[:adjustment_amount] = (element.to_f * 100).round().to_i if plb_pair_open
718
+ end
719
+ if plb_pair_open && adjustment_counter_a > -1 && (adjustment != {} && !adjustment.nil?)
720
+ adjustments[adjustment_counter_a] = adjustment
721
+ # Attribute the adjustment to the check (TRN) it belongs to, so multi-check
722
+ # files expose provider level adjustments per check.
723
+ if check[:check_number]
724
+ check[:provider_adjustments] = Array.new if check[:provider_adjustments].nil?
725
+ check[:provider_adjustments] << adjustment unless check[:provider_adjustments].include?(adjustment)
776
726
  end
777
- when 14
778
- # Provider Adjustment Amount
779
- adjustment[:adjustment_amount] = (element.to_f * 100).round().to_i
780
727
  end
781
- adjustments[adjustment_counter_a] = adjustment if adjustment_counter_a > -1 && (adjustment != {} && !adjustment.nil?)
782
728
  when "CAS"
783
729
  case index
784
730
  when 1
@@ -1034,7 +980,7 @@ module Era835Parser
1034
980
  eras[era_counter] = individual_era
1035
981
  era[:checks][check_number][:eras] = era[:checks][check_number][:eras].merge(eras)
1036
982
  end
1037
- return era
983
+ era
1038
984
  else
1039
985
  if individual_line_item != {}
1040
986
  if line_items.nil?
@@ -1100,7 +1046,7 @@ module Era835Parser
1100
1046
  end
1101
1047
  end
1102
1048
  end
1103
- return era
1049
+ era
1104
1050
  end
1105
1051
  end
1106
1052
 
@@ -1108,15 +1054,15 @@ module Era835Parser
1108
1054
 
1109
1055
  def get_length(string)
1110
1056
  if string.nil?
1111
- return 0
1057
+ 0
1112
1058
  else
1113
- return string.length
1059
+ string.length
1114
1060
  end
1115
1061
  end
1116
1062
 
1117
1063
  def truncate(string, truncate_at)
1118
1064
  if !string.nil?
1119
- return string.to_s[0...truncate_at]
1065
+ string.to_s[0...truncate_at]
1120
1066
  end
1121
1067
  end
1122
1068
 
@@ -1,3 +1,3 @@
1
1
  module Era835Parser
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -29,12 +29,24 @@ RSpec.describe Era835Parser::Parser do
29
29
  it 'returns the correct number of adjustment groups' do
30
30
  expect(@era[:checks]['70408535'][:eras][0][:line_items][0][:adjustment_groups].count).to eq(1)
31
31
  end
32
+ it 'returns no provider adjustments' do
33
+ expect(@era[:checks]['70408535'][:provider_adjustments]).to eq(nil)
34
+ end
32
35
  end
33
36
 
34
37
  context 'Check #70408535' do
35
38
  it 'returns the check number' do
36
39
  expect(@era[:checks]['70408535'][:check_number]).to eq('70408535')
37
40
  end
41
+ it 'returns the transaction handling code' do
42
+ expect(@era[:checks]['70408535'][:transaction_handling_code]).to eq('I')
43
+ end
44
+ it 'returns the credit debit flag' do
45
+ expect(@era[:checks]['70408535'][:credit_debit_flag]).to eq('C')
46
+ end
47
+ it 'returns the payment method code' do
48
+ expect(@era[:checks]['70408535'][:payment_method_code]).to eq('CHK')
49
+ end
38
50
  it 'returns the amount' do
39
51
  expect(@era[:checks]['70408535'][:amount]).to eq(1509646)
40
52
  end
@@ -192,6 +204,15 @@ RSpec.describe Era835Parser::Parser do
192
204
  it 'returns the check number' do
193
205
  expect(@era[:checks]['02790758'][:check_number]).to eq('02790758')
194
206
  end
207
+ it 'returns the transaction handling code' do
208
+ expect(@era[:checks]['02790758'][:transaction_handling_code]).to eq('I')
209
+ end
210
+ it 'returns the credit debit flag' do
211
+ expect(@era[:checks]['02790758'][:credit_debit_flag]).to eq('C')
212
+ end
213
+ it 'returns the payment method code' do
214
+ expect(@era[:checks]['02790758'][:payment_method_code]).to eq('CHK')
215
+ end
195
216
  it 'returns the amount' do
196
217
  expect(@era[:checks]['02790758'][:amount]).to eq(192286)
197
218
  end
@@ -435,6 +456,15 @@ RSpec.describe Era835Parser::Parser do
435
456
  it 'returns the check number' do
436
457
  expect(@era[:checks]['02790758'][:check_number]).to eq('02790758')
437
458
  end
459
+ it 'returns the transaction handling code' do
460
+ expect(@era[:checks]['02790758'][:transaction_handling_code]).to eq('I')
461
+ end
462
+ it 'returns the credit debit flag' do
463
+ expect(@era[:checks]['02790758'][:credit_debit_flag]).to eq('C')
464
+ end
465
+ it 'returns the payment method code' do
466
+ expect(@era[:checks]['02790758'][:payment_method_code]).to eq('CHK')
467
+ end
438
468
  it 'returns the amount' do
439
469
  expect(@era[:checks]['02790758'][:amount]).to eq(192286)
440
470
  end
@@ -678,6 +708,15 @@ RSpec.describe Era835Parser::Parser do
678
708
  it 'returns the check number' do
679
709
  expect(@era[:checks]['0123456789012345678901234567890123456789'][:check_number]).to eq('0123456789012345678901234567890123456789')
680
710
  end
711
+ it 'returns the transaction handling code' do
712
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:transaction_handling_code]).to eq('I')
713
+ end
714
+ it 'returns the credit debit flag' do
715
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:credit_debit_flag]).to eq('C')
716
+ end
717
+ it 'returns the payment method code' do
718
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:payment_method_code]).to eq('CHK')
719
+ end
681
720
  it 'returns the amount' do
682
721
  expect(@era[:checks]['0123456789012345678901234567890123456789'][:amount]).to eq(192286)
683
722
  end
@@ -921,6 +960,15 @@ RSpec.describe Era835Parser::Parser do
921
960
  it 'returns the check number' do
922
961
  expect(@era[:checks]['0123456789012345678901234567890123456789'][:check_number]).to eq('0123456789012345678901234567890123456789')
923
962
  end
963
+ it 'returns the transaction handling code' do
964
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:transaction_handling_code]).to eq('I')
965
+ end
966
+ it 'returns the credit debit flag' do
967
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:credit_debit_flag]).to eq('C')
968
+ end
969
+ it 'returns the payment method code' do
970
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:payment_method_code]).to eq('CHK')
971
+ end
924
972
  it 'returns the amount' do
925
973
  expect(@era[:checks]['0123456789012345678901234567890123456789'][:amount]).to eq(192286)
926
974
  end
@@ -1154,6 +1202,615 @@ RSpec.describe Era835Parser::Parser do
1154
1202
  end
1155
1203
  end
1156
1204
  end
1205
+ context 'example_6.835' do
1206
+ before :all do
1207
+ @era = Era835Parser::Parser.new(file_path: "../era_835_parser/spec/example_6.835").parse
1208
+ @check_5003 = @era[:checks]['5003']
1209
+ @check_5010 = @era[:checks]['5010']
1210
+ end
1211
+
1212
+ context 'Aggregate totals' do
1213
+ it 'returns the addressed to' do
1214
+ expect(@era[:addressed_to]).to eq(nil)
1215
+ end
1216
+ it 'returns the correct number of checks' do
1217
+ expect(@era[:checks].count).to eq(2)
1218
+ end
1219
+ it 'returns the correct number of adjustments' do
1220
+ expect(@era[:adjustments]).to eq(nil)
1221
+ end
1222
+ it 'returns the correct number of eras' do
1223
+ total = @check_5003[:eras].count + @check_5010[:eras].count
1224
+ expect(total).to eq(2)
1225
+ end
1226
+ it 'returns the correct number of line items' do
1227
+ total = @check_5003[:eras][0][:line_items].count + @check_5010[:eras][0][:line_items].count
1228
+ expect(total).to eq(6)
1229
+ end
1230
+ it 'returns the correct number of adjustment groups' do
1231
+ total = @check_5003[:eras][0][:line_items][0][:adjustment_groups].count + @check_5010[:eras][0][:line_items][0][:adjustment_groups].count
1232
+ expect(total).to eq(4)
1233
+ end
1234
+ it 'returns the correct number of adjustment groups' do
1235
+ total = @check_5003[:eras][0][:line_items][1][:adjustment_groups].count + @check_5010[:eras][0][:line_items][1][:adjustment_groups].count
1236
+ expect(total).to eq(2)
1237
+ end
1238
+ it 'returns the correct number of adjustment groups' do
1239
+ total = @check_5003[:eras][0][:line_items][2][:adjustment_groups].count + @check_5010[:eras][0][:line_items][2][:adjustment_groups].count
1240
+ expect(total).to eq(2)
1241
+ end
1242
+ end
1243
+
1244
+ context 'Check #5003' do
1245
+ it 'returns the check number' do
1246
+ expect(@check_5003[:check_number]).to eq('5003')
1247
+ end
1248
+ it 'returns the transaction handling code' do
1249
+ expect(@check_5003[:transaction_handling_code]).to eq('H')
1250
+ end
1251
+ it 'returns the credit debit flag' do
1252
+ expect(@check_5003[:credit_debit_flag]).to eq('C')
1253
+ end
1254
+ it 'returns the payment method code' do
1255
+ expect(@check_5003[:payment_method_code]).to eq('NON')
1256
+ end
1257
+ it 'returns the amount' do
1258
+ expect(@check_5003[:amount]).to eq(0)
1259
+ end
1260
+ it 'returns the number of claims' do
1261
+ expect(@check_5003[:number_of_claims]).to eq(1)
1262
+ end
1263
+ it 'returns the NPI or Tax ID of payee' do
1264
+ expect(@check_5003[:npi_tax_id]).to eq('0987654321')
1265
+ end
1266
+ it 'returns the Check payee' do
1267
+ expect(@check_5003[:payee]).to eq('XYZ HEALTHCARE CORPORATION')
1268
+ end
1269
+ it 'returns the Payer name' do
1270
+ expect(@check_5003[:payer_name]).to eq('BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA')
1271
+ end
1272
+ it 'returns the Payer address' do
1273
+ expect(@check_5003[:payer_address]).to eq('P O BOX 2291')
1274
+ end
1275
+ it 'returns the Payer city' do
1276
+ expect(@check_5003[:payer_city]).to eq('DURHAM')
1277
+ end
1278
+ it 'returns the Payer state' do
1279
+ expect(@check_5003[:payer_state]).to eq('NC')
1280
+ end
1281
+ it 'returns the Payer zip code' do
1282
+ expect(@check_5003[:payer_zip_code]).to eq('27702')
1283
+ end
1284
+ it 'returns the Payer tax id' do
1285
+ expect(@check_5003[:payer_tax_id]).to eq('60-894904')
1286
+ end
1287
+ it 'returns the Payer EDI id' do
1288
+ expect(@check_5003[:payer_edi_id]).to eq(nil)
1289
+ end
1290
+ it 'returns the Check date (string mm/dd/yyyy)' do
1291
+ expect(@check_5003[:date]).to eq('01/08/2026')
1292
+ end
1293
+ context 'ERA #0' do
1294
+ it 'returns the Patient ID' do
1295
+ expect(@check_5003[:eras][0][:patient_id]).to eq(nil)
1296
+ end
1297
+ it 'returns the Patient name' do
1298
+ expect(@check_5003[:eras][0][:patient_name]).to eq('DOUGH,MARY')
1299
+ end
1300
+ it 'returns the Patient last name (titleized)' do
1301
+ expect(@check_5003[:eras][0][:patient_last_name]).to eq('Dough')
1302
+ end
1303
+ it 'returns the Patient first name (titleized)' do
1304
+ expect(@check_5003[:eras][0][:patient_first_name]).to eq('Mary')
1305
+ end
1306
+ it 'returns the Subscriber last name (titleized)' do
1307
+ expect(@check_5003[:eras][0][:subscriber_first_name]).to eq('Marty')
1308
+ end
1309
+ it 'returns the Subscriber last name (titleized)' do
1310
+ expect(@check_5003[:eras][0][:subscriber_last_name]).to eq('Dough')
1311
+ end
1312
+ it 'returns the Subscriber name (titleized)' do
1313
+ expect(@check_5003[:eras][0][:subscriber_name]).to eq('DOUGH,MARTY')
1314
+ end
1315
+ it 'returns the Subscriber middle initial' do
1316
+ expect(@check_5003[:eras][0][:subscriber_middle_initial]).to eq('L')
1317
+ end
1318
+ it 'returns the Subscriber suffix' do
1319
+ expect(@check_5003[:eras][0][:subscriber_suffix]).to eq('Sr.')
1320
+ end
1321
+ it 'returns the Subscriber ID' do
1322
+ expect(@check_5003[:eras][0][:subscriber_id]).to eq('YPB123456789009')
1323
+ end
1324
+ it 'returns the rendering provider last_name (titleized)' do
1325
+ expect(@check_5003[:eras][0][:rendering_provider_last_name]).to eq('Jones')
1326
+ end
1327
+ it 'returns the rendering provider first name (titleized)' do
1328
+ expect(@check_5003[:eras][0][:rendering_provider_first_name]).to eq('Alice')
1329
+ end
1330
+ it 'returns the rendering provider NPI' do
1331
+ expect(@check_5003[:eras][0][:rendering_provider_npi]).to eq('1116359906')
1332
+ end
1333
+ it 'returns the Total charge amount (integer)' do
1334
+ expect(@check_5003[:eras][0][:charge_amount]).to eq(30000)
1335
+ end
1336
+ it 'returns the Total payment amount (integer)' do
1337
+ expect(@check_5003[:eras][0][:payment_amount]).to eq(15000)
1338
+ end
1339
+ it 'returns the Account number' do
1340
+ expect(@check_5003[:eras][0][:account_number]).to eq('200200964A52')
1341
+ end
1342
+ it 'returns the Claim status code' do
1343
+ expect(@check_5003[:eras][0][:claim_status_code]).to eq('1')
1344
+ end
1345
+ it 'returns the Claim status code description' do
1346
+ expect(@check_5003[:eras][0][:status]).to eq("PROCESSED AS PRIMARY")
1347
+ end
1348
+ it 'returns the Payer claim control number' do
1349
+ expect(@check_5003[:eras][0][:payer_claim_control_number]).to eq('94151100100')
1350
+ end
1351
+ it 'returns the Claim statement period start' do
1352
+ expect(@check_5003[:eras][0][:claim_statement_period_start]).to eq(nil)
1353
+ end
1354
+ it 'returns the Claim statement period end' do
1355
+ expect(@check_5003[:eras][0][:claim_statement_period_end]).to eq(nil)
1356
+ end
1357
+
1358
+ context 'Line item #0' do
1359
+ it 'returns the Date of service (string mm/dd/yyyy)' do
1360
+ expect(@check_5003[:eras][0][:line_items][0][:service_date]).to eq("12/31/2010")
1361
+ end
1362
+ it 'returns the CPT code' do
1363
+ expect(@check_5003[:eras][0][:line_items][0][:cpt_code]).to eq("59430")
1364
+ end
1365
+ it 'returns the Charge amount (integer)' do
1366
+ expect(@check_5003[:eras][0][:line_items][0][:charge_amount]).to eq(10100)
1367
+ end
1368
+ it 'returns the Payment amount (integer)' do
1369
+ expect(@check_5003[:eras][0][:line_items][0][:payment_amount]).to eq(5050)
1370
+ end
1371
+ it 'returns the Total adjustment amount (integer)' do
1372
+ expect(@check_5003[:eras][0][:line_items][0][:total_adjustment_amount]).to eq(5050)
1373
+ end
1374
+ it 'returns the Remark code' do
1375
+ expect(@check_5003[:eras][0][:line_items][0][:remark_code]).to eq(nil)
1376
+ end
1377
+ it 'returns the Remarks' do
1378
+ expect(@check_5003[:eras][0][:line_items][0][:remarks]).to eq(nil)
1379
+ end
1380
+ it 'returns the Reference number' do
1381
+ expect(@check_5003[:eras][0][:line_items][0][:reference_number]).to eq('0001')
1382
+ end
1383
+ context 'Adjustment group #0' do
1384
+ it 'returns the Adjustment group' do
1385
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq("Contractual Obligation")
1386
+ end
1387
+ it 'returns the Adjustment group code' do
1388
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group_code]).to eq("CO")
1389
+ end
1390
+ it 'returns the Adjustment amount (integer)' do
1391
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_amount]).to eq(2550)
1392
+ end
1393
+ it 'returns the Reason code' do
1394
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][0][:reason_code]).to eq('42')
1395
+ end
1396
+ it 'returns the Translated reason code' do
1397
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][0][:translated_reason_code]).to eq("Charges exceed our fee schedule or maximum allowable amount. (Use CARC 45)")
1398
+ end
1399
+ end
1400
+ context 'Adjustment group #1' do
1401
+ it 'returns the Adjustment group' do
1402
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_group]).to eq("Patient Responsibility")
1403
+ end
1404
+ it 'returns the Adjustment group code' do
1405
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_group_code]).to eq("PR")
1406
+ end
1407
+ it 'returns the Adjustment amount (integer)' do
1408
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_amount]).to eq(2500)
1409
+ end
1410
+ it 'returns the Reason code' do
1411
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][1][:reason_code]).to eq('2')
1412
+ end
1413
+ it 'returns the Translated reason code' do
1414
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][1][:translated_reason_code]).to eq("Coinsurance Amount")
1415
+ end
1416
+ end
1417
+ end
1418
+ context 'Line item #1' do
1419
+ it 'returns the Date of service (string mm/dd/yyyy)' do
1420
+ expect(@check_5003[:eras][0][:line_items][1][:service_date]).to eq("12/31/2010")
1421
+ end
1422
+ it 'returns the CPT code' do
1423
+ expect(@check_5003[:eras][0][:line_items][1][:cpt_code]).to eq("59440")
1424
+ end
1425
+ it 'returns the Charge amount (integer)' do
1426
+ expect(@check_5003[:eras][0][:line_items][1][:charge_amount]).to eq(10000)
1427
+ end
1428
+ it 'returns the Payment amount (integer)' do
1429
+ expect(@check_5003[:eras][0][:line_items][1][:payment_amount]).to eq(5000)
1430
+ end
1431
+ it 'returns the Total adjustment amount (integer)' do
1432
+ expect(@check_5003[:eras][0][:line_items][1][:total_adjustment_amount]).to eq(5000)
1433
+ end
1434
+ it 'returns the Remark code' do
1435
+ expect(@check_5003[:eras][0][:line_items][1][:remark_code]).to eq(nil)
1436
+ end
1437
+ it 'returns the Remarks' do
1438
+ expect(@check_5003[:eras][0][:line_items][1][:remarks]).to eq(nil)
1439
+ end
1440
+ it 'returns the Reference number' do
1441
+ expect(@check_5003[:eras][0][:line_items][1][:reference_number]).to eq('0002')
1442
+ end
1443
+ context 'Adjustment group #0' do
1444
+ it 'returns the Adjustment group' do
1445
+ expect(@check_5003[:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group]).to eq("Patient Responsibility")
1446
+ end
1447
+ it 'returns the Adjustment group code' do
1448
+ expect(@check_5003[:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group_code]).to eq("PR")
1449
+ end
1450
+ it 'returns the Adjustment amount (integer)' do
1451
+ expect(@check_5003[:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_amount]).to eq(5000)
1452
+ end
1453
+ it 'returns the Reason code' do
1454
+ expect(@check_5003[:eras][0][:line_items][1][:adjustment_groups][0][:reason_code]).to eq('3')
1455
+ end
1456
+ it 'returns the Translated reason code' do
1457
+ expect(@check_5003[:eras][0][:line_items][1][:adjustment_groups][0][:translated_reason_code]).to eq("Co-payment Amount")
1458
+ end
1459
+ end
1460
+ end
1461
+ context 'Line item #2' do
1462
+ it 'returns the Date of service (string mm/dd/yyyy)' do
1463
+ expect(@check_5003[:eras][0][:line_items][2][:service_date]).to eq("12/31/2010")
1464
+ end
1465
+ it 'returns the CPT code' do
1466
+ expect(@check_5003[:eras][0][:line_items][2][:cpt_code]).to eq("59426")
1467
+ end
1468
+ it 'returns the Charge amount (integer)' do
1469
+ expect(@check_5003[:eras][0][:line_items][2][:charge_amount]).to eq(9900)
1470
+ end
1471
+ it 'returns the Payment amount (integer)' do
1472
+ expect(@check_5003[:eras][0][:line_items][2][:payment_amount]).to eq(4950)
1473
+ end
1474
+ it 'returns the Total adjustment amount (integer)' do
1475
+ expect(@check_5003[:eras][0][:line_items][2][:total_adjustment_amount]).to eq(4950)
1476
+ end
1477
+ it 'returns the Remark code' do
1478
+ expect(@check_5003[:eras][0][:line_items][2][:remark_code]).to eq(nil)
1479
+ end
1480
+ it 'returns the Remarks' do
1481
+ expect(@check_5003[:eras][0][:line_items][2][:remarks]).to eq(nil)
1482
+ end
1483
+ it 'returns the Reference number' do
1484
+ expect(@check_5003[:eras][0][:line_items][2][:reference_number]).to eq('0003')
1485
+ end
1486
+ end
1487
+ end
1488
+ end
1489
+
1490
+ context 'Check #5010' do
1491
+ it 'returns the check number' do
1492
+ expect(@check_5010[:check_number]).to eq('5010')
1493
+ end
1494
+ it 'returns the transaction handling code' do
1495
+ expect(@check_5010[:transaction_handling_code]).to eq('I')
1496
+ end
1497
+ it 'returns the credit debit flag' do
1498
+ expect(@check_5010[:credit_debit_flag]).to eq('C')
1499
+ end
1500
+ it 'returns the payment method code' do
1501
+ expect(@check_5010[:payment_method_code]).to eq('ACH')
1502
+ end
1503
+ it 'returns the amount' do
1504
+ expect(@check_5010[:amount]).to eq(30000)
1505
+ end
1506
+ it 'returns the number of claims' do
1507
+ expect(@check_5010[:number_of_claims]).to eq(1)
1508
+ end
1509
+ it 'returns the NPI or Tax ID of payee' do
1510
+ expect(@check_5010[:npi_tax_id]).to eq('0987654321')
1511
+ end
1512
+ it 'returns the Check payee' do
1513
+ expect(@check_5010[:payee]).to eq('XYZ HEALTHCARE CORPORATION')
1514
+ end
1515
+ it 'returns the Payer name' do
1516
+ expect(@check_5010[:payer_name]).to eq('BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA')
1517
+ end
1518
+ it 'returns the Payer address' do
1519
+ expect(@check_5010[:payer_address]).to eq('P O BOX 2291')
1520
+ end
1521
+ it 'returns the Payer city' do
1522
+ expect(@check_5010[:payer_city]).to eq('DURHAM')
1523
+ end
1524
+ it 'returns the Payer state' do
1525
+ expect(@check_5010[:payer_state]).to eq('NC')
1526
+ end
1527
+ it 'returns the Payer zip code' do
1528
+ expect(@check_5010[:payer_zip_code]).to eq('27702')
1529
+ end
1530
+ it 'returns the Payer tax id' do
1531
+ expect(@check_5010[:payer_tax_id]).to eq('60-894904')
1532
+ end
1533
+ it 'returns the Payer EDI id' do
1534
+ expect(@check_5010[:payer_edi_id]).to eq(nil)
1535
+ end
1536
+ it 'returns the Check date (string mm/dd/yyyy)' do
1537
+ expect(@check_5010[:date]).to eq('01/09/2026')
1538
+ end
1539
+ context 'ERA #0' do
1540
+ it 'returns the Patient ID' do
1541
+ expect(@check_5010[:eras][0][:patient_id]).to eq(nil)
1542
+ end
1543
+ it 'returns the Patient name' do
1544
+ expect(@check_5010[:eras][0][:patient_name]).to eq('DOUGH,MARY')
1545
+ end
1546
+ it 'returns the Patient last name (titleized)' do
1547
+ expect(@check_5010[:eras][0][:patient_last_name]).to eq('Dough')
1548
+ end
1549
+ it 'returns the Patient first name (titleized)' do
1550
+ expect(@check_5010[:eras][0][:patient_first_name]).to eq('Mary')
1551
+ end
1552
+ it 'returns the Subscriber last name (titleized)' do
1553
+ expect(@check_5010[:eras][0][:subscriber_first_name]).to eq('Marty')
1554
+ end
1555
+ it 'returns the Subscriber last name (titleized)' do
1556
+ expect(@check_5010[:eras][0][:subscriber_last_name]).to eq('Dough')
1557
+ end
1558
+ it 'returns the Subscriber name (titleized)' do
1559
+ expect(@check_5010[:eras][0][:subscriber_name]).to eq('DOUGH,MARTY')
1560
+ end
1561
+ it 'returns the Subscriber middle initial' do
1562
+ expect(@check_5010[:eras][0][:subscriber_middle_initial]).to eq('L')
1563
+ end
1564
+ it 'returns the Subscriber suffix' do
1565
+ expect(@check_5010[:eras][0][:subscriber_suffix]).to eq('Sr.')
1566
+ end
1567
+ it 'returns the Subscriber ID' do
1568
+ expect(@check_5010[:eras][0][:subscriber_id]).to eq('YPB123456789009')
1569
+ end
1570
+ it 'returns the rendering provider last_name (titleized)' do
1571
+ expect(@check_5010[:eras][0][:rendering_provider_last_name]).to eq('Jones')
1572
+ end
1573
+ it 'returns the rendering provider first name (titleized)' do
1574
+ expect(@check_5010[:eras][0][:rendering_provider_first_name]).to eq('Alice')
1575
+ end
1576
+ it 'returns the rendering provider NPI' do
1577
+ expect(@check_5010[:eras][0][:rendering_provider_npi]).to eq('1116359906')
1578
+ end
1579
+ it 'returns the Total charge amount (integer)' do
1580
+ expect(@check_5010[:eras][0][:charge_amount]).to eq(30000)
1581
+ end
1582
+ it 'returns the Total payment amount (integer)' do
1583
+ expect(@check_5010[:eras][0][:payment_amount]).to eq(15000)
1584
+ end
1585
+ it 'returns the Account number' do
1586
+ expect(@check_5010[:eras][0][:account_number]).to eq('200200964A52')
1587
+ end
1588
+ it 'returns the Claim status code' do
1589
+ expect(@check_5010[:eras][0][:claim_status_code]).to eq('1')
1590
+ end
1591
+ it 'returns the Claim status code description' do
1592
+ expect(@check_5010[:eras][0][:status]).to eq("PROCESSED AS PRIMARY")
1593
+ end
1594
+ it 'returns the Payer claim control number' do
1595
+ expect(@check_5010[:eras][0][:payer_claim_control_number]).to eq('94151100100')
1596
+ end
1597
+ it 'returns the Claim statement period start' do
1598
+ expect(@check_5010[:eras][0][:claim_statement_period_start]).to eq(nil)
1599
+ end
1600
+ it 'returns the Claim statement period end' do
1601
+ expect(@check_5010[:eras][0][:claim_statement_period_end]).to eq(nil)
1602
+ end
1603
+
1604
+ context 'Line item #0' do
1605
+ it 'returns the Date of service (string mm/dd/yyyy)' do
1606
+ expect(@check_5010[:eras][0][:line_items][0][:service_date]).to eq("12/31/2010")
1607
+ end
1608
+ it 'returns the CPT code' do
1609
+ expect(@check_5010[:eras][0][:line_items][0][:cpt_code]).to eq("59430")
1610
+ end
1611
+ it 'returns the Charge amount (integer)' do
1612
+ expect(@check_5010[:eras][0][:line_items][0][:charge_amount]).to eq(10100)
1613
+ end
1614
+ it 'returns the Payment amount (integer)' do
1615
+ expect(@check_5010[:eras][0][:line_items][0][:payment_amount]).to eq(5050)
1616
+ end
1617
+ it 'returns the Total adjustment amount (integer)' do
1618
+ expect(@check_5010[:eras][0][:line_items][0][:total_adjustment_amount]).to eq(5050)
1619
+ end
1620
+ it 'returns the Remark code' do
1621
+ expect(@check_5010[:eras][0][:line_items][0][:remark_code]).to eq(nil)
1622
+ end
1623
+ it 'returns the Remarks' do
1624
+ expect(@check_5010[:eras][0][:line_items][0][:remarks]).to eq(nil)
1625
+ end
1626
+ it 'returns the Reference number' do
1627
+ expect(@check_5010[:eras][0][:line_items][0][:reference_number]).to eq('0001')
1628
+ end
1629
+ context 'Adjustment group #0' do
1630
+ it 'returns the Adjustment group' do
1631
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq("Contractual Obligation")
1632
+ end
1633
+ it 'returns the Adjustment group code' do
1634
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group_code]).to eq("CO")
1635
+ end
1636
+ it 'returns the Adjustment amount (integer)' do
1637
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_amount]).to eq(2550)
1638
+ end
1639
+ it 'returns the Reason code' do
1640
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][0][:reason_code]).to eq('42')
1641
+ end
1642
+ it 'returns the Translated reason code' do
1643
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][0][:translated_reason_code]).to eq("Charges exceed our fee schedule or maximum allowable amount. (Use CARC 45)")
1644
+ end
1645
+ end
1646
+ context 'Adjustment group #1' do
1647
+ it 'returns the Adjustment group' do
1648
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_group]).to eq("Patient Responsibility")
1649
+ end
1650
+ it 'returns the Adjustment group code' do
1651
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_group_code]).to eq("PR")
1652
+ end
1653
+ it 'returns the Adjustment amount (integer)' do
1654
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_amount]).to eq(2500)
1655
+ end
1656
+ it 'returns the Reason code' do
1657
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][1][:reason_code]).to eq('2')
1658
+ end
1659
+ it 'returns the Translated reason code' do
1660
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][1][:translated_reason_code]).to eq("Coinsurance Amount")
1661
+ end
1662
+ end
1663
+ end
1664
+ context 'Line item #1' do
1665
+ it 'returns the Date of service (string mm/dd/yyyy)' do
1666
+ expect(@check_5010[:eras][0][:line_items][1][:service_date]).to eq("12/31/2010")
1667
+ end
1668
+ it 'returns the CPT code' do
1669
+ expect(@check_5010[:eras][0][:line_items][1][:cpt_code]).to eq("59440")
1670
+ end
1671
+ it 'returns the Charge amount (integer)' do
1672
+ expect(@check_5010[:eras][0][:line_items][1][:charge_amount]).to eq(10000)
1673
+ end
1674
+ it 'returns the Payment amount (integer)' do
1675
+ expect(@check_5010[:eras][0][:line_items][1][:payment_amount]).to eq(5000)
1676
+ end
1677
+ it 'returns the Total adjustment amount (integer)' do
1678
+ expect(@check_5010[:eras][0][:line_items][1][:total_adjustment_amount]).to eq(5000)
1679
+ end
1680
+ it 'returns the Remark code' do
1681
+ expect(@check_5010[:eras][0][:line_items][1][:remark_code]).to eq(nil)
1682
+ end
1683
+ it 'returns the Remarks' do
1684
+ expect(@check_5010[:eras][0][:line_items][1][:remarks]).to eq(nil)
1685
+ end
1686
+ it 'returns the Reference number' do
1687
+ expect(@check_5010[:eras][0][:line_items][1][:reference_number]).to eq('0002')
1688
+ end
1689
+ context 'Adjustment group #0' do
1690
+ it 'returns the Adjustment group' do
1691
+ expect(@check_5010[:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group]).to eq("Patient Responsibility")
1692
+ end
1693
+ it 'returns the Adjustment group code' do
1694
+ expect(@check_5010[:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group_code]).to eq("PR")
1695
+ end
1696
+ it 'returns the Adjustment amount (integer)' do
1697
+ expect(@check_5010[:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_amount]).to eq(5000)
1698
+ end
1699
+ it 'returns the Reason code' do
1700
+ expect(@check_5010[:eras][0][:line_items][1][:adjustment_groups][0][:reason_code]).to eq('3')
1701
+ end
1702
+ it 'returns the Translated reason code' do
1703
+ expect(@check_5010[:eras][0][:line_items][1][:adjustment_groups][0][:translated_reason_code]).to eq("Co-payment Amount")
1704
+ end
1705
+ end
1706
+ end
1707
+ context 'Line item #2' do
1708
+ it 'returns the Date of service (string mm/dd/yyyy)' do
1709
+ expect(@check_5010[:eras][0][:line_items][2][:service_date]).to eq("12/31/2010")
1710
+ end
1711
+ it 'returns the CPT code' do
1712
+ expect(@check_5010[:eras][0][:line_items][2][:cpt_code]).to eq("59426")
1713
+ end
1714
+ it 'returns the Charge amount (integer)' do
1715
+ expect(@check_5010[:eras][0][:line_items][2][:charge_amount]).to eq(9900)
1716
+ end
1717
+ it 'returns the Payment amount (integer)' do
1718
+ expect(@check_5010[:eras][0][:line_items][2][:payment_amount]).to eq(4950)
1719
+ end
1720
+ it 'returns the Total adjustment amount (integer)' do
1721
+ expect(@check_5010[:eras][0][:line_items][2][:total_adjustment_amount]).to eq(4950)
1722
+ end
1723
+ it 'returns the Remark code' do
1724
+ expect(@check_5010[:eras][0][:line_items][2][:remark_code]).to eq(nil)
1725
+ end
1726
+ it 'returns the Remarks' do
1727
+ expect(@check_5010[:eras][0][:line_items][2][:remarks]).to eq(nil)
1728
+ end
1729
+ it 'returns the Reference number' do
1730
+ expect(@check_5010[:eras][0][:line_items][2][:reference_number]).to eq('0003')
1731
+ end
1732
+ end
1733
+ end
1734
+ end
1735
+ end
1736
+
1737
+ context 'example_7.835' do
1738
+ # Multi-check 835 where PLB segments carry multiple reason/amount pairs
1739
+ # (PLB03-04 through PLB13-14). Each pair must parse as its own
1740
+ # adjustment and be attributed to the check (TRN) it belongs to.
1741
+ before :all do
1742
+ @era = Era835Parser::Parser.new(file_path: "../era_835_parser/spec/example_7.835").parse
1743
+ end
1744
+
1745
+ context 'Aggregate totals' do
1746
+ it 'returns the correct number of checks' do
1747
+ expect(@era[:checks].count).to eq(2)
1748
+ end
1749
+ it 'returns one adjustment per reason/amount pair across the file' do
1750
+ expect(@era[:adjustments].count).to eq(5)
1751
+ end
1752
+ end
1753
+
1754
+ context 'Check #02790758 (zero payment, multi-pair PLB)' do
1755
+ it 'returns the transaction handling code' do
1756
+ expect(@era[:checks]['02790758'][:transaction_handling_code]).to eq('H')
1757
+ end
1758
+ it 'returns the check amount (integer)' do
1759
+ expect(@era[:checks]['02790758'][:amount]).to eq(0)
1760
+ end
1761
+ it 'returns one provider adjustment per reason/amount pair' do
1762
+ expect(@era[:checks]['02790758'][:provider_adjustments].count).to eq(4)
1763
+ end
1764
+ it 'returns the first pair' do
1765
+ adjustment = @era[:checks]['02790758'][:provider_adjustments][0]
1766
+ expect(adjustment[:reason_code]).to eq('FB')
1767
+ expect(adjustment[:reason]).to eq('Forwarding Balance')
1768
+ expect(adjustment[:reference_id]).to eq('926072000117048')
1769
+ expect(adjustment[:adjustment_amount]).to eq(547904)
1770
+ expect(adjustment[:provider_id]).to eq('0987654321')
1771
+ expect(adjustment[:adjustment_date]).to eq('03/14/2026')
1772
+ end
1773
+ it 'returns the second pair' do
1774
+ adjustment = @era[:checks]['02790758'][:provider_adjustments][1]
1775
+ expect(adjustment[:reason_code]).to eq('FB')
1776
+ expect(adjustment[:reference_id]).to eq('926073000032814')
1777
+ expect(adjustment[:adjustment_amount]).to eq(-375852)
1778
+ end
1779
+ it 'returns the third pair' do
1780
+ adjustment = @era[:checks]['02790758'][:provider_adjustments][2]
1781
+ expect(adjustment[:reason_code]).to eq('WO')
1782
+ expect(adjustment[:reason]).to eq('Overpayment Recovery')
1783
+ expect(adjustment[:reference_id]).to eq('200200964A52')
1784
+ expect(adjustment[:adjustment_amount]).to eq(11576)
1785
+ end
1786
+ it 'returns the fourth pair' do
1787
+ adjustment = @era[:checks]['02790758'][:provider_adjustments][3]
1788
+ expect(adjustment[:reason_code]).to eq('CS')
1789
+ expect(adjustment[:reason]).to eq('Adjustment')
1790
+ expect(adjustment[:reference_id]).to eq('200200964A52')
1791
+ expect(adjustment[:adjustment_amount]).to eq(-11576)
1792
+ end
1793
+ end
1794
+
1795
+ context 'Check #99887766 (single-pair PLB)' do
1796
+ it 'returns the transaction handling code' do
1797
+ expect(@era[:checks]['99887766'][:transaction_handling_code]).to eq('I')
1798
+ end
1799
+ it 'returns the check amount (integer)' do
1800
+ expect(@era[:checks]['99887766'][:amount]).to eq(10000)
1801
+ end
1802
+ it 'returns one provider adjustment' do
1803
+ expect(@era[:checks]['99887766'][:provider_adjustments].count).to eq(1)
1804
+ end
1805
+ it 'returns the pair' do
1806
+ adjustment = @era[:checks]['99887766'][:provider_adjustments][0]
1807
+ expect(adjustment[:reason_code]).to eq('WO')
1808
+ expect(adjustment[:reason]).to eq('Overpayment Recovery')
1809
+ expect(adjustment[:reference_id]).to eq('926074000055521')
1810
+ expect(adjustment[:adjustment_amount]).to eq(2500)
1811
+ end
1812
+ end
1813
+ end
1157
1814
  end
1158
1815
 
1159
1816
  context 'Human readable' do
@@ -0,0 +1,66 @@
1
+ ST*835*1234~
2
+ BPR*H*0*C*NON************20260108~
3
+ TRN*1*5003*560894904~
4
+ REF*F2*LCLA438D~
5
+ DTM*405*20110104~
6
+ N1*PR*BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA~
7
+ N3*P O BOX 2291~
8
+ N4*DURHAM*NC*27702~
9
+ PER*CX*TE*8005554844~
10
+ N1*PE*XYZ HEALTHCARE CORPORATION*XX*0987654321~
11
+ N3*P O BOX XYZ~
12
+ N4*CHARLOTTE*NC*28234~
13
+ REF*TJ*123456789~
14
+ LX*1~
15
+ CLP*200200964A52*1*300*150*142.54*15*94151100100~
16
+ NM1*QC*1*Dough*Mary~
17
+ NM1*IL*1*Dough*Marty*L**Sr.*MI* YPB123456789009~
18
+ NM1*82*1*Jones*Alice****XX*1116359906~
19
+ DTM*050*20110103~
20
+ SVC*HC:59430*101*50.5**1*HC:59410~
21
+ DTM*472*20101231~
22
+ CAS*CO*42*25.5~
23
+ CAS*PR*2*25~
24
+ REF*6R*0001~
25
+ SVC*HC:59440*100*50**1*HC:59410~
26
+ DTM*472*20101231~
27
+ CAS*PR*3*50~
28
+ REF*6R*0002~
29
+ SVC*HC:59426*99*49.5**1~
30
+ DTM*472*20101231~
31
+ CAS*CO*42*49.5~
32
+ REF*6R*0003~
33
+ SE*33*1234~
34
+ ST*835*1234~
35
+ BPR*I*300*C*ACH************20260109~
36
+ TRN*1*5010*560894904~
37
+ REF*F2*LCLA438D~
38
+ DTM*405*20110104~
39
+ N1*PR*BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA~
40
+ N3*P O BOX 2291~
41
+ N4*DURHAM*NC*27702~
42
+ PER*CX*TE*8005554844~
43
+ N1*PE*XYZ HEALTHCARE CORPORATION*XX*0987654321~
44
+ N3*P O BOX XYZ~
45
+ N4*CHARLOTTE*NC*28234~
46
+ REF*TJ*123456789~
47
+ LX*1~
48
+ CLP*200200964A52*1*300*150*142.54*15*94151100100~
49
+ NM1*QC*1*Dough*Mary~
50
+ NM1*IL*1*Dough*Marty*L**Sr.*MI* YPB123456789009~
51
+ NM1*82*1*Jones*Alice****XX*1116359906~
52
+ DTM*050*20110103~
53
+ SVC*HC:59430*101*50.5**1*HC:59410~
54
+ DTM*472*20101231~
55
+ CAS*CO*42*25.5~
56
+ CAS*PR*2*25~
57
+ REF*6R*0001~
58
+ SVC*HC:59440*100*50**1*HC:59410~
59
+ DTM*472*20101231~
60
+ CAS*PR*3*50~
61
+ REF*6R*0002~
62
+ SVC*HC:59426*99*49.5**1~
63
+ DTM*472*20101231~
64
+ CAS*CO*42*49.5~
65
+ REF*6R*0003~
66
+ SE*33*1234~
@@ -0,0 +1,48 @@
1
+ ST*835*1234~
2
+ BPR*H*0*C*NON************20260314~
3
+ TRN*1*02790758*560894904~
4
+ REF*F2*LCLA438D~
5
+ DTM*405*20260310~
6
+ N1*PR*BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA~
7
+ N3*P O BOX 2291~
8
+ N4*DURHAM*NC*27702~
9
+ PER*CX*TE*8005554844~
10
+ N1*PE*XYZ HEALTHCARE CORPORATION*XX*0987654321~
11
+ N3*P O BOX XYZ~
12
+ N4*CHARLOTTE*NC*28234~
13
+ REF*TJ*123456789~
14
+ LX*1~
15
+ CLP*200200964A52*1*150*67.73*0*15*94151100100~
16
+ NM1*QC*1*Dough*Mary****MI*YPB123456789001~
17
+ DTM*050*20260310~
18
+ SVC*HC:92507*150*67.73**1~
19
+ DTM*472*20260301~
20
+ CAS*CO*45*82.27~
21
+ REF*6R*0001~
22
+ AMT*B6*67.73~
23
+ PLB*0987654321*20260314*FB:926072000117048*5479.04*FB:926073000032814*-3758.52*WO:200200964A52*115.76*CS:200200964A52*-115.76~
24
+ SE*27*1234~
25
+ ST*835*1235~
26
+ BPR*I*100*C*CHK************20260314~
27
+ TRN*1*99887766*560894904~
28
+ REF*F2*LCLA439D~
29
+ DTM*405*20260310~
30
+ N1*PR*BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA~
31
+ N3*P O BOX 2291~
32
+ N4*DURHAM*NC*27702~
33
+ PER*CX*TE*8005554844~
34
+ N1*PE*XYZ HEALTHCARE CORPORATION*XX*0987654321~
35
+ N3*P O BOX XYZ~
36
+ N4*CHARLOTTE*NC*28234~
37
+ REF*TJ*123456789~
38
+ LX*1~
39
+ CLP*300300964B63*1*125*100*0*15*94151100200~
40
+ NM1*QC*1*Dough*John****MI*YPB123456789002~
41
+ DTM*050*20260310~
42
+ SVC*HC:92507*125*100**1~
43
+ DTM*472*20260301~
44
+ CAS*CO*45*25~
45
+ REF*6R*0001~
46
+ AMT*B6*100~
47
+ PLB*0987654321*20260314*WO:926074000055521*25~
48
+ SE*24*1235~
metadata CHANGED
@@ -1,27 +1,26 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: era_835_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin S. Dias
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-03-04 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - "~>"
16
+ - - ">="
18
17
  - !ruby/object:Gem::Version
19
18
  version: '1.7'
20
19
  type: :development
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - "~>"
23
+ - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '1.7'
27
26
  - !ruby/object:Gem::Dependency
@@ -80,13 +79,14 @@ files:
80
79
  - spec/example_3.835
81
80
  - spec/example_4.835
82
81
  - spec/example_5.835
82
+ - spec/example_6.835
83
+ - spec/example_7.835
83
84
  - spec/spec_helper.rb
84
85
  - spec/test_era.txt
85
86
  homepage: https://github.com/diasks2/era_835_parser
86
87
  licenses:
87
88
  - MIT
88
89
  metadata: {}
89
- post_install_message:
90
90
  rdoc_options: []
91
91
  require_paths:
92
92
  - lib
@@ -101,8 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.3.26
105
- signing_key:
104
+ rubygems_version: 3.7.2
106
105
  specification_version: 4
107
106
  summary: Electronic Remittance Advice (ERA) 835 parser
108
107
  test_files:
@@ -112,5 +111,7 @@ test_files:
112
111
  - spec/example_3.835
113
112
  - spec/example_4.835
114
113
  - spec/example_5.835
114
+ - spec/example_6.835
115
+ - spec/example_7.835
115
116
  - spec/spec_helper.rb
116
117
  - spec/test_era.txt