Описание дилера
+ * @throws \Afosto\Sdk\Exception\GetShipmentMethodNotFoundException
+ * @throws \Afosto\Sdk\Exception\GetShipmentMethodInternalServerErrorException
+ * @throws \Afosto\Sdk\Exception\GetShipmentMethodServiceUnavailableException
*
* @return \Afosto\Sdk\Model\LcsShipmentMethod|\Psr\Http\Message\ResponseInterface|null
*/
@@ -92,6 +96,18 @@
if (429 === $status) {
$this->addResponseDetails($status, $response);
+ return null;
+ }
+
+ if (404 === $status) {
+ throw new GetShipmentMethodNotFoundException($serializer->deserialize($body, 'Afosto\\Sdk\\Model\\Error', 'json'), $response);
+ }
+
+ if (500 === $status) {
+ throw new GetShipmentMethodInternalServerErrorException($serializer->deserialize($body, 'Afosto\\Sdk\\Model\\Error', 'json'), $response);
+ }
+
+ if (503 === $status) {
return null;
}
}
CI commit
@@ -12,6 +12,7 @@
namespace Afosto\Sdk\Api;
+use Afosto\Sdk\Exception\GetShipmentMethodBadRequestException;
use Afosto\Sdk\Exception\GetShipmentMethodNotFoundException;
use Afosto\Sdk\Exception\GetShipmentMethodInternalServerErrorException;
use Afosto\Sdk\Exception\GetShipmentMethodServiceUnavailableException;
@@ -47,6 +48,7 @@
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Afosto\Sdk\Exception\GetShipmentMethodUnauthorizedException
+ * @throws \Afosto\Sdk\Exception\GetShipmentMethodBadRequestException
* @throws \Afosto\Sdk\Exception\GetShipmentMethodForbiddenException
* @throws \Afosto\Sdk\Exception\GetShipmentMethodNotFoundException
* @throws \Afosto\Sdk\Exception\GetShipmentMethodInternalServerErrorException
@@ -81,6 +83,10 @@
if (401 === $status) {
throw new GetShipmentMethodUnauthorizedException($serializer->deserialize($body, 'Afosto\\Sdk\\Model\\Error', 'json'), $response);
}
+
+ if (400 === $status) {
+ throw new GetShipmentMethodBadRequestException($serializer->deserialize($body, 'Afosto\\Sdk\\Model\\Error', 'json'), $response);
+ }
}
return $serializer->deserialize($body, 'Afosto\\Sdk\\Model\\LcsShipmentMethod', 'json');
@@ -99,6 +105,10 @@
return null;
}
+ if (400 === $status) {
+ throw new GetShipmentMethodBadRequestException($serializer->deserialize($body, 'Afosto\\Sdk\\Model\\Error', 'json'), $response);
+ }
+
if (404 === $status) {
throw new GetShipmentMethodNotFoundException($serializer->deserialize($body, 'Afosto\\Sdk\\Model\\Error', 'json'), $response);
}
@@ -108,7 +118,7 @@
}
if (503 === $status) {
- return null;
+ throw new GetShipmentMethodServiceUnavailableException($serializer->deserialize($body, 'Afosto\\Sdk\\Model\\Error', 'json'), $response);
}
}
}