-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(registry): patch Finland bank code to 6 digits (#257)
- Loading branch information
Showing
4 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/IbanNet.CodeGen/Swift/Patches/9_FinlandBankCodePatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace IbanNet.CodeGen.Swift.Patches; | ||
|
||
internal sealed class _9_FinlandBankCodePatch : RecordPatcher | ||
{ | ||
protected override SwiftCsvRecord Apply(SwiftCsvRecord record) | ||
{ | ||
switch (record) | ||
{ | ||
case { CountryCode: "FI" }: | ||
record.Bban.Pattern = "6!n8!n"; | ||
record.Bban.Example = "12345600000785"; | ||
record.Bank.Pattern = "6!n"; | ||
record.Bank.Example = "123456"; | ||
|
||
return record; | ||
|
||
default: | ||
return record; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using IbanNet.Registry; | ||
|
||
namespace IbanNet.Issues; | ||
|
||
public sealed class _224_FinlandBankCode | ||
{ | ||
[Theory] | ||
[InlineData("FI4017453000182859", "174530")] | ||
[InlineData("FI2840554920113105", "405549")] | ||
public void When_extracting_bank_code_it_should_return_expected(string ibanStr, string expectedBankCode) | ||
{ | ||
var ibanParser = new IbanParser(IbanRegistry.Default); | ||
|
||
// Act | ||
bool isValid = ibanParser.TryParse(ibanStr, out Iban? iban); | ||
|
||
// Assert | ||
isValid.Should().BeTrue(); | ||
iban!.BankIdentifier.Should().Be(expectedBankCode); | ||
} | ||
} |