|
@@ -3,6 +3,11 @@
|
|
|
namespace Bolt\Extension\Ginger\Squarepay;
|
|
|
|
|
|
use Bolt\Extension\SimpleExtension;
|
|
|
+use Bolt\Menu\MenuEntry;
|
|
|
+use Silex\Application;
|
|
|
+use Silex\ControllerCollection;
|
|
|
+use Symfony\Component\HttpFoundation\Request;
|
|
|
+use Symfony\Component\HttpFoundation\Response;
|
|
|
|
|
|
/**
|
|
|
* Squarepay extension class.
|
|
@@ -11,8 +16,61 @@ use Bolt\Extension\SimpleExtension;
|
|
|
*/
|
|
|
class SquarepayExtension extends SimpleExtension
|
|
|
{
|
|
|
+ protected function registerAssets() {
|
|
|
+ // $config = $this->getConfig();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected function registerFrontendRoutes(ControllerCollection $collection)
|
|
|
+ {
|
|
|
+ $collection->match('/checkout', [$this, 'checkoutPaymentForm']);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected function registerBackendRoutes(ControllerCollection $collection)
|
|
|
+ {
|
|
|
+ $collection->match('/extensions/square-authorisation', [$this, 'squareAuthorisation']);
|
|
|
+ $collection->match('/extensions/square-authorisation-result', [$this, 'squareAuthorisationHandleResult']);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected function registerBackendControllers()
|
|
|
+ {
|
|
|
+ return [
|
|
|
+ '/extensions/square' => new Controller\SquareController()
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ protected function registerMenuEntries()
|
|
|
+ {
|
|
|
+ $menu = MenuEntry::create('square-menu', 'square')
|
|
|
+ ->setLabel('Square Payments')
|
|
|
+ ->setIcon('fa:credit-card-alt')
|
|
|
+ ->setPermission('settings')
|
|
|
+ // ->setRoute('square')
|
|
|
+ ;
|
|
|
+
|
|
|
+ return [
|
|
|
+ $menu
|
|
|
+ ];
|
|
|
+ }
|
|
|
|
|
|
+ protected function registerTwigFunctions() {
|
|
|
+ return [
|
|
|
+ 'waggawoo' => ['waggawooFunction', ['is_safe' => ['html']]]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function waggawooFunction() {
|
|
|
+ return '<h1>WAGGA WAGGA WOO!</h1>';
|
|
|
+ }
|
|
|
|
|
|
+ function checkoutPaymentForm() {
|
|
|
+ return new Response('Display Payment Form', Response::HTTP_OK);
|
|
|
+ }
|
|
|
|
|
|
+ function squareAuthorisation() {
|
|
|
+ return new Response('Square Authorisation', Response::HTTP_OK);
|
|
|
+ }
|
|
|
|
|
|
+ function squareAuthorisationHandleResult() {
|
|
|
+ return new Response('Square Authorisation Result', Response::HTTP_OK);
|
|
|
+ }
|
|
|
}
|