30 lines
1.1 KiB
C#
30 lines
1.1 KiB
C#
// src/Webshop.Api/Controllers/Public/PaymentMethodsController.cs
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Webshop.Application.DTOs.Payments; // PaymentMethodDto
|
|
using Webshop.Application.Services.Public; // IPaymentMethodService
|
|
|
|
namespace Webshop.Api.Controllers.Public
|
|
{
|
|
[ApiController]
|
|
[Route("api/v1/public/[controller]")] // Saubere Route
|
|
[AllowAnonymous] // Jeder darf die verfügbaren Zahlungsmethoden sehen
|
|
public class PaymentMethodsController : ControllerBase
|
|
{
|
|
private readonly IPaymentMethodService _paymentMethodService;
|
|
|
|
public PaymentMethodsController(IPaymentMethodService paymentMethodService)
|
|
{
|
|
_paymentMethodService = paymentMethodService;
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<ActionResult<IEnumerable<PaymentMethodDto>>> GetActivePaymentMethods()
|
|
{
|
|
var paymentMethods = await _paymentMethodService.GetAllActiveAsync();
|
|
return Ok(paymentMethods);
|
|
}
|
|
}
|
|
} |