-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix editorconfig errors * Fix build warnings * Remove "this." from codebase * Fixing build editor suggestions * Enable nullable references in Blazor project * Fix more editor config issues * WIP: Use ModelName -> Request/Response namespaces everywhere * Use ModelName -> Request/Response namespaces everywhere * Remove unused using statements * Fix null reference issues * 11 warnings to go * Add more XML comments and fix all editorconfig warnings * Fix unit test
- Loading branch information
1 parent
ef73b55
commit 104e560
Showing
235 changed files
with
2,121 additions
and
1,944 deletions.
There are no files selected for viewing
10 changes: 6 additions & 4 deletions
10
samples/Mollie.WebApplication.Blazor/Framework/StaticStringListBuilder.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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
using System.Reflection; | ||
|
||
namespace Mollie.WebApplication.Blazor.Framework; | ||
namespace Mollie.WebApplication.Blazor.Framework; | ||
|
||
public static class StaticStringListBuilder { | ||
public static IEnumerable<string> GetStaticStringList(Type type) { | ||
foreach (FieldInfo fieldInfo in type.GetFields(BindingFlags.Static | BindingFlags.Public)) { | ||
string value = fieldInfo.GetValue(null).ToString(); | ||
yield return value; | ||
string? value = fieldInfo.GetValue(null)?.ToString(); | ||
if (value != null) { | ||
yield return value; | ||
} | ||
} | ||
} | ||
} | ||
} |
18 changes: 11 additions & 7 deletions
18
samples/Mollie.WebApplication.Blazor/Framework/Validators/DecimalPlacesAttribute.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
12 changes: 6 additions & 6 deletions
12
samples/Mollie.WebApplication.Blazor/Framework/Validators/StaticStringListAttribute.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 |
---|---|---|
@@ -1,24 +1,24 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Reflection; | ||
|
||
namespace Mollie.WebApplication.Blazor.Framework.Validators; | ||
namespace Mollie.WebApplication.Blazor.Framework.Validators; | ||
|
||
public class StaticStringListAttribute : ValidationAttribute { | ||
private readonly Type _staticClass; | ||
|
||
public StaticStringListAttribute(Type staticClass) { | ||
this._staticClass = staticClass; | ||
_staticClass = staticClass; | ||
} | ||
|
||
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { | ||
IEnumerable<string> validValues = this._staticClass | ||
protected override ValidationResult? IsValid(object? value, ValidationContext validationContext) { | ||
IEnumerable<string?> validValues = _staticClass | ||
.GetFields(BindingFlags.Static | BindingFlags.Public) | ||
.Select(x => x.GetValue(null).ToString()); | ||
.Select(x => x.GetValue(null)?.ToString()); | ||
|
||
if (validValues.Contains(value)) { | ||
return ValidationResult.Success; | ||
} | ||
|
||
return new ValidationResult($"The value \"{value}\" is invalid"); | ||
} | ||
} |
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
10 changes: 5 additions & 5 deletions
10
samples/Mollie.WebApplication.Blazor/Models/Mandate/CreateMandateModel.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Mollie.WebApplication.Blazor.Models.Mandate; | ||
namespace Mollie.WebApplication.Blazor.Models.Mandate; | ||
|
||
public class CreateMandateModel { | ||
[Required] | ||
public string ConsumerName { get; set; } | ||
public required string ConsumerName { get; set; } | ||
|
||
[Required] | ||
public string ConsumerAccount { get; set; } | ||
} | ||
public required string ConsumerAccount { get; set; } | ||
} |
30 changes: 15 additions & 15 deletions
30
samples/Mollie.WebApplication.Blazor/Models/Order/CreateOrderBillingAddressModel.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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Mollie.WebApplication.Blazor.Models.Order; | ||
namespace Mollie.WebApplication.Blazor.Models.Order; | ||
|
||
public class CreateOrderBillingAddressModel { | ||
[Required] | ||
public string GivenName { get; set; } | ||
public required string GivenName { get; set; } | ||
|
||
[Required] | ||
public string FamilyName { get; set; } | ||
public required string FamilyName { get; set; } | ||
|
||
[Required] | ||
[EmailAddress] | ||
public string Email { get; set; } | ||
public required string Email { get; set; } | ||
|
||
[Required] | ||
public string StreetAndNumber { get; set; } | ||
public required string StreetAndNumber { get; set; } | ||
|
||
[Required] | ||
public string City { get; set; } | ||
public required string City { get; set; } | ||
|
||
[Required] | ||
[MaxLength(2)] | ||
public string Country { get; set; } | ||
public required string Country { get; set; } | ||
|
||
[Required] | ||
public string PostalCode { get; set; } | ||
} | ||
public required string PostalCode { get; set; } | ||
} |
12 changes: 6 additions & 6 deletions
12
samples/Mollie.WebApplication.Blazor/Models/Order/CreateOrderLineModel.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 |
---|---|---|
@@ -1,25 +1,25 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
using Mollie.WebApplication.Blazor.Framework.Validators; | ||
|
||
namespace Mollie.WebApplication.Blazor.Models.Order; | ||
namespace Mollie.WebApplication.Blazor.Models.Order; | ||
|
||
public class CreateOrderLineModel { | ||
[Required] | ||
public string Name { get; set; } | ||
public string Name { get; set; } = string.Empty; | ||
|
||
[Required] | ||
[Range(1, 100, ErrorMessage = "Please enter a quantity between 0.01 and 1000")] | ||
public int Quantity { get; set; } | ||
|
||
[Required] | ||
[Range(0.01, 10000, ErrorMessage = "Please enter a unit price between 0.01 and 10000")] | ||
[DecimalPlaces(2)] | ||
public decimal UnitPrice { get; set; } | ||
|
||
public decimal TotalAmount { get; set; } | ||
|
||
[Range(0.01, 100, ErrorMessage = "Please enter a vat rate between 0.01 and 100")] | ||
[DecimalPlaces(2)] | ||
public decimal VatRate { get; set; } | ||
public decimal VatAmount { get; set; } | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
@using Mollie.WebApplication.Blazor.Models.Customer | ||
@using Mollie.Api.Client | ||
@using Mollie.Api.Models.Customer.Request | ||
|
||
@inject ICustomerClient CustomerClient | ||
@inject NavigationManager NavigationManager | ||
|
@@ -36,17 +37,17 @@ | |
</EditForm> | ||
|
||
@code { | ||
private MollieApiException _apiException = null; | ||
private MollieApiException? _apiException; | ||
|
||
private CreateCustomerModel _customer = new() { | ||
Name = "Customer name", | ||
Email = "[email protected]" | ||
}; | ||
|
||
private async Task OnSave() { | ||
try { | ||
_apiException = null; | ||
|
||
await CustomerClient.CreateCustomerAsync(new CustomerRequest() { | ||
Name = _customer.Name, | ||
Email = _customer.Email | ||
|
@@ -58,4 +59,4 @@ | |
_apiException = e; | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.