Affordability and income verification reports, and Standard Financial Statements - used in lending and collections workflows.
Report generation is asynchronous: create/3 returns a report in
"pending" status, which transitions to "complete" (or "failed")
some time later. Poll with get/3, or subscribe to the
affordabilityReportSuccess / affordabilityReportFailure webhooks
(see MoneyHub.Webhooks) instead of polling.
See Lending and Collections Reports and Creating Affordability Widgets.
Summary
Functions
Polls get/3 until the report's status leaves "pending", sleeping
interval_ms between attempts, up to max_attempts. Returns the final
report (whether "complete" or "failed") or an error if the request
itself fails or attempts are exhausted while still pending.
Requests generation of an affordability (or income verification) report
for the user identified by token. attrs selects the report type and
any configuration (e.g. which accounts/date range to include).
Fetches a report's current status/contents by id. While "status" is
"pending", the report body is not yet populated.
Types
@type report() :: map()
Functions
@spec await(MoneyHub.Config.t(), String.t(), String.t(), keyword()) :: {:ok, report()} | {:error, MoneyHub.Error.t()}
Polls get/3 until the report's status leaves "pending", sleeping
interval_ms between attempts, up to max_attempts. Returns the final
report (whether "complete" or "failed") or an error if the request
itself fails or attempts are exhausted while still pending.
Prefer subscribing to the affordabilityReportSuccess /
affordabilityReportFailure webhooks in production - this helper is
intended for scripts, tests, and simple synchronous workflows.
@spec create(MoneyHub.Config.t(), String.t(), map()) :: {:ok, report()} | {:error, MoneyHub.Error.t()}
Requests generation of an affordability (or income verification) report
for the user identified by token. attrs selects the report type and
any configuration (e.g. which accounts/date range to include).
@spec get(MoneyHub.Config.t(), String.t(), String.t()) :: {:ok, report()} | {:error, MoneyHub.Error.t()}
Fetches a report's current status/contents by id. While "status" is
"pending", the report body is not yet populated.