OpenPayments.Types.AccessIncoming (open_payments_elixir v1.0.0)

Copy Markdown View Source

Incoming-payment permissions in a grant's access-item union.

Required type is incoming-payment; required actions is an array of unique strings from create, complete, read, read-all, list and list-all. Empty actions are allowed by the pinned schema. Optional identifier is an absolute URI: omission becomes nil, while explicit JSON null is invalid. Its spelling is preserved without HTTP request-target validation or payment-pointer conversion.

The enclosing access-item union forbids extra fields. This grant-facing type enforces that rule even though the standalone access-incoming branch does not repeat it. Inspection omits the identifier; explicit map/JSON export includes it. Decoding permissions does not obtain a grant or authorize a network request.

Struct literals can bypass validation. Call validate/1 after constructing or modifying a struct; to_map/1 converts its shape without validating it.

Summary

Functions

Decodes an incoming-payment grant access entry using the union's field rules.

Converts to protocol fields, omitting a nil identifier, without validating.

Validates a struct, treating a nil identifier as omitted.

Types

t()

@type t() :: %OpenPayments.Types.AccessIncoming{
  actions: [String.t()],
  identifier: String.t() | nil,
  type: String.t()
}

Functions

from_map(data)

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

Decodes an incoming-payment grant access entry using the union's field rules.

to_map(access)

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

Converts to protocol fields, omitting a nil identifier, without validating.

validate(access)

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

Validates a struct, treating a nil identifier as omitted.