libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 58d6b0aa414ca6a8a137ff6c4b301f502e8eccab
parent e2fcf78f1b68c96ff4d7a5c021f547e0d85ee98e
Author: MS <ms@taler.net>
Date:   Wed,  1 Nov 2023 14:50:37 +0100

Testing ebics-submit.

Providing script that inserts mock initiated payments into
the database, to let the ebics-submit subcommand pick them
and send to the bank.

Diffstat:
Acontrib/payment_initiation_debug.sh | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+), 0 deletions(-)

diff --git a/contrib/payment_initiation_debug.sh b/contrib/payment_initiation_debug.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# This script injects an initiated payment into its +# table, in order to test the ebics-submit subcommand. + +usage() { + echo "Usage: ./payment_initiation.sh CONFIG_FILE IBAN_CREDITOR PAYMENT_SUBJECT" + echo + echo "Pays a fixed amount of 1 CHF to the IBAN_CREDITOR with the PAYMENT_SUBJECT." + echo "It requires the EBICS keying to be already carried out, see ebics-setup" + echo "subcommand at libeufin-nexus(1)" +} + +# Detecting the help case. +if test "$1" = "--help" -o "$1" = "-h" -o -z ${1:-}; + then usage + exit +fi + +set -eu + +CONFIG_FILE=$1 +IBAN_CREDITOR=$2 +PAYMENT_SUBJECT=$3 + +# Getting the database connection. +DB_NAME=$(taler-config -c $1 -s nexus-postgres -o config) +echo database: $DB_NAME + +# Optionally reading the user-provided request UID. +if test -n "${LIBEUFIN_SUBMIT_REQUEST_UID:-}" + then SUBMIT_REQUEST_UID="$LIBEUFIN_SUBMIT_REQUEST_UID" + else SUBMIT_REQUEST_UID=$(uuidgen) +fi + +# Finally inserting the initiated payment into the database. +INSERT_COMMAND=" +INSERT INTO libeufin_nexus.initiated_outgoing_transactions + (amount, + wire_transfer_subject, + initiation_time, + credit_payto_uri, + request_uid) + VALUES ((1,0), + '${PAYMENT_SUBJECT}', + 1, + 'payto://iban/BIC/${IBAN_CREDITOR}', + '${SUBMIT_REQUEST_UID}')" + +# Only logging errors. +psql $DB_NAME -c "$INSERT_COMMAND" > /dev/null