Skip to content

Document India GST e-invoicing: research, readiness and feature design - #456

Merged
sridharkalaibala merged 1 commit into
developfrom
claude3_stream
Sep 2, 2026
Merged

sridharkalaibala merged 1 commit into
developfrom
claude3_stream

Conversation

@sridharkalaibala

@sridharkalaibala sridharkalaibala commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Documentation only. It adds the research, readiness evaluation and feature design for India GST e-invoicing as an optional, off-by-default feature under Manage > Features, and decides nothing about live IRP submission beyond laying out the options.

Addresses #42 (the offline field contract) and PR slices 1 and 7 of #29 (design, and connector boundary). Names the fixtures for #43 and #44 and gives #100 something true to describe. No code, schema, report or receipt changes.

Three new documents under docs/:

File What it is
INDIA_EINVOICING_RESEARCH.md What the regime and the IRPs require, with a source for every rule: thresholds (5 crore since Aug 2023, 30-day window at 10 crore since Apr 2025), the six IRPs and the access models, the INV-01 v1.1 schema attribute by attribute, NIC validation rules and tolerances, IRN computation, signed QR, cancellation, the offline bulk tool, sandbox endpoints and error codes, open-source references and their licences, indicative GSP pricing, and a 2025-2026 change list. Secondary sources and unconfirmed points are marked as such.
INDIA_EINVOICING_READINESS.md What the code on develop already holds, file by file, and a field-by-field contract table marking each schema attribute Existing / Derivable / Unclear / Missing / Not supported. Lists the cases the code cannot express today and the data-quality problems in shipped JSON (state names used for place of supply, stale hsn.json, hsncode: '0' seeds).
INDIA_EINVOICING_DESIGN.md The proposal: two layers (offline validate + export + IRN record + QR print, shipped first; live submission as a separately accepted connector design). The module_einvoice_enable switch and every registration point it needs, settings, additive model fields, the pure contract module and its finding codes, the deterministic export, result import, printing, sync, ACL, synthetic fixtures (checksum-valid placeholder GSTINs), a ten-row PR plan mapped to issues, and open questions for maintainers.

Two small edits link them: a row in the README documentation table and a pointer in the contributor quickstart's "Tax, GST, or e-invoice PR" section.

Acceptance criteria covered

From #42:

  • A design doc lists required seller, buyer, invoice, item, tax, total, and place-of-supply fields (readiness doc, "Field-by-field contract")
  • It marks each field as existing, missing, unclear, or not supported
  • It describes unsupported cases: unregistered buyer, missing HSN/SAC, missing buyer GSTIN, inconsistent tax totals, returns/credit notes (readiness doc, "Cases the code cannot express today")
  • It defines the export boundary: offline JSON/CSV only, no live portal/API submission (design doc, "Export" and "The online layer")
  • It names at least two synthetic passing examples and at least three rejected examples (design doc, "Test plan and fixtures": 2 passing, 10 rejected or excluded)
  • It links back to India GST e-invoice support: invoice readiness, IRP export contract, and safe connector boundary #29

From #29, slices 1 and 7: the design PR and the connector design PR are both in INDIA_EINVOICING_DESIGN.md. The remaining #29 slices are mapped to PRs in its "Delivery plan" and are not part of this change.

