# 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.ChargebacksAPI do @moduledoc """ API calls for all endpoints tagged `ChargebacksAPI`. """ alias MollieAPI.Connection import MollieAPI.RequestBuilder @doc """ Get payment chargeback Retrieve a single payment chargeback by its ID and the ID of its parent payment. ### Parameters - `connection` (MollieAPI.Connection): Connection to server - `payment_id` (String.t): Provide the ID of the related payment. - `chargeback_id` (String.t): Provide the ID of the related chargeback. - `opts` (keyword): Optional parameters - `: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 can be omitted. 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.EntityChargeback.t}` on success - `{:error, Tesla.Env.t}` on failure """ @spec get_chargeback(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, MollieAPI.Model.EntityChargeback.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t} def get_chargeback(connection, payment_id, chargeback_id, opts \\ []) do optional_params = %{ :embed => :query, :testmode => :query, :"idempotency-key" => :headers } request = %{} |> method(:get) |> url("/payments/#{payment_id}/chargebacks/#{chargeback_id}") |> add_optional_params(optional_params, opts) |> Enum.into([]) connection |> Connection.request(request) |> evaluate_response([ {200, MollieAPI.Model.EntityChargeback}, {404, MollieAPI.Model.ErrorResponse} ]) end @doc """ List all chargebacks Retrieve all chargebacks initiated for all your payments. 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. - `:embed` (String.t): This endpoint allows embedding related API items by appending the following values via the `embed` query string parameter. - `: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 chargebacks for. Most API credentials are linked to a single profile. In these cases the `profileId` is already implied. To retrieve all chargebacks across the organization, use an organization-level API credential and omit the `profileId` parameter. - `:testmode` (boolean()): Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter can be omitted. 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_all_chargebacks(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.ListSettlementChargebacks200Response.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t} def list_all_chargebacks(connection, opts \\ []) do optional_params = %{ :from => :query, :limit => :query, :embed => :query, :sort => :query, :profileId => :query, :testmode => :query, :"idempotency-key" => :headers } request = %{} |> method(:get) |> url("/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} ]) end @doc """ List payment chargebacks Retrieve the chargebacks initiated for a specific payment. The results are paginated. ### Parameters - `connection` (MollieAPI.Connection): Connection to server - `payment_id` (String.t): Provide the ID of the related payment. - `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 can be omitted. 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_chargebacks(Tesla.Env.client, String.t, keyword()) :: {:ok, MollieAPI.Model.ListSettlementChargebacks200Response.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t} def list_chargebacks(connection, payment_id, opts \\ []) do optional_params = %{ :from => :query, :limit => :query, :embed => :query, :testmode => :query, :"idempotency-key" => :headers } request = %{} |> method(:get) |> url("/payments/#{payment_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} ]) end end