Packages
mollie_api
0.1.0-20260716
0.1.0-20260722
0.1.0-20260721
0.1.0-20260717
0.1.0-20260716
0.1.0-20260708
0.1.0-20260702
0.1.0-20260629
0.1.0-20260625
0.1.0-20260622
0.1.0-20260619
0.1.0-20260617
0.1.0-20260615
0.1.0-20260611
0.1.0-20260609
0.1.0-20260601
0.1.0-20260529
0.1.0-20260527
0.1.0-20260526
0.1.0-20260525
0.1.0-20260521
0.1.0-20260519
0.1.0-20260515
0.1.0-20260513
0.1.0-20260512
0.1.0-20260507
0.1.0-20260505
0.1.0-20260504
0.1.0-20260430
0.1.0-20260429
0.1.0-20260428
0.1.0-20260427
0.1.0-20260423
0.1.0-20260421
0.1.0-20260420
0.1.0-20260415
0.1.0-20260410
0.1.0-20260409
0.1.0-20260408
0.1.0-20260402
0.1.0-20260401
0.1.0-20260331
0.1.0-20260330
0.1.0-20260327
0.1.0-20260317
0.1.0-20260313
0.1.0-20260310
0.1.0-20260309
0.1.0-20260306
0.1.0-20260305
0.1.0-20260303
0.1.0-20260302
0.1.0-20260226
0.1.0-20260218
0.1.0-20260217
0.1.0-20260210
0.1.0-20260206
0.1.0-20260205
0.1.0-20260204
0.1.0-20260203
0.1.0-20260202
0.1.0-20260130
0.1.0-20260129
0.1.0-20260114
0.1.0-20260109
0.1.0-20260107
0.1.0-20251222
0.1.0-20251125
0.1.0-20251121
0.1.0-20251119
0.1.0-20251118
0.1.0-20251113
An autogenerated Elixir client for the Mollie API, generated from the OpenAPI specification.
Current section
Files
Jump to
Current section
Files
lib/mollie_api/api/settlements_api.ex
# NOTE: This file is auto generated by OpenAPI Generator 7.17.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule MollieAPI.Api.SettlementsAPI do
@moduledoc """
API calls for all endpoints tagged `SettlementsAPI`.
"""
alias MollieAPI.Connection
import MollieAPI.RequestBuilder
@doc """
Get next settlement
Retrieve the details of the current settlement, that has not yet been paid out. For a complete reference of the settlement object, refer to the [Get settlement endpoint](get-settlement) documentation. For more accurate bookkeeping, refer to the [balance report](get-balance-report) endpoint or the [balance transactions](list-balance-transactions) endpoint.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.EntitySettlement.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_next_settlement(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.EntitySettlement.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def get_next_settlement(connection, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/settlements/next")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.EntitySettlement},
{429, MollieAPI.Model.ErrorResponse}
])
end
@doc """
Get open settlement
Retrieve the details of the open balance of the organization. This will return a settlement object representing your organization's balance. For a complete reference of the settlement object, refer to the [Get settlement endpoint](get-settlement) documentation. For more accurate bookkeeping, refer to the [balance report](get-balance-report) endpoint or the [balance transactions](list-balance-transactions) endpoint.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.EntitySettlement.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_open_settlement(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.EntitySettlement.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def get_open_settlement(connection, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/settlements/open")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.EntitySettlement},
{429, MollieAPI.Model.ErrorResponse}
])
end
@doc """
Get settlement
Retrieve a single settlement by its ID. To lookup settlements by their bank reference, replace the ID in the URL by a reference. For example: `1234567.2404.03`. A settlement represents a transfer of your balance funds to your external bank account. Settlements will typically include a report that details what balance transactions have taken place between this settlement and the previous one. For more accurate bookkeeping, refer to the [balance report](get-balance-report) endpoint or the [balance transactions](list-balance-transactions) endpoint.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `settlement_id` (String.t): Provide the ID of the related settlement.
- `opts` (keyword): Optional parameters
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.EntitySettlement.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_settlement(Tesla.Env.client, String.t, keyword()) :: {:ok, MollieAPI.Model.EntitySettlement.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def get_settlement(connection, settlement_id, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/settlements/#{settlement_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.EntitySettlement},
{404, MollieAPI.Model.ErrorResponse},
{429, MollieAPI.Model.ErrorResponse}
])
end
@doc """
List settlement captures
Retrieve all captures included in the given settlement. The response is in the same format as the response of the [List captures endpoint](list-captures).
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `settlement_id` (String.t): Provide the ID of the related settlement.
- `opts` (keyword): Optional parameters
- `:from` (String.t): Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the result set.
- `:limit` (integer()): The maximum number of items to return. Defaults to 50 items.
- `:embed` (String.t): This endpoint allows embedding related API items by appending the following values via the `embed` query string parameter.
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.ListSettlementCaptures200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_settlement_captures(Tesla.Env.client, String.t, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.ListSettlementCaptures200Response.t} | {:error, Tesla.Env.t}
def list_settlement_captures(connection, settlement_id, opts \\ []) do
optional_params = %{
:from => :query,
:limit => :query,
:embed => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/settlements/#{settlement_id}/captures")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.ListSettlementCaptures200Response},
{400, MollieAPI.Model.ErrorResponse},
{404, MollieAPI.Model.ErrorResponse},
{429, MollieAPI.Model.ErrorResponse}
])
end
@doc """
List settlement chargebacks
Retrieve all chargebacks 'deducted' from the given settlement. The response is in the same format as the response of the [List chargebacks endpoint](list-chargebacks).
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `settlement_id` (String.t): Provide the ID of the related settlement.
- `opts` (keyword): Optional parameters
- `:from` (String.t): Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the result set.
- `:limit` (integer()): The maximum number of items to return. Defaults to 50 items.
- `:embed` (String.t): This endpoint allows embedding related API items by appending the following values via the `embed` query string parameter.
- `:testmode` (boolean()): Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting the `testmode` query parameter to `true`. Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.ListSettlementChargebacks200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_settlement_chargebacks(Tesla.Env.client, String.t, keyword()) :: {:ok, MollieAPI.Model.ListSettlementChargebacks200Response.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def list_settlement_chargebacks(connection, settlement_id, opts \\ []) do
optional_params = %{
:from => :query,
:limit => :query,
:embed => :query,
:testmode => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/settlements/#{settlement_id}/chargebacks")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.ListSettlementChargebacks200Response},
{400, MollieAPI.Model.ErrorResponse},
{404, MollieAPI.Model.ErrorResponse},
{429, MollieAPI.Model.ErrorResponse}
])
end
@doc """
List settlement payments
Retrieve all payments included in the given settlement. The response is in the same format as the response of the [List payments endpoint](list-payments). For capture-based payment methods such as Klarna, the payments are not listed here. Refer to the [List captures endpoint](list-captures) endpoint instead.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `settlement_id` (String.t): Provide the ID of the related settlement.
- `opts` (keyword): Optional parameters
- `:from` (String.t): Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the result set.
- `:limit` (integer()): The maximum number of items to return. Defaults to 50 items.
- `:sort` (Sorting): Used for setting the direction of the result set. Defaults to descending order, meaning the results are ordered from newest to oldest.
- `:profileId` (String.t): The identifier referring to the [profile](get-profile) you wish to retrieve the resources for. Most API credentials are linked to a single profile. In these cases the `profileId` must not be sent. For organization-level credentials such as OAuth access tokens however, the `profileId` parameter is required.
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.ListSettlementPayments200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_settlement_payments(Tesla.Env.client, String.t, keyword()) :: {:ok, MollieAPI.Model.ListSettlementPayments200Response.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def list_settlement_payments(connection, settlement_id, opts \\ []) do
optional_params = %{
:from => :query,
:limit => :query,
:sort => :query,
:profileId => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/settlements/#{settlement_id}/payments")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.ListSettlementPayments200Response},
{400, MollieAPI.Model.ErrorResponse},
{429, MollieAPI.Model.ErrorResponse}
])
end
@doc """
List settlement refunds
Retrieve all refunds 'deducted' from the given settlement. The response is in the same format as the response of the [List refunds endpoint](list-refunds).
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `settlement_id` (String.t): Provide the ID of the related settlement.
- `opts` (keyword): Optional parameters
- `:from` (String.t): Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the result set.
- `:limit` (integer()): The maximum number of items to return. Defaults to 50 items.
- `:embed` (String.t): This endpoint allows embedding related API items by appending the following values via the `embed` query string parameter.
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.ListSettlementRefunds200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_settlement_refunds(Tesla.Env.client, String.t, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.ListSettlementRefunds200Response.t} | {:error, Tesla.Env.t}
def list_settlement_refunds(connection, settlement_id, opts \\ []) do
optional_params = %{
:from => :query,
:limit => :query,
:embed => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/settlements/#{settlement_id}/refunds")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.ListSettlementRefunds200Response},
{400, MollieAPI.Model.ErrorResponse},
{404, MollieAPI.Model.ErrorResponse},
{429, MollieAPI.Model.ErrorResponse}
])
end
@doc """
List settlements
Retrieve a list of all your settlements. The results are paginated.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:from` (String.t): Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the result set.
- `:limit` (integer()): The maximum number of items to return. Defaults to 50 items.
- `:balanceId` (String.t): Provide the token of the balance to filter the settlements by. This is the balance token that the settlement was settled to.
- `:year` (String.t): Provide the year to query the settlements. Must be used combined with `month` parameter
- `:month` (String.t): Provide the month to query the settlements. Must be used combined with `year` parameter
- `:currencies` (Currencies): Provides the currencies to retrieve the settlements. It accepts multiple currencies in a comma-separated format.
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.ListSettlements200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_settlements(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.ListSettlements200Response.t} | {:error, Tesla.Env.t}
def list_settlements(connection, opts \\ []) do
optional_params = %{
:from => :query,
:limit => :query,
:balanceId => :query,
:year => :query,
:month => :query,
:currencies => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/settlements")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.ListSettlements200Response},
{400, MollieAPI.Model.ErrorResponse},
{404, MollieAPI.Model.ErrorResponse},
{429, MollieAPI.Model.ErrorResponse}
])
end
end