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 TestRecycleEngineActive() { var xmlResponse = @"<cnpOnlineResponse version='8.23' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'> <authorizationResponse> <cnpTxnId>123</cnpTxnId> <fraudResult> <advancedFraudResults> <deviceReviewStatus>ReviewStatus</deviceReviewStatus> <deviceReputationScore>800</deviceReputationScore> <triggeredRule>rule triggered</triggeredRule> </advancedFraudResults> </fraudResult> <recyclingResponse> <recycleEngineActive>1</recycleEngineActive> </recyclingResponse> </authorizationResponse> </cnpOnlineResponse>"; var cnpOnlineResponse = CnpOnline.DeserializeObject(xmlResponse); var authorizationResponse = (authorizationResponse)cnpOnlineResponse.authorizationResponse; Assert.AreEqual(123, authorizationResponse.cnpTxnId); Assert.NotNull(authorizationResponse.fraudResult); Assert.NotNull(authorizationResponse.fraudResult.advancedFraudResults); Assert.NotNull(authorizationResponse.fraudResult.advancedFraudResults.deviceReviewStatus); Assert.AreEqual("ReviewStatus", authorizationResponse.fraudResult.advancedFraudResults.deviceReviewStatus); Assert.NotNull(authorizationResponse.fraudResult.advancedFraudResults.deviceReputationScore); Assert.AreEqual(800, authorizationResponse.fraudResult.advancedFraudResults.deviceReputationScore); Assert.AreEqual("rule triggered", authorizationResponse.fraudResult.advancedFraudResults.triggeredRule[0]); Assert.AreEqual(true, authorizationResponse.recyclingResponse.recycleEngineActive); }
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 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 TestRecurringResponse_NoRecurringTxnId() { var xmlResponse = "<cnpOnlineResponse version='8.18' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><authorizationResponse><cnpTxnId>123</cnpTxnId><recurringResponse><subscriptionId>12</subscriptionId><responseCode>345</responseCode><responseMessage>Foo</responseMessage></recurringResponse></authorizationResponse></cnpOnlineResponse>"; var cnpOnlineResponse = CnpOnline.DeserializeObject(xmlResponse); var authorizationResponse = (authorizationResponse)cnpOnlineResponse.authorizationResponse; Assert.AreEqual(123, authorizationResponse.cnpTxnId); Assert.AreEqual(12, authorizationResponse.recurringResponse.subscriptionId); Assert.AreEqual("345", authorizationResponse.recurringResponse.responseCode); Assert.AreEqual("Foo", authorizationResponse.recurringResponse.responseMessage); Assert.AreEqual(0, authorizationResponse.recurringResponse.recurringTxnId); }
public void TestRecurringResponse_Full() { String xmlResponse = "<cnpOnlineResponse version='8.18' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><saleResponse><cnpTxnId>123</cnpTxnId><recurringResponse><subscriptionId>12</subscriptionId><responseCode>345</responseCode><responseMessage>Foo</responseMessage><recurringTxnId>678</recurringTxnId></recurringResponse></saleResponse></cnpOnlineResponse>"; cnpOnlineResponse cnpOnlineResponse = CnpOnline.DeserializeObject(xmlResponse); saleResponse saleResponse = (saleResponse)cnpOnlineResponse.saleResponse; Assert.AreEqual(123, saleResponse.cnpTxnId); Assert.AreEqual(12, saleResponse.recurringResponse.subscriptionId); Assert.AreEqual("345", saleResponse.recurringResponse.responseCode); Assert.AreEqual("Foo", saleResponse.recurringResponse.responseMessage); Assert.AreEqual(678, saleResponse.recurringResponse.recurringTxnId); }
public void SetUp() { 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); cnp = new CnpOnline(config); }
public void TestSale_BadConnection() { sale sale = new sale { id = "21321415412", orderId = "1556632727643", amount = 5000, orderSource = orderSourceType.androidpay, paypage = new cardPaypageType { paypageRegistrationId = "4005795464788715792" } }; ConfigManager configManager = new ConfigManager(); //Dictionary<string, string> config = new Dictionary<string, string>(); Dictionary <string, string> config = configManager.getConfig(); //config["url"] = Properties.Settings.Default.url; //config["reportGroup"] = Properties.Settings.Default.reportGroup; //config["username"] = Properties.Settings.Default.username; //config["printxml"] = Properties.Settings.Default.printxml; //config["timeout"] = Properties.Settings.Default.timeout; config["proxyHost"] = "somegarbage"; //config["merchantId"] = Properties.Settings.Default.merchantId; //config["password"] = Properties.Settings.Default.password; config["proxyPort"] = "123"; //config["logFile"] = Properties.Settings.Default.logFile; //config["neuterAccountNums"] = Properties.Settings.Default.neuterAccountNums; CnpOnline tempCnp = new CnpOnline(config); Communications comms = new Communications(); tempCnp.SetCommunication(comms); try { saleResponse saleresponse = tempCnp.Sale(sale); } catch (WebException e) { Assert.AreEqual("The remote name could not be resolved: 'somegarbage'", e.Message); } }
public void SetUpCnp() { _config = new Dictionary <string, string> { { "url", "https://www.testvantivcnp.com/sandbox/new/sandbox/communicator/online" }, { "reportGroup", "Default Report Group" }, { "username", "DOTNET" }, { "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 Setup() { // Skip the test if online certification tests aren't enabled. EnvironmentVariableTestFlags.RequirePreliveOnlineTestsEnabled(); // Create the configuration. var config = new Dictionary <string, string>(); config.Add("url", "https://payments.vantivprelive.com/vap/communicator/online"); config.Add("timeout", "20000"); config.Add("printxml", "true"); config.Add("logFile", null); config.Add("neuterAccountNums", null); config.Add("proxyHost", ""); config.Add("proxyPort", ""); config.Add("version", CnpVersion.CurrentCNPXMLVersion); // Create the CNP Online. this.cnpOnline = new CnpOnline(new ConfigManager(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); }
/* * Runs a test transaction for a specific version. */ public void RunCnpTest <T>(cnpTransactionInterface transaction, XMLVersion version) { // Create the configuration. var config = new ConfigManager(new Dictionary <string, string> { { "reportGroup", "Default Report Group" }, { "username", "DOTNET" }, { "timeout", "15000" }, { "merchantId", "101" }, { "password", "TESTCASE" }, { "printxml", "true" }, { "neuterAccountNums", "true" }, { "version", version.ToString() } }); // Create a CNP Online object. var cnpOnline = new CnpOnline(config); // Perform the sync transaction, and validate the response. try { var transactionResponse = cnpOnline.SendTransaction <T>(transaction); this.ValidateResponse <T>(transactionResponse, version); } catch (Exception exception) { this.ValidateException(exception, version); } // Perform the async transaction, and validate the response. try { var transactionResponse = cnpOnline.SendTransactionAsync <T>(transaction, new CancellationToken()).Result; this.ValidateResponse <T>(transactionResponse, version); } catch (AggregateException exception) { this.ValidateException(exception.InnerException, version); } }
public void SetUp() { EnvironmentVariableTestFlags.RequirePreliveOnlineTestsEnabled(); var existingConfig = new ConfigManager().getConfig(); 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", existingConfig["username"]); config.Add("timeout", "20000"); config.Add("merchantId", existingConfig["merchantId"]); config.Add("password", existingConfig["password"]); config.Add("printxml", "true"); config.Add("logFile", null); config.Add("neuterAccountNums", null); config.Add("proxyHost", ""); config.Add("proxyPort", ""); ConfigManager configManager = new ConfigManager(config); cnp = new CnpOnline(configManager.getConfig()); }
public void TestSale_BadConnection() { var sale = new sale { id = "21321415412", orderId = "1556632727643", amount = 5000, orderSource = orderSourceType.androidpay, paypage = new cardPaypageType { paypageRegistrationId = "4005795464788715792" } }; Communications.DisposeHttpClient(); var config = new ConfigManager().getConfig(); config["proxyHost"] = "some-garbage"; config["proxyPort"] = "123"; var tempCnp = new CnpOnline(config); // Expect a WebException because an invalid proxy configuration is set Assert.Throws <WebException>(() => tempCnp.Sale(sale)); }
public void SetUpCnp() { _cnp = new CnpOnline(); }
public void SetUpCnp() { _config = new ConfigManager().getConfig(); _cnp = new CnpOnline(_config); }