Skip to content

fix!: require vatIncluded instead of defaulting it to true - #25

Merged
BenKalsky merged 1 commit into
mainfrom
fix/vat-included-required
Oct 12, 2026
Merged

BenKalsky merged 1 commit into
mainfrom
fix/vat-included-required

Conversation

@BenKalsky

Copy link
Copy Markdown
Member

What

buildOneOffChargePayload, buildRecurringChargePayload and buildCreateDocumentPayload sent VATIncluded: true when the caller left vatIncluded out. SUMIT's own default is the opposite. From its published schema (api.sumit.co.il/swagger/v1/swagger.json, read again on 2026-10-12): documents and recurring charges say "Leave empty for false", one-off charges say "Defaults to false".

So a caller who passed net prices and left the flag out got a total without VAT, and nothing failed. This happened on 2026-10-12 through sumit-mcp: lines adding up to 5,450 before VAT produced a draft with a total of 5,450 instead of 6,431.

Change

  • vatIncluded is required in the params of all three builders (option 2 in VATIncluded defaults to true, the opposite of SUMIT's own default #23).
  • The builders throw when it is not a boolean. The type covers TypeScript callers; the throw covers plain JavaScript and casts.
  • The doc comment that said the old default "matches SUMIT's API default" is replaced with what SUMIT actually does.
  • README examples pass the flag, and a note explains the choice. docs/API_REFERENCE.md states SUMIT's default.

Breaking

Callers that relied on the default have to pass vatIncluded: true to keep their amounts. That is the point: the amount is no longer decided by a default. The CHANGELOG entry is under "Unreleased"; this should go out as 0.5.0, in a separate release PR.

Known callers and what they do today:

Caller Pins Passes the flag?
Digitizers/sumit-mcp ^0.4.0 optional in the tool schema, passed through
Digitizers/sumit-react ^0.4.0 optional in the route body, passed through
Digitizers/Quoty ^0.3.1 always, from a saved setting

None of them picks up 0.5.0 by itself under a caret range on 0.x. sumit-mcp and sumit-react need their own change when they move to it (Digitizers/sumit-mcp#15 covers the first).

Tests

pnpm test (34 passed), pnpm typecheck, pnpm build. Two new tests: the three builders refuse an omitted or non-boolean flag, and both values are sent as chosen. The 17 existing calls that relied on the default now pass vatIncluded: true, so their expected payloads are unchanged.

Closes #23

🤖 Generated with Claude Code

The three payload builders sent VATIncluded: true when the caller left
the flag out. SUMIT's own default for an omitted VATIncluded is false
(published schema: "Leave empty for false"), so a caller who passed net
prices and followed SUMIT's documentation got a document or a charge
whose total left the VAT out, and nothing failed.

vatIncluded is now a required parameter of buildOneOffChargePayload,
buildRecurringChargePayload and buildCreateDocumentPayload, and the
builders throw when it is not a boolean, so plain-JavaScript callers get
an error instead of a guessed amount.

Closes #23

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T19:22:33.630621Z 416b67e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@BenKalsky

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 416b67e86f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BenKalsky
BenKalsky merged commit a64d697 into main Oct 12, 2026
4 checks passed
@BenKalsky
BenKalsky deleted the fix/vat-included-required branch October 12, 2026 19:33
@BenKalsky BenKalsky mentioned this pull request Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VATIncluded defaults to true, the opposite of SUMIT's own default

1 participant