defmodule ISO20022.Camt053.TransactionDetails do
@moduledoc """
Individual transaction details from `<TxDtls>` within an entry details block.
## Remittance information
`remittance_info` is one of:
- `{:unstructured, text}` — free-text string (max 140 chars, from `<Ustrd>`)
- `{:structured, %{ref: ..., ref_type: ..., creditor_ref: ...}}` — from `<Strd>`
- `nil` — no remittance info present
## Related parties
`related_parties` is a map with optional keys:
`:debtor`, `:debtor_account`, `:creditor`, `:creditor_account`,
`:ultimate_debtor`, `:ultimate_creditor`, each being a `%{name, iban, other_id}` map.
## Related agents
`related_agents` is a map with optional keys:
`:debtor_agent`, `:creditor_agent`, each being a `%{bic, name}` map.
"""
@type party :: %{
name: String.t() | nil,
iban: String.t() | nil,
other_id: String.t() | nil
}
@type agent :: %{
bic: String.t() | nil,
name: String.t() | nil
}
@type remittance_info ::
{:unstructured, String.t()}
| {:structured,
%{
ref: String.t() | nil,
ref_type: String.t() | nil,
creditor_ref: String.t() | nil
}}
| nil
@type refs :: %{
message_id: String.t() | nil,
account_servicer_ref: String.t() | nil,
payment_info_id: String.t() | nil,
instruction_id: String.t() | nil,
end_to_end_id: String.t() | nil,
tx_id: String.t() | nil,
mandate_id: String.t() | nil,
uetr: String.t() | nil
}
@type t :: %__MODULE__{
refs: refs() | nil,
amount: Decimal.t() | nil,
currency: String.t() | nil,
credit_debit: :credit | :debit | nil,
related_parties: map() | nil,
related_agents: map() | nil,
remittance_info: remittance_info(),
purpose: String.t() | nil
}
defstruct [
:refs,
:amount,
:currency,
:credit_debit,
:related_parties,
:related_agents,
:remittance_info,
:purpose
]
end