| @@ 76-87 (lines=12) @@ | ||
| 73 | return (string)$result->getBody(); |
|
| 74 | } |
|
| 75 | ||
| 76 | private function handleRequestException(Throwable $exception): OmsClientExceptionInterface |
|
| 77 | { |
|
| 78 | if ($exception instanceof BadResponseException) { |
|
| 79 | $response = $exception->getResponse(); |
|
| 80 | $responseBody = $response ? (string)$response->getBody() : ''; |
|
| 81 | $responseCode = $response ? $response->getStatusCode() : 0; |
|
| 82 | ||
| 83 | return OmsRequestErrorException::becauseOfError($responseCode, $responseBody, $exception); |
|
| 84 | } |
|
| 85 | ||
| 86 | return OmsGeneralErrorException::becauseOfError($exception); |
|
| 87 | } |
|
| 88 | ||
| 89 | public function codes(string $token, string $orderId, string $orderLineId, int $quantity): array |
|
| 90 | { |
|
| @@ 82-93 (lines=12) @@ | ||
| 79 | return (string)$result->getBody(); |
|
| 80 | } |
|
| 81 | ||
| 82 | private function handleRequestException(Throwable $exception): OmsClientExceptionInterface |
|
| 83 | { |
|
| 84 | if ($exception instanceof BadResponseException) { |
|
| 85 | $response = $exception->getResponse(); |
|
| 86 | $responseBody = $response ? (string)$response->getBody() : ''; |
|
| 87 | $responseCode = $response ? $response->getStatusCode() : 0; |
|
| 88 | ||
| 89 | return OmsRequestErrorException::becauseOfError($responseCode, $responseBody, $exception); |
|
| 90 | } |
|
| 91 | ||
| 92 | return OmsGeneralErrorException::becauseOfError($exception); |
|
| 93 | } |
|
| 94 | ||
| 95 | public function getICBufferStatus( |
|
| 96 | Extension $extension, |
|