|
| 1 | +defmodule OnePiece.Nacha.BatchHeader do |
| 2 | + @enforce_keys [ |
| 3 | + :record_type_code, |
| 4 | + :service_class_code, |
| 5 | + :company_name, |
| 6 | + :company_discretionary_data, |
| 7 | + :company_identification, |
| 8 | + :standard_entry_class, |
| 9 | + :company_entry_description, |
| 10 | + :company_descriptive_date, |
| 11 | + :effective_entry_date, |
| 12 | + :settlement_date, |
| 13 | + :originator_status_code, |
| 14 | + :originating_dfi_identification, |
| 15 | + :batch_number, |
| 16 | + :__parsing_info__ |
| 17 | + ] |
| 18 | + |
| 19 | + defstruct @enforce_keys |
| 20 | + |
| 21 | + def post_traverse(rest, parsed_line, context, line, byte_offset) do |
| 22 | + {rest, |
| 23 | + [ |
| 24 | + %__MODULE__{ |
| 25 | + record_type_code: Enum.at(parsed_line, 12), |
| 26 | + service_class_code: Enum.at(parsed_line, 11), |
| 27 | + company_name: Enum.at(parsed_line, 10), |
| 28 | + company_discretionary_data: Enum.at(parsed_line, 9), |
| 29 | + company_identification: Enum.at(parsed_line, 8), |
| 30 | + standard_entry_class: Enum.at(parsed_line, 7), |
| 31 | + company_entry_description: Enum.at(parsed_line, 6), |
| 32 | + company_descriptive_date: Enum.at(parsed_line, 5), |
| 33 | + effective_entry_date: Enum.at(parsed_line, 4), |
| 34 | + settlement_date: Enum.at(parsed_line, 3), |
| 35 | + originator_status_code: Enum.at(parsed_line, 2), |
| 36 | + originating_dfi_identification: Enum.at(parsed_line, 1), |
| 37 | + batch_number: Enum.at(parsed_line, 0), |
| 38 | + __parsing_info__: OnePiece.Nacha.ParsingInfo.new(line, byte_offset) |
| 39 | + } |
| 40 | + ], context} |
| 41 | + end |
| 42 | +end |
0 commit comments