Skip to content
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

feat(backend): SPSPRouteError #2705

Merged
merged 2 commits into from
May 10, 2024
Merged

feat(backend): SPSPRouteError #2705

merged 2 commits into from
May 10, 2024

Conversation

mkurapov
Copy link
Contributor

@mkurapov mkurapov commented May 7, 2024

Changes proposed in this pull request

  • The SPSP middleware & SPSP routes are technically in the Open Payments routes, and as a result, to standardize how we handle all of the logging/error handling in Open Payments, I updated the middleware to throw a new SPSPRouteError instead of directly calling ctx.throw. This is then handled like any error thrown in the Open Payments routes/middleware

Context

Related to #1905

Checklist

  • Related issues linked using fixes #number
  • Tests added/updated
  • Documentation added
  • Make sure that all checks pass
  • Bruno collection updated

@github-actions github-actions bot added type: tests Testing related pkg: backend Changes in the backend package. type: source Changes business logic labels May 7, 2024
Copy link

netlify bot commented May 7, 2024

Deploy Preview for brilliant-pasca-3e80ec ready!

Name Link
🔨 Latest commit a123c69
🔍 Latest deploy log https://app.netlify.com/sites/brilliant-pasca-3e80ec/deploys/663a54bd184d020008da2ffe
😎 Deploy Preview https://deploy-preview-2705--brilliant-pasca-3e80ec.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -24,11 +37,20 @@ const spspMiddleware = async (
): Promise<void> => {
// Fall back to legacy protocols if client doesn't support Open Payments.
if (ctx.accepts('application/spsp4+json')) {
const receiver = ctx.walletAddress ?? ctx.incomingPayment
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctx.incomingPayment was a leftover thing from when we had the "connection" resource in Open Payments. does not apply anymore

const walletAddressService = await ctx.container.use('walletAddressService')

const walletAddress = await walletAddressService.getByUrl(
ctx.walletAddressUrl
Copy link
Contributor Author

@mkurapov mkurapov May 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using ctx.walletAddressUrl instead of ctx.walletAddress as part of a larger refactor to remove the wallet address middleware altogether, see #2708

@mkurapov mkurapov force-pushed the 1905/mk/spsp-errors branch 2 times, most recently from 9edbd82 to 6cf1e7f Compare May 7, 2024 15:44
@mkurapov mkurapov marked this pull request as ready for review May 7, 2024 15:45
@mkurapov mkurapov linked an issue May 8, 2024 that may be closed by this pull request
Copy link
Contributor

@njlie njlie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mkurapov mkurapov merged commit e9b9a86 into main May 10, 2024
42 checks passed
@mkurapov mkurapov deleted the 1905/mk/spsp-errors branch May 10, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: backend Changes in the backend package. type: source Changes business logic type: tests Testing related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standardize Open Payment errors
2 participants