Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Prepaid: move drawdown maths out of TimeProApiClient; MCP reports a drawdown for non-prepaid invoices

Aperta
#93 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
45/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp

Direzione di ricerca

Start by reading TimeProApiClient and the WeekCoverageService, CheckEvaluator, and WeekCheckResult pattern. Trace PrepaidStatusService, PrepaidCalculator, PrepaidStatusResult, and both prepaid CLI and MCP surfaces, then run the existing WireMock coverage and add the zero-rate unit test. Done means the prepaid golden remains byte-identical, both surfaces share the result and fetch, and the contract decision for non-prepaid MCP output is resolved.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Priority: P1 Type: Bug Type: Refactor

Why

Prepaid is the one place where finance rules live in the HTTP client. TimeProApiClient.GetPrepaidStatusSummaryAsync / BuildPrepaidStatusSummary hold the BPP filter, tax-rate normalisation, 3-dp rounding and the credit-note apportioning. Both surfaces call it, but the logic around it has already drifted:

  • prepaid summary refuses a non-prepaid invoice (isPrepaid:false); the MCP GetPrepaidStatus tool has no such gate and returns a full drawdown for an ordinary invoice. An agent asked about unspent prepaid credit reports credit that does not exist.
  • An explicit SalesTaxPct = 0 on a drawdown row is treated as "missing" and replaced with the invoice's rate, so a zero-rated row with SellTotal = 100 gains $10 GST. The fallback tests the normalised value against zero instead of testing for null.
  • The maths can only be tested through WireMock.

Migrate

  • Features/Prepaid/PrepaidStatusService for orchestration (invoice, allocated timesheets, credit notes) and a pure PrepaidCalculator for the maths.
  • One PrepaidStatusResult { found, isPrepaid, invoiceId, summary? } used by prepaid summary --json and GetPrepaidStatus.
  • prepaid status and GetPrepaidStatusPdf share the fetch; the adapters only choose file vs base64.
  • Fix the zero-rate fallback (null means missing, zero means zero) with a unit test.
  • Remove the prepaid members from ITimeProApiClient except the raw endpoint calls.

How

Follow WeekCoverageService (fetch) + CheckEvaluator (pure, unit-tested rules) + WeekCheckResult (one document for both surfaces).

Contract

The populated golden (a prepaid invoice) should stay byte-identical. The non-prepaid MCP answer changes shape; ship the gate in a patch only if the old shape can be kept, otherwise hold it for 0.4.0.

Part of #38.

Lingua principale
C#
Stelle
3
Fork
0
Merge medio
11m
PR unite (30g)
4

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SSWConsulting/TimePro.Tools

Tutte le issue di SSWConsulting/TimePro.Tools

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.