foliolib.folio.api.finance.Exchange

class foliolib.folio.api.finance.Exchange(tenant: str)

Bases: foliolib.folio.FolioApi

Exchange API

This documents the API calls that can be made to get exchange operations

Base class of the Folio API

Parameters

tenant (str) – Tenant id

Methods

get_calculateExchanges(**kwargs)

Get exchange calculation

get_exchangeRates(**kwargs)

Get exchange rate

get_calculateExchanges(**kwargs)

Get exchange calculation

GET /finance/calculate-exchange

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • from (currency_code) –

    Source currency code

    Example

    • USD

  • to (currency_code) –

    Target currency code

    Example

    • EUR

  • amount (amount) –

    The amount of money to calculate exchange

    Example

    • 100.0

  • rate (amount) –

    The User defined exchange rate

    Example

    • 1.08

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Server Error

Schema

{
  "type": "number",
  "description": "Exchange calculation expressed as a total calculation of exchange",
  "example": 99.95
}
get_exchangeRates(**kwargs)

Get exchange rate

GET /finance/exchange-rate

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • from (currency_code) –

    From currency code

    Example

    • USD

  • to (currency_code) –

    To currency code

    Example

    • EUR

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Exchange rate schema",
  "type": "object",
  "properties": {
    "from": {
      "description": "From currency code",
      "$ref": "../../common/schemas/currency_code.json"
    },
    "to": {
      "description": "To currency code",
      "$ref": "../../common/schemas/currency_code.json"
    },
    "exchangeRate": {
      "description": "Exchange rate value",
      "type": "number"
    }
  },
  "additionalProperties": false,
  "required": [
    "from",
    "to",
    "exchangeRate"
  ]
}