diff options
author | Nic <nic@eigel.ch> | 2023-11-02 23:51:21 +0100 |
---|---|---|
committer | Nic <nic@eigel.ch> | 2023-11-02 23:51:21 +0100 |
commit | 082728f839e909453b60ba76396a9ae30f86a58f (patch) | |
tree | 869d90d2a5cefdf9a55124bf6d4ee840cd02fb24 /src/kyclogic/taler-exchange-kyc-oauth2-nda.sh | |
parent | 0442c22857a83eb9291182a1a4d372f1ffb9203c (diff) | |
parent | ec34049dff00219dfbfce23967fcaae92a391bb6 (diff) | |
download | exchange-082728f839e909453b60ba76396a9ae30f86a58f.tar.gz exchange-082728f839e909453b60ba76396a9ae30f86a58f.tar.bz2 exchange-082728f839e909453b60ba76396a9ae30f86a58f.zip |
Merge remote-tracking branch 'refs/remotes/origin/master'
Diffstat (limited to 'src/kyclogic/taler-exchange-kyc-oauth2-nda.sh')
-rw-r--r-- | src/kyclogic/taler-exchange-kyc-oauth2-nda.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/kyclogic/taler-exchange-kyc-oauth2-nda.sh b/src/kyclogic/taler-exchange-kyc-oauth2-nda.sh new file mode 100644 index 000000000..61c743c82 --- /dev/null +++ b/src/kyclogic/taler-exchange-kyc-oauth2-nda.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# This file is in the public domain. +# +# This code converts (some of) the JSON output from NDA into the GNU Taler +# specific KYC attribute data (again in JSON format). +# + +# Die if anything goes wrong. +set -eu + +# First, extract everything from stdin. +J=$(jq '{"status":.status,"id":.data.id,"last":.data.last_name,"first":.data.first_name,"phone":.data.phone}') + +STATUS=$(echo "$J" | jq -r '.status') +if [ "$STATUS" != "success" ] +then + return 1 +fi + +# Next, combine some fields into larger values. +FULLNAME=$(echo "$J" | jq -r '[.first_name,.last_name]|join(" ")') + +echo "$J" | jq \ + --arg full_name "${FULLNAME}" \ + '{$full_name,"phone":.phone,"id":.id}' + +exit 0 |