Esempio n. 1
0
        public IActionResult Put(string SKU, string Reference)
        {
            int id_credentials = 0;

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

            case "TN":
                id_credentials = 2;
                break;
            }

            if (id_credentials == 0)
            {
                return(NotFound(""));
            }
            var             cnx     = _context.conexion_Configs.Find(id_credentials);
            PaymentsService Payment = new PaymentsService(cnx.Url, cnx.Usr, cnx.Pwd, cnx.CrypKey);

            Payment.Config(7, 1, 1, 1);

            var fields = Payment.PaymentInfo(SKU.Split("-")[1].ToString(), Reference);

            return(Ok(fields));
        }
        public IActionResult Info(string SKU, string Reference)
        {
            //    int service = 0;

            //    switch (SKU.Split('-')[0].ToString())
            //    {
            //        case "DT":
            //            service = 1;
            //            break;
            //        case "TN":
            //            service = 2;
            //            break;
            //    }

            //    if (service == 0)
            //    {
            //        return NotFound();
            //    }

            var cnx = _context.conexion_Configs.Find(1);

            var Payments = new PaymentsService(cnx.Url, cnx.Usr, cnx.Pwd, cnx.CrypKey);

            Payments.Config(7, 1, 1, 1);

            var fields = Payments.PaymentInfo(SKU.Split('-')[1].ToString(), Reference);


            return(Ok(fields));
        }
Esempio n. 3
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));
        }
        public IActionResult Ejecuta()
        {
            var dt     = new Class_DT();
            var reader = new StreamReader(Request.Body);
            var body   = reader.ReadToEnd();

            body = dt.ReplaceFrom(body);
            var root = JArray.Parse(body);

            var          cnx    = _context.conexion_Configs.Find(1);
            List <Field> fields = null;

            fields = JsonConvert.DeserializeObject <List <Field> >(root[0].ToString());

            var payments = new PaymentsService(cnx.Url, cnx.Usr, cnx.Pwd, cnx.CrypKey);

            payments.Config(7, 1, 1, 1, 1);

            var response = payments.Request(fields);

            return(Ok(response));
        }