OpenPayments.Types.Access (open_payments_elixir v1.0.0)

Copy Markdown View Source

A grant access array containing typed incoming-payment, outgoing-payment or quote entries.

from_list/1 decodes JSON objects to their corresponding structs. The pinned schema permits an empty array and at most three unique objects. Distinct objects of the same resource type are allowed. Entry and action order are preserved; uniqueness compares complete JSON values, independent of object-key order.

The result is an ordinary Elixir list of typed structs. Jason encodes the list directly; to_list/1 explicitly converts entries to wire maps. Those exports can include sensitive card data. Entry inspection omits it. Errors include safe indexed paths such as access[1].card_authorization.pwk.key.

validate/1 revalidates modified typed lists. These functions do not obtain a grant, process a card, track spending or make network requests.

Summary

Functions

Decodes up to three unique access JSON objects into an ordered typed list.

Converts typed entries to wire maps without validating, including card payloads.

Validates a list of typed access entries and its cardinality/uniqueness.

Types

Functions

from_list(values)

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

Decodes up to three unique access JSON objects into an ordered typed list.

to_list(items)

@spec to_list(t()) :: [map()]

Converts typed entries to wire maps without validating, including card payloads.

validate(values)

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

Validates a list of typed access entries and its cardinality/uniqueness.