commit 622eb624b350a89918f92fc1084b67273e5e9eb4
parent 70ad9bcf8ef180157ffb4788a562973eb41e5e7a
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 12 Nov 2023 16:04:30 +0100
-fix kycaid converter
Diffstat:
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
@@ -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
@@ -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
@@ -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
@@ -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