diff options
author | MS <ms@taler.net> | 2023-07-06 14:44:45 +0200 |
---|---|---|
committer | MS <ms@taler.net> | 2023-07-06 14:49:59 +0200 |
commit | 1b6f704ff8ba2d065dafd02f991340d846407428 (patch) | |
tree | 385caecff5ca62495371ba3d3d5f6380df4363f1 | |
parent | 15e613de9a0574c76f6a77df21dcb6bc9942d40e (diff) | |
download | deployment-1b6f704ff8ba2d065dafd02f991340d846407428.tar.gz deployment-1b6f704ff8ba2d065dafd02f991340d846407428.tar.bz2 deployment-1b6f704ff8ba2d065dafd02f991340d846407428.zip |
NLnet Task3 delivery.
Preferring the unified way, where the test runner
uploads a payment and then downloads the history
from the bank.
-rw-r--r-- | nlnet/task3/Dockerfile | 9 | ||||
-rwxr-xr-x | nlnet/task3/ebics.sh | 8 | ||||
-rwxr-xr-x | nlnet/task3/keys.sh | 8 | ||||
-rwxr-xr-x | nlnet/task3/start.sh | 83 |
4 files changed, 40 insertions, 68 deletions
diff --git a/nlnet/task3/Dockerfile b/nlnet/task3/Dockerfile index 4ec5732..52e7978 100644 --- a/nlnet/task3/Dockerfile +++ b/nlnet/task3/Dockerfile @@ -1,20 +1,15 @@ FROM debian:stable RUN apt-get update -RUN apt-get install -y openjdk-17-jre git python3-pip curl jq sqlite3 -RUN pip3 install click requests +RUN apt-get install -y openjdk-17-jre git python3-pip curl jq sqlite3 postgresql python3-requests python3-click sudo # Installation RUN git clone git://git.taler.net/libeufin WORKDIR /libeufin -RUN git fetch && git checkout 06452b9adc4d149bdb1532a3ea3160909eb51c9a +RUN git fetch && git checkout 4bc5f38f571a45d427f73813ec3846bf59413afa RUN ./bootstrap RUN ./configure --prefix=/usr/local RUN make install - COPY keys.sh / -COPY ebics.sh / COPY start.sh / -COPY salted-incoming-payment-template.csv / -RUN mkdir /output-docs ENTRYPOINT ["/start.sh"] diff --git a/nlnet/task3/ebics.sh b/nlnet/task3/ebics.sh deleted file mode 100755 index a6f14e2..0000000 --- a/nlnet/task3/ebics.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# This script offers one operation to download the latest payments -# and another operation to upload one pain.001. It relies on PostFinance.kt -# in libeufin.git. - -# ./ebics.sh download -# ./ebics.sh upload $PAYMENT_SUBJECT diff --git a/nlnet/task3/keys.sh b/nlnet/task3/keys.sh index 281f17a..66cf5dd 100755 --- a/nlnet/task3/keys.sh +++ b/nlnet/task3/keys.sh @@ -5,7 +5,7 @@ set -eu # This script prepares the EBICS keys for one subscriber # at the PostFinance test platform. -export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:/postfinance-nexusdb.sqlite3" +export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:/tmp/postfinance-nexusdb.sqlite3" NEXUS_USERNAME="netzbon-bridge" NEXUS_PASSWORD="secret" @@ -13,7 +13,6 @@ NEXUS_PORT="5001" function exit_cleanup() { - echo "Running exit-cleanup" for n in `jobs -p` do kill $n 2> /dev/null || true @@ -64,14 +63,14 @@ libeufin-cli connections new-ebics-connection \ # NOTE: these keys will ONLY be considered if the user # is in a NEW state. Please delete any previous uploaded # keys via the "zuruecksetzen" button. -echo "Please reset any previous keys via the bank Web UI, then press Enter.." +echo "Please reset any previous keys via the bank Web UI, then press Enter.. " read -s echo -n "Sending the new keys to the bank..." libeufin-cli connections connect postfinanceconn echo DONE # 2, invite the user to unblock them in the Web UI -echo "Please enable the new client keys via the bank Web UI, then press Enter.." +echo "Please enable the new client keys via the bank Web UI, then press Enter.. " read -s # 3, download the bank keys (HPB). @@ -85,6 +84,7 @@ libeufin-cli connections show-connection postfinanceconn | jq -r '.details | "Au echo echo "If any bank keys showed up, please check in the bank Web UI if they match." echo "If they match, press Enter to continue, otherwise CTRL-C to end." +read -s echo -n "Preparing the local keys bundle.." libeufin-cli connections export-backup \ diff --git a/nlnet/task3/start.sh b/nlnet/task3/start.sh index b1edcc9..a6c3ab2 100755 --- a/nlnet/task3/start.sh +++ b/nlnet/task3/start.sh @@ -2,6 +2,12 @@ set -eu +function finish() { + exit 1 +} + +trap finish SIGINT + # Expected arguments are: # # $1 := EBICS user ID @@ -10,66 +16,34 @@ set -eu # Suggested invocation via 'docker': # -# docker -# run \ -# -v /$HOST_MOUNTPOINT:/output-docs/ \ -# -it $IMAGE_TAG $EBICS_USER_ID $EBICS_PARTNER_ID $MY_IBAN - +# docker run -it $IMAGE_TAG $EBICS_USER_ID $EBICS_PARTNER_ID +service postgresql start +sudo -u postgres createuser -s root +createdb libeufincheck # This script conducts the key exchange with the bank # and guides the user to download and upload docuemts # to the bank. It pauses the execution to let the user # check and set the Web UI as a double-check mean. -# Setting the EBICS keys. +# Setting the EBICS keys. It'll place them in the container's +# /tmp/pofi.json, where Kotlin expects them. export EBICS_USER_ID=$1 export EBICS_PARTNER_ID=$2 /keys.sh # If the keys are ready, it proceeds to invoke the uploading -# and downloading logic (ebics.sh). Such 'invocation' might -# even just mean to give the user a facilitated environment -# to manually run the steps. - -# Download test. - -# Let the user first upload one salted payment that should -# then show up here as the downloaded result. The salted -# payment is a CSV file that should be manually uploaded in -# the bank Web UI. -PAYMENT_SALT=$RANDOM -echo "Now preparing the CSV document that instructs the bank" -echo "to create an incoming payment for the test platform account." -echo "The incoming payment defaults to have this subject: $PAYMENT_SALT". -echo "Please enter any value in this prompt, in case you want to" -echo -n "change the default subject: " -read MAYBE_PAYMENT_SALT - -if ! test "x" = "x$MAYBE_PAYMENT_SALT"; then - PAYMENT_SALT=$MAYBE_PAYMENT_SALT -fi - -MY_IBAN=$3 -OUTPUT_CSV=$(mktemp /output-docs/salted-incoming-payment-XXXX.csv) -sed "s/__PAYMENT_SALT__/$PAYMENT_SALT/" /salted-incoming-payment-template.csv \ - | sed "s/__PAYEE_IBAN__/$MY_IBAN/" > $OUTPUT_CSV - -echo "The payment instruction (subject $PAYMENT_SALT) was saved in $OUTPUT_CSV." -echo -n "Please upload it manually to the bank and press Enter when done. " -read -/ebics.sh download # downloads the new records. - -echo "Now downloading the banking records and showing the payment subject(s)" -echo "that were found. If you see $PAYMENT_SALT, then LibEuFin succeeded in" -echo "downloading the banking records." +# and downloading logic. # Upload test. -echo -echo "Press Enter to continue with uploading a payment instruction to the" -echo -n "bank, or CTRL-C to end the test. " + +# The test runner will upload one pain.001 document to +# the bank. Thereafter, the user can check the existtence +# of such document via the bank Web UI. Moreover, the user +# is offered the possibility to specify a custom payment +# subject. PAIN_SALT=$RANDOM echo -echo echo "Now preparing the pain.001 to upload to the bank via LibEuFin." echo "This document instructs the bank to send money to an arbitrary" echo "IBAN by debiting the test platform bank account." @@ -82,12 +56,23 @@ if ! test "x" = "x$MAYBE_PAIN_SALT"; then PAIN_SALT=$MAYBE_PAIN_SALT fi -echo "The pain.001 will have this subject: $PAIN_SALT, now calling" -echo -n "LibEuFin to upload it via EBICS.." -/ebics.sh upload $PAIN_SALT # uploads one pain.001 given its subject. +echo "The pain.001 will have this subject: '$PAIN_SALT', now calling" +echo "LibEuFin to upload it via EBICS.." +cd /libeufin; ./gradlew -q :nexus:pofi --args="upload --subject \"$PAIN_SALT\""; cd - echo DONE echo echo "Please check the bank Web UI to find the pain.001 document" echo "whose subject is '$PAIN_SALT'. If that is found, then LibEuFin" -echo "has successfully uploaded it." +echo "has successfully uploaded it. In the next step, LibEuFin" +echo "will download the new banking records. If '$PAIN_SALT' is found" +echo "in the logs, then it succeeded. Press Enter to continue.. " +read -s + +# Download test. + +# The test runnner proceeds with downloading the banking +# records that witness the payment that was uploaded shortly +# ago. If the logs show the payment subject that belongs +# to such payment, then the download went through. +cd /libeufin; ./gradlew -q :nexus:pofi --args="download"; cd - |