From 622eb624b350a89918f92fc1084b67273e5e9eb4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 12 Nov 2023 16:04:30 +0100 Subject: -fix kycaid converter --- src/kyclogic/taler-exchange-kyc-kycaid-converter.sh | 19 ++++++++++++------- src/kyclogic/taler-exchange-kyc-oauth2-nda.sh | 9 ++++++--- .../taler-exchange-kyc-oauth2-test-converter.sh | 10 ++++++---- src/kyclogic/taler-exchange-kyc-persona-converter.sh | 15 +++++++++------ 4 files changed, 33 insertions(+), 20 deletions(-) (limited to 'src/kyclogic') 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 -- cgit v1.2.3