Skip to content

Commit

Permalink
Inferred parameters are not always recognized correctly (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
wAsnk authored Aug 29, 2024
1 parent 913d7b3 commit 3eb9a9f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public static IEndpointRouteBuilder AddStripeMiddlewareEndpoint(this IEndpointRo
}

private static async Task<IResult> AddStripeMiddlewareAsync(
string? shoppingCartId,
IStripePaymentService stripePaymentService,
[FromRoute] string? shoppingCartId,
[FromServices] IStripePaymentService stripePaymentService,
[FromQuery(Name = "payment_intent")] string? paymentIntent = null
)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public static IEndpointRouteBuilder AddFreeEndpoint(this IEndpointRouteBuilder b

[Authorize(AuthenticationSchemes = "Api")]
private static async Task<IResult> AddFreeAsync(
string? shoppingCartId,
IAuthorizationService authorizationService,
HttpContext httpContext,
IPaymentService paymentService
[FromRoute] string? shoppingCartId,
[FromServices] IAuthorizationService authorizationService,
[FromServices] HttpContext httpContext,
[FromServices] IPaymentService paymentService
)
{
if (!await authorizationService.AuthorizeAsync(httpContext.User, ApiPermissions.CommerceApi))
Expand All @@ -49,12 +49,12 @@ public static IEndpointRouteBuilder AddCallbackEndpoint(this IEndpointRouteBuild

[Authorize(AuthenticationSchemes = "Api")]
private static async Task<IResult> AddCallbackAsync(
string paymentProviderName,
string? orderId,
[FromRoute] string paymentProviderName,
[FromRoute] string? orderId,
[FromQuery] string? shoppingCartId,
IAuthorizationService authorizationService,
HttpContext httpContext,
IPaymentService paymentService
[FromServices] IAuthorizationService authorizationService,
[FromServices] HttpContext httpContext,
[FromServices] IPaymentService paymentService
)
{
if (!await authorizationService.AuthorizeAsync(httpContext.User, ApiPermissions.CommerceApi))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public static IEndpointRouteBuilder AddAddItemEndpoint(this IEndpointRouteBuilde
[Authorize(AuthenticationSchemes = "Api")]
private static async Task<IResult> AddItemAsync(
[FromBody] AddItemViewModel addItemVM,
IAuthorizationService authorizationService,
HttpContext httpContext,
IShoppingCartService shoppingCartService,
IHtmlLocalizer<AddItemViewModel> htmlLocalizer
[FromServices] IAuthorizationService authorizationService,
[FromServices] HttpContext httpContext,
[FromServices] IShoppingCartService shoppingCartService,
[FromServices] IHtmlLocalizer<AddItemViewModel> htmlLocalizer
)
{
if (!await authorizationService.AuthorizeAsync(httpContext.User, ApiPermissions.CommerceApi))
Expand Down Expand Up @@ -67,10 +67,10 @@ public static IEndpointRouteBuilder AddUpdateEndpoint(this IEndpointRouteBuilder
[Authorize(AuthenticationSchemes = "Api")]
private static async Task<IResult> UpdateAsync(
[FromBody] UpdateViewModel updateVM,
IAuthorizationService authorizationService,
HttpContext httpContext,
IShoppingCartService shoppingCartService,
IHtmlLocalizer<UpdateViewModel> htmlLocalizer
[FromServices] IAuthorizationService authorizationService,
[FromServices] HttpContext httpContext,
[FromServices] IShoppingCartService shoppingCartService,
[FromServices] IHtmlLocalizer<UpdateViewModel> htmlLocalizer
)
{
if (!await authorizationService.AuthorizeAsync(httpContext.User, ApiPermissions.CommerceApi))
Expand Down Expand Up @@ -105,10 +105,10 @@ public static IEndpointRouteBuilder AddRemoveLineEndpoint(this IEndpointRouteBui
[Authorize(AuthenticationSchemes = "Api")]
private static async Task<IResult> RemoveLineAsync(
[FromBody] RemoveLineViewModel removeLineVM,
IAuthorizationService authorizationService,
HttpContext httpContext,
IShoppingCartService shoppingCartService,
IHtmlLocalizer<RemoveLineViewModel> htmlLocalizer
[FromServices] IAuthorizationService authorizationService,
[FromServices] HttpContext httpContext,
[FromServices] IShoppingCartService shoppingCartService,
[FromServices] IHtmlLocalizer<RemoveLineViewModel> htmlLocalizer
)
{
if (!await authorizationService.AuthorizeAsync(httpContext.User, ApiPermissions.CommerceApi))
Expand Down Expand Up @@ -143,10 +143,10 @@ public static IEndpointRouteBuilder AddRetrieveAsyncEndpoint(this IEndpointRoute

[Authorize(AuthenticationSchemes = "Api")]
private static async Task<IResult> RetrieveAsync(
string? shoppingCartId,
IAuthorizationService authorizationService,
HttpContext httpContext,
IShoppingCartPersistence shoppingCartPersistence
[FromRoute] string? shoppingCartId,
[FromServices] IAuthorizationService authorizationService,
[FromServices] HttpContext httpContext,
[FromServices] IShoppingCartPersistence shoppingCartPersistence
)
{
if (!await authorizationService.AuthorizeAsync(httpContext.User, ApiPermissions.CommerceApi))
Expand Down

0 comments on commit 3eb9a9f

Please sign in to comment.