1
0
mirror of synced 2024-11-21 20:46:03 +03:00

fix возвращаем response с ошибкой

This commit is contained in:
Alexey Chelnakov 2019-04-10 19:21:17 +03:00
parent aa735cff8d
commit 73dc060297
2 changed files with 6 additions and 4 deletions

View File

@ -12,6 +12,7 @@
"require": {
"php": ">=7.1",
"ext-curl": "*",
"ext-json": "*",
"guzzle/guzzle": "~3.7",
"jms/serializer": "~0.12 || ~1.4.2",
"symfony/validator": "~2.8|~3.4|~4.0",

View File

@ -114,7 +114,6 @@ class AtolOnlineApi
$url = $this->buildUrl('report/'.$uuid, $token);
$request = $this->client->get($url);
$response = false;
try {
$this->attemptsCheckStatus++;
$response = $request->send();
@ -124,10 +123,12 @@ class AtolOnlineApi
if ($this->isTokenExpired($body) && $this->attemptsCheckStatus <= 1) {
return $this->checkStatus($uuid);
}
$this->logDebug($url, $uuid, $e->getResponse());
$response = $e->getResponse();
}
if ($response) {
$this->logDebug($url, $uuid, $response);
return $response->getBody()->__toString();
}
@ -263,7 +264,6 @@ class AtolOnlineApi
$url = $this->buildUrl($operation, $token);
$request = $this->client->createRequest('POST', $url, null, $data);
$response = false;
try {
$this->attempts++;
$response = $this->client->send($request);
@ -273,8 +273,9 @@ class AtolOnlineApi
if ($this->isTokenExpired($body) && $this->attempts <= 1) {
return $this->sendOperationRequest($operation, $data);
}
$this->logDebug($url, $data, $e->getResponse());
$response = $e->getResponse();
}
if ($response) {
$this->logDebug($url, $data, $response);
}