Skip to content

Commit

Permalink
Add enum DealSemanticStage and update property types in `DealItemRe…
Browse files Browse the repository at this point in the history
…sult`

This commit introduces the `DealSemanticStage` enum, furthering the options available for the `STAGE_SEMANTIC_ID` field of the `DealItemResult` class. This change provides more precise type information. Also, the types of several properties in the `DealItemResult` class are updated to nullable ones to better reflect possible data states.

Signed-off-by: mesilov <[email protected]>
  • Loading branch information
mesilov committed Apr 3, 2024
1 parent b23306f commit 7cefd11
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 46 deletions.
33 changes: 22 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@
## 2.0-beta.2 — 1.04.2024

### Added

* add `bizproc` [services](https://github.com/mesilov/bitrix24-php-sdk/issues/376)

### Changed

* updated [dependencies versions](https://github.com/mesilov/bitrix24-php-sdk/issues/373):
* require
* `psr/log` `1.4.0``3.0.*`
* `moneyphp/money` `4.3.*``4.5.*`
* require-dev
* `monolog/monolog` `2.9.*``3.5.*`
* `phpunit/phpunit` `10.5.*``11.0.*`
* require
* `psr/log` `1.4.0``3.0.*`
* `moneyphp/money` `4.3.*``4.5.*`
* require-dev
* `monolog/monolog` `2.9.*``3.5.*`
* `phpunit/phpunit` `10.5.*``11.0.*`
* added enum `DealSemanticStage` for deal field `STAGE_SEMANTIC_ID`

### Bugfix

### etc

## 2.0-beta.1 — 18.02.2024
Expand All @@ -39,13 +45,13 @@
* add [crm item support](https://github.com/mesilov/bitrix24-php-sdk/issues/330)
* add enum `DealStageSemanticId`
* add Duplicate search support for `Bitrix24\SDK\Services\CRM\Duplicates\Service\Duplicate`
* add `x-request-id` [header support](https://github.com/mesilov/bitrix24-php-sdk/issues/354)
* add `x-request-id` [header support](https://github.com/mesilov/bitrix24-php-sdk/issues/354)
* add CRM multifields support [header support](https://github.com/mesilov/bitrix24-php-sdk/issues/338)
* `Email`
* `Phone`
* `Website`
* `IM`
* add [Catalog](https://github.com/mesilov/bitrix24-php-sdk/issues/364) scope services support
* add [Catalog](https://github.com/mesilov/bitrix24-php-sdk/issues/364) scope services support

### Changed

Expand All @@ -60,7 +66,7 @@
to `Bitrix24\SDK\Services\Telephony\Requests\Events\OnExternalCallStart\OnExternalCallStart`
* from `Bitrix24\SDK\Services\Telephony\Requests\Events\OnVoximplantCallEnd`
to `Bitrix24\SDK\Services\Telephony\Requests\Events\OnVoximplantCallEnd\OnVoximplantCallEnd`
* ❗Changes in `Bitrix24\SDK\Application\Contracts\Bitrix24Account\Bitrix24AccountInterface`:
* ❗Changes in `Bitrix24\SDK\Application\Contracts\Bitrix24Account\Bitrix24AccountInterface`:
* method `getContactPerson` renamed to `getContactPersonId`
* added method `getApplicationVersion`
* added method `updateApplicationVersion`
Expand All @@ -70,7 +76,7 @@
* added method `markAsDeactivated`
* added method `getBitrix24UserId`
* removed method `markAccountAsDeleted`
* changed method `markAsActive`
* changed method `markAsActive`
* ❗Changes in `Bitrix24\SDK\Application\Contracts\Bitrix24Account\Bitrix24AccountRepositoryInterface`:
* method `saveAccount` renamed to `save`
* method `deleteAccount` renamed to `delete`
Expand All @@ -86,7 +92,8 @@
* fix [typehint at ContactItemResult](https://github.com/mesilov/bitrix24-php-sdk/issues/320)
* fix [return types in DealCategoryItemResult](https://github.com/mesilov/bitrix24-php-sdk/issues/322)
* fix [add auth node in telephony voximplant events requests](https://github.com/mesilov/bitrix24-php-sdk/issues/331)
* fix [add helper metods isError for registerCallResult fortelephony](https://github.com/mesilov/bitrix24-php-sdk/issues/335)
*
fix [add helper metods isError for registerCallResult fortelephony](https://github.com/mesilov/bitrix24-php-sdk/issues/335)
* fix [add return type for crm multifields phone, email, im](https://github.com/mesilov/bitrix24-php-sdk/issues/338)
* fix errors in `ShowFieldsDescriptionCommand` metadata reader CLI command
* fix errors for `ApplicationProfile` with empty scope
Expand Down Expand Up @@ -159,9 +166,13 @@
are [consistent](https://github.com/mesilov/bitrix24-php-sdk/issues/303): `createFromWebhook`, `createFromOAuth`
, `createFromPlacementRequest`
*

❗️deleted [unused class](https://github.com/mesilov/bitrix24-php-sdk/issues/303) `Bitrix24\SDK\Core\Response\DTO\ResponseDataCollection`

*

❗️deleted [redundant class](https://github.com/mesilov/bitrix24-php-sdk/issues/303) `Bitrix24\SDK\Core\Response\DTO\Result`

* ❗️deleted [method](https://github.com/mesilov/bitrix24-php-sdk/issues/303) `CoreBuilder::withWebhookUrl`, use
method `CoreBuilder::withCredentials`

Expand Down
6 changes: 6 additions & 0 deletions src/Services/CRM/Common/Result/AbstractCrmItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\Phone;
use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\PhoneValueType;
use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\Website;
use Bitrix24\SDK\Services\CRM\Deal\Result\DealSemanticStage;
use Bitrix24\SDK\Services\CRM\Userfield\Exceptions\UserfieldNotFoundException;
use DateTimeImmutable;
use Money\Currency;
Expand Down Expand Up @@ -172,6 +173,11 @@ public function __get($offset)
case 'currencyId':
case 'accountCurrencyId':
return new Currency($this->data[$offset]);
case 'STAGE_SEMANTIC_ID':
if ($this->data[$offset] !== null) {
return DealSemanticStage::from($this->data[$offset]);
}
return null;
default:
return $this->data[$offset] ?? null;
}
Expand Down
70 changes: 35 additions & 35 deletions src/Services/CRM/Deal/Result/DealItemResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,41 @@
/**
* Class DealItemResult
*
* @property-read int $ID
* @property-read string $TITLE deal title
* @property-read string|null $TYPE_ID
* @property-read string|null $CATEGORY_ID
* @property-read string $STAGE_ID
* @property-read string $STAGE_SEMANTIC_ID
* @property-read bool $IS_NEW
* @property-read bool $IS_RECURRING
* @property-read string|null $PROBABILITY
* @property-read string $CURRENCY_ID
* @property-read string $OPPORTUNITY
* @property-read bool $IS_MANUAL_OPPORTUNITY
* @property-read string $TAX_VALUE
* @property-read int $LEAD_ID
* @property-read int $COMPANY_ID
* @property-read int $CONTACT_ID
* @property-read int $QUOTE_ID
* @property-read DateTimeInterface $BEGINDATE
* @property-read DateTimeInterface $CLOSEDATE
* @property-read bool $OPENED
* @property-read bool $CLOSED
* @property-read string|null $COMMENTS
* @property-read string|null $ADDITIONAL_INFO
* @property-read string|null $LOCATION_ID
* @property-read bool $IS_RETURN_CUSTOMER
* @property-read bool $IS_REPEATED_APPROACH
* @property-read int|null $SOURCE_ID
* @property-read string|null $SOURCE_DESCRIPTION
* @property-read string|null $ORIGINATOR_ID
* @property-read string|null $ORIGIN_ID
* @property-read string|null $UTM_SOURCE
* @property-read string|null $UTM_MEDIUM
* @property-read string|null $UTM_CAMPAIGN
* @property-read string|null $UTM_CONTENT
* @property-read string|null $UTM_TERM
* @property-read int $ID
* @property-read string|null $TITLE deal title
* @property-read string|null $TYPE_ID
* @property-read string|null $CATEGORY_ID
* @property-read string|null $STAGE_ID
* @property-read DealSemanticStage|null $STAGE_SEMANTIC_ID
* @property-read bool|null $IS_NEW
* @property-read bool|null $IS_RECURRING
* @property-read string|null $PROBABILITY
* @property-read string|null $CURRENCY_ID
* @property-read string|null $OPPORTUNITY
* @property-read bool|null $IS_MANUAL_OPPORTUNITY
* @property-read string|null $TAX_VALUE
* @property-read int|null $LEAD_ID
* @property-read int|null $COMPANY_ID
* @property-read int|null $CONTACT_ID
* @property-read int|null $QUOTE_ID
* @property-read DateTimeInterface|null $BEGINDATE
* @property-read DateTimeInterface|null $CLOSEDATE
* @property-read bool|null $OPENED
* @property-read bool|null $CLOSED
* @property-read string|null $COMMENTS
* @property-read string|null $ADDITIONAL_INFO
* @property-read string|null $LOCATION_ID
* @property-read bool|null $IS_RETURN_CUSTOMER
* @property-read bool|null $IS_REPEATED_APPROACH
* @property-read int|null $SOURCE_ID
* @property-read string|null $SOURCE_DESCRIPTION
* @property-read string|null $ORIGINATOR_ID
* @property-read string|null $ORIGIN_ID
* @property-read string|null $UTM_SOURCE
* @property-read string|null $UTM_MEDIUM
* @property-read string|null $UTM_CAMPAIGN
* @property-read string|null $UTM_CONTENT
* @property-read string|null $UTM_TERM
*/
class DealItemResult extends AbstractCrmItem
{
Expand Down
13 changes: 13 additions & 0 deletions src/Services/CRM/Deal/Result/DealSemanticStage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php


declare(strict_types=1);

namespace Bitrix24\SDK\Services\CRM\Deal\Result;

enum DealSemanticStage: string
{
case underway = 'P';
case successful = 'S';
case failed = 'F';
}

0 comments on commit 7cefd11

Please sign in to comment.