1. Go to this page and download the library: Download beeralex/beeralex.marking library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Beeralex\Marking\Factory\CodesCheckServiceFactory;
$factory = service(CodesCheckServiceFactory::class);
// По заказу (автоматически находит кассу)
$service = $factory->createByOrder($order);
// По обработчику кассы
$service = $factory->createByCashbox($cashboxHandler);
// Дефолтные настройки модуля
$service = $factory->createDefault();
$result = $service->check($codes);
namespace Your\Namespace;
use Beeralex\Marking\CashboxSettingsTrait;
use Bitrix\Sale\Cashbox\Cashbox;
class YourCashboxHandler extends Cashbox
{
use CashboxSettingsTrait;
// Ваш код обработчика
}
use Beeralex\Marking\Factory\CodesCheckServiceFactory;
$factory = service(CodesCheckServiceFactory::class);
// Автоматически возьмет настройки из кассы заказа
$service = $factory->createByOrder($order);
$result = $service->check($codes);
public function check(array $codes): CodesCheckResult
public function setFiscalDriveNumber(string $fiscalDriveNumber): self
public function getCdn(bool $withoutCache = false): Hosts
protected function authorize(): string
protected function retryWithTokenRefresh(callable $callback): mixed
public function allCodesValid(): bool
public function getValidCodes(): array
public function getInvalidCodes(): array
public function hasTransborderUnavailable(): bool
public readonly string $cis; // Код маркировки
public readonly bool $valid; // Валиден ли код
public readonly ?string $errorMessage; // Сообщение об ошибке
public readonly ?string $errorCode; // Код ошибки
public function save(CodesCheckResult $result): void
public function findByCode(string $code): ?array
use Beeralex\Marking\Exceptions\CdnTemporarilyUnavailableException;
use Beeralex\Marking\Exceptions\TransborderCheckServiceUnavailableException;
use Beeralex\Core\Exceptions\ApiTooManyRequestsException;
try {
$result = $service->check($codes);
} catch (ApiTooManyRequestsException $e) {
// Превышен лимит запросов - автоматически переключится на другой CDN
} catch (CdnTemporarilyUnavailableException $e) {
// CDN временно недоступен - попробует другой хост
} catch (TransborderCheckServiceUnavailableException $e) {
// Сервис проверки трансграничных кодов недоступен
} catch (\Exception $e) {
// Общая ошибка
}
// Логи находятся в:
// {module_dir}/logs/
// Например: /local/modules/beeralex.marking/logs/
$options = service(\Beeralex\Marking\Options::class);
if ($options->logsEnable) {
// Логирование активно
}
$factory = service(CodesCheckServiceFactory::class);
$service = $factory->createDefault();
$result = $service->check($codes);
if ($result->hasTransborderUnavailable()) {
// Сервис проверки трансграничных кодов недоступен
// Можно отложить проверку или использовать другой способ
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.