public static void DataServices(CommandArguments args) { switch (args.DataServicesAction) { case DataServicesAction.GetVersionInfo: Processors.DataServices.VersionInfo vi = new Processors.DataServices.VersionInfo(); //vi.TestDate(); vi.Get(); break; } }
public static void Test(CommandArguments args) { switch (args.TestAction) { case TestAction.Merge: Processors.SMIME.RSA.DKIMDecrypt(); //using (System.IO.StringWriter tw = new System.IO.StringWriter(new System.Text.StringBuilder())) //{ // System.IO.TextWriter con = Console.Out; // Console.SetOut(tw); // for (int i = 1; i <= 10; i++) // { // Console.WriteLine("-- Run " + i.ToString() + " --"); // Console.WriteLine(); // Processors.Test.Merge.Run(true); // } // System.IO.File.WriteAllText(@"e:\output.txt", tw.GetStringBuilder().ToString()); // Console.SetOut(con); //} //for (int zz = 10; zz <= 100; zz += 10) //{ // string content = Processors.Test.MergeContent.Generate(100000, zz); // System.IO.File.WriteAllText(@"e:\mergedata\100k\100k_" + zz.ToString() + ".txt", content); //} //for (int zz = 100; zz <= 300; zz+=50) { // string content = Processors.Test.MergeContent.Generate(50000, zz); // System.IO.File.WriteAllText(@"e:\mergedata\100k\100k_" + zz.ToString() + ".txt", content); //} break; case TestAction.GenerateData: Processors.Test.DataCollections.AddRecords("blackbaud.com", 100); Processors.Test.DataCollections.AddRecords("yahoo.com", 200); Processors.Test.DataCollections.AddRecords("hotmail.com", 200); Processors.Test.DataCollections.AddRecords("aol.com", 200); Processors.Test.DataCollections.AddRecords("gmail.com", 200); string xml = Processors.Test.DataCollections.Serialize(); System.IO.File.WriteAllText(@"D:\temp\dataset.xml", xml); break; case TestAction.RegEx: System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(@"(?i)^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$"); if (r.Match("*****@*****.**").Success) { Console.WriteLine("Matched"); } else { Console.WriteLine("Not matched"); } //Console.Read(); break; case TestAction.Code: //var intToTrue = Convert.ToInt32(true); //var intToFalse = Convert.ToInt32(false); //Console.WriteLine(intToTrue.ToString()); //Console.WriteLine(intToFalse.ToString()); //Processors.Test.Code.SSHTest(); //Processors.Test.Code.TestCompression(); //Processors.Test.Code.RunLINQ(); //Processors.Test.Code.TestMemoryCache(); //Processors.Test.Merge.MergeRowCount = 10; //Processors.Test.Merge.MergeFieldCount = 10; //Processors.Test.Merge.MergeRowDataFormat = "aldfja;lkjkljfkajsdjfjalksjdlfjalsjdlfjajsdjfajsldjflkjalksjdlfjalksdjlfja;lsjdlfjlkajsldfjlajsldflajsdjflajlsdjlfjalksjdfjalsjdfjlkajsdlfjlajsldfjlkajsld;flkajsldflajslkf{0}"; //Processors.Test.Merge.RunMergeData(false); //string result = Processors.Test.Code.HashProductId("755BDDBE-E500-4C32-98C3-D56A67CF80AA"); //string rresult = Processors.Test.Code.BuildInstallCode(new Guid("755BDDBE-E500-4C32-98C3-D56A67CF80AA")); //VBCode.MergeData.Encode(" ", 998); // VBCode.MergeData.Bytes(); //Processors.Test.Code.DataSetTest(); //string t_xml = ""; //var a = System.Reflection.Assembly.GetExecutingAssembly(); //using (System.IO.StreamReader strm = new System.IO.StreamReader(a.GetManifestResourceStream("PaymentsTest.Resources.mergedata.xml"))) //{ // DataSet ds = new DataSet(); // ds.ReadXml(strm); ////} //VBCode.ProdMergeData md = new VBCode.ProdMergeData(); //md.ConnectionString = @"Data Source=CHS6SCOTTCAR01\SQL2008R2;Initial Catalog=BBCS;Integrated Security=True"; //string __xml = md.GetData("F772EE14-07C5-4A33-AB9E-D69378B4484A"); ////System.IO.File.WriteAllText(@"C:\Users\scott.carnley\Documents\mergedata.xml", __xml); //Console.Write("done"); //string volume = System.Configuration.ConfigurationManager.AppSettings.Get("Volume"); //string batchCount = System.Configuration.ConfigurationManager.AppSettings.Get("BatchCount"); //string path = System.Configuration.ConfigurationManager.AppSettings.Get("MTA_File_Path"); //string outputPath = System.Configuration.ConfigurationManager.AppSettings.Get("Output_Path"); //VBCode.main.BatchCount = int.Parse(batchCount); //VBCode.main.Volume = int.Parse(volume); //VBCode.main.filePath = path; //VBCode.main.outputPath = outputPath; //VBCode.main.MTA_run(); //var embly = System.Reflection.Assembly.GetExecutingAssembly(); //string testdata; //using (System.IO.StreamReader strm = new System.IO.StreamReader(embly.GetManifestResourceStream("PaymentsTest.Resources.smallbase64.txt"))) //{ // testdata = strm.ReadToEnd(); //} //using (System.IO.StreamReader sr = new StreamReader(@"D:\code\DevLab\Console\Resources\smallbase64.txt")) //{ // testdata = sr.ReadToEnd(); //} //byte[] bins = System.Text.UTF8Encoding.UTF8.GetBytes(testdata); //Console.WriteLine("before: " + bins.Length.ToString()); //string b64 = System.Convert.ToBase64String(bins); //using (System.IO.StreamWriter wr = new StreamWriter(@"d:\temp\email\base64.txt")) //{ // wr.Write(b64); //} //Console.WriteLine("after: " + b64.Length.ToString()); //double rr = (b64.Length * .75); //double pad = rr; //if (b64[b64.Length-1] == '=') //{ // pad = rr - 1; // if (b64[b64.Length - 2] == '=') // { // pad = rr - 2; // } //} //double TENMB = (Math.Pow(2, 20) * 10); //if (rr > TENMB) //{ // Console.WriteLine("rr: " + rr.ToString() + " > " + TENMB.ToString()); //} //else //{ // Console.WriteLine("rr: " + rr.ToString() + " <= " + TENMB.ToString()); //} //if (pad > TENMB) //{ // Console.WriteLine("pad: " + pad.ToString() + " > " + TENMB.ToString()); //} //else //{ // Console.WriteLine("pad: " + pad.ToString() + " <= " + TENMB.ToString()); //} //Console.ReadLine(); //VBCode.main.MTA_run(); //VBCode.main.TestLinq(); //Processors.BBCS.SpamAssassin.Client c = new Processors.BBCS.SpamAssassin.Client(); // c.ProcessContent(); //VBCode.Spamc spc = new VBCode.Spamc(); //spc.Process(); Processors.Cryptography.DKIM.Sign.Prod(); break; case TestAction.SMTP: //var assembly = System.Reflection.Assembly.GetExecutingAssembly(); //string htmlFormat = ""; //using (System.IO.StreamReader strm = new System.IO.StreamReader(assembly.GetManifestResourceStream("PaymentsTest.Resources.edfContent.txt"))) //{ // htmlFormat = strm.ReadToEnd(); //} //var m = new VBCode.ParseHTML(); //var fields = m.GetMergeFields(ref htmlFormat); //StringBuilder sb = new StringBuilder(); //sb.Append("<mergedata>"); //foreach (string fld in fields) //{ // string value = fld.Replace("[[",""); // sb.Append(string.Concat("<", value, ">", "</", value, ">")); //} //sb.Append("</mergedata>"); //System.IO.File.WriteAllText(@"d:\temp\mailmessages\mergedata.xml", sb.ToString()); Processors.Test.DirectInjection di = new Processors.Test.DirectInjection(); Processors.Test.EmailMessage em = new Processors.Test.EmailMessage(); Processors.Test.EmailMessageHeader eh = new Processors.Test.EmailMessageHeader(); Processors.Test.EmailMessageHeader.EmailRecipient er = new Processors.Test.EmailMessageHeader.EmailRecipient(); eh.FromAddress = "*****@*****.**"; eh.FromDisplayName = "Scott Carnley"; eh.MailFrom = "*****@*****.**"; eh.ReplyTo = "*****@*****.**"; eh.ReturnPath = "*****@*****.**"; eh.Subject = "SV third party signing test"; eh.VirtualServerGroup = "Bulk"; em.Header = eh; er.EmailAddress = "*****@*****.**"; er.EmailDisplayName = "M. Simpson"; var assembly = System.Reflection.Assembly.GetExecutingAssembly(); string htmlFormat; using (System.IO.StreamReader strm = new System.IO.StreamReader(assembly.GetManifestResourceStream("PaymentsTest.Resources.IssueContent.txt"))) { htmlFormat = strm.ReadToEnd(); } er.MergedContentHTML = htmlFormat; er.MergedContentText = "Hello world"; er.ClientUniqueId = ""; em.Recipient = er; di.EmailMessage = em; //di.SMTPServer = "10.26.2.131"; //di.SMTPServer = "127.0.0.1"; //mailsrvweb-sm di.SMTPServer = "10.26.2.136"; //di.SMTPServer = "10.26.2.154"; di.Port = 25; di.Connect(); di.SendMessage(); Console.WriteLine(); Console.WriteLine("Done"); di.Disconnect(); Console.WriteLine("Success"); //Console.Read(); break; } }
public static void Cryptography(CommandArguments args) { switch (args.CryptographyAction) { case CryptographyAction.Custom: Processors.Cryptography.AsymetricEncryption asym = new Processors.Cryptography.AsymetricEncryption(); do { Console.Write("Enter value to encrypt: "); string value = Console.ReadLine(); if (value == "quit") break; byte[] bytes = System.Text.Encoding.ASCII.GetBytes(value); byte[] cipher = null; try { cipher = asym.Encrypt(bytes); Console.WriteLine("Encrypted value: " + System.Convert.ToBase64String(cipher)); byte[] decryptedBytes = asym.Decrypt(cipher); string back = System.Text.Encoding.ASCII.GetString(decryptedBytes); Console.WriteLine("Original value: " + back); } catch (Exception e) { Console.WriteLine(e.Message); } finally { Console.WriteLine(); } } while (true); break; case CryptographyAction.RSA: Processors.Cryptography.RSA rsa = new Processors.Cryptography.RSA(); byte[] num = System.BitConverter.GetBytes(30); rsa.GenerateKeys(); byte[] rsaCipher = rsa.Encrypt(num); byte[] plain = rsa.Decrypt(rsaCipher); string base64 = System.Convert.ToBase64String(plain); int result = System.BitConverter.ToInt32(plain, 0); using (System.IO.StreamWriter fs = System.IO.File.CreateText(@"c:\test.txt")) { fs.Write(base64); } break; case CryptographyAction.SMIME: Processors.SMIME.CMS smime = new Processors.SMIME.CMS(); byte[] sessionKey, sessionIV, cmsMessage; using (StreamReader reader = new StreamReader(@"E:\Files\Payments\Managed File Handler\PayflowPro\payflowpro6\test\latenighttest\single.cipher")) { for (int i = 0; i < 5; i++) { reader.ReadLine(); } // S/MIME header data. It's being stripped because it's unecessary. string smimeBase64 = reader.ReadToEnd(); cmsMessage = System.Convert.FromBase64String(smimeBase64); } smime.Certificate = Actions.GetCertificate("pfp"); byte[] carData = smime.UnWrapCMS(cmsMessage, out sessionKey, out sessionIV); byte[] decrypted = smime.Decrypt(carData, sessionKey, sessionIV); List<char> cl = new List<char>(); foreach (byte b in decrypted) { cl.Add((char)b); } Console.WriteLine(cl.ToArray()); //Console.ReadLine(); break; case CryptographyAction.BASE64: string encoded = "eNq9V1tvmzAUTq9a120P28NeEdpjCJCEECKHTutlitakVVpNfasInCR0XDJjcvkZe9rP7WxwgEWpNk0rjmKbz8ffd2xj+1DZqVQqjzSxkqVXuzQb3KwiAn7tzCJWVfgKOHLDoNusKexXFU5jj8QYugHEBFteVbiOR55rf4HVbfgNgu5I1y3N1lqq0WiC0jYOGPm7AmeS3QDZo/h7Xq8NwQ+JG0y43NGd793YU/CtY1o7c8fjz9jy93Z23nAibsf8PWJEh/s0+/EWnSx9T5hzn0W1pogCBHboUOquGJOxpLbEE/P1S7SMOlEiILhOVxyC7c5cCEgkCpQhiLoir3SWtD4lZNaR5cViUVs0aiGeyHVFUeW7/mXq5NrWjxw6HiqEA84eSb5r4zAKx0SyQ79D7aTUSqReCALzAzzwqbQQWD787kpq2elFfJq6IsExZPhlaFse7ZJSpWRUZObB8nY1A45yfBq6Ngi+G1zZdozpoOjU+NZy/RQHozAOHHDErNtW754UL0htcSFvjeB7TJdks2mb2LkoEErSFVk3gukaZurEwhMgA2oWzSybubExNPkv+AfPzN97Zv7+M/Nf1FQt2fZl6Kgl6dRL0mmUpNMsSUcrSadVko5ekk67JB2jrH1a2oFQ1omg/ucjAclPXXNJy/brMWnizuUXt5zd3OsrfhvDRt9UPwk/zMMDGhf9PEAODaEmuJMWlv8v8Qrvk1L8qc9aSJqroonymIbWBe5LEnep2TTjcHGFHcDJlHKTqRWdTq1gAnSi3SACTFh8gs7NBxfP3QA+Lry4Bk6M5HMTDczTMJwBFm4B4xWSBybqmZqiGrpeR3LPRH0TtIaqGZohtUeaIjXbhiONNN2QDNoA9khvgGojuW+i7OYzFSTnDyi7qTJczfF6Ea/neKOIN3Kcndy5gzmEsvM266XleKuIt3JcL+J6jrPzh76iKDsk+DRxS6MwLqVommw/84NaVRSKZ8MtjDfZN+a1hdnCChc0elwbpYOXh+xfWHp54y0091novhHSs0D+8L5vPYSYFm7Aik+x6zlH90OYu8yEfaq8oGmXf7Y88nT8C4qtxZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; byte[] decodedbytes = Convert.FromBase64String(encoded); string decompressed = DecompressStatusData(decodedbytes); break; } }
public static void BBSP(CommandArguments args) { Processors.BBPay.Template temp = new Processors.BBPay.Template(); switch (args.BBSPAction) { case BBSPAction.CreateTemplate: Console.WriteLine(temp.Create()); break; case BBSPAction.GetTemplate: Console.WriteLine(temp.GetTemplateInformation(new Guid("869023F3-B7E2-4C6E-A163-050FE8396F3E"))); break; case BBSPAction.StoreCard: Processors.BBPay.Recurring r = new Processors.BBPay.Recurring(); r.Token = Guid.NewGuid(); r.CardToken = Guid.NewGuid(); Console.WriteLine("Token: " + r.Token.ToString()); Console.WriteLine("Card token: " + r.CardToken.ToString()); string scURI = r.StoreCard(); Console.WriteLine(scURI); using (System.IO.StreamWriter sw = new StreamWriter(@"E:\Files\Payments\PaymentsTest\AccountUpdateProcessor\BBPay\Data\" + r.Token.ToString() + ".txt")) { sw.WriteLine("BBPay Store Card"); sw.WriteLine(); sw.WriteLine("Card Token: " + r.CardToken.ToString()); sw.WriteLine("Trx Token: " + r.Token.ToString()); sw.WriteLine(scURI); } break; case BBSPAction.UpdateCard: Processors.BBPay.Recurring u = new Processors.BBPay.Recurring(); u.Token = Guid.NewGuid(); u.CardToken = new Guid("267ab7f4-0086-4e09-a13b-bda39e87c9a9"); string updateUri = u.UpdateCardInfo(); using (System.IO.StreamWriter sw = new StreamWriter(@"E:\Files\Payments\PaymentsTest\AccountUpdateProcessor\BBPay\Data\" + u.Token.ToString() + ".txt")) { sw.WriteLine("BBPay Update Stored Card"); sw.WriteLine(); sw.WriteLine(updateUri); } Console.WriteLine("Done"); break; case BBSPAction.DirectDebit: Processors.BBPay.DirectDebit dd = new Processors.BBPay.DirectDebit(); dd.Token = Guid.NewGuid(); Console.WriteLine("Token: " + dd.Token.ToString()); string processUri = dd.Process(); Console.WriteLine(processUri); using (System.IO.StreamWriter sw = new StreamWriter(@"E:\Files\Payments\PaymentsTest\AccountUpdateProcessor\BBPay\Data\" + dd.Token.ToString() + ".txt")) { sw.WriteLine("BBPay Direct Debit Transaction"); sw.WriteLine(); sw.WriteLine(processUri); } break; case BBSPAction.StoreDirectDebit: Processors.BBPay.Recurring store = new Processors.BBPay.Recurring(); store.AccountToken = Guid.NewGuid(); store.Token = Guid.NewGuid(); string storeUri = store.StoreDirectDebit(); using (System.IO.StreamWriter sw = new StreamWriter(@"E:\Files\Payments\PaymentsTest\AccountUpdateProcessor\BBPay\Data\" + store.Token.ToString() + ".txt")) { sw.WriteLine("BBPay Store Direct Debit"); sw.WriteLine(); sw.WriteLine("Token: " + store.Token.ToString()); sw.WriteLine("Account token: " + store.AccountToken.ToString()); sw.WriteLine(storeUri); } Console.WriteLine("Done"); break; case BBSPAction.UpdateDirectDebit: Processors.BBPay.Recurring update = new Processors.BBPay.Recurring(); update.AccountToken = new Guid("3d1d2bbb-88fa-4ac8-adae-d9e6ad12ee27"); update.Token = Guid.NewGuid(); string uddUri = update.UpdateDirectDebit(); using (System.IO.StreamWriter sw = new StreamWriter(@"E:\Files\Payments\PaymentsTest\AccountUpdateProcessor\BBPay\Data\" + update.Token.ToString() + ".txt")) { sw.WriteLine("BBPay Update Direct Debit"); sw.WriteLine(); sw.WriteLine("Token: " + update.Token.ToString()); sw.WriteLine("Account token: " + update.AccountToken.ToString()); sw.WriteLine(uddUri); } Console.WriteLine("Done"); break; case BBSPAction.TransactionResponse: Processors.BBPay.TransactionResponse tr = new Processors.BBPay.TransactionResponse(); tr.Token = new Guid("c641d2e3-c7a0-4785-b504-ac0401f07eb5"); string reply = tr.Retrieve(); using (System.IO.StreamWriter sw = new StreamWriter(@"E:\Files\Payments\PaymentsTest\AccountUpdateProcessor\BBPay\Data\TransactionResponse" + tr.Token.ToString() + ".txt")) { sw.WriteLine("BBPay Transaction Response"); sw.WriteLine(); sw.WriteLine(tr.Token.ToString()); sw.WriteLine(); sw.WriteLine(reply); } Console.WriteLine("done"); break; default: break; } }
public static void BBCS(CommandArguments args) { connection = args.GetConnection(); Processors.BBCS.REST.Common.HOST = args.Host; Processors.BBCS.REST.Common.USER = args.User; Processors.BBCS.REST.Common.PWD = args.Password; switch (args.BBCSAction) { case BBCSAction.Ping: Processors.BBCS.SOAP.Ping p = new Processors.BBCS.SOAP.Ping( ( new Processors.BBCS.SOAP.EmailSubmissionService() .proxy(Processors.BBCS.SOAP.EmailSubmissionService.HTTP_SCHEME, Processors.BBCS.SOAP.EmailSubmissionService.PATH_TRANSACTIONAL) )); if (p.Execute()) { Console.WriteLine("SOAP ping: success"); } else { Console.WriteLine("Failure"); } break; case BBCSAction.Bulk: DevLab.UI.BBCS inline = DevLab.UI.UIFactory.GetBBCSUI(); DevLab.UI.ScreenParameters inlineParam = inline.PrintMenu(connection); DataContext.BBCS.RequestFactory.GenerateMergeData = false; RequestParameters pm = new RequestParameters(); pm.MergeDataResourceName = connection.MergeData.FileName; pm.ContentResourceName = connection.Content.FileName; pm.Tag = inlineParam.tag; pm.RecipientCount = inlineParam.recipientCount; pm.GenerateMergedata = false; DataContext.BBCS.GeneralPurpose.Request r = DataContext.BBCS.RequestFactory.GetBulkRequest(pm); r.OrganizationID = connection.OrganizationId.ToString(); Processors.BBCS.REST.Submission.Bulk b = new Processors.BBCS.REST.Submission.Bulk(r, connection.BulkInline(), connection.AuthorizationHeader); b.Submit(); Console.WriteLine("Bulk submit: success"); break; case BBCSAction.BulkChunk: if (args.BBCSProtocol == BBCSProtocol.REST) { DevLab.UI.BBCS chunk = DevLab.UI.UIFactory.GetBBCSUI(); DevLab.UI.ScreenParameters chunkParm = chunk.PrintMenu(connection); RequestFactory.GenerateMergeData = true; Request _cr = RequestFactory.GetBulkCreateRequest(Guid.NewGuid(), chunkParm.tag, chunkParm.recipientCount); AddDataRequest _adr = RequestFactory.GetBulkAddDataRequest(_cr.JobId, chunkParm.tag, chunkParm.recipientCount); ProcessRequest _pr = RequestFactory.GetBulkProcessRequest(_cr.JobId); BulkCreate _bs = new BulkCreate(_cr, connection.BulkCreate(), connection.AuthorizationHeader); _bs.Submit(); chunk.PrintScreen(connection); BulkAddData _ba = new BulkAddData(_adr, connection.BulkAdd(), connection.AuthorizationHeader); _ba.Submit(); chunk.PrintScreen(connection); BulkProcess _br = new BulkProcess(_pr, connection.BulkProcess(), connection.AuthorizationHeader); _br.Submit(); chunk.PrintScreen(connection); Console.WriteLine("Success"); } else { Processors.BBCS.SOAP.GeneralPurpose.Chunk ch = new Processors.BBCS.SOAP.GeneralPurpose.Chunk( new Processors.BBCS.SOAP.EmailSubmissionService() .proxy(Processors.BBCS.SOAP.EmailSubmissionService.HTTPS_SCHEME, Processors.BBCS.SOAP.EmailSubmissionService.PATH_GENERAL_PURPOSE) ); ch.Jobid = Guid.NewGuid(); ch.Execute(); } break; case BBCSAction.BulkPing: break; case BBCSAction.ClientPing: break; case BBCSAction.AddClient: Processors.BBCS.REST.ClientResponse cr = Processors.BBCS.REST.Client.Submit(); Console.WriteLine("Client Id: " + cr.ID.ToString()); break; case BBCSAction.Inline: Processors.BBCS.SOAP.GeneralPurpose.Inline i = new Processors.BBCS.SOAP.GeneralPurpose.Inline( (new Processors.BBCS.SOAP.EmailSubmissionService() .proxy(Processors.BBCS.SOAP.EmailSubmissionService.HTTP_SCHEME, Processors.BBCS.SOAP.EmailSubmissionService.PATH_GENERAL_PURPOSE) )); bool result = i.Execute(); Console.WriteLine("Submitted: " + result.ToString()); break; case BBCSAction.JobStatus: switch (args.BBCSProtocol) { case BBCSProtocol.SOAP: System.Collections.Generic.List<StatusException> exceptions = new List<StatusException>(); string exceptionsPath = System.Configuration.ConfigurationManager.AppSettings.Get("ExceptionsList"); try { string path = System.Configuration.ConfigurationManager.AppSettings.Get("ClientListPath"); string[] clients = System.IO.File.ReadAllLines(path); for (int ii = 0; ii < clients.Length; ii++) { if (ii == 0) continue; string client = clients[ii]; string[] columns = client.Split(','); string uname = columns[0]; string pwd = columns[1]; string name = columns[2]; string siteId = columns[3]; try { Processors.BBCS.SOAP.EmailStatusService.UserName = uname; Processors.BBCS.SOAP.EmailStatusService.Password = pwd; var proxy = Processors.BBCS.SOAP.EmailStatusService.proxy(Processors.BBCS.SOAP.EmailStatusService.HTTPS_SCHEME); Processors.BBCS.SOAP.Status.GetJobStatus soapStatus = new Processors.BBCS.SOAP.Status.GetJobStatus(proxy); soapStatus.Execute(); } catch (Exception ex) { exceptions.Add(new StatusException() { SiteId = siteId, Name = name, UserName = uname, Password = pwd, Message = ex.Message }); } } } catch (Exception) { throw; } finally { if (exceptions.Count > 0) { System.Collections.Generic.List<string> list = new List<string>(); list.Add("ServiceUser,ServicePassword,Name,SiteID,ErrorMessage"); foreach (StatusException se in exceptions) { list.Add(se.Serialize()); } System.IO.File.WriteAllLines(exceptionsPath, list.ToArray()); } } break; case BBCSProtocol.REST: Processors.BBCS.REST.Status.GetJobStatus(); break; } Console.WriteLine("Complete"); break; case BBCSAction.RecipientStatus: Processors.BBCS.REST.Status.GetRecipientStatus(); Console.WriteLine("Complete"); break; case BBCSAction.Data: DataSet ds = new DataSet(); string cs = System.Configuration.ConfigurationManager.ConnectionStrings["BBCS"].ConnectionString; string startDate = System.Configuration.ConfigurationManager.AppSettings.Get("startdate"); string endDate = System.Configuration.ConfigurationManager.AppSettings.Get("enddate"); using (SqlConnection con = new SqlConnection(cs)) { using (SqlCommand cmd = con.CreateCommand()) { cmd.Connection.Open(); cmd.CommandText = "select id from dbo.generalpurposeemailjobinfo i where (i.dateadded between @startdate and @enddate) and i.statuscode = 3 ;"; cmd.Parameters.Add(new SqlParameter("@startdate", startDate)); cmd.Parameters.Add(new SqlParameter("@enddate", endDate)); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); } } Console.WriteLine("Jobs found: " + ds.Tables[0].Rows.Count.ToString()); string csvFormat = @"{0},{1},{2},{3},{4}"; if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { Console.WriteLine("Jobs found: " + ds.Tables[0].Rows.Count.ToString()); using (StreamWriter sw = new StreamWriter(@"C:\Users\scott.carnley\Documents\listquality\recipientgroups.csv")) { sw.WriteLine("EmailJobId,Unknown(0),Low(1),Medium(2),High(3)"); foreach (DataRow dr in ds.Tables[0].Rows) { Console.Write("."); Processors.BBCS.MergeData md = new Processors.BBCS.MergeData(); md.ConnectionString = cs; md.EmailJobId = dr[0].ToString(); Processors.BBCS.MergeData.Stats st = md.ProcessMergeData(); sw.WriteLine(string.Format(csvFormat, st.EmailJobId, st.Unknown.ToString(), st.Low.ToString(), st.Medium.ToString(), st.High.ToString())); } } Console.WriteLine("Jobs processed: " + ds.Tables[0].Rows.Count.ToString()); } else { Console.WriteLine("No jobs found."); } //Console.ReadLine(); //Console.WriteLine(); break; case BBCSAction.Transactional: string trx_tag = CCUpdate.Program.WriteMenu(CCUpdate.Program.EMAIL_JOB_BBCS, "Enter tag", true); string trxScreen = CCUpdate.Program.GetMenu(CCUpdate.Program.RUN_BBCS); CCUpdate.Program.WriteScreen(string.Format(trxScreen, connection.Host, connection.User, connection.Password, trx_tag, connection.Transactional())); DataContext.BBCS.Transactional.Request trxR = DataContext.BBCS.RequestFactory.GetTrxRequest(); trxR.OrganizationID = connection.OrganizationId.ToString(); Processors.BBCS.REST.Submission.Transactional t = new Processors.BBCS.REST.Submission.Transactional(trxR, connection.Transactional(), connection.AuthorizationHeader); t.Submit(); Console.WriteLine("Complete"); break; case BBCSAction.Attachment: string attScreen = CCUpdate.Program.GetMenu(CCUpdate.Program.RUN_BBCS); CCUpdate.Program.WriteScreen(string.Format(attScreen, connection.Host, connection.User, connection.Password, "N/A", connection.Attachments())); AttachmentService svc = new AttachmentService(connection.Attachments(), connection.AuthorizationHeader); svc.Submit(null); break; case BBCSAction.LoadBalancer: break; } }
public static void BBPS(CommandArguments args) { switch (args.BBPSAction) { case BBPSAction.CardNotPresent: Processors.BBPS.CreditCard.CardNotPresent cnp = new Processors.BBPS.CreditCard.CardNotPresent(); string r = cnp.Submit(); Console.WriteLine("Result: " + r); break; case BBPSAction.Batch: Processors.BBPS.CreditCard.Batch batch = new Processors.BBPS.CreditCard.Batch(); batch.Submit(); System.Threading.Thread.Sleep(3000); string batchResult = batch.Download(); Console.WriteLine("Batch result: " + batchResult); ////Console.Read(); break; case BBPSAction.BatchRefund: Processors.BBPS.Refund.Batch b = new Processors.BBPS.Refund.Batch(); b.BatchId = Guid.NewGuid(); b.Submit(); break; case BBPSAction.MerchantAccountList: Processors.Lists.MerchantAccounts ms = new Processors.Lists.MerchantAccounts(); MerchantAccountListDetail[] lists = ms.getLists(); Console.WriteLine("Merchant Accounts"); foreach (MerchantAccountListDetail d in lists) { Console.WriteLine(d.ID.ToString() + " " + d.Name + " " + d.Currency); } Console.WriteLine("Done"); //Console.ReadLine(); break; case BBPSAction.DirectDebitTransaction: Processors.BBPS.DirectDebit.Transaction ddT = new Processors.BBPS.DirectDebit.Transaction(); ddT.TransactionId = Guid.NewGuid(); ddT.Submit(); Console.WriteLine("done"); //Console.ReadLine(); break; case BBPSAction.StoreDirectDebit: Processors.BBPS.DirectDebit.Recurring sr = new Processors.BBPS.DirectDebit.Recurring(); sr.AccountToken = Guid.NewGuid(); sr.Submit(); break; case BBPSAction.RetrieveDirectDebit: Processors.BBPS.DirectDebit.Recurring rr = new Processors.BBPS.DirectDebit.Recurring(); rr.AccountToken = new Guid(""); rr.GetAccountInfo(); break; case BBPSAction.UploadCards: Processors.BBPS.AccountUpdate.CCU upload = new Processors.BBPS.AccountUpdate.CCU(); upload.UploadCards(); break; case BBPSAction.RegisterCards: Processors.BBPS.AccountUpdate.CCU register = new Processors.BBPS.AccountUpdate.CCU(); register.RegisterCard(); break; case BBPSAction.RetrieveCards: Processors.BBPS.AccountUpdate.CCU retrieve = new Processors.BBPS.AccountUpdate.CCU(); retrieve.RetrieveCards(); break; case BBPSAction.StoreCard: Processors.StoredCard.CardInfo single = new Processors.StoredCard.CardInfo(); single.StoreCard(); break; case BBPSAction.StoreCardBulk: Processors.StoredCard.CardInfo bulk = new Processors.StoredCard.CardInfo(); bulk.StoreCardBulk(); break; case BBPSAction.Credentials: string siteId, userName, password; siteId = "2000"; Processors.Other.Credentials creds = new Processors.Other.Credentials(); creds.GetBBPS(siteId, out userName, out password); Console.WriteLine("User name: " + userName); Console.WriteLine("Password: " + password); //Console.Read(); break; } }
static int Main(string[] args) { _consoleForeColor = Console.ForegroundColor; try { //header = string.Format("{0}\r\n{1}\r\n{2}\r\n", args[3], args[4], args[5]); CommandArguments commandArguments = new CommandArguments(args); if (!commandArguments.HasConnectionInfo) { string env = WriteMenu(MENU_BBCS_SYSTEMINFO); Data.Environment enviro = Data.Environment.Local; if (!Enum.TryParse(env, out enviro)) { throw new ArgumentException("Invalid option: " + env); } commandArguments.Enviro = enviro; } string cmd = "run"; do { cmd = WriteMenu(MENU_SERVICE_ACTION); if (cmd.Equals("exit")) break; Data.System sys = Data.System.Test; if (!Enum.TryParse(cmd, out sys)) { throw new ArgumentException("Invalid option: " + cmd); } switch (sys) { case Data.System.BBPS: PaymentsTest.Actions.BBPS(commandArguments); break; case Data.System.Cryptography: PaymentsTest.Actions.Cryptography(commandArguments); break; case Data.System.Test: cmd = WriteMenu(MENU_TEST); TestAction test; if (!Enum.TryParse(cmd, out test)) { throw new ArgumentException("Invalid option: " + cmd); } commandArguments.TestAction = test; PaymentsTest.Actions.Test(commandArguments); break; case Data.System.BBSP: PaymentsTest.Actions.BBSP(commandArguments); //Console.Read(); break; case Data.System.BBCS: cmd = WriteMenu(MENU_BBCS_PROTOCOL); BBCSProtocol proto; if (!Enum.TryParse(cmd, out proto)) { throw new ArgumentException("Invalid option: " + cmd); } commandArguments.BBCSProtocol = proto; cmd = WriteMenu(MENU_BBCS_ACTION); Data.BBCSAction a; if (!Enum.TryParse(cmd, out a)) { throw new ArgumentException("Invalid option: " + cmd); } commandArguments.BBCSAction = a; PaymentsTest.Actions.BBCS(commandArguments); break; default: break; } cmd = WriteMenu(CONTINUE, false); } while (cmd != "exit"); return 0; } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Trace.TraceError(e.ToString()); Console.Read(); Console.ForegroundColor = _consoleForeColor; } finally { Trace.TraceInformation("App completed."); Trace.Flush(); System.Threading.Thread.Sleep(3000); } return 0; }