From b95d781d488799fde4eec7a17970ed53e1029578 Mon Sep 17 00:00:00 2001 From: MS Date: Mon, 23 Aug 2021 12:08:14 -1100 Subject: Anastasis/LibEuFin test: provide wire transfer command. --- src/cli/test_iban.sh | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/cli/test_iban.sh b/src/cli/test_iban.sh index 8045db3..b4b3c0e 100755 --- a/src/cli/test_iban.sh +++ b/src/cli/test_iban.sh @@ -31,7 +31,6 @@ function cleanup() # $1=ebics username, $2=ebics partner name, $3=person name, $4=sandbox bank account name, $5=iban function prepare_sandbox_account() { - echo -n "Activating ebics subscriber $1 at the sandbox ..." libeufin-cli \ sandbox --sandbox-url=$SANDBOX_URL \ @@ -46,7 +45,7 @@ function prepare_sandbox_account() { ebicsbankaccount create \ --iban=$5 \ --bic="BCMAESM1XXX"\ - --person-name=$3 \ + --person-name="$3" \ --account-name=$4 \ --ebics-user-id=$1 \ --ebics-host-id=$EBICS_HOST \ @@ -59,6 +58,27 @@ function prepare_sandbox_account() { # Install cleanup handler (except for kill -9) trap cleanup EXIT + +# Transfer _always_ from debit to credit/anastasis account. +# $1 = amount ($CURRENCY:X.Y), $2 = subject. +function wire_transfer_to_anastasis() { + libeufin-sandbox make-transaction \ + --debit-account=sandbox-account-debit \ + --credit-account=sandbox-account-credit "$1" "$2" + # Download new transactions now, so that they show up in the + # Anastasis facade. + export LIBEUFIN_NEXUS_USERNAME=$CREDIT_USERNAME + export LIBEUFIN_NEXUS_PASSWORD=$CREDIT_PASSWORD + libeufin-cli accounts fetch-transactions nexus-bankaccount-credit > /dev/null +} + +# $1 = facade base URL. Merely a debug utility. +function see_anastasis_transactions_via_facade() { + export LIBEUFIN_NEXUS_USERNAME=$CREDIT_USERNAME + export LIBEUFIN_NEXUS_PASSWORD=$CREDIT_PASSWORD + curl -s --user "$CREDIT_USERNAME:$CREDIT_PASSWORD" "${1}history/incoming?delta=5" | jq +} + # $1 = ebics user id, $2 = ebics partner, $3 = bank connection name # $4 = bank account name local to Nexus, $5 = bank account name as known # by Sandbox @@ -186,7 +206,8 @@ if ! curl -s --retry 5 --retry-connrefused $SANDBOX_URL > /dev/null; then fi echo " OK" -CURRENCY="TESTKUDOS" +CURRENCY="EUR" +# CURRENCY="TESTKUDOS" EBICS_HOST="ebicstesthost" IBAN_CREDIT="DE89370400440532013000" @@ -206,13 +227,13 @@ echo " OK" prepare_sandbox_account \ ebicsuserCredit \ ebicspartnerCredit \ - Person01 \ + "Person Credit" \ sandbox-account-credit \ $IBAN_CREDIT prepare_sandbox_account \ ebicsuserDebit \ ebicspartnerDebit \ - Person02 \ + "Person Debit" \ sandbox-account-debit \ $IBAN_DEBIT echo Sandbox preparation done @@ -428,6 +449,14 @@ NUMBER=`jq -r -e .challenge_feedback.\"$NAME_UUID\".details.wire_transfer_subjec SUBJECT="Anastasis ${NUMBER}" # FIXME-MS: must do wire transfer using $SUBJECT and $AMOUNT here! +# +# This command (see function definition above) wires funds: +# wire_transfer_to_anastasis "$CURRENCY:1" "Sandbox-only transaction 1" +# wire_transfer_to_anastasis "$CURRENCY:1" "Sandbox-only transaction 2" +# +# This command (see function definition above) checks the history via the facade API: +# see_anastasis_transactions_via_facade $FACADE_URL # via Nexus/facade. + bash -- cgit v1.2.3