| 12345678910111213141516171819202122232425262728 |
- using Web.Api.Common;
- using Web.Api.Extensions;
- using MediatR;
- using System.Security.Claims;
- namespace Web.Api.Endpoints.Payment;
- /// <summary>결제 취소</summary>
- internal sealed class Cancel : IEndpoint
- {
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- /// 결제 취소 (Paid 상태만 가능) → 다날 취소 API + 지갑 차감
- app.MapPost("api/payment/cancel", async (
- Application.Features.Api.Payment.Cancel.Command body,
- ClaimsPrincipal user,
- ISender sender,
- CancellationToken ct
- ) => {
- var memberID = user.GetRequiredMemberID();
- var command = body with { MemberID = memberID };
- await sender.Send(command, ct);
- return ApiResponse.Ok();
- })
- .WithTags("Payment")
- .RequireAuthorization();
- }
- }
|