aboutsummaryrefslogtreecommitdiff
path: root/src/kyclogic
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-11-12 16:04:30 +0100
committerChristian Grothoff <christian@grothoff.org>2023-11-12 16:04:30 +0100
commit622eb624b350a89918f92fc1084b67273e5e9eb4 (patch)
tree23f18c31727e76db00a11c6dd3dbc4a736a6a1b8 /src/kyclogic
parent70ad9bcf8ef180157ffb4788a562973eb41e5e7a (diff)
-fix kycaid converter
Diffstat (limited to 'src/kyclogic')
-rwxr-xr-xsrc/kyclogic/taler-exchange-kyc-kycaid-converter.sh19
-rwxr-xr-xsrc/kyclogic/taler-exchange-kyc-oauth2-nda.sh9
-rwxr-xr-xsrc/kyclogic/taler-exchange-kyc-oauth2-test-converter.sh10
-rwxr-xr-xsrc/kyclogic/taler-exchange-kyc-persona-converter.sh15
4 files changed, 33 insertions, 20 deletions
diff --git a/src/kyclogic/taler-exchange-kyc-kycaid-converter.sh b/src/kyclogic/taler-exchange-kyc-kycaid-converter.sh
index f77ad9bf2..68a1b6a0d 100755
--- a/src/kyclogic/taler-exchange-kyc-kycaid-converter.sh
+++ b/src/kyclogic/taler-exchange-kyc-kycaid-converter.sh
@@ -70,16 +70,21 @@ then
# CITY=$(echo $J | jq -r '[.postcode,.city,."address-subdivision,.cc"]|join(" ")')
# Combine into final result for individual.
- # FIXME: does jq tolerate 'pep = NULL' here?
- echo "$J" | jq \
- --arg full_name "${FULLNAME}" \
- '{$full_name,"birthdate":.dob,"pep":.pep,"phone":."phone","email",.email,"residences":.residence_country}'
+ echo "$J" \
+ | jq \
+ --arg full_name "${FULLNAME}" \
+ '{$full_name,"birthdate":.dob,"pep":.pep,"phone":.phone,"email":.email,"residences":.residence_country}' \
+ | jq \
+ 'del(..|select(.==null))'
else
# Combine into final result for business.
- echo "$J" | jq \
- $DOCS_RAW \
- "{\"company_name\":.company_name,\"phone\":.phone,\"email\":.email,\"registration_country\":.registration_country,\"documents\":[${DOCS_JSON}]}"
+ echo "$J" \
+ | jq \
+ $DOCS_RAW \
+ "{\"company_name\":.company_name,\"phone\":.phone,\"email\":.email,\"registration_country\":.registration_country,\"documents\":[${DOCS_JSON}]}" \
+ | jq \
+ 'del(..|select(.==null))'
fi
exit 0
diff --git a/src/kyclogic/taler-exchange-kyc-oauth2-nda.sh b/src/kyclogic/taler-exchange-kyc-oauth2-nda.sh
index 61c743c82..5af785f19 100755
--- a/src/kyclogic/taler-exchange-kyc-oauth2-nda.sh
+++ b/src/kyclogic/taler-exchange-kyc-oauth2-nda.sh
@@ -20,8 +20,11 @@ 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}'
+echo "$J" \
+ | jq \
+ --arg full_name "${FULLNAME}" \
+ '{$full_name,"phone":.phone,"id":.id}' \
+ | jq \
+ 'del(..|select(.==null))'
exit 0
diff --git a/src/kyclogic/taler-exchange-kyc-oauth2-test-converter.sh b/src/kyclogic/taler-exchange-kyc-oauth2-test-converter.sh
index 51ec80dc6..76f9f16c4 100755
--- a/src/kyclogic/taler-exchange-kyc-oauth2-test-converter.sh
+++ b/src/kyclogic/taler-exchange-kyc-oauth2-test-converter.sh
@@ -22,8 +22,10 @@ fi
FULLNAME=$(echo "$J" | jq -r '[.first,.last]|join(" ")')
-echo $J | jq \
- --arg full_name "${FULLNAME}" \
- '{$full_name,"birthdate":.birthdate,"id":.id}'
-
+echo $J \
+ | jq \
+ --arg full_name "${FULLNAME}" \
+ '{$full_name,"birthdate":.birthdate,"id":.id}' \
+ | jq \
+ 'del(..|select(.==null))'
exit 0
diff --git a/src/kyclogic/taler-exchange-kyc-persona-converter.sh b/src/kyclogic/taler-exchange-kyc-persona-converter.sh
index a5d4d03ac..13142d0e5 100755
--- a/src/kyclogic/taler-exchange-kyc-persona-converter.sh
+++ b/src/kyclogic/taler-exchange-kyc-persona-converter.sh
@@ -44,11 +44,14 @@ else
fi
# Combine into final result.
-echo "$J" | jq \
- --arg full_name "${FULLNAME}" \
- --arg street "${STREET}" \
- --arg city "${CITY}" \
- --rawfile photo "${PHOTO_FILE}" \
- '{$full_name,$street,$city,"birthdate":.birthdate,"residences":.cc,"identification_number":."identification-number",$photo}'
+echo "$J" \
+ | jq \
+ --arg full_name "${FULLNAME}" \
+ --arg street "${STREET}" \
+ --arg city "${CITY}" \
+ --rawfile photo "${PHOTO_FILE}" \
+ '{$full_name,$street,$city,"birthdate":.birthdate,"residences":.cc,"identification_number":."identification-number",$photo}' \
+ | jq \
+ 'del(..|select(.==null))'
exit 0