ibanity v0.6.0 Ibanity.Consent.Consent

Link to this section Summary

Functions

[Creates a consent].

[Finds a consent].

[Revokes a consent].

[Validates a consent].

Link to this section Functions

Link to this function

create(request)

[Creates a consent].

Returns {:ok, consent} if successful, {:error, reason} otherwise.

Example

iex> [
...>   action_type: "checkbox",
...>   displayed_text: "Your consent text.",
...>   ...
...> ]
...> |> Request.attributes
...> |> Consent.create
{:ok, %Ibanity.Consent.Consent{id: "270141aa-0c93-42a5-9adf-e2b9a8ab4cea"}}

[Finds a consent].

Returns {:ok, consent} if successful, {:error, reason} otherwise.

Example

iex> "270141aa-0c93-42a5-9adf-e2b9a8ab4cea"
...> |> Request.id
...> |> Consent.find
{:ok, %Ibanity.Consent.Consent{id: "270141aa-0c93-42a5-9adf-e2b9a8ab4cea"}}
Link to this function

revoke(request)

[Revokes a consent].

Returns {:ok, consent} if successful, {:error, reason} otherwise.

Example

iex> [
...>   consent_id: "270141aa-0c93-42a5-9adf-e2b9a8ab4cea"
...> ]
...> |> Request.ids
...> |> Consent.revoke
{:ok, %Ibanity.Consent.Consent{id: "270141aa-0c93-42a5-9adf-e2b9a8ab4cea"}}
Link to this function

validate(request)

[Validates a consent].

Returns {:ok, consent} if successful, {:error, reason} otherwise.

Example

iex> [
...>   consent_id: "270141aa-0c93-42a5-9adf-e2b9a8ab4cea"
...> ]
...> |> Request.ids
...> |> Consent.validate
{:ok, %Ibanity.Consent.Consent{id: "270141aa-0c93-42a5-9adf-e2b9a8ab4cea"}}