Configuration struct controlling how ExReconcile.reconcile/3 behaves.
Build one via new/1 (or pass keyword options directly to ExReconcile.reconcile/3).
Options
| Option | Type | Default | Description |
|---|---|---|---|
:match_on | [atom] | [:amount, :date] | Fields used to find candidate pairs. |
:amount_tolerance | number | 0 | Maximum absolute difference in amount that still counts as a match. |
:date_tolerance | non_neg_integer | 0 | Maximum absolute difference in days for date matching. |
:description_match | :case_insensitive | :ignore | :case_insensitive | How descriptions are compared when checking for discrepancies or matching. |
Valid match_on fields
:id- match when both transactions carry the same non-nil:id.:amount- match whenabs(left.amount - right.amount) <= amount_tolerance.:date- match whenabs(Date.diff(left.date, right.date)) <= date_tolerance.:description- match when descriptions are equal after normalisation (trim + downcase).
Examples
iex> ExReconcile.Config.new(match_on: [:id], amount_tolerance: 0)
%ExReconcile.Config{match_on: [:id], amount_tolerance: 0, date_tolerance: 0, description_match: :case_insensitive}
iex> ExReconcile.Config.new(match_on: [:amount, :date], date_tolerance: 2)
%ExReconcile.Config{match_on: [:amount, :date], date_tolerance: 2, amount_tolerance: 0, description_match: :case_insensitive}
Summary
Types
@type description_match() :: :case_insensitive | :ignore
@type t() :: %ExReconcile.Config{ amount_tolerance: number(), date_tolerance: non_neg_integer(), description_match: description_match(), match_on: [atom()] }
Functions
Create a Config from options, validating all values.
Raises ArgumentError on invalid input.