Conversation
… a multi-company account
…he address is empty
There was a problem hiding this comment.
Pull request overview
1. What's Good
- Reuses the existing queueing mechanism (
QueueAction::hydrateAction()+QueueRepository::getFirstNotTreatedEntry()), instead of introducing a parallel lock/flag system. - The change is scoped to notification handling and doesn’t touch payment amount/currency logic.
2. Summary table
| Dimension | Rating |
|---|---|
| Security | ✅ Fine |
| Correctness | ❌ High (queue “turn” detection can proceed out of order) |
| Performance | ✅ Fine |
| Maintainability |
3. Closing one-liner
Fix the queue “our turn” detection to use a stable identifier (e.g., resource_id) instead of timestamps, and remove the now-dead $hydrate_time code.
4. Individual findings (one section per issue)
Correctness ❌ High
Incorrect “our turn” detection can break FIFO ordering (classes/PayPlugNotifications.php:652)
// Our entry was created at $hydrate_time or just after.
// If the first untreated entry is that recent, it is ours and it is our turn.
if (isset($first_entry['date_add']) && $first_entry['date_add'] >= $hydrate_time) {
$is_our_turn = true;
break;
}Comparing date_add >= $hydrate_time is not a reliable way to identify “our” queue entry: timestamps are only second-precision and concurrent notifications can insert entries in an unexpected order. This can allow a notification to proceed while an earlier queue entry is still pending, reintroducing the race condition the queue is supposed to prevent.
Fix: compare against a stable identifier for the current notification (e.g., resource_id) when checking the first untreated entry.
// Wait until the first untreated entry is the one for the current notification.
if (isset($first_entry['resource_id']) && (string) $first_entry['resource_id'] === (string) $this->resource->id) {
$is_our_turn = true;
break;
}Maintainability ⚠️ Medium
Unused $hydrate_time after changing the wait strategy (classes/PayPlugNotifications.php:617)
// Record time before creating the entry so we can identify it later in the wait loop
$hydrate_time = date('Y-m-d H:i:s');Once the wait loop uses resource_id (or another stable identifier), $hydrate_time becomes dead code and should be removed to avoid confusion.
Fix: delete the unused assignment/comment.
Maintainability ⚠️ Low
Changelog entry capitalization inconsistency (changelog.md:12)
- [PRE-3394](...): Fix oney orders that remain pending after a successful paymentSurrounding entries use “Oney” capitalized; this one is inconsistent.
Fix: change “oney” → “Oney”.
Changes:
- Add a “wait for our turn” loop when a queue entry already exists during notification processing.
- Update changelog for PRE-3394.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| classes/PayPlugNotifications.php | Adds waiting logic when queue already exists so a notification can proceed after prior processing finishes. |
| changelog.md | Adds PRE-3394 bugfix entry to “Next version”. |
e120a2f to
de27cc0
Compare
e5380c5 to
92f8a84
Compare
Description
PRE-3394: Fix oney orders that remain pending after a successful payment
Related Issue
Ticket: PRE-3394
Type of Change
[x] 🐛 Bug fix
[ ] ✨ New feature
[ ] 💥 Breaking change
[ ] ♻️ Refactor
[ ] 🔧 Configuration / CI
[ ] 🚀 Release (
release/*branch targetingmaster)[ ] 📦 Dependency update
[ ] 🔒 Security fix
[ ] 📝 Documentation update
✅ Quality Checklist
Local Environment & Hooks
(PRE|SMP)-XXXX: descriptionpattern.phpstan.neon/.php-cs-fixer.php) were generated successfully from.disttemplates.Testing & Code Quality
composer cs:fix).vendor/bin/phpstan).CI/CD Deployment Context
release/*branch, I am targeting the correct base branch to allow the automatedapply-releaseversion bumping job to run.Screenshots (if applicable)
Notes for Reviewer