OpenPayments.Types.GrantRequest (open_payments_elixir v1.0.0)

Copy Markdown View Source

A complete grant initiation request with typed client, access, interaction and subject data.

A client identity is required. The pinned anyOf contract allows an access-token request, or a subject request with interaction, or both. Subject information alongside an access-token request does not itself require interaction. Directed JWK identity cannot be combined with an explicit interact field, following the specification's non-interactive restriction.

Omitted optional fields become nil; explicit JSON nulls are rejected. Additional JSON fields are retained in extensions at the root and nested access-token-request level. Known wire names and nested string/object forms are preserved. All nested models and access entries are revalidated by validate/1.

Inspection omits payload values. Explicit map/JSON exports contain nonces, subject identifiers and any card data. This type does not fetch keys, match a directed JWK to a configured signing key, sign or send a request, or verify a callback. to_map/1 converts shape without validating it.

Summary

Functions

Decodes a complete grant request and validates its nested models and variant.

Converts to a complete protocol request, including sensitive fields, without validating.

Revalidates typed nested fields, request variants and extension rules.

Types

t()

@type t() :: %OpenPayments.Types.GrantRequest{
  access_token: OpenPayments.Types.AccessTokenRequest.t() | nil,
  client: OpenPayments.Types.GrantClient.t(),
  extensions: %{optional(String.t()) => term()},
  interact: OpenPayments.Types.InteractionRequest.t() | nil,
  subject: OpenPayments.Types.Subject.t() | nil
}

Functions

from_map(data)

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

Decodes a complete grant request and validates its nested models and variant.

to_map(request)

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

Converts to a complete protocol request, including sensitive fields, without validating.

validate(request)

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

Revalidates typed nested fields, request variants and extension rules.