Completed
Push — master ( a1acf8...e83a08 )
by Tomáš
03:23
created

Balikobot::getActivatedManipulationUnits()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 10
ccs 3
cts 3
cp 1
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Inspirum\Balikobot\Services;
4
5
use Inspirum\Balikobot\Contracts\RequesterInterface;
6
use Inspirum\Balikobot\Definitions\Option;
7
use Inspirum\Balikobot\Definitions\Shipper;
8
use Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection;
9
use Inspirum\Balikobot\Model\Aggregates\PackageCollection;
10
use Inspirum\Balikobot\Model\Values\Branch;
11
use Inspirum\Balikobot\Model\Values\OrderedPackage;
12
use Inspirum\Balikobot\Model\Values\OrderedShipment;
13
use Inspirum\Balikobot\Model\Values\Package;
14
use Inspirum\Balikobot\Model\Values\PackageStatus;
15
use Inspirum\Balikobot\Model\Values\PostCode;
16
17
class Balikobot
18
{
19
    /**
20
     * Balikobot API
21
     *
22
     * @var \Inspirum\Balikobot\Services\Client
23
     */
24
    private $client;
25
26
    /**
27
     * Balikobot constructor
28
     *
29
     * @param \Inspirum\Balikobot\Contracts\RequesterInterface $requester
30
     */
31 71
    public function __construct(RequesterInterface $requester)
32
    {
33 71
        $this->client = new Client($requester);
34 71
    }
35
36
    /**
37
     * All supported shipper services
38
     *
39
     * @return array<string>
40
     */
41 1
    public function getShippers(): array
42
    {
43 1
        return Shipper::all();
44
    }
45
46
    /**
47
     * Add packages
48
     *
49
     * @param \Inspirum\Balikobot\Model\Aggregates\PackageCollection $packages
50
     *
51
     * @return \Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection|\Inspirum\Balikobot\Model\Values\OrderedPackage[]
52
     *
53
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
54
     */
55 8
    public function addPackages(PackageCollection $packages): OrderedPackageCollection
56
    {
57 8
        $usedRequestVersion = Shipper::resolveAddRequestVersion($packages->getShipper(), $packages->toArray());
58 8
        $labelsUrl          = null;
59
60 8
        $response = $this->client->addPackages(
61 8
            $packages->getShipper(),
62 8
            $packages->toArray(),
63
            $usedRequestVersion,
64
            $labelsUrl
65
        );
66
67 8
        $orderedPackages = new OrderedPackageCollection();
68 8
        $orderedPackages->setLabelsUrl($labelsUrl);
69
70 8
        foreach ($response as $i => $package) {
71 8
            $orderedPackage = OrderedPackage::newInstanceFromData(
72 8
                $packages->getShipper(),
73 8
                $packages->offsetGet($i)->getEID(),
74 8
                $package
75
            );
76 8
            $orderedPackages->add($orderedPackage);
77
        }
78
79 8
        return $orderedPackages;
80
    }
81
82
    /**
83
     * Exports order into Balikobot system
84
     *
85
     * @param \Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection $packages
86
     *
87
     * @return void
88
     *
89
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
90
     */
91 1
    public function dropPackages(OrderedPackageCollection $packages): void
92
    {
93 1
        $this->client->dropPackages($packages->getShipper(), $packages->getPackageIds());
94 1
    }
95
96
    /**
97
     * Exports order into Balikobot system
98
     *
99
     * @param \Inspirum\Balikobot\Model\Values\OrderedPackage $package
100
     *
101
     * @return void
102
     *
103
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
104
     */
105 1
    public function dropPackage(OrderedPackage $package): void
106
    {
107 1
        $this->client->dropPackage($package->getShipper(), $package->getPackageId());
108 1
    }
109
110
    /**
111
     * Order shipment
112
     *
113
     * @param \Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection $packages
114
     *
115
     * @return \Inspirum\Balikobot\Model\Values\OrderedShipment
116
     *
117
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
118
     */
119 2
    public function orderShipment(OrderedPackageCollection $packages): OrderedShipment
120
    {
121 2
        $response = $this->client->orderShipment($packages->getShipper(), $packages->getPackageIds());
122
123 2
        $orderedShipment = OrderedShipment::newInstanceFromData(
124 2
            $packages->getShipper(),
125 2
            $packages->getPackageIds(),
126 2
            $response
127
        );
128
129 2
        return $orderedShipment;
130
    }
131
132
    /**
133
     * Track package
134
     *
135
     * @param \Inspirum\Balikobot\Model\Values\OrderedPackage $package
136
     *
137
     * @return array<\Inspirum\Balikobot\Model\Values\PackageStatus>|\Inspirum\Balikobot\Model\Values\PackageStatus[]
138
     *
139
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
140
     */
141 2
    public function trackPackage(OrderedPackage $package): array
142
    {
143 2
        $packages = new OrderedPackageCollection();
144 2
        $packages->add($package);
145
146 2
        $response = $this->trackPackages($packages);
147
148 2
        return $response[0];
149
    }
150
151
    /**
152
     * Track packages
153
     *
154
     * @param \Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection $packages
155
     *
156
     * @return array<array<\Inspirum\Balikobot\Model\Values\PackageStatus>>|\Inspirum\Balikobot\Model\Values\PackageStatus[][]
157
     *
158
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
159
     */
160 4
    public function trackPackages(OrderedPackageCollection $packages): array
161
    {
162 4
        $response = $this->client->trackPackages($packages->getShipper(), $packages->getCarrierIds());
163
164 4
        $statuses = [];
165
166 4
        foreach ($response as $i => $responseStatuses) {
167 4
            $statuses[$i] = [];
168
169 4
            foreach ($responseStatuses as $status) {
170 4
                $statuses[$i][] = PackageStatus::newInstanceFromData($status);
171
            }
172
        }
173
174 4
        return $statuses;
175
    }
176
177
    /**
178
     * Track package last status
179
     *
180
     * @param \Inspirum\Balikobot\Model\Values\OrderedPackage $package
181
     *
182
     * @return \Inspirum\Balikobot\Model\Values\PackageStatus
183
     *
184
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
185
     */
186 2
    public function trackPackageLastStatus(OrderedPackage $package): PackageStatus
187
    {
188 2
        $packages = new OrderedPackageCollection();
189 2
        $packages->add($package);
190
191 2
        $response = $this->trackPackagesLastStatus($packages);
192
193 2
        return $response[0];
194
    }
195
196
    /**
197
     * Track package last status
198
     *
199
     * @param \Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection $packages
200
     *
201
     * @return array<\Inspirum\Balikobot\Model\Values\PackageStatus>|\Inspirum\Balikobot\Model\Values\PackageStatus[]
202
     *
203
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
204
     */
205 4
    public function trackPackagesLastStatus(OrderedPackageCollection $packages): array
206
    {
207 4
        $response = $this->client->trackPackagesLastStatus($packages->getShipper(), $packages->getCarrierIds());
208
209 4
        $statuses = [];
210
211 4
        foreach ($response as $status) {
212 4
            $statuses[] = PackageStatus::newInstanceFromData($status);
213
        }
214
215 4
        return $statuses;
216
    }
217
218
    /**
219
     * Get overview for given shipper
220
     *
221
     * @param string $shipper
222
     *
223
     * @return \Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection|\Inspirum\Balikobot\Model\Values\OrderedPackage[]
224
     *
225
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
226
     */
227 2
    public function getOverview(string $shipper): OrderedPackageCollection
228
    {
229 2
        $response = $this->client->getOverview($shipper);
230
231 2
        $orderedPackages = new OrderedPackageCollection();
232
233 2
        foreach ($response as $package) {
234 1
            $orderedPackage = OrderedPackage::newInstanceFromData(
235 1
                $shipper,
236 1
                (string) $package['eshop_id'],
237 1
                $package
238
            );
239 1
            $orderedPackages->add($orderedPackage);
240
        }
241
242 2
        return $orderedPackages;
243
    }
244
245
    /**
246
     * Get labels for orders
247
     *
248
     * @param \Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection $packages
249
     *
250
     * @return string
251
     *
252
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
253
     */
254 2
    public function getLabels(OrderedPackageCollection $packages): string
255
    {
256 2
        $labelUrl = $this->client->getLabels($packages->getShipper(), $packages->getPackageIds());
257
258 2
        return $labelUrl;
259
    }
260
261
    /**
262
     * Gets complete information about a package
263
     *
264
     * @param \Inspirum\Balikobot\Model\Values\OrderedPackage $package
265
     *
266
     * @return \Inspirum\Balikobot\Model\Values\Package
267
     *
268
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
269
     */
270 2
    public function getPackageInfo(OrderedPackage $package): Package
271
    {
272 2
        $response = $this->client->getPackageInfo($package->getShipper(), $package->getPackageId());
273
274 2
        unset($response['package_id']);
275 2
        unset($response['eshop_id']);
276 2
        unset($response['carrier_id']);
277 2
        unset($response['track_url']);
278 2
        unset($response['label_url']);
279 2
        unset($response['carrier_id_swap']);
280 2
        unset($response['pieces']);
281
282 2
        $options              = $response;
283 2
        $options[Option::EID] = $package->getBatchId();
284
285 2
        $package = new Package($options);
286
287 2
        return $package;
288
    }
289
290
    /**
291
     * Gets complete information about a package
292
     *
293
     * @param string $shipper
294
     * @param int    $orderId
295
     *
296
     * @return \Inspirum\Balikobot\Model\Values\OrderedShipment
297
     *
298
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
299
     */
300 2
    public function getOrder(string $shipper, int $orderId): OrderedShipment
301
    {
302 2
        $response = $this->client->getOrder($shipper, $orderId);
303
304 2
        $orderedShipment = OrderedShipment::newInstanceFromData(
305 2
            $shipper,
306 2
            $response['package_ids'],
307 2
            $response
308
        );
309
310 2
        return $orderedShipment;
311
    }
312
313
    /**
314
     * Returns available services for the given shipper
315
     *
316
     * @param string      $shipper
317
     * @param string|null $country
318
     *
319
     * @return array<string,string>
320
     *
321
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
322
     */
323 5
    public function getServices(string $shipper, string $country = null): array
324
    {
325 5
        $usedRequestVersion = Shipper::resolveServicesRequestVersion($shipper);
326
327 5
        $services = $this->client->getServices($shipper, $country, $usedRequestVersion);
328
329 4
        return $services;
330
    }
331
332
    /**
333
     * Returns available B2A services for the given shipper
334
     *
335
     * @param string $shipper
336
     *
337
     * @return array<string,string>
338
     *
339
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
340
     */
341 2
    public function getB2AServices(string $shipper): array
342
    {
343 2
        $services = $this->client->getB2AServices($shipper);
344
345 2
        return $services;
346
    }
347
348
    /**
349
     * Returns all manipulation units for the given shipper
350
     *
351
     * @param string $shipper
352
     *
353
     * @return array<string>
354
     *
355
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
356
     */
357 2
    public function getManipulationUnits(string $shipper): array
358
    {
359 2
        $units = $this->client->getManipulationUnits($shipper);
360
361 2
        return $units;
362
    }
363
364
    /**
365
     * Returns available manipulation units for the given shipper
366
     *
367
     * @param string $shipper
368
     *
369
     * @return array<string>
370
     *
371
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
372
     */
373 2
    public function getActivatedManipulationUnits(string $shipper): array
374
    {
375 2
        $units = $this->client->getActivatedManipulationUnits($shipper);
376
377 2
        return $units;
378
    }
379
380
    /**
381
     * Get all available branches
382
     *
383
     * @return \Generator|\Inspirum\Balikobot\Model\Values\Branch[]
384
     *
385
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
386
     */
387 1
    public function getBranches(): iterable
388
    {
389 1
        $shippers = $this->getShippers();
390
391 1
        foreach ($shippers as $shipper) {
392 1
            yield from $this->getBranchesForShipper($shipper);
393
        }
394 1
    }
395
396
    /**
397
     * Get all available branches for countries
398
     *
399
     * @param array<string> $countries
400
     *
401
     * @return \Generator|\Inspirum\Balikobot\Model\Values\Branch[]
402
     *
403
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
404
     */
405 1
    public function getBranchesForCountries(array $countries): iterable
406
    {
407 1
        $shippers = $this->getShippers();
408
409 1
        foreach ($shippers as $shipper) {
410 1
            yield from $this->getBranchesForShipperForCountries($shipper, $countries);
411
        }
412 1
    }
413
414
    /**
415
     * Get all available branches for given shipper
416
     *
417
     * @param string $shipper
418
     *
419
     * @return \Generator|\Inspirum\Balikobot\Model\Values\Branch[]
420
     *
421
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
422
     */
423 2
    public function getBranchesForShipper(string $shipper): iterable
424
    {
425 2
        $services = $this->getServicesForShipper($shipper);
426
427 2
        foreach ($services as $service) {
428 2
            yield from $this->getBranchesForShipperService($shipper, $service);
429
        }
430 2
    }
431
432
    /**
433
     * Get all available branches for given shipper for countries
434
     *
435
     * @param string        $shipper
436
     * @param array<string> $countries
437
     *
438
     * @return \Generator|\Inspirum\Balikobot\Model\Values\Branch[]
439
     *
440
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
441
     */
442 2
    public function getBranchesForShipperForCountries(string $shipper, array $countries): iterable
443
    {
444 2
        $services = $this->getServicesForShipper($shipper);
445
446 2
        foreach ($services as $service) {
447 2
            yield from $this->getBranchesForShipperServiceForCountries($shipper, $service, $countries);
448
        }
449 2
    }
450
451
    /**
452
     * Get services for shipper
453
     *
454
     * @param string $shipper
455
     *
456
     * @return array<string|null>
457
     *
458
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
459
     */
460 4
    private function getServicesForShipper(string $shipper): array
461
    {
462 4
        $services = array_keys($this->getServices($shipper)) ?: [null];
463
464 4
        return $services;
465
    }
466
467
    /**
468
     * Get all available branches for given shipper and service type
469
     *
470
     * @param string      $shipper
471
     * @param string|null $service
472
     * @param string|null $country
473
     *
474
     * @return \Generator|\Inspirum\Balikobot\Model\Values\Branch[]
475
     *
476
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
477
     */
478 4
    public function getBranchesForShipperService(string $shipper, ?string $service, string $country = null): iterable
479
    {
480 4
        $useFullbranchRequest = Shipper::hasFullBranchesSupport($shipper, $service);
481 4
        $usedRequestVersion   = Shipper::resolveBranchesRequestVersion($shipper, $service);
482
483 4
        $branches = $this->client->getBranches(
484 4
            $shipper,
485
            $service,
486
            $useFullbranchRequest,
487
            $country,
488
            $usedRequestVersion
489
        );
490
491 4
        foreach ($branches as $branch) {
492 2
            yield Branch::newInstanceFromData($shipper, $service, $branch);
493
        }
494 4
    }
495
496
    /**
497
     * Get all available branches for given shipper and service type for countries
498
     *
499
     * @param string        $shipper
500
     * @param string|null   $service
501
     * @param array<string> $countries
502
     *
503
     * @return \Generator|\Inspirum\Balikobot\Model\Values\Branch[]
504
     *
505
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
506
     */
507 3
    public function getBranchesForShipperServiceForCountries(
508
        string $shipper,
509
        ?string $service,
510
        array $countries
511
    ): iterable {
512 3
        $branches = $this->getAllBranchesForShipperServiceForCountries($shipper, $service, $countries);
513
514 3
        foreach ($branches as $branch) {
515 3
            if (in_array($branch->getCountry(), $countries)) {
516 3
                yield $branch;
517
            }
518
        }
519 3
    }
520
521
    /**
522
     * Get all available branches for given shipper and service type filtered by countries if possible
523
     *
524
     * @param string        $shipper
525
     * @param string|null   $service
526
     * @param array<string> $countries
527
     *
528
     * @return \Generator|\Inspirum\Balikobot\Model\Values\Branch[]
529
     *
530
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
531
     */
532 3
    private function getAllBranchesForShipperServiceForCountries(
533
        string $shipper,
534
        ?string $service,
535
        array $countries
536
    ): iterable {
537 3
        if (Shipper::hasBranchCountryFilterSupport($shipper) === false) {
538 2
            yield from $this->getBranchesForShipperService($shipper, $service);
539
540 2
            return;
541
        }
542
543 2
        foreach ($countries as $country) {
544 2
            yield from $this->getBranchesForShipperService($shipper, $service, $country);
545
        }
546 2
    }
547
548
    /**
549
     * Get all available branches for given shipper
550
     *
551
     * @param string      $shipper
552
     * @param string      $country
553
     * @param string      $city
554
     * @param string|null $postcode
555
     * @param string|null $street
556
     * @param int|null    $maxResults
557
     * @param float|null  $radius
558
     * @param string|null $type
559
     *
560
     * @return \Generator|\Inspirum\Balikobot\Model\Values\Branch[]
561
     *
562
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
563
     */
564 3
    public function getBranchesForLocation(
565
        string $shipper,
566
        string $country,
567
        string $city,
568
        string $postcode = null,
569
        string $street = null,
570
        int $maxResults = null,
571
        float $radius = null,
572
        string $type = null
573
    ): iterable {
574 3
        $branches = $this->client->getBranchesForLocation(
575 3
            $shipper,
576
            $country,
577
            $city,
578
            $postcode,
579
            $street,
580
            $maxResults,
581
            $radius,
582
            $type
583
        );
584
585 3
        foreach ($branches as $branch) {
586 1
            yield Branch::newInstanceFromData($shipper, null, $branch);
587
        }
588 3
    }
589
590
    /**
591
     * Returns list of countries where service with cash-on-delivery payment type is available in
592
     *
593
     * @param string $shipper
594
     *
595
     * @return array<array<int|string,array<string,array>>>
596
     *
597
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
598
     */
599 2
    public function getCodCountries(string $shipper): array
600
    {
601 2
        $countries = $this->client->getCodCountries($shipper);
602
603 2
        return $countries;
604
    }
605
606
    /**
607
     * Returns list of countries where service is available in
608
     *
609
     * @param string $shipper
610
     *
611
     * @return array<array<int|string,string>>
612
     *
613
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
614
     */
615 2
    public function getCountries(string $shipper): array
616
    {
617 2
        $countries = $this->client->getCountries($shipper);
618
619 2
        return $countries;
620
    }
621
622
    /**
623
     * Returns available branches for the given shipper and its service
624
     *
625
     * @param string      $shipper
626
     * @param string      $service
627
     * @param string|null $country
628
     *
629
     * @return \Generator|\Inspirum\Balikobot\Model\Values\PostCode[]
630
     *
631
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
632
     */
633 2
    public function getPostCodes(string $shipper, string $service, string $country = null): iterable
634
    {
635 2
        $postCodes = $this->client->getPostCodes($shipper, $service, $country);
636
637 2
        foreach ($postCodes as $postcode) {
638 1
            yield PostCode::newInstanceFromData($shipper, $service, $postcode);
639
        }
640 2
    }
641
642
    /**
643
     * Check package(s) data
644
     *
645
     * @param \Inspirum\Balikobot\Model\Aggregates\PackageCollection $packages
646
     *
647
     * @return void
648
     *
649
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
650
     */
651 1
    public function checkPackages(PackageCollection $packages): void
652
    {
653 1
        $this->client->checkPackages($packages->getShipper(), $packages->toArray());
654 1
    }
655
656
    /**
657
     * Returns available manipulation units for the given shipper
658
     *
659
     * @param string $shipper
660
     *
661
     * @return array<string>
662
     *
663
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
664
     */
665 2
    public function getAdrUnits(string $shipper): array
666
    {
667 2
        $units = $this->client->getAdrUnits($shipper);
668
669 2
        return $units;
670
    }
671
672
    /**
673
     * Returns available activated services for the given shipper
674
     *
675
     * @param string $shipper
676
     *
677
     * @return array<string,mixed>
678
     *
679
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
680
     */
681 2
    public function getActivatedServices(string $shipper): array
682
    {
683 2
        $services = $this->client->getActivatedServices($shipper);
684
685 2
        return $services;
686
    }
687
688
    /**
689
     * Order shipments from place B (typically supplier / previous consignee) to place A (shipping point)
690
     *
691
     * @param \Inspirum\Balikobot\Model\Aggregates\PackageCollection $packages
692
     *
693
     * @return \Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection|\Inspirum\Balikobot\Model\Values\OrderedPackage[]
694
     *
695
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
696
     */
697 3
    public function orderB2AShipment(PackageCollection $packages): OrderedPackageCollection
698
    {
699 3
        $response = $this->client->orderB2AShipment($packages->getShipper(), $packages->toArray());
700
701 3
        $orderedPackages = new OrderedPackageCollection();
702
703 3
        foreach ($response as $i => $package) {
704 3
            $orderedPackage = OrderedPackage::newInstanceFromData(
705 3
                $packages->getShipper(),
706 3
                $packages->offsetGet($i)->getEID(),
707 3
                $package
708
            );
709 3
            $orderedPackages->add($orderedPackage);
710
        }
711
712 3
        return $orderedPackages;
713
    }
714
715
    /**
716
     * Get PDF link with signed consignment delivery document by the recipient
717
     *
718
     * @param \Inspirum\Balikobot\Model\Values\OrderedPackage $package
719
     *
720
     * @return string
721
     *
722
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
723
     */
724 2
    public function getProofOfDelivery(OrderedPackage $package): string
725
    {
726 2
        $packages = new OrderedPackageCollection();
727 2
        $packages->add($package);
728
729 2
        $linkUrls = $this->getProofOfDeliveries($packages);
730
731 2
        return $linkUrls[0];
732
    }
733
734
    /**
735
     * Get array of PDF links with signed consignment delivery document by the recipient
736
     *
737
     * @param \Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection $packages
738
     *
739
     * @return array<string>
740
     *
741
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
742
     */
743 4
    public function getProofOfDeliveries(OrderedPackageCollection $packages): array
744
    {
745 4
        $linkUrls = $this->client->getProofOfDeliveries($packages->getShipper(), $packages->getCarrierIds());
746
747 4
        return $linkUrls;
748
    }
749
}
750