Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/.editorconfig export-ignore
/.env.local.example export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/CLAUDE.md export-ignore
/README.md export-ignore
/UPGRADE.md export-ignore
/composer-dependency-analyser.php export-ignore
/ecs.php export-ignore
/examples export-ignore
/infection.json.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.PHP_EXTENSIONS }}"
coverage: "none"

- name: "Install composer dependencies"
Expand Down Expand Up @@ -71,7 +70,6 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "${{ env.PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"
tools: "composer-dependency-analyser"

Expand Down Expand Up @@ -109,7 +107,6 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.PHP_EXTENSIONS }}"
coverage: "none"

- name: "Install composer dependencies"
Expand Down Expand Up @@ -146,7 +143,6 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.PHP_EXTENSIONS }}"
coverage: "none"

- name: "Install composer dependencies"
Expand Down Expand Up @@ -178,7 +174,6 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
extensions: "${{ env.PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for phpunit/phpunit"
Expand Down Expand Up @@ -219,7 +214,6 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
extensions: "${{ env.PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"

- name: "Install composer dependencies"
Expand Down
2 changes: 1 addition & 1 deletion src/Callback/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* The body is NOT assumed to be a payment: check {@see self::$type} / {@see self::isPayment()} and only
* call {@see self::payment()} when it is a payment. Use {@see self::toArray()} for any resource type.
*
* Instances are produced by {@see CallbackHandler::handle()} / {@see CallbackHandler::handleRequest()}.
* Instances are produced by {@see CallbackHandler::handle()} / {@see CallbackHandler::handleRaw()}.
*/
final class Callback
{
Expand Down Expand Up @@ -73,7 +73,7 @@
try {
$payment = $this->mapperBuilder()->mapper()->map(Payment::class, Source::array($decoded)->camelCaseKeys());
} catch (MappingError $e) {
throw new InvalidCallbackException('The callback body does not match the expected payment shape: ' . $e->getMessage(), 0, $e);

Check warning on line 76 in src/Callback/Callback.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.3, highest)

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ try { $payment = $this->mapperBuilder()->mapper()->map(Payment::class, Source::array($decoded)->camelCaseKeys()); } catch (MappingError $e) { - throw new InvalidCallbackException('The callback body does not match the expected payment shape: ' . $e->getMessage(), 0, $e); + throw new InvalidCallbackException('The callback body does not match the expected payment shape: ' . $e->getMessage(), 1, $e); } $payment->raw = $decoded; return $payment;

Check warning on line 76 in src/Callback/Callback.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.3, highest)

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ try { $payment = $this->mapperBuilder()->mapper()->map(Payment::class, Source::array($decoded)->camelCaseKeys()); } catch (MappingError $e) { - throw new InvalidCallbackException('The callback body does not match the expected payment shape: ' . $e->getMessage(), 0, $e); + throw new InvalidCallbackException('The callback body does not match the expected payment shape: ' . $e->getMessage(), -1, $e); } $payment->raw = $decoded; return $payment;

Check warning on line 76 in src/Callback/Callback.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.3, highest)

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ try { $payment = $this->mapperBuilder()->mapper()->map(Payment::class, Source::array($decoded)->camelCaseKeys()); } catch (MappingError $e) { - throw new InvalidCallbackException('The callback body does not match the expected payment shape: ' . $e->getMessage(), 0, $e); + throw new InvalidCallbackException('The callback body does not match the expected payment shape: ', 0, $e); } $payment->raw = $decoded; return $payment;

Check warning on line 76 in src/Callback/Callback.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.3, highest)

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ try { $payment = $this->mapperBuilder()->mapper()->map(Payment::class, Source::array($decoded)->camelCaseKeys()); } catch (MappingError $e) { - throw new InvalidCallbackException('The callback body does not match the expected payment shape: ' . $e->getMessage(), 0, $e); + throw new InvalidCallbackException($e->getMessage(), 0, $e); } $payment->raw = $decoded; return $payment;

Check warning on line 76 in src/Callback/Callback.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.3, highest)

Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ try { $payment = $this->mapperBuilder()->mapper()->map(Payment::class, Source::array($decoded)->camelCaseKeys()); } catch (MappingError $e) { - throw new InvalidCallbackException('The callback body does not match the expected payment shape: ' . $e->getMessage(), 0, $e); + throw new InvalidCallbackException($e->getMessage() . 'The callback body does not match the expected payment shape: ', 0, $e); } $payment->raw = $decoded; return $payment;
}

