Skip to content

Commit 08d7fb2

Browse files
committed
add deal category stages
1 parent 2747fe8 commit 08d7fb2

File tree

6 files changed

+201
-57
lines changed

6 files changed

+201
-57
lines changed

CHANGELOG.md

Lines changed: 69 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
11
# bitrix24-php-sdk change log
2-
## 2.0 DEV
3-
* remove all old code
2+
3+
## 2.0-alpha.2 (31.01.2021)
4+
5+
* remove Travis CI and migrate to Github Actions
6+
* add unit-tests
7+
* add phpstan checks in independent github action
8+
* add in scope «CRM» Contacts service and integration test
9+
* add in scope «CRM» Contacts batch service and integration test
10+
* add in scope «CRM» Products service and integration test
11+
* add in scope «CRM» Settings service and integration test
12+
* add in scope «CRM» DealCategoryStage service and integration test
13+
* add in scope «IM» IM service and integration test
14+
* add in default scope «Main» default service
15+
16+
## 2.0-alpha.1 (11.07.2020)
17+
18+
* remove all v1 code
419
* migrate to Symfony HttpClient
520
* add documentation webhook auth type
621
* add OAuth 2.0 support
722
* add Events support
823

924
## 0.7.0 (11.07.2020)
25+
1026
* add arguments in method `Bitrix24\Bizproc\Robot::add` for return results support
1127

1228
## 0.6.2 (12.09.2019)
29+
1330
* remove in method, `processBatchCalls` remove call `handleBitrix24APILevelErrors`
1431
* remove php 5.x branch in travis config
1532

1633
## 0.6.1 (20.03.2019)
34+
1735
* add `offset` parameter to entity `CRM\Status\Status` in method `getList`
1836
* add `offset` parameter to entity `User\User` in method `getList`
1937
* add method `messageAdd` to entity `Bitrix24\Bitrix24`
@@ -26,8 +44,9 @@
2644
* fix log level in method `Bitrix24::handleBitrix24APILevelErrors`
2745

2846
## 0.6.0 (18.02.2018)
47+
2948
* add support for `FaceTracker` entity
30-
* add presets for request timing information
49+
* add presets for request timing information
3150
* add all methods for sonetgroup
3251
* add method `crm.contact.userfield.update`
3352
* add activities methods
@@ -44,39 +63,51 @@
4463
* add new placement presets for detail page
4564

4665
## 0.5.4 (8.07.2017)
66+
4767
* add Callback for expired token. Fix pullrequest#63 by valga
4868
* add method `update` in class `Bitrix24\CRM\Product`
4969
* increased curl time out
5070
* add new scope `placement` in class `Bitrix24\Presets\Scope`
5171
* add batch calls method to bitrix24 api client interface
5272

5373
## 0.5.3 (20.05.2017)
74+
5475
* add class `Bitrix24\Placement\Placement`
5576
* add preset `Bitrix24\Presets\Placement\Placement` with placement codes
5677
* add preset `Bitrix24\Presets\Placement\Fields` with placement fields
5778

5879
## 0.5.2 (11.05.2017)
80+
5981
* add preset `Bitrix24\Presets\CRM\Product\ProductRowFields`
6082
* updated preset `Bitrix24\Presets\CRM\Contact\Fields`
6183
* updated preset `Bitrix24\Presets\CRM\Deal\Fields`
6284
* updated preset `Bitrix24\Presets\CRM\Lead\Fields`
6385

6486
## 0.5.1 (30.04.2017)
87+
6588
* add preset `Bitrix24\Presets\CRM\Product\Fields`
6689
* add method `add` in class `Bitrix24\CRM\Product`
6790

