@@ 33-71 (lines=39) @@ | ||
30 | use Symfony\Component\EventDispatcher\EventDispatcher; |
|
31 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
|
32 | ||
33 | class HookListCommand extends ContainerAwareCommand |
|
34 | { |
|
35 | ||
36 | private $output; |
|
37 | ||
38 | protected function configure() |
|
39 | { |
|
40 | $this |
|
41 | ->setName('partfire:mangopay:hook-list') |
|
42 | ->setDescription('Shows all hooks registered in Mango') |
|
43 | ; |
|
44 | ||
45 | } |
|
46 | ||
47 | protected function execute(InputInterface $input, OutputInterface $output) |
|
48 | { |
|
49 | $this->output = $this->getConsoleOutPutter(); |
|
50 | $this->output->setOutputer($output); |
|
51 | ||
52 | $this->output->info("Listing all hooks with MangoPay"); |
|
53 | var_dump($this->getHookService()->list()); |
|
54 | } |
|
55 | ||
56 | private function showTitle($title) |
|
57 | { |
|
58 | $this->output->info(str_pad(" " . $title . " ", 80, "-", STR_PAD_BOTH)); |
|
59 | } |
|
60 | ||
61 | private function getConsoleOutPutter() : ConsoleOutput |
|
62 | { |
|
63 | return $this->getContainer()->get('partfire_common.output_console'); |
|
64 | } |
|
65 | ||
66 | private function getHookService() : Hook |
|
67 | { |
|
68 | return $this->getContainer()->get('part_fire_mango_pay.services.hook'); |
|
69 | } |
|
70 | ||
71 | } |
@@ 32-70 (lines=39) @@ | ||
29 | use Symfony\Component\EventDispatcher\EventDispatcher; |
|
30 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
|
31 | ||
32 | class WebHookDispatchCommand extends ContainerAwareCommand |
|
33 | { |
|
34 | ||
35 | private $output; |
|
36 | ||
37 | protected function configure() |
|
38 | { |
|
39 | $this |
|
40 | ->setName('partfire:mangopay:webhook-dispatch') |
|
41 | ->setDescription('Checks for new hooks and dispatches them') |
|
42 | ; |
|
43 | ||
44 | } |
|
45 | ||
46 | protected function execute(InputInterface $input, OutputInterface $output) |
|
47 | { |
|
48 | $this->output = $this->getConsoleOutPutter(); |
|
49 | $this->output->setOutputer($output); |
|
50 | ||
51 | $this->output->info("Checking for new MangoPay Hooks"); |
|
52 | $this->getPartFireMangoPayService()->processNewWebhooks($this->output); |
|
53 | } |
|
54 | ||
55 | private function showTitle($title) |
|
56 | { |
|
57 | $this->output->info(str_pad(" " . $title . " ", 80, "-", STR_PAD_BOTH)); |
|
58 | } |
|
59 | ||
60 | private function getConsoleOutPutter() : ConsoleOutput |
|
61 | { |
|
62 | return $this->getContainer()->get('partfire_common.output_console'); |
|
63 | } |
|
64 | ||
65 | private function getPartFireMangoPayService() : HookHandleService |
|
66 | { |
|
67 | return $this->getContainer()->get('part_fire_mango_pay.services.webhook'); |
|
68 | } |
|
69 | ||
70 | } |