kych

OAuth 2.0 API for Swiyu to enable Taler integration of Swiyu for KYC (experimental)
Log | Files | Refs

commit 97794e0d32bf55b89a50fbfbb37b7d481e10b67a
parent 0016c1a0cda56af65eb7c5a558bdb2f7fd198851
Author: Henrique Chan Carvalho Machado <henriqueccmachado@tecnico.ulisboa.pt>
Date:   Mon,  3 Nov 2025 23:09:35 +0100

swiyu-verifier api_requests: response output to json file

Diffstat:
Mswiyu-verifier/api_requests/post_management_api_verifications.sh | 21++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/swiyu-verifier/api_requests/post_management_api_verifications.sh b/swiyu-verifier/api_requests/post_management_api_verifications.sh @@ -10,12 +10,27 @@ if [ $# -eq 0 ]; then exit 1 fi +# Determine the input file (add .json if not present and file doesn't exist) +if [ -f "$1" ]; then + input_file="$1" +elif [ -f "${1}.json" ]; then + input_file="${1}.json" +else + echo "Error: File '$1' or '${1}.json' not found" + exit 1 +fi + +base_name="${input_file%.json}" + +response_file="${base_name}_response.json" +qr_code_file="${base_name}_qr_code.png" + curl -X POST http://localhost:8080/management/api/verifications \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ - -d @"$1" \ - | jq -r '.verification_url' | tee /dev/tty | xargs qrencode -o qr_code.png + -d @"$input_file" \ + | tee "$response_file" | jq -r '.verification_url' | tee /dev/tty | xargs qrencode -o "$qr_code_file" # open .png with default image viewer app -open qr_code.png +open "$qr_code_file"