private string GenLigaPara(string id_company, string id_branch, string user, string pwd, string Referencia, decimal Importe, string moneda, string canal, string promocion, int intCorreo, string Vencimiento, string Correo, string Concepto, string semillaAES, string data0, string urlGen) { string url = string.Empty; string ArchivoXml = "" + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + "<P>\r\n " + " <business>\r\n" + " <id_company>" + id_company + "</id_company>\r\n" + " <id_branch>" + id_branch + "</id_branch>\r\n" + " <user>" + user + "</user>\r\n" + " <pwd>" + pwd + "</pwd>\r\n" + " </business>\r\n" + " <url>\r\n" + " <reference>" + Referencia + "</reference>\r\n" + " <amount>" + Importe + "</amount>\r\n" + " <moneda>" + moneda + "</moneda>\r\n" + " <canal>" + canal + "</canal>\r\n" + " <omitir_notif_default>1</omitir_notif_default>\r\n" + " <promociones>" + promocion + "</promociones>\r\n" + " <st_correo>" + intCorreo + "</st_correo>\r\n" + " <fh_vigencia>" + Vencimiento + "</fh_vigencia>\r\n" + " <mail_cliente>" + Correo + "</mail_cliente>\r\n" + " <datos_adicionales>\r\n" + " <data id=\"1\" display=\"true\">\r\n" + " <label>Concepto:</label>\r\n" + " <value>" + Concepto + "</value>\r\n" + " </data>\r\n" + " <data id=\"2\" display=\"false\">\r\n" + " <label>Color</label>\r\n" + " <value>Azul</value>\r\n" + " </data>\r\n" + " </datos_adicionales>\r\n" + " </url>\r\n" + "</P>\r\n"; string originalString = ArchivoXml; string key = semillaAES; AESCrypto aesCrypto = new AESCrypto(); string encryptedString = aesCrypto.encrypt(originalString, key); string finalString = encryptedString.Replace("%", "%25").Replace(" ", "%20").Replace("+", "%2B").Replace("=", "%3D").Replace("/", "%2F"); string encodedString = HttpUtility.UrlEncode("<pgs><data0>" + data0 + "</data0><data>" + encryptedString + "</data></pgs>"); string postParam = "xml=" + encodedString; var client = new RestClient(urlGen); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("content-type", "application/x-www-form-urlencoded"); request.AddParameter("application/x-www-form-urlencoded", postParam, ParameterType.RequestBody); IRestResponse response = client.Execute(request); var content = response.Content; string decryptedString = aesCrypto.decrypt(key, content); string str1 = decryptedString.Replace("<P_RESPONSE><cd_response>success</cd_response><nb_response></nb_response><nb_url>", ""); url = str1.Replace("</nb_url></P_RESPONSE>", ""); return(url); }
//public PagoTarjeta(string formadepago,string FolioCliente, string FolioPagoTarjeta) public PagoTarjeta(string formadepago, string FolioCliente) { InitializeComponent(); TipoDeFormaDePago = formadepago; for (int i = 0; i < App.MVProducto.ListaDelCarrito.Count; i++) { cantidad += App.MVProducto.ListaDelCarrito[i].Cantidad; decimal a = decimal.Parse(App.MVProducto.ListaDelCarrito[i].StrCosto); } for (int i = 0; i < App.MVProducto.ListaDelInformacionSucursales.Count; i++) { TotalEnvio += App.MVProducto.ListaDelInformacionSucursales[i].CostoEnvio; TotalPagar += App.MVProducto.ListaDelInformacionSucursales[i].Total.ToString("N2"); subtotal += App.MVProducto.ListaDelInformacionSucursales[i].Subtotal; TotalPropina += App.MVProducto.ListaDelInformacionSucursales[i].DPropina; } TotalPagar = (decimal.Parse(TotalPagar) + TotalPropina).ToString("N2"); UidOrden = Guid.NewGuid(); UidOrdenPago = Guid.NewGuid(); App.MVCorreoElectronico.BuscarCorreos(UidPropietario: new Guid(App.Global1), strParametroDebusqueda: "Usuario"); string ArchivoXml = "" + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + "<P>\r\n <business>\r\n" + " <id_company>Z937</id_company>\r\n" + " <id_branch>1050</id_branch>\r\n" + " <user>Z937SDUS1</user>\r\n" + " <pwd>09K1HT91B3</pwd>\r\n" + " </business>\r\n" + " <url>\r\n" + " <reference>" + UidOrdenPago.ToString() + "</reference>\r\n" + " <amount>" + TotalPagar + "</amount>\r\n" + " <moneda>MXN</moneda>\r\n" + " <canal>W</canal>\r\n" + " <omitir_notif_default>1</omitir_notif_default>\r\n" + " <st_correo>1</st_correo>\r\n" + " <mail_cliente>" + App.MVCorreoElectronico.CORREO + "</mail_cliente>\r\n" + " <datos_adicionales>\r\n" + " <data id=\"1\" display=\"false\">\r\n" + " <label>PRINCIPAL</label>\r\n" + " <value>" + FolioCliente + "</value>\r\n" + " </data>\r\n" + " <data id=\"2\" display=\"true\">\r\n" + " <label>Concepto:</label>\r\n" + " <value>Orden en GoDeliverix.</value>\r\n" + " </data>\r\n" + " <data id=\"3\" display=\"false\">\r\n" + " <label>Color</label>\r\n" + " <value>Azul</value>\r\n" + " </data>\r\n" + " </datos_adicionales>\r\n" + " </url>\r\n" + "</P>\r\n"; string originalString = ArchivoXml; string key = "7AACFE849FABD796F6DCB947FD4D5268"; AESCrypto o = new AESCrypto(); string encryptedString = o.encrypt(originalString, key); string finalString = encryptedString.Replace("%", "%25").Replace(" ", "%20").Replace("+", "%2B").Replace("=", "%3D").Replace("/", "%2F"); string encodedString = HttpUtility.UrlEncode("<pgs><data0>9265655113</data0><data>" + encryptedString + "</data></pgs>"); string postParam = "xml=" + encodedString; var client = new RestClient("https://bc.mitec.com.mx/p/gen"); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("content-type", "application/x-www-form-urlencoded"); request.AddParameter("application/x-www-form-urlencoded", postParam, ParameterType.RequestBody); IRestResponse response = client.Execute(request); var content = response.Content; //lblRespuesta.Text = o.decrypt(key, content); string decryptedString = o.decrypt(key, content); string str1 = decryptedString.Replace("<P_RESPONSE><cd_response>success</cd_response><nb_response></nb_response><nb_url>", ""); string url = str1.Replace("</nb_url></P_RESPONSE>", ""); WVWebPay.Source = new UrlWebViewSource { Url = url }; tiempo.Interval = 2000; tiempo.Elapsed += new ElapsedEventHandler(VerificaPago); tiempo.Start(); }
public void GenerarLiga() { int idUsuario = int.Parse(ViewState["IdUsuario"].ToString()); DateTime thisDay = DateTime.Now; string j = thisDay.ToString("dd/MM/yyyy HH:mm:ss.fff"); string o = j.Replace("/", ""); string s = o.Replace(":", ""); string u = s.Replace(".", ""); string e = u.Replace(".", ""); string Referencia = e.Replace(" ", ""); Guid UidOrden = Guid.NewGuid(); Guid UidOrdenPago = Guid.NewGuid(); string ArchivoXml = "" + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + "<P>\r\n " + " <business>\r\n" + " <id_company>Z937</id_company>\r\n" + " <id_branch>851</id_branch>\r\n" + " <user>Z937SIUS21</user>\r\n" + " <pwd>7TYGNDWO48</pwd>\r\n" + " </business>\r\n" + " <url>\r\n" + " <reference>" + idUsuario + Referencia + "</reference>\r\n" + " <amount>" + txtNombre.Text + "</amount>\r\n" + " <moneda>MXN</moneda>\r\n" + " <canal>W</canal>\r\n" + " <omitir_notif_default>1</omitir_notif_default>\r\n" + " <st_correo>1</st_correo>\r\n" + " <fh_vigencia>" + txtFecha.Text + "</fh_vigencia>\r\n" + " <mail_cliente>" + txtCorreo.Text + "</mail_cliente>\r\n" + " <datos_adicionales>\r\n" + " <data id=\"1\" display=\"false\">\r\n" + " <label>PRINCIPAL</label>\r\n" + " <value>" + idUsuario + "</value>\r\n" + " </data>\r\n" + " <data id=\"2\" display=\"true\">\r\n" + " <label>Concepto:</label>\r\n" + " <value>" + txtConcepto.Text + "</value>\r\n" + " </data>\r\n" + " <data id=\"3\" display=\"false\">\r\n" + " <label>Color</label>\r\n" + " <value>Azul</value>\r\n" + " </data>\r\n" + " </datos_adicionales>\r\n" + " </url>\r\n" + "</P>\r\n"; string originalString = ArchivoXml; //string key = "5DCC67393750523CD165F17E1EFADD21"; string key = "7AACFE849FABD796F6DCB947FD4D5268"; AESCrypto aesCrypto = new AESCrypto(); string encryptedString = aesCrypto.encrypt(originalString, key); string finalString = encryptedString.Replace("%", "%25").Replace(" ", "%20").Replace("+", "%2B").Replace("=", "%3D").Replace("/", "%2F"); string encodedString = HttpUtility.UrlEncode("<pgs><data0>9265655113</data0><data>" + encryptedString + "</data></pgs>"); string postParam = "xml=" + encodedString; var client = new RestClient("(https://bc.mitec.com.mx/p/gen"); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("content-type", "application/x-www-form-urlencoded"); request.AddParameter("application/x-www-form-urlencoded", postParam, ParameterType.RequestBody); IRestResponse response = client.Execute(request); var content = response.Content; //lblRespuesta.Text = o.decrypt(key, content); string decryptedString = aesCrypto.decrypt(key, content); string str1 = decryptedString.Replace("<P_RESPONSE><cd_response>success</cd_response><nb_response></nb_response><nb_url>", ""); string url = str1.Replace("</nb_url></P_RESPONSE>", ""); txtUrlGene.Text = url; }