4 changed files with 65 additions and 0 deletions
@ -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<List<PaymentMethodDto>> GetListAsync(); |
||||
|
} |
||||
@ -0,0 +1,6 @@ |
|||||
|
namespace EShopOnAbp.PaymentService.PaymentMethods; |
||||
|
|
||||
|
public class PaymentMethodDto |
||||
|
{ |
||||
|
public string PaymentType { get; set; } |
||||
|
} |
||||
@ -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<IPaymentMethod> _paymentMethods; |
||||
|
|
||||
|
public PaymentMethodAppService(IEnumerable<IPaymentMethod> paymentMethods) |
||||
|
{ |
||||
|
this._paymentMethods = paymentMethods; |
||||
|
} |
||||
|
|
||||
|
public Task<List<PaymentMethodDto>> GetListAsync() |
||||
|
{ |
||||
|
return Task.FromResult( |
||||
|
_paymentMethods |
||||
|
.Select(p => new PaymentMethodDto { PaymentType = p.PaymentType }) |
||||
|
.ToList() |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -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<List<PaymentMethodDto>> GetListAsync() |
||||
|
{ |
||||
|
return PaymentMethodAppService.GetListAsync(); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue