public void SetUp() { CommManager.reset(); ConfigManager configManager = new ConfigManager(); _config = configManager.getConfig(); //_config = new Dictionary<string, string>(); //_config["url"] = Properties.Settings.Default.url; //_config["reportGroup"] = Properties.Settings.Default.reportGroup; _config["username"] = Environment.GetEnvironmentVariable("encUsername"); //_config["printxml"] = Properties.Settings.Default.printxml; //_config["timeout"] = Properties.Settings.Default.timeout; //_config["proxyHost"] = Properties.Settings.Default.proxyHost; _config["merchantId"] = Environment.GetEnvironmentVariable("encMerchantId"); _config["password"] = Environment.GetEnvironmentVariable("encPassword").Replace("\"", ""); //_config["proxyPort"] = Properties.Settings.Default.proxyPort; //_config["sftpUrl"] = Properties.Settings.Default.sftpUrl; _config["sftpUsername"] = Environment.GetEnvironmentVariable("encSftpUsername"); _config["sftpPassword"] = Environment.GetEnvironmentVariable("encSftpPassword"); //_config["knownHostsFile"] = Properties.Settings.Default.knownHostsFile; //_config["requestDirectory"] = Properties.Settings.Default.requestDirectory; //_config["responseDirectory"] = Properties.Settings.Default.responseDirectory; _config["useEncryption"] = "true"; _config["vantivPublicKeyId"] = Environment.GetEnvironmentVariable("vantivPublicKeyId"); _config["pgpPassphrase"] = Environment.GetEnvironmentVariable("pgpPassphrase"); }
public void TestTimeoutNotParsable() { CommManager.reset(); _config = new Dictionary <string, string> { { "url", Properties.Settings.Default.url }, { "reportGroup", "Default Report Group" }, { "username", "DOTNET" }, { "version", "11.0" }, { "timeout", "notparsableasint" }, { "merchantId", "101" }, { "password", "TESTCASE" }, { "printxml", "true" }, { "proxyHost", Properties.Settings.Default.proxyHost }, { "proxyPort", Properties.Settings.Default.proxyPort }, { "logFile", Properties.Settings.Default.logFile }, { "neuterAccountNums", "true" } }; _cnp = new CnpOnline(_config); var registerTokenRequest = new registerTokenRequestType { id = "1", reportGroup = "Planets", orderId = "12344", accountNumber = "1233456789103801", }; var rtokenResponse = _cnp.RegisterToken(registerTokenRequest); StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message); }
public void testInstanceMultiSite() { Dictionary <string, string> _config = new Dictionary <string, string> { { "proxyHost", "websenseproxy" }, { "proxyPort", "8080" }, { "multiSite", "true" }, { "printxml", "false" }, { "printMultiSiteDebug", "true" }, { "merchantId", "101" }, { "username", "DOTNET" }, { "password", "TESTCASE" }, { "url", legacyUrl }, { "multiSiteUrl1", site1Url }, { "multiSiteUrl2", site2Url }, { "multiSiteErrorThreshold", "4" }, { "maxHoursWithoutSwitch", "48" } }; CommManager.reset(); CommManager cmg = CommManager.instance(_config); Assert.IsNotNull(cmg); Assert.IsTrue(cmg.getMultiSite()); Assert.AreEqual(cmg.getMultiSiteThreshold(), 4); Assert.AreEqual(cmg.getMultiSiteUrls().Count(), 2); }
public PerformanceTest(long idNumber) { threadId = idNumber; Dictionary <string, string> _config = new Dictionary <string, string>(); try { CommManager.reset(); _config = new Dictionary <string, string> { { "proxyHost", "websenseproxy" }, { "proxyPort", "8080" }, { "multiSite", "true" }, { "printxml", "false" }, { "printMultiSiteDebug", "false" }, { "merchantId", "101" }, { "username", "DOTNET" }, { "password", "TESTCASE" } }; cnp = new CnpOnline(_config); } catch (Exception e) { // TODO Auto-generated catch block Console.WriteLine(e.ToString()); } }
public void testFindUrl_MultiSite1() { Dictionary <string, string> _config = new Dictionary <string, string> { { "proxyHost", "websenseproxy" }, { "proxyPort", "8080" }, { "printxml", "false" }, { "merchantId", "101" }, { "username", "DOTNET" }, { "password", "TESTCASE" }, { "multiSite", "true" }, { "printMultiSiteDebug", "true" }, { "url", legacyUrl }, { "multiSiteUrl1", site1Url }, { "multiSiteUrl2", site2Url }, { "multiSiteErrorThreshold", "4" }, { "maxHoursWithoutSwitch", "48" } }; CommManager.reset(); CommManager cmg = CommManager.instance(_config); Assert.IsNotNull(cmg); Assert.IsTrue(cmg.getMultiSite()); RequestTarget rt = cmg.findUrl(); Assert.AreEqual(cmg.getMultiSiteUrls()[cmg.getCurrentMultiSiteUrlIndex()], rt.getUrl()); Assert.True(rt.getUrl().Equals(site1Url) || rt.getUrl().Equals(site2Url)); }
public void TestTimeoutReached() { CommManager.reset(); _config = new Dictionary <string, string> { { "url", Properties.Settings.Default.url }, { "reportGroup", "Default Report Group" }, { "username", "DOTNET" }, { "version", "11.0" }, { "timeout", "0" }, { "merchantId", "101" }, { "password", "TESTCASE" }, { "printxml", "true" }, { "proxyHost", Properties.Settings.Default.proxyHost }, { "proxyPort", Properties.Settings.Default.proxyPort }, { "logFile", Properties.Settings.Default.logFile }, { "neuterAccountNums", "true" } }; _cnp = new CnpOnline(_config); var registerTokenRequest = new registerTokenRequestType { id = "1", reportGroup = "Planets", orderId = "12344", accountNumber = "1233456789103801", }; Assert.Throws <WebException>(() => { _cnp.RegisterToken(registerTokenRequest); }); }
public void setup() { CommManager.reset(); _config = new Dictionary <string, string> { { "proxyHost", "websenseproxy" }, { "proxyPort", "8080" }, { "multiSite", "true" }, { "printxml", "true" }, { "printMultiSiteDebug", "false" }, { "url", Properties.Settings.Default.url } }; }
public void testFindUrl_MultiSiteMaxHours() { // test that url is switched when number of hours since last switch exceeds threshold Dictionary <string, string> _config = new Dictionary <string, string> { { "proxyHost", "websenseproxy" }, { "proxyPort", "8080" }, { "printxml", "false" }, { "merchantId", "101" }, { "username", "DOTNET" }, { "password", "TESTCASE" }, { "multiSite", "true" }, { "printMultiSiteDebug", "true" }, { "url", legacyUrl }, { "multiSiteUrl1", site1Url }, { "multiSiteUrl2", site2Url }, { "multiSiteErrorThreshold", "3" }, { "maxHoursWithoutSwitch", "4" } }; CommManager.reset(); CommManager cmg = CommManager.instance(_config); Assert.IsNotNull(cmg); Assert.IsTrue(cmg.getMultiSite()); Assert.AreEqual(cmg.getMultiSiteThreshold(), 3); RequestTarget rt1 = cmg.findUrl(); Assert.AreEqual(cmg.getMultiSiteUrls()[cmg.getCurrentMultiSiteUrlIndex()], rt1.getUrl()); cmg.reportResult(rt1, CommManager.REQUEST_RESULT_RESPONSE_RECEIVED, 200); RequestTarget rt2 = cmg.findUrl(); Assert.AreEqual(rt1.getUrl(), rt2.getUrl()); cmg.reportResult(rt2, CommManager.REQUEST_RESULT_RESPONSE_RECEIVED, 200); // set last switch time to 6 hours earlier DateTime gc = new DateTime(cmg.getLastSiteSwitchTime() * 10000); gc = gc.Add(new System.TimeSpan(-6, 0, 0)); cmg.setLastSiteSwitchTime((gc.Ticks / 10000)); RequestTarget rt3 = cmg.findUrl(); Assert.IsFalse(rt3.getUrl().Equals(rt1.getUrl())); }
public void testFindUrl_MultiSite2() { // test that url is switched when errors reach threshold Dictionary <string, string> _config = new Dictionary <string, string> { { "proxyHost", "websenseproxy" }, { "proxyPort", "8080" }, { "printxml", "false" }, { "merchantId", "101" }, { "username", "DOTNET" }, { "password", "TESTCASE" }, { "multiSite", "true" }, { "printMultiSiteDebug", "false" }, { "url", legacyUrl }, { "multiSiteUrl1", site1Url }, { "multiSiteUrl2", site2Url }, { "multiSiteErrorThreshold", "3" }, { "maxHoursWithoutSwitch", "48" } }; CommManager.reset(); CommManager cmg = CommManager.instance(_config); Assert.IsNotNull(cmg); Assert.IsTrue(cmg.getMultiSite()); Assert.AreEqual(cmg.getMultiSiteThreshold(), 3); RequestTarget rt1 = cmg.findUrl(); Assert.AreEqual(cmg.getMultiSiteUrls()[cmg.getCurrentMultiSiteUrlIndex()], rt1.getUrl()); cmg.reportResult(rt1, CommManager.REQUEST_RESULT_RESPONSE_TIMEOUT, 0); RequestTarget rt2 = cmg.findUrl(); Assert.AreEqual(rt1.getUrl(), rt2.getUrl()); cmg.reportResult(rt2, CommManager.REQUEST_RESULT_RESPONSE_TIMEOUT, 0); RequestTarget rt3 = cmg.findUrl(); Assert.AreEqual(rt1.getUrl(), rt3.getUrl()); cmg.reportResult(rt3, CommManager.REQUEST_RESULT_RESPONSE_TIMEOUT, 0); Assert.AreEqual(cmg.getErrorCount(), 3); RequestTarget rt4 = cmg.findUrl(); Assert.IsFalse(rt4.getUrl().Equals(rt1.getUrl())); }
public void SetUp() { CommManager.reset(); Dictionary <string, string> config = new Dictionary <string, string>(); config.Add("url", "https://payments.vantivprelive.com/vap/communicator/online"); config.Add("reportGroup", "Default Report Group"); config.Add("username", Properties.Settings.Default.username); config.Add("timeout", "500"); config.Add("merchantId", Properties.Settings.Default.merchantId); config.Add("password", Properties.Settings.Default.password); config.Add("printxml", "true"); config.Add("logFile", null); config.Add("neuterAccountNums", null); config.Add("proxyHost", Properties.Settings.Default.proxyHost); config.Add("proxyPort", Properties.Settings.Default.proxyPort); config.Add("multiSite", "false"); cnp = new CnpOnline(config); }
public void SetUpCnp() { CommManager.reset(); _config = new Dictionary <string, string> { { "url", Properties.Settings.Default.url }, { "reportGroup", "Default Report Group" }, { "username", "DOTNET" }, { "version", "11.0" }, { "timeout", "5000" }, { "merchantId", "101" }, { "password", "TESTCASE" }, { "printxml", "true" }, { "proxyHost", Properties.Settings.Default.proxyHost }, { "proxyPort", Properties.Settings.Default.proxyPort }, { "logFile", Properties.Settings.Default.logFile }, { "neuterAccountNums", "true" } }; _cnp = new CnpOnline(_config); }
public void testInstanceMultiSiteNoUrls() { Dictionary <string, string> _config = new Dictionary <string, string> { { "proxyHost", "websenseproxy" }, { "proxyPort", "8080" }, { "multiSite", "true" }, { "printxml", "false" }, { "printMultiSiteDebug", "true" }, { "merchantId", "101" }, { "username", "DOTNET" }, { "password", "TESTCASE" }, { "url", legacyUrl } }; CommManager.reset(); CommManager cmg = CommManager.instance(_config); Assert.IsNotNull(cmg); Assert.IsFalse(cmg.getMultiSite()); }
public void testInstanceLegacy() { Dictionary <string, string> _config = new Dictionary <string, string> { { "proxyHost", "websenseproxy" }, { "proxyPort", "8080" }, { "multiSite", "false" }, { "printxml", "false" }, { "printMultiSiteDebug", "true" }, { "merchantId", "101" }, { "username", "DOTNET" }, { "password", "TESTCASE" }, { "url", legacyUrl } }; CommManager.reset(); CommManager cmg = CommManager.instance(_config); Assert.IsNotNull(cmg); Assert.IsFalse(cmg.getMultiSite()); Assert.AreEqual(legacyUrl, cmg.getLegacyUrl()); Dictionary <string, string> _config2 = new Dictionary <string, string> { { "proxyHost", "websenseproxy" }, { "proxyPort", "8080" }, { "multiSite", "false" }, { "printxml", "false" }, { "printMultiSiteDebug", "true" }, { "merchantId", "101" }, { "username", "DOTNET" }, { "password", "TESTCASE" }, { "url", "https://nowhere.com" } }; CommManager cmg2 = CommManager.instance(_config2); Assert.AreEqual(legacyUrl, cmg2.getLegacyUrl()); // should be same manager as previous }
public void testReportResult_NotMultiSite() { Dictionary <string, string> _config = new Dictionary <string, string> { { "proxyHost", "websenseproxy" }, { "proxyPort", "8080" }, { "multiSite", "false" }, { "printxml", "false" }, { "printMultiSiteDebug", "true" }, { "merchantId", "101" }, { "username", "DOTNET" }, { "password", "TESTCASE" }, { "url", legacyUrl } }; CommManager.reset(); CommManager cmg = CommManager.instance(_config); Assert.IsNotNull(cmg); Assert.IsFalse(cmg.getMultiSite()); Assert.AreEqual(legacyUrl, cmg.getLegacyUrl()); cmg.reportResult(new RequestTarget("", 1), 1, 0); }
public void ctxAll() { CommManager.reset(); Dictionary <string, string> _config = new Dictionary <string, string>(); _config["merchantId"] = Environment.GetEnvironmentVariable("payfacMerchantId_v12_7"); _config["username"] = Environment.GetEnvironmentVariable("payfacUsername_v12_7"); _config["password"] = Environment.GetEnvironmentVariable("payfacPassword_v12_7"); _config["sftpUsername"] = Environment.GetEnvironmentVariable("payfacSftpUsername_v12_7"); _config["sftpPassword"] = Environment.GetEnvironmentVariable("payfacSftpPassword_v12_7"); _config["url"] = Properties.Settings.Default.url; _config["reportGroup"] = Properties.Settings.Default.reportGroup; _config["printxml"] = Properties.Settings.Default.printxml; _config["timeout"] = Properties.Settings.Default.timeout; _config["proxyHost"] = Properties.Settings.Default.proxyHost; _config["proxyPort"] = Properties.Settings.Default.proxyPort; _config["sftpUrl"] = Properties.Settings.Default.sftpUrl; _config["knownHostsFile"] = Properties.Settings.Default.knownHostsFile; _config["requestDirectory"] = Properties.Settings.Default.requestDirectory; _config["responseDirectory"] = Properties.Settings.Default.responseDirectory; _config["useEncryption"] = "false"; var cnpBatchRequest = new batchRequest(_config); var cnpCtx = new cnpRequest(_config); string[] ctxPaymentInformation = { "ctx1 for submerchantcredit", "ctx2 for submerchantcredit", "ctx3 for submerchantcredit", "ctx4 for submerchantcredit", "ctx5 for submerchantcredit" }; string fundsTransferIdString = DateTime.Now.Ticks.ToString(); var accountInfoCtx = new echeckTypeCtx() { accType = echeckAccountTypeEnum.Checking, accNum = "1092969901", routingNum = "011075150", checkNum = "123455", ctxPaymentInformation = ctxPaymentInformation }; var submerchantCreditCtx = new submerchantCreditCtx { // attributes. id = "111", reportGroup = "submerchantCredit", // required child elements. accountInfo = accountInfoCtx, amount = 500, fundingSubmerchantId = "submerchantCredit", fundsTransferId = fundsTransferIdString, submerchantName = "Vantiv", customIdentifier = "WorldPay" }; cnpBatchRequest.addSubmerchantCreditCtx(submerchantCreditCtx); var req = submerchantCreditCtx.Serialize(); var submerchantDebitCtx = new submerchantDebitCtx { // attributes. id = "11", reportGroup = "CTX Report Group", // required child elements. accountInfo = accountInfoCtx, amount = 500, fundingSubmerchantId = "value for fundingSubmerchantId", fundsTransferId = fundsTransferIdString, submerchantName = "Vantiv", customIdentifier = "WorldPay" }; cnpBatchRequest.addSubmerchantDebitCtx(submerchantDebitCtx); var vendorCreditCtx = new vendorCreditCtx { // attributes. id = "11", reportGroup = "CTX Report Group", // required child elements. accountInfo = accountInfoCtx, amount = 500, fundingSubmerchantId = "value for fundingSubmerchantId", fundsTransferId = fundsTransferIdString, vendorName = "Vantiv" }; cnpBatchRequest.addVendorCreditCtx(vendorCreditCtx); var vendorDebitCtx = new vendorDebitCtx { // attributes. id = "11", reportGroup = "CTX Report Group", // required child elements. accountInfo = accountInfoCtx, amount = 500, fundingSubmerchantId = "value for fundingSubmerchantId", fundsTransferId = fundsTransferIdString, vendorName = "Vantiv" }; cnpBatchRequest.addVendorDebitCtx(vendorDebitCtx); cnpCtx.addBatch(cnpBatchRequest); var batchName = cnpCtx.sendToCnp(); cnpCtx.blockAndWaitForResponse(batchName, estimatedResponseTime(0, 1)); var cnpResponse = cnpCtx.receiveFromCnp(batchName); Assert.NotNull(cnpResponse); Assert.AreEqual("0", cnpResponse.response); Assert.AreEqual("Valid Format", cnpResponse.message); var cnpBatchResponse = cnpResponse.nextBatchResponse(); while (cnpBatchResponse != null) { var submerchantCreditResponse = cnpBatchResponse.nextSubmerchantCreditResponse(); while (submerchantCreditResponse != null) { Assert.AreEqual("000", submerchantCreditResponse.response); submerchantCreditResponse = cnpBatchResponse.nextSubmerchantCreditResponse(); } var submerchantDebitResponse = cnpBatchResponse.nextSubmerchantDebitResponse(); while (submerchantDebitResponse != null) { Assert.AreEqual("000", submerchantDebitResponse.response); submerchantDebitResponse = cnpBatchResponse.nextSubmerchantDebitResponse(); } var vendorCreditResponse = cnpBatchResponse.nextVendorCreditResponse(); while (vendorCreditResponse != null) { Assert.AreEqual("000", vendorCreditResponse.response); vendorCreditResponse = cnpBatchResponse.nextVendorCreditResponse(); } var vendorDebitResponse = cnpBatchResponse.nextVendorDebitResponse(); while (vendorDebitResponse != null) { Assert.AreEqual("000", vendorDebitResponse.response); vendorDebitResponse = cnpBatchResponse.nextVendorDebitResponse(); } cnpBatchResponse = cnpResponse.nextBatchResponse(); } }
public void setUpBeforeTest() { CommManager.reset(); cnp = new cnpRequest(); }
public void setUpBeforeTest() { CommManager.reset(); cnp = new cnpRequest(); this.preliveStatus = Environment.GetEnvironmentVariable("preliveStatus"); }