| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "init": "{ |
| 5 | $nom_AA = 'Consultes_Getons'; |
| 6 | |
| 7 | $args = trigger.data; |
| 8 | $_Portal = $args._Portal; |
| 9 | $refcons = $args.refcons; |
| 10 | |
| 11 | $__dada = $refval => { |
| 12 | data_feed[[ oracles = $args._Registre, feed_name = $refval, ifnone = false ]] |
| 13 | }; |
| 14 | }", |
| 15 | "messages": [ |
| 16 | { |
| 17 | "app": "state", |
| 18 | "state": "{ |
| 19 | response[ 'consulta' ] = $refcons; |
| 20 | $refgeto = |
| 21 | $args.nom ? |
| 22 | 'geto_' || $args.nom : |
| 23 | $__dada( 'refgeto_' || $args.idgeto ); |
| 24 | |
| 25 | if ( $refcons == 'Dades_Geto' ) { |
| 26 | $getons_pendents = var[ $_Portal ][ 'getons_pendents' ]; |
| 27 | |
| 28 | $resp = $args.nom ? 'getó amb nom ' || $args.nom : 'getó amb id ' || $args.idgeto; |
| 29 | |
| 30 | if ( ! $__dada( $refgeto ) ) |
| 31 | response[ $resp ] = 'Desconegut'; |
| 32 | |
| 33 | if ( ! $__dada( $refgeto || '__confirmant' ) ) |
| 34 | response[ $resp ] = 'Pendent de validació'; |
| 35 | |
| 36 | if ( !! $getons_pendents[ $refgeto ] AND ! $__dada( $refgeto || '_id' )) |
| 37 | response[ $resp ] = 'Pendent de generació'; |
| 38 | |
| 39 | if ( ! $__dada( $refgeto || '_id' ) ) |
| 40 | response[ $resp ] = "pendent d'inscripció"; |
| 41 | |
| 42 | $refs = [ |
| 43 | 'id', 'estat', '_proposant', '_confirmant', '_FOP', 'aportacio', |
| 44 | 'factor_conversio', 'taxa_conversio', 'derivacio', 'import_activacio', |
| 45 | 'import_subscripcio', 'import_renovacio','cicles_diposit', |
| 46 | 'activacions_restringides', 'subscripcions_restringides', |
| 47 | 'recepcions_restringides', 'conversions_restringides', |
| 48 | 'valors_esmenables', 'llistats_editables', 'bloqueig_possible', |
| 49 | '_AUT_A', '_AUT_B', '_AUT_C' |
| 50 | ]; |
| 51 | |
| 52 | $__resposta = $r => { |
| 53 | response[ $r ] = $__dada( $refgeto || '_' || $r ); |
| 54 | }; |
| 55 | |
| 56 | $resps = map( $refs, 23, $__resposta ); |
| 57 | } |
| 58 | |
| 59 | if ( $refcons == 'Dades_Generacio' ) { |
| 60 | response[ 'Existeix' ] = asset[ $args.idgeto ].exists; |
| 61 | response[ 'Generat' ] = asset[ $args.idgeto ].is_issued; |
| 62 | response[ 'Cap' ] = asset[ $args.idgeto ].cap; |
| 63 | response[ 'Adreça del Definidor' ] = asset[ $args.idgeto ].definer_address; |
| 64 | } |
| 65 | |
| 66 | if ( $refcons == 'Avis' ) { |
| 67 | $refavis = 'avis_' || $refgeto || '_' || $args.adr; |
| 68 | $temps_avis = $__dada( $refavis ); |
| 69 | $avis_es_actual = $temps_avis + ( $__dada( 'Lapse' ) * 2 ) < timestamp; |
| 70 | if ( $avis_es_actual ) { |
| 71 | response[ 'Avís' ] = $__dada( $refavis || '_text' ); |
| 72 | response[ 'Hora' ] = timestamp_to_string( $temps_avis, 'time' ); |
| 73 | response[ 'Data' ] = timestamp_to_string( $temps_avis, 'date' ); |
| 74 | response[ 'Rebot' ] = $__dada( $refavis || '_rebot' ); |
| 75 | } else { |
| 76 | response[ 'No hi ha cap avís per a' ] = $args.adr; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | if ( $refcons == 'Capacitacio' ) { |
| 81 | $ref_capacitacio = 'CPC_' || $refgeto || '_' || $args.accio || '_' || $args.adr; |
| 82 | $capacitada = $__dada( $ref_capacitacio ) otherwise ''; |
| 83 | $secc = $capacitada == 'capacitada' ? ' ' : ' NO '; |
| 84 | response[ 'Ref' ] = $ref_capacitacio; |
| 85 | response[ 'Capacitacio' ] = 'Adreça' || $secc || 'capacitada per a ' || $args.accio || 'ns'; |
| 86 | } |
| 87 | |
| 88 | if ( $refcons == 'Geto_Pendent' ) { |
| 89 | $getons_pendents = var[ $_Portal ][ 'getons_pendents' ]; |
| 90 | response[ "Getó pendent d'inscripció" ] = $getons_pendents[ $refgeto ]; |
| 91 | } |
| 92 | |
| 93 | if ( $refcons == 'Emissions_Geto' ) { |
| 94 | $total_emissions = $__dada( 'total_emissions_' || $refgeto ) otherwise 0; |
| 95 | response[ 'Emissions de ' || $refgeto ] = $total_emissions; |
| 96 | } |
| 97 | |
| 98 | if ( $refcons == 'Romanent_Geto' ) { |
| 99 | $idgeto = $__dada( $refgeto || '_id' ); |
| 100 | response[ 'Id ' || $refgeto ] = $idgeto; |
| 101 | response[ 'Romanent en ' || $args.nom ] = balance[ $args._Portal ][ $idgeto ]; |
| 102 | } |
| 103 | }" |
| 104 | } |
| 105 | ] |
| 106 | } |
| 107 | ] |