From 93f5186b158f22c60dd7692b576f3262e839ab6f Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Sat, 30 May 2020 01:58:40 +0800 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B7=D0=B0=D0=BF?= =?UTF-8?q?=D0=B8=D1=81=D1=8C=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=B2=20=D0=B4=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B5=20=D0=BF=D1=80=D0=B8=20=D1=82=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=D0=BE=D0=BC=20=D1=80=D0=B5=D0=B6=D0=B8=D0=BC=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AtolOnline/Api/Kkt.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/AtolOnline/Api/Kkt.php b/src/AtolOnline/Api/Kkt.php index 9d2b32a..ee9a59a 100644 --- a/src/AtolOnline/Api/Kkt.php +++ b/src/AtolOnline/Api/Kkt.php @@ -9,7 +9,8 @@ namespace AtolOnline\Api; -use AtolOnline\{Entities\Document, +use AtolOnline\{Entities\Company, + Entities\Document, Exceptions\AtolCorrectionInfoException, Exceptions\AtolInvalidUuidException, Exceptions\AtolKktLoginEmptyException, @@ -390,7 +391,7 @@ class Kkt extends Client { $headers['Content-type'] = 'application/json; charset=utf-8'; if ($this->getAuthToken()) { - $headers['Token'] = $this->auth_token; + $headers['Token'] = $this->getAuthToken(); } return $headers; } @@ -429,6 +430,7 @@ class Kkt extends Client * @param mixed $data Данные для передачи * @param array|null $options Параметры Guzzle * @return \AtolOnline\Api\KktResponse + * @throws \GuzzleHttp\Exception\GuzzleException * @see https://guzzle.readthedocs.io/en/latest/request-options.html */ protected function sendAtolRequest(string $http_method, string $api_method, $data = null, array $options = null) @@ -449,6 +451,7 @@ class Kkt extends Client * Производит авторизацию на ККТ и получает токен доступа для дальнейших HTTP-запросов * * @return bool + * @throws \GuzzleHttp\Exception\GuzzleException */ protected function auth() { @@ -482,6 +485,12 @@ class Kkt extends Client throw new AtolWrongDocumentTypeException($type); } $this->auth(); + if ($this->isTestMode()) { + $document->setCompany((new Company()) + ->setInn('5544332219') + ->setPaymentAddress('https://v4.online.atol.ru') + ); + } $data = [ 'timestamp' => date('d.m.y H:i:s'), 'external_id' => Uuid::uuid4()->toString(),