diff --git a/Retailcrm/Retailcrm.csproj b/Retailcrm/Retailcrm.csproj
index 0048f2f..58508c2 100644
--- a/Retailcrm/Retailcrm.csproj
+++ b/Retailcrm/Retailcrm.csproj
@@ -55,9 +55,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Retailcrm/Versions/V3/Packs.cs b/Retailcrm/Versions/V3/Packs.cs
index f83c8e6..3a81f8b 100644
--- a/Retailcrm/Versions/V3/Packs.cs
+++ b/Retailcrm/Versions/V3/Packs.cs
@@ -69,11 +69,6 @@
public Response PacksDelete(string id)
{
- if (id.Length < 1)
- {
- throw new ArgumentException("Parameter `id` must contains a data");
- }
-
return Request.MakeRequest(
$"/orders/packs/{id}/delete",
Request.MethodPost
diff --git a/Retailcrm/Versions/V3/References.cs b/Retailcrm/Versions/V3/References.cs
index c671608..f9fed36 100644
--- a/Retailcrm/Versions/V3/References.cs
+++ b/Retailcrm/Versions/V3/References.cs
@@ -1,12 +1,363 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Retailcrm.Versions.V3
+namespace Retailcrm.Versions.V3
{
- class References
+ using System;
+ using System.Collections.Generic;
+ using System.Web.Script.Serialization;
+
+ public partial class Client
{
+ public Response Countries()
+ {
+ return Request.MakeRequest(
+ "/reference/countries",
+ Request.MethodGet
+ );
+ }
+
+ public Response DeliveryServices()
+ {
+ return Request.MakeRequest(
+ "/reference/delivery-services",
+ Request.MethodGet
+ );
+ }
+
+ public Response DeliveryTypes()
+ {
+ return Request.MakeRequest(
+ "/reference/delivery-types",
+ Request.MethodGet
+ );
+ }
+
+ public Response OrderMethods()
+ {
+ return Request.MakeRequest(
+ "/reference/order-methods",
+ Request.MethodGet
+ );
+ }
+
+ public Response OrderTypes()
+ {
+ return Request.MakeRequest(
+ "/reference/order-types",
+ Request.MethodGet
+ );
+ }
+
+ public Response PaymentStatuses()
+ {
+ return Request.MakeRequest(
+ "/reference/payment-statuses",
+ Request.MethodGet
+ );
+ }
+
+ public Response PaymentTypes()
+ {
+ return Request.MakeRequest(
+ "/reference/payment-types",
+ Request.MethodGet
+ );
+ }
+
+ public Response ProductStatuses()
+ {
+ return Request.MakeRequest(
+ "/reference/product-statuses",
+ Request.MethodGet
+ );
+ }
+
+ public Response Sites()
+ {
+ return Request.MakeRequest(
+ "/reference/sites",
+ Request.MethodGet
+ );
+ }
+
+ public Response StatusGroups()
+ {
+ return Request.MakeRequest(
+ "/reference/status-groups",
+ Request.MethodGet
+ );
+ }
+
+ public Response Statuses()
+ {
+ return Request.MakeRequest(
+ "/reference/statuses",
+ Request.MethodGet
+ );
+ }
+
+ public Response Stores()
+ {
+ return Request.MakeRequest(
+ "/reference/stores",
+ Request.MethodGet
+ );
+ }
+
+ public Response DeliveryServicesEdit(Dictionary service)
+ {
+ if (!service.ContainsKey("code"))
+ {
+ throw new ArgumentException("Parameter `code` is missing");
+ }
+
+ if (!service.ContainsKey("name"))
+ {
+ throw new ArgumentException("Parameter `name` is missing");
+ }
+
+ return Request.MakeRequest(
+ $"/reference/delivery-services/{service["code"].ToString()}/edit",
+ Request.MethodPost,
+ new Dictionary
+ {
+ { "deliveryService", new JavaScriptSerializer().Serialize(service) }
+ }
+ );
+ }
+
+ public Response DeliveryTypesEdit(Dictionary type)
+ {
+ if (!type.ContainsKey("code"))
+ {
+ throw new ArgumentException("Parameter `code` is missing");
+ }
+
+ if (!type.ContainsKey("name"))
+ {
+ throw new ArgumentException("Parameter `name` is missing");
+ }
+
+ if (!type.ContainsKey("defaultCost"))
+ {
+ throw new ArgumentException("Parameter `defaultCost` is missing");
+ }
+
+ if (!type.ContainsKey("defaultNetCost"))
+ {
+ throw new ArgumentException("Parameter `defaultCost` is missing");
+ }
+
+ return Request.MakeRequest(
+ $"/reference/delivery-types/{type["code"].ToString()}/edit",
+ Request.MethodPost,
+ new Dictionary
+ {
+ { "deliveryType", new JavaScriptSerializer().Serialize(type) }
+ }
+ );
+ }
+
+ public Response OrderMethodsEdit(Dictionary method)
+ {
+ if (!method.ContainsKey("code"))
+ {
+ throw new ArgumentException("Parameter `code` is missing");
+ }
+
+ if (!method.ContainsKey("name"))
+ {
+ throw new ArgumentException("Parameter `name` is missing");
+ }
+
+ return Request.MakeRequest(
+ $"/reference/order-methods/{method["code"].ToString()}/edit",
+ Request.MethodPost,
+ new Dictionary
+ {
+ { "orderMethod", new JavaScriptSerializer().Serialize(method) }
+ }
+ );
+ }
+
+ public Response OrderTypesEdit(Dictionary type)
+ {
+ if (!type.ContainsKey("code"))
+ {
+ throw new ArgumentException("Parameter `code` is missing");
+ }
+
+ if (!type.ContainsKey("name"))
+ {
+ throw new ArgumentException("Parameter `name` is missing");
+ }
+
+ return Request.MakeRequest(
+ $"/reference/order-types/{type["code"].ToString()}/edit",
+ Request.MethodPost,
+ new Dictionary
+ {
+ { "orderType", new JavaScriptSerializer().Serialize(type) }
+ }
+ );
+ }
+
+ public Response PaymentStatusesEdit(Dictionary status)
+ {
+ if (!status.ContainsKey("code"))
+ {
+ throw new ArgumentException("Parameter `code` is missing");
+ }
+
+ if (!status.ContainsKey("name"))
+ {
+ throw new ArgumentException("Parameter `name` is missing");
+ }
+
+ return Request.MakeRequest(
+ $"/reference/payment-statuses/{status["code"].ToString()}/edit",
+ Request.MethodPost,
+ new Dictionary
+ {
+ { "paymentStatus", new JavaScriptSerializer().Serialize(status) }
+ }
+ );
+ }
+
+ public Response PaymentTypesEdit(Dictionary type)
+ {
+ if (!type.ContainsKey("code"))
+ {
+ throw new ArgumentException("Parameter `code` is missing");
+ }
+
+ if (!type.ContainsKey("name"))
+ {
+ throw new ArgumentException("Parameter `name` is missing");
+ }
+
+ return Request.MakeRequest(
+ $"/reference/payment-types/{type["code"].ToString()}/edit",
+ Request.MethodPost,
+ new Dictionary
+ {
+ { "paymentType", new JavaScriptSerializer().Serialize(type) }
+ }
+ );
+ }
+
+ public Response ProductStatusesEdit(Dictionary status)
+ {
+ if (!status.ContainsKey("code"))
+ {
+ throw new ArgumentException("Parameter `code` is missing");
+ }
+
+ if (!status.ContainsKey("name"))
+ {
+ throw new ArgumentException("Parameter `name` is missing");
+ }
+
+ return Request.MakeRequest(
+ $"/reference/product-statuses/{status["code"].ToString()}/edit",
+ Request.MethodPost,
+ new Dictionary
+ {
+ { "productStatus", new JavaScriptSerializer().Serialize(status) }
+ }
+ );
+ }
+
+ public Response SitesEdit(Dictionary site)
+ {
+ if (!site.ContainsKey("code"))
+ {
+ throw new ArgumentException("Parameter `code` is missing");
+ }
+
+ if (!site.ContainsKey("name"))
+ {
+ throw new ArgumentException("Parameter `name` is missing");
+ }
+
+ if (!site.ContainsKey("url"))
+ {
+ throw new ArgumentException("Parameter `url` is missing");
+ }
+
+ return Request.MakeRequest(
+ $"/reference/sites/{site["code"].ToString()}/edit",
+ Request.MethodPost,
+ new Dictionary
+ {
+ { "site", new JavaScriptSerializer().Serialize(site) }
+ }
+ );
+ }
+
+ public Response StatusesEdit(Dictionary status)
+ {
+ if (!status.ContainsKey("code"))
+ {
+ throw new ArgumentException("Parameter `code` is missing");
+ }
+
+ if (!status.ContainsKey("name"))
+ {
+ throw new ArgumentException("Parameter `name` is missing");
+ }
+
+ if (!status.ContainsKey("ordering"))
+ {
+ throw new ArgumentException("Parameter `ordering` is missing");
+ }
+
+ if (!status.ContainsKey("group"))
+ {
+ throw new ArgumentException("Parameter `group` is missing");
+ }
+
+ return Request.MakeRequest(
+ $"/reference/statuses/{status["code"].ToString()}/edit",
+ Request.MethodPost,
+ new Dictionary
+ {
+ { "status", new JavaScriptSerializer().Serialize(status) }
+ }
+ );
+ }
+
+ public Response StoresEdit(Dictionary store)
+ {
+ if (!store.ContainsKey("code"))
+ {
+ throw new ArgumentException("Parameter `code` is missing");
+ }
+
+ if (!store.ContainsKey("name"))
+ {
+ throw new ArgumentException("Parameter `name` is missing");
+ }
+
+ List types = new List
+ {
+ "store-type-online",
+ "store-type-retail",
+ "store-type-supplier",
+ "store-type-warehouse"
+ };
+
+ if (store.ContainsKey("type") && !types.Contains(store["type"].ToString()))
+ {
+ throw new ArgumentException("Parameter `type` should be equal to one of `store-type-online|store-type-retail|store-type-supplier|store-type-warehouse`");
+ }
+
+ return Request.MakeRequest(
+ $"/reference/stores/{store["code"].ToString()}/edit",
+ Request.MethodPost,
+ new Dictionary
+ {
+ { "store", new JavaScriptSerializer().Serialize(store) }
+ }
+ );
+ }
}
}
diff --git a/Retailcrm/Versions/V4/Customers.cs b/Retailcrm/Versions/V4/Customers.cs
new file mode 100644
index 0000000..90d5c7b
--- /dev/null
+++ b/Retailcrm/Versions/V4/Customers.cs
@@ -0,0 +1,29 @@
+namespace Retailcrm.Versions.V4
+{
+ using System.Collections.Generic;
+
+ public partial class Client
+ {
+ public Response CustomersHistory(Dictionary filter = null, int page = 0, int limit = 0)
+ {
+ Dictionary parameters = new Dictionary();
+
+ 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("/customers/history", Request.MethodGet, parameters);
+ }
+ }
+}
diff --git a/Retailcrm/Versions/V4/Delivery.cs b/Retailcrm/Versions/V4/Delivery.cs
new file mode 100644
index 0000000..31e3b15
--- /dev/null
+++ b/Retailcrm/Versions/V4/Delivery.cs
@@ -0,0 +1,81 @@
+namespace Retailcrm.Versions.V4
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Web.Script.Serialization;
+
+ public partial class Client
+ {
+ public Response DeliverySettingGet(string code)
+ {
+ if (string.IsNullOrEmpty(code))
+ {
+ throw new ArgumentException("Parameter `code` is mandatory");
+ }
+
+ return Request.MakeRequest(
+ $"/delivery/generic/setting/{code}",
+ Request.MethodGet
+ );
+ }
+
+ public Response DeliverySettingsEdit(Dictionary configuration)
+ {
+ if (configuration.Count < 1)
+ {
+ throw new ArgumentException("Parameter `configuration` must contain data");
+ }
+
+ if (!configuration.ContainsKey("clientId"))
+ {
+ throw new ArgumentException("Parameter `configuration` should contain `clientId`");
+ }
+
+ if (!configuration.ContainsKey("baseUrl"))
+ {
+ throw new ArgumentException("Parameter `configuration` should contain `baseUrl`");
+ }
+
+ if (!configuration.ContainsKey("code"))
+ {
+ throw new ArgumentException("Parameter `configuration` should contain `code`");
+ }
+
+ if (!configuration.ContainsKey("name"))
+ {
+ throw new ArgumentException("Parameter `configuration` should contain `name`");
+ }
+
+ return Request.MakeRequest(
+ $"/delivery/generic/setting/{configuration["code"].ToString()}/edit",
+ Request.MethodPost,
+ new Dictionary
+ {
+ { "configuration", new JavaScriptSerializer().Serialize(configuration) }
+ }
+ );
+ }
+
+ public Response DeliveryTracking(string code, List