public void TestXmlWithCompanyCustomer() { _order = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig()) .AddOrderRow(Item.OrderRow() .SetAmountExVat(4) .SetVatPercent(25) .SetQuantity(1)) .SetCurrency(TestingTool.DefaultTestCurrency) .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber) .SetCountryCode(TestingTool.DefaultTestCountryCode) .AddCustomerDetails(TestingTool.CreateCompanyCustomer()); var payment = new FakeHostedPayment(_order); payment.SetReturnUrl("http://myurl.se") .CalculateRequestValues(); _xml = _xmlBuilder.GetXml(payment); const string expectedString = "<customer><ssn>194608142222</ssn><firstname>Tess, T Persson</firstname>" + "<phone>0811111111</phone><email>[email protected]</email>" + "<address>Testgatan</address><housenumber>1</housenumber>" + "<address2>c/o Eriksson, Erik</address2><zip>99999</zip>" + "<city>Stan</city><country>SE</country></customer>"; Assert.That(_xml.Contains(expectedString), Is.True); Assert.That(_xml.Contains("<ipaddress>123.123.123.123</ipaddress>"), Is.True); }
public void TestBasicXml() { _order = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig()) .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber) .SetCountryCode(TestingTool.DefaultTestCountryCode) .SetCurrency(TestingTool.DefaultTestCurrency) .AddCustomerDetails(Item.IndividualCustomer() .SetNationalIdNumber(TestingTool.DefaultTestIndividualNationalIdNumber)) .AddOrderRow(Item.OrderRow() .SetAmountExVat(4) .SetVatPercent(25) .SetQuantity(1)); var payment = new FakeHostedPayment(_order); payment.SetReturnUrl("http://myurl.se") .CalculateRequestValues(); _xml = _xmlBuilder.GetXml(payment); const string expectedXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><!--Message generated by Integration package C#-->" + "<payment><customerrefno>33</customerrefno><currency>SEK</currency><amount>500</amount>" + "<vat>100</vat><lang>en</lang><returnurl>http://myurl.se</returnurl><iscompany>false</iscompany>" + "<customer><ssn>194605092222</ssn><country>SE</country></customer><orderrows><row><sku /><name />" + "<description /><amount>500</amount><vat>100</vat><quantity>1</quantity></row></orderrows>" + "<excludepaymentMethods /><addinvoicefee>false</addinvoicefee></payment>"; Assert.That(_xml, Is.EqualTo(expectedXml)); }
public void TestXmlWithIndividualCustomer() { _order = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig()) .SetCountryCode(TestingTool.DefaultTestCountryCode) .SetCurrency(TestingTool.DefaultTestCurrency) .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber) .AddOrderRow(Item.OrderRow() .SetAmountExVat(4) .SetVatPercent(25) .SetQuantity(1)) .AddCustomerDetails(Item.IndividualCustomer() .SetName("Julius", "Caesar") .SetInitials("JS") .SetNationalIdNumber("666666") .SetPhoneNumber("999999") .SetEmail("*****@*****.**") .SetIpAddress("123.123.123.123") .SetStreetAddress("Gatan", "23") .SetCoAddress("c/o Eriksson") .SetZipCode("9999") .SetLocality("Stan")); var payment = new FakeHostedPayment(_order); payment.SetReturnUrl("http://myurl.se") .CalculateRequestValues(); _xml = _xmlBuilder.GetXml(payment); const string expectedString = "<customer><ssn>666666</ssn><firstname>Julius</firstname>" + "<lastname>Caesar</lastname><initials>JS</initials>" + "<phone>999999</phone><email>[email protected]</email>" + "<address>Gatan</address><housenumber>23</housenumber>" + "<address2>c/o Eriksson</address2><zip>9999</zip>" + "<city>Stan</city><country>SE</country></customer>"; Assert.That(_xml.Contains(expectedString), Is.True); Assert.That(_xml.Contains("<ipaddress>123.123.123.123</ipaddress>"), Is.True); }