How was it tested?

  • git diff --check clean
  • Every relative link and heading anchor in the three new documents, the README and the quickstart resolves from the directory of the file it appears in (120 links checked with a one-off script; the GitHub resolution rule PR Fix 30 broken documentation links, and check them from now on #450 introduces)
  • Every markdown table row has the header's column count
  • GSTIN placeholders in the fixtures were generated with the mod-36 check digit and the generator was sanity-checked against a known valid GSTIN, so the checksum test in GST e-invoice: add synthetic validation fixtures #43 can be real
  • Not run: the app, the installer, or the unit suites - nothing executable changed

Checklist

  • One focused change per PR
  • Commits are signed off (git commit -s, DCO)
  • Works fully offline (no new external network calls in the local edition) - documentation only
  • Matches surrounding code style - follows the voice and layout of the existing docs/
  • No real customer, tax, payment, credential, token, or production data is included - all GSTINs, names and addresses are synthetic and say so

Notes for reviewers

  • The research was gathered on 2 September 2026. Every fact carries a link; facts from GSP documentation or tax publishers rather than NIC/CBIC/GSTN are marked [secondary], and seven points that could not be confirmed are listed together at the end of the research document.
  • The design asks eight questions of maintainers (credit-note identity, legal-name placement, header discount allocation, inclusive pricing, page location, Phase B home, bulk-tool envelope, retention). Answering them is the gate for the first code PR.

Three documents under docs/ for the optional India e-invoicing feature
asked for in #29, answering #42 and naming the fixtures for #43 and #44:

- INDIA_EINVOICING_RESEARCH.md: what the regime and the IRPs require,
  with a source for every rule - thresholds, the six IRPs and access
  models, the INV-01 v1.1 schema, NIC validations and tolerances, IRN,
  signed QR, cancellation, the offline bulk tool, sandbox endpoints and
  error codes, open-source references, indicative pricing, 2025-2026
  changes. Secondary and unconfirmed points are marked.
- INDIA_EINVOICING_READINESS.md: what the code on develop already holds,
  file by file, and a field-by-field contract marking each schema
  attribute existing, derivable, unclear, missing or not supported.
- INDIA_EINVOICING_DESIGN.md: the proposal - an offline layer (validate,
  export, record IRN, print QR) behind module_einvoice_enable, shipped
  first; live submission as a separately accepted connector design with
  three options compared. Includes the feature-switch registration
  checklist, additive model fields, finding codes, synthetic fixtures
  with checksum-valid placeholder GSTINs, a PR plan and open questions.

The README documentation table and the contributor quickstart point at
them. Documentation only; no behaviour changes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Sridhar Bala <[email protected]>
@sridharkalaibala
sridharkalaibala merged commit ab48699 into develop Sep 2, 2026
7 checks passed
@github-actions github-actions Bot added the ready for QA Merged to develop and live on develop.posnic.io - anyone can test it label Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Merged to develop. Anyone can test this - you do not need write access.

Try it at https://develop.posnic.io, or run it yourself:

git fetch origin develop && git checkout develop
npm install && npm --prefix api install
npm run dev   # then http://localhost:3000

When you have tested it, say what you did and what happened, and set
QA passed or QA failed. If you cannot set labels, just comment -
a maintainer will.

Reporting that something is broken is as useful as fixing it. It is
better found here than by a shopkeeper.

sridharkalaibala added a commit that referenced this pull request Sep 4, 2026
Three pieces of the India GST work opened by #456.

CODE (PR 2 of the design's delivery plan, issue #43)

api/src/services/einvoice/ - pure functions, no database, no network,
not yet wired to a route:

- gstin.js: the mod-36 check digit, so a transposed character is caught
  at the till instead of by the portal after the customer has left. The
  existing regex accepts 33AAAAA0000A1Z0 as readily as ...1Z9.
- uqc.js + uqc_codes.json: GST unit codes, and the mapping from the free
  text Posnic stores. A unit nobody can map produces NOTHING rather than
  OTH - choosing OTHERS is a decision about what a shop declares, and it
  is the shop's to make.
- applicability.js: the India-only gate, in one place. Availability is
  checked before the feature switch, so module_einvoice_enable left on
  by a shop that changed country cannot revive an Indian-only feature.
- findings.js: the EI-xxx catalogue, with the screen that fixes each.
- validate.js: the checks. A walk-in sale is not_applicable, not an
  error; a customer MARKED registered with no GSTIN still is one.

121 tests over four suites. The robustness test found a real crash: a
null entry in items threw, which would have taken the readiness page
down for any shop with one damaged row. It is now reported (EI-113)
rather than skipped, because exporting an invoice with a line quietly
missing would file a total that does not match the printed bill.

EI-012 is a warning, not the block the design proposed. The export takes
the state code from the GSTIN, so it is consistent either way, and
EI-108 blocks the case that matters.

DOCS

docs/INDIA_GST_RETURNS_GAPS.md (issue #45): what the GST reports compute
today, verified by hand against the code. One filing-capable artefact
and one correct tax position; around them a GSTR-1 aggregation that
groups without accumulators and loses duplicate lines, credit notes
filed in the invoice's month rather than the return's, unregistered
credit notes dropped by an inherited filter, four DOM-scraping exports
no filing tool can read, and no exemption, reverse-charge or cess field
anywhere. Twelve items in dependency order.

docs/INDIA_GOVERNMENT_INTEGRATION.md: how software is actually
registered with the GST system. The e-invoice sandbox is free and
self-service today; production credentials need ~390 logged operations
run through our own application; return-filing APIs are GSP-only and
that window is closed. Records, with the source, that no government list
of recommended billing software exists.

Corrects a claim that HSN is never persisted on a sale line: the model
does not declare it, but the line schema is strict:false and
sale.service.js does write it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Signed-off-by: Sridhar Bala <[email protected]>
sridharkalaibala added a commit that referenced this pull request Sep 4, 2026
Three pieces of the India GST work opened by #456.

CODE (PR 2 of the design's delivery plan, issue #43)

api/src/services/einvoice/ - pure functions, no database, no network,
not yet wired to a route:

- gstin.js: the mod-36 check digit, so a transposed character is caught
  at the till instead of by the portal after the customer has left. The
  existing regex accepts 33AAAAA0000A1Z0 as readily as ...1Z9.
- uqc.js + uqc_codes.json: GST unit codes, and the mapping from the free
  text Posnic stores. A unit nobody can map produces NOTHING rather than
  OTH - choosing OTHERS is a decision about what a shop declares, and it
  is the shop's to make.
- applicability.js: the India-only gate, in one place. Availability is
  checked before the feature switch, so module_einvoice_enable left on
  by a shop that changed country cannot revive an Indian-only feature.
- findings.js: the EI-xxx catalogue, with the screen that fixes each.
- validate.js: the checks. A walk-in sale is not_applicable, not an
  error; a customer MARKED registered with no GSTIN still is one.

121 tests over four suites. The robustness test found a real crash: a
null entry in items threw, which would have taken the readiness page
down for any shop with one damaged row. It is now reported (EI-113)
rather than skipped, because exporting an invoice with a line quietly
missing would file a total that does not match the printed bill.

EI-012 is a warning, not the block the design proposed. The export takes
the state code from the GSTIN, so it is consistent either way, and
EI-108 blocks the case that matters.

DOCS

docs/INDIA_GST_RETURNS_GAPS.md (issue #45): what the GST reports compute
today, verified by hand against the code. One filing-capable artefact
and one correct tax position; around them a GSTR-1 aggregation that
groups without accumulators and loses duplicate lines, credit notes
filed in the invoice's month rather than the return's, unregistered
credit notes dropped by an inherited filter, four DOM-scraping exports
no filing tool can read, and no exemption, reverse-charge or cess field
anywhere. Twelve items in dependency order.

docs/INDIA_GOVERNMENT_INTEGRATION.md: how software is actually
registered with the GST system. The e-invoice sandbox is free and
self-service today; production credentials need ~390 logged operations
run through our own application; return-filing APIs are GSP-only and
that window is closed. Records, with the source, that no government list
of recommended billing software exists.

Corrects a claim that HSN is never persisted on a sale line: the model
does not declare it, but the line schema is strict:false and
sale.service.js does write it.

Signed-off-by: Sridhar Bala <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for QA Merged to develop and live on develop.posnic.io - anyone can test it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant