Skip to content

Add South Korea (KR) tax regime - #878

Open
aryanv175 wants to merge 3 commits into
invopop:mainfrom
aryanv175:feat/kr-regime
Open

aryanv175 wants to merge 3 commits into
invopop:mainfrom
aryanv175:feat/kr-regime

Conversation

@aryanv175

@aryanv175 aryanv175 commented Jun 28, 2026 •

Copy link
Copy Markdown

Summary

Adds a new tax regime for South Korea (KR). It follows the structure of the
recently merged Norway regime (regimes/no) and uses the current rules + norm
validation framework.

  • VAT (부가가치세) at the standard 10% rate (in place since VAT was introduced on
    1 July 1977), with zero-rating for exports handled via the standard VAT keys.
  • Business Registration Number (사업자등록번호) normalization and check-digit
    validation. The algorithm is verified against real, public BRNs in the tests.
  • Corrections: credit and debit notes, matching Korea's revised tax invoice
    (수정세금계산서), which can adjust a prior invoice up or down.
  • Example invoices (standard, zero-rated export, credit note) and regenerated
    data/regimes/kr.json, data/rules/kr.json, and the regime-code schema enum.

Sources

Scope decisions (and what I deliberately left out)

  • VAT is the correct category for Korea: 부가가치세 allows input-tax credits, which
    is the defining property of a VAT (unlike a consumption/sales tax).
  • No org-identity / Corporate Registration Number (법인등록번호): the CRN is not used
    to identify parties on Korean tax invoices — the BRN is — so I didn't add an identity
    type that wouldn't appear on invoices, and I couldn't verify its check digit against a
    known-valid number.
  • No invoice-level "supplier tax ID required" rule: Korea has simplified taxpayers
    (간이과세자) below the VAT-registration threshold, so a blanket requirement would be
    wrong. Kept the regime minimal; format/agency-specific rules belong in a future addon.
  • No e-invoicing addon: the NTS e-Tax Invoice system (전자세금계산서) is a large CTC
    system and out of scope for a base regime.

Checklist

  • Opened as a draft
  • Read the CONTRIBUTING.md guide
  • Self-reviewed the code
  • Tests with ≥90% coverage (KR package is at ~95%)
  • Added example GOBL documents
  • Added source links for tax data
  • Ran go generate . so schema and regime data are up to date
  • Fixed all linter warnings (go vet, gofmt)
  • Nil-checks on tax-identity handling
  • Updated CHANGELOG.md
  • Requested a review from Copilot and addressed feedback
  • Marked ready and requested review from @samlown

Adds a VAT tax regime for South Korea, following the existing Norway
regime and using the current rules + norm validation framework.

- VAT (부가가치세) at the standard 10% rate, with zero-rating for exports
- Business Registration Number (사업자등록번호) check-digit validation
- Credit and debit note corrections (revised tax invoice, 수정세금계산서)
- Example invoices and regenerated regime/rule/schema data
@aryanv175
aryanv175 marked this pull request as ready for review June 28, 2026 09:15
@aryanv175

Copy link
Copy Markdown
Author

Ready for review @samlown — thanks!

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.82540% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.76%. Comparing base (225e39d) to head (790cca4).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
regimes/kr/tax_identity.go 92.59% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #878   +/-   ##
=======================================
  Coverage   94.75%   94.76%           
=======================================
  Files         343      345    +2     
  Lines       18815    18878   +63     
=======================================
+ Hits        17829    17890   +61     
- Misses        600      601    +1     
- Partials      386      387    +1     

☔ View full report in Codecov by Harness.
📢 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.

@samlown samlown added the regime Related to a specific regime. label Jul 6, 2026
@rilla
rilla requested a review from Copilot July 31, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 South Korea (KR) tax regime to the GOBL regimes registry, including VAT definitions, BRN (사업자등록번호) normalization/validation, and example documents, and regenerates the derived JSON rule/regime artifacts and schema enum.

Changes:

  • Register the new kr regime and define KR VAT (10%) category/rate metadata.
  • Add KR tax identity normalization + BRN check-digit validation with unit/integration tests.
  • Add KR example invoices/credit note and regenerate data/regimes/kr.json, data/rules/kr.json, and the regime-code schema enum.

Reviewed changes

Copilot reviewed 14 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
regimes/regimes.go Registers the new KR regime via blank import.
regimes/kr/kr.go Defines and registers the KR regime (VAT scheme, timezone, corrections, norm/rules wiring).
regimes/kr/tax_categories.go Adds KR VAT category and 10% general rate with sources.
regimes/kr/tax_identity.go Implements KR BRN validation rules + check-digit algorithm hook.
regimes/kr/kr_test.go Regime + invoice calculation/validation tests for KR.
regimes/kr/tax_identity_test.go Normalization + validation tests for KR BRN handling.
regimes/kr/tax_identity_internal_test.go Direct guard-rail test for isValidBRN type assertion behavior.
examples/kr/invoice-kr-standard.yaml Source example for a standard KR invoice.
examples/kr/invoice-kr-zero-rated.yaml Source example for a zero-rated export KR invoice.
examples/kr/credit-note-kr.yaml Source example for a KR credit note (correction).
examples/kr/out/invoice-kr-standard.json Generated output for standard KR invoice example.
examples/kr/out/invoice-kr-zero-rated.json Generated output for zero-rated KR invoice example.
examples/kr/out/credit-note-kr.json Generated output for KR credit note example.
data/schemas/tax/regime-code.json Adds KR to the regime code enum schema.
data/rules/kr.json Generated rules artifact for KR tax identity validation.
data/regimes/kr.json Generated regime definition artifact for KR.
CHANGELOG.md Documents addition of the KR regime.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

regime Related to a specific regime.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants