110 lines
1.9 KiB
Elixir
110 lines
1.9 KiB
Elixir
defmodule CampApi.PaymentLinks do
|
|
@moduledoc """
|
|
The PaymentLinks context.
|
|
"""
|
|
|
|
# import Ecto.Query, warn: false
|
|
alias CampApi.Repo
|
|
|
|
alias CampApi.PaymentLinks.Link
|
|
|
|
alias CampApi.PaymentLinks.Qonto
|
|
|
|
def connect() do
|
|
body = %{
|
|
"partner_callback_url" => "http://localhost:4000",
|
|
"user_bank_account_id" => "01982d1e-6813-7bdf-a96f-0c583e6fa063",
|
|
"user_phone_number" => "+33612345678",
|
|
"user_website_url" => "http://localhost:4000",
|
|
"business_description" => "This needs a long long long description. This needs a long long long description."
|
|
}
|
|
Qonto.request(:post, "/v2/payment_links/connections", body)
|
|
end
|
|
|
|
@doc """
|
|
Returns the list of links.
|
|
|
|
## Examples
|
|
|
|
iex> list_links()
|
|
[%Link{}, ...]
|
|
|
|
"""
|
|
def list_links do
|
|
raise "TODO"
|
|
end
|
|
|
|
@doc """
|
|
Gets a single link.
|
|
|
|
Raises if the Link does not exist.
|
|
|
|
## Examples
|
|
|
|
iex> get_link!(123)
|
|
%Link{}
|
|
|
|
"""
|
|
def get_link!(id), do: raise "TODO"
|
|
|
|
@doc """
|
|
Creates a link.
|
|
|
|
## Examples
|
|
|
|
iex> create_link(%{field: value})
|
|
{:ok, %Link{}}
|
|
|
|
iex> create_link(%{field: bad_value})
|
|
{:error, ...}
|
|
|
|
"""
|
|
def create_link(attrs) do
|
|
raise "TODO"
|
|
end
|
|
|
|
@doc """
|
|
Updates a link.
|
|
|
|
## Examples
|
|
|
|
iex> update_link(link, %{field: new_value})
|
|
{:ok, %Link{}}
|
|
|
|
iex> update_link(link, %{field: bad_value})
|
|
{:error, ...}
|
|
|
|
"""
|
|
def update_link(%Link{} = link, attrs) do
|
|
raise "TODO"
|
|
end
|
|
|
|
@doc """
|
|
Deletes a Link.
|
|
|
|
## Examples
|
|
|
|
iex> delete_link(link)
|
|
{:ok, %Link{}}
|
|
|
|
iex> delete_link(link)
|
|
{:error, ...}
|
|
|
|
"""
|
|
def delete_link(%Link{} = link) do
|
|
raise "TODO"
|
|
end
|
|
|
|
@doc """
|
|
Returns a data structure for tracking link changes.
|
|
|
|
## Examples
|
|
|
|
iex> change_link(link)
|
|
%Todo{...}
|
|
|
|
"""
|
|
def change_link(%Link{} = link, _attrs \\ %{}) do
|
|
raise "TODO"
|
|
end
|
|
end
|