taler-docs

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

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


      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.
     36   :http:statuscode:`404 Not found`:
     37     The reserve key does not belong to a reserve known to the exchange.
     38 
     39   **Details:**
     40 
     41   .. ts:def:: ReserveHistory
     42 
     43     interface ReserveHistory {
     44       // Balance left in the reserve.
     45       balance: Amount;
     46 
     47       // If set, gives the maximum age group that the client is required to set
     48       // during withdrawal.
     49       maximum_age_group: Integer;
     50 
     51       // Transaction history for this reserve.
     52       // May be partial (!).
     53       history: TransactionHistoryItem[];
     54     }
     55 
     56   Objects in the transaction history have the following format:
     57 
     58   .. ts:def:: TransactionHistoryItem
     59 
     60     // Union discriminated by the "type" field.
     61     type TransactionHistoryItem =
     62       | AccountSetupTransaction
     63       | ReserveWithdrawTransaction
     64       | ReserveCreditTransaction
     65       | ReserveClosingTransaction
     66       | ReserveOpenRequestTransaction
     67       | ReserveCloseRequestTransaction
     68       | PurseMergeTransaction;
     69 
     70   .. ts:def:: AccountSetupTransaction
     71 
     72     interface AccountSetupTransaction {
     73       type: "SETUP";
     74 
     75       // Offset of this entry in the reserve history.
     76       // Useful to request incremental histories via
     77       // the "start" query parameter.
     78       history_offset: Integer;
     79 
     80       // KYC fee agreed to by the reserve owner.
     81       kyc_fee: Amount;
     82 
     83       // Time when the KYC was triggered.
     84       kyc_timestamp: Timestamp;
     85 
     86       // Hash of the wire details of the account.
     87       // Note that this hash is unsalted and potentially
     88       // private (as it could be inverted), hence access
     89       // to this endpoint must be authorized using the
     90       // private key of the reserve.
     91       h_wire: HashCode;
     92 
     93       // Signature created with the reserve's private key.
     94       // Must be of purpose ``TALER_SIGNATURE_ACCOUNT_SETUP_REQUEST`` over
     95       // a ``TALER_AccountSetupRequestSignaturePS``.
     96       reserve_sig: EddsaSignature;
     97 
     98     }
     99 
    100   .. ts:def:: ReserveWithdrawTransaction
    101 
    102     interface ReserveWithdrawTransaction {
    103       type: "WITHDRAW";
    104 
    105       // Offset of this entry in the reserve history.
    106       // Useful to request incremental histories via
    107       // the "start" query parameter.
    108       history_offset: Integer;
    109 
    110       // Amount withdrawn.
    111       amount: Amount;
    112 
    113       // Total fee that is charged for withdraw.
    114       withdraw_fee: Amount;
    115 
    116       // Total number of coins in the withdraw request
    117       num_coins: Integer;
    118 
    119       // Signature over a `TALER_WithdrawRequestPS`
    120       // with purpose ``TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW``
    121       // created with the reserve's private key.
    122       reserve_sig: EddsaSignature;
    123 
    124       // The hash of the all the planchets that were provided during the
    125       // call to /withdraw.
    126       h_planchets: HashCode;
    127 
    128       // The blinding seed that was provided. It will be NULL if
    129       // no denominations of cipher type Clause-Schnorr were invovled
    130       blinding_seed?: BlindingMasterSeed;
    131 
    132       // The array of hashes of public key of denominations for the coins.
    133       denom_pub_hashes: HashCode[];
    134 
    135       // The maximum age committed to, if the withdraw request
    136       // required age-restriction
    137       max_age?: Integer;
    138 
    139       // The noreveal index that was returned as part
    140       // of a age-restricted withdraw, if applicable
    141       noreveal_index?: Integer;
    142 
    143      }
    144 
    145 
    146   .. ts:def:: ReserveCreditTransaction
    147 
    148     interface ReserveCreditTransaction {
    149       type: "CREDIT";
    150 
    151       // Offset of this entry in the reserve history.
    152       // Useful to request incremental histories via
    153       // the "start" query parameter.
    154       history_offset: Integer;
    155 
    156       // Amount deposited.
    157       amount: Amount;
    158 
    159       // Sender account full payto:// URI.
    160       sender_account_url: string;
    161 
    162       // Opaque identifier internal to the exchange that
    163       // uniquely identifies the wire transfer that credited the reserve.
    164       wire_reference: Integer;
    165 
    166       // Timestamp of the incoming wire transfer.
    167       timestamp: Timestamp;
    168     }
    169 
    170 
    171   .. ts:def:: ReserveClosingTransaction
    172 
    173     interface ReserveClosingTransaction {
    174       type: "CLOSING";
    175 
    176       // Offset of this entry in the reserve history.
    177       // Useful to request incremental histories via
    178       // the "start" query parameter.
    179       history_offset: Integer;
    180 
    181       // Closing balance.
    182       amount: Amount;
    183 
    184       // Closing fee charged by the exchange.
    185       closing_fee: Amount;
    186 
    187       // Wire transfer subject.
    188       wtid: Base32;
    189 
    190       // Full payto URI of the wire account into which the funds were returned to.
    191       receiver_account_details: string;
    192 
    193       // This is a signature over a
    194       // struct `TALER_ReserveCloseConfirmationPS` with purpose
    195       // ``TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED``.
    196       exchange_sig: EddsaSignature;
    197 
    198       // Public key used to create 'exchange_sig'.
    199       exchange_pub: EddsaPublicKey;
    200 
    201       // Time when the reserve was closed.
    202       timestamp: Timestamp;
    203     }
    204 
    205 
    206   .. ts:def:: ReserveOpenRequestTransaction
    207 
    208     interface ReserveOpenRequestTransaction {
    209       type: "OPEN";
    210 
    211       // Offset of this entry in the reserve history.
    212       // Useful to request incremental histories via
    213       // the "start" query parameter.
    214       history_offset: Integer;
    215 
    216       // Open fee paid from the reserve.
    217       open_fee: Amount;
    218 
    219       // This is a signature over
    220       // a struct `TALER_ReserveOpenPS` with purpose
    221       // ``TALER_SIGNATURE_WALLET_RESERVE_OPEN``.
    222       reserve_sig: EddsaSignature;
    223 
    224       // Timestamp of the open request.
    225       request_timestamp: Timestamp;
    226 
    227       // Requested expiration.
    228       requested_expiration: Timestamp;
    229 
    230       // Requested number of free open purses.
    231       requested_min_purses: Integer;
    232 
    233     }
    234 
    235   .. ts:def:: ReserveCloseRequestTransaction
    236 
    237     interface ReserveCloseRequestTransaction {
    238       type: "CLOSE";
    239 
    240       // Offset of this entry in the reserve history.
    241       // Useful to request incremental histories via
    242       // the "start" query parameter.
    243       history_offset: Integer;
    244 
    245       // This is a signature over
    246       // a struct `TALER_ReserveClosePS` with purpose
    247       // ``TALER_SIGNATURE_WALLET_RESERVE_CLOSE``.
    248       reserve_sig: EddsaSignature;
    249 
    250       // Hash over the full payto URI of the target account.
    251       h_payto?: FullPaytoHash;
    252 
    253       // Timestamp of the close request.
    254       request_timestamp: Timestamp;
    255     }
    256 
    257   .. ts:def:: PurseMergeTransaction
    258 
    259     interface PurseMergeTransaction {
    260       type: "MERGE";
    261 
    262       // Offset of this entry in the reserve history.
    263       // Useful to request incremental histories via
    264       // the "start" query parameter.
    265       history_offset: Integer;
    266 
    267       // SHA-512 hash of the contact of the purse.
    268       h_contract_terms: HashCode;
    269 
    270       // EdDSA public key used to approve merges of this purse.
    271       merge_pub: EddsaPublicKey;
    272 
    273       // Minimum age required for all coins deposited into the purse.
    274       min_age: Integer;
    275 
    276       // Number that identifies who created the purse
    277       // and how it was paid for.
    278       flags: Integer;
    279 
    280       // Purse public key.
    281       purse_pub: EddsaPublicKey;
    282 
    283       // EdDSA signature of the account/reserve affirming the merge
    284       // over a `TALER_AccountMergeSignaturePS`.
    285       // Must be of purpose ``TALER_SIGNATURE_ACCOUNT_MERGE``
    286       reserve_sig: EddsaSignature;
    287 
    288       // Client-side timestamp of when the merge request was made.
    289       merge_timestamp: Timestamp;
    290 
    291       // Indicative time by which the purse should expire
    292       // if it has not been merged into an account. At this
    293       // point, all of the deposits made should be
    294       // auto-refunded.
    295       purse_expiration: Timestamp;
    296 
    297       // Purse fee the reserve owner paid for the purse creation.
    298       purse_fee: Amount;
    299 
    300       // Total amount merged into the reserve.
    301       // (excludes fees).
    302       amount: Amount;
    303 
    304       // True if the purse was actually merged.
    305       // If false, only the purse_fee has an impact
    306       // on the reserve balance!
    307       merged: boolean;
    308     }