quantix-mcp 0.4.9 → 0.5.3
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/README.md +12 -1
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/dist/tools/subscriptions.d.ts.map +1 -1
- package/dist/tools/subscriptions.js +46 -1
- package/dist/tools/subscriptions.js.map +1 -1
- package/dist/tools/transactions.d.ts.map +1 -1
- package/dist/tools/transactions.js +5 -5
- package/dist/tools/transactions.js.map +1 -1
- package/dist/types/schemas.d.ts +17 -0
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +21 -4
- package/dist/types/schemas.js.map +1 -1
- package/package.json +9 -4
- package/.claude/commands/opsx/apply.md +0 -152
- package/.claude/commands/opsx/archive.md +0 -157
- package/.claude/commands/opsx/bulk-archive.md +0 -242
- package/.claude/commands/opsx/continue.md +0 -114
- package/.claude/commands/opsx/explore.md +0 -174
- package/.claude/commands/opsx/ff.md +0 -94
- package/.claude/commands/opsx/new.md +0 -69
- package/.claude/commands/opsx/onboard.md +0 -525
- package/.claude/commands/opsx/sync.md +0 -134
- package/.claude/commands/opsx/verify.md +0 -164
- package/.claude/settings.local.json +0 -9
- package/.claude/skills/openspec-apply-change/SKILL.md +0 -156
- package/.claude/skills/openspec-archive-change/SKILL.md +0 -114
- package/.claude/skills/openspec-bulk-archive-change/SKILL.md +0 -246
- package/.claude/skills/openspec-continue-change/SKILL.md +0 -118
- package/.claude/skills/openspec-explore/SKILL.md +0 -290
- package/.claude/skills/openspec-ff-change/SKILL.md +0 -101
- package/.claude/skills/openspec-new-change/SKILL.md +0 -74
- package/.claude/skills/openspec-onboard/SKILL.md +0 -529
- package/.claude/skills/openspec-sync-specs/SKILL.md +0 -138
- package/.claude/skills/openspec-verify-change/SKILL.md +0 -168
- package/.dockerignore +0 -8
- package/.gemini/commands/opsx/apply.toml +0 -149
- package/.gemini/commands/opsx/archive.toml +0 -154
- package/.gemini/commands/opsx/bulk-archive.toml +0 -239
- package/.gemini/commands/opsx/continue.toml +0 -111
- package/.gemini/commands/opsx/explore.toml +0 -171
- package/.gemini/commands/opsx/ff.toml +0 -91
- package/.gemini/commands/opsx/new.toml +0 -66
- package/.gemini/commands/opsx/onboard.toml +0 -522
- package/.gemini/commands/opsx/sync.toml +0 -131
- package/.gemini/commands/opsx/verify.toml +0 -161
- package/.gemini/skills/openspec-apply-change/SKILL.md +0 -156
- package/.gemini/skills/openspec-archive-change/SKILL.md +0 -114
- package/.gemini/skills/openspec-bulk-archive-change/SKILL.md +0 -246
- package/.gemini/skills/openspec-continue-change/SKILL.md +0 -118
- package/.gemini/skills/openspec-explore/SKILL.md +0 -290
- package/.gemini/skills/openspec-ff-change/SKILL.md +0 -101
- package/.gemini/skills/openspec-new-change/SKILL.md +0 -74
- package/.gemini/skills/openspec-onboard/SKILL.md +0 -529
- package/.gemini/skills/openspec-sync-specs/SKILL.md +0 -138
- package/.gemini/skills/openspec-verify-change/SKILL.md +0 -168
- package/.github/agents/copilot-instructions.md +0 -32
- package/.github/agents/speckit.analyze.agent.md +0 -184
- package/.github/agents/speckit.checklist.agent.md +0 -294
- package/.github/agents/speckit.clarify.agent.md +0 -181
- package/.github/agents/speckit.constitution.agent.md +0 -82
- package/.github/agents/speckit.implement.agent.md +0 -135
- package/.github/agents/speckit.plan.agent.md +0 -89
- package/.github/agents/speckit.specify.agent.md +0 -258
- package/.github/agents/speckit.tasks.agent.md +0 -137
- package/.github/agents/speckit.taskstoissues.agent.md +0 -30
- package/.github/copilot-instructions.md +0 -17
- package/.github/prompts/speckit.analyze.prompt.md +0 -3
- package/.github/prompts/speckit.checklist.prompt.md +0 -3
- package/.github/prompts/speckit.clarify.prompt.md +0 -3
- package/.github/prompts/speckit.constitution.prompt.md +0 -3
- package/.github/prompts/speckit.implement.prompt.md +0 -3
- package/.github/prompts/speckit.plan.prompt.md +0 -3
- package/.github/prompts/speckit.specify.prompt.md +0 -3
- package/.github/prompts/speckit.tasks.prompt.md +0 -3
- package/.github/prompts/speckit.taskstoissues.prompt.md +0 -3
- package/.github/workflows/publish.yaml +0 -29
- package/.opencode/command/speckit.analyze.md +0 -184
- package/.opencode/command/speckit.checklist.md +0 -294
- package/.opencode/command/speckit.clarify.md +0 -181
- package/.opencode/command/speckit.constitution.md +0 -84
- package/.opencode/command/speckit.implement.md +0 -135
- package/.opencode/command/speckit.plan.md +0 -89
- package/.opencode/command/speckit.specify.md +0 -258
- package/.opencode/command/speckit.tasks.md +0 -137
- package/.opencode/command/speckit.taskstoissues.md +0 -30
- package/.qwen/commands/opsx-apply.toml +0 -149
- package/.qwen/commands/opsx-archive.toml +0 -154
- package/.qwen/commands/opsx-bulk-archive.toml +0 -239
- package/.qwen/commands/opsx-continue.toml +0 -111
- package/.qwen/commands/opsx-explore.toml +0 -171
- package/.qwen/commands/opsx-ff.toml +0 -91
- package/.qwen/commands/opsx-new.toml +0 -66
- package/.qwen/commands/opsx-onboard.toml +0 -522
- package/.qwen/commands/opsx-sync.toml +0 -131
- package/.qwen/commands/opsx-verify.toml +0 -161
- package/.qwen/skills/openspec-apply-change/SKILL.md +0 -156
- package/.qwen/skills/openspec-archive-change/SKILL.md +0 -114
- package/.qwen/skills/openspec-bulk-archive-change/SKILL.md +0 -246
- package/.qwen/skills/openspec-continue-change/SKILL.md +0 -118
- package/.qwen/skills/openspec-explore/SKILL.md +0 -290
- package/.qwen/skills/openspec-ff-change/SKILL.md +0 -101
- package/.qwen/skills/openspec-new-change/SKILL.md +0 -74
- package/.qwen/skills/openspec-onboard/SKILL.md +0 -529
- package/.qwen/skills/openspec-sync-specs/SKILL.md +0 -138
- package/.qwen/skills/openspec-verify-change/SKILL.md +0 -168
- package/.specify/memory/constitution.md +0 -58
- package/.specify/scripts/powershell/check-prerequisites.ps1 +0 -148
- package/.specify/scripts/powershell/common.ps1 +0 -137
- package/.specify/scripts/powershell/create-new-feature.ps1 +0 -283
- package/.specify/scripts/powershell/setup-plan.ps1 +0 -61
- package/.specify/scripts/powershell/update-agent-context.ps1 +0 -448
- package/.specify/templates/agent-file-template.md +0 -28
- package/.specify/templates/checklist-template.md +0 -40
- package/.specify/templates/constitution-template.md +0 -50
- package/.specify/templates/plan-template.md +0 -104
- package/.specify/templates/spec-template.md +0 -115
- package/.specify/templates/tasks-template.md +0 -251
- package/.vscode/launch.json +0 -14
- package/.vscode/settings.json +0 -14
- package/.vscode/tasks.json +0 -15
- package/AGENTS.md +0 -117
- package/CLAUDE.md +0 -70
- package/Dockerfile +0 -30
- package/GEMINI.md +0 -117
- package/QWEN.md +0 -117
- package/docker-compose.yml +0 -15
- package/openapi.yaml +0 -3127
- package/openspec/README.md +0 -33
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/.openspec.yaml +0 -2
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/design.md +0 -60
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/proposal.md +0 -25
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/specs/credit-card-transactions/spec.md +0 -46
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/specs/transactions/spec.md +0 -42
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/tasks.md +0 -22
- package/openspec/config.yaml +0 -20
- package/openspec/specs/accounts/spec.md +0 -86
- package/openspec/specs/categories/spec.md +0 -78
- package/openspec/specs/credit-card-transactions/spec.md +0 -64
- package/openspec/specs/credit-cards/spec.md +0 -109
- package/openspec/specs/data/spec.md +0 -49
- package/openspec/specs/settings/spec.md +0 -48
- package/openspec/specs/subscriptions/spec.md +0 -85
- package/openspec/specs/summary/spec.md +0 -49
- package/openspec/specs/transactions/spec.md +0 -113
- package/openspec/specs/transfers/spec.md +0 -74
- package/specs/001-mcp-api-integration/checklists/requirements.md +0 -34
- package/specs/001-mcp-api-integration/contracts/openapi.yaml +0 -636
- package/specs/001-mcp-api-integration/data-model.md +0 -106
- package/specs/001-mcp-api-integration/plan.md +0 -73
- package/specs/001-mcp-api-integration/quickstart.md +0 -74
- package/specs/001-mcp-api-integration/research.md +0 -58
- package/specs/001-mcp-api-integration/spec.md +0 -119
- package/specs/001-mcp-api-integration/tasks.md +0 -64
- package/src/config.ts +0 -39
- package/src/index.ts +0 -99
- package/src/services/apiClient.ts +0 -55
- package/src/services/requestContext.ts +0 -11
- package/src/tools/accounts.ts +0 -122
- package/src/tools/categories.ts +0 -102
- package/src/tools/credit-cards.ts +0 -203
- package/src/tools/data.ts +0 -45
- package/src/tools/settings.ts +0 -64
- package/src/tools/subscriptions.ts +0 -159
- package/src/tools/summary.ts +0 -29
- package/src/tools/transactions.ts +0 -200
- package/src/tools/transfers.ts +0 -122
- package/src/types/schemas.ts +0 -333
- package/src/utils/toolHelpers.ts +0 -11
- package/tests/benchmark.test.d.ts +0 -2
- package/tests/benchmark.test.d.ts.map +0 -1
- package/tests/benchmark.test.js +0 -33
- package/tests/benchmark.test.js.map +0 -1
- package/tests/benchmark.test.ts +0 -38
- package/tests/server.test.d.ts +0 -2
- package/tests/server.test.d.ts.map +0 -1
- package/tests/server.test.js +0 -13
- package/tests/server.test.js.map +0 -1
- package/tests/server.test.ts +0 -14
- package/tests/setup.d.ts +0 -4
- package/tests/setup.d.ts.map +0 -1
- package/tests/setup.js +0 -17
- package/tests/setup.js.map +0 -1
- package/tests/setup.ts +0 -20
- package/tests/tools/accounts.test.ts +0 -159
- package/tests/tools/categories.test.d.ts +0 -2
- package/tests/tools/categories.test.d.ts.map +0 -1
- package/tests/tools/categories.test.js +0 -63
- package/tests/tools/categories.test.js.map +0 -1
- package/tests/tools/categories.test.ts +0 -120
- package/tests/tools/credit-cards.test.d.ts +0 -2
- package/tests/tools/credit-cards.test.d.ts.map +0 -1
- package/tests/tools/credit-cards.test.js +0 -71
- package/tests/tools/credit-cards.test.js.map +0 -1
- package/tests/tools/credit-cards.test.ts +0 -131
- package/tests/tools/data.test.ts +0 -100
- package/tests/tools/settings.test.ts +0 -116
- package/tests/tools/subscriptions.test.ts +0 -173
- package/tests/tools/summary.test.d.ts +0 -2
- package/tests/tools/summary.test.d.ts.map +0 -1
- package/tests/tools/summary.test.js +0 -36
- package/tests/tools/summary.test.js.map +0 -1
- package/tests/tools/summary.test.ts +0 -63
- package/tests/tools/transactions.test.d.ts +0 -2
- package/tests/tools/transactions.test.d.ts.map +0 -1
- package/tests/tools/transactions.test.js +0 -67
- package/tests/tools/transactions.test.js.map +0 -1
- package/tests/tools/transactions.test.ts +0 -133
- package/tests/tools/transfers.test.ts +0 -141
- package/tsconfig.json +0 -52
- package/vitest.config.d.ts +0 -3
- package/vitest.config.d.ts.map +0 -1
- package/vitest.config.js +0 -14
- package/vitest.config.js.map +0 -1
- package/vitest.config.ts +0 -14
package/openspec/README.md
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# OpenSpec — Quantix MCP Server
|
|
2
|
-
|
|
3
|
-
Especificações comportamentais do sistema, organizadas por domínio.
|
|
4
|
-
|
|
5
|
-
## Estrutura
|
|
6
|
-
|
|
7
|
-
### specs/
|
|
8
|
-
Source of truth — como o sistema atualmente se comporta.
|
|
9
|
-
|
|
10
|
-
| Domínio | Descrição | # Requirements |
|
|
11
|
-
|---------|-----------|:-:|
|
|
12
|
-
| [accounts](specs/accounts/spec.md) | Contas financeiras (CRUD + saldo) | 6 |
|
|
13
|
-
| [categories](specs/categories/spec.md) | Categorias de classificação (CRUD) | 5 |
|
|
14
|
-
| [credit-cards](specs/credit-cards/spec.md) | Cartões de crédito (CRUD + extratos + antecipação) | 10 |
|
|
15
|
-
| [credit-card-transactions](specs/credit-card-transactions/spec.md) | Transações de cartão de crédito (criar/atualizar) | 3 |
|
|
16
|
-
| [data](specs/data/spec.md) | Exportação e importação de backup | 3 |
|
|
17
|
-
| [settings](specs/settings/spec.md) | Configurações globais (usuário, idioma, moeda) | 3 |
|
|
18
|
-
| [subscriptions](specs/subscriptions/spec.md) | Assinaturas e pagamentos recorrentes | 8 |
|
|
19
|
-
| [summary](specs/summary/spec.md) | Resumo financeiro consolidado | 4 |
|
|
20
|
-
| [transactions](specs/transactions/spec.md) | Transações diretas (CASH, PIX, DEBIT) | 8 |
|
|
21
|
-
| [transfers](specs/transfers/spec.md) | Transferências entre contas | 5 |
|
|
22
|
-
|
|
23
|
-
**Total: 10 domínios, ~55 requirements**
|
|
24
|
-
|
|
25
|
-
### changes/
|
|
26
|
-
Modificações propostas. Cada change vive em sua própria pasta até ser mergeada.
|
|
27
|
-
|
|
28
|
-
## Convenções
|
|
29
|
-
|
|
30
|
-
- Requisitos usam keywords RFC 2119 (SHALL, MUST, SHOULD, MAY)
|
|
31
|
-
- Cenários seguem formato **WHEN**/**THEN**
|
|
32
|
-
- Specs descrevem **comportamento**, não implementação
|
|
33
|
-
- Delta specs vivem em `changes/<name>/specs/` e são syncadas para `specs/` ao arquivar
|
package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/design.md
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
## Context
|
|
2
|
-
|
|
3
|
-
O MCP server `quantix-mcp` expõe ferramentas de transação para um LLM via Model Context Protocol. Atualmente existem duas tools genéricas:
|
|
4
|
-
- `create_transaction`: envia tudo para `POST /transactions`
|
|
5
|
-
- `update_transaction`: envia tudo para `PATCH /transactions/:id`
|
|
6
|
-
|
|
7
|
-
A API Quantix evoluiu e agora rejeita transações de cartão na rota genérica (HTTP 400 com mensagem "Use POST /transactions/credit for credit card transactions"). As rotas dedicadas são:
|
|
8
|
-
- `POST /transactions/credit` → cria transações de cartão
|
|
9
|
-
- `PATCH /transactions/credit/:id` → atualiza transações de cartão
|
|
10
|
-
|
|
11
|
-
Os schemas de input também divergem: o recurrence de cartão suporta 7 frequências (BIWEEKLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, ANNUALLY além de WEEKLY/MONTHLY/YEARLY), enquanto o genérico suporta apenas 3.
|
|
12
|
-
|
|
13
|
-
## Goals / Non-Goals
|
|
14
|
-
|
|
15
|
-
**Goals:**
|
|
16
|
-
- Separar tools de cartão em `create_credit_transaction` e `update_credit_transaction` com schemas próprios
|
|
17
|
-
- Restringir `create_transaction` e `update_transaction` a métodos diretos (CASH, PIX, DEBIT)
|
|
18
|
-
- Alinhar schemas do MCP aos DTOs da API (RecurrenceDto vs CreditCardRecurrenceDto)
|
|
19
|
-
- Manter `delete_transaction`, `get_transactions`, `get_transaction`, `pay_transaction`, `unpay_transaction` inalteradas
|
|
20
|
-
|
|
21
|
-
**Non-Goals:**
|
|
22
|
-
- Não alterar a lógica de outras domains (accounts, categories, credit-cards, subscriptions)
|
|
23
|
-
- Não modificar o schema de entidade `TransactionSchema` (representa a resposta da API, que é unificada via `TransactionWithRelationsDto`)
|
|
24
|
-
- Não adicionar novas funcionalidades além da separação de rotas
|
|
25
|
-
|
|
26
|
-
## Decisions
|
|
27
|
-
|
|
28
|
-
### 1. Tools separadas vs roteamento interno
|
|
29
|
-
|
|
30
|
-
**Decisão:** Tools separadas (`create_credit_transaction`, `update_credit_transaction`).
|
|
31
|
-
|
|
32
|
-
**Razão:** Os schemas de input são diferentes (campos obrigatórios diferentes, recurrence com enums diferentes). Tools separadas dão descrições mais precisas ao LLM, melhorando a qualidade das escolhas de tool. A API já trata como domínios distintos.
|
|
33
|
-
|
|
34
|
-
**Alternativa considerada:** Roteamento interno baseado em `paymentMethod`. Rejeitada porque esconde complexidade, torna descrições ambíguas, e o `UpdateTransactionDto` não tem `paymentMethod` como campo obrigatório — não haveria como detectar reliably.
|
|
35
|
-
|
|
36
|
-
### 2. Schema de recurrence
|
|
37
|
-
|
|
38
|
-
**Decisão:** Manter dois schemas de recurrence distintos no MCP:
|
|
39
|
-
- `TransactionRecurrenceSchema`: 3 frequências (WEEKLY, MONTHLY, YEARLY) — para transações diretas
|
|
40
|
-
- `CreditCardRecurrenceSchema`: 7 frequências — para transações de cartão
|
|
41
|
-
|
|
42
|
-
**Razão:** Espelha exatamente os DTOs da API (`RecurrenceDto` vs `CreditCardRecurrenceDto`). Evita que o LLM tente usar `BIWEEKLY` em transações diretas.
|
|
43
|
-
|
|
44
|
-
### 3. Tratamento de campos removidos
|
|
45
|
-
|
|
46
|
-
**Decisão:** Remover silenciosamente `paymentMethod: "CREDIT"`, `creditCardId`, `targetDueMonth`, `purchaseDate` dos schemas de transação direta. Se o LLM tentar usar, a validação Zod rejeitará o campo.
|
|
47
|
-
|
|
48
|
-
**Razão:** Zod valida estritamente — campos não declarados serão rejeitados pelo SDK do MCP antes mesmo de chegar na API. Não é necessário tratamento especial.
|
|
49
|
-
|
|
50
|
-
### 4. Estrutura de arquivos
|
|
51
|
-
|
|
52
|
-
**Decisão:** Manter tudo em `src/tools/transactions.ts`. São 4 tools no mesmo domínio, não justifica separação de arquivo.
|
|
53
|
-
|
|
54
|
-
## Risks / Trade-offs
|
|
55
|
-
|
|
56
|
-
| Risco | Mitigação |
|
|
57
|
-
|-------|-----------|
|
|
58
|
-
| LLM tenta usar `create_transaction` com cartão e recebe erro de validação | Descrições claras nas tools indicando "não use para cartão" |
|
|
59
|
-
| Quebra de compatibilidade para clientes existentes | É intencional — o comportamento antigo já retornava 400 da API |
|
|
60
|
-
| Dois schemas de recurrence aumentam complexidade | Nomes claros (`TransactionRecurrenceSchema` vs `CreditCardRecurrenceSchema`) + descrições |
|
package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/proposal.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
## Why
|
|
2
|
-
|
|
3
|
-
A API Quantix separou as rotas de transações: `POST /transactions` agora aceita apenas `CASH|PIX|DEBIT`, enquanto `POST /transactions/credit` é a rota dedicada para transações de cartão. O MCP server ainda possui uma única tool `create_transaction` genérica que envia tudo para `/transactions`, resultando em erro 400 quando `paymentMethod` é `CREDIT`. O mesmo problema ocorre no `update_transaction`.
|
|
4
|
-
|
|
5
|
-
## What Changes
|
|
6
|
-
|
|
7
|
-
- **`create_transaction`**: Removidos os campos exclusivos de cartão (`paymentMethod: "CREDIT"`, `creditCardId`, `targetDueMonth`). Agora envia apenas para `POST /transactions`.
|
|
8
|
-
- **`update_transaction`**: Removidos os campos exclusivos de cartão (`paymentMethod: "CREDIT"`, `creditCardId`, `targetDueMonth`, `purchaseDate`). Agora envia apenas para `PATCH /transactions/:id`.
|
|
9
|
-
- **Nova tool `create_credit_transaction`**: Tool dedicada para criar transações de cartão via `POST /transactions/credit`, com schema próprio (`purchaseDate`, `creditCardId`, `installments`, `targetDueMonth`, recurrence com 7 frequências).
|
|
10
|
-
- **Nova tool `update_credit_transaction`**: Tool dedicada para atualizar transações de cartão via `PATCH /transactions/credit/:id`, com schema próprio.
|
|
11
|
-
- **`delete_transaction`**: Permanece inalterada (a rota de delete é compartilhada).
|
|
12
|
-
|
|
13
|
-
## Capabilities
|
|
14
|
-
|
|
15
|
-
### New Capabilities
|
|
16
|
-
- `credit-card-transactions`: Criação e atualização de transações de cartão de crédito com schema próprio (purchaseDate, targetDueMonth, installments, recurrence estendida).
|
|
17
|
-
|
|
18
|
-
### Modified Capabilities
|
|
19
|
-
- `transactions`: Requisitos de criação e atualização agora restritos a métodos diretos (CASH, PIX, DEBIT). Campos de cartão removidos do schema de input.
|
|
20
|
-
|
|
21
|
-
## Impact
|
|
22
|
-
|
|
23
|
-
- `src/types/schemas.ts`: Reorganização dos schemas de input; adição de schemas específicos para cartão.
|
|
24
|
-
- `src/tools/transactions.ts`: Separação em 4 tools distintas; remoção de campos de cartão das tools genéricas.
|
|
25
|
-
- Clients MCP que usavam `create_transaction` com `paymentMethod: "CREDIT"` precisarão migrar para `create_credit_transaction`.
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
## ADDED Requirements
|
|
2
|
-
|
|
3
|
-
### Requirement: Create credit card transaction
|
|
4
|
-
The system SHALL provide a `create_credit_transaction` tool that sends a POST request to `/transactions/credit` with a schema specific to credit card transactions.
|
|
5
|
-
|
|
6
|
-
#### Scenario: Successful creation
|
|
7
|
-
- **WHEN** the user provides `name`, `amount`, `purchaseDate`, and `creditCardId`
|
|
8
|
-
- **THEN** the system calls `POST /transactions/credit` and returns the created transaction
|
|
9
|
-
|
|
10
|
-
#### Scenario: Creation with installments
|
|
11
|
-
- **WHEN** the user provides `installments` > 1
|
|
12
|
-
- **THEN** the transaction is split into installments with the due date calculated from the card closing day
|
|
13
|
-
|
|
14
|
-
#### Scenario: Creation with target due month
|
|
15
|
-
- **WHEN** the user provides `targetDueMonth` in YYYY-MM format
|
|
16
|
-
- **THEN** the first installment's due date is set to the target month
|
|
17
|
-
|
|
18
|
-
#### Scenario: Creation with recurrence
|
|
19
|
-
- **WHEN** the user provides `recurrence` with one of the 7 supported frequencies (WEEKLY, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, ANNUALLY)
|
|
20
|
-
- **THEN** the system includes the recurrence object in the request body
|
|
21
|
-
|
|
22
|
-
### Requirement: Update credit card transaction
|
|
23
|
-
The system SHALL provide an `update_credit_transaction` tool that sends a PATCH request to `/transactions/credit/:id` with a schema specific to credit card transactions.
|
|
24
|
-
|
|
25
|
-
#### Scenario: Successful update
|
|
26
|
-
- **WHEN** the user provides a valid transaction ID and one or more updateable fields
|
|
27
|
-
- **THEN** the system calls `PATCH /transactions/credit/:id` and returns the updated transaction
|
|
28
|
-
|
|
29
|
-
#### Scenario: Recalculation of due date
|
|
30
|
-
- **WHEN** the user changes `purchaseDate` or `targetDueMonth`
|
|
31
|
-
- **THEN** the due date is recalculated by the API
|
|
32
|
-
|
|
33
|
-
#### Scenario: Update with recurrence
|
|
34
|
-
- **WHEN** the user modifies the `recurrence` field
|
|
35
|
-
- **THEN** the recurrence object is updated with one of the 7 supported frequencies
|
|
36
|
-
|
|
37
|
-
### Requirement: Credit card transaction input schema
|
|
38
|
-
The input schema for credit card transaction tools SHALL include the following fields: `name` (required), `amount` (required, min 0), `purchaseDate` (required, YYYY-MM-DD), `creditCardId` (required), `categoryId` (optional), `installments` (optional, min 1), `targetDueMonth` (optional, YYYY-MM), `isPaid` (optional, default false), `recurrence` (optional, CreditCardRecurrenceDto with 7 frequencies).
|
|
39
|
-
|
|
40
|
-
#### Scenario: Validation rejects missing required fields
|
|
41
|
-
- **WHEN** any of `name`, `amount`, `purchaseDate`, or `creditCardId` is missing
|
|
42
|
-
- **THEN** the MCP SDK rejects the input with a validation error
|
|
43
|
-
|
|
44
|
-
#### Scenario: Validation rejects invalid frequency
|
|
45
|
-
- **WHEN** the user provides a recurrence frequency not in the 7 supported values
|
|
46
|
-
- **THEN** the input is rejected by the Zod schema
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
## ADDED Requirements
|
|
2
|
-
|
|
3
|
-
### Requirement: Create direct transaction only
|
|
4
|
-
The `create_transaction` tool SHALL only support direct payment methods: CASH, PIX, and DEBIT. It SHALL send a POST request to `/transactions` and SHALL NOT accept credit-card-specific fields.
|
|
5
|
-
|
|
6
|
-
#### Scenario: Successful direct transaction creation
|
|
7
|
-
- **WHEN** the user provides `type`, `name`, `amount`, `date`, `paymentMethod` (CASH, PIX, or DEBIT), and `accountId`
|
|
8
|
-
- **THEN** the system calls `POST /transactions` and returns the created transaction
|
|
9
|
-
|
|
10
|
-
#### Scenario: Validation rejects credit card fields
|
|
11
|
-
- **WHEN** the user attempts to provide `creditCardId`, `targetDueMonth`, or `purchaseDate`
|
|
12
|
-
- **THEN** the Zod schema rejects the input as those fields are not part of the direct transaction schema
|
|
13
|
-
|
|
14
|
-
#### Scenario: Validation rejects CREDIT payment method
|
|
15
|
-
- **WHEN** the user provides `paymentMethod` as "CREDIT"
|
|
16
|
-
- **THEN** the Zod schema rejects the input as the enum only allows CASH, PIX, DEBIT
|
|
17
|
-
|
|
18
|
-
### Requirement: Update direct transaction only
|
|
19
|
-
The `update_transaction` tool SHALL only support updating direct payment method transactions. It SHALL send a PATCH request to `/transactions/:id` and SHALL NOT accept credit-card-specific fields.
|
|
20
|
-
|
|
21
|
-
#### Scenario: Successful direct transaction update
|
|
22
|
-
- **WHEN** the user provides a valid transaction ID and one or more updateable fields (type, name, amount, date, categoryId, paymentMethod, accountId, isPaid)
|
|
23
|
-
- **THEN** the system calls `PATCH /transactions/:id` and returns the updated transaction
|
|
24
|
-
|
|
25
|
-
#### Scenario: Recurring transaction update mode
|
|
26
|
-
- **WHEN** the user provides `mode` as SINGLE, PENDING, or ALL
|
|
27
|
-
- **THEN** the update is applied according to the mode (only this transaction, this and future pending, or all in the series)
|
|
28
|
-
|
|
29
|
-
#### Scenario: Validation rejects credit card fields
|
|
30
|
-
- **WHEN** the user attempts to provide `creditCardId`, `targetDueMonth`, or `purchaseDate`
|
|
31
|
-
- **THEN** the Zod schema rejects the input as those fields are not part of the direct transaction schema
|
|
32
|
-
|
|
33
|
-
### Requirement: Direct transaction recurrence
|
|
34
|
-
The recurrence for direct transactions SHALL support only 3 frequencies: WEEKLY, MONTHLY, YEARLY.
|
|
35
|
-
|
|
36
|
-
#### Scenario: Valid recurrence frequencies
|
|
37
|
-
- **WHEN** the user provides a recurrence with WEEKLY, MONTHLY, or YEARLY
|
|
38
|
-
- **THEN** the request is accepted
|
|
39
|
-
|
|
40
|
-
#### Scenario: Invalid recurrence frequency
|
|
41
|
-
- **WHEN** the user provides BIWEEKLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, or ANNUALLY
|
|
42
|
-
- **THEN** the Zod schema rejects the input
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
## 1. Schema definitions
|
|
2
|
-
|
|
3
|
-
- [x] 1.1 Create `CreditCardRecurrenceSchema` in `src/types/schemas.ts` with 7 frequencies (WEEKLY, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, ANNUALLY)
|
|
4
|
-
- [x] 1.2 Create `CreateCreditCardTransactionInput` schema with required fields (name, amount, purchaseDate, creditCardId) and optional fields (categoryId, installments, targetDueMonth, isPaid, recurrence)
|
|
5
|
-
- [x] 1.3 Create `UpdateCreditCardTransactionInput` schema with all fields optional
|
|
6
|
-
- [x] 1.4 Remove `paymentMethod: "CREDIT"`, `creditCardId`, `targetDueMonth` from `CreateTransactionInput`; keep `installments`
|
|
7
|
-
- [x] 1.5 Remove `paymentMethod: "CREDIT"`, `creditCardId`, `targetDueMonth`, `purchaseDate` from `UpdateTransactionInput`; keep `installments`
|
|
8
|
-
|
|
9
|
-
## 2. Transaction tools (direct payments)
|
|
10
|
-
|
|
11
|
-
- [x] 2.1 Update `create_transaction` tool to POST to `/transactions` with cleaned schema; update description to clarify "CASH, PIX, or DEBIT only"
|
|
12
|
-
- [x] 2.2 Update `update_transaction` tool to PATCH `/transactions/:id` with cleaned schema; update description to clarify "CASH, PIX, or DEBIT only"
|
|
13
|
-
|
|
14
|
-
## 3. Credit card transaction tools (new)
|
|
15
|
-
|
|
16
|
-
- [x] 3.1 Register `create_credit_transaction` tool that POSTs to `/transactions/credit` with `CreateCreditCardTransactionInput` schema
|
|
17
|
-
- [x] 3.2 Register `update_credit_transaction` tool that PATCHes `/transactions/credit/:id` with `UpdateCreditCardTransactionInput` schema
|
|
18
|
-
|
|
19
|
-
## 4. Verification
|
|
20
|
-
|
|
21
|
-
- [x] 4.1 Run `npm run build` and confirm no TypeScript errors
|
|
22
|
-
- [x] 4.2 Run `npm test` and confirm all tests pass
|
package/openspec/config.yaml
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
schema: spec-driven
|
|
2
|
-
|
|
3
|
-
# Project context (optional)
|
|
4
|
-
# This is shown to AI when creating artifacts.
|
|
5
|
-
# Add your tech stack, conventions, style guides, domain knowledge, etc.
|
|
6
|
-
# Example:
|
|
7
|
-
# context: |
|
|
8
|
-
# Tech stack: TypeScript, React, Node.js
|
|
9
|
-
# We use conventional commits
|
|
10
|
-
# Domain: e-commerce platform
|
|
11
|
-
|
|
12
|
-
# Per-artifact rules (optional)
|
|
13
|
-
# Add custom rules for specific artifacts.
|
|
14
|
-
# Example:
|
|
15
|
-
# rules:
|
|
16
|
-
# proposal:
|
|
17
|
-
# - Keep proposals under 500 words
|
|
18
|
-
# - Always include a "Non-goals" section
|
|
19
|
-
# tasks:
|
|
20
|
-
# - Break tasks into chunks of max 2 hours
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# Accounts Specification
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Gerenciamento de contas financeiras (contas bancárias, carteiras, poupanças, investimentos). Cada conta possui um saldo inicial e um saldo calculado baseado nas transações.
|
|
5
|
-
|
|
6
|
-
## Scope
|
|
7
|
-
O que está **incluído** nesta spec:
|
|
8
|
-
- CRUD completo de contas financeiras
|
|
9
|
-
- Consulta de saldo individual por conta
|
|
10
|
-
- Tipos de conta: BANK_ACCOUNT, WALLET, SAVINGS_ACCOUNT, INVESTMENT_ACCOUNT, OTHER
|
|
11
|
-
|
|
12
|
-
O que está **fora do escopo**:
|
|
13
|
-
- Transferências entre contas (domínio: transfers)
|
|
14
|
-
- Cálculo de saldo agregado (domínio: summary)
|
|
15
|
-
|
|
16
|
-
## Requirements
|
|
17
|
-
|
|
18
|
-
### Requirement: Create account
|
|
19
|
-
The system SHALL allow creating a new financial account with a name, type, and optional initial balance. The system SHALL assign a unique ID and set `currentBalance` equal to `initialBalance` upon creation.
|
|
20
|
-
|
|
21
|
-
#### Scenario: Create account with initial balance
|
|
22
|
-
- **WHEN** the user provides `name`, `type`, and `initialBalance`
|
|
23
|
-
- **THEN** the system creates the account with `currentBalance` equal to `initialBalance` and returns the full account object
|
|
24
|
-
|
|
25
|
-
#### Scenario: Create account without initial balance
|
|
26
|
-
- **WHEN** the user provides `name` and `type` but no `initialBalance`
|
|
27
|
-
- **THEN** the system creates the account with `initialBalance` defaulting to 0
|
|
28
|
-
|
|
29
|
-
#### Scenario: Validation rejects invalid type
|
|
30
|
-
- **WHEN** the user provides a `type` not in the allowed enum
|
|
31
|
-
- **THEN** the input is rejected by the Zod schema
|
|
32
|
-
|
|
33
|
-
### Requirement: List all accounts
|
|
34
|
-
The system SHALL return all financial accounts with their current balances.
|
|
35
|
-
|
|
36
|
-
#### Scenario: List accounts when some exist
|
|
37
|
-
- **WHEN** the user requests the account list
|
|
38
|
-
- **THEN** the system returns an array of all accounts with their `currentBalance`
|
|
39
|
-
|
|
40
|
-
#### Scenario: List accounts when none exist
|
|
41
|
-
- **WHEN** no accounts have been created
|
|
42
|
-
- **THEN** the system returns an empty array
|
|
43
|
-
|
|
44
|
-
### Requirement: Get account by ID
|
|
45
|
-
The system SHALL return the details of a specific account by its ID.
|
|
46
|
-
|
|
47
|
-
#### Scenario: Account found
|
|
48
|
-
- **WHEN** the user requests an account with a valid ID
|
|
49
|
-
- **THEN** the system returns the account details
|
|
50
|
-
|
|
51
|
-
#### Scenario: Account not found
|
|
52
|
-
- **WHEN** the user requests an account with an ID that does not exist
|
|
53
|
-
- **THEN** the system returns a 404 error
|
|
54
|
-
|
|
55
|
-
### Requirement: Update account
|
|
56
|
-
The system SHALL allow updating an existing account's name, type, and initial balance.
|
|
57
|
-
|
|
58
|
-
#### Scenario: Successful update
|
|
59
|
-
- **WHEN** the user provides a valid account ID and one or more updateable fields
|
|
60
|
-
- **THEN** the system updates the account and returns the updated object
|
|
61
|
-
|
|
62
|
-
#### Scenario: Account not found on update
|
|
63
|
-
- **WHEN** the user attempts to update a non-existent account
|
|
64
|
-
- **THEN** the system returns a 404 error
|
|
65
|
-
|
|
66
|
-
### Requirement: Delete account
|
|
67
|
-
The system SHALL allow deleting an account by its ID.
|
|
68
|
-
|
|
69
|
-
#### Scenario: Successful deletion
|
|
70
|
-
- **WHEN** the user deletes an account with a valid ID
|
|
71
|
-
- **THEN** the system confirms the deletion
|
|
72
|
-
|
|
73
|
-
#### Scenario: Account not found on deletion
|
|
74
|
-
- **WHEN** the user attempts to delete a non-existent account
|
|
75
|
-
- **THEN** the system returns a 404 error
|
|
76
|
-
|
|
77
|
-
### Requirement: Get account balance
|
|
78
|
-
The system SHALL return the current balance for a specific account.
|
|
79
|
-
|
|
80
|
-
#### Scenario: Balance retrieved successfully
|
|
81
|
-
- **WHEN** the user requests the balance of an existing account
|
|
82
|
-
- **THEN** the system returns the `accountId`, `currentBalance`, and `calculatedAt` timestamp
|
|
83
|
-
|
|
84
|
-
#### Scenario: Account not found for balance
|
|
85
|
-
- **WHEN** the user requests the balance of a non-existent account
|
|
86
|
-
- **THEN** the system returns a 404 error
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Categories Specification
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Gerenciamento de categorias de classificação para transações financeiras. Cada categoria é do tipo INCOME (receita) ou EXPENSE (despesa) e pode ter uma cor associada.
|
|
5
|
-
|
|
6
|
-
## Scope
|
|
7
|
-
O que está **incluído** nesta spec:
|
|
8
|
-
- CRUD completo de categorias
|
|
9
|
-
- Validação de tipo (INCOME/EXPENSE) e cor hexadecimal
|
|
10
|
-
|
|
11
|
-
O que está **fora do escopo**:
|
|
12
|
-
- Atribuição de categorias a transações (domínio: transactions)
|
|
13
|
-
- Hierarquia ou subcategorias
|
|
14
|
-
|
|
15
|
-
## Requirements
|
|
16
|
-
|
|
17
|
-
### Requirement: Create category
|
|
18
|
-
The system SHALL allow creating a new category with a name, type (INCOME or EXPENSE), and optional hex color.
|
|
19
|
-
|
|
20
|
-
#### Scenario: Create category with color
|
|
21
|
-
- **WHEN** the user provides `name`, `type`, and a valid hex color (e.g., `#FF5733`)
|
|
22
|
-
- **THEN** the system creates the category and returns it with the assigned ID
|
|
23
|
-
|
|
24
|
-
#### Scenario: Create category without color
|
|
25
|
-
- **WHEN** the user provides `name` and `type` but no color
|
|
26
|
-
- **THEN** the system creates the category with `color` as undefined/null
|
|
27
|
-
|
|
28
|
-
#### Scenario: Validation rejects invalid color format
|
|
29
|
-
- **WHEN** the user provides a color that is not a valid 6-digit hex
|
|
30
|
-
- **THEN** the Zod schema rejects the input
|
|
31
|
-
|
|
32
|
-
#### Scenario: Validation rejects invalid type
|
|
33
|
-
- **WHEN** the user provides a `type` not in INCOME/EXPENSE
|
|
34
|
-
- **THEN** the Zod schema rejects the input
|
|
35
|
-
|
|
36
|
-
### Requirement: List all categories
|
|
37
|
-
The system SHALL return all categories.
|
|
38
|
-
|
|
39
|
-
#### Scenario: Categories exist
|
|
40
|
-
- **WHEN** the user requests the category list
|
|
41
|
-
- **THEN** the system returns an array of all categories
|
|
42
|
-
|
|
43
|
-
#### Scenario: No categories exist
|
|
44
|
-
- **WHEN** no categories have been created
|
|
45
|
-
- **THEN** the system returns an empty array
|
|
46
|
-
|
|
47
|
-
### Requirement: Get category by ID
|
|
48
|
-
The system SHALL return a specific category by its ID.
|
|
49
|
-
|
|
50
|
-
#### Scenario: Category found
|
|
51
|
-
- **WHEN** the user requests a category with a valid ID
|
|
52
|
-
- **THEN** the system returns the category details
|
|
53
|
-
|
|
54
|
-
#### Scenario: Category not found
|
|
55
|
-
- **WHEN** the user requests a category with a non-existent ID
|
|
56
|
-
- **THEN** the system returns a 404 error
|
|
57
|
-
|
|
58
|
-
### Requirement: Update category
|
|
59
|
-
The system SHALL allow updating a category's name and/or color.
|
|
60
|
-
|
|
61
|
-
#### Scenario: Successful update
|
|
62
|
-
- **WHEN** the user provides a valid category ID and one or more fields to update
|
|
63
|
-
- **THEN** the system updates and returns the modified category
|
|
64
|
-
|
|
65
|
-
#### Scenario: Category not found on update
|
|
66
|
-
- **WHEN** the user attempts to update a non-existent category
|
|
67
|
-
- **THEN** the system returns a 404 error
|
|
68
|
-
|
|
69
|
-
### Requirement: Delete category
|
|
70
|
-
The system SHALL allow deleting a category by its ID.
|
|
71
|
-
|
|
72
|
-
#### Scenario: Successful deletion
|
|
73
|
-
- **WHEN** the user deletes a category with a valid ID
|
|
74
|
-
- **THEN** the system confirms the deletion
|
|
75
|
-
|
|
76
|
-
#### Scenario: Category not found on deletion
|
|
77
|
-
- **WHEN** the user attempts to delete a non-existent category
|
|
78
|
-
- **THEN** the system returns a 404 error
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# Credit Card Transactions Specification
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Gerenciamento de transações de cartão de crédito, incluindo compras à vista e parceladas, com cálculo automático de data de vencimento baseado no dia de fechamento do cartão.
|
|
5
|
-
|
|
6
|
-
## Scope
|
|
7
|
-
O que está **incluído** nesta spec:
|
|
8
|
-
- Criação de transações de cartão via `POST /transactions/credit`
|
|
9
|
-
- Atualização de transações de cartão via `PATCH /transactions/credit/:id`
|
|
10
|
-
- Cálculo automático de data de vencimento
|
|
11
|
-
- Parcelamento com datas de vencimento distribuídas
|
|
12
|
-
- Recorrência com 7 frequências (WEEKLY, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, ANNUALLY)
|
|
13
|
-
|
|
14
|
-
O que está **fora do escopo**:
|
|
15
|
-
- Gestão de cartões de crédito em si (domínio: credit-cards)
|
|
16
|
-
- Extratos e pagamento de fatura (domínio: credit-cards)
|
|
17
|
-
- Transações diretas CASH/PIX/DEBIT (domínio: transactions)
|
|
18
|
-
|
|
19
|
-
## Requirements
|
|
20
|
-
|
|
21
|
-
### Requirement: Create credit card transaction
|
|
22
|
-
The system SHALL allow creating a credit card transaction via `POST /transactions/credit` with name, amount, purchaseDate, creditCardId, and optional fields (categoryId, installments, targetDueMonth, isPaid, recurrence).
|
|
23
|
-
|
|
24
|
-
#### Scenario: Successful creation
|
|
25
|
-
- **WHEN** the user provides `name`, `amount`, `purchaseDate`, and `creditCardId`
|
|
26
|
-
- **THEN** the system creates the transaction and the due date is calculated from the card's closing day
|
|
27
|
-
|
|
28
|
-
#### Scenario: Creation with installments
|
|
29
|
-
- **WHEN** the user provides `installments` > 1
|
|
30
|
-
- **THEN** the transaction is split into installments with due dates calculated from the card closing day
|
|
31
|
-
|
|
32
|
-
#### Scenario: Creation with target due month
|
|
33
|
-
- **WHEN** the user provides `targetDueMonth` in YYYY-MM format
|
|
34
|
-
- **THEN** the first installment's due date is set to the target month
|
|
35
|
-
|
|
36
|
-
#### Scenario: Creation with recurrence
|
|
37
|
-
- **WHEN** the user provides `recurrence` with one of the 7 supported frequencies (WEEKLY, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, ANNUALLY)
|
|
38
|
-
- **THEN** the system includes the recurrence object in the request body
|
|
39
|
-
|
|
40
|
-
### Requirement: Update credit card transaction
|
|
41
|
-
The system SHALL allow updating a credit card transaction via `PATCH /transactions/credit/:id`. If `purchaseDate` or `targetDueMonth` is changed, the due date SHALL be recalculated.
|
|
42
|
-
|
|
43
|
-
#### Scenario: Successful update
|
|
44
|
-
- **WHEN** the user provides a valid transaction ID and one or more updateable fields
|
|
45
|
-
- **THEN** the system updates and returns the modified transaction
|
|
46
|
-
|
|
47
|
-
#### Scenario: Recalculation of due date
|
|
48
|
-
- **WHEN** the user changes `purchaseDate` or `targetDueMonth`
|
|
49
|
-
- **THEN** the due date is recalculated by the API
|
|
50
|
-
|
|
51
|
-
#### Scenario: Update with recurrence
|
|
52
|
-
- **WHEN** the user modifies the `recurrence` field
|
|
53
|
-
- **THEN** the recurrence object is updated with one of the 7 supported frequencies
|
|
54
|
-
|
|
55
|
-
### Requirement: Credit card transaction input schema
|
|
56
|
-
The input schema for credit card transaction tools SHALL include: `name` (required), `amount` (required, min 0), `purchaseDate` (required, YYYY-MM-DD), `creditCardId` (required), `categoryId` (optional), `installments` (optional, min 1), `targetDueMonth` (optional, YYYY-MM), `isPaid` (optional, default false), `recurrence` (optional, CreditCardRecurrenceDto with 7 frequencies).
|
|
57
|
-
|
|
58
|
-
#### Scenario: Validation rejects missing required fields
|
|
59
|
-
- **WHEN** any of `name`, `amount`, `purchaseDate`, or `creditCardId` is missing
|
|
60
|
-
- **THEN** the MCP SDK rejects the input with a validation error
|
|
61
|
-
|
|
62
|
-
#### Scenario: Validation rejects invalid frequency
|
|
63
|
-
- **WHEN** the user provides a recurrence frequency not in the 7 supported values
|
|
64
|
-
- **THEN** the input is rejected by the Zod schema
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
# Credit Cards Specification
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Gerenciamento de cartões de crédito, incluindo CRUD, consultas de extrato (statement), pagamento de fatura, reabertura de fatura e antecipação de parcelas.
|
|
5
|
-
|
|
6
|
-
## Scope
|
|
7
|
-
O que está **incluído** nesta spec:
|
|
8
|
-
- CRUD de cartões de crédito (nome, bandeira, limite, dia de fechamento, dia de vencimento)
|
|
9
|
-
- Consulta de extrato mensal (`/credit-cards/{id}/statement`)
|
|
10
|
-
- Pagamento de fatura (`pay-statement`)
|
|
11
|
-
- Reabertura de fatura (`reopen-statement`)
|
|
12
|
-
- Status de pagamento da fatura (`statement-status`)
|
|
13
|
-
- Antecipação de parcelas (`anticipations`)
|
|
14
|
-
|
|
15
|
-
O que está **fora do escopo**:
|
|
16
|
-
- Transações de cartão de crédito (domínio: credit-card-transactions)
|
|
17
|
-
- Criação de parcelamento manual (domínio: credit-card-transactions)
|
|
18
|
-
|
|
19
|
-
## Requirements
|
|
20
|
-
|
|
21
|
-
### Requirement: Create credit card
|
|
22
|
-
The system SHALL allow creating a new credit card with name, optional brand, limit amount, closing day (1-31), and due day (1-31).
|
|
23
|
-
|
|
24
|
-
#### Scenario: Create credit card with all fields
|
|
25
|
-
- **WHEN** the user provides `name`, `brand`, `limitAmount`, `closingDay`, and `dueDay`
|
|
26
|
-
- **THEN** the system creates the card with an `availableLimit` equal to `limitAmount`
|
|
27
|
-
|
|
28
|
-
#### Scenario: Validation rejects closing day outside range
|
|
29
|
-
- **WHEN** the user provides a `closingDay` less than 1 or greater than 31
|
|
30
|
-
- **THEN** the Zod schema rejects the input
|
|
31
|
-
|
|
32
|
-
#### Scenario: Validation rejects due day outside range
|
|
33
|
-
- **WHEN** the user provides a `dueDay` less than 1 or greater than 31
|
|
34
|
-
- **THEN** the Zod schema rejects the input
|
|
35
|
-
|
|
36
|
-
### Requirement: List all credit cards
|
|
37
|
-
The system SHALL return all credit cards with their available limits.
|
|
38
|
-
|
|
39
|
-
#### Scenario: Cards exist
|
|
40
|
-
- **WHEN** the user requests the credit card list
|
|
41
|
-
- **THEN** the system returns an array of all cards with `availableLimit`
|
|
42
|
-
|
|
43
|
-
### Requirement: Get credit card by ID
|
|
44
|
-
The system SHALL return a specific credit card by its ID.
|
|
45
|
-
|
|
46
|
-
#### Scenario: Card found
|
|
47
|
-
- **WHEN** the user requests a card with a valid ID
|
|
48
|
-
- **THEN** the system returns the card details including `availableLimit`
|
|
49
|
-
|
|
50
|
-
#### Scenario: Card not found
|
|
51
|
-
- **WHEN** the user requests a card with a non-existent ID
|
|
52
|
-
- **THEN** the system returns a 404 error
|
|
53
|
-
|
|
54
|
-
### Requirement: Update credit card
|
|
55
|
-
The system SHALL allow updating a credit card's name, brand, limit, closing day, and/or due day.
|
|
56
|
-
|
|
57
|
-
#### Scenario: Successful update
|
|
58
|
-
- **WHEN** the user provides a valid card ID and one or more updateable fields
|
|
59
|
-
- **THEN** the system updates and returns the modified card
|
|
60
|
-
|
|
61
|
-
### Requirement: Delete credit card
|
|
62
|
-
The system SHALL allow deleting a credit card by its ID.
|
|
63
|
-
|
|
64
|
-
#### Scenario: Successful deletion
|
|
65
|
-
- **WHEN** the user deletes a card with a valid ID
|
|
66
|
-
- **THEN** the system confirms the deletion
|
|
67
|
-
|
|
68
|
-
### Requirement: Get statement
|
|
69
|
-
The system SHALL return the credit card statement for a specific month, including all transactions, total amount, and available limit.
|
|
70
|
-
|
|
71
|
-
#### Scenario: Statement retrieved
|
|
72
|
-
- **WHEN** the user provides a valid card ID and a month in YYYY-MM format
|
|
73
|
-
- **THEN** the system returns the statement with transactions, total, and available limit
|
|
74
|
-
|
|
75
|
-
#### Scenario: Card not found for statement
|
|
76
|
-
- **WHEN** the user requests a statement for a non-existent card
|
|
77
|
-
- **THEN** the system returns a 404 error
|
|
78
|
-
|
|
79
|
-
### Requirement: Pay statement
|
|
80
|
-
The system SHALL mark all transactions in a credit card statement as paid, debiting from a specified payment account.
|
|
81
|
-
|
|
82
|
-
#### Scenario: Statement paid successfully
|
|
83
|
-
- **WHEN** the user provides `cardId`, `month`, and `paymentAccountId`
|
|
84
|
-
- **THEN** all transactions in the statement are marked as paid and the system confirms the payment
|
|
85
|
-
|
|
86
|
-
### Requirement: Reopen statement
|
|
87
|
-
The system SHALL reopen a credit card statement by marking all transactions as unpaid.
|
|
88
|
-
|
|
89
|
-
#### Scenario: Statement reopened
|
|
90
|
-
- **WHEN** the user provides `cardId` and `month`
|
|
91
|
-
- **THEN** all transactions in the statement are marked as unpaid
|
|
92
|
-
|
|
93
|
-
### Requirement: Get statement status
|
|
94
|
-
The system SHALL return the payment status of a credit card statement for a specific month.
|
|
95
|
-
|
|
96
|
-
#### Scenario: Status retrieved
|
|
97
|
-
- **WHEN** the user provides `cardId` and `month`
|
|
98
|
-
- **THEN** the system returns the `isPaid` status for that month
|
|
99
|
-
|
|
100
|
-
### Requirement: Create anticipation
|
|
101
|
-
The system SHALL allow creating a credit card anticipation (advance payment toward a future statement). The system SHALL create a linked pair: an INCOME transaction on the credit card side and an EXPENSE transaction on the account side.
|
|
102
|
-
|
|
103
|
-
#### Scenario: Anticipation created
|
|
104
|
-
- **WHEN** the user provides `cardId`, `name`, `amount`, `purchaseDate`, `targetDueMonth`, `accountId`, and optional `categoryId`
|
|
105
|
-
- **THEN** the system creates the linked INCOME/EXPENSE transaction pair and returns the result
|
|
106
|
-
|
|
107
|
-
#### Scenario: Validation rejects amount below minimum
|
|
108
|
-
- **WHEN** the user provides an `amount` less than 0.01
|
|
109
|
-
- **THEN** the Zod schema rejects the input
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# Data Import/Export Specification
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Backup e restauração de todos os dados do usuário (configurações, categorias, contas, cartões de crédito, regras de recorrência, transações) via exportação e importação JSON.
|
|
5
|
-
|
|
6
|
-
## Scope
|
|
7
|
-
O que está **incluído** nesta spec:
|
|
8
|
-
- Exportação completa de todos os dados (`GET /export`)
|
|
9
|
-
- Importação em modo `reset` (limpa dados existentes) ou `increment` (adiciona sem duplicar)
|
|
10
|
-
- Validação de formato e versão do export
|
|
11
|
-
|
|
12
|
-
O que está **fora do escopo**:
|
|
13
|
-
- Exportação parcial por domínio ou data
|
|
14
|
-
- Migração entre versões de formato de export
|
|
15
|
-
|
|
16
|
-
## Requirements
|
|
17
|
-
|
|
18
|
-
### Requirement: Export all data
|
|
19
|
-
The system SHALL return all user data as a complete backup in JSON format, including settings, categories, accounts, credit cards, recurrence rules, and transactions.
|
|
20
|
-
|
|
21
|
-
#### Scenario: Successful export
|
|
22
|
-
- **WHEN** the user requests an export
|
|
23
|
-
- **THEN** the system returns a JSON object with `version`, `exportedAt`, and a `data` object containing all domains
|
|
24
|
-
|
|
25
|
-
#### Scenario: Export includes version metadata
|
|
26
|
-
- **WHEN** the user receives the export
|
|
27
|
-
- **THEN** the response includes `version` (e.g., "1.0") and `exportedAt` (ISO timestamp)
|
|
28
|
-
|
|
29
|
-
### Requirement: Import data in reset mode
|
|
30
|
-
The system SHALL allow importing a previously exported backup in `reset` mode, which clears all existing data before importing.
|
|
31
|
-
|
|
32
|
-
#### Scenario: Reset import clears and replaces data
|
|
33
|
-
- **WHEN** the user imports with `mode: "reset"` and valid export data
|
|
34
|
-
- **THEN** the system clears existing records and imports all data from the backup
|
|
35
|
-
|
|
36
|
-
#### Scenario: Validation rejects wrong version
|
|
37
|
-
- **WHEN** the user provides a `version` that does not match "1.0"
|
|
38
|
-
- **THEN** the input is rejected
|
|
39
|
-
|
|
40
|
-
### Requirement: Import data in increment mode
|
|
41
|
-
The system SHALL allow importing a backup in `increment` mode, which adds new records and skips any IDs that already exist.
|
|
42
|
-
|
|
43
|
-
#### Scenario: Increment import skips duplicates
|
|
44
|
-
- **WHEN** the user imports with `mode: "increment"` and the backup contains IDs that already exist
|
|
45
|
-
- **THEN** the system skips existing IDs and only imports new records
|
|
46
|
-
|
|
47
|
-
#### Scenario: Increment import adds new records
|
|
48
|
-
- **WHEN** the user imports with `mode: "increment"` and the backup contains new IDs
|
|
49
|
-
- **THEN** the system adds all new records to the existing data
|