-
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Workflows services and add new features
Updated the structure of Workflows services and incorporated new functionalities. This includes the ability to delete and launch workflows, and stop active ones. Additionally, implemented workflow templates add and delete features. Introduced Base64 encoding within the file system and now handle file not found exception. Signed-off-by: mesilov <mesilov.maxim@gmail.com>
- Loading branch information
Showing
13 changed files
with
263 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Bitrix24\SDK\Core\Exceptions; | ||
|
||
class FileNotFoundException extends BaseException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Bitrix24\SDK\Infrastructure\Filesystem; | ||
|
||
use Bitrix24\SDK\Core\Exceptions\FileNotFoundException; | ||
use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; | ||
use Psr\Log\LoggerInterface; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
|
||
readonly class Base64Encoder | ||
{ | ||
public function __construct( | ||
private Filesystem $filesystem, | ||
private \Symfony\Component\Mime\Encoder\Base64Encoder $base64Encoder, | ||
private LoggerInterface $log | ||
) | ||
{ | ||
} | ||
|
||
/** | ||
* @throws FileNotFoundException|InvalidArgumentException | ||
*/ | ||
public function encodeFile(string $filename): string | ||
{ | ||
$this->log->debug('encodeFile.start', ['filename' => $filename]); | ||
|
||
if (!$this->filesystem->exists($filename)) { | ||
throw new FileNotFoundException(sprintf('file %s not found', $filename)); | ||
} | ||
|
||
$fileBody = file_get_contents($filename); | ||
if (false === $fileBody) { | ||
throw new InvalidArgumentException(sprintf('cannot read file %s', $filename)); | ||
} | ||
|
||
$fileBody = $this->base64Encoder->encodeString($fileBody); | ||
|
||
$this->log->debug('encodeFile.finish¨'); | ||
return $fileBody; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Bitrix24\SDK\Services\Workflows\Common; | ||
|
||
enum DocumentType: string | ||
{ | ||
// lead | ||
case crmLead = 'CCrmDocumentLead'; | ||
// company | ||
case crmCompany = 'CCrmDocumentCompany'; | ||
// contact | ||
case crmContact = 'CCrmDocumentContact'; | ||
// deal | ||
case crmDeal = 'CCrmDocumentDeal'; | ||
// drive file | ||
case discBizProcDocument = 'Bitrix\\Disk\\BizProcDocument'; | ||
// Drive file | ||
case listBizProcDocument = 'BizprocDocument'; | ||
case listBizProcDocumentLists = 'BizprocDocumentLists'; | ||
// smart process | ||
case smartProcessDynamic = 'Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic'; | ||
case task = 'Bitrix\\Tasks\\Integration\\Bizproc\\Document\\Task'; | ||
case invoice = 'Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice'; | ||
} |
41 changes: 0 additions & 41 deletions
41
src/Services/Workflows/Common/WorkflowActivityDocumentType.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.