ameliabooking
/
src
/
Application
/
Controller
/
Notification
/
SendAmeliaSmsApiRequestController.php
GetNotificationsController.php
1 month ago
GetSMSNotificationsHistoryController.php
1 month ago
SendAmeliaSmsApiRequestController.php
1 month ago
SendTestEmailController.php
1 month ago
SendUndeliveredNotificationsController.php
1 month ago
UpdateNotificationController.php
1 month ago
UpdateNotificationStatusController.php
1 month ago
UpdateSMSNotificationHistoryController.php
1 month ago
UpdateSMSNotificationHistoryDirectlyController.php
1 month ago
ValidateSMTPCredentialsController.php
1 month ago
SendAmeliaSmsApiRequestController.php
44 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Application\Controller\Notification; |
| 4 | |
| 5 | use AmeliaBooking\Application\Commands\Notification\SendAmeliaSmsApiRequestCommand; |
| 6 | use AmeliaBooking\Application\Controller\Controller; |
| 7 | use AmeliaVendor\Psr\Http\Message\ServerRequestInterface as Request; |
| 8 | |
| 9 | /** |
| 10 | * Class SendAmeliaSmsApiRequestController |
| 11 | * |
| 12 | * @package AmeliaBooking\Application\Controller\Notification |
| 13 | */ |
| 14 | class SendAmeliaSmsApiRequestController extends Controller |
| 15 | { |
| 16 | /** |
| 17 | * Fields for SMS API that can be received from front-end |
| 18 | * |
| 19 | * @var array |
| 20 | */ |
| 21 | protected $allowedFields = [ |
| 22 | 'process', |
| 23 | 'data', |
| 24 | 'type' |
| 25 | ]; |
| 26 | |
| 27 | /** |
| 28 | * Instantiates the Send Amelia SMS API Request command to hand it over to the Command Handler |
| 29 | * |
| 30 | * @param Request $request |
| 31 | * @param $args |
| 32 | * |
| 33 | * @return SendAmeliaSmsApiRequestCommand |
| 34 | */ |
| 35 | protected function instantiateCommand(Request $request, $args) |
| 36 | { |
| 37 | $command = new SendAmeliaSmsApiRequestCommand($args); |
| 38 | $requestBody = $request->getParsedBody(); |
| 39 | $this->setCommandFields($command, $requestBody); |
| 40 | |
| 41 | return $command; |
| 42 | } |
| 43 | } |
| 44 |