post-purses-PURSE_PUB-deposit.rst (5494B)
1 .. http:post:: /purses/$PURSE_PUB/deposit 2 3 Deposit money into a purse. Used by the buyer for a PULL payment. 4 5 **Request:** 6 7 The request body must be a `PurseDeposits` object. 8 9 A purse that is not decided refunds the coins deposited into it when it 10 expires, and the exchange must still be able to account for that refund. 11 A coin whose denomination would stop being legally valid before the 12 purse expires is therefore refused. 13 14 **Response:** 15 16 :http:statuscode:`200 OK`: 17 The operation succeeded, the exchange confirms that all 18 coins were deposited into the purse. 19 The response will include a `PurseDepositSuccessResponse` object. 20 :http:statuscode:`400 Bad Request`: 21 The request body is malformed or a parameter is invalid. 22 This response comes with a standard `ErrorDetail` response with 23 a code of ``TALER_EC_GENERIC_PARAMETER_MALFORMED`` or of 24 ``TALER_EC_EXCHANGE_PURSE_DENOMINATION_LEGAL_EXPIRES_TOO_SOON``, 25 whose ``detail`` gives the ``stamp_expire_legal`` of the denomination 26 that is too short-lived for this purse. 27 :http:statuscode:`403 Forbidden`: 28 A coin or denomination signature is invalid. 29 This response comes with a standard `ErrorDetail` response. 30 :http:statuscode:`404 Not found`: 31 The purse is unknown. 32 This response comes with a standard `ErrorDetail` response with 33 a code of ``TALER_EC_EXCHANGE_GENERIC_PURSE_UNKNOWN``. 34 :http:statuscode:`409 Conflict`: 35 The deposit operation has either failed because a coin has insufficient 36 residual value, or because the same public key of the coin has been 37 previously used with a different denomination or age commitment. 38 Which case it is can be decided by looking at the error code 39 (``TALER_EC_EXCHANGE_GENERIC_INSUFFICIENT_FUNDS`` or 40 ``TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY`` or 41 ``TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_AGE_HASH`` or 42 ``TALER_EC_EXCHANGE_PURSE_DEPOSIT_CONFLICTING_META_DATA``). 43 This response comes with a standard `PurseConflict` response 44 (alas some cases are impossible). 45 :http:statuscode:`410 Gone`: 46 The purse has expired, was deleted, or the deposit was already decided. 47 Possible error codes include 48 ``TALER_EC_EXCHANGE_GENERIC_PURSE_EXPIRED``, 49 ``TALER_EC_EXCHANGE_GENERIC_PURSE_DELETED``, or 50 ``TALER_EC_EXCHANGE_PURSE_DEPOSIT_DECIDED_ALREADY``. 51 :http:statuscode:`413 Request entity too large`: 52 The uploaded body is to long, it exceeds the size limit. 53 Returned with an error code of 54 ``TALER_EC_GENERIC_UPLOAD_EXCEEDS_LIMIT``. 55 :http:statuscode:`500 Internal Server Error`: 56 The server experienced an internal error. 57 This response comes with a standard `ErrorDetail` response. 58 Possible error codes include 59 ``TALER_EC_GENERIC_DB_STORE_FAILED``, 60 ``TALER_EC_GENERIC_DB_FETCH_FAILED``, 61 ``TALER_EC_GENERIC_DB_START_FAILED``, or 62 ``TALER_EC_GENERIC_FAILED_COMPUTE_AMOUNT``. 63 64 **Details:** 65 66 .. ts:def:: PurseDeposits 67 68 interface PurseDeposits { 69 70 // Array of coins to deposit into the purse. 71 deposits: PurseDeposit[]; 72 } 73 74 .. ts:def:: PurseDeposit 75 76 interface PurseDeposit { 77 78 // Amount to be deposited, can be a fraction of the 79 // coin's total value. 80 amount: Amount; 81 82 // Hash of denomination RSA key with which the coin is signed. 83 denom_pub_hash: HashCode; 84 85 // Exchange's unblinded RSA signature of the coin. 86 ub_sig: DenominationSignature; 87 88 // Age commitment for the coin, if the denomination is age-restricted. 89 age_commitment?: AgeCommitment; 90 91 // Attestation for the minimum age, if the denomination is age-restricted. 92 attest?: Attestation; 93 94 // Signature over `TALER_PurseDepositSignaturePS` 95 // of purpose ``TALER_SIGNATURE_WALLET_PURSE_DEPOSIT`` 96 // made by the customer with the 97 // `coin's private key <coin-priv>`. 98 coin_sig: EddsaSignature; 99 100 // Public key of the coin being deposited into the purse. 101 coin_pub: EddsaPublicKey; 102 103 } 104 105 .. ts:def:: PurseDepositSuccessResponse 106 107 interface PurseDepositSuccessResponse { 108 109 // Total amount paid into the purse. 110 total_deposited: Amount; 111 112 // Total amount expected in the purse. 113 purse_value_after_fees: Amount; 114 115 // Time at which the deposit came into effect. 116 exchange_timestamp: Timestamp; 117 118 // Indicative time by which the purse should expire 119 // if it has not been merged into an account. At this 120 // point, all of the deposits made will be auto-refunded. 121 purse_expiration: Timestamp; 122 123 // SHA-512 hash of the contact of the purse. 124 h_contract_terms: HashCode; 125 126 // EdDSA signature of the exchange affirming the payment, 127 // of purpose ``TALER_SIGNATURE_PURSE_DEPOSIT_CONFIRMED`` 128 // over a `TALER_PurseDepositConfirmedSignaturePS`. 129 // Signs over the above and the purse public key and 130 // the hash of the contract terms. 131 exchange_sig: EddsaSignature; 132 133 // public key used to create the signature. 134 exchange_pub: EddsaPublicKey; 135 136 } 137 138 .. ts:def:: AgeCommitment 139 140 // AgeCommitment is an array of public keys, one for each age group of the 141 // age-restricted denomination. 142 type AgeCommitment = Edx25519PublicKey[]; 143 144 .. ts:def:: Attestation 145 146 // An attestation for a minimum age is an Edx25519 signature of the age 147 // with purpose ``TALER_SIGNATURE_WALLET_AGE_ATTESTATION``. 148 type Attestation = string;