Skip to content

Commit eca99ca

Browse files
committed
feat: add one piece nacha
1 parent c9084fa commit eca99ca

File tree

192 files changed

+34639
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+34639
-1
lines changed

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
elixir 1.13.2
1+
elixir 1.14.0
22
erlang 24.2.1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Used by "mix format"
2+
[
3+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
4+
]

apps/one_piece_nacha/.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where third-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Ignore package tarball (built via "mix hex.build").
23+
one_piece_nacha-*.tar
24+
25+
# Temporary files, for example, from tests.
26+
/tmp/

apps/one_piece_nacha/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# OnePieceNacha
2+
3+
**TODO: Add description**
4+
5+
## Installation
6+
7+
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
8+
by adding `one_piece_nacha` to your list of dependencies in `mix.exs`:
9+
10+
```elixir
11+
def deps do
12+
[
13+
{:one_piece_nacha, "~> 0.1.0"}
14+
]
15+
end
16+
```
17+
18+
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
19+
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
20+
be found at <https://hexdocs.pm/one_piece_nacha>.
21+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
defmodule OnePiece.Nacha.BatchControl do
2+
@enforce_keys [
3+
:record_type_code,
4+
:service_class_code,
5+
:entry_addenda_count,
6+
:entry_hash,
7+
:total_debit_entry_dollar_amount,
8+
:total_credit_entry_dollar_amount,
9+
:company_identification,
10+
:message_authentication_code,
11+
:reserved,
12+
:originating_financial_institution_id,
13+
:batch_number,
14+
:__parsing_info__
15+
]
16+
17+
defstruct @enforce_keys
18+
19+
def post_traverse(rest, parsed_line, context, line, byte_offset) do
20+
{rest,
21+
[
22+
%__MODULE__{
23+
record_type_code: Enum.at(parsed_line, 10),
24+
service_class_code: Enum.at(parsed_line, 9),
25+
entry_addenda_count: Enum.at(parsed_line, 8),
26+
entry_hash: Enum.at(parsed_line, 7),
27+
total_debit_entry_dollar_amount: Enum.at(parsed_line, 6),
28+
total_credit_entry_dollar_amount: Enum.at(parsed_line, 5),
29+
company_identification: Enum.at(parsed_line, 4),
30+
message_authentication_code: Enum.at(parsed_line, 3),
31+
reserved: Enum.at(parsed_line, 2),
32+
originating_financial_institution_id: Enum.at(parsed_line, 1),
33+
batch_number: Enum.at(parsed_line, 0),
34+
__parsing_info__: OnePiece.Nacha.ParsingInfo.new(line, byte_offset)
35+
}
36+
], context}
37+
end
38+
end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
:odfi_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+
odfi_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
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
defmodule OnePiece.Nacha.CddAddenda do
2+
@enforce_keys [
3+
:record_type_code,
4+
:addenda_type_code,
5+
:payment_related_information,
6+
:addenda_sequence_number,
7+
:entry_detail_sequence_number,
8+
:__parsing_info__
9+
]
10+
11+
defstruct @enforce_keys
12+
13+
def post_traverse(rest, parsed_line, context, line, byte_offset) do
14+
{rest,
15+
[
16+
%__MODULE__{
17+
record_type_code: Enum.at(parsed_line, 4),
18+
addenda_type_code: Enum.at(parsed_line, 3),
19+
payment_related_information: Enum.at(parsed_line, 2),
20+
addenda_sequence_number: Enum.at(parsed_line, 1),
21+
entry_detail_sequence_number: Enum.at(parsed_line, 0),
22+
__parsing_info__: OnePiece.Nacha.ParsingInfo.new(line, byte_offset)
23+
}
24+
], context}
25+
end
26+
end
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
defmodule OnePiece.Nacha.CddEntryDetail do
2+
@enforce_keys [
3+
:record_type_code,
4+
:transaction_code,
5+
:receiving_dfi_identification,
6+
:check_digit,
7+
:dfi_account_number,
8+
:amount,
9+
:identification_number,
10+
:receiving_company_name,
11+
:discretionary_data,
12+
:addenda_record_indicator,
13+
:trace_number,
14+
:__parsing_info__
15+
]
16+
17+
defstruct @enforce_keys
18+
19+
def post_traverse(rest, parsed_line, context, line, byte_offset) do
20+
{rest,
21+
[
22+
%__MODULE__{
23+
record_type_code: Enum.at(parsed_line, 10),
24+
transaction_code: Enum.at(parsed_line, 9),
25+
receiving_dfi_identification: Enum.at(parsed_line, 8),
26+
check_digit: Enum.at(parsed_line, 7),
27+
dfi_account_number: Enum.at(parsed_line, 6),
28+
amount: Enum.at(parsed_line, 5),
29+
identification_number: Enum.at(parsed_line, 4),
30+
receiving_company_name: Enum.at(parsed_line, 3),
31+
discretionary_data: Enum.at(parsed_line, 2),
32+
addenda_record_indicator: Enum.at(parsed_line, 1),
33+
trace_number: Enum.at(parsed_line, 0),
34+
__parsing_info__: OnePiece.Nacha.ParsingInfo.new(line, byte_offset)
35+
}
36+
], context}
37+
end
38+
end
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
defmodule OnePiece.Nacha.CtxAddenda do
2+
@enforce_keys [
3+
:record_type_code,
4+
:addenda_type_code,
5+
:payment_related_information,
6+
:addenda_sequence_number,
7+
:entry_detail_sequence_number,
8+
:__parsing_info__
9+
]
10+
11+
defstruct @enforce_keys
12+
13+
def post_traverse(rest, parsed_line, context, line, byte_offset) do
14+
{rest, [%__MODULE__{
15+
record_type_code: Enum.at(parsed_line, 4),
16+
addenda_type_code: Enum.at(parsed_line, 3),
17+
payment_related_information: Enum.at(parsed_line, 2),
18+
addenda_sequence_number: Enum.at(parsed_line, 1),
19+
entry_detail_sequence_number: Enum.at(parsed_line, 0),
20+
__parsing_info__: OnePiece.Nacha.ParsingInfo.new(line, byte_offset)
21+
}], context}
22+
end
23+
end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
defmodule OnePiece.Nacha.CtxEntryDetail do
2+
@enforce_keys [
3+
:record_type_code,
4+
:transaction_code,
5+
:receiving_dfi_identification,
6+
:check_digit,
7+
:dfi_account_number,
8+
:amount,
9+
:identification_number,
10+
:number_of_addenda_records,
11+
:receiving_company_name_id_number,
12+
:reserved,
13+
:discretionary_data,
14+
:addenda_record_indicator,
15+
:trace_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+
transaction_code: Enum.at(parsed_line, 11),
27+
receiving_dfi_identification: Enum.at(parsed_line, 10),
28+
check_digit: Enum.at(parsed_line, 9),
29+
dfi_account_number: Enum.at(parsed_line, 8),
30+
amount: Enum.at(parsed_line, 7),
31+
identification_number: Enum.at(parsed_line, 6),
32+
number_of_addenda_records: Enum.at(parsed_line, 5),
33+
receiving_company_name_id_number: Enum.at(parsed_line, 4),
34+
reserved: Enum.at(parsed_line, 3),
35+
discretionary_data: Enum.at(parsed_line, 2),
36+
addenda_record_indicator: Enum.at(parsed_line, 1),
37+
trace_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

Comments
 (0)