Skip to content

Commit 01b11a8

Browse files
committed
Refactor changeContactPerson method into linkContactPerson and unlinkContactPerson. Add corresponding unit tests and events for state changes. Update CHANGELOG to reflect these changes.
Signed-off-by: mesilov <[email protected]>
1 parent 399066a commit 01b11a8

File tree

7 files changed

+856
-420
lines changed

7 files changed

+856
-420
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@
109109
- added method `isApplicationTokenValid`
110110
- changed method `public function applicationInstalled(?string $applicationToken): void` application token now is nullable
111111
- changed method `public function applicationUninstalled(?string $applicationToken): void` application token now is nullable
112+
- added method `linkContactPerson(Uuid $uuid)`
113+
- added method `unlinkContactPerson()`
114+
- remove method `changeContactPerson(?Uuid $uuid)`
112115

113116
### Statistics
114117

src/Application/Contracts/ApplicationInstallations/Docs/ApplicationInstallations.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Optional can store links to:
1414
| `getUpdatedAt()` | `CarbonImmutable` | Returns date and time of last application installation change | |
1515
| `getBitrix24AccountId()` | `Uuid` | Returns Bitrix24 Account id related to this installation | |
1616
| `getContactPersonId()` | `?Uuid` | Returns contact person id who installed the application on portal (optional) | |
17-
| `changeContactPerson()` | `void` | Changes client contact person | |
17+
| `linkContactPerson()` | `void` | Link client contact person | |
18+
| `unlinkContactPerson()` | `void` | Unlink client contact person | |
1819
| `getBitrix24PartnerContactPersonId()` | `?Uuid` | Returns Bitrix24 partner contact person id (optional) | |
1920
| `changeBitrix24PartnerContactPerson()` | `void` | Changes Bitrix24 partner contact person | |
2021
| `getBitrix24PartnerId()` | `?Uuid` | Returns Bitrix24 Partner id related to this installation (optional) | |

src/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterface.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,18 @@ public function getBitrix24AccountId(): Uuid;
5757
public function getContactPersonId(): ?Uuid;
5858

5959
/**
60-
* Change contact person
60+
* Link contact person
6161
*
62-
* Change client contact person if client say he has new responsible for the application
62+
* Link client contact person if a client says they have new responsible for the application
6363
*/
64-
public function changeContactPerson(?Uuid $uuid): void;
64+
public function linkContactPerson(Uuid $uuid): void;
65+
66+
/**
67+
* Unlink contact person
68+
*
69+
* Unlink a client contact person if the client says the contact person has changed
70+
*/
71+
public function unlinkContactPerson(): void;
6572

6673
/**
6774
* Get Bitrix24 Partner contact person id, optional
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the bitrix24-php-sdk package.
5+
*
6+
* © Maksim Mesilov <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the MIT-LICENSE.txt
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events;
15+
16+
use Carbon\CarbonImmutable;
17+
use Symfony\Component\Uid\Uuid;
18+
use Symfony\Contracts\EventDispatcher\Event;
19+
20+
class ApplicationInstallationContactPersonLinkedEvent extends Event
21+
{
22+
public function __construct(
23+
public readonly Uuid $applicationInstallationId,
24+
public readonly CarbonImmutable $timestamp,
25+
public readonly Uuid $contactPersonId
26+
) {
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the bitrix24-php-sdk package.
5+
*
6+
* © Maksim Mesilov <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the MIT-LICENSE.txt
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events;
15+
16+
use Carbon\CarbonImmutable;
17+
use Symfony\Component\Uid\Uuid;
18+
use Symfony\Contracts\EventDispatcher\Event;
19+
20+
class ApplicationInstallationContactPersonUnlinkedEvent extends Event
21+
{
22+
public function __construct(
23+
public readonly Uuid $applicationInstallationId,
24+
public readonly CarbonImmutable $timestamp,
25+
public readonly Uuid $unlinkedContactPersonId
26+
) {
27+
}
28+
}

0 commit comments

Comments
 (0)