@@ -162,10 +162,10 @@ |
||
| 162 | 162 | ?array $body = null) |
| 163 | 163 | { |
| 164 | 164 | $url = sprintf('%s/%s%s%s', |
| 165 | - $this->apiEndpoint, |
|
| 166 | - self::API_VERSION, |
|
| 167 | - $this->composePath($path), |
|
| 168 | - $this->composerQuery($query)); |
|
| 165 | + $this->apiEndpoint, |
|
| 166 | + self::API_VERSION, |
|
| 167 | + $this->composePath($path), |
|
| 168 | + $this->composerQuery($query)); |
|
| 169 | 169 | |
| 170 | 170 | return $this->performHttpCallToFullUrl($httpMethod, $url, $this->composeRequestBody($body)); |
| 171 | 171 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | { |
| 280 | 280 | if ($first) |
| 281 | 281 | { |
| 282 | - $uri .= '?'; |
|
| 282 | + $uri .= '?'; |
|
| 283 | 283 | $first = false; |
| 284 | 284 | } |
| 285 | 285 | else |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | private function parseResponseBody(ResponseInterface $response): ?array |
| 329 | 329 | { |
| 330 | - $body = (string)$response->getBody(); |
|
| 330 | + $body = (string) $response->getBody(); |
|
| 331 | 331 | if (empty($body)) |
| 332 | 332 | { |
| 333 | 333 | if ($response->getStatusCode()===self::HTTP_NO_CONTENT) |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | throw new ClubCollectApiException("Unable to decode ClubCollect response: '{$body}'."); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - if ($response->getStatusCode()>=400) |
|
| 347 | + if ($response->getStatusCode() >= 400) |
|
| 348 | 348 | { |
| 349 | 349 | throw ClubCollectApiException::createFromResponse($response); |
| 350 | 350 | } |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | { |
| 103 | 103 | $list[] = $this->getResourceObject($import); |
| 104 | 104 | } |
| 105 | - } while ($page<($to ?? $result['page']['total_pages'])); |
|
| 105 | + } while ($page < ($to ?? $result['page']['total_pages'])); |
|
| 106 | 106 | |
| 107 | 107 | return $list; |
| 108 | 108 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | { |
| 25 | 25 | /** @var Company $resource */ |
| 26 | 26 | $resource = parent::restRead(['companies', $this->client->getCompanyId()], |
| 27 | - ['api_key' => $this->client->getApiKey()]); |
|
| 27 | + ['api_key' => $this->client->getApiKey()]); |
|
| 28 | 28 | if (!is_a($resource, Company::class)) |
| 29 | 29 | { |
| 30 | 30 | throw new ClubCollectApiException('Expected a Company object, got a %s', get_class($resource)); |
@@ -29,8 +29,8 @@ |
||
| 29 | 29 | { |
| 30 | 30 | /** @var Import $resource */ |
| 31 | 31 | $resource = parent::restPost(['imports'], |
| 32 | - ['api_key' => $this->client->getApiKey()], |
|
| 33 | - ['title' => $title, |
|
| 32 | + ['api_key' => $this->client->getApiKey()], |
|
| 33 | + ['title' => $title, |
|
| 34 | 34 | 'company_id' => $this->client->getCompanyId(), |
| 35 | 35 | 'expected_invoices_count' => $expectedInvoiceCount]); |
| 36 | 36 | if (!is_a($resource, Import::class)) |
@@ -39,31 +39,31 @@ discard block |
||
| 39 | 39 | * @throws ClubCollectApiException |
| 40 | 40 | */ |
| 41 | 41 | public function create(string $importId, |
| 42 | - string $externalInvoiceNumber, |
|
| 42 | + string $externalInvoiceNumber, |
|
| 43 | 43 | ?string $reference, |
| 44 | 44 | ?string $directDebitIban, |
| 45 | 45 | ?string $federationMembershipNumber, |
| 46 | 46 | ?string $clubMembershipNumber, |
| 47 | 47 | ?string $locale, |
| 48 | - array $customerName, |
|
| 49 | - array $customerAddress, |
|
| 50 | - array $customerEmail, |
|
| 51 | - array $customerPhone, |
|
| 52 | - array $invoiceLines, |
|
| 53 | - int $amountTotalCents): Invoice |
|
| 48 | + array $customerName, |
|
| 49 | + array $customerAddress, |
|
| 50 | + array $customerEmail, |
|
| 51 | + array $customerPhone, |
|
| 52 | + array $invoiceLines, |
|
| 53 | + int $amountTotalCents): Invoice |
|
| 54 | 54 | { |
| 55 | 55 | /** @var Invoice $resource */ |
| 56 | 56 | $resource = parent::restPost( |
| 57 | 57 | ['invoices'], |
| 58 | 58 | ['api_key' => $this->client->getApiKey()], |
| 59 | 59 | ['import_id' => $importId, |
| 60 | - 'external_invoice_number' => $externalInvoiceNumber, |
|
| 61 | - 'reference' => $reference, |
|
| 62 | - 'direct_debit_iban' => $directDebitIban, |
|
| 63 | - 'federation_membership_number' => Cast::toOptString($federationMembershipNumber), |
|
| 64 | - 'club_membership_number' => Cast::toOptString($clubMembershipNumber), |
|
| 65 | - 'locale' => $locale, |
|
| 66 | - 'customer' => ['name' => ['prefix' => $customerName['prefix'] ?? null, |
|
| 60 | + 'external_invoice_number' => $externalInvoiceNumber, |
|
| 61 | + 'reference' => $reference, |
|
| 62 | + 'direct_debit_iban' => $directDebitIban, |
|
| 63 | + 'federation_membership_number' => Cast::toOptString($federationMembershipNumber), |
|
| 64 | + 'club_membership_number' => Cast::toOptString($clubMembershipNumber), |
|
| 65 | + 'locale' => $locale, |
|
| 66 | + 'customer' => ['name' => ['prefix' => $customerName['prefix'] ?? null, |
|
| 67 | 67 | 'first_name' => $customerName['first_name'] ?? null, |
| 68 | 68 | 'infix' => $customerName['infix'] ?? null, |
| 69 | 69 | 'last_name' => $customerName['last_name'] ?? null, |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | 'email' => ['email_address' => $customerEmail['email_address'] ?? null], |
| 80 | 80 | 'phone' => ['phone_number' => $customerPhone['phone_number'] ?? null, |
| 81 | 81 | 'country_code' => $customerPhone['country_code'] ?? null]], |
| 82 | - 'invoice_lines' => $this->composeInvoiceLines($invoiceLines), |
|
| 83 | - 'amount_total_cents' => $amountTotalCents]); |
|
| 82 | + 'invoice_lines' => $this->composeInvoiceLines($invoiceLines), |
|
| 83 | + 'amount_total_cents' => $amountTotalCents]); |
|
| 84 | 84 | if (!is_a($resource, Invoice::class)) |
| 85 | 85 | { |
| 86 | 86 | throw new ClubCollectApiException('Expected an Invoice object, got a %s', get_class($resource)); |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | * @throws ClubCollectApiException |
| 104 | 104 | */ |
| 105 | 105 | public function credit(string $invoiceId, |
| 106 | - string $externalInvoiceNumber, |
|
| 107 | - array $invoiceLines, |
|
| 108 | - int $amountTotalCents): Invoice |
|
| 106 | + string $externalInvoiceNumber, |
|
| 107 | + array $invoiceLines, |
|
| 108 | + int $amountTotalCents): Invoice |
|
| 109 | 109 | { |
| 110 | 110 | /** @var Invoice $resource */ |
| 111 | 111 | $resource = parent::restPost(['invoices', $invoiceId, 'credit'], |
| 112 | - ['api_key' => $this->client->getApiKey()], |
|
| 113 | - ['external_invoice_number' => $externalInvoiceNumber, |
|
| 112 | + ['api_key' => $this->client->getApiKey()], |
|
| 113 | + ['external_invoice_number' => $externalInvoiceNumber, |
|
| 114 | 114 | 'invoice_lines' => $this->composeInvoiceLines($invoiceLines), |
| 115 | 115 | 'amount_total_cents' => $amountTotalCents]); |
| 116 | 116 | |
@@ -138,15 +138,15 @@ discard block |
||
| 138 | 138 | * @throws ClubCollectApiException |
| 139 | 139 | */ |
| 140 | 140 | public function creditAndRetract(string $invoiceId, |
| 141 | - string $externalInvoiceNumber, |
|
| 142 | - string $description, |
|
| 141 | + string $externalInvoiceNumber, |
|
| 142 | + string $description, |
|
| 143 | 143 | ?string $retractionReason, |
| 144 | 144 | ?bool $showRetractionReasonToCustomer): Invoice |
| 145 | 145 | { |
| 146 | 146 | /** @var Invoice $resource */ |
| 147 | 147 | $resource = parent::restPost(['invoices', $invoiceId, 'credit_and_retract'], |
| 148 | - ['api_key' => $this->client->getApiKey()], |
|
| 149 | - ['external_invoice_number' => $externalInvoiceNumber, |
|
| 148 | + ['api_key' => $this->client->getApiKey()], |
|
| 149 | + ['external_invoice_number' => $externalInvoiceNumber, |
|
| 150 | 150 | 'description' => $description, |
| 151 | 151 | 'retraction_reason' => $retractionReason, |
| 152 | 152 | 'show_retraction_reason_to_customer' => $showRetractionReasonToCustomer]); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | public function delete(string $invoiceId): void |
| 171 | 171 | { |
| 172 | 172 | parent::restDelete(['invoices', $invoiceId], |
| 173 | - ['api_key' => $this->client->getApiKey()]); |
|
| 173 | + ['api_key' => $this->client->getApiKey()]); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | { |
| 188 | 188 | /** @var Invoice $resource */ |
| 189 | 189 | $resource = parent::restRead(['invoices', $invoiceId], |
| 190 | - ['api_key' => $this->client->getApiKey()]); |
|
| 190 | + ['api_key' => $this->client->getApiKey()]); |
|
| 191 | 191 | if (!is_a($resource, Invoice::class)) |
| 192 | 192 | { |
| 193 | 193 | throw new ClubCollectApiException('Expected an Invoice object, got a %s', get_class($resource)); |
@@ -219,28 +219,28 @@ discard block |
||
| 219 | 219 | * @throws ClubCollectApiException |
| 220 | 220 | */ |
| 221 | 221 | public function update(string $invoiceId, |
| 222 | - string $externalInvoiceNumber, |
|
| 222 | + string $externalInvoiceNumber, |
|
| 223 | 223 | ?string $reference, |
| 224 | 224 | ?string $directDebitIban, |
| 225 | 225 | ?string $federationMembershipNumber, |
| 226 | 226 | ?string $clubMembershipNumber, |
| 227 | 227 | ?string $locale, |
| 228 | - array $customerName, |
|
| 229 | - array $customerAddress, |
|
| 230 | - array $customerEmail, |
|
| 231 | - array $customerPhone): Invoice |
|
| 228 | + array $customerName, |
|
| 229 | + array $customerAddress, |
|
| 230 | + array $customerEmail, |
|
| 231 | + array $customerPhone): Invoice |
|
| 232 | 232 | { |
| 233 | 233 | /** @var Invoice $resource */ |
| 234 | 234 | $resource = parent::restPut( |
| 235 | 235 | ['invoices', $invoiceId], |
| 236 | 236 | ['api_key' => $this->client->getApiKey()], |
| 237 | 237 | ['external_invoice_number' => $externalInvoiceNumber, |
| 238 | - 'reference' => $reference, |
|
| 239 | - 'direct_debit_iban' => $directDebitIban, |
|
| 240 | - 'federation_membership_number' => Cast::toOptString($federationMembershipNumber), |
|
| 241 | - 'club_membership_number' => Cast::toOptString($clubMembershipNumber), |
|
| 242 | - 'locale' => $locale, |
|
| 243 | - 'customer' => ['name' => ['prefix' => $customerName['prefix'] ?? null, |
|
| 238 | + 'reference' => $reference, |
|
| 239 | + 'direct_debit_iban' => $directDebitIban, |
|
| 240 | + 'federation_membership_number' => Cast::toOptString($federationMembershipNumber), |
|
| 241 | + 'club_membership_number' => Cast::toOptString($clubMembershipNumber), |
|
| 242 | + 'locale' => $locale, |
|
| 243 | + 'customer' => ['name' => ['prefix' => $customerName['prefix'] ?? null, |
|
| 244 | 244 | 'first_name' => $customerName['first_name'] ?? null, |
| 245 | 245 | 'infix' => $customerName['infix'] ?? null, |
| 246 | 246 | 'last_name' => $customerName['last_name'] ?? null, |