@@ -70,13 +70,13 @@ |
||
| 70 | 70 | public function getAccessTokenFromAuthorizedCode(string $redirectUrl, string $code): AccessToken |
| 71 | 71 | { |
| 72 | 72 | $options = [ |
| 73 | - 'form_params' => [ |
|
| 74 | - 'grant_type' => self::API_ACCESS_TOKEN_CODE_GRANT, |
|
| 75 | - 'client_id' => $this->clientId, |
|
| 76 | - 'client_secret' => $this->clientSecret, |
|
| 77 | - 'redirect_uri' => $redirectUrl, |
|
| 78 | - 'code' => $code, |
|
| 79 | - ], |
|
| 73 | + 'form_params' => [ |
|
| 74 | + 'grant_type' => self::API_ACCESS_TOKEN_CODE_GRANT, |
|
| 75 | + 'client_id' => $this->clientId, |
|
| 76 | + 'client_secret' => $this->clientSecret, |
|
| 77 | + 'redirect_uri' => $redirectUrl, |
|
| 78 | + 'code' => $code, |
|
| 79 | + ], |
|
| 80 | 80 | ]; |
| 81 | 81 | |
| 82 | 82 | try { |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $url = self::API_AUTHORIZE_USER_LOGIN_URL; |
| 60 | 60 | $url .= '?response_type=code'; |
| 61 | - $url .= '&redirect_uri=' . $redirectUrl; |
|
| 62 | - $url .= '&client_id=' . $this->clientId; |
|
| 63 | - $url .= '&scope=' . $apiScope->getUrlParameters(); |
|
| 61 | + $url .= '&redirect_uri='.$redirectUrl; |
|
| 62 | + $url .= '&client_id='.$this->clientId; |
|
| 63 | + $url .= '&scope='.$apiScope->getUrlParameters(); |
|
| 64 | 64 | $url .= '&state=oauth2'; |
| 65 | 65 | |
| 66 | 66 | return $url; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | return $this->accessToken; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - public function refreshAccessToken(?AccessToken $accessToken = null): AccessToken |
|
| 131 | + public function refreshAccessToken(?AccessToken $accessToken = null): AccessToken |
|
| 132 | 132 | { |
| 133 | 133 | $accessToken ??= $this->accessToken; |
| 134 | 134 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | public function get(string $url, ?array $queryParameters = null): ResponseInterface |
| 155 | 155 | { |
| 156 | - $options = array_merge(['headers' => $this->getAuthorizationHeader()], ['query' => $queryParameters]); |
|
| 156 | + $options = array_merge(['headers' => $this->getAuthorizationHeader()], ['query' => $queryParameters]); |
|
| 157 | 157 | |
| 158 | 158 | try { |
| 159 | 159 | $response = $this->guzzleClient->get($url, $options); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | ] |
| 178 | 178 | ); |
| 179 | 179 | |
| 180 | - $options = array_merge(['headers' => $headers], ['body' => $postable->getPostBodyData()]); |
|
| 180 | + $options = array_merge(['headers' => $headers], ['body' => $postable->getPostBodyData()]); |
|
| 181 | 181 | |
| 182 | 182 | try { |
| 183 | 183 | return $this->guzzleClient->post($url, $options); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | ] |
| 200 | 200 | ); |
| 201 | 201 | |
| 202 | - $options = array_merge(['headers' => $headers], ['body' => $jsonData]); |
|
| 202 | + $options = array_merge(['headers' => $headers], ['body' => $jsonData]); |
|
| 203 | 203 | |
| 204 | 204 | try { |
| 205 | 205 | $this->guzzleClient->put($url, $options); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | ?Money $price, |
| 58 | 58 | ?Money $costPrice, |
| 59 | 59 | float $vatPercentage |
| 60 | - ): self { |
|
| 60 | + ) : self { |
|
| 61 | 61 | return new self( |
| 62 | 62 | Uuid::uuid1(), |
| 63 | 63 | $name, |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | ]; |
| 141 | 141 | |
| 142 | 142 | if ($this->costPrice) { |
| 143 | - $data['costPrice'] =[ |
|
| 143 | + $data['costPrice'] = [ |
|
| 144 | 144 | 'amount' => $this->costPrice->getAmount(), |
| 145 | 145 | 'currencyId' => (string) $this->costPrice->getCurrency(), |
| 146 | 146 | ]; |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | ImageCollection $imageCollection, |
| 64 | 64 | VariantCollection $variants, |
| 65 | 65 | ?string $externalReference = null |
| 66 | - ): self { |
|
| 66 | + ) : self { |
|
| 67 | 67 | return new self( |
| 68 | 68 | Uuid::uuid1(), |
| 69 | 69 | $categories, |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | final class ImageClient |
| 14 | 14 | { |
| 15 | 15 | public const BASE_URL = 'https://image.izettle.com/organizations/%s'; |
| 16 | - public const POST_IMAGE = self::BASE_URL . '/products'; |
|
| 16 | + public const POST_IMAGE = self::BASE_URL.'/products'; |
|
| 17 | 17 | |
| 18 | 18 | private $client; |
| 19 | 19 | private $organizationUuid = 'self'; |
@@ -21,10 +21,10 @@ |
||
| 21 | 21 | { |
| 22 | 22 | public const BASE_URL = 'https://finance.izettle.com/organizations/%s'; |
| 23 | 23 | |
| 24 | - public const GET_ACCOUNT_TRANSACTIONS = self::BASE_URL . '/accounts/%s/transactions'; |
|
| 25 | - public const GET_ACCOUNT_BALANCE = self::BASE_URL . '/accounts/%s/balance'; |
|
| 24 | + public const GET_ACCOUNT_TRANSACTIONS = self::BASE_URL.'/accounts/%s/transactions'; |
|
| 25 | + public const GET_ACCOUNT_BALANCE = self::BASE_URL.'/accounts/%s/balance'; |
|
| 26 | 26 | |
| 27 | - public const GET_PAYOUT_INFO = self::BASE_URL . '/payout-info'; |
|
| 27 | + public const GET_PAYOUT_INFO = self::BASE_URL.'/payout-info'; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * @var IzettleClientInterface |
@@ -24,30 +24,30 @@ |
||
| 24 | 24 | { |
| 25 | 25 | public const BASE_URL = 'https://products.izettle.com/organizations/%s'; |
| 26 | 26 | |
| 27 | - public const POST_CATEGORY = self::BASE_URL . '/categories'; |
|
| 28 | - public const GET_CATEGORY = self::BASE_URL . '/categories/%s'; |
|
| 29 | - public const GET_CATEGORIES = self::BASE_URL . '/categories'; |
|
| 30 | - |
|
| 31 | - public const POST_DISCOUNT = self::BASE_URL . '/discounts'; |
|
| 32 | - public const GET_DISCOUNT = self::BASE_URL . '/discounts/%s'; |
|
| 33 | - public const PUT_DISCOUNT = self::BASE_URL . '/discounts/%s'; |
|
| 34 | - public const DELETE_DISCOUNT = self::BASE_URL . '/discounts/%s'; |
|
| 35 | - public const GET_DISCOUNTS = self::BASE_URL . '/discounts'; |
|
| 36 | - |
|
| 37 | - public const GET_EXPORT = self::BASE_URL . '/products/%s'; |
|
| 38 | - public const GET_EXPORT_TEMPLATE = self::BASE_URL . '/products/%s/template'; |
|
| 39 | - |
|
| 40 | - public const GET_LIBRARY = self::BASE_URL . '/library'; |
|
| 41 | - |
|
| 42 | - public const POST_PRODUCT = self::BASE_URL . '/products'; |
|
| 43 | - public const GET_PRODUCT = self::BASE_URL . '/products/%s'; |
|
| 44 | - public const PUT_PRODUCT = self::BASE_URL . '/products/v2/%s'; |
|
| 45 | - public const DELETE_PRODUCT = self::BASE_URL . '/products/%s'; |
|
| 46 | - public const POST_PRODUCT_VARIANT = self::BASE_URL . '/products/%s/variants'; |
|
| 47 | - public const PUT_PRODUCT_VARIANT = self::BASE_URL . '/products/%s/variants/%s'; |
|
| 48 | - public const DELETE_PRODUCT_VARIANT = self::BASE_URL . '/products/%s/variants/%s'; |
|
| 49 | - public const GET_PRODUCTS = self::BASE_URL . '/products'; |
|
| 50 | - public const DELETE_PRODUCTS = self::BASE_URL . '/products'; |
|
| 27 | + public const POST_CATEGORY = self::BASE_URL.'/categories'; |
|
| 28 | + public const GET_CATEGORY = self::BASE_URL.'/categories/%s'; |
|
| 29 | + public const GET_CATEGORIES = self::BASE_URL.'/categories'; |
|
| 30 | + |
|
| 31 | + public const POST_DISCOUNT = self::BASE_URL.'/discounts'; |
|
| 32 | + public const GET_DISCOUNT = self::BASE_URL.'/discounts/%s'; |
|
| 33 | + public const PUT_DISCOUNT = self::BASE_URL.'/discounts/%s'; |
|
| 34 | + public const DELETE_DISCOUNT = self::BASE_URL.'/discounts/%s'; |
|
| 35 | + public const GET_DISCOUNTS = self::BASE_URL.'/discounts'; |
|
| 36 | + |
|
| 37 | + public const GET_EXPORT = self::BASE_URL.'/products/%s'; |
|
| 38 | + public const GET_EXPORT_TEMPLATE = self::BASE_URL.'/products/%s/template'; |
|
| 39 | + |
|
| 40 | + public const GET_LIBRARY = self::BASE_URL.'/library'; |
|
| 41 | + |
|
| 42 | + public const POST_PRODUCT = self::BASE_URL.'/products'; |
|
| 43 | + public const GET_PRODUCT = self::BASE_URL.'/products/%s'; |
|
| 44 | + public const PUT_PRODUCT = self::BASE_URL.'/products/v2/%s'; |
|
| 45 | + public const DELETE_PRODUCT = self::BASE_URL.'/products/%s'; |
|
| 46 | + public const POST_PRODUCT_VARIANT = self::BASE_URL.'/products/%s/variants'; |
|
| 47 | + public const PUT_PRODUCT_VARIANT = self::BASE_URL.'/products/%s/variants/%s'; |
|
| 48 | + public const DELETE_PRODUCT_VARIANT = self::BASE_URL.'/products/%s/variants/%s'; |
|
| 49 | + public const GET_PRODUCTS = self::BASE_URL.'/products'; |
|
| 50 | + public const DELETE_PRODUCTS = self::BASE_URL.'/products'; |
|
| 51 | 51 | |
| 52 | 52 | private $client; |
| 53 | 53 | private $organizationUuid; |
@@ -68,37 +68,37 @@ |
||
| 68 | 68 | { |
| 69 | 69 | $scope = []; |
| 70 | 70 | if ($this->finance !== null) { |
| 71 | - $scope[] = $this->finance->value . ':' . self::FINANCE; |
|
| 71 | + $scope[] = $this->finance->value.':'.self::FINANCE; |
|
| 72 | 72 | if ($this->finance->value == Rights::WRITE) { |
| 73 | - $scope[] = Rights::READ . ':' . self::FINANCE; |
|
| 73 | + $scope[] = Rights::READ.':'.self::FINANCE; |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | if ($this->purchase !== null) { |
| 78 | - $scope[] = $this->purchase->value . ':' . self::PURCHASE; |
|
| 78 | + $scope[] = $this->purchase->value.':'.self::PURCHASE; |
|
| 79 | 79 | if ($this->purchase->value == Rights::WRITE) { |
| 80 | - $scope[] = Rights::READ . ':' . self::PURCHASE; |
|
| 80 | + $scope[] = Rights::READ.':'.self::PURCHASE; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if ($this->product !== null) { |
| 85 | - $scope[] = $this->product->value . ':' . self::PRODUCT; |
|
| 85 | + $scope[] = $this->product->value.':'.self::PRODUCT; |
|
| 86 | 86 | if ($this->product->value == Rights::WRITE) { |
| 87 | - $scope[] = Rights::READ . ':' . self::PRODUCT; |
|
| 87 | + $scope[] = Rights::READ.':'.self::PRODUCT; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if ($this->inventory !== null) { |
| 92 | - $scope[] = $this->inventory->value . ':' . self::INVENTORY; |
|
| 92 | + $scope[] = $this->inventory->value.':'.self::INVENTORY; |
|
| 93 | 93 | if ($this->inventory->value == Rights::WRITE) { |
| 94 | - $scope[] = Rights::READ . ':' . self::INVENTORY; |
|
| 94 | + $scope[] = Rights::READ.':'.self::INVENTORY; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | if ($this->image !== null) { |
| 99 | - $scope[] = $this->image->value . ':' . self::IMAGE; |
|
| 99 | + $scope[] = $this->image->value.':'.self::IMAGE; |
|
| 100 | 100 | if ($this->image->value == Rights::WRITE) { |
| 101 | - $scope[] = Rights::READ . ':' . self::IMAGE; |
|
| 101 | + $scope[] = Rights::READ.':'.self::IMAGE; |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
@@ -17,8 +17,8 @@ |
||
| 17 | 17 | { |
| 18 | 18 | public const BASE_URL = 'https://purchase.izettle.com'; |
| 19 | 19 | |
| 20 | - public const GET_PURCHASE = self::BASE_URL . '/purchase/v2/%s'; |
|
| 21 | - public const GET_PURCHASES = self::BASE_URL . '/purchases/v2'; |
|
| 20 | + public const GET_PURCHASE = self::BASE_URL.'/purchase/v2/%s'; |
|
| 21 | + public const GET_PURCHASES = self::BASE_URL.'/purchases/v2'; |
|
| 22 | 22 | |
| 23 | 23 | private $client; |
| 24 | 24 | private $purchaseHistoryBuilder; |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | interface IzettleClientInterface |
| 14 | 14 | { |
| 15 | 15 | public const API_BASE_URL = 'https://oauth.zettle.com'; |
| 16 | - public const API_AUTHORIZE_USER_LOGIN_URL = self::API_BASE_URL . '/authorize'; |
|
| 16 | + public const API_AUTHORIZE_USER_LOGIN_URL = self::API_BASE_URL.'/authorize'; |
|
| 17 | 17 | |
| 18 | - public const API_ACCESS_TOKEN_REQUEST_URL = self::API_BASE_URL . '/token'; |
|
| 18 | + public const API_ACCESS_TOKEN_REQUEST_URL = self::API_BASE_URL.'/token'; |
|
| 19 | 19 | public const API_ACCESS_TOKEN_PASSWORD_GRANT = 'password'; |
| 20 | 20 | public const API_ACCESS_TOKEN_CODE_GRANT = 'authorization_code'; |
| 21 | 21 | public const API_ACCESS_ASSERTION_GRANT = 'urn:ietf:params:oauth:grant-type:jwt-bearer'; |
| 22 | - public const API_ACCESS_TOKEN_REFRESH_TOKEN_URL = self::API_BASE_URL . '/token'; |
|
| 22 | + public const API_ACCESS_TOKEN_REFRESH_TOKEN_URL = self::API_BASE_URL.'/token'; |
|
| 23 | 23 | public const API_ACCESS_TOKEN_REFRESH_TOKEN_GRANT = 'refresh_token'; |
| 24 | 24 | |
| 25 | 25 | public function setAccessToken(AccessToken $accessToken): void; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function getAccessTokenFromUserLogin(string $username, string $password): AccessToken; |
| 30 | 30 | |
| 31 | - public function refreshAccessToken(?AccessToken $accessToken = null): AccessToken; |
|
| 31 | + public function refreshAccessToken(?AccessToken $accessToken = null): AccessToken; |
|
| 32 | 32 | |
| 33 | 33 | public function get(string $url, ?array $queryParameters = null): ResponseInterface; |
| 34 | 34 | |