From 18d37f891f4f0879189798485eaab2a10d1a1692 Mon Sep 17 00:00:00 2001 From: MS Date: Tue, 6 Oct 2020 16:50:36 +0200 Subject: adapt code samples to new cli --- libeufin/nexus-tutorial.rst | 67 +++++++++++++-------------------------------- 1 file changed, 19 insertions(+), 48 deletions(-) (limited to 'libeufin') diff --git a/libeufin/nexus-tutorial.rst b/libeufin/nexus-tutorial.rst index 621f9681..7504078f 100644 --- a/libeufin/nexus-tutorial.rst +++ b/libeufin/nexus-tutorial.rst @@ -54,7 +54,7 @@ into the system*: .. code-block:: shell - $ libeufin-nexus superuser foo # Will interactively ask for password + $ libeufin-nexus superuser $NEXUS_USER # 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 @@ -69,14 +69,10 @@ creating a EBICS connection*. 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 + $CONNECTION_NAME If the step above executed correctly, Nexus created all the cryptographic material that is needed on the client side; in this EBICS example, it created @@ -88,12 +84,9 @@ a backup copy* of such keys. libeufin-cli \ connections \ export-backup \ - --connection-name $NEXUS_BANK_CONNECTION_NAME \ - --nexus-user-id $NEXUS_USER \ - --nexus-password $NEXUS_PASSWORD \ --passphrase $SECRET \ --outputfile $BACKUP_FILE \ - $NEXUS_URL + $CONNECTION_NAME At this point, Nexus must communicate all the details to the bank. Therefore, it will *(5) synchronize the connection*. In this EBICS example, Nexus will send @@ -104,25 +97,19 @@ the *INI* and *HIA* messages to the bank. libeufin-cli \ connections \ sync \ - --connection-name $NEXUS_BANK_CONNECTION_NAME \ - --nexus-user-id $NEXUS_USER \ - --nexus-password $NEXUS_PASSWORD \ - $NEXUS_URL + $CONNECTION_NAME 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 *(6) downloads the list of the bank accounts offered by the* -``$NEXUS_BANK_CONNECTION_NAME``. +``$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 + $CONNECTION_NAME It is now possible to *(7) list the accounts offered by the connection*. @@ -131,9 +118,7 @@ It is now possible to *(7) list the accounts offered by the connection*. libeufin-cli \ connections \ list-offered-bank-accounts \ - --nexus-user-id $NEXUS_USER \ - --nexus-password $NEXUS_PASSWORD \ - $NEXUS_URL + $CONNECTION_NAME Nexus now needs an explicit *(8) import of the accounts it needs to manage*. This step is needed to let the user pick a custom name for such accounts. @@ -143,15 +128,12 @@ This step is needed to let the user pick a custom name for such accounts. 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 + $CONNECTION_NAME Once a Nexus user imported a bank account (``$CUSTOM_RENAMING_FOR_ACCOUNT``) -under a certain connection (``$NEXUS_BANK_CONNECTION_NAME``), it is possible +under a certain connection (``$CONNECTION_NAME``), it is possible to accomplish the usual operations for any bank account: asking for the list of transactions, and making a payment. @@ -172,10 +154,7 @@ This command asks Nexus to *download the latest bank statements*: libeufin-cli \ accounts \ fetch-transactions \ - --nexus-user-id $NEXUS_USER \ - --nexus-password $NEXUS_PASSWORD \ - --account-name $CUSTOM_RENAMING_FOR_ACCOUNT \ - $NEXUS_URL + $CUSTOM_RENAMING_FOR_ACCOUNT Once Nexus stored all the information in the database, the client can ask to actually **see** the transactions: @@ -185,10 +164,7 @@ client can ask to actually **see** the transactions: libeufin-cli accounts \ transactions \ - --nexus-user-id $NEXUS_USER \ - --nexus-password $NEXUS_PASSWORD \ - --account-name $CUSTOM_RENAMING_FOR_ACCOUNT \ - $NEXUS_URL + $CUSTOM_RENAMING_FOR_ACCOUNT Make a payment ============== @@ -205,15 +181,15 @@ The following command prepares a payment: libeufin-cli \ accounts \ prepare-payment \ - --account-name $CUSTOM_RENAMING_FOR_ACCOUNT \ --credit-iban $IBAN_TO_SEND_MONEY_TO \ --credit-bic $BIC_TO_SEND_MONEY_TO \ --credit-name $LEGAL_ENTITY_RECEIVING_THE_PAYMENT \ - --payment-amount $AMOUNT \ # NOTE THIS. + --payment-amount $AMOUNT \ --payment-subject $SUBJECT \ - --nexus-user-id $NEXUS_USER \ - --nexus-password $NEXUS_PASSWORD \ - $NEXUS_URL + $CUSTOM_RENAMING_FOR_ACCOUNT + +Note: the ``$AMOUNT`` value needs the format ``X.Y:CURRENCY``; for example +``10:EUR``, or ``1.01:EUR``. The previous command should return a value (``$UUID``) that uniquely identifies the prepared payment in the Nexus system. It'll be needed @@ -224,11 +200,9 @@ in the next step, to **send the payment instructions to the bank**: libeufin-cli \ accounts \ submit-payment \ - --account-name $CUSTOM_RENAMING_FOR_ACCOUNT \ --payment-uuid $UUID \ - --nexus-user-id $NEXUS_USER \ - --nexus-password $NEXUS_PASSWORD \ - $NEXUS_URL + $CUSTOM_RENAMING_FOR_ACCOUNT + Restore the backup ================== @@ -243,9 +217,6 @@ for the requesting user. libeufin-cli \ connection \ restore-backup \ - --connection-name $NEXUS_BANK_CONNECTION_NAME \ - --nexus-user-id $NEXUS_USER \ - --nexus-password $NEXUS_PASSWORD \ --passphrase $SECRET \ --outputfile $BACKUP_FILE \ - $NEXUS_URL + $CONNECTION_NAME -- cgit v1.2.3