Repository navigation
feat(api-logs): log writes to the public invoice routes like the public API - #34
Merged
Merged
Conversation
…ic API The customer invoice routes (ledger/public/...) ran no middleware, so paying an invoice was never written to the API request logs. They now run LogApiRequests. The public wallet API (ledger/v1/...) already runs it through fleetbase.api and is logged once core-api logs every route that opts in (fleetbase/core-api#302). Webhooks and internal routes stay unlogged. The route registrar test stub now records each route's group middleware.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ledger's client-facing requests weren't written to
api_request_logs.ledger/v1/wallet/..., API key auth): already runs core'sfleetbase.apigroup, which includesLogApiRequests. Core skipped it because it only loggedv1/...URIs. fix(api-logs): log every route that opts in to LogApiRequests and let extensions relate ids core-api#302 fixes that for every route that runs the middleware, so this needs no ledger change.ledger/public/invoices/..., no auth): ran no middleware at all, so paying an invoice was never logged. They now runLogApiRequests.Not logged, on purpose:
ledger/webhooks/{driver}): inbound gateway callbacks, not client requests.ledger/int/v1/...): console traffic. Core skips any route with anintsegment.As everywhere,
LogApiRequestslogs only writes (POST, PUT, PATCH, DELETE), so on the invoice routes that meansPOST invoices/{public_id}/pay.Change
server/src/routes.php: the public invoice group runsFleetbase\Http\Middleware\LogApiRequests.scripts/pest-bootstrap.php: theRouteRegistrartest stub records each route's group middleware as a fourth element of the route tuple.RELEASE.md: a bug-fix entry and an upgrade note that this takes effect with core-api#302.Compatibility
v1/...URIs there.company_uuid. They show up in the database but not in a company's console log view. The invoice public id is in the loggedpath.Tests
server/tests/Routes/RouteRegistrationTest.phpadds a test of which middleware each route group runs:fleetbase.apiLogApiRequestsfleetbase.protectedIt fails without the routes change. The route tests pass, and php-cs-fixer (repo config) reports nothing to fix.
Locally, the full suite has 7 failing invoice-settings tests. They fail the same way on
release/v0.0.13without this change, because of this machine's out-of-dateserver_vendor.