/** * @param \Magento\Customer\Model\Customer $customer */ public function disconnect(\Magento\Customer\Model\Customer $customer) { // TODO: Move to \Inchoo\SocialConnect\Model\Facebook\Info\User try { $this->_client->setAccessToken(unserialize($customer->getInchooSocialconnectFtoken())); $this->_client->api('/me/permissions', 'DELETE'); } catch (Exception $e) { } $pictureFilename = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . '/inchoo/socialconnect/facebook/' . $customer->getInchooSocialconnectFid(); if (file_exists($pictureFilename)) { @unlink($pictureFilename); } $customer->setInchooSocialconnectFid(null)->setInchooSocialconnectFtoken(null)->save(); }
/** * @throws \Inchoo\SocialConnect\Model\Facebook\Oauth2\Exception * @throws \Exception */ protected function _load() { try { $response = $this->_client->api('/' . $this->_target, 'GET', $this->_params); foreach ($response as $key => $value) { $this->setData($key, $value); } } catch (\Inchoo\SocialConnect\Model\Facebook\Oauth2\Exception $e) { $this->_onException($e); } catch (Exception $e) { $this->_onException($e); } }
/** * @return string */ public function getState() { return $this->_clientFacebook->getState(); }
/** * @return bool */ public function facebookEnabled() { return $this->_clientFacebook->isEnabled(); }