diff --git a/Retailcrm/Properties/AssemblyInfo.cs b/Retailcrm/Properties/AssemblyInfo.cs
index 30a418d..1bd10a6 100644
--- a/Retailcrm/Properties/AssemblyInfo.cs
+++ b/Retailcrm/Properties/AssemblyInfo.cs
@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("Retailcrm.SDK")]
-[assembly: AssemblyDescription("Multiversion API client for RetailCRM")]
+[assembly: AssemblyDescription("Multiversion API client for retailCRM")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("RetailDriver LLC")]
[assembly: AssemblyProduct("Retailcrm.SDK")]
-[assembly: AssemblyCopyright("Copyright © RetailDriver LLC 2017")]
+[assembly: AssemblyCopyright("Copyright © RetailDriver LLC 2019")]
[assembly: AssemblyTrademark("RetailDriver LLC")]
[assembly: AssemblyCulture("")]
diff --git a/Retailcrm/QueryBuilder.cs b/Retailcrm/QueryBuilder.cs
index 0f8fa0e..165ed10 100644
--- a/Retailcrm/QueryBuilder.cs
+++ b/Retailcrm/QueryBuilder.cs
@@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
+using System.Web;
namespace Retailcrm
{
@@ -37,8 +38,8 @@ namespace Retailcrm
return String.Join(argSeperator,
_keyValuePairs.Select(kvp =>
{
- var key = Uri.EscapeDataString(kvp.Key);
- var value = Uri.EscapeDataString(kvp.Value.ToString());
+ var key = HttpUtility.UrlEncode(kvp.Key);
+ var value = HttpUtility.UrlEncode(kvp.Value.ToString());
return $"{key}={value}";
}));
}
diff --git a/Retailcrm/Request.cs b/Retailcrm/Request.cs
index 403b472..7b7492a 100644
--- a/Retailcrm/Request.cs
+++ b/Retailcrm/Request.cs
@@ -77,7 +77,6 @@ namespace Retailcrm
}
Exception exception = null;
-
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(path);
request.Method = method;
@@ -112,7 +111,6 @@ namespace Retailcrm
throw new WebException(exception.ToString(), exception);
}
- // ReSharper disable once AssignNullToNotNullAttribute
StreamReader reader = new StreamReader(response.GetResponseStream());
string responseBody = reader.ReadToEnd();
int statusCode = (int)response.StatusCode;
diff --git a/Retailcrm/Retailcrm.csproj b/Retailcrm/Retailcrm.csproj
index 00071af..2e23b14 100644
--- a/Retailcrm/Retailcrm.csproj
+++ b/Retailcrm/Retailcrm.csproj
@@ -34,6 +34,7 @@
+
diff --git a/Retailcrm/Retailcrm.nuspec b/Retailcrm/Retailcrm.nuspec
index 68d6bef..a2f15f3 100644
--- a/Retailcrm/Retailcrm.nuspec
+++ b/Retailcrm/Retailcrm.nuspec
@@ -2,17 +2,17 @@
Retailcrm.SDK
- 5.1.1
+ 5.1.2
$title$
- Retailcrm
- Retailcrm
- https://opensource.org/licenses/MIT
- http://retailcrm.ru
- http://www.retailcrm.ru/favicon.ico
+ retailCRM
+ retailCRM
+ MIT
+ https://retailcrm.ru
+ https://help.retailcrm.ru/favicon.ico
false
- Multiversion API client for RetailCRM
- Update tests, setup auto builds
- Copyright 2017-2018
+ Multiversion API client for retailCRM
+ Fix POST request for big data
+ Copyright 2017-2019
crm ecommerce retailcrm sdk
\ No newline at end of file
diff --git a/RetailcrmUnitTest/ApiTest.cs b/RetailcrmUnitTest/ApiTest.cs
index d59c744..a3e6352 100644
--- a/RetailcrmUnitTest/ApiTest.cs
+++ b/RetailcrmUnitTest/ApiTest.cs
@@ -1,6 +1,4 @@
-using System.Collections.Specialized;
-using System.Configuration;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
using Retailcrm;
namespace RetailcrmUnitTest
diff --git a/RetailcrmUnitTest/RetailcrmUnitTest.csproj b/RetailcrmUnitTest/RetailcrmUnitTest.csproj
index da35e67..750ecf1 100644
--- a/RetailcrmUnitTest/RetailcrmUnitTest.csproj
+++ b/RetailcrmUnitTest/RetailcrmUnitTest.csproj
@@ -1,6 +1,6 @@
-
+
Debug
AnyCPU
@@ -39,10 +39,10 @@
- ..\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
+ ..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
- ..\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
+ ..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
@@ -95,8 +95,8 @@
Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.
-
-
+
+
-
+
\ No newline at end of file
diff --git a/RetailcrmUnitTest/V3/OrdersTest.cs b/RetailcrmUnitTest/V3/OrdersTest.cs
index bbc307c..2125370 100644
--- a/RetailcrmUnitTest/V3/OrdersTest.cs
+++ b/RetailcrmUnitTest/V3/OrdersTest.cs
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Retailcrm;
using Retailcrm.Versions.V3;
diff --git a/RetailcrmUnitTest/V4/OrdersTest.cs b/RetailcrmUnitTest/V4/OrdersTest.cs
index b28ce04..a4b1af5 100644
--- a/RetailcrmUnitTest/V4/OrdersTest.cs
+++ b/RetailcrmUnitTest/V4/OrdersTest.cs
@@ -37,5 +37,113 @@ namespace RetailcrmUnitTest.V4
Assert.IsInstanceOfType(response, typeof(Response));
Assert.IsTrue(response.GetResponse().ContainsKey("history"));
}
+
+ [TestMethod]
+ public void BigOrderCreateUpdate()
+ {
+ long epochTicks = new DateTime(1970, 1, 1).Ticks;
+ long unixTime = ((DateTime.UtcNow.Ticks - epochTicks) / TimeSpan.TicksPerSecond);
+
+ List> items = new List>();
+ Dictionary properties = new Dictionary();
+
+ for (int j = 0; j < 10; j++)
+ {
+ properties.Add(
+ $"property_{j}",
+ new Dictionary {
+ { "name", $"Property_{j}" },
+ { "code", $"property_{j}" },
+ { "value", $"{Guid.NewGuid().ToString()}" },
+ }
+ );
+ }
+
+ for (int i = 0; i < 100; i++) {
+ Dictionary item = new Dictionary {
+ { "initialPrice", i + 100 },
+ { "purchasePrice", i + 90 },
+ { "productName", $"Product_{i}" },
+ { "quantity", 2 },
+ {
+ "offer",
+ new Dictionary {
+ { "name", $"Product_{i}" },
+ { "xmlId", $"{Guid.NewGuid().ToString()}" }
+ }
+ },
+ { "properties", properties }
+ };
+
+ items.Add(item);
+ }
+
+ Dictionary order = new Dictionary
+ {
+ {"number", unixTime},
+ {"createdAt", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},
+ {"lastName", "Doe"},
+ {"firstName", "John"},
+ {"email", "john@example.com"},
+ {"phone", "+79999999999"},
+ {"items", items},
+ {
+ "delivery",
+ new Dictionary {
+ { "code", "self-delivery" },
+ { "cost", "300" },
+ {
+ "address", new Dictionary {
+ { "city", "Москва" },
+ { "street", "Ярославская" },
+ { "building", "10" },
+ { "flat", "2" },
+ }
+ }
+ }
+ }
+ };
+
+ Response createResponse = _client.OrdersCreate(order);
+
+ Assert.IsTrue(createResponse.IsSuccessfull());
+ Assert.IsInstanceOfType(createResponse, typeof(Response));
+ Assert.AreEqual(createResponse.GetStatusCode(), 201);
+ Assert.IsTrue(createResponse.GetResponse().ContainsKey("id"));
+
+ List> newItems = new List>();
+
+ for (int i = 0; i < 120; i++)
+ {
+ Dictionary item = new Dictionary {
+ { "initialPrice", i + 100 },
+ { "purchasePrice", i + 90 },
+ { "productName", $"Product_{i}" },
+ { "quantity", 2 },
+ {
+ "offer",
+ new Dictionary {
+ { "name", $"Product_{i}" },
+ { "xmlId", $"{Guid.NewGuid().ToString()}" }
+ }
+ },
+ { "properties", properties }
+ };
+
+ newItems.Add(item);
+ }
+
+ Response updateResponse = _client.OrdersUpdate(
+ new Dictionary {
+ { "id", createResponse.GetResponse()["id"].ToString()},
+ { "items", newItems }
+ },
+ "id"
+ );
+
+ Assert.IsTrue(updateResponse.IsSuccessfull());
+ Assert.IsInstanceOfType(updateResponse, typeof(Response));
+ Assert.AreEqual(updateResponse.GetStatusCode(), 200);
+ }
}
}
diff --git a/RetailcrmUnitTest/packages.config b/RetailcrmUnitTest/packages.config
index 03805ce..06aa648 100644
--- a/RetailcrmUnitTest/packages.config
+++ b/RetailcrmUnitTest/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file