Skip to content

Small additive DX items: variables(), deadlineAt/acquirer, Shopsystem, memoized callback payment, SDK version in User-Agent - #19

Merged
loevgaard merged 2 commits into
1.xfrom
dx/small-additive
Aug 17, 2026
Merged

Small additive DX items: variables(), deadlineAt/acquirer, Shopsystem, memoized callback payment, SDK version in User-Agent#19
loevgaard merged 2 commits into
1.xfrom
dx/small-additive

Conversation

@loevgaard

Copy link
Copy Markdown
Member

Part of #10 (finding 10).

Five small, independent, additive improvements:

  • Payment::variables(): array — your custom variables with keys and value types exactly as sent. This is deliberately a method reading $raw, not a mapped property: while implementing I verified that Valinor's camelCaseKeys() recurses into nested arrays, so a typed $variables property would silently rename a consumer's internal_ref to internalRef (and mixed values would need allowPermissiveTypes()). The docblock explains this. Live shape verified: {} when empty, value types preserved (int/bool/nested).
  • Payment::$deadlineAt (?\DateTimeImmutable) and Payment::$acquirer (?string) typed — live: ISO-8601 with Z (mapped by the existing formats) / null until authorized. Appended as optional constructor params.
  • CreatePaymentRequest::$shopsystem with a new Shopsystem payload (name/version, shopsystem[name|version] on POST /payments) so a plugin/module can identify itself on the payments it creates (Quickpay shows it as metadata.shopsystem_name/_version).
  • Callback::payment() is memoized — a guard followed by a handler no longer decodes and maps the body twice.
  • User-Agent carries the SDK version: Setono-Quickpay-PHP/1.0.0 (+https://github.com/Setono/quickpay-php-sdk) via Composer\InstalledVersions (Client::version() is public; composer-runtime-api ^2.0 added to require — it's a virtual platform package every Composer 2 install provides).

README: reading variables back after the update example; a Shopsystem tip.

Tests: variables verbatim (snake_case + nested + types) / empty / absent / hand-built; deadline + acquirer mapping and nulls; shopsystem on the wire; memoization; UA format with a known version.

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.08%. Comparing base (862f98e) to head (15f764a).

Additional details and impacted files
@@             Coverage Diff              @@
##                1.x      #19      +/-   ##
============================================
+ Coverage     99.06%   99.08%   +0.01%     
- Complexity      197      203       +6     
============================================
  Files            26       27       +1     
  Lines           535      544       +9     
============================================
+ Hits            530      539       +9     
  Misses            5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…, memoized callback payment, SDK version in User-Agent

- Payment::variables(): array — your custom variables with keys and value
  types exactly as sent. Deliberately a method reading $raw rather than a
  mapped property: Valinor's camelCaseKeys() recurses, so a typed property
  would silently rename internal_ref → internalRef (and mixed values need
  allowPermissiveTypes). Verified the live shape ({} when empty, types
  preserved) before deciding.
- Payment::$deadlineAt (?DateTimeImmutable) and $acquirer (?string) typed
  (live: ISO-8601 with Z / null until authorized).
- CreatePaymentRequest::$shopsystem (new Shopsystem payload: name/version) so
  a plugin can identify itself on the payments it creates.
- Callback::payment() is memoized.
- User-Agent now carries the installed package version
  (Setono-Quickpay-PHP/1.x.y (+url)) via Composer\InstalledVersions;
  Client::version() is public; composer-runtime-api ^2.0 required.
- README: reading variables back, Shopsystem.

Refs #10 (finding 10).
The defensive catch was the only uncovered code in the PR (codecov patch +
project checks). isInstalled() + a single expression keeps the same
behaviour with no unreachable branch.
@loevgaard
loevgaard merged commit 3762a69 into 1.x Aug 17, 2026
36 checks passed
@loevgaard
loevgaard deleted the dx/small-additive branch August 17, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant