# dbhat93/payment-file-demo architecture

> Architecture diagram of the GitHub repository dbhat93/payment-file-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dbhat93/payment-file-demo
- Repository: https://github.com/dbhat93/payment-file-demo

## Overview

payment-file-demo is a synthetic ACH/X9.37 demonstration, not a production payment processor. Its main workflow is generating or supplying sample payment files, validating them with the Go checker, and comparing an older ACH reader with a reference reader; returns can also be matched to original payments. An outbound-write hook automatically invokes validation. The earlier COBOL extract exercise is explicitly outside the demo and is omitted. The live `new_ach.py` described in the README is absent from the tree, so the graph uses only the available reference implementation.

Main entry points: [`checker/main.go`](https://github.com/dbhat93/payment-file-demo/blob/main/checker/main.go) (File checker), [`eval/run_eval.py`](https://github.com/dbhat93/payment-file-demo/blob/main/eval/run_eval.py) (Evaluation runner), [`samples/ach`](https://github.com/dbhat93/payment-file-demo/tree/main/samples/ach) (ACH samples), [`harness/compare.py`](https://github.com/dbhat93/payment-file-demo/blob/main/harness/compare.py) (Reader comparator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_files["Payment files"]
  node_ach_samples["ACH samples"]
  node_x937_samples["X9.37 samples"]
  node_ach_generator["ACH generator<br/>[gen_ach.py]"]
end

subgraph group_validation["Validation"]
  node_checker["File checker<br/>[main.go]"]
  node_outbound["Outbound files"]
  node_write_hook["Write hook"]
end

subgraph group_comparison["Reader comparison"]
  node_legacy_reader["Legacy ACH reader<br/>[old_ach.py]"]
  node_reference_reader["ACH reference reader"]
  node_comparator["Reader comparator<br/>[compare.py]"]
  node_eval_runner["Evaluation runner<br/>[run_eval.py]"]
end

subgraph group_returns["Returns analysis"]
  node_return_matcher["Return matcher<br/>[match_returns.py]"]
end

node_user(("Engineer"))
node_ach_library["Moov ACH library"]
node_x937_library["Moov X9.37 library"]

node_user -->|"generates files"| node_ach_generator
node_ach_generator -->|"writes samples"| node_ach_samples
node_user -->|"checks file"| node_checker
node_user -->|"runs evaluation"| node_eval_runner
node_eval_runner -->|"runs checks"| node_checker
node_eval_runner -->|"compares readers"| node_comparator
node_eval_runner -->|"matches returns"| node_return_matcher
node_comparator -->|"loads reader"| node_legacy_reader
node_comparator -->|"loads reader"| node_reference_reader
node_return_matcher -.->|"reads payments"| node_ach_samples
node_return_matcher -.->|"reads returns"| node_ach_samples
node_write_hook -->|"checks writes"| node_outbound
node_write_hook -->|"invokes checker"| node_checker
node_checker -->|"parses ACH"| node_ach_library
node_checker -->|"parses X9.37"| node_x937_library
node_checker -.->|"validates input"| node_ach_samples
node_checker -.->|"validates input"| node_x937_samples

click node_ach_samples "https://github.com/dbhat93/payment-file-demo/tree/main/samples/ach"
click node_x937_samples "https://github.com/dbhat93/payment-file-demo/tree/main/samples/x937"
click node_ach_generator "https://github.com/dbhat93/payment-file-demo/blob/main/harness/gen_ach.py"
click node_checker "https://github.com/dbhat93/payment-file-demo/blob/main/checker/main.go"
click node_outbound "https://github.com/dbhat93/payment-file-demo/tree/main/outbound"
click node_write_hook "https://github.com/dbhat93/payment-file-demo/blob/main/scripts/validate_payment_file.py"
click node_legacy_reader "https://github.com/dbhat93/payment-file-demo/blob/main/legacy/old_ach.py"
click node_reference_reader "https://github.com/dbhat93/payment-file-demo/blob/main/eval/answer_key_new_ach.py"
click node_comparator "https://github.com/dbhat93/payment-file-demo/blob/main/harness/compare.py"
click node_eval_runner "https://github.com/dbhat93/payment-file-demo/blob/main/eval/run_eval.py"
click node_return_matcher "https://github.com/dbhat93/payment-file-demo/blob/main/eval/match_returns.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ach_samples,node_x937_samples,node_ach_generator toneBlue
class node_checker,node_outbound,node_write_hook toneAmber
class node_legacy_reader,node_reference_reader,node_comparator,node_eval_runner toneMint
class node_return_matcher toneRose
class node_user,node_ach_library,node_x937_library toneIndigo
```

## Components

### Payment files

- [ACH samples](https://github.com/dbhat93/payment-file-demo/tree/main/samples/ach): `samples/ach`
- [X9.37 samples](https://github.com/dbhat93/payment-file-demo/tree/main/samples/x937): `samples/x937`
- [ACH generator](https://github.com/dbhat93/payment-file-demo/blob/main/harness/gen_ach.py): `harness/gen_ach.py`

### Validation

- [File checker](https://github.com/dbhat93/payment-file-demo/blob/main/checker/main.go): `checker/main.go`
- [Outbound files](https://github.com/dbhat93/payment-file-demo/tree/main/outbound): `outbound`
- [Write hook](https://github.com/dbhat93/payment-file-demo/blob/main/scripts/validate_payment_file.py): `scripts/validate_payment_file.py`

### Reader comparison

- [Legacy ACH reader](https://github.com/dbhat93/payment-file-demo/blob/main/legacy/old_ach.py): `legacy/old_ach.py`
- [ACH reference reader](https://github.com/dbhat93/payment-file-demo/blob/main/eval/answer_key_new_ach.py): `eval/answer_key_new_ach.py`
- [Reader comparator](https://github.com/dbhat93/payment-file-demo/blob/main/harness/compare.py): `harness/compare.py`
- [Evaluation runner](https://github.com/dbhat93/payment-file-demo/blob/main/eval/run_eval.py): `eval/run_eval.py`

### Returns analysis

- [Return matcher](https://github.com/dbhat93/payment-file-demo/blob/main/eval/match_returns.py): `eval/match_returns.py`

### Other components

- **Engineer**
- **Moov ACH library**
- **Moov X9.37 library**

## Connections

- Engineer → ACH generator: generates files (evidence: `README.md`)
- ACH generator → ACH samples: writes samples (evidence: `harness/gen_ach.py`)
- Engineer → File checker: checks file (evidence: `README.md`)
- Engineer → Evaluation runner: runs evaluation (evidence: `README.md`)
- Evaluation runner → File checker: runs checks (evidence: `eval/run_eval.py`)
- Evaluation runner → Reader comparator: compares readers (evidence: `eval/run_eval.py`)
- Evaluation runner → Return matcher: matches returns (evidence: `eval/run_eval.py`)
- Reader comparator → Legacy ACH reader: loads reader (evidence: `harness/compare.py`)
- Reader comparator → ACH reference reader: loads reader (evidence: `harness/compare.py`)
- Return matcher → ACH samples: reads payments
- Return matcher → ACH samples: reads returns
- Write hook → Outbound files: checks writes (evidence: `README.md`)
- Write hook → File checker: invokes checker (evidence: `scripts/validate_payment_file.py`)
- File checker → Moov ACH library: parses ACH (evidence: `checker/main.go`)
- File checker → Moov X9.37 library: parses X9.37 (evidence: `checker/main.go`)
- File checker → ACH samples: validates input
- File checker → X9.37 samples: validates input
