post-reserves-RESERVE_PUB-purse.rst (6335B)
1 .. http:post:: /reserves/$RESERVE_PUB/purse 2 3 Create purse for an account. First step of a PULL payment. 4 5 **Request:** 6 7 The request body must be a `ReservePurseRequest` object. 8 9 A purse that is not paid in full refunds the coins that were deposited 10 into it when it expires, and the exchange must still be able to account 11 for that refund. ``purse_expiration`` is therefore limited to 12 ``max_p2p_expiration`` (see :http:get:`/keys </keys>`) from now. 13 14 **Response:** 15 16 :http:statuscode:`200 OK`: 17 The operation succeeded, the exchange confirms that the 18 purse was allocated. 19 The response will include a `PurseCreateSuccessResponse` object. 20 :http:statuscode:`400 Bad Request`: 21 The request is invalid. In addition to generic error codes, 22 the following specific error codes may be returned: 23 24 1. ``TALER_EC_EXCHANGE_RESERVES_PURSE_EXPIRATION_BEFORE_NOW``: 25 The requested purse expiration time is in the past. 26 2. ``TALER_EC_EXCHANGE_RESERVES_PURSE_CREATE_INSUFFICIENT_FUNDS``: 27 The reserve does not have enough funds to create this reserve. 28 3. ``TALER_EC_EXCHANGE_RESERVES_PURSE_EXPIRATION_IS_NEVER``: 29 A purse expiration time of "never" is not allowed. 30 4. ``TALER_EC_EXCHANGE_RESERVES_PURSE_FEE_TOO_LOW``: 31 The specified purse fee is lower than allowed. 32 5. ``TALER_EC_EXCHANGE_RESERVES_PURSE_EXPIRATION_TOO_LATE``: 33 The requested purse expiration time is further in the future than 34 ``max_p2p_expiration`` allows. The ``detail`` of the `ErrorDetail` 35 gives the latest purse expiration the exchange accepts. 36 37 :http:statuscode:`403 Forbidden`: 38 Account or contract signature is invalid. 39 This response comes with a standard `ErrorDetail` response. 40 Returned with error codes of: 41 - ``TALER_EC_EXCHANGE_PURSE_CREATE_SIGNATURE_INVALID`` 42 - ``TALER_EC_EXCHANGE_PURSE_ECONTRACT_SIGNATURE_INVALID`` 43 - ``TALER_EC_EXCHANGE_RESERVES_PURSE_MERGE_SIGNATURE_INVALID`` 44 - ``TALER_EC_EXCHANGE_RESERVES_RESERVE_MERGE_SIGNATURE_INVALID`` 45 46 :http:statuscode:`404 Not found`: 47 The purse creation operation failed as we could not find the reserve. 48 This response comes with a standard `ErrorDetail` response. 49 Returned with an EC of ``TALER_EC_EXCHANGE_GENERIC_RESERVE_UNKNOWN`` 50 :http:statuscode:`409 Conflict`: 51 The purse creation failed because a purse with 52 the same public key but different meta data was 53 created previously or the funds for the operation 54 were insufficient. Which specific conflict it is 55 can be decided by looking at the error code: 56 - ``TALER_EC_EXCHANGE_PURSE_CREATE_CONFLICTING_META_DATA`` 57 - ``TALER_EC_EXCHANGE_PURSE_DEPOSIT_CONFLICTING_META_DATA`` 58 - ``TALER_EC_EXCHANGE_PURSE_ECONTRACT_CONFLICTING_META_DATA`` 59 - ``TALER_EC_EXCHANGE_RESERVES_PURSE_CREATE_INSUFFICIENT_FUNDS`` 60 - ``TALER_EC_EXCHANGE_RESERVES_PURSE_CREATE_CONFLICTING_META_DATA`` 61 The specific fields of the response depend on the error code 62 and include the signatures (and what was signed over) proving the 63 conflict. 64 The response will be a `PurseConflict` response 65 (but not a `DepositDoubleSpendError`). 66 :http:statuscode:`410 Gone`: 67 The purse has expired. 68 This response comes with a standard `ErrorDetail` response with 69 a code of ``TALER_EC_EXCHANGE_GENERIC_PURSE_EXPIRED``. 70 :http:statuscode:`413 Request entity too large`: 71 The uploaded body is to long, it exceeds the size limit. 72 Returned with an error code of 73 ``TALER_EC_GENERIC_UPLOAD_EXCEEDS_LIMIT``. 74 :http:statuscode:`451 Unavailable For Legal Reasons`: 75 This account has not yet passed the KYC checks. 76 The client must pass KYC checks before proceeding with the merge. 77 The response will be an `LegitimizationNeededResponse` object. 78 :http:statuscode:`500 Internal Server Error`: 79 The server experienced an internal error. 80 This response comes with a standard `ErrorDetail` response. 81 Possible error codes include 82 ``TALER_EC_GENERIC_DB_STORE_FAILED``, 83 ``TALER_EC_GENERIC_DB_FETCH_FAILED``, or 84 ``TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE``. 85 :http:statuscode:`503 Service unavailable`: 86 The server could not process the request because it is currently 87 unavailable. Error codes include: 88 - ``TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING`` 89 - ``TALER_EC_EXCHANGE_GENERIC_GLOBAL_FEES_MISSING`` 90 91 **Details:** 92 93 .. ts:def:: ReservePurseRequest 94 95 interface ReservePurseRequest { 96 97 // Minimum amount that must be credited to the reserve, that is 98 // the total value of the purse minus the deposit fees. 99 // If the deposit fees are lower, the contribution to the 100 // reserve can be higher! 101 purse_value: Amount; 102 103 // Minimum age required for all coins deposited into the purse. 104 min_age: Integer; 105 106 // Purse fee the reserve owner is willing to pay 107 // for the purse creation. Optional, if not present 108 // the purse is to be created from the purse quota 109 // of the reserve. 110 purse_fee?: Amount; 111 112 // Optional encrypted contract, in case the buyer is 113 // proposing the contract and thus establishing the 114 // purse with the payment. 115 econtract?: EncryptedContract; 116 117 // EdDSA public key used to approve merges of this purse. 118 merge_pub: EddsaPublicKey; 119 120 // EdDSA signature of the purse private key affirming the merge 121 // over a `TALER_PurseMergeSignaturePS`. 122 // Must be of purpose ``TALER_SIGNATURE_PURSE_MERGE``. 123 merge_sig: EddsaSignature; 124 125 // EdDSA signature of the account/reserve affirming the merge. 126 // Must be of purpose ``TALER_SIGNATURE_WALLET_ACCOUNT_MERGE`` 127 reserve_sig: EddsaSignature; 128 129 // Purse public key. 130 purse_pub: EddsaPublicKey; 131 132 // EdDSA signature of the purse over 133 // `TALER_PurseRequestSignaturePS` of 134 // purpose ``TALER_SIGNATURE_PURSE_REQUEST`` 135 // confirming that the 136 // above details hold for this purse. 137 purse_sig: EddsaSignature; 138 139 // SHA-512 hash of the contact of the purse. 140 h_contract_terms: HashCode; 141 142 // Client-side timestamp of when the merge request was made. 143 merge_timestamp: Timestamp; 144 145 // Indicative time by which the purse should expire 146 // if it has not been paid. 147 purse_expiration: Timestamp; 148 149 }