public void ToXml_Includes_DeviceData() { TransactionRequest request = new TransactionRequest(); request.DeviceData = "{\"device_session_id\":\"my_dsid\", \"fraud_merchant_id\":\"my_fmid\"}"; Assert.IsTrue(request.ToXml().Contains("device-data")); Assert.IsTrue(request.ToXml().Contains("device_session_id")); Assert.IsTrue(request.ToXml().Contains("my_dsid")); Assert.IsTrue(request.ToXml().Contains("fraud_merchant_id")); Assert.IsTrue(request.ToXml().Contains("my_fmid")); }
public void ToXml_Includes_DeviceData() { TransactionRequest request = new TransactionRequest(); request.DeviceData = "{\"device_session_id\":\"my_dsid\", \"fraud_merchant_id\":\"my_fmid\"}"; Assert.IsTrue(request.ToXml().Contains("device-data")); Assert.IsTrue(request.ToXml().Contains("device_session_id")); Assert.IsTrue(request.ToXml().Contains("my_dsid")); Assert.IsTrue(request.ToXml().Contains("fraud_merchant_id")); Assert.IsTrue(request.ToXml().Contains("my_fmid")); }
public void ToXML_EnsuresUSLocaleForDecimals() { CultureInfo existingCulture = CultureInfo.CurrentCulture; try { #if netcore CultureInfo.CurrentCulture = new CultureInfo("it-IT"); #else Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("it-IT"); #endif TransactionRequest transactionRequest = new TransactionRequest { Amount = 100.0M, TaxAmount = 10.0M, }; SubscriptionRequest subscriptionRequest = new SubscriptionRequest { Price = 200.0M, }; SubscriptionTransactionRequest subscriptionTransactionRequest = new SubscriptionTransactionRequest { Amount = 300.0M }; ModificationRequest modificationRequest = new ModificationRequest { Amount = 400.0M }; TestHelper.AssertIncludes("<amount>100.00</amount>", transactionRequest.ToXml()); TestHelper.AssertIncludes("<tax-amount>10.00</tax-amount>", transactionRequest.ToXml()); TestHelper.AssertIncludes("<price>200.00</price>", subscriptionRequest.ToXml()); TestHelper.AssertIncludes("<amount>300.00</amount>", subscriptionTransactionRequest.ToXml()); TestHelper.AssertIncludes("<amount>400.00</amount>", modificationRequest.ToXml("root")); } finally { #if netcore CultureInfo.CurrentCulture = existingCulture; #else Thread.CurrentThread.CurrentCulture = existingCulture; #endif } }
public void ToXML_EnsuresUSLocaleForDecimals() { CultureInfo existingCulture = CultureInfo.CurrentCulture; try { #if netcore CultureInfo.CurrentCulture = new CultureInfo("it-IT"); #else Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("it-IT"); #endif TransactionRequest transactionRequest = new TransactionRequest { Amount = 100.0M, TaxAmount = 10.0M, }; SubscriptionRequest subscriptionRequest = new SubscriptionRequest { Price = 200.0M, }; SubscriptionTransactionRequest subscriptionTransactionRequest = new SubscriptionTransactionRequest { Amount = 300.0M }; ModificationRequest modificationRequest = new ModificationRequest { Amount = 400.0M }; TestHelper.AssertIncludes("<amount>100.00</amount>", transactionRequest.ToXml()); TestHelper.AssertIncludes("<tax-amount>10.00</tax-amount>", transactionRequest.ToXml()); TestHelper.AssertIncludes("<price>200.00</price>", subscriptionRequest.ToXml()); TestHelper.AssertIncludes("<amount>300.00</amount>", subscriptionTransactionRequest.ToXml()); TestHelper.AssertIncludes("<amount>400.00</amount>", modificationRequest.ToXml("root")); } finally { #if netcore CultureInfo.CurrentCulture = existingCulture; #else Thread.CurrentThread.CurrentCulture = existingCulture; #endif } }
public void ToXml_InludesPaymentMethodNonce() { TransactionRequest request = new TransactionRequest(); request.PaymentMethodNonce = "1232131232"; Assert.IsTrue(request.ToXml().Contains("1232131232")); }
public void ToXml_Includes_DeviceSessionId() { TransactionRequest request = new TransactionRequest(); request.DeviceSessionId = "my_dsid"; Assert.IsTrue(request.ToXml().Contains("my_dsid")); }
public void CanGetXmlRepresentationOfTransactionRequest() { var transactionRequest = new TransactionRequest("123456789", null, 1, "http://webpirates.nl", "1", 1000000, TimeSpan.FromMinutes(30), "iMac 27", "1"); var xml = transactionRequest.ToXml(new SignatureProvider(PrivateCertificate, PublicCertificate)); Assert.IsNotNullOrEmpty(xml); }
public void ToXml_Includes_FraudMerchantId() { TransactionRequest request = new TransactionRequest(); request.FraudMerchantId = "my_fmid"; Assert.IsTrue(request.ToXml().Contains("my_fmid")); }
public void ToXml_InludesPaymentMethodNonce() { TransactionRequest request = new TransactionRequest(); request.PaymentMethodNonce = "1232131232"; Assert.IsTrue(request.ToXml().Contains("1232131232")); }
public void ToXml_Includes_FraudMerchantId() { TransactionRequest request = new TransactionRequest(); request.FraudMerchantId = "my_fmid"; Assert.IsTrue(request.ToXml().Contains("my_fmid")); }
public void ToXml_Includes_DeviceSessionId() { TransactionRequest request = new TransactionRequest(); request.DeviceSessionId = "my_dsid"; Assert.IsTrue(request.ToXml().Contains("my_dsid")); }
public void ToXML_EscapesGeneratedXMLForString() { TransactionRequest request = new TransactionRequest { OrderId = "<>&\"'" }; TestHelper.AssertIncludes("<order-id><>&"'</order-id>", request.ToXml()); }
public void ToXML_EscapesGeneratedXMLForNestedSearchCriteria() { TransactionRequest request = new TransactionRequest { Customer = new CustomerRequest { FirstName = "<John>" } }; TestHelper.AssertIncludes("<first-name><John></first-name>", request.ToXml()); }
public void ToXML_EscapesGeneratedXMLForNestedSearchCriteria() { TransactionRequest request = new TransactionRequest { Customer = new CustomerRequest { FirstName = "<John>" } }; TestHelper.AssertIncludes("<first-name><John></first-name>", request.ToXml()); }
public void ToXml_IncludesInstallmentsCount() { TransactionRequest request = new TransactionRequest(); request.InstallmentRequest = new InstallmentRequest(); request.InstallmentRequest.Count = "4"; string xml = request.ToXml(); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); Assert.AreEqual("4", doc.SelectSingleNode("//installments/count").InnerText); }
public void ToXml_Includes_Level3SummaryData() { TransactionRequest request = new TransactionRequest(); request.ShippingAmount = 1.00M; request.DiscountAmount = 2.00M; request.ShipsFromPostalCode = "12345"; string xml = request.ToXml(); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); Assert.AreEqual("1.00", doc.GetElementsByTagName("shipping-amount")[0].InnerXml); Assert.AreEqual("2.00", doc.GetElementsByTagName("discount-amount")[0].InnerXml); Assert.AreEqual("12345", doc.GetElementsByTagName("ships-from-postal-code")[0].InnerXml); }
public void TransactionRequest_ToXml_Includes_SkipAdvancedFraudChecking() { var request = new TransactionRequest { Amount = SandboxValues.TransactionAmount.AUTHORIZE, CreditCard = new TransactionCreditCardRequest { Number = SandboxValues.CreditCardNumber.VISA, ExpirationDate = "05/2016", }, Options = new TransactionOptionsRequest { SkipAdvancedFraudChecking = false } }; Assert.IsTrue(request.ToXml().Contains("<skip-advanced-fraud-checking>false</skip-advanced-fraud-checking>")); }
public void ToXML_EnsuresUSLocaleForDecimals() { System.Globalization.CultureInfo existingCulture = System.Globalization.CultureInfo.CurrentCulture; try { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("it-IT"); TransactionRequest transactionRequest = new TransactionRequest { Amount = 100.0M }; SubscriptionRequest subscriptionRequest = new SubscriptionRequest { Price = 200.0M, }; SubscriptionTransactionRequest subscriptionTransactionRequest = new SubscriptionTransactionRequest { Amount = 300.0M }; ModificationRequest modificationRequest = new ModificationRequest { Amount = 400.0M }; TestHelper.AssertIncludes("<amount>100.0</amount>", transactionRequest.ToXml()); TestHelper.AssertIncludes("<price>200.0</price>", subscriptionRequest.ToXml()); TestHelper.AssertIncludes("<amount>300.0</amount>", subscriptionTransactionRequest.ToXml()); TestHelper.AssertIncludes("<amount>400.0</amount>", modificationRequest.ToXml("root")); } finally { System.Threading.Thread.CurrentThread.CurrentCulture = existingCulture; } }
public void ToXML_EnsuresUSLocaleForDecimals() { System.Globalization.CultureInfo existingCulture = System.Globalization.CultureInfo.CurrentCulture; try { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("it-IT"); TransactionRequest transactionRequest = new TransactionRequest { Amount = 100.0M }; SubscriptionRequest subscriptionRequest = new SubscriptionRequest { Price = 200.0M, }; SubscriptionTransactionRequest subscriptionTransactionRequest = new SubscriptionTransactionRequest { Amount = 300.0M }; ModificationRequest modificationRequest = new ModificationRequest { Amount = 400.0M }; TestHelper.AssertIncludes("<amount>100.0</amount>", transactionRequest.ToXml()); TestHelper.AssertIncludes("<price>200.0</price>", subscriptionRequest.ToXml()); TestHelper.AssertIncludes("<amount>300.0</amount>", subscriptionTransactionRequest.ToXml()); TestHelper.AssertIncludes("<amount>400.0</amount>", modificationRequest.ToXml("root")); } finally { System.Threading.Thread.CurrentThread.CurrentCulture = existingCulture; } }
public void ToXML_EscapesGeneratedXMLForString() { TransactionRequest request = new TransactionRequest { OrderId = "<>&\"'" }; TestHelper.AssertIncludes("<order-id><>&"'</order-id>", request.ToXml()); }
public void ToXML_EscapesGeneratedXMLForCustomFields() { TransactionRequest request = new TransactionRequest { CustomFields = new Dictionary<string, string> { { "<key>", "val&ue" } } }; TestHelper.AssertIncludes("<custom-fields><<key>>val&ue</<key>></custom-fields>", request.ToXml()); }
public void ToXML_EscapesGeneratedXMLForCustomFields() { TransactionRequest request = new TransactionRequest { CustomFields = new Dictionary <string, string> { { "<key>", "val&ue" } } }; TestHelper.AssertIncludes("<custom-fields><<key>>val&ue</<key>></custom-fields>", request.ToXml()); }