Skip to content

Add Australia GST regime#784

Open
albipuliga wants to merge 8 commits intoinvopop:mainfrom
albipuliga:australia
Open

Add Australia GST regime#784
albipuliga wants to merge 8 commits intoinvopop:mainfrom
albipuliga:australia

Conversation

@albipuliga
Copy link
Copy Markdown

@albipuliga albipuliga commented Apr 4, 2026

Australia GST regime

  • Australia is modeled as a GST regime with a 10% standard rate.
  • GST-free supplies map to the shared GST zero key.
  • Input-taxed supplies map to the shared GST exempt key.
  • The regime models ABN as the AU tax identity. ACN display obligations are treated as a separate corporate-document concern and are not modeled here as the primary tax identifier.
  • ABN validation follows the ABR checksum algorithm for 11-digit ABNs.
  • Invoice validation requires supplier details and ABN, and currently requires customer identification for invoices of AUD 1,000+ and self-billed invoices.
  • Electronic invoicing references align with Peppol PINT A-NZ BIS.

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.name in that case, which aligns with existing shared invoice validation in bill/invoice.go. I did not broaden this PR to change the shared validation model, but I'd love some feedback on whether AU should support customer.tax_id.code without customer.name, and if so, whether that should be handled at regime level or by adjusting the shared invoice validator.

Sources

Pre-Review Checklist

  • Opened this PR as a draft
  • Read the CONTRIBUTING.md guide.
  • Performed a self-review of my code.
  • Added thorough tests with at least 90% code coverage.
  • Modified or created example GOBL documents to show my changes in use, if appropriate.
  • Added links to the source of the changes in tax regimes or addons, either structured or in the comments.
  • Run go generate . to ensure that the Schemas and Regime data are up to date.
  • Reviewed and fixed all linter warnings.
  • Been obsessive with pointer nil checks to avoid panics.
  • Updated the CHANGELOG.md with an overview of my changes.
  • Marked this PR as ready for review.

And if you are part of the org:

  • Requested a review from Copilot and fixed or dismissed (with a reason) all the feedback raised.
  • Requested a review from @samlown.

@albipuliga albipuliga changed the title feat(au): add Australian GST regime Add Australian GST regime Apr 4, 2026
@albipuliga albipuliga changed the title Add Australian GST regime Add Australia GST regime Apr 4, 2026
@albipuliga albipuliga marked this pull request as ready for review April 4, 2026 20:21
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.17%. Comparing base (e36c17e) to head (1e2da5a).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AU regime 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.

Comment on lines +38 to +43
if len(normalized) != abnLength {
return errors.New("invalid length")
}
if _, err := strconv.Atoi(normalized); err != nil {
return errors.New("invalid characters, expected numeric")
}
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +91 to +97
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())
})
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread regimes/au/README.md
Comment on lines +18 to +21
| Position | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Weight | 10 | 1 | 3 | 5 | 7 | 9 | 11 | 13 | 15 | 17 | 19 |

Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | ... |).

Copilot uses AI. Check for mistakes.
Comment thread regimes/au/README.md
Comment on lines +31 to +36
| 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 |
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread regimes/au/README.md
Comment on lines +38 to +41
| Rate Name | GOBL Rate Key | Percent | Since |
| --- | --- | --- | --- |
| General rate | `standard` / `general` | 10% | 2000-07-01 |

Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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.

2 participants