using SinochemCloudClient.Models;
using SinochemPosClient.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using System.Windows.Forms;

namespace CloudSimulator.Controllers
{
    public class PosController : ApiController
    {
        CloudForm cloudForm = (CloudForm)Application.OpenForms["CloudForm"];
              
        [Route("pay/iotNotify")]
        [HttpPost]
        public TrxNotificationResponse PosNotify([FromBody] TrxNotificationRequest request)
        {
            cloudForm.AppendTextThreadSafe(Environment.NewLine + "Pos notify request:");
            cloudForm.AppendTextThreadSafe(request.ToString());

            TrxNotificationResponse response = new TrxNotificationResponse
            {
                status = TrxNotificationResponse.SuccessResponse
            };

            cloudForm.AppendTextThreadSafe(Environment.NewLine + "Pos notify response:");
            cloudForm.AppendTextThreadSafe(response.ToString());

            return response;
        }

    
    }
}