public static string Processar(int clienteID, int parcelas, Decimal totalCompra, string sessionID, int taxaEntregaID, int formaPagamentoID, string bin) { SortedList transactionData = new SortedList(new VPCStringComparer()); string queryString = "https://vpos.amxvpos.com/vpcpay"; int clientePedidoID = Controle.GetOrderID(Controle.FP_AMEX, clienteID); string tid = Controle.GeraTID(Controle.FP_AMEX, clienteID, clientePedidoID); //string tid = DateTime.Now.ToString("yyyyMMddHHmmssfffffff"); transactionData.Add("vpc_Version", "1"); transactionData.Add("vpc_Command", "pay"); transactionData.Add("vpc_AccessCode", AccessCode); transactionData.Add("vpc_MerchTxnRef", tid); // TID validar se funciona bem transactionData.Add("vpc_OrderInfo", sessionID); //SessionID transactionData.Add("vpc_Merchant", Merchant); transactionData.Add("vpc_Locale", "pt_BR"); transactionData.Add("vpc_ReturnURL", ReturnURL); transactionData.Add("vpc_Amount", Util.FormataValorRedecard(totalCompra)); //preco no formato 15000 = 150,00 // campos variáveis if (parcelas > 1) { transactionData.Add("vpc_PaymentPlan", "PlanN"); transactionData.Add("vpc_numPayments", parcelas); //parcelas TODO: verificar com AMEX n esta funcionando parece } string rawHashData = SECURE_SECRET; string seperator = "?"; foreach (System.Collections.DictionaryEntry item in transactionData) { // build the query string, URL Encoding all keys and their values queryString += seperator + System.Web.HttpUtility.UrlEncode(item.Key.ToString()) + "=" + System.Web.HttpUtility.UrlEncode(item.Value.ToString()); seperator = "&"; // Collect the data required for the MD5 sugnature if required if (SECURE_SECRET.Length > 0) { rawHashData += item.Value.ToString(); } } // Create the MD5 signature if required string signature = ""; if (SECURE_SECRET.Length > 0) { // create the signature and add it to the query string signature = CreateMD5Signature(rawHashData); queryString += seperator + "vpc_SecureHash=" + signature; } // Transmit the DO to the Payment Server via a browser redirect //Page.Response.Redirect(queryString); if (InserirTransacao(clienteID, tid, clientePedidoID, parcelas, totalCompra, sessionID, taxaEntregaID, formaPagamentoID, bin) != 0) { return(queryString); } else { return(string.Empty); } #region querystring pronta //queryString = "https://vpos.amxvpos.com/vpcpay?" + //"&vpc_Version=1" + //"&vpc_Command=pay" + //"&vpc_AccessCode=DEE970C5" + //"&vpc_MerchTxnRef=" + DateTime.Now.ToString("yyyyMMddHHmmssff") + //"&vpc_Merchant=TEST9917588774" + //"&vpc_OrderInfo=campo livre" + //"&vpc_Amount=100" + //"&vpc_ReturnURL=http://localhost:8888/Amex/DR.aspx" + //"&vpc_Locale=pt_BR"; #endregion }