$payment->raw = $decoded;
Expand All @@ -94,7 +94,7 @@
/** @var mixed $decoded */
$decoded = json_decode($this->body, true, flags: \JSON_THROW_ON_ERROR);
} catch (\JsonException $e) {
throw new InvalidCallbackException('The callback body is not valid JSON: ' . $e->getMessage(), 0, $e);

Check warning on line 97 in src/Callback/Callback.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.3, highest)

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ /** @var mixed $decoded */ $decoded = json_decode($this->body, true, flags: \JSON_THROW_ON_ERROR); } catch (\JsonException $e) { - throw new InvalidCallbackException('The callback body is not valid JSON: ' . $e->getMessage(), 0, $e); + throw new InvalidCallbackException('The callback body is not valid JSON: ' . $e->getMessage(), 1, $e); } if (!is_array($decoded)) { throw new InvalidCallbackException(sprintf('Expected the callback body to decode to an object but got %s.', get_debug_type($decoded)));

Check warning on line 97 in src/Callback/Callback.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.3, highest)

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ /** @var mixed $decoded */ $decoded = json_decode($this->body, true, flags: \JSON_THROW_ON_ERROR); } catch (\JsonException $e) { - throw new InvalidCallbackException('The callback body is not valid JSON: ' . $e->getMessage(), 0, $e); + throw new InvalidCallbackException('The callback body is not valid JSON: ' . $e->getMessage(), -1, $e); } if (!is_array($decoded)) { throw new InvalidCallbackException(sprintf('Expected the callback body to decode to an object but got %s.', get_debug_type($decoded)));

Check warning on line 97 in src/Callback/Callback.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.3, highest)

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ /** @var mixed $decoded */ $decoded = json_decode($this->body, true, flags: \JSON_THROW_ON_ERROR); } catch (\JsonException $e) { - throw new InvalidCallbackException('The callback body is not valid JSON: ' . $e->getMessage(), 0, $e); + throw new InvalidCallbackException('The callback body is not valid JSON: ', 0, $e); } if (!is_array($decoded)) { throw new InvalidCallbackException(sprintf('Expected the callback body to decode to an object but got %s.', get_debug_type($decoded)));

Check warning on line 97 in src/Callback/Callback.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.3, highest)

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ /** @var mixed $decoded */ $decoded = json_decode($this->body, true, flags: \JSON_THROW_ON_ERROR); } catch (\JsonException $e) { - throw new InvalidCallbackException('The callback body is not valid JSON: ' . $e->getMessage(), 0, $e); + throw new InvalidCallbackException($e->getMessage(), 0, $e); } if (!is_array($decoded)) { throw new InvalidCallbackException(sprintf('Expected the callback body to decode to an object but got %s.', get_debug_type($decoded)));

Check warning on line 97 in src/Callback/Callback.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.3, highest)

Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ /** @var mixed $decoded */ $decoded = json_decode($this->body, true, flags: \JSON_THROW_ON_ERROR); } catch (\JsonException $e) { - throw new InvalidCallbackException('The callback body is not valid JSON: ' . $e->getMessage(), 0, $e); + throw new InvalidCallbackException($e->getMessage() . 'The callback body is not valid JSON: ', 0, $e); } if (!is_array($decoded)) { throw new InvalidCallbackException(sprintf('Expected the callback body to decode to an object but got %s.', get_debug_type($decoded)));
}

if (!is_array($decoded)) {
Expand Down
3 changes: 2 additions & 1 deletion tests/Client/LiveClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public function it_creates_a_payment_and_a_link(): void
$client = $this->liveClient();

$payment = $client->payments()->create(new CreatePaymentRequest(
orderId: 'sdk-probe-' . bin2hex(random_bytes(6)),
// Quickpay limits order_id to 4-20 characters; 'probe-' + 12 hex chars = 18.
orderId: 'probe-' . bin2hex(random_bytes(6)),
currency: 'DKK',
));
self::assertGreaterThan(0, $payment->id);
Expand Down
Loading