| @@ 317-332 (lines=16) @@ | ||
| 314 | * |
|
| 315 | * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface |
|
| 316 | */ |
|
| 317 | public function getManipulationUnits(string $shipper): array |
|
| 318 | { |
|
| 319 | $response = $this->requester->call('v1', $shipper, Request::MANIPULATION_UNITS); |
|
| 320 | ||
| 321 | if ($response['units'] === null) { |
|
| 322 | return []; |
|
| 323 | } |
|
| 324 | ||
| 325 | $units = []; |
|
| 326 | ||
| 327 | foreach ($response['units'] as $item) { |
|
| 328 | $units[$item['code']] = $item['name']; |
|
| 329 | } |
|
| 330 | ||
| 331 | return $units; |
|
| 332 | } |
|
| 333 | ||
| 334 | /** |
|
| 335 | * Returns available branches for the given shipper and its service |
|
| @@ 414-429 (lines=16) @@ | ||
| 411 | * |
|
| 412 | * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface |
|
| 413 | */ |
|
| 414 | public function getCountries(string $shipper): array |
|
| 415 | { |
|
| 416 | $response = $this->requester->call('v1', $shipper, Request::COUNTRIES); |
|
| 417 | ||
| 418 | if ($response['service_types'] === null) { |
|
| 419 | return []; |
|
| 420 | } |
|
| 421 | ||
| 422 | $services = []; |
|
| 423 | ||
| 424 | foreach ($response['service_types'] as $item) { |
|
| 425 | $services[$item['service_type']] = $item['countries']; |
|
| 426 | } |
|
| 427 | ||
| 428 | return $services; |
|
| 429 | } |
|
| 430 | ||
| 431 | /** |
|
| 432 | * Returns available branches for the given shipper and its service |
|
| @@ 498-513 (lines=16) @@ | ||
| 495 | * |
|
| 496 | * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface |
|
| 497 | */ |
|
| 498 | public function getAdrUnits(string $shipper): array |
|
| 499 | { |
|
| 500 | $response = $this->requester->call('v1', $shipper, Request::ADR_UNITS); |
|
| 501 | ||
| 502 | if ($response['units'] === null) { |
|
| 503 | return []; |
|
| 504 | } |
|
| 505 | ||
| 506 | $units = []; |
|
| 507 | ||
| 508 | foreach ($response['units'] as $item) { |
|
| 509 | $units[$item['code']] = $item['name']; |
|
| 510 | } |
|
| 511 | ||
| 512 | return $units; |
|
| 513 | } |
|
| 514 | } |
|
| 515 | ||