@semacode/cli 1.5.17 → 1.5.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +268 -260
- package/LICENSE +22 -22
- package/README.md +93 -61
- package/SEMA_BRIEF.curto.txt +8 -6
- package/SEMA_BRIEF.md +71 -22
- package/SEMA_BRIEF.micro.txt +7 -5
- package/SEMA_INDEX.json +931 -193
- package/dist/controleComercialSupabase.d.ts +326 -0
- package/dist/controleComercialSupabase.js +310 -0
- package/dist/controleComercialSupabase.js.map +1 -0
- package/dist/docs.js +48 -20
- package/dist/docs.js.map +1 -1
- package/dist/drift.d.ts +5 -3
- package/dist/drift.js +119 -116
- package/dist/drift.js.map +1 -1
- package/dist/importador.d.ts +1 -1
- package/dist/importador.js +1 -200
- package/dist/importador.js.map +1 -1
- package/dist/index.js +1924 -493
- package/dist/index.js.map +1 -1
- package/dist/mcpRemoto.d.ts +32 -0
- package/dist/mcpRemoto.js +61 -0
- package/dist/mcpRemoto.js.map +1 -0
- package/dist/projeto.js +3 -21
- package/dist/projeto.js.map +1 -1
- package/dist/tipos.d.ts +1 -1
- package/docs/AGENT_STARTER.md +109 -102
- package/docs/cli.md +89 -33
- package/docs/como-ensinar-a-sema-para-ia.md +42 -36
- package/docs/deploy.md +231 -43
- package/docs/documentacao.md +61 -36
- package/docs/env.md +63 -14
- package/docs/extensao-vscode.md +12 -4
- package/docs/fluxo-pratico-ia-sema.md +45 -35
- package/docs/instalacao-e-primeiro-uso.md +52 -30
- package/docs/integracao-com-ia.md +44 -35
- package/docs/mcp.md +270 -31
- package/docs/pagamento-ponta-a-ponta.md +40 -24
- package/docs/persistencia-vendor-first.md +11 -5
- package/docs/prompt-base-ia-sema.md +18 -11
- package/docs/rollback.md +17 -15
- package/docs/sintaxe.md +37 -229
- package/exemplos/agendamento.sema +105 -106
- package/exemplos/assinatura.sema +133 -136
- package/exemplos/auditoria.sema +89 -88
- package/exemplos/autenticacao.sema +125 -125
- package/exemplos/author_obra_comum.sema +294 -0
- package/exemplos/author_tema_sensivel.sema +264 -0
- package/exemplos/automacao.sema +107 -107
- package/exemplos/cadastro_usuario.sema +54 -54
- package/exemplos/calculadora.sema +78 -78
- package/exemplos/crud_simples.sema +89 -89
- package/exemplos/estoque.sema +127 -126
- package/exemplos/exportacao.sema +94 -94
- package/exemplos/fila.sema +130 -131
- package/exemplos/integracao_externa.sema +94 -94
- package/exemplos/multi_tenant.sema +140 -140
- package/exemplos/notificacao.sema +149 -98
- package/exemplos/operacao_estrategia.sema +633 -402
- package/exemplos/pagamento.sema +434 -222
- package/exemplos/pagamento_dominio.sema +35 -35
- package/exemplos/pedido.sema +255 -119
- package/exemplos/permissao.sema +121 -121
- package/exemplos/persistencia_vendor_first.sema +86 -86
- package/exemplos/profile_game.sema +114 -0
- package/exemplos/profile_legal.sema +105 -0
- package/exemplos/profile_ops.sema +110 -0
- package/exemplos/profile_research.sema +104 -0
- package/exemplos/profile_software.sema +123 -0
- package/exemplos/profile_workflow_n8n.sema +99 -0
- package/exemplos/relatorio.sema +93 -93
- package/exemplos/replica_analitica_erp.sema +160 -0
- package/exemplos/testes_embutidos.sema +45 -45
- package/exemplos/tratamento_erro.sema +157 -157
- package/exemplos/upload_arquivo.sema +93 -93
- package/exemplos/webhook.sema +94 -96
- package/llms-full.txt +34 -34
- package/llms.txt +17 -17
- package/node_modules/@sema/gerador-css/dist/index.js +563 -563
- package/node_modules/@sema/gerador-css/package.json +1 -1
- package/node_modules/@sema/gerador-dart/package.json +1 -1
- package/node_modules/@sema/gerador-html/dist/index.js +90 -90
- package/node_modules/@sema/gerador-html/package.json +1 -1
- package/node_modules/@sema/gerador-javascript/dist/index.js +92 -92
- package/node_modules/@sema/gerador-javascript/package.json +1 -1
- package/node_modules/@sema/gerador-lua/dist/index.js +53 -53
- package/node_modules/@sema/gerador-lua/package.json +1 -1
- package/node_modules/@sema/gerador-python/dist/index.js +122 -96
- package/node_modules/@sema/gerador-python/dist/index.js.map +1 -1
- package/node_modules/@sema/gerador-python/package.json +1 -1
- package/node_modules/@sema/gerador-typescript/dist/index.js +153 -153
- package/node_modules/@sema/gerador-typescript/package.json +1 -1
- package/node_modules/@sema/nucleo/dist/ast/tipos.d.ts +2 -4
- package/node_modules/@sema/nucleo/dist/formatador/index.js +26 -46
- package/node_modules/@sema/nucleo/dist/formatador/index.js.map +1 -1
- package/node_modules/@sema/nucleo/dist/ir/conversor.js +9 -204
- package/node_modules/@sema/nucleo/dist/ir/conversor.js.map +1 -1
- package/node_modules/@sema/nucleo/dist/ir/modelos.d.ts +3 -35
- package/node_modules/@sema/nucleo/dist/lexer/tokens.js +0 -21
- package/node_modules/@sema/nucleo/dist/lexer/tokens.js.map +1 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.js +0 -40
- package/node_modules/@sema/nucleo/dist/parser/parser.js.map +1 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.d.ts +6 -5
- package/node_modules/@sema/nucleo/dist/semantico/analisador.js +76 -307
- package/node_modules/@sema/nucleo/dist/semantico/analisador.js.map +1 -1
- package/node_modules/@sema/nucleo/dist/semantico/estruturas.d.ts +2 -0
- package/node_modules/@sema/nucleo/dist/semantico/estruturas.js +32 -2
- package/node_modules/@sema/nucleo/dist/semantico/estruturas.js.map +1 -1
- package/node_modules/@sema/nucleo/package.json +1 -1
- package/node_modules/@sema/padroes/package.json +1 -1
- package/package.json +15 -15
package/exemplos/pagamento.sema
CHANGED
|
@@ -1,222 +1,434 @@
|
|
|
1
|
-
module exemplos.pagamento {
|
|
2
|
-
docs {
|
|
3
|
-
resumo: "Vertical oficial de pagamento
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
use exemplos.pagamento.dominio
|
|
7
|
-
|
|
8
|
-
task processar_pagamento {
|
|
9
|
-
input {
|
|
10
|
-
pagamento_id: Id required
|
|
11
|
-
valor: Decimal required
|
|
12
|
-
token: Texto required
|
|
13
|
-
}
|
|
14
|
-
output {
|
|
15
|
-
pagamento: Pagamento
|
|
16
|
-
status: StatusPagamento
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
1
|
+
module exemplos.pagamento {
|
|
2
|
+
docs {
|
|
3
|
+
resumo: "Vertical oficial de pagamento IA-first: contrato operacional para agente governar cobranca, estado, erro, efeito, seguranca e retry sem inventar comportamento."
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
use exemplos.pagamento.dominio
|
|
7
|
+
|
|
8
|
+
task processar_pagamento {
|
|
9
|
+
input {
|
|
10
|
+
pagamento_id: Id required
|
|
11
|
+
valor: Decimal required
|
|
12
|
+
token: Texto required
|
|
13
|
+
}
|
|
14
|
+
output {
|
|
15
|
+
pagamento: Pagamento
|
|
16
|
+
status: StatusPagamento
|
|
17
|
+
}
|
|
18
|
+
authz {
|
|
19
|
+
escopo: pagamentos.processar
|
|
20
|
+
tenant: obrigatorio
|
|
21
|
+
}
|
|
22
|
+
dados {
|
|
23
|
+
classificacao_padrao: financeiro
|
|
24
|
+
redacao_log: obrigatoria
|
|
25
|
+
input {
|
|
26
|
+
pagamento_id: interno
|
|
27
|
+
valor: financeiro
|
|
28
|
+
token: segredo
|
|
29
|
+
}
|
|
30
|
+
output {
|
|
31
|
+
pagamento: financeiro
|
|
32
|
+
status: interno
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
audit {
|
|
36
|
+
evento: pagamento.processado
|
|
37
|
+
ator: auth.usuario
|
|
38
|
+
correlacao: request_id
|
|
39
|
+
retencao: "180d"
|
|
40
|
+
motivo: obrigatorio
|
|
41
|
+
}
|
|
42
|
+
segredos {
|
|
43
|
+
gateway_pagamento_token {
|
|
44
|
+
origem: vault
|
|
45
|
+
escopo: runtime
|
|
46
|
+
acesso: gateway_pagamento
|
|
47
|
+
rotacao: "30d"
|
|
48
|
+
nao_logar: verdadeiro
|
|
49
|
+
nao_retornar: verdadeiro
|
|
50
|
+
mascarar: verdadeiro
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
forbidden {
|
|
54
|
+
shell.exec
|
|
55
|
+
log.segredo
|
|
56
|
+
retorno.credencial
|
|
57
|
+
}
|
|
58
|
+
rules {
|
|
59
|
+
valor > 0
|
|
60
|
+
token existe
|
|
61
|
+
token deve_ser valido
|
|
62
|
+
}
|
|
63
|
+
effects {
|
|
64
|
+
consulta gateway_pagamento criticidade = alta
|
|
65
|
+
persistencia Pagamento criticidade = alta
|
|
66
|
+
evento pagamento_autorizado criticidade = media
|
|
67
|
+
notificacao cliente comprovante_pagamento criticidade = media
|
|
68
|
+
auditoria pagamento criticidade = alta
|
|
69
|
+
}
|
|
70
|
+
vinculos {
|
|
71
|
+
recurso: gateway_pagamento
|
|
72
|
+
tabela: pagamentos
|
|
73
|
+
evento: pagamento_autorizado
|
|
74
|
+
}
|
|
75
|
+
execucao {
|
|
76
|
+
idempotencia: verdadeiro
|
|
77
|
+
timeout: "15s"
|
|
78
|
+
retry: "2x exponencial"
|
|
79
|
+
compensacao: "registrar_falha_pagamento"
|
|
80
|
+
criticidade_operacional: alta
|
|
81
|
+
}
|
|
82
|
+
state ciclo_pagamento {
|
|
83
|
+
transitions {
|
|
84
|
+
PENDENTE -> AUTORIZADO
|
|
85
|
+
AUTORIZADO -> PROCESSADO
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
guarantees {
|
|
89
|
+
pagamento existe
|
|
90
|
+
status em [AUTORIZADO, PROCESSADO]
|
|
91
|
+
pagamento.status == status
|
|
92
|
+
}
|
|
93
|
+
error {
|
|
94
|
+
autorizacao_negada: "A operacao foi recusada pelo gateway."
|
|
95
|
+
saldo_insuficiente: "O saldo nao cobre o valor da cobranca."
|
|
96
|
+
timeout_gateway: "O gateway nao respondeu em tempo habil."
|
|
97
|
+
}
|
|
98
|
+
tests {
|
|
99
|
+
caso "pagamento autorizado" {
|
|
100
|
+
given {
|
|
101
|
+
pagamento_id: "pag_1"
|
|
102
|
+
valor: 199.9
|
|
103
|
+
token: "tok_ok"
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
expect {
|
|
107
|
+
sucesso: verdadeiro
|
|
108
|
+
status: "AUTORIZADO"
|
|
109
|
+
pagamento: "pag_1"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
caso "pagamento recusado por autorizacao" {
|
|
113
|
+
given {
|
|
114
|
+
pagamento_id: "pag_erro"
|
|
115
|
+
valor: 10
|
|
116
|
+
token: "tok_recusado"
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
expect {
|
|
120
|
+
sucesso: falso
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
error {
|
|
124
|
+
tipo: "autorizacao_negada"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
caso "pagamento falha por timeout" {
|
|
128
|
+
given {
|
|
129
|
+
pagamento_id: "pag_timeout"
|
|
130
|
+
valor: 10
|
|
131
|
+
token: "tok_timeout"
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
expect {
|
|
135
|
+
sucesso: falso
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
error {
|
|
139
|
+
tipo: "timeout_gateway"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
task confirmar_pagamento {
|
|
146
|
+
input {
|
|
147
|
+
pagamento_id: Id required
|
|
148
|
+
}
|
|
149
|
+
output {
|
|
150
|
+
status: StatusPagamento
|
|
151
|
+
}
|
|
152
|
+
authz {
|
|
153
|
+
escopo: pagamentos.confirmar
|
|
154
|
+
tenant: obrigatorio
|
|
155
|
+
}
|
|
156
|
+
dados {
|
|
157
|
+
classificacao_padrao: financeiro
|
|
158
|
+
redacao_log: obrigatoria
|
|
159
|
+
input {
|
|
160
|
+
pagamento_id: interno
|
|
161
|
+
}
|
|
162
|
+
output {
|
|
163
|
+
status: interno
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
audit {
|
|
167
|
+
evento: pagamento.confirmado
|
|
168
|
+
ator: sistema.pagamentos
|
|
169
|
+
correlacao: request_id
|
|
170
|
+
retencao: "180d"
|
|
171
|
+
motivo: obrigatorio
|
|
172
|
+
}
|
|
173
|
+
forbidden {
|
|
174
|
+
shell.exec
|
|
175
|
+
log.segredo
|
|
176
|
+
}
|
|
177
|
+
rules {
|
|
178
|
+
pagamento_id existe
|
|
179
|
+
}
|
|
180
|
+
effects {
|
|
181
|
+
consulta gateway_pagamento criticidade = alta
|
|
182
|
+
persistencia Pagamento criticidade = alta
|
|
183
|
+
evento pagamento_confirmado criticidade = media
|
|
184
|
+
auditoria conciliacao_pagamento criticidade = alta
|
|
185
|
+
}
|
|
186
|
+
vinculos {
|
|
187
|
+
recurso: gateway_pagamento
|
|
188
|
+
tabela: pagamentos
|
|
189
|
+
evento: pagamento_confirmado
|
|
190
|
+
}
|
|
191
|
+
execucao {
|
|
192
|
+
idempotencia: verdadeiro
|
|
193
|
+
timeout: "15s"
|
|
194
|
+
retry: "2x exponencial"
|
|
195
|
+
compensacao: "registrar_timeout_pagamento"
|
|
196
|
+
criticidade_operacional: alta
|
|
197
|
+
}
|
|
198
|
+
state ciclo_pagamento {
|
|
199
|
+
transitions {
|
|
200
|
+
AUTORIZADO -> PROCESSADO
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
guarantees {
|
|
204
|
+
status == PROCESSADO
|
|
205
|
+
}
|
|
206
|
+
tests {
|
|
207
|
+
caso "confirma pagamento autorizado" {
|
|
208
|
+
given {
|
|
209
|
+
pagamento_id: "pag_1"
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
expect {
|
|
213
|
+
sucesso: verdadeiro
|
|
214
|
+
status: "PROCESSADO"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
task notificar_falha_pagamento {
|
|
221
|
+
input {
|
|
222
|
+
pagamento_id: Id required
|
|
223
|
+
motivo: Texto required
|
|
224
|
+
}
|
|
225
|
+
output {
|
|
226
|
+
protocolo_notificacao: Id
|
|
227
|
+
}
|
|
228
|
+
authz {
|
|
229
|
+
escopo: pagamentos.notificar_falha
|
|
230
|
+
tenant: obrigatorio
|
|
231
|
+
}
|
|
232
|
+
dados {
|
|
233
|
+
classificacao_padrao: interno
|
|
234
|
+
redacao_log: obrigatoria
|
|
235
|
+
input {
|
|
236
|
+
pagamento_id: interno
|
|
237
|
+
motivo: interno
|
|
238
|
+
}
|
|
239
|
+
output {
|
|
240
|
+
protocolo_notificacao: interno
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
audit {
|
|
244
|
+
evento: pagamento.falha_notificada
|
|
245
|
+
ator: sistema.pagamentos
|
|
246
|
+
correlacao: request_id
|
|
247
|
+
retencao: "180d"
|
|
248
|
+
motivo: obrigatorio
|
|
249
|
+
}
|
|
250
|
+
forbidden {
|
|
251
|
+
shell.exec
|
|
252
|
+
log.segredo
|
|
253
|
+
}
|
|
254
|
+
effects {
|
|
255
|
+
notificacao cliente falha_pagamento criticidade = alta
|
|
256
|
+
auditoria falha_pagamento criticidade = media
|
|
257
|
+
}
|
|
258
|
+
vinculos {
|
|
259
|
+
evento: falha_pagamento
|
|
260
|
+
recurso: canal_notificacao
|
|
261
|
+
}
|
|
262
|
+
execucao {
|
|
263
|
+
idempotencia: verdadeiro
|
|
264
|
+
timeout: "10s"
|
|
265
|
+
retry: "3x exponencial"
|
|
266
|
+
compensacao: "registrar_auditoria_falha"
|
|
267
|
+
criticidade_operacional: alta
|
|
268
|
+
}
|
|
269
|
+
guarantees {
|
|
270
|
+
protocolo_notificacao existe
|
|
271
|
+
}
|
|
272
|
+
tests {
|
|
273
|
+
caso "notifica falha por recusa" {
|
|
274
|
+
given {
|
|
275
|
+
pagamento_id: "pag_erro"
|
|
276
|
+
motivo: "autorizacao_negada"
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
expect {
|
|
280
|
+
sucesso: verdadeiro
|
|
281
|
+
protocolo_notificacao: "notif_1"
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
task registrar_timeout_pagamento {
|
|
288
|
+
input {
|
|
289
|
+
pagamento_id: Id required
|
|
290
|
+
}
|
|
291
|
+
output {
|
|
292
|
+
auditoria_id: Id
|
|
293
|
+
}
|
|
294
|
+
authz {
|
|
295
|
+
escopo: pagamentos.registrar_timeout
|
|
296
|
+
tenant: obrigatorio
|
|
297
|
+
}
|
|
298
|
+
dados {
|
|
299
|
+
classificacao_padrao: interno
|
|
300
|
+
redacao_log: obrigatoria
|
|
301
|
+
input {
|
|
302
|
+
pagamento_id: interno
|
|
303
|
+
}
|
|
304
|
+
output {
|
|
305
|
+
auditoria_id: interno
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
audit {
|
|
309
|
+
evento: pagamento.timeout_registrado
|
|
310
|
+
ator: sistema.pagamentos
|
|
311
|
+
correlacao: request_id
|
|
312
|
+
retencao: "180d"
|
|
313
|
+
motivo: obrigatorio
|
|
314
|
+
}
|
|
315
|
+
forbidden {
|
|
316
|
+
shell.exec
|
|
317
|
+
log.segredo
|
|
318
|
+
}
|
|
319
|
+
effects {
|
|
320
|
+
auditoria timeout_gateway criticidade = alta
|
|
321
|
+
persistencia incidente_pagamento criticidade = media
|
|
322
|
+
}
|
|
323
|
+
vinculos {
|
|
324
|
+
tabela: incidentes_pagamento
|
|
325
|
+
evento: timeout_gateway
|
|
326
|
+
}
|
|
327
|
+
execucao {
|
|
328
|
+
idempotencia: verdadeiro
|
|
329
|
+
timeout: "10s"
|
|
330
|
+
retry: "nenhum"
|
|
331
|
+
compensacao: "notificar_operacao"
|
|
332
|
+
criticidade_operacional: alta
|
|
333
|
+
}
|
|
334
|
+
guarantees {
|
|
335
|
+
auditoria_id existe
|
|
336
|
+
}
|
|
337
|
+
tests {
|
|
338
|
+
caso "registra timeout" {
|
|
339
|
+
given {
|
|
340
|
+
pagamento_id: "pag_timeout"
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
expect {
|
|
344
|
+
sucesso: verdadeiro
|
|
345
|
+
auditoria_id: "aud_1"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
flow orquestracao_pagamento {
|
|
352
|
+
pagamento_id: Id
|
|
353
|
+
valor: Decimal
|
|
354
|
+
token: Texto
|
|
355
|
+
etapa autorizar usa processar_pagamento com pagamento_id = pagamento_id, valor = valor, token = token em_sucesso confirmar em_erro registrar_falha por_erro autorizacao_negada = notificar_falha, timeout_gateway = registrar_timeout
|
|
356
|
+
etapa confirmar usa confirmar_pagamento com pagamento_id = pagamento_id depende_de autorizar
|
|
357
|
+
etapa notificar_falha usa notificar_falha_pagamento com pagamento_id = pagamento_id, motivo = "autorizacao_negada" depende_de autorizar
|
|
358
|
+
etapa registrar_timeout usa registrar_timeout_pagamento com pagamento_id = pagamento_id depende_de autorizar
|
|
359
|
+
etapa registrar_falha usa registrar_timeout_pagamento com pagamento_id = pagamento_id depende_de autorizar
|
|
360
|
+
effects {
|
|
361
|
+
auditoria fluxo_pagamento criticidade = alta
|
|
362
|
+
evento pagamento_em_processamento criticidade = media
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
route processar_pagamento_publico {
|
|
367
|
+
metodo: POST
|
|
368
|
+
caminho: /pagamentos/processar
|
|
369
|
+
task: processar_pagamento
|
|
370
|
+
auth {
|
|
371
|
+
modo: obrigatorio
|
|
372
|
+
principal: usuario
|
|
373
|
+
origem: publica
|
|
374
|
+
}
|
|
375
|
+
authz {
|
|
376
|
+
escopo: pagamentos.processar
|
|
377
|
+
tenant: obrigatorio
|
|
378
|
+
}
|
|
379
|
+
dados {
|
|
380
|
+
classificacao_padrao: financeiro
|
|
381
|
+
redacao_log: obrigatoria
|
|
382
|
+
input {
|
|
383
|
+
pagamento_id: interno
|
|
384
|
+
valor: financeiro
|
|
385
|
+
token: segredo
|
|
386
|
+
}
|
|
387
|
+
output {
|
|
388
|
+
pagamento: financeiro
|
|
389
|
+
status: interno
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
audit {
|
|
393
|
+
evento: pagamento.processado.publico
|
|
394
|
+
ator: auth.usuario
|
|
395
|
+
correlacao: request_id
|
|
396
|
+
retencao: "180d"
|
|
397
|
+
motivo: obrigatorio
|
|
398
|
+
}
|
|
399
|
+
segredos {
|
|
400
|
+
gateway_pagamento_token {
|
|
401
|
+
origem: vault
|
|
402
|
+
escopo: runtime
|
|
403
|
+
acesso: gateway_pagamento
|
|
404
|
+
rotacao: "30d"
|
|
405
|
+
nao_logar: verdadeiro
|
|
406
|
+
nao_retornar: verdadeiro
|
|
407
|
+
mascarar: verdadeiro
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
forbidden {
|
|
411
|
+
shell.exec
|
|
412
|
+
log.segredo
|
|
413
|
+
retorno.credencial
|
|
414
|
+
}
|
|
415
|
+
input {
|
|
416
|
+
pagamento_id: Id required
|
|
417
|
+
valor: Decimal required
|
|
418
|
+
token: Texto required
|
|
419
|
+
}
|
|
420
|
+
output {
|
|
421
|
+
pagamento: Pagamento required
|
|
422
|
+
status: StatusPagamento required
|
|
423
|
+
}
|
|
424
|
+
effects {
|
|
425
|
+
auditoria pagamento_publico criticidade = alta
|
|
426
|
+
evento pagamento_requisitado criticidade = media
|
|
427
|
+
}
|
|
428
|
+
error {
|
|
429
|
+
autorizacao_negada: "Erro publico quando o gateway recusa a operacao."
|
|
430
|
+
saldo_insuficiente: "Erro publico quando nao ha saldo suficiente."
|
|
431
|
+
timeout_gateway: "Erro publico quando o gateway nao responde."
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|