DisconnectFromSquareAccountController.php
6 months ago
DisconnectFromSquareAccountDirectlyController.php
6 months ago
FetchAccessTokenSquareController.php
6 months ago
GetSquareAuthURLController.php
10 months ago
SquareRefundWebhookController.php
6 months ago
SquareRefundWebhookController.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Application\Controller\Square; |
| 4 | |
| 5 | use AmeliaBooking\Application\Commands\Square\SquareRefundWebhookCommand; |
| 6 | use AmeliaBooking\Application\Controller\Controller; |
| 7 | use Slim\Http\Request; |
| 8 | |
| 9 | /** |
| 10 | * Class SquareRefundWebhookController |
| 11 | * |
| 12 | * @package AmeliaBooking\Application\Controller\Square |
| 13 | */ |
| 14 | class SquareRefundWebhookController extends Controller |
| 15 | { |
| 16 | /** |
| 17 | * Fields for Square payment that can be received from webhook |
| 18 | * |
| 19 | * @var array |
| 20 | */ |
| 21 | protected $allowedFields = [ |
| 22 | 'data', |
| 23 | 'signature', |
| 24 | ]; |
| 25 | |
| 26 | /** |
| 27 | * @param Request $request |
| 28 | * @param $args |
| 29 | * |
| 30 | * @return SquareRefundWebhookCommand |
| 31 | */ |
| 32 | protected function instantiateCommand(Request $request, $args) |
| 33 | { |
| 34 | $command = new SquareRefundWebhookCommand($args); |
| 35 | $requestBody = $request->getParsedBody(); |
| 36 | $this->setCommandFields($command, $requestBody); |
| 37 | |
| 38 | return $command; |
| 39 | } |
| 40 | } |
| 41 |