To finalize the standardization of Open Payments route errors in backend, this PR removes walletAddressMiddleware.
The benefits:
We now handle all possible errors properly in the openPaymentsServerErrorMiddleware (i.e. we don't use ctx.throw at all in other places)
walletAddressUrl is determined as an inline-middleware per route, meaning the complex logic walletAddressMiddleware can be removed
We don't need to fetch the walletAddress until each route needs it. This is nice for a few reasons:
we can control whether a route will poll (or not) the wallet address creation at the ASE (i.e. we can choose whether a route will call walletAddressService.getOrPollByUrl or just getByUrl)
we can eliminate a request to get the wallet address before other checks are ran (like token introspection, http signature middleware, Open Api validation, etc)
Changes proposed in this pull request
To finalize the standardization of Open Payments route errors in
backend
, this PR removeswalletAddressMiddleware
. The benefits:openPaymentsServerErrorMiddleware
(i.e. we don't usectx.throw
at all in other places)walletAddressUrl
is determined as an inline-middleware per route, meaning the complex logicwalletAddressMiddleware
can be removedwalletAddressService.getOrPollByUrl
or justgetByUrl
)Context
Completion of
backend
changes for #1905Checklist
fixes #number