feat: CDI % configurável por conta + fix mocks de teste
- Adiciona campo cdi_percentage (default 100%) na tabela accounts - Cálculo CDI aplica proporção: balance × (compound-1) × (pct/100) - Frontend exibe input de % quando yield_type=cdi e badge mostra valor - Corrige mocks de teste desatualizados (DeleteByMonth, isTax) - Corrige ConfirmIncome para rejeitar tipo expense (ErrRecurringNotIncome) Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
@@ -78,7 +78,11 @@ func (s *CDIYieldService) ApplyYield(ctx context.Context, a *model.Account) erro
|
||||
compound *= 1 + lastRate/100
|
||||
}
|
||||
|
||||
yieldAmount := a.Balance * (compound - 1)
|
||||
cdiPct := a.CDIPercentage
|
||||
if cdiPct <= 0 {
|
||||
cdiPct = 100
|
||||
}
|
||||
yieldAmount := a.Balance * (compound - 1) * (cdiPct / 100)
|
||||
if yieldAmount <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user