32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using Fitness_core_BE.DTOs.PlatformBilling;
|
|
using Fitness_core_BE.Helpers;
|
|
using Fitness_core_BE.Interfaces.Services;
|
|
using Fitness_core_BE.Models.IOs;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using static Fitness_core_BE.Helpers.ApiResponseHelper;
|
|
|
|
namespace Fitness_core_BE.Controllers
|
|
{
|
|
// Trusted-machine-caller surface for the scheduled subscription-billing worker — not a
|
|
// human/agent session, so it's gated by RequireWorkerKeyAttribute (X-Worker-Key) instead
|
|
// of CustomMiddleware/JwtMiddleware.
|
|
[ApiController]
|
|
[Route("api/internal/billing")]
|
|
[RequireWorkerKey]
|
|
public class WorkerBillingController : ControllerBase
|
|
{
|
|
private readonly IPlatformBillingService _platformBilling;
|
|
|
|
public WorkerBillingController(IPlatformBillingService platformBilling)
|
|
{
|
|
_platformBilling = platformBilling;
|
|
}
|
|
|
|
[HttpPost("run-subscription-charges")]
|
|
public async Task<ActionResult<ApiResponse<SubscriptionChargeRunResult>>> RunSubscriptionCharges()
|
|
{
|
|
return Response(await _platformBilling.RunAndChargeSubscriptionBillingAsync(HttpContext.RequestAborted));
|
|
}
|
|
}
|
|
}
|