-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle forwarded "account.updated" webhook #598
Conversation
This logic is required by other parts of the code base, so extracting it out allows it to be shared. The unit tests have been left as is for now, but this also allows for database access to be mocked more easily.
The initial implementation just handles refund updated events and adds an order note in the event of a failure.
This rule is generating some false positives. We can try turning it on again if it gets fixed in a later PHPCS version. Alternatively we could start relying on a static code analyser for more robust checks on how we're using exceptions.
array( | ||
'methods' => WP_REST_Server::CREATABLE, | ||
'callback' => array( $this, 'handle_webhook' ), | ||
'permission_callback' => array( $this, 'check_permission' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check_permission will be interesting. How will you do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to #411 (comment), the existing check should be enough because it will log in the connection owner via the signature in the request (see also paJDYF-wq-p2).
Looks like you're including a refactor to make it more unit testable too? That's awesome, but if this PR gets much larger let's do that as a separate PR |
831c326
to
d3e0817
Compare
1d1ee4d
to
e2fcaff
Compare
Replaced with #612 |
Fixes #512
Based on webhooks forwarding introduced in #411
Changes proposed in this Pull Request
Questions:
Testing instructions
Run unit tests with
./vendor/bin/phpunit
.Setup testing environment:
Testing steps:
account.updated
webhook is logged.