summaryrefslogtreecommitdiff
path: root/api-bank.rst
blob: 8d2d5626bd8f8b21b9d5e7f68e431dc5a2dec68d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
=========
Bank API
=========

The following APIs are served from banks, in order to allow mints to
deposit funds to money recipients.  A typical scenario for calling this
APIs is after a merchant has deposited coins to the mint, and the mint
needs to give real money to the merchant.

------------------
Administrative API
------------------

This is `local` API, meant to make the bank communicate with trusted entities,
namely mints.

.. _bank-deposit:
.. http:post:: /admin/add/incoming

**Request:** The body of this request must have the format of a `BankDepositRequest`_.

**Response:**

:status 200 OK: The request has been correctly handled, so the funds have been transferred to
the recipient's account

:status 400 Bad Request: The bank replies a `BankIncomingError`_ object
**Details:**

.. _BankDepositRequest:
.. code-block:: tsref

  interface BankDepositRequest {

    // JSON 'amount' object. The amount the caller wants to transfer
    // to the recipient's count
    amount: Amount;

    // The id of this wire transfer
    wid: base32;

    // The sender's account identificator
    debit_account: number;

    // The recipient's account identificator
    credit_account: number;

  }

.. _BankIncomingError:
.. code-block:: tsref

  interface BankIncomingError {

    // The reason which made this request fail. Typically due to malfomation
    // of the POST's body
    reason: string

  }