6891
## 0.5.0 (4.09.2016)
92+
6993
* add class `Bitrix24\CRM\Quote` see pr [Added support for Quote API calls](https://github.com/mesilov/bitrix24-php-sdk/pull/53/)
70-
* add support http status 301 moved permanently in class `Bitrix24` see issue [301 Moved Permanently #49](https://github.com/mesilov/bitrix24-php-sdk/issues/49)
94+
* add support http status 301 moved permanently in class `Bitrix24` see
95+
issue [301 Moved Permanently #49](https://github.com/mesilov/bitrix24-php-sdk/issues/49)
7196
* fixed bug in class `Bitrix24` see pr [Issue in the isAccessTokenExpire method](https://github.com/mesilov/bitrix24-php-sdk/pull/54)
7297

7398
## 0.4.1 (4.08.2016)
74-
* add new events in class `Bitrix24\Presets\Event\Event` see issue [Add new bitrix24 events #44](https://github.com/mesilov/bitrix24-php-sdk/issues/44)
75-
* add new scope in class `Bitrix24\Presets\Scope` see issue [Update scope presets class #47](https://github.com/mesilov/bitrix24-php-sdk/issues/47)
76-
* remove file with old deprecated exceptions see issue [Move all exceptions in namespace «Exceptions» #46](https://github.com/mesilov/bitrix24-php-sdk/issues/46)
99+
100+
* add new events in class `Bitrix24\Presets\Event\Event` see
101+
issue [Add new bitrix24 events #44](https://github.com/mesilov/bitrix24-php-sdk/issues/44)
102+
* add new scope in class `Bitrix24\Presets\Scope` see
103+
issue [Update scope presets class #47](https://github.com/mesilov/bitrix24-php-sdk/issues/47)
104+
* remove file with old deprecated exceptions see
105+
issue [Move all exceptions in namespace «Exceptions» #46](https://github.com/mesilov/bitrix24-php-sdk/issues/46)
77106

78107
## 0.4.0 (16.07.2016)
79-
* remove all exceptions in namespace `\Exceptions` see issue [Move all exceptions in namespace «Exceptions» #46](https://github.com/mesilov/bitrix24-php-sdk/issues/46)
108+
109+
* remove all exceptions in namespace `\Exceptions` see
110+
issue [Move all exceptions in namespace «Exceptions» #46](https://github.com/mesilov/bitrix24-php-sdk/issues/46)
80111
* add class `Bitrix24\Exceptions\Bitrix24Exception`
81112
* add class `Bitrix24\Exceptions\Bitrix24IoException`
82113
* add class `Bitrix24\Exceptions\Bitrix24EmptyResponseException`
@@ -100,37 +131,48 @@
100131
* updated class `Bitrix24\Bitrix24SecurityException` mark as **deprecated**
101132

102133
## 0.3.4 (06.06.2016)
134+
103135
* add exception class `Bitrix24EmptyResponseException`
104136
* in class `Bitrix24` add debug information for some error types
105-
* temporary remove calls to oauth.bitrix.info for methods `app.info` and `app.stat` see issue [Fix errors after change REST API to support self hosted version #43](https://github.com/mesilov/bitrix24-php-sdk/issues/43)
137+
* temporary remove calls to oauth.bitrix.info for methods `app.info` and `app.stat` see
138+
issue [Fix errors after change REST API to support self hosted version #43](https://github.com/mesilov/bitrix24-php-sdk/issues/43)
106139

107140
## 0.3.3 (28.05.2016)
108-
* fixed bug in class `Bitrix24` see issue [Fix errors after change REST API to support self hosted version #43](https://github.com/mesilov/bitrix24-php-sdk/issues/43)
141+
142+
* fixed bug in class `Bitrix24` see
143+
issue [Fix errors after change REST API to support self hosted version #43](https://github.com/mesilov/bitrix24-php-sdk/issues/43)
109144

110145
## 0.3.2 (07.05.2016)
111-
* fixed bug in class `Bitrix24\Im\Notify` see issue [ATTACH_ERROR for calls method im.notify for empty attach #42](https://github.com/mesilov/bitrix24-php-sdk/issues/42)
112-
146+
147+
* fixed bug in class `Bitrix24\Im\Notify` see
148+
issue [ATTACH_ERROR for calls method im.notify for empty attach #42](https://github.com/mesilov/bitrix24-php-sdk/issues/42)
149+
113150
## 0.3.1 (04.05.2016)
151+
114152
* add `dev` branch in GitHub repo
115153
* fixed bug in class `Bitrix24\Im\Attach\Attach`, method `Attach::getAttachItems()` already return array
116154

117155
## 0.3.0 (04.05.2016)
156+
118157
* add class `Bitrix24\Im\Attach\Item\Message` class implements work with string messages in attach item
119-
* add interface `Bitrix24\Presets\Im\iChatColor` with chat color presets
158+
* add interface `Bitrix24\Presets\Im\iChatColor` with chat color presets
120159
* add phpUnit tests for items:
121-
* `Bitrix24\Im\Attach\Item\Delimiter`
122-
* `Bitrix24\Im\Attach\Item\File`
123-
* `Bitrix24\Im\Attach\Item\Grid`
124-
* `Bitrix24\Im\Attach\Item\Image`
125-
* `Bitrix24\Im\Attach\Item\Link`
126-
* `Bitrix24\Im\Attach\Item\Message`
127-
* `Bitrix24\Im\Attach\Item\User`
128-
* fixed bug in class `Bitrix24\Im\Attach\Attach`
160+
* `Bitrix24\Im\Attach\Item\Delimiter`
161+
* `Bitrix24\Im\Attach\Item\File`
162+
* `Bitrix24\Im\Attach\Item\Grid`
163+
* `Bitrix24\Im\Attach\Item\Image`
164+
* `Bitrix24\Im\Attach\Item\Link`
165+
* `Bitrix24\Im\Attach\Item\Message`
166+
* `Bitrix24\Im\Attach\Item\User`
167+
* fixed bug in class `Bitrix24\Im\Attach\Attach`
129168

130169
## 0.2.1 (27.04.2016)
131-
* add exception class `Bitrix24PortalDeleted` and handle Bitrix24 portal deleted event. See issue [Add support for deleted portals #40](https://github.com/mesilov/bitrix24-php-sdk/issues/40)
170+
171+
* add exception class `Bitrix24PortalDeleted` and handle Bitrix24 portal deleted event. See
172+
issue [Add support for deleted portals #40](https://github.com/mesilov/bitrix24-php-sdk/issues/40)
132173

133174
## 0.2.0 (24.06.2015)
175+
134176
* add class `Deal`
135177
* add class `LiveFeedMessage`
136178
* add task fields presets
@@ -149,6 +191,7 @@
149191
* remove class `Bitrix24\Task\TaskItem`
150192

151193
## 0.1.4 (18.04.2015)
194+
152195
* add presets for user fields data type structure
153196
* add method `Update` and predefined constants in class `Invoice`
154197
* add protected method `handleBitrix24APILevelErrors` in a base class
@@ -163,6 +206,7 @@
163206
* fixed bug in Fix method isAccessTokenExpire
164207

165208
## 0.1.3 (24.08.2014)
209+
166210
* add const `TOTAL` and `RESULT` for class `Bitrix24\Presets\Main`
167211
* add class `Bitrix24\Presets\Users\Fields` for Bitrix24 users fields
168212
* add class `Bitrix24\Departments\Department`
@@ -178,6 +222,7 @@
178222
* fixed bug in __construct in abstract class `Bitrix24Entity`
179223

180224
## 0.1.2 (22.01.2014)
225+
181226
* add security sign support in api-call
182227
* add class `User`
183228
* add method «admin» — Check is current user admin
@@ -186,9 +231,11 @@
186231
* add MIT-LICENSE
187232

188233
## 0.1.1 (9.10.2013)
234+
189235
* add namespace support
190236
* add classes of Bitrix24 parts: tasks, sonet
191237
* add base class `Bitrix24Entity`
192238

193239
## 0.1.0 (26.10.2013)
240+
194241
* Initial release
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Bitrix24\SDK\Services\CRM\Deal\Result;
6+
7+
use Bitrix24\SDK\Core\Result\AbstractItem;
8+
9+
/**
10+
* Class DealCategoryStageItemResult
11+
*
12+
* @property string $NAME
13+
* @property int $SORT
14+
* @property string $STATUS_ID
15+
*/
16+
class DealCategoryStageItemResult extends AbstractItem
17+
{
18+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Bitrix24\SDK\Services\CRM\Deal\Result;
6+
7+
use Bitrix24\SDK\Core\Exceptions\BaseException;
8+
use Bitrix24\SDK\Core\Result\AbstractResult;
9+
10+
/**
11+
* Class DealCategoryStagesResult
12+
*
13+
* @property string $NAME
14+
* @property int $SORT
15+
* @property string $STATUS_ID
16+
*/
17+
class DealCategoryStagesResult extends AbstractResult
18+
{
19+
/**
20+
* @return DealCategoryStageItemResult[]
21+
* @throws BaseException
22+
*/
23+
public function getDealCategoryStages(): array
24+
{
25+
$res = [];
26+
foreach ($this->getCoreResponse()->getResponseData()->getResult()->getResultData() as $deal) {
27+
$res[] = new DealCategoryStageItemResult($deal);
28+
}
29+
30+
return $res;
31+
}
32+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Bitrix24\SDK\Services\CRM\Deal\Service;
6+
7+
use Bitrix24\SDK\Core\Exceptions\BaseException;
8+
use Bitrix24\SDK\Core\Exceptions\TransportException;
9+
use Bitrix24\SDK\Services\AbstractService;
10+
use Bitrix24\SDK\Services\CRM\Deal\Result\DealCategoryStagesResult;
11+
12+
/**
13+
* Class DealCategoryStage
14+
*
15+
* @package Bitrix24\SDK\Services\CRM\Deal\Service
16+
*/
17+
class DealCategoryStage extends AbstractService
18+
{
19+
/**
20+
* @param int $categoryId
21+
*
22+
* @return DealCategoryStagesResult
23+
* @throws BaseException
24+
* @throws TransportException
25+
*/
26+
public function list(int $categoryId): DealCategoryStagesResult
27+
{
28+
return new DealCategoryStagesResult(
29+
$this->core->call(
30+
'crm.dealcategory.stage.list',
31+
[
32+
'id' => $categoryId,
33+
]
34+
)
35+
);
36+
}
37+
}

src/Services/CRM/Deals/Service/DealCategoryStages.php

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Deal\Service;
6+
7+
use Bitrix24\SDK\Core\Exceptions\BaseException;
8+
use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException;
9+
use Bitrix24\SDK\Core\Exceptions\TransportException;
10+
use Bitrix24\SDK\Services\CRM\Deal\Service\DealCategory;
11+
use Bitrix24\SDK\Services\CRM\Deal\Service\DealCategoryStage;
12+
use Bitrix24\SDK\Tests\Integration\Fabric;
13+
use PHPUnit\Framework\TestCase;
14+
15+
/**
16+
* Class DealCategoryStageTest
17+
*
18+
* @package Bitrix24\SDK\Tests\Integration\Services\CRM\Deal\Service
19+
*/
20+
class DealCategoryStageTest extends TestCase
21+
{
22+
protected DealCategoryStage $dealCategoryStage;
23+
protected DealCategory $dealCategory;
24+
25+
/**
26+
* @covers DealCategoryStage::list()
27+
* @throws BaseException
28+
* @throws TransportException
29+
*/
30+
public function testList(): void
31+
{
32+
$newCategoryId = (int)$this->dealCategory->add(['NAME' => 'php unit test'])->getId();
33+
$res = $this->dealCategoryStage->list($newCategoryId);
34+
$this::assertGreaterThan(1, count($res->getDealCategoryStages()));
35+
}
36+
37+
/**
38+
* @throws InvalidArgumentException
39+
*/
40+
public function setUp(): void
41+
{
42+
$this->dealCategoryStage = Fabric::getServiceBuilder()->getCRMScope()->dealCategoryStage();
43+
$this->dealCategory = Fabric::getServiceBuilder()->getCRMScope()->dealCategory();
44+
}
45+
}

0 commit comments

Comments
 (0)