Skip to content
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

v3.1 #4

Merged
merged 20 commits into from
May 10, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Regenerate supported countries, and list included countries
  • Loading branch information
skwasjer committed May 10, 2019
commit a4a047b8c86003a71c5672f9456650c7201a9213
28 changes: 27 additions & 1 deletion SupportedRegions.md → SupportedCountries.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## IbanNet supports 76 regions
## IbanNet supports 92 countries

| ISO country code | Country | SEPA | Length | IBAN example |
|---|---|---|---|---|
| AD | Andorra | No | 24 | `AD12 0001 2030 2003 5910 0100` |
Expand Down Expand Up @@ -78,4 +79,29 @@
| VG | Virgin Islands | No | 24 | `VG96 VPVG 0000 0123 4567 8901` |
| XK | Kosovo | No | 20 | `XK05 1212 0123 4567 8906` |

### Finland includes:

- Unknown (AX)

### France includes:

- French Guiana (GF)
- Guadeloupe (GP)
- Martinique (MQ)
- Réunion (RE)
- French Polynesia (PF)
- Unknown (TF)
- Mayotte (YT)
- New Caledonia (NC)
- Saint Barthélemy (BL)
- Saint Martin (MF)
- Saint Pierre and Miquelon (PM)
- Wallis and Futuna (WF)

### United Kingdom includes:

- Unknown (IM)
- Unknown (JE)
- Unknown (GG)

For more info visit [Wikipedia](https://en.wikipedia.org/wiki/International_Bank_Account_Number).
42 changes: 35 additions & 7 deletions tools/SupportedRegionsToMarkdown.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Extract supported regions from assembly to update README.md
# Extract supported countries from assembly to update README.md

$scriptPath = (Split-Path $MyInvocation.MyCommand.Path)
$repoPath = Join-Path $scriptPath "..\"
Expand All @@ -23,18 +23,46 @@ Catch
exit
}

$regions = New-Object IbanNet.Registry.IbanRegistry;
$countries = New-Object IbanNet.Registry.IbanRegistry;
$supportedCount = $countries.Count

$markdown = "## IbanNet supports $($regions.Count) regions`r`n"
$markdown = "## IbanNet supports [SUPPORTED_COUNT] countries`r`n`r`n"

$markdown += "| ISO country code | Country | SEPA | Length | IBAN example |`r`n"
$markdown += "|---|---|---|---|---|`r`n"
ForEach($region in $regions)
ForEach($country in $countries)
{
$iban = [IbanNet.Iban]::Parse($region.Iban.Example)
$markdown += "| $($region.TwoLetterISORegionName) | $($region.EnglishName) | $(If ($region.Sepa.IsMember) { "Yes" } else { "No" }) | $($region.Iban.Length) | ``$($iban.ToString("S"))`` |`r`n"
$iban = [IbanNet.Iban]::Parse($country.Iban.Example)
$markdown += "| $($country.TwoLetterISORegionName) | $($country.EnglishName) | $(If ($country.Sepa.IsMember) { "Yes" } else { "No" }) | $($country.Iban.Length) | ``$($iban.ToString("S"))`` |`r`n"
}

ForEach($country in $countries)
{
If ($country.IncludedCountries.Count -gt 0)
{
$supportedCount += $country.IncludedCountries.Count

$markdown += "`r`n"
$markdown += "### $($country.EnglishName) includes:`r`n`r`n"

ForEach($ic in $country.IncludedCountries)
{
$regionInfo = New-Object System.Globalization.RegionInfo($ic)
If ($regionInfo.ThreeLetterISORegionName -eq "ZZZ")
{
# Unknown
$markdown += "- Unknown ($($ic.Substring(3)))`r`n"
}
Else
{
$markdown += "- $($regionInfo.EnglishName) ($($ic.Substring(3)))`r`n"
}
}
}
}

$markdown += "`r`nFor more info visit [Wikipedia](https://en.wikipedia.org/wiki/International_Bank_Account_Number)."

[System.IO.File]::WriteAllLines((Join-Path $repoPath "SupportedRegions.md"), $markdown)
$markdown = $markdown.Replace("[SUPPORTED_COUNT]", $supportedCount)

[System.IO.File]::WriteAllLines((Join-Path $repoPath "SupportedCountries.md"), $markdown)