Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.1"
dependencies: [ highest ]

steps:
Expand All @@ -36,7 +36,6 @@ jobs:
ini-values: variables_order=EGPCS
env:
BITRIX24_PHP_SDK_PLAYGROUND_WEBHOOK: ${{ secrets.BITRIX24_PHP_SDK_PLAYGROUND_WEBHOOK }}
TEST2_ENV: 12345

- name: "Install dependencies"
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
dependencies:
- "lowest"
- "highest"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.1"
- "8.2"
dependencies: [ highest ]

steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/vendor-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
matrix:
php-version:
- "8.1"
- "8.2"
dependencies: [ highest ]

steps:
Expand Down
25 changes: 21 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,33 @@
## 2.0-beta.1 — 10.11.2022

### Added

* add `Symfony\Component\Uid\Uuid` requirements
* add contracts for bitrix24 applications based on bitrix24-php-sdk - `Bitrix24\SDK\Application\Contracts`, now added `Bitrix24Account`
* add contracts for bitrix24 applications based on bitrix24-php-sdk - `Bitrix24\SDK\Application\Contracts`, now added `Bitrix24Account`
* add [service builder factory](https://github.com/mesilov/bitrix24-php-sdk/issues/328)
* add method `Bitrix24\SDK\Core\Credentials\Scope::initFromString`
* add method `Bitrix24\SDK\Application\ApplicationStatus::initFromString`
* ❗️add php 8.2 support

### Changed
* ❗️Batch interface `BatchInterface` [renamed](https://github.com/mesilov/bitrix24-php-sdk/issues/324) to `Bitrix24\SDK\Core\Contracts\BatchOperationsInterface`

* ❗️Batch interface `BatchInterface` [renamed](https://github.com/mesilov/bitrix24-php-sdk/issues/324)
to `Bitrix24\SDK\Core\Contracts\BatchOperationsInterface`
* ❗`Bitrix24\SDK\Services\Telephony\Requests\Events` moved to separated namespaces:
* from `Bitrix24\SDK\Services\Telephony\Requests\Events\OnVoximplantCallInit`
to `Bitrix24\SDK\Services\Telephony\Requests\Events\OnVoximplantCallInit\OnVoximplantCallInit`
* from `Bitrix24\SDK\Services\Telephony\Requests\Events\OnVoximplantCallStart`
to `Bitrix24\SDK\Services\Telephony\Requests\Events\OnVoximplantCallStart\OnVoximplantCallStart`
* from `Bitrix24\SDK\Services\Telephony\Requests\Events\OnExternalCallStart`
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`

### Bugfix

* 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)

### etc

Expand Down Expand Up @@ -62,10 +79,10 @@
* method `Services\Main\Service::getAllMethods` marks as deprecated
* method `Services\Main\Service::getMethodsByScope` marks as deprecated
* ❗️fabric methods `Bitrix24\SDK\Core\Credentials`
renamed and now are [consistent](https://github.com/mesilov/bitrix24-php-sdk/issues/303): `createFromWebhook`, `createFromOAuth`
renamed and now 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 [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
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
],
"require": {
"php": "8.1.*",
"php": "8.1.* || 8.2.*",
"ext-json": "*",
"ext-bcmath": "*",
"ext-curl": "*",
Expand All @@ -33,7 +33,7 @@
"symfony/event-dispatcher": "5.4.* || 6.*",
"ramsey/uuid": "^4.2.3",
"moneyphp/money": "3.* || 4.*",
"symfony/uid": "^6.0",
"symfony/uid": "6.*",
"ext-intl": "*"
},
"require-dev": {
Expand All @@ -44,8 +44,7 @@
"phpstan/phpstan": "1.*",
"phpunit/phpunit": "9.5.*",
"symfony/stopwatch": "5.4.* || 6.*",
"roave/security-advisories": "dev-master",
"ext-intl": "*"
"roave/security-advisories": "dev-master"
},
"autoload": {
"psr-4": {
Expand Down
17 changes: 14 additions & 3 deletions src/Application/ApplicationStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ApplicationStatus
/**
* @param string $statusShortCode
*
* @throws \Bitrix24\SDK\Core\Exceptions\InvalidArgumentException
* @throws InvalidArgumentException
*/
public function __construct(string $statusShortCode)
{
Expand Down Expand Up @@ -107,13 +107,24 @@ public function getStatusCode(): string
}

/**
* @param \Symfony\Component\HttpFoundation\Request $request
* @param Request $request
*
* @return self
* @throws \Bitrix24\SDK\Core\Exceptions\InvalidArgumentException
* @throws InvalidArgumentException
*/
public static function initFromRequest(Request $request): self
{
return new self($request->request->getAlpha('status'));
}

/**
* @param string $shortStatusCode
*
* @return self
* @throws InvalidArgumentException
*/
public static function initFromString(string $shortStatusCode): self
{
return new self($shortStatusCode);
}
}
8 changes: 8 additions & 0 deletions src/Core/Credentials/Scope.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,12 @@ public function getScopeCodes(): array
{
return $this->currentScope;
}

/**
* @throws \Bitrix24\SDK\Core\Exceptions\UnknownScopeCodeException
*/
public static function initFromString(string $scope): self
{
return new self(str_replace(' ', '', explode(',', $scope)));
}
}
41 changes: 41 additions & 0 deletions src/Services/Telephony/Requests/Events/Auth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace Bitrix24\SDK\Services\Telephony\Requests\Events;

use Bitrix24\SDK\Application\ApplicationStatus;
use Bitrix24\SDK\Core\Credentials\Scope;
use Bitrix24\SDK\Core\Result\AbstractItem;

/**
* @property-read string $access_token
* @property-read string $application_token
* @property-read string $client_endpoint
* @property-read string $domain
* @property-read int $expires_in
* @property-read int $expires
* @property-read string $member_id
* @property-read Scope $scope
* @property-read string $server_endpoint
* @property-read ApplicationStatus $status
* @property-read int $user_id
*/
class Auth extends AbstractItem
{
/**
* @param int|string $offset
*
* @return bool|\DateTimeImmutable|int|mixed|null
* @throws \Bitrix24\SDK\Core\Exceptions\InvalidArgumentException
*/
public function __get($offset)
{
return match ($offset) {
'scope' => Scope::initFromString((string)$this->data[$offset]),
'status' => ApplicationStatus::initFromString((string)$this->data[$offset]),
'user_id', 'expires_in', 'expires' => (int)$this->data[$offset],
default => parent::__get($offset),
};
}
}
95 changes: 0 additions & 95 deletions src/Services/Telephony/Requests/Events/OnExternalCallStart.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);

namespace Bitrix24\SDK\Services\Telephony\Requests\Events\OnExternalCallStart;

use Bitrix24\SDK\Core\Result\AbstractItem;
use Bitrix24\SDK\Services\Telephony\Common\CallType;

/**
* @property-read string $CALL_ID
* @property-read int $CALL_LIST_ID
* @property-read array|null $CRM_CREATED_ENTITIES
* @property-read int $CRM_CREATED_LEAD
* @property-read int $CRM_ENTITY_ID
* @property-read string|null $CRM_ENTITY_TYPE
* @property-read string|null $EXTENSION
* @property-read bool $IS_MOBILE
* @property-read string|null $LINE_NUMBER
* @property-read string $PHONE_NUMBER_INTERNATIONAL
* @property-read string $PHONE_NUMBER
* @property-read int $USER_ID
*/
class CallData extends AbstractItem
{
/**
* @param int|string $offset
*
* @return bool|\DateTimeImmutable|int|mixed|null
* @throws \Bitrix24\SDK\Core\Exceptions\InvalidArgumentException
*/
public function __get($offset)
{
return match ($offset) {
'IS_MOBILE' => (int)$this->data[$offset] !== 0,
'CALL_TYPE' => CallType::initByTypeCode((int)$this->data[$offset]),
'CRM_ENTITY_TYPE' => (string)$this->data[$offset],
'REST_APP_ID', 'CALL_LIST_ID', 'CRM_CREATED_LEAD', 'CRM_ENTITY_ID', 'USER_ID' => (int)$this->data[$offset],
default => parent::__get($offset),
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace Bitrix24\SDK\Services\Telephony\Requests\Events\OnExternalCallStart;

use Bitrix24\SDK\Application\Requests\Events\AbstractEventRequest;
use Bitrix24\SDK\Services\Telephony\Requests\Events\Auth;

/**
* @link https://training.bitrix24.com/rest_help/scope_telephony/telephony/events_telephony/index.php
*/
class OnExternalCallStart extends AbstractEventRequest
{
/**
* @return \Bitrix24\SDK\Services\Telephony\Requests\Events\OnExternalCallStart\CallData
*/
public function getCallData(): CallData
{
return new CallData($this->eventPayload['data']);
}

/**
* @return \Bitrix24\SDK\Services\Telephony\Requests\Events\Auth
*/
public function getAuth(): Auth
{
return new Auth($this->eventPayload['auth']);
}
}
Loading