Browse Source

Create PaymentRequestController.cs

pull/17/head
enisn 5 years ago
parent
commit
d6fe9186f8
  1. 50
      services/payment/src/EShopOnAbp.PaymentService.HttpApi/Controllers/PaymentRequestController.cs

50
services/payment/src/EShopOnAbp.PaymentService.HttpApi/Controllers/PaymentRequestController.cs

@ -0,0 +1,50 @@
using EShopOnAbp.PaymentService.PaymentRequests;
using Microsoft.AspNetCore.Mvc;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
namespace EShopOnAbp.PaymentService.Controllers
{
[RemoteService(Name = PaymentServiceRemoteServiceConsts.RemoteServiceName)]
[Area("payment")]
[Route("api/payment/requests")]
public class PaymentRequestController : PaymentServiceController, IPaymentRequestAppService
{
protected IPaymentRequestAppService PaymentRequestAppService { get; }
public PaymentRequestController(IPaymentRequestAppService paymentRequestAppService)
{
PaymentRequestAppService = paymentRequestAppService;
}
[HttpPost("complete")]
public Task<PaymentRequestDto> CompleteAsync(string token)
{
return PaymentRequestAppService.CompleteAsync(token);
}
[HttpPost]
public Task<PaymentRequestDto> CreateAsync(PaymentRequestCreationDto input)
{
return PaymentRequestAppService.CreateAsync(input);
}
[HttpPost]
[Route("webhook")]
public async Task<bool> HandleWebhookAsync(string payload)
{
var bytes = await Request.Body.GetAllBytesAsync();
payload = Encoding.UTF8.GetString(bytes);
return await PaymentRequestAppService.HandleWebhookAsync(payload);
}
[HttpPost("start")]
public Task<PaymentRequestStartResultDto> StartAsync(PaymentRequestStartDto input)
{
return PaymentRequestAppService.StartAsync(input);
}
}
}
Loading…
Cancel
Save