DisconnectFromSquareAccountCommand.php
1 year ago
DisconnectFromSquareAccountCommandHandler.php
1 year ago
FetchAccessTokenSquareCommand.php
1 year ago
FetchAccessTokenSquareCommandHandler.php
1 year ago
GetSquareAuthURLCommand.php
1 year ago
GetSquareAuthURLCommandHandler.php
1 year ago
SquarePaymentCommand.php
1 year ago
SquarePaymentCommandHandler.php
1 year ago
SquarePaymentNotifyCommand.php
1 year ago
SquarePaymentNotifyCommandHandler.php
1 year ago
SquareRefundWebhookCommand.php
1 year ago
SquareRefundWebhookCommandHandler.php
1 year ago
GetSquareAuthURLCommandHandler.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Application\Commands\Square; |
| 4 | |
| 5 | use AmeliaBooking\Application\Commands\CommandHandler; |
| 6 | use AmeliaBooking\Application\Commands\CommandResult; |
| 7 | use AmeliaBooking\Infrastructure\Services\Payment\SquareService; |
| 8 | use Interop\Container\Exception\ContainerException; |
| 9 | |
| 10 | /** |
| 11 | * Class GetSquareAuthURLCommandHandler |
| 12 | * |
| 13 | * @package AmeliaBooking\Application\Commands\Outlook |
| 14 | */ |
| 15 | class GetSquareAuthURLCommandHandler extends CommandHandler |
| 16 | { |
| 17 | /** |
| 18 | * @param GetSquareAuthURLCommand $command |
| 19 | * |
| 20 | * @return CommandResult |
| 21 | * @throws ContainerException |
| 22 | */ |
| 23 | public function handle(GetSquareAuthURLCommand $command) |
| 24 | { |
| 25 | $result = new CommandResult(); |
| 26 | |
| 27 | /** @var SquareService $squareService */ |
| 28 | $squareService = $this->container->get('infrastructure.payment.square.service'); |
| 29 | |
| 30 | $authUrl = $squareService->getAuthUrl(); |
| 31 | |
| 32 | $result->setResult(CommandResult::RESULT_SUCCESS); |
| 33 | $result->setMessage('Successfully retrieved square authorization URL'); |
| 34 | $result->setData([ |
| 35 | 'authUrl' => filter_var($authUrl, FILTER_SANITIZE_URL) |
| 36 | ]); |
| 37 | |
| 38 | return $result; |
| 39 | } |
| 40 | } |
| 41 |