Este documento descreve as condições necessárias e o fluxo de status para reproduzir o cenário de erro após cancelamento de enrollment no teste [JSR-CONS-008].
Etapa Ação Status Resultante 9 Cancelar Enrollment (PATCH) REVOKED
Etapa Requisição Status Esperado Observação 1 Get Application Token - Autenticação bem-sucedida 2 Enrollment Payment initiation AWAITING_ACCOUNT_HOLDER_VALIDATIONEnrollment criado 3 URL Autorização - URL gerada 4 Login AWAITING_ACCOUNT_HOLDER_VALIDATIONLogin bem-sucedido 5 Approve AWAITING_ENROLLMENTConsentimento aprovado 6 Callback Payment Initiation AWAITING_ENROLLMENTCallback processado 7 fido-registration-options - Opções geradas 8 fido-registration AUTHORISEDEnrollment autorizado 9 Enrollment (PATCH) REVOKED⚠️ CANCELAMENTO 10 payment-initiation AWAITING_AUTHORISATIONPayment criado (ainda funciona) 11 fido-sign-options 422 ERROR Erro: Enrollment REVOKED
┌─────────────────────────────────────────────────────────────┐
│ 1-5. Fluxo Inicial de Enrollment │
│ Status: AWAITING_ENROLLMENT │
└────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 6-7. FIDO Registration │
│ Status: AUTHORISED │
│ ✅ Enrollment completo e autorizado │
└────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 8. Enrollment (PATCH) - CANCELAMENTO │
│ Status: REVOKED │
│ ⚠️ Enrollment cancelado pelo usuário │
└────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 9. Payment Initiation │
│ Status: AWAITING_AUTHORISATION │
│ ⚠️ Ainda é possível criar payment │
└────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 10. fido-sign-options │
│ ❌ ERRO 422: Enrollment REVOKED │
│ "cannot generate fido sign options to enrollment. │
│ current status: REVOKED" │
└─────────────────────────────────────────────────────────────┘
PATCH {{BASE_URL}}/open-keys/itp/api/v2/enrollments/v2/payment-initiation/{{itp_enrollment_id}}
Content-Type: application/json
Authorization: Bearer {{application_token}}
{
"data": {
"cancellation": {
"cancelledBy": {
"document": {
"identification": "98765432100",
"rel": "CPF"
}
},
"reason": {
"revocationReason": "REJEITADO_MANUALMENTE"
}
},
"cancelledFrom": "INICIADORA"
}
}
Momento Status do Enrollment Observação Antes do PATCH AUTHORISEDEnrollment válido e autorizado Após o PATCH REVOKEDEnrollment cancelado
O cancelamento deve ocorrer após :
✅ Enrollment estar autorizado (AUTHORISED)
✅ FIDO registration completo
✅ Antes de tentar gerar fido-sign-options
Ação Status Resultado Criar payment-initiation AWAITING_AUTHORISATION✅ Ainda funciona Gerar fido-sign-options - ❌ ERRO 422
O sistema valida o status do enrollment ao tentar gerar fido-sign-options:
if (enrollment.status === 'REVOKED') {
throw Error('cannot generate fido sign options to enrollment. current status: REVOKED')
}
JSON
{
"name": "UnprocessableEntityError",
"message": "Unprocessable Entity",
"code": 422,
"type": {
"data": {
"description": "cannot generate fido sign options to enrollment. current status: REVOKED"
}
}
}
✅ Enrollment deve estar no status AUTHORISED antes do cancelamento
✅ Cancelamento deve ser executado via PATCH com revocationReason: "REJEITADO_MANUALMENTE"
✅ Enrollment deve estar no status REVOKED após o cancelamento
✅ Tentativa de gerar fido-sign-options deve ocorrer após o cancelamento
✅ Payment-initiation pode ser criado mesmo com enrollment REVOKED
PENDING
↓
AWAITING_ACCOUNT_HOLDER_VALIDATION
↓
AWAITING_ENROLLMENT
↓
AUTHORISED ← Enrollment completo
↓
REVOKED ← Cancelamento (Etapa 9)
↓
❌ ERRO ao tentar fido-sign-options (Etapa 11)
O cancelamento pode ser feito a qualquer momento após a autorização
A criação de payment-initiation ainda funciona após o cancelamento
O erro ocorre apenas ao tentar gerar fido-sign-options
O sistema valida o status do enrollment antes de gerar opções de assinatura
O erro retorna código HTTP 422 (Unprocessable Entity)
A mensagem de erro indica claramente o status atual: REVOKED
Aspecto Fluxo Normal Fluxo com Cancelamento Status final do Enrollment AUTHORISEDREVOKEDCriação de Payment ✅ Permitida ✅ Permitida Geração de fido-sign-options ✅ Permitida ❌ Bloqueada Processamento de PIX ✅ Permitido ❌ Não alcançado