Initial commit
This commit is contained in:
53
local/Beds24/Controller/Front/NotificationController.php
Normal file
53
local/Beds24/Controller/Front/NotificationController.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 17/06/2019 13:03
|
||||
*/
|
||||
namespace Beds24\Controller\Front;
|
||||
|
||||
use Beds24\Beds24\Beds24Request;
|
||||
use Beds24\Model\Beds24BookingOrderProductQuery;
|
||||
use Thelia\Controller\Front\BaseFrontController;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class NotificationController extends BaseFrontController
|
||||
{
|
||||
/**
|
||||
* @return Response
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function notify()
|
||||
{
|
||||
// Clear request cache
|
||||
$api = new Beds24Request();
|
||||
|
||||
$api->clearCache();
|
||||
|
||||
// Update booking, if required.
|
||||
$bookId = $this->getRequest()->get('bookId');
|
||||
|
||||
if (! empty($bookId)) {
|
||||
if (null !== $bookingInfo = Beds24BookingOrderProductQuery::create()->findOneByBeds24BookingId($bookId)) {
|
||||
$status = $this->getRequest()->get('status');
|
||||
|
||||
if ($status === 'cancel') {
|
||||
$bookingInfo->setBeds24BookingId('')->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Response('Cache cleared', 200);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user