fixes for API v5

This commit is contained in:
iyzoer 2017-07-27 14:41:58 +03:00
parent 5b7b2c3c36
commit cbbfc67cd8
6 changed files with 342 additions and 48 deletions

View File

@ -546,7 +546,7 @@ class ControllerExtensionModuleRetailcrm extends Controller
$response = $this->retailcrm->statisticUpdate(); $response = $this->retailcrm->statisticUpdate();
if (!$response) { if (!$response->isSuccessful()) {
$this->_error['warning'] = $this->language->get('text_error_api'); $this->_error['warning'] = $this->language->get('text_error_api');
} }

View File

@ -62,7 +62,22 @@ class ModelExtensionRetailcrmOrder extends Model {
$response = $this->retailcrm->ordersEdit($order); $response = $this->retailcrm->ordersEdit($order);
if ($this->settings[$this->moduleTitle . '_apiversion'] == 'v5' && $response->isSuccessful()) { if ($this->settings[$this->moduleTitle . '_apiversion'] == 'v5' && $response->isSuccessful()) {
$this->editPayment($order_data, $order_id); $response_order = $this->retailcrm->ordersGet($order_id);
if ($response_order->isSuccessful()) $order_info = $response_order['order'];
foreach ($order_info['payments'] as $payment_data) {
if ($payment_data['externalId'] == $order_id) {
$payment = $payment_data;
}
}
if (isset($payment) && $payment['type'] != $this->settings[$this->moduleTitle . '_payment'][$order_data['payment_code']]) {
$response = $this->retailcrm->ordersPaymentDelete($payment['id']);
if ($response->isSuccessful()) {
$this->createPayment($order_data, $order_id);
}
}
} }
} }
@ -103,11 +118,13 @@ class ModelExtensionRetailcrmOrder extends Model {
} }
} }
if (isset($couponTotal)) $order['discount'] = $couponTotal;
$order['createdAt'] = $order_data['date_added']; $order['createdAt'] = $order_data['date_added'];
if ($this->settings[$this->moduleTitle . '_apiversion'] != 'v5') { if ($this->settings[$this->moduleTitle . '_apiversion'] != 'v5') {
$order['paymentType'] = $this->settings[$this->moduleTitle . '_payment'][$payment_code]; $order['paymentType'] = $this->settings[$this->moduleTitle . '_payment'][$payment_code];
if (isset($couponTotal)) $order['discount'] = $couponTotal;
} else {
if (isset($couponTotal)) $order['discountManualAmount'] = $couponTotal;
} }
$country = (isset($order_data['shipping_country'])) ? $order_data['shipping_country'] : '' ; $country = (isset($order_data['shipping_country'])) ? $order_data['shipping_country'] : '' ;

View File

