| 123456789101112131415161718192021222324252627282930313233343536373839 |
- using System.Security.Claims;
- using System.Text.Json.Serialization;
- using Application.Abstractions.Messaging;
- using Web.Api.Common;
- using Web.Api.Extensions;
- namespace Web.Api.Endpoints.Paper;
- public sealed class PaperDepositRequest
- {
- [JsonPropertyName("tokenAmount")]
- public decimal TokenAmount { get; set; }
- }
- /// <summary>모의투자 — 입금 (지갑 토큰 → 계좌).</summary>
- internal sealed class Deposit : IEndpoint
- {
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- app.MapPost("api/paper/account/deposit", async (
- PaperDepositRequest body,
- ClaimsPrincipal user,
- ISender sender,
- CancellationToken ct
- ) => {
- var memberID = user.GetRequiredMemberID();
- var result = await sender.Send(new Application.Features.Api.Paper.Deposit.Command(memberID, body.TokenAmount), ct);
- if (result.IsFailure)
- {
- return CustomResults.Problem(result);
- }
- return ApiResponse.Ok(result.Value);
- })
- .WithTags("Paper")
- .RequireAuthorization();
- }
- }
|