-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add support for SwedishCompanyRegistrationNumber #12
Comments
I would like to get started on this, so we need to put some thought into the api. Individual firmsOne special usecase is numbers for “enskild firma” (individual firm/enterprise/ sole proprietor?) where the number is the same as the individual’s personal identity number. 12 digit numbersWhat’s the deal with these? We need to be able to parse them? Is there a clear 1 to 1 relationship between 12- and 10-digit numbers? Are we guaranteed to be able to map between them? HintsI am ok to leave these out-of-scope for the first version. Unified apiI.e. an additional parse-method that returns a PersonalIdentityNumber or a CompanyRegistrationNumber could be useful, but should probably be discussed in its’ own issue. |
After some offline discussions we reached the following conclusions:
|
Here is a proposed class structure. Almost identitcal as for personal identity number, but with the addition of public class SwedishCompanyRegistrationNumber
{
public SwedishCompanyRegistrationNumber(int x, int y, int z, int q, int checksum) { }
public int X { get; set; } //TODO: Find proper name
public int Y { get; set; } //TODO: Find proper name
public int Z { get; set; } //TODO: Find proper name
public int Q { get; set; } //TODO: Find proper name
public int Checksum { get; set; }
public SwedishCompanyRegistrationNumber ParseInSpecificYear(string s, int year) { }
public SwedishCompanyRegistrationNumber Parse(string s) { }
public bool TryParseInSpecificYear(string s, int year, out SwedishCompanyRegistrationNumber parseResult) { }
public bool TryParse(string s, out SwedishCompanyRegistrationNumber parseResult) { }
public string To10DigitStringInSpecificYear(int serializationYear) { }
public string To10DigitString() { }
public string To12DigitString() { }
public string ToVatString() { }
public string ToString() { }
public bool Equals(object b) { }
public int GetHashCode() { }
public static bool operator ==(SwedishCompanyRegistrationNumber a, SwedishCompanyRegistrationNumber b) { }
} We need to decide what the indivudual parts should be named. Year/Month/Day/Birthnumber only applies for "enksild firma", so that is not correct. Also, we need to figure out if an "Enskild firma" ever can contain a + as delmiter. I have not so far been able to find any info on this subject. A full 12 digit version of the SwedishCompanyRegistrationNumber will contain the full year, so then it's not a problem, but when displayed as 10 digit or parsed as 10 digit it can be. |
Some findings that we (probably) have to handle:
|
All texts I find for “Enskild firma” states that you use the owner’s personal identity number. Therefore I draw the conclusion that the same rules must apply, i.e. plus is a valid delimiter, however unlikely that situation might be. I realize that we will need the ...InSpecificYear overloads but I do not like them. If would like to propose an alternative api for that use case: |
I have seen the suffixes before could not figure out what they meant. Great find! We should support this. But I think we should treat them as suffixes and still name our methods to12digitstring and let it return a 12digitstring + suffix. If a number has a suffix it is invalid to return it without a suffix. I agree we need to do Coordination number first now. We need to find more information on letters in registration numbers. The number in your link: OC34875 looks like another type of number completely. |
Swedish companies all have a unique number (Organisationsnummer), called company registration number, that is used for taxes and similiar places when you need to identify a company.
As it's a common usecase and an implementation would be very similar to a
PersonalIdentityNumber
we aim to implement this.Info and definitions:
The text was updated successfully, but these errors were encountered: