-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding TIN algorithms #400
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #400 +/- ##
========================================
Coverage 78.88% 78.89%
========================================
Files 217 223 +6
Lines 10722 10967 +245
========================================
+ Hits 8458 8652 +194
- Misses 1909 1945 +36
- Partials 355 370 +15 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lot's going on here... we need consistency on naming, and I'd also try to standardise on using type codes instead of keys for local identities.
Also, patch test coverage IS NOT 90%!
@@ -50,7 +52,10 @@ func Validate(doc any) error { | |||
return validateInvoice(obj) | |||
case *tax.Identity: | |||
return validateTaxIdentity(obj) | |||
case *org.Identity: | |||
return validateTaxNumber(obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be:
return validateTaxNumber(obj) | |
return validateIdentity(obj) |
// people that can be included on invoices inside Austria. For international | ||
// sales, the registered VAT number (Umsatzsteueridentifikationsnummer) should | ||
// be used instead. | ||
IdentityKeyTaxNumber cbc.Key = "at-tax-number" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking that these should be Identity types also, in this case ChatGTP suggests STNR
. The same could also be applied to Germany (but we don't want to do that yet!)
}, | ||
} | ||
|
||
func normalizeTaxNumber(id *org.Identity) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There needs to be a generic normalize method. Naming also needs to be consistent, so this should be normalizeIdentity
.
} | ||
|
||
// validateNino validates the normalized National Insurance Number (NINO). | ||
func validateNino(value interface{}) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd stick to the validateIdentity
convention and check the type.
return nil | ||
} | ||
|
||
if id.Type == IdentityTypeNINO { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switches are always clearer in these circumstances.
@@ -72,6 +74,8 @@ func Validate(doc interface{}) error { | |||
return validateTaxIdentity(obj) | |||
case *bill.Invoice: | |||
return validateInvoice(obj) | |||
case *org.Identity: | |||
return validateTaxNumber(obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return validateTaxNumber(obj) | |
return validateIdentity(obj) |
{ | ||
Value: IdentityTypePESEL.String(), | ||
Name: i18n.String{ | ||
i18n.EN: "Tax Number", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this name needs to be a bit more descriptive.
Describe your changes
I added TINs algorithms in identities for Austria, France, Great Britain and Poland and I have created a first version of the regime in Ireland.
Checklist before requesting a review
go generate .
to ensure that Schemas and Regime data are up to date.