-
Notifications
You must be signed in to change notification settings - Fork 105
feat(backend): add middleware that handles STREAM KYC/additional data frames #3706
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for brilliant-pasca-3e80ec ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
packages/backend/src/payment-method/ilp/connector/core/middleware/kyc-decision.ts
Outdated
Show resolved
Hide resolved
mkurapov
left a comment
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.
Only focused on the kyc decision middleware here
|
|
||
| const readDecision = async (): Promise<string | undefined> => { | ||
| try { | ||
| const value = await redis.get(cacheKey) |
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.
We have a poll utility function for this in utils.ts
|
|
||
| const incomingPaymentId = ctx.state.streamDestination | ||
| const connectionId = ctx.state.connectionId ?? 'unknown' | ||
| const cacheKey = `kyc_decision:${incomingPaymentId}:${connectionId}` |
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.
I think we should incorporate the polling inside the existing incoming payment service that will handle the logic for this. That is where we can also put the code to actually confirm or reject the partial incoming payment.
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.
I think the incoming payment service is fine for this one.
| } | ||
|
|
||
| const incomingPaymentId = ctx.state.streamDestination | ||
| const connectionId = ctx.state.connectionId ?? 'unknown' |
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.
Let's generate our own UUID partialIncomingPaymentId
| import { ILPContext, ILPMiddleware } from '../rafiki' | ||
| import { StreamState } from './stream-address' | ||
|
|
||
| export function createKycDecisionMiddleware(): ILPMiddleware { |
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.
I think we should not have any references to "kyc" in this code change, but simply partialPaymentDecisionMiddleware or something
Changes proposed in this pull request
Context
Closes #RAF-1185
Checklist
fixes #numberuser-docslabel (if necessary)