Skip to content

Commit e97268d

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 3aa1191 + 3f97f6b commit e97268d

File tree

3 files changed

+142
-0
lines changed

3 files changed

+142
-0
lines changed

src/bitrix24.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Bitrix24\Exceptions\Bitrix24TokenIsExpiredException;
2525
use Bitrix24\Exceptions\Bitrix24TokenIsInvalidException;
2626
use Bitrix24\Exceptions\Bitrix24WrongClientException;
27+
use Bitrix24\Exceptions\Bitrix24InsufficientScope;
2728
use Psr\Log\LoggerInterface;
2829
use Psr\Log\NullLogger;
2930

@@ -741,6 +742,7 @@ public function setRetriesToConnectTimeout($microseconds = 1000000)
741742
* @throws Bitrix24MethodNotFoundException
742743
* @throws Bitrix24PaymentRequiredException
743744
* @throws Bitrix24PortalRenamedException
745+
* @throws Bitrix24InsufficientScope
744746
*/
745747
protected function handleBitrix24APILevelErrors(
746748
$arRequestResult,
@@ -771,6 +773,8 @@ protected function handleBitrix24APILevelErrors(
771773
throw new Bitrix24PaymentRequiredException($errorMsg);
772774
case 'NO_AUTH_FOUND':
773775
throw new Bitrix24PortalRenamedException($errorMsg);
776+
case 'INSUFFICIENT_SCOPE':
777+
throw new Bitrix24InsufficientScope($errorMsg);
774778
default:
775779
throw new Bitrix24ApiException($errorMsg);
776780
}
@@ -1035,6 +1039,13 @@ public function processBatchCalls($halt = 0, $delay = self::BATCH_DELAY)
10351039
continue;
10361040
}
10371041

1042+
if (isset($results['result_error'][$idx])) {
1043+
$this->handleBitrix24APILevelErrors(array(
1044+
'error' => $results['result_error'][$idx]['error'],
1045+
'error_description' => $results['result_error'][$idx]['error_description'],
1046+
), $call['method'], $call['parameters']);
1047+
}
1048+
10381049
call_user_func($call['callback'], array(
10391050
'result' => isset($results['result'][$idx]) ? $results['result'][$idx] : null,
10401051
'error' => isset($results['result_error'][$idx]) ? $results['result_error'][$idx] : null,

src/classes/bizproc/Provider.php

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?php
2+
3+
namespace Bitrix24\Bizproc;
4+
5+
use Bitrix24\Bitrix24Entity;
6+
7+
/**
8+
* Class provider
9+
*
10+
* @package Bitrix24\Placement
11+
*/
12+
class Provider extends Bitrix24Entity
13+
{
14+
/**
15+
* add provider
16+
*
17+
* @param string $code
18+
* @param $type
19+
* @param string $handler
20+
* @param $arName
21+
* @param $arDescription
22+
*
23+
* @return mixed
24+
*
25+
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
26+
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
27+
* @throws \Bitrix24\Exceptions\Bitrix24Exception
28+
* @throws \Bitrix24\Exceptions\Bitrix24IoException
29+
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
30+
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
31+
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
32+
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
33+
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
34+
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
35+
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
36+
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
37+
* @see https://dev.1c-bitrix.ru/rest_help/bizproc/bizproc_provider/provideradd.php
38+
*
39+
*/
40+
public function add($code, $type, $handler, $arName, $arDescription)
41+
{
42+
$arResult = $this->client->call('bizproc.provider.add',
43+
array(
44+
'CODE' => $code,
45+
'TYPE' => $type,
46+
'HANDLER' => $handler,
47+
'NAME' => $arName,
48+
'DESCRIPTION' => $arDescription
49+
));
50+
51+
return $arResult['result'];
52+
}
53+
54+
/**
55+
* delete provider
56+
*
57+
* @param $code string
58+
*
59+
* @see https://dev.1c-bitrix.ru/rest_help/bizproc/bizproc_provider/providerdelete.php
60+
*
61+
* @return array
62+
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
63+
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
64+
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
65+
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
66+
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
67+
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
68+
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
69+
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
70+
* @throws \Bitrix24\Exceptions\Bitrix24IoException
71+
* @throws \Bitrix24\Exceptions\Bitrix24Exception
72+
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
73+
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
74+
*/
75+
public function delete($code)
76+
{
77+
$arResult = $this->client->call('bizproc.provider.delete',
78+
array(
79+
'code' => $code
80+
)
81+
);
82+
83+
return $arResult['result'];
84+
}
85+
86+
/**
87+
* get list of providers
88+
*
89+
* @see https://dev.1c-bitrix.ru/rest_help/bizproc/bizproc_provider/providerlist.php
90+
*
91+
* @return mixed
92+
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
93+
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
94+
* @throws \Bitrix24\Exceptions\Bitrix24Exception
95+
* @throws \Bitrix24\Exceptions\Bitrix24IoException
96+
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
97+
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
98+
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
99+
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
100+
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
101+
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
102+
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
103+
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
104+
*/
105+
public function getList()
106+
{
107+
$arResult = $this->client->call('bizproc.provider.list',
108+
array()
109+
);
110+
111+
return $arResult['result'];
112+
}
113+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/*
3+
* This file is part of the bitrix24-php-sdk package.
4+
*
5+
* © Mesilov Maxim <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace Bitrix24\Exceptions;
11+
12+
/**
13+
* Class Bitrix24InsufficientScope
14+
* @package Bitrix24
15+
*/
16+
class Bitrix24InsufficientScope extends Bitrix24ApiException
17+
{
18+
}

0 commit comments

Comments
 (0)