1 | <?php |
||
34 | class BookingService |
||
35 | { |
||
36 | /** |
||
37 | * @var CargoRepositoryInterface |
||
38 | */ |
||
39 | private $cargoRepository; |
||
40 | |||
41 | /** |
||
42 | * @var TransactionManager |
||
43 | */ |
||
44 | private $transactionManager; |
||
45 | |||
46 | /** |
||
47 | * @var RoutingServiceInterface |
||
48 | */ |
||
49 | private $routingService; |
||
50 | |||
51 | /** |
||
52 | * @var array List of locations |
||
53 | */ |
||
54 | private $locations; |
||
55 | |||
56 | /** |
||
57 | * @param CargoRepositoryInterface $aCargoRepository |
||
58 | * @param TransactionManager $aTransactionManager |
||
59 | * @param RoutingServiceInterface $aRoutingService |
||
60 | * @param array $locations |
||
61 | */ |
||
62 | public function __construct( |
||
63 | CargoRepositoryInterface $aCargoRepository, |
||
64 | TransactionManager $aTransactionManager, |
||
65 | RoutingServiceInterface $aRoutingService, |
||
66 | array $locations |
||
67 | ) { |
||
68 | $this->cargoRepository = $aCargoRepository; |
||
69 | $this->transactionManager = $aTransactionManager; |
||
70 | $this->routingService = $aRoutingService; |
||
71 | $this->locations = $locations; |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * @param string $anOrigin |
||
76 | * @param string $aDestination |
||
77 | * @throws \Exception If booking fails |
||
78 | * @return string |
||
79 | */ |
||
80 | public function bookNewCargo(string $anOrigin, string $aDestination): string |
||
102 | |||
103 | /** |
||
104 | * @param string $aTrackingId |
||
105 | * @throws \Codeliner\CargoBackend\Application\Exception\CargoNotFoundException |
||
106 | * @return CargoRoutingDto |
||
107 | */ |
||
108 | public function loadCargoForRouting(string $aTrackingId): CargoRoutingDto |
||
122 | |||
123 | /** |
||
124 | * @param string $aTrackingId |
||
125 | * @throws CargoNotFoundException |
||
126 | * @return RouteCandidateDto[] |
||
127 | */ |
||
128 | public function requestPossibleRoutesForCargo(string $aTrackingId): array |
||
149 | |||
150 | /** |
||
151 | * @param string $aTrackingId |
||
152 | * @param RouteCandidateDto $aRoute |
||
153 | * @throws CargoNotFoundException |
||
154 | * @throws \Exception |
||
155 | * @return void |
||
156 | */ |
||
157 | public function assignCargoToRoute(string $aTrackingId, RouteCandidateDto $aRoute) |
||
187 | |||
188 | /** |
||
189 | * @return LocationDto[] |
||
190 | */ |
||
191 | public function listShippingLocations(): array |
||
205 | |||
206 | /** |
||
207 | * @return CargoRoutingDto[] |
||
208 | */ |
||
209 | public function listAllCargos(): array |
||
223 | } |
||
224 |