PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.32
Booking for Appointments and Events Calendar – Amelia v1.2.32
2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Application / Commands / Booking / Appointment / DeleteBookingRemotelyCommandHandler.php
ameliabooking / src / Application / Commands / Booking / Appointment Last commit date
AddAppointmentCommand.php 1 year ago AddAppointmentCommandHandler.php 1 year ago AddBookingCommand.php 1 year ago AddBookingCommandHandler.php 1 year ago ApproveBookingRemotelyCommand.php 1 year ago ApproveBookingRemotelyCommandHandler.php 1 year ago CancelBookingCommand.php 1 year ago CancelBookingCommandHandler.php 1 year ago CancelBookingRemotelyCommand.php 1 year ago CancelBookingRemotelyCommandHandler.php 2 years ago DeleteAppointmentCommand.php 1 year ago DeleteAppointmentCommandHandler.php 1 year ago DeleteBookingCommand.php 1 year ago DeleteBookingCommandHandler.php 1 year ago DeleteBookingRemotelyCommand.php 1 year ago DeleteBookingRemotelyCommandHandler.php 1 year ago GetAppointmentCommand.php 7 years ago GetAppointmentCommandHandler.php 1 year ago GetAppointmentsCommand.php 1 year ago GetAppointmentsCommandHandler.php 1 year ago GetIcsCommand.php 1 year ago GetIcsCommandHandler.php 4 years ago GetPackageAppointmentsCommand.php 1 year ago GetPackageAppointmentsCommandHandler.php 1 year ago GetTimeSlotsCommand.php 1 year ago GetTimeSlotsCommandHandler.php 1 year ago ReassignBookingCommand.php 1 year ago ReassignBookingCommandHandler.php 1 year ago RejectBookingRemotelyCommand.php 1 year ago RejectBookingRemotelyCommandHandler.php 1 year ago SuccessfulBookingCommand.php 1 year ago SuccessfulBookingCommandHandler.php 1 year ago UpdateAppointmentCommand.php 1 year ago UpdateAppointmentCommandHandler.php 1 year ago UpdateAppointmentStatusCommand.php 1 year ago UpdateAppointmentStatusCommandHandler.php 1 year ago UpdateAppointmentTimeCommand.php 1 year ago UpdateAppointmentTimeCommandHandler.php 1 year ago UpdateBookingStatusCommand.php 1 year ago UpdateBookingStatusCommandHandler.php 1 year ago
DeleteBookingRemotelyCommandHandler.php
66 lines
1 <?php
2
3 namespace AmeliaBooking\Application\Commands\Booking\Appointment;
4
5 use AmeliaBooking\Application\Commands\CommandHandler;
6 use AmeliaBooking\Application\Commands\CommandResult;
7 use AmeliaBooking\Application\Common\Exceptions\AccessDeniedException;
8 use AmeliaBooking\Application\Services\Reservation\AbstractReservationService;
9 use AmeliaBooking\Domain\Entity\Entities;
10 use AmeliaBooking\Infrastructure\Common\Exceptions\NotFoundException;
11 use AmeliaBooking\Infrastructure\Common\Exceptions\QueryExecutionException;
12 use AmeliaBooking\Domain\Common\Exceptions\InvalidArgumentException;
13 use Slim\Exception\ContainerValueNotFoundException;
14 use Interop\Container\Exception\ContainerException;
15
16 /**
17 * Class DeleteBookingRemotelyCommandHandler
18 *
19 * @package AmeliaBooking\Application\Commands\Booking\Appointment
20 */
21 class DeleteBookingRemotelyCommandHandler extends CommandHandler
22 {
23 /**
24 * @param DeleteBookingRemotelyCommand $command
25 *
26 * @return CommandResult
27 * @throws InvalidArgumentException
28 * @throws ContainerValueNotFoundException
29 * @throws AccessDeniedException
30 * @throws QueryExecutionException
31 * @throws ContainerException
32 * @throws NotFoundException
33 */
34 public function handle(DeleteBookingRemotelyCommand $command)
35 {
36 $result = new CommandResult();
37
38 $type = $command->getField('type') ?: Entities::APPOINTMENT;
39
40 $bookingId = $command->getArg('id');
41
42 $token = $command->getField('token');
43
44 if (!$token) {
45 throw new AccessDeniedException('No token sent');
46 }
47
48 /** @var AbstractReservationService $reservationService */
49 $reservationService = $this->container->get('application.reservation.service')->get($type);
50
51 try {
52 $reservationService->deleteBooking($bookingId, $token);
53 } catch (\Exception $e) {
54 $result->setResult(CommandResult::RESULT_ERROR);
55 $result->setMessage($e->getMessage());
56
57 return $result;
58 }
59
60 $result->setResult(CommandResult::RESULT_SUCCESS);
61 $result->setMessage('Successfully deleted booking');
62
63 return $result;
64 }
65 }
66