diff --git a/services/payment/src/EShopOnAbp.PaymentService.Application.Contracts/PaymentMethods/IPaymentMethodAppService.cs b/services/payment/src/EShopOnAbp.PaymentService.Application.Contracts/PaymentMethods/IPaymentMethodAppService.cs new file mode 100644 index 00000000..eb7177af --- /dev/null +++ b/services/payment/src/EShopOnAbp.PaymentService.Application.Contracts/PaymentMethods/IPaymentMethodAppService.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; + +namespace EShopOnAbp.PaymentService.PaymentMethods; + +public interface IPaymentMethodAppService : IApplicationService +{ + Task> GetListAsync(); +} diff --git a/services/payment/src/EShopOnAbp.PaymentService.Application.Contracts/PaymentMethods/PaymentMethodDto.cs b/services/payment/src/EShopOnAbp.PaymentService.Application.Contracts/PaymentMethods/PaymentMethodDto.cs new file mode 100644 index 00000000..93ba6ceb --- /dev/null +++ b/services/payment/src/EShopOnAbp.PaymentService.Application.Contracts/PaymentMethods/PaymentMethodDto.cs @@ -0,0 +1,6 @@ +namespace EShopOnAbp.PaymentService.PaymentMethods; + +public class PaymentMethodDto +{ + public string PaymentType { get; set; } +} \ No newline at end of file diff --git a/services/payment/src/EShopOnAbp.PaymentService.Application/PaymentMethods/PaymentMethodAppService.cs b/services/payment/src/EShopOnAbp.PaymentService.Application/PaymentMethods/PaymentMethodAppService.cs new file mode 100644 index 00000000..f787fb82 --- /dev/null +++ b/services/payment/src/EShopOnAbp.PaymentService.Application/PaymentMethods/PaymentMethodAppService.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EShopOnAbp.PaymentService.PaymentMethods; + +public class PaymentMethodAppService : PaymentServiceAppService, IPaymentMethodAppService +{ + private readonly IEnumerable _paymentMethods; + + public PaymentMethodAppService(IEnumerable paymentMethods) + { + this._paymentMethods = paymentMethods; + } + + public Task> GetListAsync() + { + return Task.FromResult( + _paymentMethods + .Select(p => new PaymentMethodDto { PaymentType = p.PaymentType }) + .ToList() + ); + } +} diff --git a/services/payment/src/EShopOnAbp.PaymentService.HttpApi/Controllers/PaymentMethodController.cs b/services/payment/src/EShopOnAbp.PaymentService.HttpApi/Controllers/PaymentMethodController.cs new file mode 100644 index 00000000..9a805315 --- /dev/null +++ b/services/payment/src/EShopOnAbp.PaymentService.HttpApi/Controllers/PaymentMethodController.cs @@ -0,0 +1,25 @@ +using EShopOnAbp.PaymentService.PaymentMethods; +using Microsoft.AspNetCore.Mvc; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp; + +namespace EShopOnAbp.PaymentService.Controllers; + +[RemoteService(Name = PaymentServiceRemoteServiceConsts.RemoteServiceName)] +[Area("payment")] +[Route("api/payment/methods")] +public class PaymentMethodController : PaymentServiceController, IPaymentMethodAppService +{ + protected IPaymentMethodAppService PaymentMethodAppService { get; } + + public PaymentMethodController(IPaymentMethodAppService paymentMethodAppService) + { + PaymentMethodAppService = paymentMethodAppService; + } + + public Task> GetListAsync() + { + return PaymentMethodAppService.GetListAsync(); + } +}