summaryrefslogtreecommitdiff
path: root/libeufin/nexus-tutorial.rst
blob: 73784d579d45342ca6db900daceeb17ec47fa589 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Nexus How-To
############

.. contents:: Table of Contents

Nexus is a Web service that provides a JSON abstraction layer to
access bank accounts.  It is **not** itself a bank, but a translator
between JSON requests and more structured banking protocols (like
EBICS, for example.), that are offered by actual banks.

This document explains how to setup Nexus to access a bank account
via the EBICS protocol.  In order to follow all the steps below, the
reader should already have one EBICS subscriber activated at their bank.

Obtain Nexus
============
Nexus belongs to the LibEuFin project, and can be downloaded via Git:
``$ git clone git://git.taler.net/libeufin``

Note that Kotlin+Gradle should already work on the host system.

Install Nexus
=============
Navigate into the `libeufin` local repository, and from top-level run:

.. code-block:: shell

  $ ./gradlew -Pprefix=$PREFIX nexus:installToPrefix
  $ ./gradlew -Pprefix=$PREFIX cli:installToPrefix

In case of success, the two following commands should be found:

.. code-block:: shell

  $ which libeufin-nexus
  $ which libeufin-cli

Connect Nexus with a EBICS account
==================================

Use the following command to *(1) run the nexus service*:

.. code-block:: shell

  $ libeufin-nexus

At this point a *(2) superuser account needs to be activated
into the system*:

.. code-block:: shell

  $ libeufin-nexus superuser foo # Will interactively ask for password

For simplicity, we'll enable the superuser to access the bank account
via the EBICS protocol, but a API to create less privileged users is
as well offered.

Nexus needs now to associate the user to a EBICS subscriber that was
activated on the bank.  In the Nexus terminology, this is called *(3)
creating a EBICS connection*.

.. code-block:: shell

  ./libeufin-cli \
    connections \
      new-ebics-connection \
        --connection-name $NEXUS_BANK_CONNECTION_NAME \
        --ebics-url $EBICS_BASE_URL \
        --host-id $EBICS_HOST_ID \
        --partner-id $EBICS_PARTNER_ID \
        --ebics-user-id $EBICS_USER_ID \
        --nexus-user-id $NEXUS_USER \
        --nexus-password $NEXUS_PASSWORD \
        $NEXUS_URL

If the previous command succeeded, Nexus must communicate all the details
to the bank.  Therefore, it will *(4) synchronize the connection*.

.. code-block:: shell

  ./libeufin-cli \
    connections \
      sync \
        --connection-name $NEXUS_BANK_CONNECTION_NAME \
        --nexus-user-id $NEXUS_USER \
        --nexus-password $NEXUS_PASSWORD \
        $NEXUS_URL

Once the connection is synchronized, Nexus needs to import locally the data
corresponding to the bank accounts offered by the bank connection just made.
The command below *(5) downloads the list of the bank accounts offered by the*
``$NEXUS_BANK_CONNECTION_NAME``.

.. code-block:: shell

  ./libeufin-cli \
    connections \
      download-bank-accounts \
        --connection-name $NEXUS_BANK_CONNECTION_NAME \
        --nexus-user-id $NEXUS_USER \
        --nexus-password $NEXUS_PASSWORD \
        $NEXUS_URL

It is now possible to *(6) list the accounts offered by the connection*.

.. code-block:: shell

  ./libeufin-cli \
    connections \
      list-offered-bank-accounts \
        --nexus-user-id $NEXUS_USER \
        --nexus-password $NEXUS_PASSWORD \
        $NEXUS_URL

Nexus now needs an explicit *(7) import of the accounts it needs to manage*.
This step is needed to let the user pick a custom name for such accounts.

.. code-block:: shell

  ./libeufin-cli
    connections \
      import-bank-account \
        --connection-name $NEXUS_BANK_CONNECTION_NAME \
        --nexus-user-id $NEXUS_USER \
        --nexus-password $NEXUS_PASSWORD \
        --offered-account-id $ACCOUNT_NATIVE_NAME \
        --nexus-bank-account-id $CUSTOM_RENAMING_FOR_ACCOUNT \
        $NEXUS_URL

Once a Nexus user imported a bank account (``$CUSTOM_RENAMING_FOR_ACCOUNT``)
under a certain connection (``$NEXUS_BANK_CONNECTION_NAME``), it is possible
to accomplish the usual operations for any bank account: asking for the
list of transactions, and making a payment.

Request history of transactions
===============================

It is first needed to tell Nexus to download the latest news
from the bank, and then ask it again to return the results.

This command asks Nexus to *download the latest bank statements*:

.. code-block:: shell

  ./libeufin-cli \
    accounts \
      fetch-transactions \
        --nexus-user-id $NEXUS_USER \
        --nexus-password $NEXUS_PASSWORD \
        --account-name $CUSTOM_RENAMING_FOR_ACCOUNT \
        $NEXUS_URL

Once Nexus stored all the information in the database, the
client can ask to actually **see** the transactions:

.. code-block:: shell

  ./libeufin-cli
    accounts \
      transactions \
        --nexus-user-id $NEXUS_USER \
        --nexus-password $NEXUS_PASSWORD \
        --account-name $CUSTOM_RENAMING_FOR_ACCOUNT \
        $NEXUS_URL

Make a payment
==============

TBD.