Style: C# 12 Primary constructor
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
namespace Hutopy.Application.Stripe.Commands;
|
||||
public record CreateSessionCheckoutCommand : IRequest<string>
|
||||
public abstract record CreateSessionCheckoutCommand : IRequest<string>
|
||||
{
|
||||
public required int Price { get; init; }
|
||||
|
||||
@@ -10,21 +10,16 @@ public record CreateSessionCheckoutCommand : IRequest<string>
|
||||
}
|
||||
|
||||
|
||||
public class CreateSessionCheckoutCommandHandler : IRequestHandler<CreateSessionCheckoutCommand, string>
|
||||
public class CreateSessionCheckoutCommandHandler(
|
||||
IApplicationDbContext context,
|
||||
IStripeService stripeService)
|
||||
: IRequestHandler<CreateSessionCheckoutCommand, string>
|
||||
{
|
||||
private readonly IApplicationDbContext _context;
|
||||
private readonly IStripeService _stripeService;
|
||||
|
||||
|
||||
public CreateSessionCheckoutCommandHandler(IApplicationDbContext context, IStripeService stripeService)
|
||||
{
|
||||
_context = context;
|
||||
_stripeService = stripeService;
|
||||
}
|
||||
|
||||
private readonly IApplicationDbContext _context = context;
|
||||
|
||||
public async Task<string> Handle(CreateSessionCheckoutCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var stripeSecret = await _stripeService.CreateCheckoutSession(request.Price, request.Currency);
|
||||
var stripeSecret = await stripeService.CreateCheckoutSession(request.Price, request.Currency);
|
||||
|
||||
return stripeSecret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user