Codat.BankFeeds.AccountMapping (codat v1.0.0)

Copy Markdown View Source

Retrieve and configure the mapping between source accounts and the customer's chart of accounts.

Customers must map their bank feed source accounts to existing GL accounts (or create new ones) in their accounting software before transactions can flow.

Summary

Functions

Returns the mapping options for a source account (available target GL accounts).

Functions

get_options(client_or_company_id, company_or_conn_id, conn_or_account_id, account_or_opts \\ [])

@spec get_options(
  Codat.Client.t() | String.t(),
  String.t(),
  String.t(),
  String.t() | keyword()
) ::
  {:ok, map()} | {:error, Codat.Error.t()}

Returns the mapping options for a source account (available target GL accounts).

Example

{:ok, mapping} = Codat.BankFeeds.AccountMapping.get_options(
  client, company_id, conn_id, source_account_id
)

set(client_or_company_id, company_or_conn_id, conn_or_account_id, account_or_body, body_or_opts \\ %{})

@spec set(
  Codat.Client.t() | String.t(),
  String.t(),
  String.t(),
  String.t(),
  map() | keyword()
) ::
  {:ok, map()} | {:error, Codat.Error.t()}

Sets the mapping for a source account to a target GL account.

Parameters

  • target_account_id — ID of the existing GL account to map to
  • feed_start_date — ISO8601 date from which to start feeding transactions

Example

{:ok, _} = Codat.BankFeeds.AccountMapping.set(
  client, company_id, conn_id, source_account_id,
  %{targetAccountId: "gl-account-id", feedStartDate: "2024-01-01"}
)