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): support Open Payments connection as receiver #603

Merged
merged 11 commits into from
Sep 23, 2022

Conversation

wilsonianb
Copy link
Contributor

@wilsonianb wilsonianb commented Sep 15, 2022

Changes proposed in this pull request

  • Support quote/outgoing payment to Open Payments connection
  • Include asset details in connection
  • Query receiver via http in development mode

Context

Checklist

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

@github-actions github-actions bot added pkg: backend Changes in the backend package. type: source Changes business logic type: tests Testing related labels Sep 15, 2022
@wilsonianb wilsonianb marked this pull request as ready for review September 15, 2022 20:08
Auth is only required on mocked payment pointer endpoints.
Copy link
Member

@sabineschaller sabineschaller left a comment

Choose a reason for hiding this comment

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

It's late and I had a glass of wine because it's my wedding anniversary. If you need another review, I can look at it first thing tomorrow morning.

}

const CONNECTION_URL_REGEX = /\/connections\/(.){36}$/
const INCOMING_PAYMENT_URL_REGEX = /\/incoming-payments\/(.){36}$/
Copy link
Member

Choose a reason for hiding this comment

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

The id doesn't necessarily have to be a uuid so I'd remove the (.){36} constraint. Maybe just check that it is alpha-numerical?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Interesting 🤔. I'm wondering whether we actually want to enforce that in the spec. It seems to me like more of a business decision.

@@ -255,6 +255,6 @@ export type IncomingPaymentJSON = {
externalRef?: string
createdAt: string
updatedAt: string
expiresAt: string
expiresAt?: string
Copy link
Member

Choose a reason for hiding this comment

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

I thought we had that as required since it is either set to the client's value or the server's default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's correct for Rafiki the Open Payments server.
But Rafiki the client of an arbitrary Open Payments server has to go by the OpenAPI spec in which expiresAt isn't required:
https://github.com/interledger/open-payments/blob/6d128e2298301a3a76d2421581e2ffa097ebf33c/open-api-spec.yaml#L915-L939

@wilsonianb wilsonianb requested review from sabineschaller and removed request for sentientwaffle September 20, 2022 16:52
sabineschaller
sabineschaller previously approved these changes Sep 22, 2022
Comment on lines 32 to 34
if (typeof incomingPayment.ilpStreamConnection !== 'object') {
return undefined
}
Copy link
Member

Choose a reason for hiding this comment

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

nit pick: I'd move that in front of the previous one.

@wilsonianb wilsonianb merged commit 9dea96b into main Sep 23, 2022
@wilsonianb wilsonianb deleted the bw-connections branch September 23, 2022 12:51
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.

Support non-https payment pointers in local dev Support quote/outgoing payment to STREAM connection
2 participants