Triple.Types.Enrich.V1.Request (triple v1.0.0)

Copy Markdown View Source

Request payload for POST /v1/enrich-transaction/ — structured transaction enrichment.

Build one with new/1 (validates locally and returns {:error, %Triple.Error{}} on bad input, mirroring the shape Triple's own 400 response would have) rather than constructing the struct directly.

Summary

Functions

Builds and validates a request from a map or keyword list.

Types

channel_type()

@type channel_type() :: :ATM | :POS | :ECOMMERCE

t()

@type t() :: %Triple.Types.Enrich.V1.Request{
  account_id: String.t() | nil,
  channel_type: channel_type() | String.t() | nil,
  merchant_category_code: non_neg_integer() | nil,
  merchant_city: String.t() | nil,
  merchant_country: String.t() | nil,
  merchant_id: String.t() | nil,
  merchant_name: String.t() | nil,
  merchant_postcode: String.t() | nil,
  transaction_amount: number() | String.t() | nil,
  transaction_currency: String.t() | nil,
  transaction_id: String.t() | nil,
  transaction_timestamp: DateTime.t() | String.t() | nil,
  transaction_type: transaction_type() | String.t() | nil,
  vat: String.t() | nil
}

transaction_type()

@type transaction_type() :: :BANK_TRANSFER | :CARD_TRANSACTION | :INVOICE

Functions

new(attrs)

@spec new(map() | keyword()) :: {:ok, t()} | {:error, Triple.Error.t()}

Builds and validates a request from a map or keyword list.

transaction_type and channel_type may be given as atoms (:CARD_TRANSACTION) or strings ("CARD_TRANSACTION").

Returns {:ok, t()} or {:error, %Triple.Error{type: :validation}}.