payment
This commit is contained in:
30
Webshop.Api/Controllers/Public/PaymentMethodsController.cs
Normal file
30
Webshop.Api/Controllers/Public/PaymentMethodsController.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
// 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/paymentmethods")] // 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user