fix: honor cash drawer setting for cloud print jobs#1171
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: wcpos/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds server-side cash drawer auto-open support for order-based cloud print jobs. Drawer options ( ChangesCash Drawer Auto-Open for Cloud Printing
Sequence Diagram(s)sequenceDiagram
participant POS_Client
participant Print_Jobs_Controller
participant Cloud_Print_Trigger_Service
participant Print_Job_Service
participant Thermal_Renderer
participant Cloud_Print_Submit_Service
participant PrintNode_Client
POS_Client->>Print_Jobs_Controller: POST /print-jobs {autoOpenDrawer, drawerConnector}
Print_Jobs_Controller->>Print_Jobs_Controller: drawer_options_from_request()
Print_Jobs_Controller->>Cloud_Print_Trigger_Service: enqueue_order_job(..., drawer_options)
Cloud_Print_Trigger_Service->>Cloud_Print_Trigger_Service: drawer_options_for_provider(provider)
Cloud_Print_Trigger_Service->>Print_Job_Service: create(job with auto_open_drawer, drawer_connector)
rect rgba(100, 149, 237, 0.5)
Note over Print_Job_Service,Thermal_Renderer: Thermal render path (Epson SDP / PrintNode ESC/POS)
Print_Job_Service->>Print_Job_Service: drawer_render_options(job)
Print_Job_Service->>Thermal_Renderer: render(template, order, format, options)
Thermal_Renderer->>Thermal_Renderer: nodes_with_auto_drawer → inject pulse before cut
end
rect rgba(144, 238, 144, 0.5)
Note over Cloud_Print_Submit_Service,PrintNode_Client: PrintNode PDF drawer-kick path
Cloud_Print_Submit_Service->>PrintNode_Client: submit_job(PDF)
Cloud_Print_Submit_Service->>PrintNode_Client: submit_job(raw_base64 ESC/POS kick)
PrintNode_Client-->>Cloud_Print_Submit_Service: kick result (success or WP_Error)
Cloud_Print_Submit_Service->>Print_Job_Service: mark PRINTED (+ optional META_DRAWER_ERROR)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
E2E API Test Results35 tests 35 ✅ 3s ⏱️ Results for commit c1e5474. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@includes/Services/Cloud_Print_Trigger_Service.php`:
- Around line 160-161: Remove the unnecessary null coalescing operator `??
'pin2'` from the `drawer_connector` assignment in the
Print_Job_Service::normalize_drawer_connector() call. Since
drawer_options_for_provider() already guarantees a non-null drawer_connector
string value, the fallback is unreachable and causes PHPStan static analysis
failures. Apply this fix at both locations where this pattern appears (lines 161
and 184) to simplify the assignment and clear the analysis failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: wcpos/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: fcfe8334-1406-4a2d-8ad8-55f36b2893c6
📒 Files selected for processing (13)
docs/cloud-printing-cash-drawer.mdincludes/API/Print_Jobs_Controller.phpincludes/Services/Cloud_Print_Submit_Service.phpincludes/Services/Cloud_Print_Trigger_Service.phpincludes/Services/Print_Job_Service.phpincludes/Templates/Thermal/Epos_Xml_Thermal_Emitter.phpincludes/Templates/Thermal/Escpos_Thermal_Emitter.phpincludes/Templates/Thermal/Thermal_Renderer.phptests/includes/API/Print_Jobs_Controller_Test.phptests/includes/Services/Cloud_Print_Submit_Service_Test.phptests/includes/Services/Print_Job_Service_Render_Test.phptests/includes/Templates/Thermal/Epos_Xml_Thermal_Emitter_Test.phptests/includes/Templates/Thermal/Escpos_Thermal_Emitter_Test.php
|
Post-fix triage for dispatch round 2. Remaining unresolved inline review threads after push: 0.
Excluded threads: none. Validation:
|
Summary
autoOpenDrawer/drawerConnectoron manual order-based cloud print jobs.<drawer/>.raw_base64drawer-kick job so a drawer failure does not duplicate the receipt.Design decisions (preserve through rebases)
<drawer/>defaults to pin2 /drawer_1— matches the client-side default pulse behavior; only the auto-injected pulse honors the jobdrawer_connector.Companion PRs / cross-repo
autoOpenDrawer/drawerConnectoron order-based cloud print requests before this is verifiable end-to-end in production.Test plan
vendor/bin/phpunit -c .phpunit.xml.dist tests/includes/Templates/Thermal/Epos_Xml_Thermal_Emitter_Test.php tests/includes/Templates/Thermal/Escpos_Thermal_Emitter_Test.php tests/includes/Services/Print_Job_Service_Render_Test.php tests/includes/API/Print_Jobs_Controller_Test.php tests/includes/Services/Cloud_Print_Submit_Service_Test.php— OK, 11 tests / 53 assertions.vendor/bin/phpunit -c .phpunit.xml.dist --verbose --log-junit phpunit.xml— OK, 1477 tests / 6398 assertions, with 6 skipped and 1 incomplete pre-existing documentary test.composer run lint— OK, 155 files.pnpm run lintchecked — repository has nolintscript; usedcomposer run lintas the project PHP lint command.Known blockers
autoOpenDrawer/drawerConnectorfor order-based cloud print requests (tracked in Cash drawer auto-open: harden across printer languages, connectors, and transports monorepo#601).🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Documentation
Tests