Ejemplo n.º 1
0
 public function testGetAuthorizationUrl()
 {
     $client = new Client('AccessToken', 'SecretKey');
     $client->setShop('example.myshopify.com')->addScope(Client::SCOPE_READ_CUSTOMERS);
     $actual = $client->getAuthorizationUrl('https://example.com', 1);
     $expected = 'https://example.myshopify.com/admin/oauth/authorize?client_id=AccessToken&scope=read_customers&redirect_uri=https%3A%2F%2Fexample.com&state=1';
     $this->assertSame($expected, $actual);
 }
Ejemplo n.º 2
0
 public function callbackAction(Request $request)
 {
     $code = $request->query->get('code');
     $hmac = $request->query->get('hmac');
     $shop = $request->query->get('shop');
     $signature = $request->query->get('signature');
     $state = $request->query->get('state');
     $timestamp = $request->query->get('timestamp');
     $key = $this->getParameter('shopify.key');
     $secret = $this->getParameter('shopify.secret');
     $client = new Client($key, $secret);
     $client->setShop($shop);
     $accessToken = $client->getAccessToken($code);
     $customers = $client->call('get', '/admin/customers.json');
     var_dump($request->query->all(), $accessToken, $customers);
     die;
     $this->redirct($client->getBaseUri() . '/admin');
 }