Merge pull request #76 from Neur0toxine/master
[fix] Fill site code for /telephony/call/event and /telephony/call/upload
This commit is contained in:
commit
29fd360e4f
@ -60,11 +60,11 @@ trait Telephony
|
|||||||
* @param string $hangupStatus
|
* @param string $hangupStatus
|
||||||
* @param string $externalPhone
|
* @param string $externalPhone
|
||||||
* @param array $webAnalyticsData
|
* @param array $webAnalyticsData
|
||||||
|
* @param string $site (default: null)
|
||||||
*
|
*
|
||||||
* @return \RetailCrm\Response\ApiResponse
|
* @return \RetailCrm\Response\ApiResponse
|
||||||
* @internal param string $code additional phone code
|
* @internal param string $code additional phone code
|
||||||
* @internal param string $status call status
|
* @internal param string $status call status
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function telephonyCallEvent(
|
public function telephonyCallEvent(
|
||||||
$phone,
|
$phone,
|
||||||
@ -72,7 +72,8 @@ trait Telephony
|
|||||||
$codes,
|
$codes,
|
||||||
$hangupStatus = null,
|
$hangupStatus = null,
|
||||||
$externalPhone = null,
|
$externalPhone = null,
|
||||||
$webAnalyticsData = []
|
$webAnalyticsData = [],
|
||||||
|
$site = null
|
||||||
) {
|
) {
|
||||||
if (!isset($phone)) {
|
if (!isset($phone)) {
|
||||||
throw new \InvalidArgumentException('Phone number must be set');
|
throw new \InvalidArgumentException('Phone number must be set');
|
||||||
@ -93,12 +94,11 @@ trait Telephony
|
|||||||
$parameters['callExternalId'] = $externalPhone;
|
$parameters['callExternalId'] = $externalPhone;
|
||||||
$parameters['webAnalyticsData'] = $webAnalyticsData;
|
$parameters['webAnalyticsData'] = $webAnalyticsData;
|
||||||
|
|
||||||
|
|
||||||
/* @noinspection PhpUndefinedMethodInspection */
|
/* @noinspection PhpUndefinedMethodInspection */
|
||||||
return $this->client->makeRequest(
|
return $this->client->makeRequest(
|
||||||
'/telephony/call/event',
|
'/telephony/call/event',
|
||||||
"POST",
|
"POST",
|
||||||
['event' => json_encode($parameters)]
|
['event' => json_encode($this->fillSite($site, $parameters))]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,13 +107,11 @@ trait Telephony
|
|||||||
*
|
*
|
||||||
* @param array $calls calls data
|
* @param array $calls calls data
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @param bool $autoFillSite fill site code from API client in provided calls
|
||||||
* @throws \RetailCrm\Exception\CurlException
|
|
||||||
* @throws \RetailCrm\Exception\InvalidJsonException
|
|
||||||
*
|
*
|
||||||
* @return \RetailCrm\Response\ApiResponse
|
* @return \RetailCrm\Response\ApiResponse
|
||||||
*/
|
*/
|
||||||
public function telephonyCallsUpload(array $calls)
|
public function telephonyCallsUpload(array $calls, $autoFillSite = false)
|
||||||
{
|
{
|
||||||
if (!count($calls)) {
|
if (!count($calls)) {
|
||||||
throw new \InvalidArgumentException(
|
throw new \InvalidArgumentException(
|
||||||
@ -121,6 +119,12 @@ trait Telephony
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($autoFillSite) {
|
||||||
|
foreach ($calls as $key => $call) {
|
||||||
|
$calls[$key] = $this->fillSite(null, $call);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* @noinspection PhpUndefinedMethodInspection */
|
/* @noinspection PhpUndefinedMethodInspection */
|
||||||
return $this->client->makeRequest(
|
return $this->client->makeRequest(
|
||||||
'/telephony/calls/upload',
|
'/telephony/calls/upload',
|
||||||
|
Loading…
Reference in New Issue
Block a user