@@ -53,7 +53,7 @@ |
||
| 53 | 53 | return $this->parseVippsPayment($payment, $currency); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - throw new PaymentTypeNotConfiguredException('Payment type \'' . $payment['type'] . '\' not configured'); |
|
| 56 | + throw new PaymentTypeNotConfiguredException('Payment type \''.$payment['type'].'\' not configured'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | private function parseCardPayment($payment, Currency $currency): CardPayment |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | public function buildFromJson(string $jsonData): PurchaseHistory |
| 20 | 20 | { |
| 21 | - $data = json_decode($jsonData, true); |
|
| 21 | + $data = json_decode($jsonData, true); |
|
| 22 | 22 | |
| 23 | 23 | return new PurchaseHistory( |
| 24 | 24 | $data['firstPurchaseHash'], |
@@ -68,37 +68,37 @@ |
||
| 68 | 68 | { |
| 69 | 69 | $scope = []; |
| 70 | 70 | if ($this->finance !== null) { |
| 71 | - $scope[] = $this->finance->getValue() . ':' . self::FINANCE; |
|
| 71 | + $scope[] = $this->finance->getValue().':'.self::FINANCE; |
|
| 72 | 72 | if ($this->finance->getValue() == 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->getValue() . ':' . self::PURCHASE; |
|
| 78 | + $scope[] = $this->purchase->getValue().':'.self::PURCHASE; |
|
| 79 | 79 | if ($this->purchase->getValue() == 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->getValue() . ':' . self::PRODUCT; |
|
| 85 | + $scope[] = $this->product->getValue().':'.self::PRODUCT; |
|
| 86 | 86 | if ($this->product->getValue() == 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->getValue() . ':' . self::INVENTORY; |
|
| 92 | + $scope[] = $this->inventory->getValue().':'.self::INVENTORY; |
|
| 93 | 93 | if ($this->inventory->getValue() == 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->getValue() . ':' . self::IMAGE; |
|
| 99 | + $scope[] = $this->image->getValue().':'.self::IMAGE; |
|
| 100 | 100 | if ($this->image->getValue() == Rights::WRITE) { |
| 101 | - $scope[] = Rights::READ . ':' . self::IMAGE; |
|
| 101 | + $scope[] = Rights::READ.':'.self::IMAGE; |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
@@ -68,13 +68,13 @@ |
||
| 68 | 68 | public function getAccessTokenFromAuthorizedCode(string $redirectUrl, string $code): AccessToken |
| 69 | 69 | { |
| 70 | 70 | $options = [ |
| 71 | - 'form_params' => [ |
|
| 72 | - 'grant_type' => self::API_ACCESS_TOKEN_CODE_GRANT, |
|
| 73 | - 'client_id' => $this->clientId, |
|
| 74 | - 'client_secret' => $this->clientSecret, |
|
| 75 | - 'redirect_uri' => $redirectUrl, |
|
| 76 | - 'code' => $code |
|
| 77 | - ], |
|
| 71 | + 'form_params' => [ |
|
| 72 | + 'grant_type' => self::API_ACCESS_TOKEN_CODE_GRANT, |
|
| 73 | + 'client_id' => $this->clientId, |
|
| 74 | + 'client_secret' => $this->clientSecret, |
|
| 75 | + 'redirect_uri' => $redirectUrl, |
|
| 76 | + 'code' => $code |
|
| 77 | + ], |
|
| 78 | 78 | ]; |
| 79 | 79 | |
| 80 | 80 | 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 = $accessToken ?? $this->accessToken; |
| 134 | 134 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $this->getAuthorizationHeader(), |
| 158 | 158 | $customHeaders |
| 159 | 159 | ); |
| 160 | - $options = array_merge(['headers' => $headers], ['query' => $queryParameters]); |
|
| 160 | + $options = array_merge(['headers' => $headers], ['query' => $queryParameters]); |
|
| 161 | 161 | |
| 162 | 162 | try { |
| 163 | 163 | $response = $this->guzzleClient->get($url, $options); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $customHeaders |
| 183 | 183 | ); |
| 184 | 184 | |
| 185 | - $options = array_merge(['headers' => $headers], ['body' => $postable->getPostBodyData()]); |
|
| 185 | + $options = array_merge(['headers' => $headers], ['body' => $postable->getPostBodyData()]); |
|
| 186 | 186 | |
| 187 | 187 | try { |
| 188 | 188 | return $this->guzzleClient->post($url, $options); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $customHeaders |
| 206 | 206 | ); |
| 207 | 207 | |
| 208 | - $options = array_merge(['headers' => $headers], ['body' => $jsonData]); |
|
| 208 | + $options = array_merge(['headers' => $headers], ['body' => $jsonData]); |
|
| 209 | 209 | |
| 210 | 210 | try { |
| 211 | 211 | $this->guzzleClient->put($url, $options); |
@@ -11,13 +11,13 @@ discard block |
||
| 11 | 11 | interface IzettleClientInterface |
| 12 | 12 | { |
| 13 | 13 | const API_BASE_URL = 'https://oauth.izettle.net'; |
| 14 | - const API_AUTHORIZE_USER_LOGIN_URL = self::API_BASE_URL . '/authorize'; |
|
| 14 | + const API_AUTHORIZE_USER_LOGIN_URL = self::API_BASE_URL.'/authorize'; |
|
| 15 | 15 | |
| 16 | - const API_ACCESS_TOKEN_REQUEST_URL = self::API_BASE_URL . '/token'; |
|
| 16 | + const API_ACCESS_TOKEN_REQUEST_URL = self::API_BASE_URL.'/token'; |
|
| 17 | 17 | const API_ACCESS_TOKEN_PASSWORD_GRANT = 'password'; |
| 18 | 18 | const API_ACCESS_TOKEN_CODE_GRANT = 'authorization_code'; |
| 19 | 19 | const API_ACCESS_ASSERTION_GRANT = 'urn:ietf:params:oauth:grant-type:jwt-bearer'; |
| 20 | - const API_ACCESS_TOKEN_REFRESH_TOKEN_URL = self::API_BASE_URL . '/token'; |
|
| 20 | + const API_ACCESS_TOKEN_REFRESH_TOKEN_URL = self::API_BASE_URL.'/token'; |
|
| 21 | 21 | const API_ACCESS_TOKEN_REFRESH_TOKEN_GRANT = 'refresh_token'; |
| 22 | 22 | |
| 23 | 23 | public function setAccessToken(AccessToken $accessToken): void; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function getAccessTokenFromUserLogin(string $username, string $password): AccessToken; |
| 28 | 28 | |
| 29 | - public function refreshAccessToken(?AccessToken $accessToken = null): AccessToken; |
|
| 29 | + public function refreshAccessToken(?AccessToken $accessToken = null): AccessToken; |
|
| 30 | 30 | |
| 31 | 31 | public function get(string $url, ?array $queryParameters = null): ResponseInterface; |
| 32 | 32 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | ?Money $price = null, |
| 58 | 58 | ?Money $costPrice = null, |
| 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 | ]; |