OpenPayments.Types.TokenRotationResponse (open_payments_elixir v1.0.0)

Copy Markdown View Source

The response to rotating an issued access token.

Required access_token becomes an AccessToken; permitted additional JSON fields remain in extensions. The wrapper is retained, matching the wire response and Node's rotate result. All nested access entries are validated.

Inspection omits payload values; explicit map/JSON exports include the token and any card results. This codec does not update a client, persist a token, assess expiry or compare old/new access. Validate modified structs with validate/1; to_map/1 converts shape without validating it.

Summary

Functions

Decodes the issued token wrapper and preserves permitted JSON extensions.

Converts to protocol fields, including token/card values, without validating.

Revalidates the issued token and JSON extension data.

Types

t()

@type t() :: %OpenPayments.Types.TokenRotationResponse{
  access_token: OpenPayments.Types.AccessToken.t(),
  extensions: %{optional(String.t()) => term()}
}

Functions

from_map(data)

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

Decodes the issued token wrapper and preserves permitted JSON extensions.

to_map(response)

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

Converts to protocol fields, including token/card values, without validating.

validate(response)

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

Revalidates the issued token and JSON extension data.