Exemple #1
0
 public function testScopes()
 {
     $client = new Client('AccessToken', 'SecretKey');
     $this->assertEmpty($client->getScopes(), 'By default the scopes should be an empty array');
     $this->assertInternalType('array', $client->getScopes(), 'Expected getScopes to return an array');
     $client->setScopes(array(Client::SCOPE_READ_CUSTOMERS));
     $this->assertCount(1, $client->getScopes());
     $this->assertInternalType('array', $client->getScopes());
     $client->addScope(Client::SCOPE_WRITE_CUSTOMERS);
     $this->assertCount(2, $client->getScopes());
     $this->assertInternalType('array', $client->getScopes());
 }
 public function indexAction(Request $request)
 {
     $hmac = $request->query->get('hmac');
     $shop = $request->query->get('shop');
     $signature = $request->query->get('signature');
     $timestamp = $request->query->get('timestamp');
     $this->get('session')->set('shop', $shop);
     $key = $this->getParameter('shopify.key');
     $secret = $this->getParameter('shopify.secret');
     $client = new Client($key, $secret);
     $client->setShop($shop);
     $client->setScopes('read_products,read_customers,read_orders');
     $authUrl = $client->getAuthorizationUrl($this->generateUrl('dspace_shopify_auth_callback', array(), UrlGeneratorInterface::ABSOLUTE_URL));
     var_dump($request->query->all(), $request->getMethod(), $authUrl);
     die;
     return $this->redirect($authUrl);
 }