taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

get-cashout-rate.rst (1825B)


      1 .. http:get:: /cashout-rate
      2 
      3   This public endpoint allows clients to calculate
      4   the exchange rate between the regional currency
      5   and the fiat currency of the banking system.
      6 
      7   This endpoint shows how the bank would apply the cash-out
      8   ratio and fee to one input amount.  Typically, frontends
      9   ask this endpoint before creating cash-in operations.
     10 
     11   **Request:**
     12 
     13   :query amount_debit: this is the amount that the user will get
     14     deducted from their regional bank account.
     15 
     16   or
     17 
     18   :query amount_credit: this is the amount that the user will receive
     19     in their fiat bank account.
     20 
     21   **Response:**
     22 
     23   :http:statuscode:`200 OK`:
     24     Response is a `CashoutConversionResponse`.
     25   :http:statuscode:`400 Bad request`:
     26     * ``TALER_EC_GENERIC_PARAMETER_MISSING`` : none of the parameters have been provided.
     27     * ``TALER_EC_GENERIC_PARAMETER_MALFORMED`` : both of the parameters have been provided or one of them is not a valid Taler amount.
     28     * ``TALER_EC_GENERIC_CURRENCY_MISMATCH`` : the parameter is in the wrong currency.
     29   :http:statuscode:`401 Unauthorized`:
     30     Invalid credentials or missing rights.
     31   :http:statuscode:`403 Forbidden`:
     32     Missing rights.
     33   :http:statuscode:`409 Conflict`:
     34     The amount is too small to be converted because it produces an amount less than zero.
     35   :http:statuscode:`501 Not implemented`:
     36     This server does not support conversion, client should check config response.
     37 
     38   **Details:**
     39 
     40   .. ts:def:: CashoutConversionResponse
     41 
     42     interface CashoutConversionResponse {
     43       // Amount that the user will get deducted from their regional
     44       // bank account, according to the 'amount_credit' value.
     45       amount_debit: Amount;
     46       // Amount that the user will receive in their fiat
     47       // bank account, according to 'amount_debit'.
     48       amount_credit: Amount;
     49     }