public void Read_GetPaymentProductsResponse() { // Arrange var response = new GetPaymentProducts(); //Act response.FromModifiedXml(new ModifiedXmlDocument(GetPaymentMethodsResponseText), string.Empty); // Assert Assert.IsNotNull(response.Response); Assert.AreEqual("OK", response.Response.Result); Assert.AreEqual(841604, response.Response.Meta.RequestId); Assert.IsNotNull(response.Response.PaymentProducts); Assert.AreEqual(7, response.Response.PaymentProducts.Count); Assert.Contains("Credit Card / Debit Card", response.Response.PaymentProducts.Select(x => x.PaymentMethodName).ToList()); Assert.Contains("American Express", response.Response.PaymentProducts.Select(x => x.PaymentProductName).ToList()); }
public virtual IEnumerable <IPaymentProduct> GetPaymentProducts(PaymentMethod paymentMethod, string languageCode, string countryCode, string currencyCode) { languageCode = _languageCodeMapper.Convert(languageCode); var getPaymentProducts = new GetPaymentProducts { Meta = { MerchantId = paymentMethod.DynamicProperty <int>().MerchantId }, General = { LanguageCode = languageCode, CountryCode = countryCode, CurrencyCode = currencyCode } }; var responseText = SendTextAndCheckResponseForErrors(GetServiceUrl(paymentMethod), getPaymentProducts.ToString()); var response = new GetPaymentProducts(); response.FromModifiedXml(new ModifiedXmlDocument(responseText), string.Empty); return(new List <IPaymentProduct>(response.Response.PaymentProducts)); }
public void GetPaymentProducts() { // Arrange var getPaymentProducts = new GetPaymentProducts { Meta = { MerchantId = 7454 }, General = { LanguageCode = "en", CountryCode = "GB", CurrencyCode = "EUR" } }; var text = getPaymentProducts.ToString(); var caller = new ServiceApiCaller("HTTPS://ps.gcsip.nl/wdl/wdl"); // Act var responseText = caller.Send(text); // Assert AssertResponseOk(responseText); var response = new GetPaymentProducts(); response.FromModifiedXml(new ModifiedXmlDocument(responseText), string.Empty); Assert.AreEqual("OK", response.Response.Result); }
public void Write_Then_Read_GetPaymentProducts() { // Arrange var request = new GetPaymentProducts { Meta = { MerchantId = 1, IpAddress = "123.123.123.123", Version = "1.0" }, General = { CountryCode = "NL", LanguageCode = "en" } }; // Act var text = ConvertApiDataPartToString(request); var request2 = new GetPaymentProducts(); request2.FromModifiedXml(new ModifiedXmlDocument(text), string.Empty); // Assert Assert.AreEqual(1, request2.Meta.MerchantId); Assert.AreEqual("123.123.123.123", request2.Meta.IpAddress); Assert.AreEqual("1.0", request2.Meta.Version); Assert.AreEqual("NL", request2.General.CountryCode); Assert.AreEqual("en", request2.General.LanguageCode); }