/**
  * @param Application $app
  * @param string $webhookName
  */
 public function setConfig(Application $app, $webhookName)
 {
     $config = $app->getWebhook($webhookName);
     $this->app = $app;
     $this->secret = $config['secret'];
     $this->events = $config['events'];
 }
 protected function displayAppWebhooks(Application $app, OutputInterface $output)
 {
     $output->writeln(sprintf('<info>Webhooks for application:</info> %s', $app->getApp()));
     $webhooks = $app->getWebhook();
     $this->renderWebhooks($webhooks, $output, $app->getApp());
 }
 /**
  * shop installed an upgraded version
  * @param UpgradeEvent $event
  * @return bool
  */
 public function onUpgrade(UpgradeEvent $event)
 {
     $shop = $this->getShopByEvent($event);
     if (!$shop) {
         return false;
     }
     // todo: refactor this on major change: push application object thru event
     $appData = $event->getApplication();
     $app = new Application($event->getApplicationName(), $appData['app_id'], $appData['app_secret'], $appData['appstore_secret'], null, $this->skipSsl);
     $app->setUserAgent($appData['user_agent']);
     $this->tokenRefresher->setClient($app->getClient($shop));
     $this->tokenRefresher->refresh($shop);
     $shop->setVersion($event->getPayload()['application_version']);
     $this->objectManager->save($shop);
 }