using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MS.Services;
using MS.Services.PosTrxService;
using MS.WebCore.Core;
using System;
using System.Threading.Tasks;

namespace MS.WebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class TransactionStatusController : ControllerBase
    {
        private readonly IPosTrxService _PosTrxService;
        public TransactionStatusController(IPosTrxService posTrxService)
        {
            _PosTrxService = posTrxService;
        }
        [Route("GetTransactionStatus")]
        [EnableCors("AllowSpecificOrigin")]
        [HttpPost]
        public async Task<ExecuteResult> GetTransactionStatus(string SeqNo, string NozzleId, string sn,string token,string FuelItemFdcReleaseTokenAttribute = "",string FuelItemOriginalGrossAmount = "",DateTime? FuelItemTransactionEndTime = null)
        {
            if (token != "123456789")
            {
                return null;
            }
            return await _PosTrxService.GetTransactionStatus( SeqNo,  NozzleId,  sn, FuelItemFdcReleaseTokenAttribute, FuelItemOriginalGrossAmount, FuelItemTransactionEndTime);
        }
    }
}