@ -309,6 +309,10 @@ class OpencartApiClient {
return curl_exec($curl); return curl_exec($curl);
} }
/**
* Login api user for opencart version > 3.0
*
*/
private function apiLogin() { private function apiLogin() {
$this->load->model('user/api'); $this->load->model('user/api');
$registry = new Registry(); $registry = new Registry();

View File

@ -1,6 +1,14 @@
<?php <?php
/** /**
* retailCRM API client class * PHP version 5.3
*
* API client class
*
* @category RetailCrm
* @package RetailCrm
* @author RetailCrm <integration@retailcrm.ru>
* @license https://opensource.org/licenses/MIT MIT License
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion3
*/ */
class RetailcrmApiClient3 class RetailcrmApiClient3
{ {
@ -38,7 +46,7 @@ class RetailcrmApiClient3
* *
* @param array $order * @param array $order
* @param string $site (default: null) * @param string $site (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function ordersCreate(array $order, $site = null) public function ordersCreate(array $order, $site = null)
{ {
@ -57,7 +65,7 @@ class RetailcrmApiClient3
* @param array $order * @param array $order
* @param string $by * @param string $by
* @param string $site (default: null) * @param string $site (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function ordersEdit(array $order, $by = 'externalId', $site = null) public function ordersEdit(array $order, $by = 'externalId', $site = null)
{ {
@ -86,7 +94,7 @@ class RetailcrmApiClient3
* *
* @param array $orders * @param array $orders
* @param string $site (default: null) * @param string $site (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function ordersUpload(array $orders, $site = null) public function ordersUpload(array $orders, $site = null)
{ {
@ -105,7 +113,7 @@ class RetailcrmApiClient3
* @param string $id * @param string $id
* @param string $by (default: 'externalId') * @param string $by (default: 'externalId')
* @param string $site (default: null) * @param string $site (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function ordersGet($id, $by = 'externalId', $site = null) public function ordersGet($id, $by = 'externalId', $site = null)
{ {
@ -124,7 +132,7 @@ class RetailcrmApiClient3
* @param int $limit (default: 100) * @param int $limit (default: 100)
* @param int $offset (default: 0) * @param int $offset (default: 0)
* @param bool $skipMyChanges (default: true) * @param bool $skipMyChanges (default: true)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function ordersHistory( public function ordersHistory(
DateTime $startDate = null, DateTime $startDate = null,
@ -160,7 +168,7 @@ class RetailcrmApiClient3
* @param array $filter (default: array()) * @param array $filter (default: array())
* @param int $page (default: null) * @param int $page (default: null)
* @param int $limit (default: null) * @param int $limit (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function ordersList(array $filter = array(), $page = null, $limit = null) public function ordersList(array $filter = array(), $page = null, $limit = null)
{ {
@ -184,7 +192,7 @@ class RetailcrmApiClient3
* *
* @param array $ids (default: array()) * @param array $ids (default: array())
* @param array $externalIds (default: array()) * @param array $externalIds (default: array())
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function ordersStatuses(array $ids = array(), array $externalIds = array()) public function ordersStatuses(array $ids = array(), array $externalIds = array())
{ {
@ -204,7 +212,7 @@ class RetailcrmApiClient3
* Save order IDs' (id and externalId) association in the CRM * Save order IDs' (id and externalId) association in the CRM
* *
* @param array $ids * @param array $ids
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function ordersFixExternalIds(array $ids) public function ordersFixExternalIds(array $ids)
{ {
@ -223,7 +231,7 @@ class RetailcrmApiClient3
* @param array $filter (default: array()) * @param array $filter (default: array())
* @param int $page (default: null) * @param int $page (default: null)
* @param int $limit (default: null) * @param int $limit (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function ordersPacksHistory(array $filter = array(), $page = null, $limit = null) public function ordersPacksHistory(array $filter = array(), $page = null, $limit = null)
{ {
@ -247,7 +255,7 @@ class RetailcrmApiClient3
* *
* @param array $customer * @param array $customer
* @param string $site (default: null) * @param string $site (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function customersCreate(array $customer, $site = null) public function customersCreate(array $customer, $site = null)
{ {
@ -266,7 +274,7 @@ class RetailcrmApiClient3
* @param array $customer * @param array $customer
* @param string $by (default: 'externalId') * @param string $by (default: 'externalId')
* @param string $site (default: null) * @param string $site (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function customersEdit(array $customer, $by = 'externalId', $site = null) public function customersEdit(array $customer, $by = 'externalId', $site = null)
{ {
@ -298,7 +306,7 @@ class RetailcrmApiClient3
* *
* @param array $customers * @param array $customers
* @param string $site (default: null) * @param string $site (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function customersUpload(array $customers, $site = null) public function customersUpload(array $customers, $site = null)
{ {
@ -317,7 +325,7 @@ class RetailcrmApiClient3
* @param string $id * @param string $id
* @param string $by (default: 'externalId') * @param string $by (default: 'externalId')
* @param string $site (default: null) * @param string $site (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function customersGet($id, $by = 'externalId', $site = null) public function customersGet($id, $by = 'externalId', $site = null)
{ {
@ -334,7 +342,7 @@ class RetailcrmApiClient3
* @param array $filter (default: array()) * @param array $filter (default: array())
* @param int $page (default: null) * @param int $page (default: null)
* @param int $limit (default: null) * @param int $limit (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function customersList(array $filter = array(), $page = null, $limit = null) public function customersList(array $filter = array(), $page = null, $limit = null)
{ {
@ -357,7 +365,7 @@ class RetailcrmApiClient3
* Save customer IDs' (id and externalId) association in the CRM * Save customer IDs' (id and externalId) association in the CRM
* *
* @param array $ids * @param array $ids
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function customersFixExternalIds(array $ids) public function customersFixExternalIds(array $ids)
{ {
@ -377,7 +385,7 @@ class RetailcrmApiClient3
* @param int $page (default: null) * @param int $page (default: null)
* @param int $limit (default: null) * @param int $limit (default: null)
* @param string $site (default: null) * @param string $site (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function storeInventories(array $filter = array(), $page = null, $limit = null, $site = null) public function storeInventories(array $filter = array(), $page = null, $limit = null, $site = null)
{ {
@ -401,7 +409,7 @@ class RetailcrmApiClient3
* *
* @param array $offers * @param array $offers
* @param string $site (default: null) * @param string $site (default: null)
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function storeInventoriesUpload(array $offers, $site = null) public function storeInventoriesUpload(array $offers, $site = null)
{ {
@ -419,7 +427,7 @@ class RetailcrmApiClient3
/** /**
* Returns deliveryServices list * Returns deliveryServices list
* *
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function deliveryServicesList() public function deliveryServicesList()
{ {
@ -429,7 +437,7 @@ class RetailcrmApiClient3
/** /**
* Returns deliveryTypes list * Returns deliveryTypes list
* *
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function deliveryTypesList() public function deliveryTypesList()
{ {
@ -439,7 +447,7 @@ class RetailcrmApiClient3
/** /**
* Returns orderMethods list * Returns orderMethods list
* *
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function orderMethodsList() public function orderMethodsList()
{ {
@ -449,7 +457,7 @@ class RetailcrmApiClient3
/** /**
* Returns orderTypes list * Returns orderTypes list
* *
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function orderTypesList() public function orderTypesList()
{ {
@ -459,7 +467,7 @@ class RetailcrmApiClient3
/** /**
* Returns paymentStatuses list * Returns paymentStatuses list
* *
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function paymentStatusesList() public function paymentStatusesList()
{ {
@ -469,7 +477,7 @@ class RetailcrmApiClient3
/** /**
* Returns paymentTypes list * Returns paymentTypes list
* *
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function paymentTypesList() public function paymentTypesList()
{ {
@ -479,7 +487,7 @@ class RetailcrmApiClient3
/** /**
* Returns productStatuses list * Returns productStatuses list
* *
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function productStatusesList() public function productStatusesList()
{ {
@ -489,7 +497,7 @@ class RetailcrmApiClient3
/** /**
* Returns statusGroups list * Returns statusGroups list
* *
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function statusGroupsList() public function statusGroupsList()
{ {
@ -499,7 +507,7 @@ class RetailcrmApiClient3
/** /**
* Returns statuses list * Returns statuses list
* *
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function statusesList() public function statusesList()
{ {
@ -509,7 +517,7 @@ class RetailcrmApiClient3
/** /**
* Returns sites list * Returns sites list
* *
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function sitesList() public function sitesList()
{ {
@ -519,7 +527,7 @@ class RetailcrmApiClient3
/** /**
* Returns stores list * Returns stores list
* *
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function storesList() public function storesList()
{ {
@ -530,7 +538,7 @@ class RetailcrmApiClient3
* Edit deliveryService * Edit deliveryService
* *
* @param array $data delivery service data * @param array $data delivery service data
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function deliveryServicesEdit(array $data) public function deliveryServicesEdit(array $data)
{ {
@ -551,7 +559,7 @@ class RetailcrmApiClient3
* Edit deliveryType * Edit deliveryType
* *
* @param array $data delivery type data * @param array $data delivery type data
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function deliveryTypesEdit(array $data) public function deliveryTypesEdit(array $data)
{ {
@ -572,7 +580,7 @@ class RetailcrmApiClient3
* Edit orderMethod * Edit orderMethod
* *
* @param array $data order method data * @param array $data order method data
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function orderMethodsEdit(array $data) public function orderMethodsEdit(array $data)
{ {
@ -593,7 +601,7 @@ class RetailcrmApiClient3
* Edit orderType * Edit orderType
* *
* @param array $data order type data * @param array $data order type data
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function orderTypesEdit(array $data) public function orderTypesEdit(array $data)
{ {
@ -614,7 +622,7 @@ class RetailcrmApiClient3
* Edit paymentStatus * Edit paymentStatus
* *
* @param array $data payment status data * @param array $data payment status data
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function paymentStatusesEdit(array $data) public function paymentStatusesEdit(array $data)
{ {
@ -635,7 +643,7 @@ class RetailcrmApiClient3
* Edit paymentType * Edit paymentType
* *
* @param array $data payment type data * @param array $data payment type data
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function paymentTypesEdit(array $data) public function paymentTypesEdit(array $data)
{ {
@ -656,7 +664,7 @@ class RetailcrmApiClient3
* Edit productStatus * Edit productStatus
* *
* @param array $data product status data * @param array $data product status data
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function productStatusesEdit(array $data) public function productStatusesEdit(array $data)
{ {
@ -677,7 +685,7 @@ class RetailcrmApiClient3
* Edit order status * Edit order status
* *
* @param array $data status data * @param array $data status data
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function statusesEdit(array $data) public function statusesEdit(array $data)
{ {
@ -698,7 +706,7 @@ class RetailcrmApiClient3
* Edit site * Edit site
* *
* @param array $data site data * @param array $data site data
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function sitesEdit(array $data) public function sitesEdit(array $data)
{ {
@ -719,7 +727,7 @@ class RetailcrmApiClient3
* Edit store * Edit store
* *
* @param array $data site data * @param array $data site data
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function storesEdit(array $data) public function storesEdit(array $data)
{ {
@ -743,7 +751,7 @@ class RetailcrmApiClient3
/** /**
* Update CRM basic statistic * Update CRM basic statistic
* *
* @return RetailcrmApiResponse * @return ApiResponse
*/ */
public function statisticUpdate() public function statisticUpdate()
{ {

View File

@ -12,7 +12,6 @@
*/ */
class RetailcrmApiClient4 class RetailcrmApiClient4
{ {
const VERSION = 'v4'; const VERSION = 'v4';
protected $client; protected $client;

View File

@ -8,11 +8,10 @@
* @package RetailCrm * @package RetailCrm
* @author RetailCrm <integration@retailcrm.ru> * @author RetailCrm <integration@retailcrm.ru>
* @license https://opensource.org/licenses/MIT MIT License * @license https://opensource.org/licenses/MIT MIT License
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion4 * @link http://www.retailcrm.ru/docs/Developers/ApiVersion5
*/ */
class RetailcrmApiClient5 class RetailcrmApiClient5
{ {
const VERSION = 'v5'; const VERSION = 'v5';
protected $client; protected $client;
@ -95,6 +94,14 @@ class RetailcrmApiClient5
return $this->client->makeRequest("/users/$id", RetailcrmHttpClient::METHOD_GET); return $this->client->makeRequest("/users/$id", RetailcrmHttpClient::METHOD_GET);
} }
/**
* Change user status
*
* @param integer $id user ID
* @param string $status user status
*
* @return ApiResponse
*/
public function usersStatus($id, $status) public function usersStatus($id, $status)
{ {
$statuses = array("free", "busy", "dinner", "break"); $statuses = array("free", "busy", "dinner", "break");
@ -112,6 +119,15 @@ class RetailcrmApiClient5
); );
} }
/**
* Get segments list
*
* @param array $filter
* @param null $limit
* @param null $page
*
* @return ApiResponse
*/
public function segmentsList(array $filter = array(), $limit = null, $page = null) public function segmentsList(array $filter = array(), $limit = null, $page = null)
{ {
$parameters = array(); $parameters = array();
@ -133,6 +149,15 @@ class RetailcrmApiClient5
); );
} }
/**
* Get custom fields list
*
* @param array $filter
* @param null $limit
* @param null $page
*
* @return ApiResponse
*/
public function customFieldsList(array $filter = array(), $limit = null, $page = null) public function customFieldsList(array $filter = array(), $limit = null, $page = null)
{ {
$parameters = array(); $parameters = array();
@ -154,6 +179,14 @@ class RetailcrmApiClient5
); );
} }
/**
* Create custom field
*
* @param $entity
* @param $customField
*
* @return ApiResponse
*/
public function customFieldsCreate($entity, $customField) public function customFieldsCreate($entity, $customField)
{ {
if (!count($customField) || if (!count($customField) ||
@ -179,6 +212,14 @@ class RetailcrmApiClient5
); );
} }
/**
* Edit custom field
*
* @param $entity
* @param $customField
*
* @return ApiResponse
*/
public function customFieldsEdit($entity, $customField) public function customFieldsEdit($entity, $customField)
{ {
if (!count($customField) || empty($customField['code'])) { if (!count($customField) || empty($customField['code'])) {
@ -200,6 +241,14 @@ class RetailcrmApiClient5
); );
} }
/**
* Get custom field
*
* @param $entity
* @param $code
*
* @return ApiResponse
*/
public function customFieldsGet($entity, $code) public function customFieldsGet($entity, $code)
{ {
if (empty($code)) { if (empty($code)) {
@ -220,6 +269,15 @@ class RetailcrmApiClient5
); );
} }
/**
* Get custom dictionaries list
*
* @param array $filter
* @param null $limit
* @param null $page
*
* @return ApiResponse
*/
public function customDictionariesList(array $filter = [], $limit = null, $page = null) public function customDictionariesList(array $filter = [], $limit = null, $page = null)
{ {
$parameters = []; $parameters = [];
@ -241,6 +299,13 @@ class RetailcrmApiClient5
); );
} }
/**
* Create custom dictionary
*
* @param $customDictionary
*
* @return ApiResponse
*/
public function customDictionariesCreate($customDictionary) public function customDictionariesCreate($customDictionary)
{ {
if (!count($customDictionary) || if (!count($customDictionary) ||
@ -259,6 +324,13 @@ class RetailcrmApiClient5
); );
} }
/**
* Edit custom dictionary
*
* @param $customDictionary
*
* @return ApiResponse
*/
public function customDictionariesEdit($customDictionary) public function customDictionariesEdit($customDictionary)
{ {
if (!count($customDictionary) || if (!count($customDictionary) ||
@ -277,6 +349,13 @@ class RetailcrmApiClient5
); );
} }
/**
* Get custom dictionary
*
* @param $code
*
* @return ApiResponse
*/
public function customDictionariesGet($code) public function customDictionariesGet($code)
{ {
if (empty($code)) { if (empty($code)) {
@ -528,6 +607,15 @@ class RetailcrmApiClient5
); );
} }
/**
* Combine orders
*
* @param string $technique
* @param array $order
* @param array $resultOrder
*
* @return ApiResponse
*/
public function ordersCombine($order, $resultOrder, $technique = 'ours') public function ordersCombine($order, $resultOrder, $technique = 'ours')
{ {
$techniques = array('ours', 'summ', 'theirs'); $techniques = array('ours', 'summ', 'theirs');
@ -555,6 +643,17 @@ class RetailcrmApiClient5
); );
} }
/**
* Create an order payment
*
* @param array $payment order data
*
* @throws \InvalidArgumentException
* @throws \RetailCrm\Exception\CurlException
* @throws \RetailCrm\Exception\InvalidJsonException
*
* @return ApiResponse
*/
public function ordersPaymentCreate(array $payment) public function ordersPaymentCreate(array $payment)
{ {
if (!count($payment)) { if (!count($payment)) {
@ -570,6 +669,15 @@ class RetailcrmApiClient5
); );
} }
/**
* Edit an order payment
*
* @param array $payment order data
* @param string $by by key
* @param null $site site code
*
* @return ApiResponse
*/
public function ordersPaymentEdit(array $payment, $by = 'externalId', $site = null) public function ordersPaymentEdit(array $payment, $by = 'externalId', $site = null)
{ {
if (!count($payment)) { if (!count($payment)) {
@ -596,6 +704,27 @@ class RetailcrmApiClient5
); );
} }
/**
* Edit an order payment
*
* @param string $id payment id
*
* @return ApiResponse
*/
public function ordersPaymentDelete($id)
{
if (!$id) {
throw new \InvalidArgumentException(
'Parameter `id` must be set'
);
}
return $this->client->makeRequest(
sprintf('/orders/payments/%s/delete', $id),
RetailcrmHttpClient::METHOD_POST
);
}
/** /**
* Returns filtered customers list * Returns filtered customers list
* *
@ -802,6 +931,14 @@ class RetailcrmApiClient5
); );
} }
/**
* Combine customers
*
* @param array $customers
* @param array $resultCustomer
*
* @return ApiResponse
*/
public function customersCombine(array $customers, $resultCustomer) public function customersCombine(array $customers, $resultCustomer)
{ {
@ -821,6 +958,88 @@ class RetailcrmApiClient5
); );
} }
/**
* Returns filtered customers notes list
*
* @param array $filter (default: array())
* @param int $page (default: null)
* @param int $limit (default: null)
*
* @throws \InvalidArgumentException
* @throws \RetailCrm\Exception\CurlException
* @throws \RetailCrm\Exception\InvalidJsonException
*
* @return ApiResponse
*/
public function customersNotesList(array $filter = array(), $page = null, $limit = null)
{
$parameters = array();
if (count($filter)) {
$parameters['filter'] = $filter;
}
if (null !== $page) {
$parameters['page'] = (int) $page;
}
if (null !== $limit) {
$parameters['limit'] = (int) $limit;
}
return $this->client->makeRequest(
'/customers/notes',
RetailcrmHttpClient::METHOD_GET,
$parameters
);
}
/**
* Create customer note
*
* @param array $note (default: array())
* @param string $site (default: null)
*
* @throws \InvalidArgumentException
* @throws \RetailCrm\Exception\CurlException
* @throws \RetailCrm\Exception\InvalidJsonException
*
* @return ApiResponse
*/
public function customersNotesCreate($note, $site = null)
{
if (empty($note['customer']['id']) && empty($note['customer']['externalId'])) {
throw new \InvalidArgumentException(
'Customer identifier must be set'
);
}
return $this->client->makeRequest(
'/customers/notes/create',
RetailcrmHttpClient::METHOD_POST,
$this->fillSite($site, array('note' => json_encode($note)))
);
}
/**
* Delete customer note
*
* @param integer $id
*
* @throws \InvalidArgumentException
* @throws \RetailCrm\Exception\CurlException
* @throws \RetailCrm\Exception\InvalidJsonException
*
* @return ApiResponse
*/
public function customersNotesDelete($id)
{
if (empty($id)) {
throw new \InvalidArgumentException(
'Note id must be set'
);
}
return $this->client->makeRequest(
"/customers/notes/$id/delete",
RetailcrmHttpClient::METHOD_POST
);
}
/** /**
* Get orders assembly list * Get orders assembly list
* *
@ -989,6 +1208,15 @@ class RetailcrmApiClient5
); );
} }
/**
* Get tasks list
*
* @param array $filter
* @param null $limit
* @param null $page
*
* @return ApiResponse
*/
public function tasksList(array $filter = array(), $limit = null, $page = null) public function tasksList(array $filter = array(), $limit = null, $page = null)
{ {
$parameters = array(); $parameters = array();
@ -1010,6 +1238,15 @@ class RetailcrmApiClient5
); );
} }
/**
* Create task
*
* @param array $task
* @param null $site
*
* @return ApiResponse
*
*/
public function tasksCreate($task, $site = null) public function tasksCreate($task, $site = null)
{ {
if (!count($task)) { if (!count($task)) {
@ -1028,6 +1265,15 @@ class RetailcrmApiClient5
); );
} }
/**
* Edit task
*
* @param array $task
* @param null $site
*
* @return ApiResponse
*
*/
public function tasksEdit($task, $site = null) public function tasksEdit($task, $site = null)
{ {
if (!count($task)) { if (!count($task)) {
@ -1046,6 +1292,13 @@ class RetailcrmApiClient5
); );
} }
/**
* Get custom dictionary
*
* @param $id
*
* @return ApiResponse
*/
public function tasksGet($id) public function tasksGet($id)
{ {
if (empty($id)) { if (empty($id)) {
@ -1060,6 +1313,19 @@ class RetailcrmApiClient5
); );
} }
/**
* Get products groups
*
* @param array $filter (default: array())
* @param int $page (default: null)
* @param int $limit (default: null)
*
* @throws \InvalidArgumentException
* @throws \RetailCrm\Exception\CurlException
* @throws \RetailCrm\Exception\InvalidJsonException
*
* @return ApiResponse
*/
public function storeProductsGroups(array $filter = array(), $page = null, $limit = null) public function storeProductsGroups(array $filter = array(), $page = null, $limit = null)
{ {
$parameters = array(); $parameters = array();