commit ecb8c2078ebe94d81a6e03ebfe01ecdde53109e2 parent 39bdb65279ba7b8e0c4497a8034e9c35cabf77f2 Author: Sebastian <sebasjm@gmail.com> Date: Tue, 26 Mar 2024 18:53:47 -0300 install with tools Diffstat:
| M | packages/taler-harness/Makefile | | | 3 | +++ |
| A | packages/taler-harness/bin/create_merchantAndBankAccount_pdf.sh | | | 27 | +++++++++++++++++++++++++++ |
| R | packages/taler-harness/pdf-template.html -> packages/taler-harness/bin/pdf-template.html | | | 0 | |
| D | packages/taler-harness/create_merchantAndBankAccount_pdf.sh | | | 23 | ----------------------- |
4 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/packages/taler-harness/Makefile b/packages/taler-harness/Makefile @@ -34,7 +34,10 @@ install-nodeps: install ./dist/taler-harness-bundled.cjs $(DESTDIR)$(NODEDIR)/dist/ install ./dist/taler-harness-bundled.cjs.map $(DESTDIR)$(NODEDIR)/dist/ install ./bin/taler-harness.mjs $(DESTDIR)$(NODEDIR)/bin/ + install ./bin/create_merchantAndBankAccount_pdf.sh $(DESTDIR)$(NODEDIR)/bin/ + install ./bin/pdf-template.html $(DESTDIR)$(NODEDIR)/bin/ ln -sf ../lib/taler-harness/node_modules/taler-harness/bin/taler-harness.mjs $(DESTDIR)$(BINDIR)/taler-harness + ln -sf $(DESTDIR)$(NODEDIR)/bin/create_merchantAndBankAccount_pdf.sh $(DESTDIR)$(BINDIR)/create_merchantAndBankAccount_pdf.sh deps: pnpm install --frozen-lockfile --filter @gnu-taler/taler-harness... install: diff --git a/packages/taler-harness/bin/create_merchantAndBankAccount_pdf.sh b/packages/taler-harness/bin/create_merchantAndBankAccount_pdf.sh @@ -0,0 +1,27 @@ +#!/bin/bash +THIS_FILE=$(realpath "$0") +DIR=$(dirname "$THIS_FILE") + +DATA=$(mktemp) +set -e + +[ -z "$1" ] && echo First parameter must be the json file result from \'taler-harness deployment provision-bank-and-merchant\'. Alternative \'-\' can be used if the file is provided from stdin. && exit 1 + +cat $1 > $DATA + +[ -z "$(jq -r '.bankUser//empty' $DATA)" ] && echo the json file is not complete: missing bankUser && exit 1 +[ -z "$(jq -r '.bankURL//empty' $DATA)" ] && echo the json file is not complete: missing bankURL && exit 1 +[ -z "$(jq -r '.merchantURL//empty' $DATA)" ] && echo the json file is not complete: missing merchantURL && exit 1 +[ -z "$(jq -r '.templateURI//empty' $DATA)" ] && echo the json file is not complete: missing templateURI && exit 1 +[ -z "$(jq -r '.password//empty' $DATA)" ] && echo the json file is not complete: missing password && exit 1 + +add_qr_image(){ + jq -r $1 $DATA | qrencode -l Q -m 2 -s 5 -o - | base64 -w 0 | jq -Rn '{"'$2'":inputs}' | jq -s add - $DATA | sponge $DATA +} + +add_qr_image .templateURI templateQR +add_qr_image .bankURL bankQR +add_qr_image .merchantURL merchantQR + +chevron $DIR/pdf-template.html -d $DATA | wkhtmltopdf - out.pdf + diff --git a/packages/taler-harness/pdf-template.html b/packages/taler-harness/bin/pdf-template.html diff --git a/packages/taler-harness/create_merchantAndBankAccount_pdf.sh b/packages/taler-harness/create_merchantAndBankAccount_pdf.sh @@ -1,23 +0,0 @@ -DATA=$(mktemp) -set -e - -[ -z "$1" ] && echo First parameter must be the json file result from \'taler-harness deployment provision-bank-and-merchant\'. Alternative \'-\' can be used if the file is provided from stdin. && exit 1 - -cat $1 > $DATA - -[ -z "$(jq -r '.bankUser//empty' $DATA)" ] && echo the json file is not complete: missing bankUser && exit 1 -[ -z "$(jq -r '.bankURL//empty' $DATA)" ] && echo the json file is not complete: missing bankURL && exit 1 -[ -z "$(jq -r '.merchantURL//empty' $DATA)" ] && echo the json file is not complete: missing merchantURL && exit 1 -[ -z "$(jq -r '.templateURI//empty' $DATA)" ] && echo the json file is not complete: missing templateURI && exit 1 -[ -z "$(jq -r '.password//empty' $DATA)" ] && echo the json file is not complete: missing password && exit 1 - -add_qr_image(){ - jq -r $1 $DATA | qrencode -l Q -m 2 -s 5 -o - | base64 -w 0 | jq -Rn '{"'$2'":inputs}' | jq -s add - $DATA | sponge $DATA -} - -add_qr_image .templateURI templateQR -add_qr_image .bankURL bankQR -add_qr_image .merchantURL merchantQR - -chevron pdf-template.html -d $DATA | wkhtmltopdf - out.pdf -