Skip to content

Commit

Permalink
Merge pull request #294 from mesilov/273-alpha-7-pre-build
Browse files Browse the repository at this point in the history
273 alpha 7 pre build
  • Loading branch information
mesilov authored Sep 3, 2022
2 parents 59905b0 + 7844c87 commit 3773768
Show file tree
Hide file tree
Showing 204 changed files with 8,831 additions and 630 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: ["https://boosty.to/bitrix24-php-sdk"]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.idea*
/app
vendor
composer.phar
composer.lock
Expand Down
67 changes: 66 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,71 @@
# bitrix24-php-sdk change log

## 2.0-alpha.6 — 7.02.2021
## 2.0-alpha.7 — 8.08.2022

### Added

* add new scope `Telephony` and services [add Telephony support](https://github.com/mesilov/bitrix24-php-sdk/issues/291)
* add new scope `UserConsent` and services [add UserConsent support](https://github.com/mesilov/bitrix24-php-sdk/issues/285)
* add new scope `Placements` and services [add Placements support](https://github.com/mesilov/bitrix24-php-sdk/issues/274)
* add new scope `IMOpenLines` and services [add IM Open Lines support](https://github.com/mesilov/bitrix24-php-sdk/issues/302)
* add in scope `CRM` new service `Leads` in scope «CRM» [add Leads support](https://github.com/mesilov/bitrix24-php-sdk/issues/282)
* add in scope `CRM` new service `Activity` in scope «CRM» [add Activity support](https://github.com/mesilov/bitrix24-php-sdk/issues/283)
* add in scope `CRM` for entity Deal method `Services\CRM\Deal\Service\Batch::update` batch update deals
* add in scope `CRM` for entity Contact method `Services\CRM\Contact\Service\Batch::delete` batch delete contacts
* add in scope `CRM` [read models](https://github.com/mesilov/bitrix24-php-sdk/issues/300) for activity `Services\CRM\Activity\ReadModel`
for activity types: `EmailFetcher`, `OpenLineFetcher`, `VoximplantFetcher`, `WebFormFetcher`
* add in scope «Main» new service `Events` [add incoming events support](https://github.com/mesilov/bitrix24-php-sdk/issues/296)
* add support Application level events: `ONAPPINSTALL`
and `ONAPPUNINSTALL` [add incoming events support](https://github.com/mesilov/bitrix24-php-sdk/issues/296)
* add support Application level event: `PortalDomainUrlChangedEvent`
* add method `Core\Batch::updateEntityItems` for [update items in batch mode](https://github.com/mesilov/bitrix24-php-sdk/issues/268) and
integration test
* add method to interface `Core\Contracts\BatchInterface::updateEntityItems` for update items in batch mode
* add in scope `Placements` service `Placement\Service\UserFieldType` for work with user fields embedding
* add in scope `Telephony` add events: `OnExternalCallBackStart`, `OnExternalCallStart`, `OnVoximplantCallEnd`, `OnVoximplantCallEnd`
, `OnVoximplantCallInit`, `OnVoximplantCallStart` see [add telephony events](https://github.com/mesilov/bitrix24-php-sdk/issues/304)
* add `ApplicationStatus` with application status codes description
* add fabric method `AccessToken::initFromPlacementRequest` when application init form placement request
* add fabric method `ApplicationProfile::initFromArray` when application profile stored in ENV-variables
* add `Bitrix24\SDK\Application\Requests\Placement\PlacementRequest` for application data from placements
* add fabric method `Credentials::initFromPlacementRequest` when application init form placement request
* add method `Services\Main\Service::getServerTime` returns current server time in the format YYYY-MM-DDThh:mm:ss±hh:mm.
* add method `Services\Main\Service::getCurrentUserProfile` return basic Information about the current user without any scopes
* add method `Services\Main\Service::getAccessName` returns access permission names.
* add method `Services\Main\Service::checkUserAccess` Checks if the current user has at least one permission of those specified by the
ACCESS parameter.
* add method `Services\Main\Service::getMethodAffordability` Method returns 2 parameters - isExisting and isAvailable
* add money type support by [phpmoney](https://github.com/moneyphp/money)
* add support fields `operating` and `operating_reset_at` at `Bitrix24\SDK\Core\Response\DTO\Time` datastructures

### Changed

* update scope list [расширить и актуализировать доступные скоупы](https://github.com/mesilov/bitrix24-php-sdk/issues/280)
* bump `symfony/*` to `6.*` version requirement.
* method `Services\Main\Service::getAvailableMethods` marks as deprecated
* 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`
, `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`

### Bugfix

* add bugfix for batch method for reverse order queries
* fix type compatible errors for `Core\Result\AbstractItem`
* fix error in `NetworkTimingParser`, [error in NetworkTimingsErrorInfo](https://github.com/mesilov/bitrix24-php-sdk/issues/277)
* fix error in `RenewedAccessToken` DTO, remove `Scope`
enum [UnknownScopeCodeException - in refresh token response](https://github.com/mesilov/bitrix24-php-sdk/issues/295)

### etc

* add link to [boosty.to/bitrix24-php-sdk](https://boosty.to/bitrix24-php-sdk) for sponsoring development

## 2.0-alpha.6 — 7.02.2022

### Added

Expand Down
39 changes: 39 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# A quick guide to contribute to the project:

## Installing the dev environment

1. Fork the repo
2. Clone the repo to local
3. Install dependencies: `composer update` (this assumes you have 'composer' aliased to wherever your composer.phar lives)
4. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate:
`composer phpstan-analyse`
`composer phpunit-run-unit-tests`
`composer phpunit-run-integration-tests`

## Adding new features

Pull requests with new features needs to be created against master branch.

If new feature require BC Break please note that in your PR comment, it will added in next major version.
New features that does not have any BC Breaks are going to be added in next minor version.

## Codding standards

In order to fix codding standards please exeecute:

```shell
composer phpstan-analyse
```

## Patches and bugfixes

1. Check the oldest version that patch/bug fix can be applied.
2. Create PR against that version


## The actual contribution

1. Make the changes/additions to the code, committing often and making clear what you've done
2. Make sure you write tests for your code, located in the folder structure
3. Run your tests (often and while coding)
4. Create Pull Request on github to against proper branch
3 changes: 1 addition & 2 deletions MIT-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Copyright 2013 Mesilov Maxim
https://bitrixinsider.ru/
Copyright 2022 Maxim Mesilov

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
63 changes: 60 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ Performance improvements 🚀
- test coverage: unit, integration, contract
- typical examples typical for different modes of operation and they are optimized for memory \ performance

### Sponsors

Help bitrix24-php-sdk by [boosty.to/bitrix24-php-sdk](https://boosty.to/bitrix24-php-sdk) its development!

### Architecture

### Abstraction layers
Expand Down Expand Up @@ -121,7 +125,8 @@ Add `"mesilov/bitrix24-php-sdk": "2.x"` to `composer.json` of your application.

### Tests

Tests locate in folder `tests` and we have two test types
Tests locate in folder `tests` and we have two test types.
In folder tests create file `.env.local` and fill environment variables from `.env`.

#### Unit tests

Expand Down Expand Up @@ -184,7 +189,6 @@ See also the list of [contributors](https://github.com/mesilov/bitrix24-php-sdk/

email: <[email protected]>

### Sponsors

### Documentation

Expand Down Expand Up @@ -217,6 +221,10 @@ email: <[email protected]>
- покрытие тестами: unit, интеграционные, контрактные
- есть типовые примеры характерные для разных режимов работы и они оптимизированы по памяти \ быстродействию

### Спонсоры

Помогите развитию bitrix24-php-sdk подписавшись на [boosty.to/bitrix24-php-sdk](https://boosty.to/bitrix24-php-sdk)!

### Ключевые особенности

### Слои SDK
Expand Down Expand Up @@ -331,4 +339,53 @@ Symfony HttpClient

JSON по HTTP/2 или HTTP/1.1

## Спонсоры
## Спонсоры

### Тесты

Тесты расположены в папке `tests` и бывают двух типов: юнит и интеграционные.
В папке `tests` создайте файл `.env.local` и заполните переменные из файла `.env`.

#### Юнит тесты

**Быстрые**, выполняются без сетевого взаимодействия с Битрикс 24.

```shell
composer phpunit-run-unit-test
```

#### Интеграционные тесты

**Медленные** тесты покрывают полный жизненный цикл CRUD операций подключение к Битрикс 24 происходи с помощью веб-хука.

❗ Не запускайте интеграционные тесты на ваших production порталах они удалят все ваши данные ❗️

Для запуска интеграционных тестов вам нужно:

1. Создать [Новый портал Битрикс 24](https://www.bitrix24.ru/create.php?p=255670) для запуска тестов.
2. Перейти в левое меню и нажать "Карта сайта".
3. Найти меню для "Разработчиков"
4. Кликнуть в меню «Другое»
5. Кликнуть в меню «Входящий веб-хук»
6. Выбрать все нужные расширения и нажать кнопку "сохранить".
7. Создать файл `/tests/.env.local` с переменными окружения которые скопировать из файла `/tests/.env` .

```yaml
APP_ENV=dev
BITRIX24_WEBHOOK=https:// your portal webhook url
INTEGRATION_TEST_LOG_LEVEL=500
```

8. Запуск из командной строки.

```shell
composer composer phpunit-run-integration-tests
```

#### Статический анализ кодовой базы – phpstan

Запуск из командной строки.

```shell
composer phpstan-analyse
```
24 changes: 14 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,27 @@
"require": {
"php": "7.4.*|8.*",
"ext-json": "*",
"ext-bcmath": "*",
"ext-curl": "*",
"psr/log": "^1.1.4 || ^2.0 || ^3.0",
"fig/http-message-util": "1.1.*",
"symfony/http-client": "5.4.*",
"symfony/http-client-contracts": "^2.5",
"symfony/event-dispatcher": "5.4.*",
"ramsey/uuid": "^4.2.3"
"symfony/http-client": "5.4.* || 6.*",
"symfony/http-client-contracts": "^2.5 || ^3.1",
"symfony/http-foundation": "5.4.* || 6.*",
"symfony/event-dispatcher": "5.4.* || 6.*",
"ramsey/uuid": "^4.2.3",
"moneyphp/money": "3.* || 4.*"
},
"require-dev": {
"monolog/monolog": "2.1.*",
"symfony/console": "5.4.*",
"symfony/dotenv": "5.4.*",
"symfony/debug-bundle": "5.4.*",
"phpstan/phpstan": "1.1.*",
"symfony/console": "5.4.* || 6.*",
"symfony/dotenv": "5.4.* || 6.*",
"symfony/debug-bundle": "5.4.* || 6.*",
"phpstan/phpstan": "1.*",
"phpunit/phpunit": "9.5.*",
"symfony/stopwatch": "5.4.*",
"roave/security-advisories": "dev-master"
"symfony/stopwatch": "5.4.* || 6.*",
"roave/security-advisories": "dev-master",
"ext-intl": "*"
},
"autoload": {
"psr-4": {
Expand Down
23 changes: 23 additions & 0 deletions docs/RU/Application/new-local-application.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Создание Локального приложения
## Предусловия
1. Создайте 2 файла в корне рабочей папки например app: это `install.php` и `index.php`.
2. Содержимое файла `install.php`.
```php
```
3. Для работы локального серверного приложения требуется рабочий веб сервер на машине разработчика.
4. Запускаем локальный веб-сервер, например так:
```shell
php -S 127.0.0.1:8080
```
3. Пробрасываем порт в большой интернет через сервис ngrok.
```shell
ngrok http 127.0.0.1:8080
```
4. После запуска ngrok будет выдан временный публичный адрес типо `https://7949-178-34-183-66.eu.ngrok.io`, который после выключения сервиса перестанет существовать. Этот адрес исчезнет после завершения ngrok.
5. Зарегистрируйте новый портал битрикс 24.
6. Включите тестовый период для маркет плейса и тарифного плана.
7. Открой портал и перейдите в меню.
1. Откройте левое меню, выберите "Разработчикам"
2. Выберите "Другое"
3. Откройте "Локальное приложение"
4. Зарегистрируйте новое локальное приложение с нужным вам скоупом.
4 changes: 2 additions & 2 deletions docs/RU/Core/Auth/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $result = json_decode($result->getContent(), true);
var_dump($result);
```

## подключение к Битрикс24 с использованием OAuth 2.0
## подключение к Битрикс24 с использованием OAuth 2.0

```php
<?php
Expand Down Expand Up @@ -71,7 +71,7 @@ $token = new \Bitrix24\SDK\Core\Credentials\AccessToken(
1604179882
);
$domain = 'https:// client portal address .bitrix24.ru';
$credentials = \Bitrix24\SDK\Core\Credentials\Credentials::createForOAuth($token, $appProfile, $domain);
$credentials = \Bitrix24\SDK\Core\Credentials\Credentials::createFromOAuth($token, $appProfile, $domain);

$apiClient = new \Bitrix24\SDK\Core\ApiClient($credentials, $traceableClient, $log);
$app = new \Bitrix24\SDK\Services\Main($apiClient, $log);
Expand Down
Loading

0 comments on commit 3773768

Please sign in to comment.