2023-03-19 17:57:55 +00:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
2017-05-24 23:36:49 +02:00
|
|
|
using Newtonsoft.Json;
|
2017-05-05 23:37:07 +02:00
|
|
|
using Yavsc.Helpers;
|
|
|
|
|
using Yavsc.Models;
|
|
|
|
|
|
|
|
|
|
namespace Yavsc.ApiControllers
|
|
|
|
|
{
|
2026-08-20 20:50:52 +01:00
|
|
|
[Route(Constants.APIPrefix + "/payment")]
|
2017-05-05 23:37:07 +02:00
|
|
|
public class PaymentApiController : Controller
|
|
|
|
|
{
|
2020-10-09 19:35:39 +01:00
|
|
|
private readonly ApplicationDbContext dbContext;
|
|
|
|
|
private readonly SiteSettings siteSettings;
|
2017-05-05 23:37:07 +02:00
|
|
|
private readonly ILogger _logger;
|
|
|
|
|
public PaymentApiController(
|
|
|
|
|
ApplicationDbContext dbContext,
|
|
|
|
|
IOptions<SiteSettings> siteSettingsReceiver,
|
|
|
|
|
ILoggerFactory loggerFactory)
|
|
|
|
|
{
|
|
|
|
|
this.dbContext = dbContext;
|
|
|
|
|
siteSettings = siteSettingsReceiver.Value;
|
|
|
|
|
_logger = loggerFactory.CreateLogger<PaymentApiController>();
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-24 23:36:49 +02:00
|
|
|
public async Task<IActionResult> Info(string paymentId, string token)
|
2017-05-12 12:15:57 +02:00
|
|
|
{
|
2017-05-24 23:36:49 +02:00
|
|
|
var details = await dbContext.GetCheckoutInfo(token);
|
|
|
|
|
_logger.LogInformation(JsonConvert.SerializeObject(details));
|
|
|
|
|
return Ok(details);
|
2017-05-12 16:29:47 +02:00
|
|
|
}
|
2017-05-05 23:37:07 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|