mirror of
https://github.com/retailcrm/api-client-dotnet.git
synced 2025-04-11 13:00:55 +00:00
Fix System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
Move to async
This commit is contained in:
parent
0c784f003c
commit
d37dd1e8fd
63 changed files with 782 additions and 690 deletions
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Retailcrm
|
||||
{
|
||||
|
@ -17,12 +18,8 @@ namespace Retailcrm
|
|||
public Connection(string url, string key)
|
||||
{
|
||||
if ("/" != url.Substring(url.Length - 1, 1))
|
||||
{
|
||||
url += "/";
|
||||
}
|
||||
|
||||
url += "api/";
|
||||
|
||||
_request = new Request(url, new Dictionary<string, object> { { "apiKey", key } });
|
||||
}
|
||||
|
||||
|
@ -30,11 +27,11 @@ namespace Retailcrm
|
|||
/// Get available API versions
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response Versions()
|
||||
public Task<Response> Versions()
|
||||
{
|
||||
return _request.MakeRequest(
|
||||
"api-versions",
|
||||
Request.MethodGet
|
||||
System.Net.Http.HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -42,11 +39,11 @@ namespace Retailcrm
|
|||
/// Get available API methods
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response Credentials()
|
||||
public Task<Response> Credentials()
|
||||
{
|
||||
return _request.MakeRequest(
|
||||
"credentials",
|
||||
Request.MethodGet
|
||||
System.Net.Http.HttpMethod.Get
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
18
Retailcrm/Http2RequestHandler.cs
Normal file
18
Retailcrm/Http2RequestHandler.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Retailcrm
|
||||
{
|
||||
public class Http2CustomHandler : WinHttpHandler
|
||||
{
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
|
||||
{
|
||||
request.Version = new Version("2.0");
|
||||
return base.SendAsync(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,9 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Retailcrm
|
||||
{
|
||||
|
@ -12,19 +14,16 @@ namespace Retailcrm
|
|||
/// </summary>
|
||||
public class Request
|
||||
{
|
||||
/// <summary>
|
||||
/// Get method
|
||||
/// </summary>
|
||||
public const string MethodGet = "GET";
|
||||
/// <summary>
|
||||
/// Post method
|
||||
/// </summary>
|
||||
public const string MethodPost = "POST";
|
||||
private const string UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
|
||||
private const string ContentType = "application/x-www-form-urlencoded";
|
||||
|
||||
private readonly string _url;
|
||||
private readonly Dictionary<string, object> _defaultParameters;
|
||||
private static readonly HttpClient DefaultClient = new(new Http2CustomHandler
|
||||
{
|
||||
EnableMultipleHttp2Connections = true,
|
||||
});
|
||||
private readonly HttpClient _httpClient;
|
||||
|
||||
/// <summary>
|
||||
/// Request constructor
|
||||
|
@ -33,12 +32,18 @@ namespace Retailcrm
|
|||
/// <param name="parameters"></param>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public Request(string apiUrl, Dictionary<string, object> parameters = null)
|
||||
: this(DefaultClient, apiUrl, parameters)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Request(HttpClient client, string apiUrl, Dictionary<string, object> parameters = null)
|
||||
{
|
||||
if (apiUrl.IndexOf("https://", StringComparison.Ordinal) == -1)
|
||||
{
|
||||
throw new ArgumentException("API schema requires HTTPS protocol");
|
||||
}
|
||||
|
||||
_httpClient = client;
|
||||
_url = apiUrl;
|
||||
_defaultParameters = parameters;
|
||||
}
|
||||
|
@ -52,69 +57,30 @@ namespace Retailcrm
|
|||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
/// <exception cref="WebException"></exception>
|
||||
public Response MakeRequest(string path, string method, Dictionary<string, object> parameters = null)
|
||||
public async Task<Response> MakeRequest(string path, HttpMethod method, Dictionary<string, object> parameters = null)
|
||||
{
|
||||
string[] allowedMethods = { MethodGet, MethodPost };
|
||||
|
||||
if (allowedMethods.Contains(method) == false)
|
||||
{
|
||||
throw new ArgumentException($"Method {method} is not valid. Allowed HTTP methods are {string.Join(", ", allowedMethods)}");
|
||||
}
|
||||
|
||||
if (parameters == null)
|
||||
{
|
||||
parameters = new Dictionary<string, object>();
|
||||
}
|
||||
if (method != HttpMethod.Get && method != HttpMethod.Post)
|
||||
throw new ArgumentException($"Method {method} is not valid. Allowed HTTP methods are GET and POST");
|
||||
parameters ??= [];
|
||||
|
||||
parameters = _defaultParameters.Union(parameters).ToDictionary(k => k.Key, v => v.Value);
|
||||
path = _url + path;
|
||||
|
||||
string httpQuery = QueryBuilder.BuildQueryString(parameters);
|
||||
|
||||
if (method.Equals(MethodGet) && parameters.Count > 0)
|
||||
{
|
||||
if (method == HttpMethod.Get && parameters.Count > 0)
|
||||
path += "?" + httpQuery;
|
||||
}
|
||||
|
||||
Exception exception = null;
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(path);
|
||||
request.Method = method;
|
||||
|
||||
if (method.Equals(MethodPost))
|
||||
using var httpRequest = new HttpRequestMessage(method, path);
|
||||
using var content = new StringContent(httpQuery);
|
||||
if (method == HttpMethod.Post)
|
||||
{
|
||||
UTF8Encoding encoding = new UTF8Encoding();
|
||||
byte[] bytes = encoding.GetBytes(httpQuery);
|
||||
request.ContentLength = bytes.Length;
|
||||
request.ContentType = ContentType;
|
||||
request.UserAgent = UserAgent;
|
||||
|
||||
Stream post = request.GetRequestStream();
|
||||
post.Write(bytes, 0, bytes.Length);
|
||||
post.Flush();
|
||||
post.Close();
|
||||
httpRequest.Content = content;
|
||||
httpRequest.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(ContentType);
|
||||
httpRequest.Headers.UserAgent.ParseAdd(UserAgent);
|
||||
}
|
||||
|
||||
HttpWebResponse response;
|
||||
|
||||
try
|
||||
{
|
||||
response = (HttpWebResponse)request.GetResponse();
|
||||
}
|
||||
catch (WebException webException)
|
||||
{
|
||||
response = (HttpWebResponse)webException.Response;
|
||||
exception = webException;
|
||||
}
|
||||
|
||||
if (request == null || response == null)
|
||||
{
|
||||
throw new WebException(exception.ToString(), exception);
|
||||
}
|
||||
|
||||
StreamReader reader = new StreamReader(response.GetResponseStream());
|
||||
using var response = await _httpClient.SendAsync(httpRequest);
|
||||
using StreamReader reader = new(await response.Content.ReadAsStreamAsync());
|
||||
string responseBody = reader.ReadToEnd();
|
||||
int statusCode = (int)response.StatusCode;
|
||||
|
||||
return new Response(statusCode, responseBody);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Retailcrm</RootNamespace>
|
||||
<AssemblyName>Retailcrm</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
@ -32,7 +34,24 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.WinHttpHandler, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Net.Http.WinHttpHandler.9.0.0\lib\net462\System.Net.Http.WinHttpHandler.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
|
@ -41,6 +60,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Connection.cs" />
|
||||
<Compile Include="Http2RequestHandler.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="QueryBuilder.cs" />
|
||||
<Compile Include="Request.cs" />
|
||||
|
@ -78,6 +98,7 @@
|
|||
<Compile Include="Versions\V5\Users.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Retailcrm.nuspec" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>Retailcrm.SDK</id>
|
||||
<version>5.1.3</version>
|
||||
<title>$title$</title>
|
||||
<authors>RetailCRM</authors>
|
||||
<owners>RetailCRM</owners>
|
||||
<license type="expression">MIT</license>
|
||||
<projectUrl>https://github.com/retailcrmapi-client-dotnet</projectUrl>
|
||||
<iconUrl>https://s3-s1.retailcrm.tech/eu-central-1/retailcrm-static/branding/retailcrm/favicon/favicon.ico</iconUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>Multiversion API client for RetailCRM</description>
|
||||
<releaseNotes>Rebranding</releaseNotes>
|
||||
<copyright>Copyright 2017-2020</copyright>
|
||||
<tags>crm ecommerce retailcrm sdk</tags>
|
||||
</metadata>
|
||||
<metadata>
|
||||
<id>Retailcrm.SDK</id>
|
||||
<version>5.2.0</version>
|
||||
<title>$title$</title>
|
||||
<authors>RetailCRM</authors>
|
||||
<owners>RetailCRM</owners>
|
||||
<license type="expression">MIT</license>
|
||||
<projectUrl>https://github.com/retailcrmapi-client-dotnet</projectUrl>
|
||||
<iconUrl>https://s3-s1.retailcrm.tech/eu-central-1/retailcrm-static/branding/retailcrm/favicon/favicon.ico</iconUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>Multiversion API client for RetailCRM</description>
|
||||
<releaseNotes>Move to async and Http 2.0</releaseNotes>
|
||||
<copyright>Copyright 2017-2024</copyright>
|
||||
<tags>crm ecommerce retailcrm sdk</tags>
|
||||
<dependencies>
|
||||
<dependency id="System.Net.Http.WinHttpHandler" version="9.0.0" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
</package>
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
|
@ -13,7 +14,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public Response CustomersCreate(Dictionary<string, object> customer, string site = "")
|
||||
public Task<Response> CustomersCreate(Dictionary<string, object> customer, string site = "")
|
||||
{
|
||||
if (customer.Count < 1)
|
||||
{
|
||||
|
@ -22,7 +23,7 @@ namespace Retailcrm.Versions.V3
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/customers/create",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
@ -41,7 +42,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public Response CustomersUpdate(Dictionary<string, object> customer, string by = "externalId", string site = "")
|
||||
public Task<Response> CustomersUpdate(Dictionary<string, object> customer, string by = "externalId", string site = "")
|
||||
{
|
||||
if (customer.Count < 1)
|
||||
{
|
||||
|
@ -59,7 +60,7 @@ namespace Retailcrm.Versions.V3
|
|||
|
||||
return Request.MakeRequest(
|
||||
$"/customers/{uid}/edit",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
@ -78,13 +79,13 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="by"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response CustomersGet(string id, string by = "externalId", string site = "")
|
||||
public Task<Response> CustomersGet(string id, string by = "externalId", string site = "")
|
||||
{
|
||||
CheckIdParameter(by);
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/customers/{id}",
|
||||
Request.MethodGet,
|
||||
System.Net.Http.HttpMethod.Get,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
@ -102,26 +103,18 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response CustomersList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> CustomersList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (filter != null && filter.Count > 0)
|
||||
{
|
||||
parameters.Add("filter", filter);
|
||||
}
|
||||
parameters.Add("filter", filter);
|
||||
|
||||
if (page > 0)
|
||||
{
|
||||
parameters.Add("page", page);
|
||||
}
|
||||
|
||||
if (limit > 0)
|
||||
{
|
||||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/customers", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/customers", System.Net.Http.HttpMethod.Get, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -129,11 +122,11 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public Response CustomersFixExternalIds(Dictionary<string, object>[] ids)
|
||||
public Task<Response> CustomersFixExternalIds(Dictionary<string, object>[] ids)
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/customers/fix-external-ids",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "customers", new JavaScriptSerializer().Serialize(ids) }
|
||||
|
@ -148,21 +141,15 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public Response CustomersUpload(List<object> customers, string site = "")
|
||||
public Task<Response> CustomersUpload(List<object> customers, string site = "")
|
||||
{
|
||||
if (customers.Count < 1)
|
||||
{
|
||||
throw new ArgumentException("Parameter `customers` must contains a data");
|
||||
}
|
||||
|
||||
if (customers.Count > 50)
|
||||
{
|
||||
throw new ArgumentException("Parameter `customers` must contain 50 or less records");
|
||||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
"/customers/upload",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
|
@ -12,7 +13,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="order"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response OrdersCreate(Dictionary<string, object> order, string site = "")
|
||||
public Task<Response> OrdersCreate(Dictionary<string, object> order, string site = "")
|
||||
{
|
||||
if (order.Count < 1)
|
||||
{
|
||||
|
@ -21,7 +22,7 @@ namespace Retailcrm.Versions.V3
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/orders/create",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
@ -39,7 +40,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="by"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response OrdersUpdate(Dictionary<string, object> order, string by = "externalId", string site = "")
|
||||
public Task<Response> OrdersUpdate(Dictionary<string, object> order, string by = "externalId", string site = "")
|
||||
{
|
||||
if (order.Count < 1)
|
||||
{
|
||||
|
@ -57,7 +58,7 @@ namespace Retailcrm.Versions.V3
|
|||
|
||||
return Request.MakeRequest(
|
||||
$"/orders/{uid}/edit",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
@ -76,13 +77,13 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="by"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response OrdersGet(string id, string by = "externalId", string site = "")
|
||||
public Task<Response> OrdersGet(string id, string by = "externalId", string site = "")
|
||||
{
|
||||
CheckIdParameter(by);
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/orders/{id}",
|
||||
Request.MethodGet,
|
||||
System.Net.Http.HttpMethod.Get,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
@ -100,7 +101,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response OrdersList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> OrdersList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
|
||||
|
@ -119,7 +120,7 @@ namespace Retailcrm.Versions.V3
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/orders", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/orders", System.Net.Http.HttpMethod.Get, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -127,11 +128,11 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public Response OrdersFixExternalIds(Dictionary<string, object>[] ids)
|
||||
public Task<Response> OrdersFixExternalIds(Dictionary<string, object>[] ids)
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/orders/fix-external-ids",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "orders", new JavaScriptSerializer().Serialize(ids) }
|
||||
|
@ -148,9 +149,9 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="offset"></param>
|
||||
/// <param name="skipMyChanges"></param>
|
||||
/// <returns></returns>
|
||||
public Response OrdersHistory(DateTime? startDate = null, DateTime? endDate = null, int limit = 200, int offset = 0, bool skipMyChanges = true)
|
||||
public Task<Response> OrdersHistory(DateTime? startDate = null, DateTime? endDate = null, int limit = 200, int offset = 0, bool skipMyChanges = true)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (startDate != null)
|
||||
{
|
||||
|
@ -176,7 +177,7 @@ namespace Retailcrm.Versions.V3
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/orders/history",
|
||||
Request.MethodGet,
|
||||
System.Net.Http.HttpMethod.Get,
|
||||
parameters
|
||||
);
|
||||
}
|
||||
|
@ -187,9 +188,9 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="ids"></param>
|
||||
/// <param name="externalIds"></param>
|
||||
/// <returns></returns>
|
||||
public Response OrdersStatuses(List<string> ids, List<string> externalIds = null)
|
||||
public Task<Response> OrdersStatuses(List<string> ids, List<string> externalIds = null)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (ids == null && externalIds == null)
|
||||
{
|
||||
|
@ -217,7 +218,7 @@ namespace Retailcrm.Versions.V3
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/orders/statuses",
|
||||
Request.MethodGet,
|
||||
System.Net.Http.HttpMethod.Get,
|
||||
parameters
|
||||
);
|
||||
}
|
||||
|
@ -228,7 +229,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="orders"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response OrdersUpload(List<object> orders, string site = "")
|
||||
public Task<Response> OrdersUpload(List<object> orders, string site = "")
|
||||
{
|
||||
if (orders.Count < 1)
|
||||
{
|
||||
|
@ -242,7 +243,7 @@ namespace Retailcrm.Versions.V3
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/orders/upload",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
|
@ -13,9 +15,9 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response PacksList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> PacksList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (filter != null && filter.Count > 0)
|
||||
{
|
||||
|
@ -32,7 +34,7 @@ namespace Retailcrm.Versions.V3
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/orders/packs", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/orders/packs", System.Net.Http.HttpMethod.Get, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -40,7 +42,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="pack"></param>
|
||||
/// <returns></returns>
|
||||
public Response PacksCreate(Dictionary<string, object> pack)
|
||||
public Task<Response> PacksCreate(Dictionary<string, object> pack)
|
||||
{
|
||||
if (pack.Count < 1)
|
||||
{
|
||||
|
@ -49,7 +51,7 @@ namespace Retailcrm.Versions.V3
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/orders/packs/create",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "pack", new JavaScriptSerializer().Serialize(pack) }
|
||||
|
@ -62,7 +64,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="pack"></param>
|
||||
/// <returns></returns>
|
||||
public Response PacksUpdate(Dictionary<string, object> pack)
|
||||
public Task<Response> PacksUpdate(Dictionary<string, object> pack)
|
||||
{
|
||||
if (pack.Count < 1)
|
||||
{
|
||||
|
@ -75,8 +77,8 @@ namespace Retailcrm.Versions.V3
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/orders/packs/{pack["id"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/orders/packs/{pack["id"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "pack", new JavaScriptSerializer().Serialize(pack) }
|
||||
|
@ -89,11 +91,11 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Response PacksDelete(string id)
|
||||
public Task<Response> PacksDelete(string id)
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
$"/orders/packs/{id}/delete",
|
||||
Request.MethodPost
|
||||
HttpMethod.Post
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -102,11 +104,11 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Response PacksGet(string id)
|
||||
public Task<Response> PacksGet(string id)
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
$"/orders/packs/{id}",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -117,7 +119,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response PacksHistory(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> PacksHistory(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
|
||||
|
@ -136,7 +138,7 @@ namespace Retailcrm.Versions.V3
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/orders/packs/history", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/orders/packs/history", HttpMethod.Get, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
|
@ -10,11 +12,11 @@ namespace Retailcrm.Versions.V3
|
|||
/// Countries
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response Countries()
|
||||
public Task<Response> Countries()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/countries",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -22,11 +24,11 @@ namespace Retailcrm.Versions.V3
|
|||
/// Delivery services
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response DeliveryServices()
|
||||
public Task<Response> DeliveryServices()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/delivery-services",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -34,11 +36,11 @@ namespace Retailcrm.Versions.V3
|
|||
/// Delivery types
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response DeliveryTypes()
|
||||
public Task<Response> DeliveryTypes()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/delivery-types",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -46,11 +48,11 @@ namespace Retailcrm.Versions.V3
|
|||
/// Order methods
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response OrderMethods()
|
||||
public Task<Response> OrderMethods()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/order-methods",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -58,11 +60,11 @@ namespace Retailcrm.Versions.V3
|
|||
/// Order types
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response OrderTypes()
|
||||
public Task<Response> OrderTypes()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/order-types",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -70,84 +72,63 @@ namespace Retailcrm.Versions.V3
|
|||
/// Payment statuses
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response PaymentStatuses()
|
||||
public Task<Response> PaymentStatuses()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/payment-statuses",
|
||||
Request.MethodGet
|
||||
);
|
||||
return Request.MakeRequest("/reference/payment-statuses", HttpMethod.Get);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Payment types
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response PaymentTypes()
|
||||
public Task<Response> PaymentTypes()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/payment-types",
|
||||
Request.MethodGet
|
||||
);
|
||||
return Request.MakeRequest("/reference/payment-types", HttpMethod.Get);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Product statuses
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response ProductStatuses()
|
||||
public Task<Response> ProductStatuses()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/product-statuses",
|
||||
Request.MethodGet
|
||||
);
|
||||
return Request.MakeRequest("/reference/product-statuses", HttpMethod.Get);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sites
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response Sites()
|
||||
public Task<Response> Sites()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/sites",
|
||||
Request.MethodGet
|
||||
);
|
||||
return Request.MakeRequest("/reference/sites", HttpMethod.Get);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Statuses groups
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response StatusGroups()
|
||||
public Task<Response> StatusGroups()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/status-groups",
|
||||
Request.MethodGet
|
||||
);
|
||||
return Request.MakeRequest("/reference/status-groups", HttpMethod.Get);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Statuses
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response Statuses()
|
||||
public Task<Response> Statuses()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/statuses",
|
||||
Request.MethodGet
|
||||
);
|
||||
return Request.MakeRequest("/reference/statuses", HttpMethod.Get);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response Stores()
|
||||
public Task<Response> Stores()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/stores",
|
||||
Request.MethodGet
|
||||
);
|
||||
return Request.MakeRequest("/reference/stores", HttpMethod.Get);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -155,7 +136,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="service"></param>
|
||||
/// <returns></returns>
|
||||
public Response DeliveryServicesEdit(Dictionary<string, object> service)
|
||||
public Task<Response> DeliveryServicesEdit(Dictionary<string, object> service)
|
||||
{
|
||||
if (!service.ContainsKey("code"))
|
||||
{
|
||||
|
@ -168,8 +149,8 @@ namespace Retailcrm.Versions.V3
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/delivery-services/{service["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/reference/delivery-services/{service["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "deliveryService", new JavaScriptSerializer().Serialize(service) }
|
||||
|
@ -182,7 +163,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public Response DeliveryTypesEdit(Dictionary<string, object> type)
|
||||
public Task<Response> DeliveryTypesEdit(Dictionary<string, object> type)
|
||||
{
|
||||
if (!type.ContainsKey("code"))
|
||||
{
|
||||
|
@ -205,8 +186,8 @@ namespace Retailcrm.Versions.V3
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/delivery-types/{type["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/reference/delivery-types/{type["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "deliveryType", new JavaScriptSerializer().Serialize(type) }
|
||||
|
@ -219,7 +200,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="method"></param>
|
||||
/// <returns></returns>
|
||||
public Response OrderMethodsEdit(Dictionary<string, object> method)
|
||||
public Task<Response> OrderMethodsEdit(Dictionary<string, object> method)
|
||||
{
|
||||
if (!method.ContainsKey("code"))
|
||||
{
|
||||
|
@ -232,8 +213,8 @@ namespace Retailcrm.Versions.V3
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/order-methods/{method["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/reference/order-methods/{method["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "orderMethod", new JavaScriptSerializer().Serialize(method) }
|
||||
|
@ -246,7 +227,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public Response OrderTypesEdit(Dictionary<string, object> type)
|
||||
public Task<Response> OrderTypesEdit(Dictionary<string, object> type)
|
||||
{
|
||||
if (!type.ContainsKey("code"))
|
||||
{
|
||||
|
@ -259,8 +240,8 @@ namespace Retailcrm.Versions.V3
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/order-types/{type["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/reference/order-types/{type["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "orderType", new JavaScriptSerializer().Serialize(type) }
|
||||
|
@ -273,7 +254,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="status"></param>
|
||||
/// <returns></returns>
|
||||
public Response PaymentStatusesEdit(Dictionary<string, object> status)
|
||||
public Task<Response> PaymentStatusesEdit(Dictionary<string, object> status)
|
||||
{
|
||||
if (!status.ContainsKey("code"))
|
||||
{
|
||||
|
@ -286,8 +267,8 @@ namespace Retailcrm.Versions.V3
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/payment-statuses/{status["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/reference/payment-statuses/{status["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "paymentStatus", new JavaScriptSerializer().Serialize(status) }
|
||||
|
@ -300,7 +281,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public Response PaymentTypesEdit(Dictionary<string, object> type)
|
||||
public Task<Response> PaymentTypesEdit(Dictionary<string, object> type)
|
||||
{
|
||||
if (!type.ContainsKey("code"))
|
||||
{
|
||||
|
@ -313,8 +294,8 @@ namespace Retailcrm.Versions.V3
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/payment-types/{type["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/reference/payment-types/{type["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "paymentType", new JavaScriptSerializer().Serialize(type) }
|
||||
|
@ -327,7 +308,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="status"></param>
|
||||
/// <returns></returns>
|
||||
public Response ProductStatusesEdit(Dictionary<string, object> status)
|
||||
public Task<Response> ProductStatusesEdit(Dictionary<string, object> status)
|
||||
{
|
||||
if (!status.ContainsKey("code"))
|
||||
{
|
||||
|
@ -340,8 +321,8 @@ namespace Retailcrm.Versions.V3
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/product-statuses/{status["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/reference/product-statuses/{status["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "productStatus", new JavaScriptSerializer().Serialize(status) }
|
||||
|
@ -354,7 +335,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response SitesEdit(Dictionary<string, object> site)
|
||||
public Task<Response> SitesEdit(Dictionary<string, object> site)
|
||||
{
|
||||
if (!site.ContainsKey("code"))
|
||||
{
|
||||
|
@ -372,8 +353,8 @@ namespace Retailcrm.Versions.V3
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/sites/{site["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/reference/sites/{site["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "site", new JavaScriptSerializer().Serialize(site) }
|
||||
|
@ -386,7 +367,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="status"></param>
|
||||
/// <returns></returns>
|
||||
public Response StatusesEdit(Dictionary<string, object> status)
|
||||
public Task<Response> StatusesEdit(Dictionary<string, object> status)
|
||||
{
|
||||
if (!status.ContainsKey("code"))
|
||||
{
|
||||
|
@ -409,8 +390,8 @@ namespace Retailcrm.Versions.V3
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/statuses/{status["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/reference/statuses/{status["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "status", new JavaScriptSerializer().Serialize(status) }
|
||||
|
@ -423,7 +404,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="store"></param>
|
||||
/// <returns></returns>
|
||||
public Response StoresEdit(Dictionary<string, object> store)
|
||||
public Task<Response> StoresEdit(Dictionary<string, object> store)
|
||||
{
|
||||
if (!store.ContainsKey("code"))
|
||||
{
|
||||
|
@ -435,13 +416,13 @@ namespace Retailcrm.Versions.V3
|
|||
throw new ArgumentException("Parameter `name` is missing");
|
||||
}
|
||||
|
||||
List<string> types = new List<string>
|
||||
{
|
||||
List<string> types =
|
||||
[
|
||||
"store-type-online",
|
||||
"store-type-retail",
|
||||
"store-type-supplier",
|
||||
"store-type-warehouse"
|
||||
};
|
||||
];
|
||||
|
||||
if (store.ContainsKey("type") && !types.Contains(store["type"].ToString()))
|
||||
{
|
||||
|
@ -449,8 +430,8 @@ namespace Retailcrm.Versions.V3
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/stores/{store["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/reference/stores/{store["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "store", new JavaScriptSerializer().Serialize(store) }
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace Retailcrm.Versions.V3
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
|
@ -6,11 +8,11 @@
|
|||
/// Update statistic
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response StatisticUpdate()
|
||||
public Task<Response> StatisticUpdate()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/statistic/update",
|
||||
Request.MethodGet
|
||||
System.Net.Http.HttpMethod.Get
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
|
@ -13,9 +14,9 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response StoreInventoriesGet(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> StoreInventoriesGet(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (filter != null && filter.Count > 0)
|
||||
{
|
||||
|
@ -32,7 +33,7 @@ namespace Retailcrm.Versions.V3
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/store/inventories", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/store/inventories", System.Net.Http.HttpMethod.Get, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -41,7 +42,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="offers"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response StoreInventoriesUpload(List<object> offers, string site = "")
|
||||
public Task<Response> StoreInventoriesUpload(List<object> offers, string site = "")
|
||||
{
|
||||
if (offers.Count< 1)
|
||||
{
|
||||
|
@ -55,7 +56,7 @@ namespace Retailcrm.Versions.V3
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/store/inventories/upload",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
|
@ -12,9 +13,9 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="phone"></param>
|
||||
/// <param name="details"></param>
|
||||
/// <returns></returns>
|
||||
public Response TelephonyManagerGet(string phone, string details = "1")
|
||||
public Task<Response> TelephonyManagerGet(string phone, string details = "1")
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (string.IsNullOrEmpty(phone))
|
||||
{
|
||||
|
@ -24,7 +25,7 @@ namespace Retailcrm.Versions.V3
|
|||
parameters.Add("details", details);
|
||||
parameters.Add("phone", phone);
|
||||
|
||||
return Request.MakeRequest("/telephony/manager", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/telephony/manager", System.Net.Http.HttpMethod.Get, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -35,7 +36,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="status"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public Response TelephonyCallEvent(string phone, string type, string status, string code)
|
||||
public Task<Response> TelephonyCallEvent(string phone, string type, string status, string code)
|
||||
{
|
||||
if (string.IsNullOrEmpty(phone))
|
||||
{
|
||||
|
@ -47,8 +48,8 @@ namespace Retailcrm.Versions.V3
|
|||
throw new ArgumentException("Parameter `phone` must contains a data");
|
||||
}
|
||||
|
||||
List<string> statuses = new List<string> { "answered", "busy", "cancel", "failed", "no answered" };
|
||||
List<string> types = new List<string> { "hangup", "in", "out" };
|
||||
List<string> statuses = ["answered", "busy", "cancel", "failed", "no answered"];
|
||||
List<string> types = ["hangup", "in", "out"];
|
||||
|
||||
if (!statuses.Contains(status))
|
||||
{
|
||||
|
@ -62,7 +63,7 @@ namespace Retailcrm.Versions.V3
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/telephony/call/event",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "phone", phone },
|
||||
|
@ -78,7 +79,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// </summary>
|
||||
/// <param name="calls"></param>
|
||||
/// <returns></returns>
|
||||
public Response TelephonyCallsUpload(List<object> calls)
|
||||
public Task<Response> TelephonyCallsUpload(List<object> calls)
|
||||
{
|
||||
if (calls.Count < 1)
|
||||
{
|
||||
|
@ -92,7 +93,7 @@ namespace Retailcrm.Versions.V3
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/telephony/calls/upload",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "calls", new JavaScriptSerializer().Serialize(calls) }
|
||||
|
@ -110,7 +111,7 @@ namespace Retailcrm.Versions.V3
|
|||
/// <param name="logo"></param>
|
||||
/// <param name="active"></param>
|
||||
/// <returns></returns>
|
||||
public Response TelephonySettingsEdit(string code, string clientId, string url, string name, string logo, string active = "true")
|
||||
public Task<Response> TelephonySettingsEdit(string code, string clientId, string url, string name, string logo, string active = "true")
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
|
@ -134,7 +135,7 @@ namespace Retailcrm.Versions.V3
|
|||
|
||||
return Request.MakeRequest(
|
||||
$"/telephony/setting/{code}",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", code },
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
|
@ -11,7 +12,7 @@ namespace Retailcrm.Versions.V4
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response CustomersHistory(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> CustomersHistory(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
|
||||
|
@ -30,7 +31,7 @@ namespace Retailcrm.Versions.V4
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/customers/history", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/customers/history", System.Net.Http.HttpMethod.Get, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
|
@ -11,7 +13,7 @@ namespace Retailcrm.Versions.V4
|
|||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public Response DeliverySettingGet(string code)
|
||||
public Task<Response> DeliverySettingGet(string code)
|
||||
{
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
|
@ -20,7 +22,7 @@ namespace Retailcrm.Versions.V4
|
|||
|
||||
return Request.MakeRequest(
|
||||
$"/delivery/generic/setting/{code}",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -29,7 +31,7 @@ namespace Retailcrm.Versions.V4
|
|||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
/// <returns></returns>
|
||||
public Response DeliverySettingsEdit(Dictionary<string, object> configuration)
|
||||
public Task<Response> DeliverySettingsEdit(Dictionary<string, object> configuration)
|
||||
{
|
||||
if (configuration.Count < 1)
|
||||
{
|
||||
|
@ -57,8 +59,8 @@ namespace Retailcrm.Versions.V4
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/delivery/generic/setting/{configuration["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/delivery/generic/setting/{configuration["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "configuration", new JavaScriptSerializer().Serialize(configuration) }
|
||||
|
@ -72,7 +74,7 @@ namespace Retailcrm.Versions.V4
|
|||
/// <param name="code"></param>
|
||||
/// <param name="statusUpdate"></param>
|
||||
/// <returns></returns>
|
||||
public Response DeliveryTracking(string code, List<object> statusUpdate)
|
||||
public Task<Response> DeliveryTracking(string code, List<object> statusUpdate)
|
||||
{
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
|
@ -86,7 +88,7 @@ namespace Retailcrm.Versions.V4
|
|||
|
||||
return Request.MakeRequest(
|
||||
$"delivery/generic/{code}/edit",
|
||||
Request.MethodPost,
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "statusUpdate", new JavaScriptSerializer().Serialize(statusUpdate) }
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
|
@ -11,7 +12,7 @@ namespace Retailcrm.Versions.V4
|
|||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
/// <returns></returns>
|
||||
public Response MarketplaceSettingsEdit(Dictionary<string, object> configuration)
|
||||
public Task<Response> MarketplaceSettingsEdit(Dictionary<string, object> configuration)
|
||||
{
|
||||
if (configuration.Count < 1)
|
||||
{
|
||||
|
@ -29,8 +30,8 @@ namespace Retailcrm.Versions.V4
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/marketplace/external/setting/{configuration["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/marketplace/external/setting/{configuration["code"]}/edit",
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "configuration", new JavaScriptSerializer().Serialize(configuration) }
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
|
@ -11,7 +13,7 @@ namespace Retailcrm.Versions.V4
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response OrdersHistory(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> OrdersHistory(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
|
||||
|
@ -30,7 +32,7 @@ namespace Retailcrm.Versions.V4
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/orders/history", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/orders/history", HttpMethod.Get, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
|
@ -10,11 +12,11 @@ namespace Retailcrm.Versions.V4
|
|||
/// Price types
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response PriceTypes()
|
||||
public Task<Response> PriceTypes()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/price-types",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -23,7 +25,7 @@ namespace Retailcrm.Versions.V4
|
|||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public Response PriceTypesEdit(Dictionary<string, object> type)
|
||||
public Task<Response> PriceTypesEdit(Dictionary<string, object> type)
|
||||
{
|
||||
if (!type.ContainsKey("code"))
|
||||
{
|
||||
|
@ -36,8 +38,8 @@ namespace Retailcrm.Versions.V4
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/price-types/{type["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/reference/price-types/{type["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "priceType", new JavaScriptSerializer().Serialize(type) }
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
|
@ -13,26 +15,16 @@ namespace Retailcrm.Versions.V4
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response StoreProducts(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> StoreProducts(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
|
||||
Dictionary<string, object> parameters = [];
|
||||
if (filter != null && filter.Count > 0)
|
||||
{
|
||||
parameters.Add("filter", filter);
|
||||
}
|
||||
|
||||
if (page > 0)
|
||||
{
|
||||
parameters.Add("page", page);
|
||||
}
|
||||
|
||||
if (limit > 0)
|
||||
{
|
||||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/store/products", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/store/products", HttpMethod.Get, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -40,21 +32,15 @@ namespace Retailcrm.Versions.V4
|
|||
/// </summary>
|
||||
/// <param name="prices"></param>
|
||||
/// <returns></returns>
|
||||
public Response StorePricesUpload(List<object> prices)
|
||||
public Task<Response> StorePricesUpload(List<object> prices)
|
||||
{
|
||||
if (prices.Count< 1)
|
||||
{
|
||||
throw new ArgumentException("Parameter `prices` must contains a data");
|
||||
}
|
||||
|
||||
if (prices.Count > 250)
|
||||
{
|
||||
throw new ArgumentException("Parameter `prices` must contain 250 or less records");
|
||||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
"/store/prices/upload",
|
||||
Request.MethodPost,
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "prices", new JavaScriptSerializer().Serialize(prices) }
|
||||
|
@ -67,16 +53,13 @@ namespace Retailcrm.Versions.V4
|
|||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public Response StoreSettingGet(string code)
|
||||
public Task<Response> StoreSettingGet(string code)
|
||||
{
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
throw new ArgumentException("Parameter `code` is mandatory");
|
||||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/store/setting/{code}",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -85,7 +68,7 @@ namespace Retailcrm.Versions.V4
|
|||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
/// <returns></returns>
|
||||
public Response StoreSettingsEdit(Dictionary<string, object> configuration)
|
||||
public Task<Response> StoreSettingsEdit(Dictionary<string, object> configuration)
|
||||
{
|
||||
if (configuration.Count < 1)
|
||||
{
|
||||
|
@ -113,8 +96,8 @@ namespace Retailcrm.Versions.V4
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/store/setting/{configuration["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/store/setting/{configuration["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "configuration", new JavaScriptSerializer().Serialize(configuration) }
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
|
@ -11,7 +13,7 @@ namespace Retailcrm.Versions.V4
|
|||
/// </summary>
|
||||
/// <param name="ievent"></param>
|
||||
/// <returns></returns>
|
||||
public Response TelephonyCallEvent(Dictionary<string, object> ievent)
|
||||
public Task<Response> TelephonyCallEvent(Dictionary<string, object> ievent)
|
||||
{
|
||||
if (ievent.Count < 1)
|
||||
{
|
||||
|
@ -33,8 +35,8 @@ namespace Retailcrm.Versions.V4
|
|||
throw new ArgumentException("Parameter `hangupStatus` must contains a data");
|
||||
}
|
||||
|
||||
List<string> statuses = new List<string> { "answered", "busy", "cancel", "failed", "no answered" };
|
||||
List<string> types = new List<string> { "hangup", "in", "out" };
|
||||
List<string> statuses = ["answered", "busy", "cancel", "failed", "no answered"];
|
||||
List<string> types = ["hangup", "in", "out"];
|
||||
|
||||
if (!statuses.Contains(ievent["hangupStatus"].ToString()))
|
||||
{
|
||||
|
@ -48,7 +50,7 @@ namespace Retailcrm.Versions.V4
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/telephony/call/event",
|
||||
Request.MethodPost,
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "event", new JavaScriptSerializer().Serialize(ievent) }
|
||||
|
@ -61,14 +63,14 @@ namespace Retailcrm.Versions.V4
|
|||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public Response TelephonySettingsGet(string code)
|
||||
public Task<Response> TelephonySettingsGet(string code)
|
||||
{
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
throw new ArgumentException("Parameter `code` should contain data");
|
||||
}
|
||||
|
||||
return Request.MakeRequest($"/telephony/setting/{code}", Request.MethodGet);
|
||||
return Request.MakeRequest($"/telephony/setting/{code}", HttpMethod.Get);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -76,7 +78,7 @@ namespace Retailcrm.Versions.V4
|
|||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
/// <returns></returns>
|
||||
public Response TelephonySettingsEdit(Dictionary<string, object> configuration)
|
||||
public Task<Response> TelephonySettingsEdit(Dictionary<string, object> configuration)
|
||||
{
|
||||
if (configuration.Count < 1)
|
||||
{
|
||||
|
@ -104,8 +106,8 @@ namespace Retailcrm.Versions.V4
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/telephony/setting/{configuration["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/telephony/setting/{configuration["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "configuration", new JavaScriptSerializer().Serialize(configuration) }
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
|
@ -11,9 +13,9 @@ namespace Retailcrm.Versions.V4
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response Users(Dictionary<string, object> filter = null, int page = 0, int limit = 0)
|
||||
public Task<Response> Users(Dictionary<string, object> filter = null, int page = 0, int limit = 0)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (filter != null && filter.Count > 0)
|
||||
{
|
||||
|
@ -30,7 +32,7 @@ namespace Retailcrm.Versions.V4
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/users", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/users", HttpMethod.Get, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -39,9 +41,9 @@ namespace Retailcrm.Versions.V4
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response UsersGroups(int page = 1, int limit = 20)
|
||||
public Task<Response> UsersGroups(int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (page > 0)
|
||||
{
|
||||
|
@ -53,7 +55,7 @@ namespace Retailcrm.Versions.V4
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/user-groups", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/user-groups", HttpMethod.Get, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -61,9 +63,9 @@ namespace Retailcrm.Versions.V4
|
|||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Response User(int id)
|
||||
public Task<Response> User(int id)
|
||||
{
|
||||
return Request.MakeRequest($"/users/{id}", Request.MethodGet);
|
||||
return Request.MakeRequest($"/users/{id}", HttpMethod.Get);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
|
@ -13,9 +15,9 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response CostsList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> CostsList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (filter != null && filter.Count > 0)
|
||||
{
|
||||
|
@ -32,7 +34,7 @@ namespace Retailcrm.Versions.V5
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/costs", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/costs", HttpMethod.Get, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -41,7 +43,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="cost"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response CostsCreate(Dictionary<string, object> cost, string site = "")
|
||||
public Task<Response> CostsCreate(Dictionary<string, object> cost, string site = "")
|
||||
{
|
||||
if (cost.Count < 1)
|
||||
{
|
||||
|
@ -70,7 +72,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/costs/create",
|
||||
Request.MethodPost,
|
||||
HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
@ -86,7 +88,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public Response CostsDelete(List<string> ids)
|
||||
public Task<Response> CostsDelete(List<string> ids)
|
||||
{
|
||||
if (ids.Count < 1)
|
||||
{
|
||||
|
@ -95,7 +97,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/costs/delete",
|
||||
Request.MethodPost,
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "ids", new JavaScriptSerializer().Serialize(ids) }
|
||||
|
@ -108,7 +110,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="costs"></param>
|
||||
/// <returns></returns>
|
||||
public Response CostsUpload(List<object> costs)
|
||||
public Task<Response> CostsUpload(List<object> costs)
|
||||
{
|
||||
if (costs.Count < 1)
|
||||
{
|
||||
|
@ -122,7 +124,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/costs/upload",
|
||||
Request.MethodPost,
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "costs", new JavaScriptSerializer().Serialize(costs) }
|
||||
|
@ -135,9 +137,9 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Response CostsGet(int id)
|
||||
public Task<Response> CostsGet(int id)
|
||||
{
|
||||
return Request.MakeRequest($"/costs/{id}", Request.MethodGet);
|
||||
return Request.MakeRequest($"/costs/{id}", HttpMethod.Get);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -145,11 +147,11 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Response CostsDelete(string id)
|
||||
public Task<Response> CostsDelete(string id)
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
$"/costs/{id}/delete",
|
||||
Request.MethodPost
|
||||
HttpMethod.Post
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -159,7 +161,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="cost"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response CostsUpdate(Dictionary<string, object> cost, string site = "")
|
||||
public Task<Response> CostsUpdate(Dictionary<string, object> cost, string site = "")
|
||||
{
|
||||
if (cost.Count < 1)
|
||||
{
|
||||
|
@ -172,8 +174,8 @@ namespace Retailcrm.Versions.V5
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/costs/{cost["id"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/costs/{cost["id"]}/edit",
|
||||
HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
|
@ -13,9 +15,9 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response CustomFieldsList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> CustomFieldsList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (filter != null && filter.Count > 0)
|
||||
{
|
||||
|
@ -32,7 +34,7 @@ namespace Retailcrm.Versions.V5
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/custom-fields", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/custom-fields", HttpMethod.Get, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -40,12 +42,12 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="customField"></param>
|
||||
/// <returns></returns>
|
||||
public Response CustomFieldsCreate(Dictionary<string, object> customField)
|
||||
public Task<Response> CustomFieldsCreate(Dictionary<string, object> customField)
|
||||
{
|
||||
List<string> types = new List<string>
|
||||
{
|
||||
List<string> types =
|
||||
[
|
||||
"boolean", "date", "dictionary", "email", "integer", "numeric", "string", "text"
|
||||
};
|
||||
];
|
||||
|
||||
if (customField.Count < 1)
|
||||
{
|
||||
|
@ -80,8 +82,8 @@ namespace Retailcrm.Versions.V5
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/custom-fields/{customField["entity"].ToString()}/create",
|
||||
Request.MethodPost,
|
||||
$"/custom-fields/{customField["entity"]}/create",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "customField", new JavaScriptSerializer().Serialize(customField) }
|
||||
|
@ -95,11 +97,11 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="code"></param>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public Response CustomFieldsGet(string code, string entity)
|
||||
public Task<Response> CustomFieldsGet(string code, string entity)
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
$"/custom-fields/{entity}/{code}",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -108,7 +110,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="customField"></param>
|
||||
/// <returns></returns>
|
||||
public Response CustomFieldsUpdate(Dictionary<string, object> customField)
|
||||
public Task<Response> CustomFieldsUpdate(Dictionary<string, object> customField)
|
||||
{
|
||||
if (customField.Count < 1)
|
||||
{
|
||||
|
@ -126,8 +128,8 @@ namespace Retailcrm.Versions.V5
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/custom-fields/{customField["entity"].ToString()}/{customField["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/custom-fields/{customField["entity"]}/{customField["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "customField", new JavaScriptSerializer().Serialize(customField) }
|
||||
|
@ -142,9 +144,9 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response CustomDictionaryList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> CustomDictionaryList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (filter != null && filter.Count > 0)
|
||||
{
|
||||
|
@ -161,7 +163,7 @@ namespace Retailcrm.Versions.V5
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/custom-fields/dictionaries", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/custom-fields/dictionaries", HttpMethod.Get, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -169,7 +171,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="customDictionary"></param>
|
||||
/// <returns></returns>
|
||||
public Response CustomDictionaryCreate(Dictionary<string, object> customDictionary)
|
||||
public Task<Response> CustomDictionaryCreate(Dictionary<string, object> customDictionary)
|
||||
{
|
||||
if (customDictionary.Count < 1)
|
||||
{
|
||||
|
@ -188,7 +190,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/custom-fields/dictionaries/create",
|
||||
Request.MethodPost,
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "customDictionary", new JavaScriptSerializer().Serialize(customDictionary) }
|
||||
|
@ -201,11 +203,11 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public Response CustomDictionaryGet(string code)
|
||||
public Task<Response> CustomDictionaryGet(string code)
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
$"/custom-fields/dictionaries/{code}",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -214,7 +216,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="customDictionary"></param>
|
||||
/// <returns></returns>
|
||||
public Response CustomDictionaryUpdate(Dictionary<string, object> customDictionary)
|
||||
public Task<Response> CustomDictionaryUpdate(Dictionary<string, object> customDictionary)
|
||||
{
|
||||
if (customDictionary.Count < 1)
|
||||
{
|
||||
|
@ -232,8 +234,8 @@ namespace Retailcrm.Versions.V5
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/custom-fields/dictionaries/{customDictionary["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/custom-fields/dictionaries/{customDictionary["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "customDictionary", new JavaScriptSerializer().Serialize(customDictionary) }
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
|
@ -10,7 +11,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public new Response DeliverySettingGet(string code)
|
||||
public new Task<Response> DeliverySettingGet(string code)
|
||||
{
|
||||
throw new ArgumentException("This method is unavailable in API V5", code);
|
||||
}
|
||||
|
@ -20,7 +21,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
/// <returns></returns>
|
||||
public new Response DeliverySettingsEdit(Dictionary<string, object> configuration)
|
||||
public new Task<Response> DeliverySettingsEdit(Dictionary<string, object> configuration)
|
||||
{
|
||||
throw new ArgumentException("This method is unavailable in API V5");
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
|
@ -11,7 +13,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public Response IntegrationsSettingGet(string code)
|
||||
public Task<Response> IntegrationsSettingGet(string code)
|
||||
{
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
|
@ -20,7 +22,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
$"/integration-modules/{code}",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -29,7 +31,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="integrationModule"></param>
|
||||
/// <returns></returns>
|
||||
public Response IntegrationsSettingsEdit(Dictionary<string, object> integrationModule)
|
||||
public Task<Response> IntegrationsSettingsEdit(Dictionary<string, object> integrationModule)
|
||||
{
|
||||
if (integrationModule.Count < 1)
|
||||
{
|
||||
|
@ -47,8 +49,8 @@ namespace Retailcrm.Versions.V5
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/integration-modules/{integrationModule["code"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/integration-modules/{integrationModule["code"]}/edit",
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "integrationModule", new JavaScriptSerializer().Serialize(integrationModule) }
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
|
@ -12,7 +14,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="note"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response NotesCreate(Dictionary<string, object> note, string site = "")
|
||||
public Task<Response> NotesCreate(Dictionary<string, object> note, string site = "")
|
||||
{
|
||||
if (note.Count < 1)
|
||||
{
|
||||
|
@ -21,7 +23,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/customers/notes/create",
|
||||
Request.MethodPost,
|
||||
HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
@ -37,11 +39,11 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Response NotesDelete(string id)
|
||||
public Task<Response> NotesDelete(string id)
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
$"/customers/notes/{id}/delete",
|
||||
Request.MethodPost
|
||||
HttpMethod.Post
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -52,9 +54,9 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response NotesList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> NotesList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (filter != null && filter.Count > 0)
|
||||
{
|
||||
|
@ -71,7 +73,7 @@ namespace Retailcrm.Versions.V5
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/customers/notes", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/customers/notes", HttpMethod.Get, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
|
@ -13,7 +14,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="resultOrder"></param>
|
||||
/// <param name="technique"></param>
|
||||
/// <returns></returns>
|
||||
public Response OrdersCombine(Dictionary<string, object> order, Dictionary<string, object> resultOrder, string technique = "ours")
|
||||
public Task<Response> OrdersCombine(Dictionary<string, object> order, Dictionary<string, object> resultOrder, string technique = "ours")
|
||||
{
|
||||
if (order.Count <= 0)
|
||||
{
|
||||
|
@ -37,7 +38,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/orders/combine",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "technique", technique },
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
|
@ -12,7 +13,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="payment"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response PaymentsCreate(Dictionary<string, object> payment, string site = "")
|
||||
public Task<Response> PaymentsCreate(Dictionary<string, object> payment, string site = "")
|
||||
{
|
||||
if (payment.Count < 1)
|
||||
{
|
||||
|
@ -31,7 +32,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/orders/payments/create",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
@ -49,7 +50,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="by"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response PaymentsUpdate(Dictionary<string, object> payment, string by = "id", string site = "")
|
||||
public Task<Response> PaymentsUpdate(Dictionary<string, object> payment, string by = "id", string site = "")
|
||||
{
|
||||
if (payment.Count < 1)
|
||||
{
|
||||
|
@ -67,7 +68,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
$"/orders/payments/{uid}/edit",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
@ -84,11 +85,11 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Response PaymentsDelete(string id)
|
||||
public Task<Response> PaymentsDelete(string id)
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
$"/orders/payments/{id}/delete",
|
||||
Request.MethodPost
|
||||
System.Net.Http.HttpMethod.Post
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
|
@ -10,11 +11,11 @@ namespace Retailcrm.Versions.V5
|
|||
/// Costs groups
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response CostGroups()
|
||||
public Task<Response> CostGroups()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/cost-groups",
|
||||
Request.MethodGet
|
||||
System.Net.Http.HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -22,11 +23,11 @@ namespace Retailcrm.Versions.V5
|
|||
/// Costs
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response CostItems()
|
||||
public Task<Response> CostItems()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/cost-items",
|
||||
Request.MethodGet
|
||||
System.Net.Http.HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -34,11 +35,11 @@ namespace Retailcrm.Versions.V5
|
|||
/// Legal entities
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response LegalEntities()
|
||||
public Task<Response> LegalEntities()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/legal-entities",
|
||||
Request.MethodGet
|
||||
System.Net.Http.HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -47,7 +48,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="group"></param>
|
||||
/// <returns></returns>
|
||||
public Response CostGroupsEdit(Dictionary<string, object> group)
|
||||
public Task<Response> CostGroupsEdit(Dictionary<string, object> group)
|
||||
{
|
||||
if (!group.ContainsKey("code"))
|
||||
{
|
||||
|
@ -66,7 +67,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/cost-groups/{@group["code"]}/edit",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "costGroup", new JavaScriptSerializer().Serialize(group) }
|
||||
|
@ -79,7 +80,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public Response CostItemsEdit(Dictionary<string, object> item)
|
||||
public Task<Response> CostItemsEdit(Dictionary<string, object> item)
|
||||
{
|
||||
if (!item.ContainsKey("code"))
|
||||
{
|
||||
|
@ -96,11 +97,10 @@ namespace Retailcrm.Versions.V5
|
|||
throw new ArgumentException("Parameter `group` is missing");
|
||||
}
|
||||
|
||||
List<string> types = new List<string>
|
||||
{
|
||||
List<string> types = [
|
||||
"const",
|
||||
"var"
|
||||
};
|
||||
];
|
||||
|
||||
if (item.ContainsKey("type") && !types.Contains(item["type"].ToString()))
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/cost-items/{item["code"]}/edit",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "costItem", new JavaScriptSerializer().Serialize(item) }
|
||||
|
@ -122,7 +122,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public Response LegalEntitiesEdit(Dictionary<string, object> entity)
|
||||
public Task<Response> LegalEntitiesEdit(Dictionary<string, object> entity)
|
||||
{
|
||||
if (!entity.ContainsKey("code"))
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/legal-entities/{entity["code"]}/edit",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "legalEntity", new JavaScriptSerializer().Serialize(entity) }
|
||||
|
@ -158,11 +158,11 @@ namespace Retailcrm.Versions.V5
|
|||
/// Couriers list
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Response Couriers()
|
||||
public Task<Response> Couriers()
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/couriers",
|
||||
Request.MethodGet
|
||||
System.Net.Http.HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -171,11 +171,11 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="courier"></param>
|
||||
/// <returns></returns>
|
||||
public Response CouriersCreate(Dictionary<string, object> courier)
|
||||
public Task<Response> CouriersCreate(Dictionary<string, object> courier)
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
"/reference/couriers/create",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "courier", new JavaScriptSerializer().Serialize(courier) }
|
||||
|
@ -188,7 +188,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="courier"></param>
|
||||
/// <returns></returns>
|
||||
public Response CouriersEdit(Dictionary<string, object> courier)
|
||||
public Task<Response> CouriersEdit(Dictionary<string, object> courier)
|
||||
{
|
||||
if (!courier.ContainsKey("id"))
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
$"/reference/couriers/{courier["id"]}/edit",
|
||||
Request.MethodPost,
|
||||
System.Net.Http.HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "courier", new JavaScriptSerializer().Serialize(courier) }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
|
@ -11,7 +12,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response Segments(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> Segments(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
|
||||
|
@ -30,7 +31,7 @@ namespace Retailcrm.Versions.V5
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/segments", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/segments", System.Net.Http.HttpMethod.Get, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
|
@ -10,7 +11,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public new Response StoreSettingGet(string code)
|
||||
public new Task<Response> StoreSettingGet(string code)
|
||||
{
|
||||
throw new ArgumentException("This method is unavailable in API V5", code);
|
||||
}
|
||||
|
@ -20,7 +21,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
/// <returns></returns>
|
||||
public new Response StoreSettingsEdit(Dictionary<string, object> configuration)
|
||||
public new Task<Response> StoreSettingsEdit(Dictionary<string, object> configuration)
|
||||
{
|
||||
throw new ArgumentException("This method is unavailable in API V5");
|
||||
}
|
||||
|
@ -32,9 +33,9 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response StoreProductsGroups(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> StoreProductsGroups(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (filter != null && filter.Count > 0)
|
||||
{
|
||||
|
@ -51,7 +52,7 @@ namespace Retailcrm.Versions.V5
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/store/products-groups", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/store/products-groups", System.Net.Http.HttpMethod.Get, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -61,9 +62,9 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response StoreProductsProperties(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> StoreProductsProperties(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (filter != null && filter.Count > 0)
|
||||
{
|
||||
|
@ -80,7 +81,7 @@ namespace Retailcrm.Versions.V5
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/store/products/properties", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/store/products/properties", System.Net.Http.HttpMethod.Get, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
|
@ -12,7 +14,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="task"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response TasksCreate(Dictionary<string, object> task, string site = "")
|
||||
public Task<Response> TasksCreate(Dictionary<string, object> task, string site = "")
|
||||
{
|
||||
if (task.Count < 1)
|
||||
{
|
||||
|
@ -21,7 +23,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
"/tasks/create",
|
||||
Request.MethodPost,
|
||||
HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
@ -38,7 +40,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="task"></param>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
public Response TasksUpdate(Dictionary<string, object> task, string site = "")
|
||||
public Task<Response> TasksUpdate(Dictionary<string, object> task, string site = "")
|
||||
{
|
||||
if (task.Count < 1)
|
||||
{
|
||||
|
@ -51,8 +53,8 @@ namespace Retailcrm.Versions.V5
|
|||
}
|
||||
|
||||
return Request.MakeRequest(
|
||||
$"/tasks/{task["id"].ToString()}/edit",
|
||||
Request.MethodPost,
|
||||
$"/tasks/{task["id"]}/edit",
|
||||
HttpMethod.Post,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>
|
||||
|
@ -68,11 +70,11 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Response TasksGet(string id)
|
||||
public Task<Response> TasksGet(string id)
|
||||
{
|
||||
return Request.MakeRequest(
|
||||
$"/tasks/{id}",
|
||||
Request.MethodGet
|
||||
HttpMethod.Get
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -83,9 +85,9 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public Response TasksList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
public Task<Response> TasksList(Dictionary<string, object> filter = null, int page = 1, int limit = 20)
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Dictionary<string, object> parameters = [];
|
||||
|
||||
if (filter != null && filter.Count > 0)
|
||||
{
|
||||
|
@ -102,7 +104,7 @@ namespace Retailcrm.Versions.V5
|
|||
parameters.Add("limit", limit);
|
||||
}
|
||||
|
||||
return Request.MakeRequest("/tasks", Request.MethodGet, parameters);
|
||||
return Request.MakeRequest("/tasks", HttpMethod.Get, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
|
@ -10,7 +11,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public new Response TelephonySettingsGet(string code)
|
||||
public new Task<Response> TelephonySettingsGet(string code)
|
||||
{
|
||||
throw new ArgumentException("This method is unavailable in API V5", code);
|
||||
}
|
||||
|
@ -20,7 +21,7 @@ namespace Retailcrm.Versions.V5
|
|||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
/// <returns></returns>
|
||||
public new Response TelephonySettingsEdit(Dictionary<string, object> configuration)
|
||||
public new Task<Response> TelephonySettingsEdit(Dictionary<string, object> configuration)
|
||||
{
|
||||
throw new ArgumentException("This method is unavailable in API V5", configuration.ToString());
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
|
@ -11,9 +13,9 @@ namespace Retailcrm.Versions.V5
|
|||
/// <param name="id"></param>
|
||||
/// <param name="status"></param>
|
||||
/// <returns></returns>
|
||||
public Response UsersStatus(int id, string status)
|
||||
public Task<Response> UsersStatus(int id, string status)
|
||||
{
|
||||
List<string> statuses = new List<string> { "free", "busy", "dinner", "break"};
|
||||
List<string> statuses = [ "free", "busy", "dinner", "break"];
|
||||
|
||||
if (!statuses.Contains(status))
|
||||
{
|
||||
|
@ -22,7 +24,7 @@ namespace Retailcrm.Versions.V5
|
|||
|
||||
return Request.MakeRequest(
|
||||
$"/users/{id}/status",
|
||||
Request.MethodPost,
|
||||
HttpMethod.Post,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "status", status }
|
||||
|
|
8
Retailcrm/packages.config
Normal file
8
Retailcrm/packages.config
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.5.5" targetFramework="net462" />
|
||||
<package id="System.Net.Http.WinHttpHandler" version="9.0.0" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net462" />
|
||||
</packages>
|
|
@ -1,5 +1,6 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RetailcrmUnitTest
|
||||
{
|
||||
|
@ -17,9 +18,9 @@ namespace RetailcrmUnitTest
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Versions()
|
||||
public async Task Versions()
|
||||
{
|
||||
Response response = _connection.Versions();
|
||||
Response response = await _connection.Versions();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(response, typeof(Response));
|
||||
|
@ -27,9 +28,9 @@ namespace RetailcrmUnitTest
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Credentials()
|
||||
public async Task Credentials()
|
||||
{
|
||||
Response response = _connection.Credentials();
|
||||
Response response = await _connection.Credentials();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(response, typeof(Response));
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<linker>
|
||||
<assembly fullname="System.Diagnostics.DiagnosticSource">
|
||||
<type fullname="System.Diagnostics.Metrics.MetricsEventSource">
|
||||
<!-- Used by System.Private.CoreLib via reflection to init the EventSource -->
|
||||
<method name="GetInstance" />
|
||||
</type>
|
||||
</assembly>
|
||||
</linker>
|
|
@ -1,6 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props')" />
|
||||
<Import Project="..\packages\MSTest.TestAdapter.3.6.4\build\net462\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.3.6.4\build\net462\MSTest.TestAdapter.props')" />
|
||||
<Import Project="..\packages\Microsoft.Testing.Extensions.Telemetry.1.4.3\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props" Condition="Exists('..\packages\Microsoft.Testing.Extensions.Telemetry.1.4.3\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props')" />
|
||||
<Import Project="..\packages\Microsoft.Testing.Platform.MSBuild.1.4.3\build\netstandard2.0\Microsoft.Testing.Platform.MSBuild.props" Condition="Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.4.3\build\netstandard2.0\Microsoft.Testing.Platform.MSBuild.props')" />
|
||||
<Import Project="..\packages\Microsoft.Testing.Platform.1.4.3\build\netstandard2.0\Microsoft.Testing.Platform.props" Condition="Exists('..\packages\Microsoft.Testing.Platform.1.4.3\build\netstandard2.0\Microsoft.Testing.Platform.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
|
@ -9,7 +12,7 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>RetailcrmUnitTest</RootNamespace>
|
||||
<AssemblyName>RetailcrmUnitTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
|
@ -19,6 +22,7 @@
|
|||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
@ -37,16 +41,75 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.ApplicationInsights, Version=2.22.0.997, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.ApplicationInsights.2.22.0\lib\net46\Microsoft.ApplicationInsights.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Testing.Extensions.Telemetry, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Testing.Extensions.Telemetry.1.4.3\lib\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Testing.Extensions.TrxReport.Abstractions, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Testing.Extensions.TrxReport.Abstractions.1.4.3\lib\netstandard2.0\Microsoft.Testing.Extensions.TrxReport.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Testing.Extensions.VSTestBridge, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Testing.Extensions.VSTestBridge.1.4.3\lib\netstandard2.0\Microsoft.Testing.Extensions.VSTestBridge.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Testing.Platform, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Testing.Platform.1.4.3\lib\netstandard2.0\Microsoft.Testing.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Testing.Platform.MSBuild, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Testing.Platform.MSBuild.1.4.3\lib\netstandard2.0\Microsoft.Testing.Platform.MSBuild.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.TestPlatform.CoreUtilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.TestPlatform.CoreUtilities.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.TestPlatform.PlatformAbstractions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.TestPlatform.PlatformAbstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
<HintPath>..\packages\MSTest.TestFramework.3.6.4\lib\net462\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
<HintPath>..\packages\MSTest.TestFramework.3.6.4\lib\net462\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Collections.Immutable.9.0.0\lib\net462\System.Collections.Immutable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.9.0.0\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System.Net.Http.WinHttpHandler, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Net.Http.WinHttpHandler.9.0.0\lib\net462\System.Net.Http.WinHttpHandler.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Reflection.Metadata, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Reflection.Metadata.9.0.0\lib\net462\System.Reflection.Metadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Xml" />
|
||||
|
@ -87,16 +150,25 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ILLink\ILLink.Descriptors.LibraryBuild.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.1.4.3\build\netstandard2.0\Microsoft.Testing.Platform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.1.4.3\build\netstandard2.0\Microsoft.Testing.Platform.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.4.3\build\netstandard2.0\Microsoft.Testing.Platform.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.MSBuild.1.4.3\build\netstandard2.0\Microsoft.Testing.Platform.MSBuild.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.4.3\build\netstandard2.0\Microsoft.Testing.Platform.MSBuild.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.MSBuild.1.4.3\build\netstandard2.0\Microsoft.Testing.Platform.MSBuild.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Testing.Extensions.Telemetry.1.4.3\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Extensions.Telemetry.1.4.3\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.3.6.4\build\net462\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.3.6.4\build\net462\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.3.6.4\build\net462\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.3.6.4\build\net462\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets')" />
|
||||
<Import Project="..\packages\Microsoft.Testing.Platform.MSBuild.1.4.3\build\netstandard2.0\Microsoft.Testing.Platform.MSBuild.targets" Condition="Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.4.3\build\netstandard2.0\Microsoft.Testing.Platform.MSBuild.targets')" />
|
||||
<Import Project="..\packages\MSTest.TestAdapter.3.6.4\build\net462\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.3.6.4\build\net462\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
|
@ -1,6 +1,7 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V3;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RetailcrmUnitTest.V3
|
||||
{
|
||||
|
@ -30,9 +31,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void StatisticUpdate()
|
||||
public async Task StatisticUpdate()
|
||||
{
|
||||
Response response = _client.StatisticUpdate();
|
||||
Response response = await _client.StatisticUpdate();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(response, typeof(Response));
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V3;
|
||||
|
@ -20,7 +21,7 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CustomersCreateReadUpdate()
|
||||
public async Task CustomersCreateReadUpdate()
|
||||
{
|
||||
Dictionary<string, object> customer = new Dictionary<string, object>
|
||||
{
|
||||
|
@ -31,7 +32,7 @@ namespace RetailcrmUnitTest.V3
|
|||
{"phone", "+78888888888"}
|
||||
};
|
||||
|
||||
Response createResponse = _client.CustomersCreate(customer);
|
||||
Response createResponse = await _client.CustomersCreate(customer);
|
||||
|
||||
Assert.IsTrue(createResponse.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(createResponse, typeof(Response));
|
||||
|
@ -40,7 +41,7 @@ namespace RetailcrmUnitTest.V3
|
|||
|
||||
string id = createResponse.GetResponse()["id"].ToString();
|
||||
|
||||
Response getResponse = _client.CustomersGet(id, "id");
|
||||
Response getResponse = await _client.CustomersGet(id, "id");
|
||||
Assert.IsTrue(getResponse.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(getResponse, typeof(Response));
|
||||
Assert.IsTrue(createResponse.GetStatusCode() == 201);
|
||||
|
@ -52,14 +53,14 @@ namespace RetailcrmUnitTest.V3
|
|||
{"email", "frodobaggins@example.com"}
|
||||
};
|
||||
|
||||
Response updateResponse = _client.CustomersUpdate(update, "id");
|
||||
Response updateResponse = await _client.CustomersUpdate(update, "id");
|
||||
Assert.IsTrue(updateResponse.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(updateResponse, typeof(Response));
|
||||
Assert.IsTrue(updateResponse.GetStatusCode() == 200);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CustomersFixExternalId()
|
||||
public async Task CustomersFixExternalId()
|
||||
{
|
||||
long epochTicks = new DateTime(1970, 1, 1).Ticks;
|
||||
long unixTime = ((DateTime.UtcNow.Ticks - epochTicks) / TimeSpan.TicksPerSecond);
|
||||
|
@ -74,7 +75,7 @@ namespace RetailcrmUnitTest.V3
|
|||
{"phone", "+77777777777"}
|
||||
};
|
||||
|
||||
Response createResponse = _client.CustomersCreate(customer);
|
||||
Response createResponse = await _client.CustomersCreate(customer);
|
||||
string id = createResponse.GetResponse()["id"].ToString();
|
||||
string externalId = $"{unixTime}ID";
|
||||
|
||||
|
@ -92,18 +93,18 @@ namespace RetailcrmUnitTest.V3
|
|||
Assert.IsTrue(createResponse.GetStatusCode() == 201);
|
||||
Assert.IsTrue(createResponse.GetResponse().ContainsKey("id"));
|
||||
|
||||
Response fixResponse = _client.CustomersFixExternalIds(fix);
|
||||
Response fixResponse = await _client.CustomersFixExternalIds(fix);
|
||||
Assert.IsTrue(fixResponse.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(fixResponse, typeof(Response));
|
||||
Assert.IsTrue(fixResponse.GetStatusCode() == 200);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CustomersList()
|
||||
public async Task CustomersList()
|
||||
{
|
||||
_client.SetSite(Environment.GetEnvironmentVariable("RETAILCRM_SITE"));
|
||||
|
||||
Response response = _client.CustomersList();
|
||||
Response response = await _client.CustomersList();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -116,7 +117,7 @@ namespace RetailcrmUnitTest.V3
|
|||
{ "dateTo", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}
|
||||
};
|
||||
|
||||
Response responseFiltered = _client.CustomersList(filter, 2, 100);
|
||||
Response responseFiltered = await _client.CustomersList(filter, 2, 100);
|
||||
|
||||
Assert.IsTrue(responseFiltered.IsSuccessfull());
|
||||
Assert.IsTrue(responseFiltered.GetStatusCode() == 200);
|
||||
|
@ -125,7 +126,7 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CustomersUpload()
|
||||
public async Task CustomersUpload()
|
||||
{
|
||||
List<object> customers = new List<object>();
|
||||
|
||||
|
@ -143,7 +144,7 @@ namespace RetailcrmUnitTest.V3
|
|||
customers.Add(customer);
|
||||
}
|
||||
|
||||
Response response = _client.CustomersUpload(customers);
|
||||
Response response = await _client.CustomersUpload(customers);
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 201);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V3;
|
||||
|
@ -20,7 +22,7 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OrdersCreateReadUpdate()
|
||||
public async Task OrdersCreateReadUpdate()
|
||||
{
|
||||
long epochTicks = new DateTime(1970, 1, 1).Ticks;
|
||||
long unixTime = ((DateTime.UtcNow.Ticks - epochTicks) / TimeSpan.TicksPerSecond);
|
||||
|
@ -36,14 +38,14 @@ namespace RetailcrmUnitTest.V3
|
|||
};
|
||||
|
||||
|
||||
Response createResponse = _client.OrdersCreate(order);
|
||||
Response createResponse = await _client.OrdersCreate(order);
|
||||
Assert.IsTrue(createResponse.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(createResponse, typeof(Response));
|
||||
Assert.IsTrue(createResponse.GetResponse().ContainsKey("id"));
|
||||
|
||||
string id = createResponse.GetResponse()["id"].ToString();
|
||||
|
||||
Response getResponse = _client.OrdersGet(id, "id");
|
||||
Response getResponse = await _client.OrdersGet(id, "id");
|
||||
Assert.IsTrue(getResponse.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(getResponse, typeof(Response));
|
||||
Assert.IsTrue(getResponse.GetResponse().ContainsKey("order"));
|
||||
|
@ -54,14 +56,14 @@ namespace RetailcrmUnitTest.V3
|
|||
{"status", "cancel-other"}
|
||||
};
|
||||
|
||||
Response updateResponse = _client.OrdersUpdate(update, "id");
|
||||
Response updateResponse = await _client.OrdersUpdate(update, "id");
|
||||
Assert.IsTrue(updateResponse.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(updateResponse, typeof(Response));
|
||||
Assert.IsTrue(updateResponse.GetStatusCode() == 200);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OrdersFixExternalId()
|
||||
public async Task OrdersFixExternalId()
|
||||
{
|
||||
long epochTicks = new DateTime(1970, 1, 1).Ticks;
|
||||
long unixTime = ((DateTime.UtcNow.Ticks - epochTicks) / TimeSpan.TicksPerSecond);
|
||||
|
@ -76,7 +78,7 @@ namespace RetailcrmUnitTest.V3
|
|||
{"phone", "+79999999999"}
|
||||
};
|
||||
|
||||
Response createResponse = _client.OrdersCreate(order);
|
||||
Response createResponse = await _client.OrdersCreate(order);
|
||||
string id = createResponse.GetResponse()["id"].ToString();
|
||||
string externalId = $"{unixTime}ID";
|
||||
|
||||
|
@ -93,15 +95,15 @@ namespace RetailcrmUnitTest.V3
|
|||
Assert.IsInstanceOfType(createResponse, typeof(Response));
|
||||
Assert.IsTrue(createResponse.GetResponse().ContainsKey("id"));
|
||||
|
||||
Response fixResponse = _client.OrdersFixExternalIds(fix);
|
||||
Response fixResponse = await _client.OrdersFixExternalIds(fix);
|
||||
Assert.IsTrue(fixResponse.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(fixResponse, typeof(Response));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OrdersList()
|
||||
public async Task OrdersList()
|
||||
{
|
||||
Response response = _client.OrdersList();
|
||||
Response response = await _client.OrdersList();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -114,7 +116,7 @@ namespace RetailcrmUnitTest.V3
|
|||
{ "createdAtTo", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}
|
||||
};
|
||||
|
||||
Response responseFiltered = _client.OrdersList(filter, 2, 100);
|
||||
Response responseFiltered = await _client.OrdersList(filter, 2, 100);
|
||||
|
||||
Assert.IsTrue(responseFiltered.IsSuccessfull());
|
||||
Assert.IsTrue(responseFiltered.GetStatusCode() == 200);
|
||||
|
@ -123,9 +125,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OrdersHistory()
|
||||
public async Task OrdersHistory()
|
||||
{
|
||||
Response response = _client.OrdersHistory();
|
||||
Response response = await _client.OrdersHistory();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -137,7 +139,7 @@ namespace RetailcrmUnitTest.V3
|
|||
DateTime from = datetime.AddHours(-24);
|
||||
DateTime to = datetime.AddHours(-1);
|
||||
|
||||
Response responseFiltered = _client.OrdersHistory(from, to, 50, 1, false);
|
||||
Response responseFiltered = await _client.OrdersHistory(from, to, 50, 1, false);
|
||||
|
||||
Assert.IsTrue(responseFiltered.IsSuccessfull());
|
||||
Assert.IsTrue(responseFiltered.GetStatusCode() == 200);
|
||||
|
@ -146,7 +148,7 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OrdersStatuses()
|
||||
public async Task OrdersStatuses()
|
||||
{
|
||||
List<string> ids = new List<string>();
|
||||
|
||||
|
@ -171,11 +173,11 @@ namespace RetailcrmUnitTest.V3
|
|||
{ "status", statuses[i] }
|
||||
};
|
||||
|
||||
Response createResponse = _client.OrdersCreate(order);
|
||||
Response createResponse = await _client.OrdersCreate(order);
|
||||
ids.Add(createResponse.GetResponse()["id"].ToString());
|
||||
}
|
||||
|
||||
Response response = _client.OrdersStatuses(ids);
|
||||
Response response = await _client.OrdersStatuses(ids);
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -184,7 +186,7 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OrdersUpload()
|
||||
public async Task OrdersUpload()
|
||||
{
|
||||
List<object> orders = new List<object>();
|
||||
|
||||
|
@ -212,7 +214,7 @@ namespace RetailcrmUnitTest.V3
|
|||
orders.Add(order);
|
||||
}
|
||||
|
||||
Response response = _client.OrdersUpload(orders);
|
||||
Response response = await _client.OrdersUpload(orders);
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 201);
|
||||
|
@ -222,38 +224,38 @@ namespace RetailcrmUnitTest.V3
|
|||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `order` must contains a data")]
|
||||
public void OrdersCreateArgumentExeption()
|
||||
public async Task OrdersCreateArgumentExeption()
|
||||
{
|
||||
Dictionary<string, object> order = new Dictionary<string, object>();
|
||||
_client.OrdersCreate(order);
|
||||
await _client.OrdersCreate(order);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `order` must contains a data")]
|
||||
public void OrdersUpdateEmptyOrderArgumentExeption()
|
||||
public async Task OrdersUpdateEmptyOrderArgumentExeption()
|
||||
{
|
||||
Dictionary<string, object> order = new Dictionary<string, object>();
|
||||
_client.OrdersUpdate(order);
|
||||
await _client.OrdersUpdate(order);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `order` must contains an id or externalId")]
|
||||
public void OrdersUpdateIdArgumentExeption()
|
||||
public async Task OrdersUpdateIdArgumentExeption()
|
||||
{
|
||||
Dictionary<string, object> order = new Dictionary<string, object> {{"status", "cancel-other"}};
|
||||
_client.OrdersUpdate(order);
|
||||
await _client.OrdersUpdate(order);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "You must set the array of `ids` or `externalIds`.")]
|
||||
public void OrdersStatusesArgumentExeption()
|
||||
public async Task OrdersStatusesArgumentExeption()
|
||||
{
|
||||
_client.OrdersStatuses(null);
|
||||
await _client.OrdersStatuses(null);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Too many ids or externalIds. Maximum number of elements is 500")]
|
||||
public void OrdersStatusesLimitArgumentExeption()
|
||||
public async Task OrdersStatusesLimitArgumentExeption()
|
||||
{
|
||||
List<string> ids = new List<string>();
|
||||
|
||||
|
@ -262,20 +264,20 @@ namespace RetailcrmUnitTest.V3
|
|||
ids.Add(i.ToString());
|
||||
}
|
||||
|
||||
_client.OrdersStatuses(ids);
|
||||
await _client.OrdersStatuses(ids);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `orders` must contains a data")]
|
||||
public void OrdersUploadEmptyOrdersArgumentExeption()
|
||||
public async Task OrdersUploadEmptyOrdersArgumentExeption()
|
||||
{
|
||||
List<object> orders = new List<object>();
|
||||
_client.OrdersUpload(orders);
|
||||
await _client.OrdersUpload(orders);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `orders` must contain 50 or less records")]
|
||||
public void OrdersUploadLimitArgumentExeption()
|
||||
public async Task OrdersUploadLimitArgumentExeption()
|
||||
{
|
||||
List<object> orders = new List<object>();
|
||||
|
||||
|
@ -294,7 +296,7 @@ namespace RetailcrmUnitTest.V3
|
|||
orders.Add(order);
|
||||
}
|
||||
|
||||
_client.OrdersUpload(orders);
|
||||
await _client.OrdersUpload(orders);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V3;
|
||||
|
@ -24,7 +25,7 @@ namespace RetailcrmUnitTest.V3
|
|||
|
||||
[TestMethod]
|
||||
[Ignore]
|
||||
public void PacksCreateUpdateReadDelete()
|
||||
public async Task PacksCreateUpdateReadDelete()
|
||||
{
|
||||
string uid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 12);
|
||||
|
||||
|
@ -48,14 +49,14 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
};
|
||||
|
||||
Response orderCreateResponse = _client.OrdersCreate(order);
|
||||
Response orderCreateResponse = await _client.OrdersCreate(order);
|
||||
|
||||
Assert.IsTrue(orderCreateResponse.IsSuccessfull());
|
||||
Assert.IsTrue(orderCreateResponse.GetStatusCode() == 201);
|
||||
Assert.IsInstanceOfType(orderCreateResponse, typeof(Response));
|
||||
Assert.IsTrue(orderCreateResponse.GetResponse().ContainsKey("id"));
|
||||
|
||||
Response orderGetResponse = _client.OrdersGet(orderCreateResponse.GetResponse()["id"].ToString(), "id");
|
||||
Response orderGetResponse = await _client.OrdersGet(orderCreateResponse.GetResponse()["id"].ToString(), "id");
|
||||
|
||||
Assert.IsTrue(orderGetResponse.IsSuccessfull());
|
||||
Assert.IsTrue(orderGetResponse.GetStatusCode() == 200);
|
||||
|
@ -83,7 +84,7 @@ namespace RetailcrmUnitTest.V3
|
|||
{ "itemId", id[0]}
|
||||
};
|
||||
|
||||
Response packsCreateResponse = _client.PacksCreate(pack);
|
||||
Response packsCreateResponse = await _client.PacksCreate(pack);
|
||||
|
||||
Debug.WriteLine(packsCreateResponse.GetRawResponse());
|
||||
Assert.IsTrue(packsCreateResponse.IsSuccessfull());
|
||||
|
@ -99,21 +100,21 @@ namespace RetailcrmUnitTest.V3
|
|||
{ "quantity", 2}
|
||||
};
|
||||
|
||||
Response packsUpdateResponse = _client.PacksUpdate(packEdit);
|
||||
Response packsUpdateResponse = await _client.PacksUpdate(packEdit);
|
||||
|
||||
Assert.IsTrue(packsUpdateResponse.IsSuccessfull());
|
||||
Assert.IsTrue(packsUpdateResponse.GetStatusCode() == 200);
|
||||
Assert.IsInstanceOfType(packsUpdateResponse, typeof(Response));
|
||||
Assert.IsTrue(packsUpdateResponse.GetResponse().ContainsKey("id"));
|
||||
|
||||
Response packsGetResponse = _client.PacksGet(packId);
|
||||
Response packsGetResponse = await _client.PacksGet(packId);
|
||||
|
||||
Assert.IsTrue(packsGetResponse.IsSuccessfull());
|
||||
Assert.IsTrue(packsGetResponse.GetStatusCode() == 200);
|
||||
Assert.IsInstanceOfType(packsGetResponse, typeof(Response));
|
||||
Assert.IsTrue(packsGetResponse.GetResponse().ContainsKey("pack"));
|
||||
|
||||
Response packsDeleteResponse = _client.PacksDelete(packId);
|
||||
Response packsDeleteResponse = await _client.PacksDelete(packId);
|
||||
|
||||
Assert.IsTrue(packsDeleteResponse.IsSuccessfull());
|
||||
Assert.IsTrue(packsDeleteResponse.GetStatusCode() == 200);
|
||||
|
@ -122,14 +123,14 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PacksList()
|
||||
public async Task PacksList()
|
||||
{
|
||||
Dictionary<string, object> filter = new Dictionary<string, object>
|
||||
{
|
||||
{ "store", Environment.GetEnvironmentVariable("RETAILCRM_STORE")}
|
||||
};
|
||||
|
||||
Response response = _client.PacksList(filter, 1, 100);
|
||||
Response response = await _client.PacksList(filter, 1, 100);
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -138,14 +139,14 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PacksHistory()
|
||||
public async Task PacksHistory()
|
||||
{
|
||||
Dictionary<string, object> filter = new Dictionary<string, object>
|
||||
{
|
||||
{ "endDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}
|
||||
};
|
||||
|
||||
Response response = _client.PacksHistory(filter, 2, 100);
|
||||
Response response = await _client.PacksHistory(filter, 2, 100);
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -155,30 +156,30 @@ namespace RetailcrmUnitTest.V3
|
|||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `pack` must contains a data")]
|
||||
public void PacksCreateArgumentExeption()
|
||||
public async Task PacksCreateArgumentExeption()
|
||||
{
|
||||
Dictionary<string, object> pack = new Dictionary<string, object>();
|
||||
_client.PacksCreate(pack);
|
||||
await _client.PacksCreate(pack);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `pack` must contains a data")]
|
||||
public void PacksUpdateArgumentExeption()
|
||||
public async Task PacksUpdateArgumentExeption()
|
||||
{
|
||||
Dictionary<string, object> pack = new Dictionary<string, object>();
|
||||
_client.PacksUpdate(pack);
|
||||
await _client.PacksUpdate(pack);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `pack` must contains an id")]
|
||||
public void PacksUpdateWithoutIdArgumentExeption()
|
||||
public async Task PacksUpdateWithoutIdArgumentExeption()
|
||||
{
|
||||
Dictionary<string, object> pack = new Dictionary<string, object>
|
||||
{
|
||||
{ "quantity", 2 }
|
||||
};
|
||||
|
||||
_client.PacksUpdate(pack);
|
||||
await _client.PacksUpdate(pack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V3;
|
||||
|
@ -20,9 +21,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Countries()
|
||||
public async Task Countries()
|
||||
{
|
||||
Response response = _client.Countries();
|
||||
Response response = await _client.Countries();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -31,9 +32,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DeliveryServices()
|
||||
public async Task DeliveryServices()
|
||||
{
|
||||
Response response = _client.DeliveryServices();
|
||||
Response response = await _client.DeliveryServices();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -42,9 +43,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DeliveryTypes()
|
||||
public async Task DeliveryTypes()
|
||||
{
|
||||
Response response = _client.DeliveryTypes();
|
||||
Response response = await _client.DeliveryTypes();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -53,9 +54,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OrderMethods()
|
||||
public async Task OrderMethods()
|
||||
{
|
||||
Response response = _client.OrderMethods();
|
||||
Response response = await _client.OrderMethods();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -64,9 +65,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OrderTypes()
|
||||
public async Task OrderTypes()
|
||||
{
|
||||
Response response = _client.OrderTypes();
|
||||
Response response = await _client.OrderTypes();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -75,9 +76,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PaymentStatuses()
|
||||
public async Task PaymentStatuses()
|
||||
{
|
||||
Response response = _client.PaymentStatuses();
|
||||
Response response = await _client.PaymentStatuses();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -86,9 +87,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PaymentTypes()
|
||||
public async Task PaymentTypes()
|
||||
{
|
||||
Response response = _client.PaymentTypes();
|
||||
Response response = await _client.PaymentTypes();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -97,9 +98,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ProductStatuses()
|
||||
public async Task ProductStatuses()
|
||||
{
|
||||
Response response = _client.ProductStatuses();
|
||||
Response response = await _client.ProductStatuses();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -108,9 +109,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Sites()
|
||||
public async Task Sites()
|
||||
{
|
||||
Response response = _client.Sites();
|
||||
Response response = await _client.Sites();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -119,9 +120,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void StatusGroups()
|
||||
public async Task StatusGroups()
|
||||
{
|
||||
Response response = _client.StatusGroups();
|
||||
Response response = await _client.StatusGroups();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -130,9 +131,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Statuses()
|
||||
public async Task Statuses()
|
||||
{
|
||||
Response response = _client.Statuses();
|
||||
Response response = await _client.Statuses();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -141,9 +142,9 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Stores()
|
||||
public async Task Stores()
|
||||
{
|
||||
Response response = _client.Stores();
|
||||
Response response = await _client.Stores();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -152,11 +153,11 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DeliveryServicesEdit()
|
||||
public async Task DeliveryServicesEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.DeliveryServicesEdit(
|
||||
Response response = await _client.DeliveryServicesEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -171,11 +172,11 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DeliveryTypesEdit()
|
||||
public async Task DeliveryTypesEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.DeliveryTypesEdit(
|
||||
Response response = await _client.DeliveryTypesEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -192,11 +193,11 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OrderMethodsEdit()
|
||||
public async Task OrderMethodsEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.OrderMethodsEdit(
|
||||
Response response =await _client.OrderMethodsEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -211,11 +212,11 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OrderTypesEdit()
|
||||
public async Task OrderTypesEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.OrderTypesEdit(
|
||||
Response response = await _client.OrderTypesEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -230,11 +231,11 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PaymentStatusesEdit()
|
||||
public async Task PaymentStatusesEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.PaymentStatusesEdit(
|
||||
Response response = await _client.PaymentStatusesEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -249,11 +250,11 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PaymentTypesEdit()
|
||||
public async Task PaymentTypesEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.PaymentTypesEdit(
|
||||
Response response = await _client.PaymentTypesEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -268,11 +269,11 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ProductStatusesEdit()
|
||||
public async Task ProductStatusesEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.ProductStatusesEdit(
|
||||
Response response = await _client.ProductStatusesEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -287,11 +288,11 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SitesEdit()
|
||||
public async Task SitesEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.SitesEdit(
|
||||
Response response = await _client.SitesEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -306,11 +307,11 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void StatusesEdit()
|
||||
public async Task StatusesEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.StatusesEdit(
|
||||
Response response = await _client.StatusesEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -327,11 +328,11 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void StoresEdit()
|
||||
public async Task StoresEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.StoresEdit(
|
||||
Response response = await _client.StoresEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V3;
|
||||
|
@ -21,7 +22,7 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void InventoriesUpload()
|
||||
public async Task InventoriesUpload()
|
||||
{
|
||||
List<object> offers = new List<object>
|
||||
{
|
||||
|
@ -69,7 +70,7 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
};
|
||||
|
||||
Response response = _client.StoreInventoriesUpload(offers);
|
||||
Response response = await _client.StoreInventoriesUpload(offers);
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -78,7 +79,7 @@ namespace RetailcrmUnitTest.V3
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Inventories()
|
||||
public async Task Inventories()
|
||||
{
|
||||
Dictionary<string, object> filter = new Dictionary<string, object>
|
||||
{
|
||||
|
@ -86,7 +87,7 @@ namespace RetailcrmUnitTest.V3
|
|||
{ "details", 1}
|
||||
};
|
||||
|
||||
Response response = _client.StoreInventoriesGet(filter, 1, 50);
|
||||
Response response = await _client.StoreInventoriesGet(filter, 1, 50);
|
||||
|
||||
Debug.WriteLine(response.GetRawResponse());
|
||||
|
||||
|
@ -98,15 +99,15 @@ namespace RetailcrmUnitTest.V3
|
|||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `offers` must contains a data")]
|
||||
public void StoreInventoriesUploadArgumentExeption()
|
||||
public async Task StoreInventoriesUploadArgumentExeption()
|
||||
{
|
||||
List<object> offers = new List<object>();
|
||||
_client.StoreInventoriesUpload(offers);
|
||||
await _client.StoreInventoriesUpload(offers);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `offers` must contain 250 or less records")]
|
||||
public void StoreInventoriesUploadLimitArgumentExeption()
|
||||
public async Task StoreInventoriesUploadLimitArgumentExeption()
|
||||
{
|
||||
List<object> offers = new List<object>();
|
||||
|
||||
|
@ -130,7 +131,7 @@ namespace RetailcrmUnitTest.V3
|
|||
);
|
||||
}
|
||||
|
||||
_client.StoreInventoriesUpload(offers);
|
||||
await _client.StoreInventoriesUpload(offers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V3;
|
||||
|
@ -21,9 +22,9 @@ namespace RetailcrmUnitTest.V3
|
|||
|
||||
[TestMethod]
|
||||
[Ignore]
|
||||
public void TelephonyManagerGet()
|
||||
public async Task TelephonyManagerGet()
|
||||
{
|
||||
Response response = _client.TelephonyManagerGet("+79999999999");
|
||||
Response response =await _client.TelephonyManagerGet("+79999999999");
|
||||
Debug.WriteLine(response.GetRawResponse());
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V4;
|
||||
|
@ -20,9 +21,9 @@ namespace RetailcrmUnitTest.V4
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CustomersHistory()
|
||||
public async Task CustomersHistory()
|
||||
{
|
||||
Response response = _client.CustomersHistory();
|
||||
Response response = await _client.CustomersHistory();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -31,7 +32,7 @@ namespace RetailcrmUnitTest.V4
|
|||
|
||||
DateTime datetime = DateTime.Now;
|
||||
|
||||
Response responseFiltered = _client.CustomersHistory(
|
||||
Response responseFiltered = await _client.CustomersHistory(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "startDate", datetime.AddMonths(-2).ToString("yyyy-MM-dd HH:mm:ss") },
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V4;
|
||||
|
@ -21,11 +22,12 @@ namespace RetailcrmUnitTest.V4
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void MarketplaceSettingsEdit()
|
||||
[Ignore]
|
||||
public async Task MarketplaceSettingsEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.MarketplaceSettingsEdit(
|
||||
Response response = await _client.MarketplaceSettingsEdit(
|
||||
new Dictionary<string, object>()
|
||||
{
|
||||
{ "name", $"MarketplaceApp-{guid}" },
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V4;
|
||||
|
@ -20,7 +21,7 @@ namespace RetailcrmUnitTest.V4
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OrdersHistory()
|
||||
public async Task OrdersHistory()
|
||||
{
|
||||
DateTime datetime = DateTime.Now;
|
||||
|
||||
|
@ -30,7 +31,7 @@ namespace RetailcrmUnitTest.V4
|
|||
{ "endDate", datetime.AddHours(-1).ToString("yyyy-MM-dd HH:mm:ss")}
|
||||
};
|
||||
|
||||
Response response = _client.OrdersHistory(filter, 1, 50);
|
||||
Response response = await _client.OrdersHistory(filter, 1, 50);
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -39,7 +40,7 @@ namespace RetailcrmUnitTest.V4
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void BigOrderCreateUpdate()
|
||||
public async Task BigOrderCreateUpdate()
|
||||
{
|
||||
long epochTicks = new DateTime(1970, 1, 1).Ticks;
|
||||
long unixTime = ((DateTime.UtcNow.Ticks - epochTicks) / TimeSpan.TicksPerSecond);
|
||||
|
@ -104,7 +105,7 @@ namespace RetailcrmUnitTest.V4
|
|||
}
|
||||
};
|
||||
|
||||
Response createResponse = _client.OrdersCreate(order);
|
||||
Response createResponse = await _client.OrdersCreate(order);
|
||||
|
||||
Assert.IsTrue(createResponse.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(createResponse, typeof(Response));
|
||||
|
@ -133,7 +134,7 @@ namespace RetailcrmUnitTest.V4
|
|||
newItems.Add(item);
|
||||
}
|
||||
|
||||
Response updateResponse = _client.OrdersUpdate(
|
||||
Response updateResponse = await _client.OrdersUpdate(
|
||||
new Dictionary<string, object> {
|
||||
{ "id", createResponse.GetResponse()["id"].ToString()},
|
||||
{ "items", newItems }
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V4;
|
||||
|
@ -20,9 +21,9 @@ namespace RetailcrmUnitTest.V4
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PriceTypes()
|
||||
public async Task PriceTypes()
|
||||
{
|
||||
Response response = _client.PriceTypes();
|
||||
Response response = await _client.PriceTypes();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -31,11 +32,11 @@ namespace RetailcrmUnitTest.V4
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PriceTypesEdit()
|
||||
public async Task PriceTypesEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.PriceTypesEdit(
|
||||
Response response = await _client.PriceTypesEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V4;
|
||||
|
@ -19,9 +20,9 @@ namespace RetailcrmUnitTest.V4
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void StoreProducts()
|
||||
public async Task StoreProducts()
|
||||
{
|
||||
Response response = _client.StoreProducts();
|
||||
Response response = await _client.StoreProducts();
|
||||
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V4;
|
||||
|
@ -24,33 +25,9 @@ namespace RetailcrmUnitTest.V4
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TelephonySettingsEdit()
|
||||
public async Task TelephonySettingsEdit()
|
||||
{
|
||||
Response response = _client.TelephonySettingsEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
|
||||
{ "code", _telephonyCode},
|
||||
{ "clientId", "4717" },
|
||||
{ "makeCallUrl", $"http://{_telephonyCode}.example.com/call"},
|
||||
{ "name", $"TestTelephony-{_telephonyCode}"},
|
||||
{ "image", _logoUrl},
|
||||
{ "inputEventSupported", true},
|
||||
{ "outputEventSupported", true},
|
||||
{ "hangupEventSupported", true},
|
||||
{
|
||||
"additionalCodes",
|
||||
new List<object>
|
||||
{
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "userId", Environment.GetEnvironmentVariable("RETAILCRM_USER") },
|
||||
{ "code", _phoneCode }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
Response response = await _client.TelephonySettingsEdit(new Dictionary<string, object> { { "code", _telephonyCode }, { "clientId", "4717" }, { "makeCallUrl", $"http://{_telephonyCode}.example.com/call" }, { "name", $"TestTelephony-{_telephonyCode}" }, { "image", _logoUrl }, { "inputEventSupported", true }, { "outputEventSupported", true }, { "hangupEventSupported", true }, { "additionalCodes", new List<object> { new Dictionary<string, object> { { "userId", Environment.GetEnvironmentVariable("RETAILCRM_USER") }, { "code", _phoneCode } } } } });
|
||||
|
||||
Debug.WriteLine(response.GetRawResponse());
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
|
@ -61,9 +38,9 @@ namespace RetailcrmUnitTest.V4
|
|||
|
||||
[TestMethod]
|
||||
[Ignore]
|
||||
public void TelephonyCallEvent()
|
||||
public async Task TelephonyCallEvent()
|
||||
{
|
||||
Response response = _client.TelephonyCallEvent(
|
||||
Response response = await _client.TelephonyCallEvent(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "phone", "+79999999999" },
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V4;
|
||||
|
@ -19,9 +20,9 @@ namespace RetailcrmUnitTest.V4
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UsersGroups()
|
||||
public async Task UsersGroups()
|
||||
{
|
||||
Response usersGroups = _client.UsersGroups();
|
||||
Response usersGroups = await _client.UsersGroups();
|
||||
Assert.IsTrue(usersGroups.IsSuccessfull());
|
||||
Assert.IsTrue(usersGroups.GetStatusCode() == 200);
|
||||
Assert.IsInstanceOfType(usersGroups, typeof(Response));
|
||||
|
@ -29,9 +30,9 @@ namespace RetailcrmUnitTest.V4
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void User()
|
||||
public async Task User()
|
||||
{
|
||||
Response usersGroups = _client.User(int.Parse(Environment.GetEnvironmentVariable("RETAILCRM_USER")));
|
||||
Response usersGroups =await _client.User(int.Parse(Environment.GetEnvironmentVariable("RETAILCRM_USER")));
|
||||
Assert.IsTrue(usersGroups.IsSuccessfull());
|
||||
Assert.IsTrue(usersGroups.GetStatusCode() == 200);
|
||||
Assert.IsInstanceOfType(usersGroups, typeof(Response));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V5;
|
||||
|
@ -21,13 +22,13 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CostsCreateUpdateReadDelete()
|
||||
public async Task CostsCreateUpdateReadDelete()
|
||||
{
|
||||
DateTime datetime = DateTime.Now;
|
||||
|
||||
string groupGuid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response groupResponse = _client.CostGroupsEdit(
|
||||
Response groupResponse = await _client.CostGroupsEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", groupGuid},
|
||||
|
@ -44,7 +45,7 @@ namespace RetailcrmUnitTest.V5
|
|||
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response itemCostResponse = _client.CostItemsEdit(
|
||||
Response itemCostResponse = await _client.CostItemsEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -60,7 +61,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(itemCostResponse, typeof(Response));
|
||||
Assert.IsTrue(itemCostResponse.GetResponse().ContainsKey("success"));
|
||||
|
||||
Response costsCreateResponse = _client.CostsCreate(
|
||||
Response costsCreateResponse = await _client.CostsCreate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "summ", 20000 },
|
||||
|
@ -77,7 +78,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(costsCreateResponse, typeof(Response));
|
||||
Assert.IsTrue(costsCreateResponse.GetResponse().ContainsKey("success"));
|
||||
|
||||
Response costsUpdateResponse = _client.CostsUpdate(
|
||||
Response costsUpdateResponse = await _client.CostsUpdate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "id", costsCreateResponse.GetResponse()["id"].ToString()},
|
||||
|
@ -95,7 +96,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(costsUpdateResponse, typeof(Response));
|
||||
Assert.IsTrue(costsUpdateResponse.GetResponse().ContainsKey("success"));
|
||||
|
||||
Response responseGet = _client.CostsGet(int.Parse(costsCreateResponse.GetResponse()["id"].ToString()));
|
||||
Response responseGet = await _client.CostsGet(int.Parse(costsCreateResponse.GetResponse()["id"].ToString()));
|
||||
|
||||
Debug.WriteLine(responseGet.GetRawResponse());
|
||||
Assert.IsTrue(responseGet.IsSuccessfull());
|
||||
|
@ -103,7 +104,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(responseGet, typeof(Response));
|
||||
Assert.IsTrue(responseGet.GetResponse().ContainsKey("success"));
|
||||
|
||||
Response response = _client.CostsDelete(costsCreateResponse.GetResponse()["id"].ToString());
|
||||
Response response = await _client.CostsDelete(costsCreateResponse.GetResponse()["id"].ToString());
|
||||
|
||||
Debug.WriteLine(response.GetRawResponse());
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
|
@ -113,11 +114,11 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CostsList()
|
||||
public async Task CostsList()
|
||||
{
|
||||
DateTime datetime = DateTime.Now;
|
||||
|
||||
Response responseFiltered = _client.CostsList(
|
||||
Response responseFiltered = await _client.CostsList(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "createdAtFrom", datetime.AddDays(-30).ToString("yyyy-MM-dd HH:mm:ss") }
|
||||
|
@ -134,13 +135,13 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CostsUploadDelete()
|
||||
public async Task CostsUploadDelete()
|
||||
{
|
||||
DateTime datetime = DateTime.Now;
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
string groupGuid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response groupResponse = _client.CostGroupsEdit(
|
||||
Response groupResponse = await _client.CostGroupsEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", groupGuid},
|
||||
|
@ -155,7 +156,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(groupResponse, typeof(Response));
|
||||
Assert.IsTrue(groupResponse.GetResponse().ContainsKey("success"));
|
||||
|
||||
Response itemCostResponse = _client.CostItemsEdit(
|
||||
Response itemCostResponse = await _client.CostItemsEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -171,7 +172,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(itemCostResponse, typeof(Response));
|
||||
Assert.IsTrue(itemCostResponse.GetResponse().ContainsKey("success"));
|
||||
|
||||
Response costsUploadResponse = _client.CostsUpload(
|
||||
Response costsUploadResponse = await _client.CostsUpload(
|
||||
new List<object>
|
||||
{
|
||||
new Dictionary<string, object>
|
||||
|
@ -215,7 +216,7 @@ namespace RetailcrmUnitTest.V5
|
|||
uploadedCosts.Add(uid.ToString());
|
||||
}
|
||||
|
||||
Response costsDeleteResponse = _client.CostsDelete(uploadedCosts);
|
||||
Response costsDeleteResponse = await _client.CostsDelete(uploadedCosts);
|
||||
|
||||
Debug.WriteLine(costsDeleteResponse.GetRawResponse());
|
||||
Assert.IsTrue(costsDeleteResponse.IsSuccessfull());
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V5;
|
||||
|
@ -21,9 +22,9 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CustomFieldsList()
|
||||
public async Task CustomFieldsList()
|
||||
{
|
||||
Response responseFiltered = _client.CustomFieldsList(new Dictionary<string, object> { { "entity", "order" } }, 2, 50);
|
||||
Response responseFiltered = await _client.CustomFieldsList(new Dictionary<string, object> { { "entity", "order" } }, 2, 50);
|
||||
|
||||
Debug.WriteLine(responseFiltered.GetRawResponse());
|
||||
Assert.IsTrue(responseFiltered.IsSuccessfull());
|
||||
|
@ -33,11 +34,11 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CustomFieldsCreateUpdateRead()
|
||||
public async Task CustomFieldsCreateUpdateRead()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response customFieldsCreateResponse = _client.CustomFieldsCreate(
|
||||
Response customFieldsCreateResponse = await _client.CustomFieldsCreate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", $"customfield{guid}" },
|
||||
|
@ -53,7 +54,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(customFieldsCreateResponse, typeof(Response));
|
||||
Assert.IsTrue(customFieldsCreateResponse.GetResponse().ContainsKey("code"));
|
||||
|
||||
Response customFieldGetResponse = _client.CustomFieldsGet($"customfield{guid}", "order");
|
||||
Response customFieldGetResponse = await _client.CustomFieldsGet($"customfield{guid}", "order");
|
||||
|
||||
Debug.WriteLine(customFieldGetResponse.GetRawResponse());
|
||||
Assert.IsTrue(customFieldGetResponse.IsSuccessfull());
|
||||
|
@ -61,7 +62,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(customFieldGetResponse, typeof(Response));
|
||||
Assert.IsTrue(customFieldGetResponse.GetResponse().ContainsKey("customField"));
|
||||
|
||||
Response customFieldsUpdateResponse = _client.CustomFieldsUpdate(
|
||||
Response customFieldsUpdateResponse = await _client.CustomFieldsUpdate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", $"customfield{guid}" },
|
||||
|
@ -80,9 +81,9 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CustomDictionaryList()
|
||||
public async Task CustomDictionaryList()
|
||||
{
|
||||
Response responseFiltered = _client.CustomDictionaryList(new Dictionary<string, object>(), 2, 50);
|
||||
Response responseFiltered = await _client.CustomDictionaryList(new Dictionary<string, object>(), 2, 50);
|
||||
|
||||
Debug.WriteLine(responseFiltered.GetRawResponse());
|
||||
Assert.IsTrue(responseFiltered.IsSuccessfull());
|
||||
|
@ -92,12 +93,12 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CustomDictionariesCreateUpdateRead()
|
||||
public async Task CustomDictionariesCreateUpdateRead()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
string fuid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response customDictionaryCreateResponse = _client.CustomDictionaryCreate(
|
||||
Response customDictionaryCreateResponse = await _client.CustomDictionaryCreate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", $"customdict{guid}" },
|
||||
|
@ -122,7 +123,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(customDictionaryCreateResponse, typeof(Response));
|
||||
Assert.IsTrue(customDictionaryCreateResponse.GetResponse().ContainsKey("code"));
|
||||
|
||||
Response customDictionaryGetResponse = _client.CustomDictionaryGet(customDictionaryCreateResponse.GetResponse()["code"].ToString());
|
||||
Response customDictionaryGetResponse = await _client.CustomDictionaryGet(customDictionaryCreateResponse.GetResponse()["code"].ToString());
|
||||
|
||||
Debug.WriteLine(customDictionaryGetResponse.GetRawResponse());
|
||||
Assert.IsTrue(customDictionaryGetResponse.IsSuccessfull());
|
||||
|
@ -130,7 +131,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(customDictionaryGetResponse, typeof(Response));
|
||||
Assert.IsTrue(customDictionaryGetResponse.GetResponse().ContainsKey("customDictionary"));
|
||||
|
||||
Response customDictionaryEditResponse = _client.CustomDictionaryUpdate(
|
||||
Response customDictionaryEditResponse = await _client.CustomDictionaryUpdate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", $"customdict{guid}" },
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V5;
|
||||
|
@ -21,11 +22,11 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IntegrationsSettingsEditSettingsGet()
|
||||
public async Task IntegrationsSettingsEditSettingsGet()
|
||||
{
|
||||
string uid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.IntegrationsSettingsEdit(
|
||||
Response response = await _client.IntegrationsSettingsEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", uid},
|
||||
|
@ -42,7 +43,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(response, typeof(Response));
|
||||
Assert.IsTrue(response.GetResponse().ContainsKey("success"));
|
||||
|
||||
Response responseGet = _client.IntegrationsSettingGet(uid);
|
||||
Response responseGet = await _client.IntegrationsSettingGet(uid);
|
||||
|
||||
Debug.WriteLine(responseGet.GetRawResponse());
|
||||
Assert.IsTrue(responseGet.IsSuccessfull());
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Diagnostics;
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V5;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RetailcrmUnitTest.V5
|
||||
{
|
||||
|
@ -23,7 +24,7 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void NotesCreateDelete()
|
||||
public async Task NotesCreateDelete()
|
||||
{
|
||||
Dictionary<string, object> customer = new Dictionary<string, object>
|
||||
{
|
||||
|
@ -34,7 +35,7 @@ namespace RetailcrmUnitTest.V5
|
|||
{"phone", "+78888888989"}
|
||||
};
|
||||
|
||||
Response createResponse = _client.CustomersCreate(customer);
|
||||
Response createResponse = await _client.CustomersCreate(customer);
|
||||
|
||||
Assert.IsTrue(createResponse.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(createResponse, typeof(Response));
|
||||
|
@ -43,14 +44,7 @@ namespace RetailcrmUnitTest.V5
|
|||
|
||||
string id = createResponse.GetResponse()["id"].ToString();
|
||||
|
||||
Response responseFiltered = _client.NotesCreate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "text", "test task" },
|
||||
{ "customer", new Dictionary<string, object> { { "id", id } }},
|
||||
{ "managerId", Environment.GetEnvironmentVariable("RETAILCRM_USER")}
|
||||
}
|
||||
);
|
||||
Response responseFiltered = await _client.NotesCreate(new Dictionary<string, object> { { "text", "test task" }, { "customer", new Dictionary<string, object> { { "id", id } } }, { "managerId", Environment.GetEnvironmentVariable("RETAILCRM_USER") } });
|
||||
|
||||
Debug.WriteLine(responseFiltered.GetRawResponse());
|
||||
Assert.IsTrue(responseFiltered.IsSuccessfull());
|
||||
|
@ -58,7 +52,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(responseFiltered, typeof(Response));
|
||||
Assert.IsTrue(responseFiltered.GetResponse().ContainsKey("success"));
|
||||
|
||||
Response response = _client.NotesDelete(responseFiltered.GetResponse()["id"].ToString());
|
||||
Response response = await _client.NotesDelete(responseFiltered.GetResponse()["id"].ToString());
|
||||
|
||||
Debug.WriteLine(response.GetRawResponse());
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
|
@ -68,11 +62,11 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void NotesList()
|
||||
public async Task NotesList()
|
||||
{
|
||||
DateTime datetime = DateTime.Now;
|
||||
|
||||
Response responseFiltered = _client.NotesList(
|
||||
Response responseFiltered = await _client.NotesList(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "createdAtFrom", datetime.AddDays(-30).ToString("yyyy-MM-dd HH:mm:ss") }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V5;
|
||||
|
@ -21,7 +22,7 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OrdersCombine()
|
||||
public async Task OrdersCombine()
|
||||
{
|
||||
Dictionary<string, object> firstOrder = new Dictionary<string, object>
|
||||
{
|
||||
|
@ -34,7 +35,7 @@ namespace RetailcrmUnitTest.V5
|
|||
};
|
||||
|
||||
|
||||
Response createFirstResponse = _client.OrdersCreate(firstOrder);
|
||||
Response createFirstResponse = await _client.OrdersCreate(firstOrder);
|
||||
Assert.IsTrue(createFirstResponse.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(createFirstResponse, typeof(Response));
|
||||
Assert.IsTrue(createFirstResponse.GetResponse().ContainsKey("id"));
|
||||
|
@ -52,7 +53,7 @@ namespace RetailcrmUnitTest.V5
|
|||
};
|
||||
|
||||
|
||||
Response createSecondResponse = _client.OrdersCreate(secondOrder);
|
||||
Response createSecondResponse = await _client.OrdersCreate(secondOrder);
|
||||
Assert.IsTrue(createSecondResponse.IsSuccessfull());
|
||||
Assert.IsInstanceOfType(createSecondResponse, typeof(Response));
|
||||
Assert.IsTrue(createSecondResponse.GetResponse().ContainsKey("id"));
|
||||
|
@ -69,7 +70,7 @@ namespace RetailcrmUnitTest.V5
|
|||
{"id", secondId }
|
||||
};
|
||||
|
||||
Response combineResponse = _client.OrdersCombine(firstCombineOrder, secondCombineOrder);
|
||||
Response combineResponse = await _client.OrdersCombine(firstCombineOrder, secondCombineOrder);
|
||||
|
||||
Debug.WriteLine(combineResponse.GetRawResponse());
|
||||
|
||||
|
@ -79,7 +80,7 @@ namespace RetailcrmUnitTest.V5
|
|||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `order` must contains a data")]
|
||||
public void OrdersCombineEmptyOrderArgumentExeption()
|
||||
public async Task OrdersCombineEmptyOrderArgumentExeption()
|
||||
{
|
||||
Dictionary<string, object> firstOrder = new Dictionary<string, object>();
|
||||
Dictionary<string, object> secondOrder = new Dictionary<string, object>
|
||||
|
@ -87,12 +88,12 @@ namespace RetailcrmUnitTest.V5
|
|||
{ "id", "111" }
|
||||
};
|
||||
|
||||
_client.OrdersCombine(firstOrder, secondOrder);
|
||||
await _client.OrdersCombine(firstOrder, secondOrder);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `resultOrder` must contains a data")]
|
||||
public void OrdersCombineEmptyResultOrderArgumentExeption()
|
||||
public async Task OrdersCombineEmptyResultOrderArgumentExeption()
|
||||
{
|
||||
Dictionary<string, object> secondOrder = new Dictionary<string, object>();
|
||||
Dictionary<string, object> firstOrder = new Dictionary<string, object>
|
||||
|
@ -100,12 +101,12 @@ namespace RetailcrmUnitTest.V5
|
|||
{ "id", "111" }
|
||||
};
|
||||
|
||||
_client.OrdersCombine(firstOrder, secondOrder);
|
||||
await _client.OrdersCombine(firstOrder, secondOrder);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `order` must contains `id` key")]
|
||||
public void OrdersCombineEmptyIdOrderArgumentExeption()
|
||||
public async Task OrdersCombineEmptyIdOrderArgumentExeption()
|
||||
{
|
||||
Dictionary<string, object> firstOrder = new Dictionary<string, object>
|
||||
{
|
||||
|
@ -117,12 +118,12 @@ namespace RetailcrmUnitTest.V5
|
|||
{ "id", "111" }
|
||||
};
|
||||
|
||||
_client.OrdersCombine(firstOrder, secondOrder);
|
||||
await _client.OrdersCombine(firstOrder, secondOrder);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Parameter `resultOrder` must contains `id` key")]
|
||||
public void OrdersCombineEmptyIdResultOrderArgumentExeption()
|
||||
public async Task OrdersCombineEmptyIdResultOrderArgumentExeption()
|
||||
{
|
||||
Dictionary<string, object> secondOrder = new Dictionary<string, object>
|
||||
{
|
||||
|
@ -134,7 +135,7 @@ namespace RetailcrmUnitTest.V5
|
|||
{ "id", "111" }
|
||||
};
|
||||
|
||||
_client.OrdersCombine(firstOrder, secondOrder);
|
||||
await _client.OrdersCombine(firstOrder, secondOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V5;
|
||||
|
@ -21,12 +22,12 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PaymentsCreateUpdateDelete()
|
||||
public async Task PaymentsCreateUpdateDelete()
|
||||
{
|
||||
DateTime datetime = DateTime.Now;
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response createResponse = _client.OrdersCreate(new Dictionary<string, object>
|
||||
Response createResponse = await _client.OrdersCreate(new Dictionary<string, object>
|
||||
{
|
||||
{"externalId", guid},
|
||||
{"createdAt", datetime.ToString("yyyy-MM-dd HH:mm:ss")},
|
||||
|
@ -41,7 +42,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(createResponse, typeof(Response));
|
||||
Assert.IsTrue(createResponse.GetResponse().ContainsKey("id"));
|
||||
|
||||
Response paymentCreateResponse = _client.PaymentsCreate(
|
||||
Response paymentCreateResponse = await _client.PaymentsCreate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "externalId", guid },
|
||||
|
@ -57,7 +58,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(paymentCreateResponse, typeof(Response));
|
||||
Assert.IsTrue(paymentCreateResponse.GetResponse().ContainsKey("success"));
|
||||
|
||||
Response paymentUpdateResponse = _client.PaymentsUpdate(
|
||||
Response paymentUpdateResponse = await _client.PaymentsUpdate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "id", paymentCreateResponse.GetResponse()["id"].ToString()},
|
||||
|
@ -72,7 +73,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(paymentUpdateResponse, typeof(Response));
|
||||
Assert.IsTrue(paymentUpdateResponse.GetResponse().ContainsKey("success"));
|
||||
|
||||
Response response = _client.PaymentsDelete(paymentCreateResponse.GetResponse()["id"].ToString());
|
||||
Response response = await _client.PaymentsDelete(paymentCreateResponse.GetResponse()["id"].ToString());
|
||||
|
||||
Debug.WriteLine(response.GetRawResponse());
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V5;
|
||||
|
@ -21,9 +22,9 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CostGroups()
|
||||
public async Task CostGroups()
|
||||
{
|
||||
Response response = _client.CostGroups();
|
||||
Response response = await _client.CostGroups();
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
Assert.IsInstanceOfType(response, typeof(Response));
|
||||
|
@ -31,9 +32,9 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CostItems()
|
||||
public async Task CostItems()
|
||||
{
|
||||
Response response = _client.CostItems();
|
||||
Response response = await _client.CostItems();
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
Assert.IsInstanceOfType(response, typeof(Response));
|
||||
|
@ -41,9 +42,9 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void LegalEntities()
|
||||
public async Task LegalEntities()
|
||||
{
|
||||
Response response = _client.LegalEntities();
|
||||
Response response = await _client.LegalEntities();
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
Assert.IsInstanceOfType(response, typeof(Response));
|
||||
|
@ -51,16 +52,15 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CostGroupsEdit()
|
||||
public async Task CostGroupsEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.CostGroupsEdit(
|
||||
Response response = await _client.CostGroupsEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
{ "name", $"TestCostGroup-{guid}" },
|
||||
{ "color", "#da5c98" }
|
||||
{ "color", "#dd4040" }
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -71,11 +71,11 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CostItemsEdit()
|
||||
public async Task CostItemsEdit()
|
||||
{
|
||||
string groupGuid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response groupResponse = _client.CostGroupsEdit(
|
||||
Response groupResponse = await _client.CostGroupsEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", groupGuid},
|
||||
|
@ -91,7 +91,7 @@ namespace RetailcrmUnitTest.V5
|
|||
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.CostItemsEdit(
|
||||
Response response = await _client.CostItemsEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -108,11 +108,11 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void LegalEntitiesEdit()
|
||||
public async Task LegalEntitiesEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
Response response = _client.LegalEntitiesEdit(
|
||||
Response response = await _client.LegalEntitiesEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", guid},
|
||||
|
@ -131,9 +131,9 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Couriers()
|
||||
public async Task Couriers()
|
||||
{
|
||||
Response response = _client.Couriers();
|
||||
Response response = await _client.Couriers();
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
Assert.IsInstanceOfType(response, typeof(Response));
|
||||
|
@ -141,11 +141,11 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CouriersCreate()
|
||||
public async Task CouriersCreate()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 3);
|
||||
|
||||
Response response = _client.CouriersCreate(
|
||||
Response response = await _client.CouriersCreate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "firstName", $"CourierFirstName-{guid}"},
|
||||
|
@ -164,11 +164,11 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CouriersEdit()
|
||||
public async Task CouriersEdit()
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 3);
|
||||
|
||||
Response response = _client.CouriersCreate(
|
||||
Response response = await _client.CouriersCreate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "firstName", $"CourierFirstName-{guid}"},
|
||||
|
@ -187,7 +187,7 @@ namespace RetailcrmUnitTest.V5
|
|||
|
||||
string id = response.GetResponse()["id"].ToString();
|
||||
|
||||
Response responseEdit = _client.CouriersEdit(
|
||||
Response responseEdit = await _client.CouriersEdit(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "id", id},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V5;
|
||||
|
@ -20,9 +21,9 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Segments()
|
||||
public async Task Segments()
|
||||
{
|
||||
Response responseFiltered = _client.Segments(
|
||||
Response responseFiltered = await _client.Segments(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "active", "1" }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V5;
|
||||
|
@ -22,11 +23,11 @@ namespace RetailcrmUnitTest.V5
|
|||
|
||||
[TestMethod]
|
||||
[Ignore]
|
||||
public void TasksCreateUpdateGet()
|
||||
public async Task TasksCreateUpdateGet()
|
||||
{
|
||||
DateTime datetime = DateTime.Now;
|
||||
|
||||
Response responseFiltered = _client.TasksCreate(
|
||||
Response responseFiltered = await _client.TasksCreate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "text", "test task" },
|
||||
|
@ -42,7 +43,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(responseFiltered, typeof(Response));
|
||||
Assert.IsTrue(responseFiltered.GetResponse().ContainsKey("success"));
|
||||
|
||||
Response response = _client.TasksUpdate(
|
||||
Response response = await _client.TasksUpdate(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "id", responseFiltered.GetResponse()["id"].ToString()},
|
||||
|
@ -59,7 +60,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Assert.IsInstanceOfType(response, typeof(Response));
|
||||
Assert.IsTrue(response.GetResponse().ContainsKey("success"));
|
||||
|
||||
Response responseGet = _client.TasksGet(responseFiltered.GetResponse()["id"].ToString());
|
||||
Response responseGet = await _client.TasksGet(responseFiltered.GetResponse()["id"].ToString());
|
||||
|
||||
Debug.WriteLine(responseGet.GetRawResponse());
|
||||
Assert.IsTrue(responseGet.IsSuccessfull());
|
||||
|
@ -69,9 +70,9 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TasksList()
|
||||
public async Task TasksList()
|
||||
{
|
||||
Response responseFiltered = _client.TasksList(
|
||||
Response responseFiltered = await _client.TasksList(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "performers", new List<string> { Environment.GetEnvironmentVariable("RETAILCRM_USER") } },
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm.Versions.V5;
|
||||
|
||||
|
@ -20,16 +21,16 @@ namespace RetailcrmUnitTest.V5
|
|||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "This method is unavailable in API V5")]
|
||||
public void TelephonySettingsGetArgumentExeption()
|
||||
public async Task TelephonySettingsGetArgumentExeption()
|
||||
{
|
||||
_client.TelephonySettingsGet("anycode");
|
||||
await _client.TelephonySettingsGet("anycode");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "This method is unavailable in API V5")]
|
||||
public void TelephonySettingsGetTelephonySettingsEditArgumentExeption()
|
||||
public async Task TelephonySettingsGetTelephonySettingsEditArgumentExeption()
|
||||
{
|
||||
_client.TelephonySettingsEdit(new Dictionary<string, object>());
|
||||
await _client.TelephonySettingsEdit(new Dictionary<string, object>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V5;
|
||||
|
@ -21,9 +22,9 @@ namespace RetailcrmUnitTest.V5
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UsersStatus()
|
||||
public async Task UsersStatus()
|
||||
{
|
||||
Response users = _client.Users();
|
||||
Response users = await _client.Users();
|
||||
Assert.IsTrue(users.IsSuccessfull());
|
||||
Assert.IsTrue(users.GetStatusCode() == 200);
|
||||
Assert.IsInstanceOfType(users, typeof(Response));
|
||||
|
@ -34,7 +35,7 @@ namespace RetailcrmUnitTest.V5
|
|||
Debug.Assert(user != null, nameof(user) + " != null");
|
||||
int uid = int.Parse(user["id"].ToString());
|
||||
|
||||
Response status = _client.UsersStatus(uid, "break");
|
||||
Response status = await _client.UsersStatus(uid, "break");
|
||||
Assert.IsTrue(status.IsSuccessfull());
|
||||
Assert.IsTrue(status.GetStatusCode() == 200);
|
||||
Assert.IsInstanceOfType(status, typeof(Response));
|
||||
|
|
|
@ -1,5 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="2.1.0" targetFramework="net45" />
|
||||
<package id="MSTest.TestFramework" version="2.1.0" targetFramework="net45" />
|
||||
<package id="Microsoft.ApplicationInsights" version="2.22.0" targetFramework="net462" />
|
||||
<package id="Microsoft.Testing.Extensions.Telemetry" version="1.4.3" targetFramework="net462" />
|
||||
<package id="Microsoft.Testing.Extensions.TrxReport.Abstractions" version="1.4.3" targetFramework="net462" />
|
||||
<package id="Microsoft.Testing.Extensions.VSTestBridge" version="1.4.3" targetFramework="net462" />
|
||||
<package id="Microsoft.Testing.Platform" version="1.4.3" targetFramework="net462" />
|
||||
<package id="Microsoft.Testing.Platform.MSBuild" version="1.4.3" targetFramework="net462" />
|
||||
<package id="Microsoft.TestPlatform.ObjectModel" version="17.12.0" targetFramework="net462" />
|
||||
<package id="MSTest.TestAdapter" version="3.6.4" targetFramework="net462" />
|
||||
<package id="MSTest.TestFramework" version="3.6.4" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.6.0" targetFramework="net462" />
|
||||
<package id="System.Collections.Immutable" version="9.0.0" targetFramework="net462" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="9.0.0" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.6.0" targetFramework="net462" />
|
||||
<package id="System.Net.Http.WinHttpHandler" version="9.0.0" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net462" />
|
||||
<package id="System.Reflection.Metadata" version="9.0.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net462" />
|
||||
</packages>
|
Loading…
Add table
Reference in a new issue