taler-docs

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

get-reserves-RESERVE_PUB-history.rst (11731B)


      1 .. http:get:: /reserves/$RESERVE_PUB/history
      2 
      3   Request information about the full history of
      4   a reserve or an account.
      5 
      6   **Request:**
      7 
      8   The GET request should come with the following HTTP headers:
      9 
     10   *If-None-Match*:
     11     The client MAY provide an ``If-None-Match`` header with an
     12     Etag.  In that case, the server MUST additionally respond with an ``304``
     13     status code in case the reserve history matches the provided Etag.
     14 
     15   *Taler-Reserve-History-Signature*:
     16     The client MUST provide Base-32 encoded
     17     EdDSA signature over a ``TALER_SIGNATURE_RESERVE_HISTORY_REQUEST`` made with
     18     the respective ``$RESERVE_PRIV``, affirming desire to download the current
     19     reserve transaction history.
     20 
     21   :query start=OFFSET: *Optional.* Only return reserve history entries with
     22                        offsets above the given OFFSET. Allows clients to not
     23                        retrieve history entries they already have.
     24 
     25   **Response:**
     26 
     27   :http:statuscode:`200 OK`:
     28     The exchange responds with a `ReserveHistory` object; the reserve was known to the exchange.
     29   :http:statuscode:`204 No content`:
     30     The reserve history is known, but at this point from the given starting point it is empty. Can only happen if OFFSET was positive.
     31   :http:statuscode:`304 Not modified`:
     32     The reserve history matches the one identified by the "If-none-match" HTTP header of the request.
     33   :http:statuscode:`403 Forbidden`:
     34     The *TALER_SIGNATURE_RESERVE_HISTORY_REQUEST* is invalid.
     35     This response comes with a standard `ErrorDetail` response with
     36     a code of ``TALER_EC_EXCHANGE_RESERVE_HISTORY_BAD_SIGNATURE``.
     37   :http:statuscode:`404 Not found`:
     38     The reserve key does not belong to a reserve known to the exchange.
     39     This response comes with a standard `ErrorDetail` response with
     40     a code of ``TALER_EC_EXCHANGE_GENERIC_RESERVE_UNKNOWN``.
     41   :http:statuscode:`500 Internal Server Error`:
     42     The server experienced an internal error.
     43     This response comes with a standard `ErrorDetail` response.
     44     Possible error codes include
     45     ``TALER_EC_GENERIC_DB_FETCH_FAILED``,
     46     ``TALER_EC_GENERIC_DB_SOFT_FAILURE``, or
     47     ``TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE``.
     48 
     49   **Details:**
     50 
     51   .. ts:def:: ReserveHistory
     52 
     53     interface ReserveHistory {
     54       // Balance left in the reserve.
     55       balance: Amount;
     56 
     57       // If set, gives the maximum age group that the client is required to set
     58       // during withdrawal.
     59       maximum_age_group: Integer;
     60 
     61       // Transaction history for this reserve.
     62       // May be partial (!).
     63       history: TransactionHistoryItem[];
     64     }
     65 
     66   Objects in the transaction history have the following format:
     67 
     68   .. ts:def:: TransactionHistoryItem
     69 
     70     // Union discriminated by the "type" field.
     71     type TransactionHistoryItem =
     72       | AccountSetupTransaction
     73       | ReserveWithdrawTransaction
     74       | ReserveCreditTransaction
     75       | ReserveClosingTransaction
     76       | ReserveRecoupTransaction
     77       | ReserveHistoryRequestTransaction
     78       | ReserveOpenRequestTransaction
     79       | ReserveCloseRequestTransaction
     80       | PurseMergeTransaction;
     81 
     82   .. ts:def:: AccountSetupTransaction
     83 
     84     interface AccountSetupTransaction {
     85       type: "SETUP";
     86 
     87       // Offset of this entry in the reserve history.
     88       // Useful to request incremental histories via
     89       // the "start" query parameter.
     90       history_offset: Integer;
     91 
     92       // KYC fee agreed to by the reserve owner.
     93       kyc_fee: Amount;
     94 
     95       // Time when the KYC was triggered.
     96       kyc_timestamp: Timestamp;
     97 
     98       // Hash of the wire details of the account.
     99       // Note that this hash is unsalted and potentially
    100       // private (as it could be inverted), hence access
    101       // to this endpoint must be authorized using the
    102       // private key of the reserve.
    103       h_wire: HashCode;
    104 
    105       // Signature created with the reserve's private key.
    106       // Must be of purpose ``TALER_SIGNATURE_ACCOUNT_SETUP_REQUEST`` over
    107       // a ``TALER_AccountSetupRequestSignaturePS``.
    108       reserve_sig: EddsaSignature;
    109 
    110     }
    111 
    112   .. ts:def:: ReserveWithdrawTransaction
    113 
    114     interface ReserveWithdrawTransaction {
    115       type: "WITHDRAW";
    116 
    117       // Offset of this entry in the reserve history.
    118       // Useful to request incremental histories via
    119       // the "start" query parameter.
    120       history_offset: Integer;
    121 
    122       // Amount withdrawn.
    123       amount: Amount;
    124 
    125       // Total fee that is charged for withdraw.
    126       withdraw_fee: Amount;
    127 
    128       // Total number of coins in the withdraw request
    129       num_coins: Integer;
    130 
    131       // Signature over a `TALER_WithdrawRequestPS`
    132       // with purpose ``TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW``
    133       // created with the reserve's private key.
    134       reserve_sig: EddsaSignature;
    135 
    136       // The hash of the all the planchets that were provided during the
    137       // call to /withdraw.
    138       h_planchets: HashCode;
    139 
    140       // The blinding seed that was provided. It will be NULL if
    141       // no denominations of cipher type Clause-Schnorr were invovled
    142       blinding_seed?: BlindingMasterSeed;
    143 
    144       // The array of hashes of public key of denominations for the coins.
    145       denom_pub_hashes: HashCode[];
    146 
    147       // The maximum age committed to, if the withdraw request
    148       // required age-restriction
    149       max_age?: Integer;
    150 
    151       // The noreveal index that was returned as part
    152       // of a age-restricted withdraw, if applicable
    153       noreveal_index?: Integer;
    154 
    155      }
    156 
    157 
    158   .. ts:def:: ReserveCreditTransaction
    159 
    160     interface ReserveCreditTransaction {
    161       type: "CREDIT";
    162 
    163       // Offset of this entry in the reserve history.
    164       // Useful to request incremental histories via
    165       // the "start" query parameter.
    166       history_offset: Integer;
    167 
    168       // Amount deposited.
    169       amount: Amount;
    170 
    171       // Sender account full payto:// URI.
    172       sender_account_url: string;
    173 
    174       // Opaque identifier internal to the exchange that
    175       // uniquely identifies the wire transfer that credited the reserve.
    176       wire_reference: Integer;
    177 
    178       // Timestamp of the incoming wire transfer.
    179       timestamp: Timestamp;
    180     }
    181 
    182 
    183   .. ts:def:: ReserveClosingTransaction
    184 
    185     interface ReserveClosingTransaction {
    186       type: "CLOSING";
    187 
    188       // Offset of this entry in the reserve history.
    189       // Useful to request incremental histories via
    190       // the "start" query parameter.
    191       history_offset: Integer;
    192 
    193       // Closing balance.
    194       amount: Amount;
    195 
    196       // Closing fee charged by the exchange.
    197       closing_fee: Amount;
    198 
    199       // Wire transfer subject.
    200       wtid: Base32;
    201 
    202       // Full payto URI of the wire account into which the funds were returned to.
    203       receiver_account_details: string;
    204 
    205       // This is a signature over a
    206       // struct `TALER_ReserveCloseConfirmationPS` with purpose
    207       // ``TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED``.
    208       exchange_sig: EddsaSignature;
    209 
    210       // Public key used to create 'exchange_sig'.
    211       exchange_pub: EddsaPublicKey;
    212 
    213       // Time when the reserve was closed.
    214       timestamp: Timestamp;
    215     }
    216 
    217 
    218   .. ts:def:: ReserveRecoupTransaction
    219 
    220     interface ReserveRecoupTransaction {
    221       type: "RECOUP";
    222 
    223       // Offset of this entry in the reserve history.
    224       // Useful to request incremental histories via
    225       // the "start" query parameter.
    226       history_offset: Integer;
    227 
    228       // Public key of the coin that was paid back.
    229       coin_pub: CoinPublicKey;
    230 
    231       // This is a signature over a
    232       // struct `TALER_RecoupConfirmationPS` with purpose
    233       // ``TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP``.
    234       exchange_sig: EddsaSignature;
    235 
    236       // Public key used to create 'exchange_sig'.
    237       exchange_pub: EddsaPublicKey;
    238 
    239       // Time when the recoup was accepted.
    240       timestamp: Timestamp;
    241 
    242       // Amount recouped to the reserve.
    243       amount: Amount;
    244 
    245       // The commitment ``planchets_h`` of the withdraw request
    246       // from this reserve that the coin was part of, see
    247       // `RecoupWithdrawRequest`.
    248       // @since **vRECOUP**
    249       planchets_h: HashCode;
    250     }
    251 
    252   .. ts:def:: ReserveHistoryRequestTransaction
    253 
    254     interface ReserveHistoryRequestTransaction {
    255       type: "HISTORY";
    256 
    257       // Offset of this entry in the reserve history.
    258       // Useful to request incremental histories via
    259       // the "start" query parameter.
    260       history_offset: Integer;
    261 
    262       // Signature created with the reserve's private key.
    263       // Must be of purpose ``TALER_SIGNATURE_RESERVE_HISTORY_REQUEST`` over
    264       // a ``TALER_ReserveHistoryRequestSignaturePS``.
    265       reserve_sig: EddsaSignature;
    266 
    267       // Timestamp of the history request.
    268       request_timestamp: Timestamp;
    269 
    270       // Fee charged for the history request.
    271       amount: Amount;
    272     }
    273 
    274   .. ts:def:: ReserveOpenRequestTransaction
    275 
    276     interface ReserveOpenRequestTransaction {
    277       type: "OPEN";
    278 
    279       // Offset of this entry in the reserve history.
    280       // Useful to request incremental histories via
    281       // the "start" query parameter.
    282       history_offset: Integer;
    283 
    284       // Open fee paid from the reserve.
    285       open_fee: Amount;
    286 
    287       // This is a signature over
    288       // a struct `TALER_ReserveOpenPS` with purpose
    289       // ``TALER_SIGNATURE_WALLET_RESERVE_OPEN``.
    290       reserve_sig: EddsaSignature;
    291 
    292       // Timestamp of the open request.
    293       request_timestamp: Timestamp;
    294 
    295       // Requested expiration.
    296       requested_expiration: Timestamp;
    297 
    298       // Requested number of free open purses.
    299       requested_min_purses: Integer;
    300 
    301     }
    302 
    303   .. ts:def:: ReserveCloseRequestTransaction
    304 
    305     interface ReserveCloseRequestTransaction {
    306       type: "CLOSE";
    307 
    308       // Offset of this entry in the reserve history.
    309       // Useful to request incremental histories via
    310       // the "start" query parameter.
    311       history_offset: Integer;
    312 
    313       // This is a signature over
    314       // a struct `TALER_ReserveClosePS` with purpose
    315       // ``TALER_SIGNATURE_WALLET_RESERVE_CLOSE``.
    316       reserve_sig: EddsaSignature;
    317 
    318       // Hash over the full payto URI of the target account.
    319       h_payto?: FullPaytoHash;
    320 
    321       // Timestamp of the close request.
    322       request_timestamp: Timestamp;
    323     }
    324 
    325   .. ts:def:: PurseMergeTransaction
    326 
    327     interface PurseMergeTransaction {
    328       type: "MERGE";
    329 
    330       // Offset of this entry in the reserve history.
    331       // Useful to request incremental histories via
    332       // the "start" query parameter.
    333       history_offset: Integer;
    334 
    335       // SHA-512 hash of the contact of the purse.
    336       h_contract_terms: HashCode;
    337 
    338       // EdDSA public key used to approve merges of this purse.
    339       merge_pub: EddsaPublicKey;
    340 
    341       // Minimum age required for all coins deposited into the purse.
    342       min_age: Integer;
    343 
    344       // Number that identifies who created the purse
    345       // and how it was paid for.
    346       flags: Integer;
    347 
    348       // Purse public key.
    349       purse_pub: EddsaPublicKey;
    350 
    351       // EdDSA signature of the account/reserve affirming the merge
    352       // over a `TALER_AccountMergeSignaturePS`.
    353       // Must be of purpose ``TALER_SIGNATURE_ACCOUNT_MERGE``
    354       reserve_sig: EddsaSignature;
    355 
    356       // Client-side timestamp of when the merge request was made.
    357       merge_timestamp: Timestamp;
    358 
    359       // Indicative time by which the purse should expire
    360       // if it has not been merged into an account. At this
    361       // point, all of the deposits made should be
    362       // auto-refunded.
    363       purse_expiration: Timestamp;
    364 
    365       // Purse fee the reserve owner paid for the purse creation.
    366       purse_fee: Amount;
    367 
    368       // Total amount merged into the reserve.
    369       // (excludes fees).
    370       amount: Amount;
    371 
    372       // True if the purse was actually merged.
    373       // If false, only the purse_fee has an impact
    374       // on the reserve balance!
    375       merged: boolean;
    376     }