Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7449 from mautic-inc/feature.sms-replies-in-campa…
…igns Add support for sms replies as a campaign decision
- Loading branch information
Showing
36 changed files
with
1,973 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
/* | ||
* @copyright 2018 Mautic Inc. All rights reserved | ||
* @author Mautic, Inc. | ||
* | ||
* @link https://www.mautic.com | ||
* | ||
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html | ||
*/ | ||
|
||
namespace Mautic\SmsBundle\Callback; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Mautic\SmsBundle\Exception\NumberNotFoundException; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; | ||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||
|
||
interface CallbackInterface | ||
{ | ||
/** | ||
* Returns a "transport" string to match the URL path /sms/{transport}/callback. | ||
* | ||
* @return string | ||
*/ | ||
public function getTransportName(); | ||
|
||
/** | ||
* Return all contacts that match whatever identifiers the service provides (likely number). | ||
* | ||
* @param Request $request | ||
* | ||
* @return ArrayCollection | ||
* | ||
* @throws NumberNotFoundException | ||
* @throws BadRequestHttpException | ||
* @throws NotFoundHttpException | ||
*/ | ||
public function getContacts(Request $request); | ||
|
||
/** | ||
* Extract the message in the reply from the request. | ||
* | ||
* @param Request $request | ||
* | ||
* @return string | ||
* | ||
* @throws BadRequestHttpException | ||
* @throws NotFoundHttpException | ||
*/ | ||
public function getMessage(Request $request); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/* | ||
* @copyright 2018 Mautic Inc. All rights reserved | ||
* @author Mautic, Inc. | ||
* | ||
* @link https://www.mautic.com | ||
* | ||
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html | ||
*/ | ||
|
||
namespace Mautic\SmsBundle\Callback; | ||
|
||
use Mautic\SmsBundle\Exception\CallbackHandlerNotFound; | ||
|
||
class HandlerContainer | ||
{ | ||
/** | ||
* @var CallbackInterface[] | ||
*/ | ||
private $handlers; | ||
|
||
/** | ||
* @param CallbackInterface $handler | ||
*/ | ||
public function registerHandler(CallbackInterface $handler) | ||
{ | ||
$this->handlers[$handler->getTransportName()] = $handler; | ||
} | ||
|
||
/** | ||
* @param $transportName | ||
* | ||
* @return CallbackInterface | ||
* | ||
* @throws CallbackHandlerNotFound | ||
*/ | ||
public function getHandler($transportName) | ||
{ | ||
if (!isset($this->handlers[$transportName])) { | ||
throw new CallbackHandlerNotFound("$transportName has not been registered"); | ||
} | ||
|
||
return $this->handlers[$transportName]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/* | ||
* @copyright 2018 Mautic Inc. All rights reserved | ||
* @author Mautic, Inc. | ||
* | ||
* @link https://www.mautic.com | ||
* | ||
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html | ||
*/ | ||
|
||
namespace Mautic\SmsBundle\Callback; | ||
|
||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
interface ResponseInterface | ||
{ | ||
/** | ||
* @return Response | ||
*/ | ||
public function getResponse(); | ||
} |
Oops, something went wrong.