Skip to content

Commit 65085e7

Browse files
committed
providers support
1 parent 6b15ff5 commit 65085e7

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

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+
}

0 commit comments

Comments
 (0)