taler-docs

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

get-cashin-rate.rst (1858B)


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