-
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.
- Loading branch information
Showing
11 changed files
with
220 additions
and
1 deletion.
There are no files selected for viewing
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,35 @@ | ||
`IbanNet.DataAnnotations` provides an attribute allowing validation of IBAN user input with ASP.NET (Core) and Microsoft Data Annotations. | ||
|
||
## Example | ||
|
||
```csharp | ||
public class InputModel | ||
{ | ||
[Iban] | ||
[Required] | ||
public string BackAccountNumber { get; set; } | ||
} | ||
|
||
[ApiController] | ||
public class MyController : ControllerBase | ||
{ | ||
[HttpPost] | ||
public ActionResult Save(InputModel model) | ||
{ | ||
if (ModelState.IsValid) | ||
{ | ||
// .. | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Other info | ||
|
||
- [Changelog](https://github.com/skwasjer/IbanNet/blob/master/CHANGELOG.md) | ||
- [IbanNet supported countries](https://github.com/skwasjer/IbanNet/blob/master/SupportedCountries.md) | ||
- [Fiddle](https://dotnetfiddle.net/JeGa9x) | ||
|
||
### Contributions | ||
|
||
Please check out the [contribution guidelines](https://github.com/skwasjer/IbanNet/blob/master/CONTRIBUTING.md). |
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,37 @@ | ||
Autofac IoC container integration for IbanNet; [IbanNet](https://github.com/skwasjer/IbanNet) provides an IBAN validator and parser. | ||
|
||
## Available services | ||
|
||
This library registers the following services: | ||
|
||
- `IIbanValidator` | ||
- `IIbanGenerator` | ||
- `IIbanParser` | ||
|
||
## Example | ||
|
||
Register IbanNet services: | ||
|
||
```csharp | ||
container.RegisterIbanNet(); | ||
``` | ||
|
||
Or register IbanNet services with configuration: | ||
|
||
```csharp | ||
container | ||
.RegisterIbanNet(opts => opts | ||
.UseRegistryProvider(new SwiftRegistryProvider()) | ||
.WithRule<MyCustomRule>() | ||
); | ||
``` | ||
|
||
## Other info | ||
|
||
- [Changelog](https://github.com/skwasjer/IbanNet/blob/master/CHANGELOG.md) | ||
- [IbanNet supported countries](https://github.com/skwasjer/IbanNet/blob/master/SupportedCountries.md) | ||
- [Fiddle](https://dotnetfiddle.net/JeGa9x) | ||
|
||
### Contributions | ||
|
||
Please check out the [contribution guidelines](https://github.com/skwasjer/IbanNet/blob/master/CONTRIBUTING.md). |
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,37 @@ | ||
`Microsoft.Extensions.DependencyInjection` integration for IbanNet; [IbanNet](https://github.com/skwasjer/IbanNet) provides an IBAN validator and parser. | ||
|
||
## Available services | ||
|
||
This library registers the following services: | ||
|
||
- `IIbanValidator` | ||
- `IIbanGenerator` | ||
- `IIbanParser` | ||
|
||
## Example | ||
|
||
Add IbanNet services: | ||
|
||
```csharp | ||
services.AddIbanNet(); | ||
``` | ||
|
||
Or add IbanNet services with configuration: | ||
|
||
```csharp | ||
services | ||
.AddIbanNet(opts => opts | ||
.UseRegistryProvider(new SwiftRegistryProvider()) | ||
.WithRule<MyCustomRule>() | ||
); | ||
``` | ||
|
||
## Other info | ||
|
||
- [Changelog](https://github.com/skwasjer/IbanNet/blob/master/CHANGELOG.md) | ||
- [IbanNet supported countries](https://github.com/skwasjer/IbanNet/blob/master/SupportedCountries.md) | ||
- [Fiddle](https://dotnetfiddle.net/JeGa9x) | ||
|
||
### Contributions | ||
|
||
Please check out the [contribution guidelines](https://github.com/skwasjer/IbanNet/blob/master/CONTRIBUTING.md). |
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,41 @@ | ||
FluentValidation support to validate IBAN user input. | ||
|
||
## Example | ||
|
||
Create a rule for a property and call the `Iban(IIbanValidator)` extension method to enable the validator. | ||
|
||
```csharp | ||
public class InputModel | ||
{ | ||
public string BackAccountNumber { get; set; } | ||
} | ||
|
||
public class InputModelValidator : AbstractValidator<InputModel> | ||
{ | ||
public InputModelValidator(IIbanValidator ibanValidator) | ||
{ | ||
RuleFor(x => x.BankAccountNumber).NotNull().Iban(ibanValidator); | ||
} | ||
} | ||
``` | ||
|
||
Prerequisite service registration (.NET Core) of IbanNet. | ||
|
||
```csharp | ||
services.AddIbanNet(); | ||
services.AddTransient<IValidator<InputModel>, InputModelValidator>() | ||
services.AddFluentValidation(); | ||
``` | ||
|
||
For more information on how to register FluentValidation and custom abstract validators: | ||
https://docs.fluentvalidation.net/en/latest/aspnet.html | ||
|
||
## Other info | ||
|
||
- [Changelog](https://github.com/skwasjer/IbanNet/blob/master/CHANGELOG.md) | ||
- [IbanNet supported countries](https://github.com/skwasjer/IbanNet/blob/master/SupportedCountries.md) | ||
- [Fiddle](https://dotnetfiddle.net/JeGa9x) | ||
|
||
### Contributions | ||
|
||
Please check out the [contribution guidelines](https://github.com/skwasjer/IbanNet/blob/master/CONTRIBUTING.md). |
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,39 @@ | ||
IbanNet is a .NET library providing functionality to validate and parse an [International Bank Account Number](https://en.wikipedia.org/wiki/International_Bank_Account_Number) also known as IBAN. | ||
|
||
Additionally, IbanNet provides: | ||
- the `Iban` primitive type, which can be used as a drop in replacement for a `string` in your domain. | ||
- a builder to construct IBAN's from a Basic Bank Account Number (BBAN). | ||
- a generator to assist with (unit) testing. | ||
|
||
## Example with validator | ||
|
||
```csharp | ||
IIbanValidator validator = new IbanValidator(); | ||
ValidationResult validationResult = validator.Validate("NL91 ABNA 0417 1643 00"); | ||
if (validationResult.IsValid) | ||
{ | ||
// .. | ||
} | ||
``` | ||
|
||
## Example with `Iban` type | ||
|
||
```csharp | ||
Iban iban; | ||
IIbanParser parser = new IbanParser(IbanRegistry.Default); | ||
bool success = parser.TryParse("NL91 ABNA 0417 1643 00", out iban); | ||
if (success) | ||
{ | ||
Console.WriteLine(iban.ToString(IbanFormat.Obfuscated)); // XXXXXXXXXXXXXX4300 | ||
} | ||
``` | ||
|
||
## Other info | ||
|
||
- [Changelog](https://github.com/skwasjer/IbanNet/blob/master/CHANGELOG.md) | ||
- [IbanNet supported countries](https://github.com/skwasjer/IbanNet/blob/master/SupportedCountries.md) | ||
- [Fiddle](https://dotnetfiddle.net/JeGa9x) | ||
|
||
### Contributions | ||
|
||
Please check out the [contribution guidelines](https://github.com/skwasjer/IbanNet/blob/master/CONTRIBUTING.md). |