blob: b1edcc9a16d438b764bf69dbb6a8ffa3b6e16a0a (
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
|
#!/bin/bash
set -eu
# Expected arguments are:
#
# $1 := EBICS user ID
# $2 := EBICS partner ID
# $3 := IBAN as assigned by the PostFinance test platform.
# Suggested invocation via 'docker':
#
# docker
# run \
# -v /$HOST_MOUNTPOINT:/output-docs/ \
# -it $IMAGE_TAG $EBICS_USER_ID $EBICS_PARTNER_ID $MY_IBAN
# 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.
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."
# 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. "
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."
echo "The outgoing payment defaults to have this subject: $PAIN_SALT".
echo "Please enter any value in this prompt, in case you want to"
echo -n "change the default subject: "
read MAYBE_PAIN_SALT
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 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."
|