Skip to content

Commit 6573396

Browse files
committed
store to shop rename
1 parent a5b26f8 commit 6573396

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $provider = new Pizdata\OAuth2\Client\Provider\Shopify([
2424
'clientId' => '{shopify-client-id}', // The client ID assigned to you by the Shopify
2525
'clientSecret' => '{shopify-client-secret}', // The client password assigned to you by the Shopify
2626
'redirectUri' => 'http://localhost/callback', // The redirect URI assigned to you
27-
'store' => 'my-test-store', // The Store name
27+
'shop' => 'pizdata.myshopify.com', // The Shop name
2828
]);
2929

3030
// If we don't have an authorization code then get one

src/Provider/Shopify.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77

88
class Shopify extends AbstractProvider
99
{
10-
/**
11-
* Production Shopify domain.
12-
*
13-
* @const string
14-
*/
15-
const BASE_SHOPIFY_DOMAIN = 'myshopify.com';
16-
1710
/**
1811
* The store name.
1912
*
@@ -31,12 +24,12 @@ public function __construct($options = [], array $collaborators = [])
3124
{
3225
parent::__construct($options, $collaborators);
3326

34-
if (empty($options['store'])) {
35-
$message = 'The "store" option not set. Please set a Store name.';
27+
if (empty($options['shop'])) {
28+
$message = 'The "shop" option not set. Please set a Shop name.';
3629
throw new \InvalidArgumentException($message);
3730
}
3831

39-
$this->store = $options['store'];
32+
$this->store = $options['shop'];
4033
}
4134

4235
/**
@@ -46,7 +39,7 @@ public function __construct($options = [], array $collaborators = [])
4639
*/
4740
public function getBaseAuthorizationUrl()
4841
{
49-
return sprintf('https://%s.%s/admin/oauth/authorize', $this->store, self::BASE_SHOPIFY_DOMAIN);
42+
return sprintf('https://%s/admin/oauth/authorize', $this->store);
5043
}
5144

5245
/**
@@ -58,7 +51,7 @@ public function getBaseAuthorizationUrl()
5851
*/
5952
public function getBaseAccessTokenUrl(array $params)
6053
{
61-
return sprintf('https://%s.%s/admin/oauth/access_token', $this->store, self::BASE_SHOPIFY_DOMAIN);
54+
return sprintf('https://%s/admin/oauth/access_token', $this->store);
6255
}
6356

6457
/**
@@ -71,9 +64,8 @@ public function getBaseAccessTokenUrl(array $params)
7164
public function getResourceOwnerDetailsUrl(AccessToken $token)
7265
{
7366
return sprintf(
74-
'https://%s.%s/admin/shop.json?access_token=%s',
67+
'https://%s/admin/shop.json?access_token=%s',
7568
$this->store,
76-
self::BASE_SHOPIFY_DOMAIN,
7769
$token->getToken()
7870
);
7971
}

tests/Provider/ShopifyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protected function setUp()
1515
'clientId' => 'mock_client_id',
1616
'clientSecret' => 'mock_secret',
1717
'redirectUri' => 'none',
18-
'store' => 'mock_domain',
18+
'shop' => 'mock_domain',
1919
]);
2020
}
2121

@@ -27,7 +27,7 @@ public function tearDown()
2727

2828
/**
2929
* @covers \Pizdata\OAuth2\Client\Provider\Shopify::__construct
30-
* @expectExceptionMessage 'The "store" option not set. Please set a Store name.'
30+
* @expectExceptionMessage 'The "shop" option not set. Please set a Shop name.'
3131
* @expectedException \InvalidArgumentException
3232
*/
3333
public function testNoStoreName()

0 commit comments

Comments
 (0)