public static string Processar(int clienteID, int parcelas, Decimal totalCompra, string free, string sessionID, int taxaEntregaID, int formaPagamentoID, bool diners) { int clientePedidoID = Controle.GetOrderID(Controle.FP_REDECARD, clienteID); string tid = Controle.GeraTID(Controle.FP_REDECARD, clienteID, clientePedidoID); int popup = 1; string loja = ConfigurationManager.AppSettings["RedecardMerchID"].ToString(); string strBandeira = ""; int bandeira = 1; if (diners) { bandeira = 2; } if (bandeira == 1) { strBandeira = "CREDICARD"; } else if (bandeira == 2) { strBandeira = "DINERS"; } else { throw new Exception("Bandeira Inexistente"); } string urlRetorno = ConfigurationManager.AppSettings["RetornoRedecard"].ToString(); string AVS = String.Empty; //usar "s" para habilitar if (InserirTransacao(clienteID, tid, clientePedidoID, parcelas, totalCompra, sessionID, taxaEntregaID, formaPagamentoID, bandeira) != 0) { return(Util.HTTPPostPage("https://comercio.locaweb.com.br/comercio.comp", "meio_pagamento_seguro=REDECARD&metodo=SAFENET&BANDEIRA=" + strBandeira + "&loja=" + loja + "&pedido=" + tid + "&valor=" + Util.FormataValorRedecard(totalCompra) + "&parcelas=" + parcelas + "&juros=0&urlback=" + urlRetorno + "&popup=" + popup + "&PAX1=" + tid + "&AVS=" + AVS + "&RedecardIdioma=pt&TARGET=&urlcima=")); } else { return("Por favor tente novamente"); } }
public static string Processar(decimal EntregaValor, int enderecoID, int pDVSelecionado, string dataSelecionada, int clienteID, int parcelas, Decimal totalCompra, string sessionID, int taxaEntregaID, int formaPagamentoID, string BIN, bool visaElectron) { try { int clientePedidoID = Controle.GetOrderID(Controle.FP_VISANET, clienteID); string tid = Controle.GeraTID(Controle.FP_VISANET, clienteID, clientePedidoID); tid += GeraComplementoTID(parcelas, visaElectron); string free = clienteID + ";" + sessionID + ";" + taxaEntregaID + ";" + EntregaValor + ";" + enderecoID + ";" + pDVSelecionado + ";" + dataSelecionada + ";" + formaPagamentoID + ";" + BIN + ";" + parcelas; //arrumar metodo if (InserirTransacao(clienteID, tid, clientePedidoID, parcelas, free, totalCompra, sessionID, taxaEntregaID, EntregaValor, enderecoID, pDVSelecionado, dataSelecionada, formaPagamentoID, BIN) != 0) { return(Util.HTTPGetPage( "https://comercio.locaweb.com.br/comercio.comp?merchid=" + merchid + "&price=" + Util.FormataValorRedecard(totalCompra) + "&damount=" + totalCompra.ToString("c") + "&tid=" + tid + "&orderid=" + clientePedidoID + "&order=" + free + "&authenttype=0" + "&bin=" + BIN + "&free=" + free + "&visa_antipopup=0" + "&PosicaoDadosVisanet=0")); } else { return("Por favor tente novamente"); } } catch (Exception ex) { throw new Exception("Método processar " + ex.Message); } }
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 }