taler-docs

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

post-private-orders-ORDER_ID-refund.rst (2819B)


      1 .. http:post:: [/instances/$INSTANCE]/private/orders/$ORDER_ID/refund
      2 
      3   Increase the refund amount associated with a given order.  The user should be
      4   redirected to the ``taler_refund_uri`` to trigger refund processing in the wallet.
      5 
      6   **Required permission:** ``orders-refund``
      7 
      8   **Request:**
      9 
     10   The request body is a `RefundRequest` object.
     11 
     12   **Response:**
     13 
     14   :http:statuscode:`200 OK`:
     15     The refund amount has been increased, the backend
     16     responds with a `MerchantRefundResponse`.
     17   :http:statuscode:`400 Bad Request`:
     18     The request body is malformed.
     19   :http:statuscode:`403 Forbidden`:
     20     For the given order, the refund delay was zero and thus
     21     refunds are categorically not allowed.
     22     Returned with ``TALER_EC_MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_NOT_ALLOWED_BY_CONTRACT``.
     23   :http:statuscode:`404 Not found`:
     24     The order is unknown to the merchant.
     25     Returned with ``TALER_EC_MERCHANT_GENERIC_ORDER_UNKNOWN``.
     26   :http:statuscode:`409 Conflict`:
     27     The refund amount exceeds the amount originally paid or
     28     the order was not yet paid.
     29     Returned with ``TALER_EC_MERCHANT_GENERIC_CURRENCY_MISMATCH`` or
     30     ``TALER_EC_MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_ORDER_UNPAID``.
     31   :http:statuscode:`410 Gone`:
     32     It is too late for refunds, the exchange may have already wired the funds
     33     to the merchant.
     34     Returned with ``TALER_EC_MERCHANT_PRIVATE_POST_REFUND_AFTER_WIRE_DEADLINE``.
     35   :http:statuscode:`451 Unavailable for Legal Reasons`:
     36     The refund could not be awarded because of legal
     37     reasons (an exchange would refuse). The merchant
     38     staff needs to find another way to give a refund
     39     to the customer.
     40     The body is an `ErrorDetail` with an error
     41     code of ``TALER_EC_MERCHANT_POST_ORDERS_ID_REFUND_EXCHANGE_TRANSACTION_LIMIT_VIOLATION``.
     42   :http:statuscode:`500 Internal Server Error`:
     43     The server experienced an internal failure.
     44     Returned with ``TALER_EC_GENERIC_DB_START_FAILED``,
     45     ``TALER_EC_GENERIC_DB_FETCH_FAILED``,
     46     ``TALER_EC_GENERIC_DB_COMMIT_FAILED``,
     47     ``TALER_EC_GENERIC_DB_INVARIANT_FAILURE``,
     48     ``TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH`` or
     49     ``TALER_EC_MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID``.
     50 
     51   **Details:**
     52 
     53   .. ts:def:: RefundRequest
     54 
     55     interface RefundRequest {
     56       // Amount to be refunded.
     57       refund: Amount;
     58 
     59       // Human-readable refund justification.
     60       reason: string;
     61     }
     62 
     63   .. ts:def:: MerchantRefundResponse
     64 
     65     interface MerchantRefundResponse {
     66 
     67       // URL (handled by the backend) that the wallet should access to
     68       // trigger refund processing.
     69       // taler://refund/...
     70       taler_refund_uri: string;
     71 
     72       // Contract hash that a client may need to authenticate an
     73       // HTTP request to obtain the above URI in a wallet-friendly way.
     74       h_contract: HashCode;
     75     }