OpenPayments.Types.CardAuthorization (open_payments_elixir v1.0.0)

Copy Markdown View Source

Card authorization credentials or results carried on outgoing-payment access.

The pinned schema requires string tlvData and requestId fields. Optional string pinBlock requires typed pwk PIN working-key data whenever present; pwk may also be supplied without a PIN block. Additional fields are forbidden. Omitted optional fields become nil; explicit JSON null is rejected.

Field strings are preserved without TLV parsing, hex/length checks, UUID requirements or PIN cryptography. Request-ID generation and replay correlation belong to the operation layer. This data codec makes no network requests.

Inspection omits all values. Explicit to_map/1 and JSON encoding contain sensitive card/key data; validation errors retain only safe field paths. Validate manually constructed or modified structs with validate/1; to_map/1 converts shape without validating it.

Summary

Functions

Decodes card authorization JSON and enforces the pinBlock-to-pwk dependency.

Converts to protocol fields, including sensitive payload data, without validating.

Validates a struct, treating nil optional fields as omitted.

Types

t()

@type t() :: %OpenPayments.Types.CardAuthorization{
  pin_block: String.t() | nil,
  pwk: OpenPayments.Types.PINWorkingKey.t() | nil,
  request_id: String.t(),
  tlv_data: String.t()
}

Functions

from_map(data)

@spec from_map(map()) :: {:ok, t()} | {:error, OpenPayments.Error.t()}

Decodes card authorization JSON and enforces the pinBlock-to-pwk dependency.

to_map(card)

@spec to_map(t()) :: map()

Converts to protocol fields, including sensitive payload data, without validating.

validate(card)

@spec validate(t()) :: :ok | {:error, OpenPayments.Error.t()}

Validates a struct, treating nil optional fields as omitted.