From 6d5e61209c2ed4a63adb67d94510b5df9c91a8e7 Mon Sep 17 00:00:00 2001 From: Midgard <2885-Midgard@users.noreply.framagit.org> Date: Wed, 26 Jul 2023 19:36:38 +0200 Subject: [PATCH] [bin] Add payme script --- bin/payme | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 bin/payme diff --git a/bin/payme b/bin/payme new file mode 100755 index 0000000..9313c13 --- /dev/null +++ b/bin/payme @@ -0,0 +1,51 @@ +#!/bin/bash + +set -euo pipefail + + +name="" # Your name +iban="" # Your International Bank Account Number, without separators +bic="" # The Bank Identification Code of your bank +currency="EUR" + + +if [ -z "$name" ] || [ -z "$iban" ] || [ -z "$bic" ]; then + echo "Fill in your account information in $(realpath "$0")" + exit 1 +fi + +if test $# -lt 2; then + echo "Usage: $0 " >&2 + exit 1 +fi + +amount="$1" +shift 1 +message="$@" + +echo "$(tput bold)Beneficiary$(tput sgr0) $name" +echo "$(tput bold)Account$(tput sgr0) $iban (BIC: $bic)" +echo "$(tput bold)Amount$(tput sgr0) $amount $currency" +echo "$(tput bold)Message$(tput sgr0) $message" + +if ! [[ $amount =~ [0-9]+(\.[0-9]+)? ]]; then + echo "Incorrect 'amount' format, (only) provide a decimal number like '1.5'" >&2 + exit 1 +fi + + +rm -f /tmp/qr.png +qrencode -s 10 -o /tmp/qr.png <