exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

taler-exchange-kyc-oauth2-challenger.sh (617B)


      1 #!/bin/bash
      2 # This file is in the public domain.
      3 #
      4 # This code converts (some of) the JSON output from
      5 # Challenger into the GNU Taler
      6 # specific KYC attribute data (again in JSON format).
      7 #
      8 
      9 # Die if anything goes wrong.
     10 set -eu
     11 
     12 # First, extract everything from stdin.
     13 J=$(jq '{"id":.id,"email":.address,"type":.address_type,"expires":.address_expiration}')
     14 
     15 ADDRESS_TYPE=$(echo "$J" | jq -r '.type')
     16 ROWID=$(echo "$J" | jq -r '.id')
     17 if [ "$ADDRESS_TYPE" != "email" ]
     18 then
     19   return 1
     20 fi
     21 
     22 echo "$J" \
     23   | jq \
     24    --arg id "${ROWID}" \
     25   '{"FORM_ID":"challenger-email",$id,"email":.email,"expires":.expires}'
     26 
     27 exit 0