Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#93 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
45/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
csharp

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
C#
星标
3
派生
0
平均合并
11 分钟
30 天内合并 PR
4

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

SSWConsulting/TimePro.Tools 的其他 Issue

查看 SSWConsulting/TimePro.Tools 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。