Skip to content

Model how an operation's callback was answered on Operation - #33

Merged
loevgaard merged 2 commits into
1.xfrom
operation-callback-fields
Nov 17, 2026
Merged

loevgaard merged 2 commits into
1.xfrom
operation-callback-fields

Conversation

@loevgaard

Copy link
Copy Markdown
Member

Summary

Quickpay records on every operation how its callback was answered. Only callback_url was typed, so consumers read the rest from the payment's $raw['operations'] (SyliusQuickpayPlugin#135 does, to show each operation's callback outcome in the admin).

 final class Operation
 {
     public function __construct(
         ...
         public readonly ?string $callbackUrl = null,
         public readonly ?\DateTimeImmutable $createdAt = null,
+        public readonly ?bool $callbackSuccess = null,                // Quickpay's judgment of the answer
+        public readonly ?string $callbackResponseCode = null,         // e.g. "204"; null when no answer came
+        public readonly ?\DateTimeImmutable $callbackAt = null,       // when it was sent
+        public readonly ?int $callbackDuration = null,                // ms; null when unreachable
     ) {

All four are null until the callback was sent. README (Reading what happened to a payment) and the changelog say so.

Evidence

Types as the live API returns them, from the test account's 40 latest payments:

callback_success callback_response_code callback_at callback_duration seen
true "204" "2026-11-16T11:23:57Z" 804 33
false "404" "2026-11-03T13:01:38Z" 51 7
false null (unreachable) "2026-11-17T09:26:57Z" null 5
null null null null 14

A timed-out callback reports callback_duration: 30002 with no response code (quickpay-dotnet-client#22), hence ?int.

  • Before: PaymentsEndpointTest::it_maps_nested_link_operations_and_metadata asserting operations[0]->callbackSuccess === true fails: the property doesn't exist.
    After: it passes for an answered callback (true, "200", time, 804) and an unanswered one (false, null, time, null); the payment.json fixture carries both shapes. Full suite, PHPStan, ECS and Rector green.

Merge Danger

Door: two-way until released, one-way after

Once tagged, removing a property is a BC break.

Blast Radius: mapping

Valinor maps a payment strictly, so a nested field typed wrong fails every payment read, not just this field. The types match 59 live operations of all four shapes; a value of another type from Quickpay (say a float duration) would break getById() and callbacks' payment().

Quickpay records on every operation how its callback was answered:
callback_success, callback_response_code, callback_at and callback_duration.
Only callback_url was typed, so consumers read the rest from the payment's raw
operations. The types are the ones the live API returns (verified against the
test account's payments); the new constructor parameters come last.
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.17%. Comparing base (c31f9ad) to head (7e365f4).

Additional details and impacted files
@@            Coverage Diff            @@
##                1.x      #33   +/-   ##
=========================================
  Coverage     99.17%   99.17%           
  Complexity      230      230           
=========================================
  Files            28       28           
  Lines           605      605           
=========================================
  Hits            600      600           
  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.

@loevgaard
loevgaard merged commit 7489915 into 1.x Nov 17, 2026
36 checks passed
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