Example #1
0
        public IActionResult CheckService()
        {
            var    reader      = new StreamReader(Request.Body);
            var    body        = reader.ReadToEnd();
            string jsonContent = body;

            var root       = JArray.Parse(jsonContent);
            var firstChild = JArray.Parse(root[0].ToString());
            var fields     = root[1].ToString();

            dynamic jdata = JObject.Parse(firstChild[0].ToString());

            string jSKU = jdata.SKU;

            string[] SKU = ExtensionMethods.ExtSKU.SeparateSku(jSKU);

            Conexion_Config cnx      = null;
            ResponseService response = null;

            var lsFields = JsonConvert.DeserializeObject <List <Field> >(fields);


            int id_credentials = 0;

            switch (SKU[0])
            {
            case "DT":
                id_credentials = 1;
                break;

            case "TN":
                id_credentials = 2;
                break;
            }
            cnx = _context.conexion_Configs.Find(id_credentials);
            var credentials = new PaymentsService(cnx.Url, cnx.Usr, cnx.Pwd, cnx.CrypKey);

            credentials.Config(7, 1, 1, 1);
            response = credentials.Check(lsFields);
            return(Ok(response));
        }