Conversation
Made-with: Cursor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #784 +/- ##
==========================================
+ Coverage 93.11% 93.17% +0.06%
==========================================
Files 334 338 +4
Lines 18086 18265 +179
==========================================
+ Hits 16840 17019 +179
Misses 876 876
Partials 370 370 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a new Australian (AU) tax regime to the GOBL regimes registry, modeling Australia as a GST regime with ABN (Australian Business Number) identity handling and AU-specific invoice validation rules.
Changes:
- Register new
AUregime and generate supporting regime/schema data. - Implement ABN validation (ABR checksum) + normalization behavior via shared tax identity normalization.
- Add AU invoice validation rules around supplier ABN requirements and customer identification threshold/self-billed handling, plus examples and tests.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
regimes/regimes.go |
Registers the new au regime package so it’s available via the global regime registry. |
regimes/au/au.go |
Defines the AU regime metadata (GST scheme, sources, timezone, corrections) and hooks validator/normalizer. |
regimes/au/tax_categories.go |
Introduces AU GST category using global GST keys and a 10% general rate since 2000-07-01. |
regimes/au/tax_identity.go |
Adds ABN checksum validation logic for AU tax identities. |
regimes/au/bill_invoice.go |
Adds AU-specific invoice validation (supplier details/ABN, customer identification threshold, self-billed rules). |
regimes/au/README.md |
Documents the AU regime model, ABN algorithm, GST mapping, and invoice rules. |
regimes/au/au_test.go |
Tests regime definition integrity and correction options schema output. |
regimes/au/tax_identity_test.go |
Tests ABN validation and normalization expectations. |
regimes/au/bill_invoice_test.go |
Tests AU invoice validation behavior for threshold/self-billed and supplier constraints. |
examples/au/invoice-au-au.yaml |
Adds an AU example invoice input document. |
examples/au/out/invoice-au-au.json |
Adds generated AU example invoice output envelope. |
data/schemas/tax/regime-code.json |
Adds AU as a valid regime code in the published JSON schema. |
data/regimes/au.json |
Adds generated serialized regime definition for AU. |
CHANGELOG.md |
Notes the addition of the Australian GST regime. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if len(normalized) != abnLength { | ||
| return errors.New("invalid length") | ||
| } | ||
| if _, err := strconv.Atoi(normalized); err != nil { | ||
| return errors.New("invalid characters, expected numeric") | ||
| } |
There was a problem hiding this comment.
strconv.Atoi(normalized) is being used only to assert the ABN is numeric, but it can fail for valid 11-digit ABNs on 32-bit platforms due to integer overflow. Prefer a digit-only check (iterate runes/bytes) or strconv.ParseUint(normalized, 10, 64) to avoid rejecting valid ABNs.
| t.Run("valid invoice at threshold with customer name only", func(t *testing.T) { | ||
| t.Parallel() | ||
| inv := validInvoice() | ||
| inv.Lines[0].Item.Price = num.NewAmount(100000, 2) | ||
| require.NoError(t, inv.Calculate()) | ||
| require.NoError(t, inv.Validate()) | ||
| }) |
There was a problem hiding this comment.
The test case name says "at threshold", but with Item.Price = 1000.00 and 10% GST the invoice Totals.TotalWithTax becomes 1100.00 (above the 1000.00 threshold). Either adjust the amount so TotalWithTax is exactly 1000.00, or rename the test to reflect it’s testing the >= threshold branch.
| | Position | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | | ||
| | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | ||
| | Weight | 10 | 1 | 3 | 5 | 7 | 9 | 11 | 13 | 15 | 17 | 19 | | ||
|
|
There was a problem hiding this comment.
The Markdown tables use a double leading pipe (|| ...) which creates an extra empty first column in most renderers. Consider changing these rows to a single leading | so the table renders as intended (e.g., | Position | 1 | 2 | ... |).
| | Australian concept | GOBL key / handling | GST treatment | | ||
| | --- | --- | --- | | ||
| | Taxable supply | `standard` / `general` | 10% GST | | ||
| | GST-free supply | `zero` | 0% GST through the shared GST zero key | | ||
| | Input-taxed supply | `exempt` | No GST charged; used as the generic mapping for input-taxed treatment | | ||
| | Outside scope / non-taxable | `outside-scope` | Not part of the GST calculation | |
There was a problem hiding this comment.
Same table formatting issue here: rows start with || (double pipe), which will render an unintended blank first column. Update to a single leading | for proper Markdown table formatting.
| | Rate Name | GOBL Rate Key | Percent | Since | | ||
| | --- | --- | --- | --- | | ||
| | General rate | `standard` / `general` | 10% | 2000-07-01 | | ||
|
|
There was a problem hiding this comment.
The rate table also starts rows with ||, which most Markdown renderers interpret as an empty first column. Use a single leading | for these rows as well.
Australia GST regime
zerokey.exemptkey.ABNas the AU tax identity.ACNdisplay obligations are treated as a separate corporate-document concern and are not modeled here as the primary tax identifier.Open question
AU tax invoice rules for invoices of AUD 1,000+ allow identifying the customer by the customer's identity OR ABN. The current implementation requires
customer.namein that case, which aligns with existing shared invoice validation inbill/invoice.go. I did not broaden this PR to change the shared validation model, but I'd love some feedback on whether AU should supportcustomer.tax_id.codewithoutcustomer.name, and if so, whether that should be handled at regime level or by adjusting the shared invoice validator.Sources
Pre-Review Checklist
go generate .to ensure that the Schemas and Regime data are up to date.And if you are part of the org: