mirror of
https://github.com/retailcrm/api-client-dotnet.git
synced 2024-11-23 05:16:03 +03:00
72cac6d6f0
* Multiversion sdk * Remove redundant code * More test coverage;
51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web.Script.Serialization;
|
|
|
|
namespace Retailcrm.Versions.V5
|
|
{
|
|
public partial class Client
|
|
{
|
|
/// <summary>
|
|
/// Combine orders
|
|
/// </summary>
|
|
/// <param name="order"></param>
|
|
/// <param name="resultOrder"></param>
|
|
/// <param name="technique"></param>
|
|
/// <returns></returns>
|
|
public Response OrdersCombine(Dictionary<string, object> order, Dictionary<string, object> resultOrder, string technique = "ours")
|
|
{
|
|
if (order.Count <= 0)
|
|
{
|
|
throw new ArgumentException("Parameter `order` must contains a data");
|
|
}
|
|
|
|
if (!order.ContainsKey("id"))
|
|
{
|
|
throw new ArgumentException("Parameter `order` must contains `id` key");
|
|
}
|
|
|
|
if (resultOrder.Count <= 0)
|
|
{
|
|
throw new ArgumentException("Parameter `resultOrder` must contains a data");
|
|
}
|
|
|
|
if (!resultOrder.ContainsKey("id"))
|
|
{
|
|
throw new ArgumentException("Parameter `resultOrder` must contains `id` key");
|
|
}
|
|
|
|
return Request.MakeRequest(
|
|
"/orders/combine",
|
|
Request.MethodPost,
|
|
new Dictionary<string, object>
|
|
{
|
|
{ "technique", technique },
|
|
{ "order", new JavaScriptSerializer().Serialize(order) },
|
|
{ "resultOrder", new JavaScriptSerializer().Serialize(resultOrder) }
|
|
}
|
|
);
|
|
}
|
|
}
|
|
}
|