DisconnectFromSquareAccountController.php
1 year ago
FetchAccessTokenSquareController.php
1 year ago
GetSquareAuthURLController.php
1 year ago
SquarePaymentController.php
1 year ago
SquarePaymentNotifyController.php
1 year ago
SquareRefundWebhookController.php
1 year ago
FetchAccessTokenSquareController.php
49 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Application\Controller\Square; |
| 4 | |
| 5 | use AmeliaBooking\Application\Commands\Square\FetchAccessTokenSquareCommand; |
| 6 | use AmeliaBooking\Application\Controller\Controller; |
| 7 | use RuntimeException; |
| 8 | use Slim\Http\Request; |
| 9 | |
| 10 | /** |
| 11 | * Class FetchAccessTokenSquareController |
| 12 | * |
| 13 | * @package AmeliaBooking\Application\Controller\Square |
| 14 | */ |
| 15 | class FetchAccessTokenSquareController extends Controller |
| 16 | { |
| 17 | /** |
| 18 | * Fields that can be received from front-end |
| 19 | * |
| 20 | * @var array |
| 21 | */ |
| 22 | public $allowedFields = [ |
| 23 | 'access_token', |
| 24 | 'expires_at', |
| 25 | 'refresh_token', |
| 26 | 'merchant_id', |
| 27 | 'decrypted_access_token', |
| 28 | 'decrypted_refresh_token' |
| 29 | ]; |
| 30 | |
| 31 | /** |
| 32 | * Instantiates the FetchAccessTokenSquareCommand to hand it over to the Command Handler |
| 33 | * |
| 34 | * @param Request $request |
| 35 | * @param $args |
| 36 | * |
| 37 | * @return FetchAccessTokenSquareCommand |
| 38 | * @throws RuntimeException |
| 39 | */ |
| 40 | protected function instantiateCommand(Request $request, $args) |
| 41 | { |
| 42 | $command = new FetchAccessTokenSquareCommand($args); |
| 43 | |
| 44 | $this->setCommandFields($command, $request->getQueryParams()); |
| 45 | |
| 46 | return $command; |
| 47 | } |
| 48 | } |
| 49 |