-
Notifications
You must be signed in to change notification settings - Fork 89
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
chore(backend): make toOpenPaymentType sync #1056
chore(backend): make toOpenPaymentType sync #1056
Conversation
@wilsonianb let me know if this feels better than the |
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 I like it.
I bet this would even let us remove some .withGraphFetched['paymentPointer']
s in subresource service queries.
@@ -75,7 +76,11 @@ async function getIncomingPayment( | |||
} | |||
if (!incomingPayment) return ctx.throw(404) | |||
const connection = deps.connectionService.get(incomingPayment) | |||
ctx.body = await incomingPaymentToBody(incomingPayment, connection) | |||
ctx.body = incomingPaymentToBody( |
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.
Could these *toBody
calls be replaced with calling *.toOpenPaymentsType
directly?
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.
🤔
...or we do the *withPaymentPointer
subresource type idea and make *toBody
the limited places where we're doing the *.paymentPointer = ctx.paymentPointer
assignment.
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 I like it.
I bet this would even let us remove some .withGraphFetched['paymentPointer']s in subresource service queries.
It's a little more straightforward than the alternatives, and will indeed allow us to remove the withGraphFetched
calls. I can do that as a separate follow-up PR
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.
toBody
is a little redundant, I agree, but the reason I like toBody
is it just keeps it standard across all of the routes, and if it were ever to change, we'd just need to change a single place.
"*withPaymentPointer subresource type idea"
I'm still not convinced about this idea, since having the non-null assertedpaymentPointer
/having throws or undefined in the model itself might end up having someone call it and open up doors for bugs... thoughts?
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 don't feeling too strongly about toBody
or *withPaymentPointer
.
The latter would let getUrl
be a url
getter but it'd probably only be called within toOpenPaymentType
.
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 guess url
getter would also be used in tests...
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.
👍
if you're wanting to merge this into your OG pr
* feat(open-payments): export the different IncomingPayment types * feat(backend): use open-payment types for IncomingPayment * feat(backend): use open-payment types for Connection * feat(backend): use open-payment types for OutgoingPayment * feat(backend): use open-payment types for Quote * chore(backend): fix IncomingPayments.toOpenPaymentsType * chore(open-payments): update mocks * chore(backend): formatting * chore(backend): add better typing for incomingPayment.toOpenPaymentsType * chore(backend): remove QuoteJSON * chore(open-payments): fix mocks * chore(backend): fix IncomingPayment types * chore(open-payments): fix incoming payment types * chore(backend): fix incoming payment method * chore(backend): make toOpenPaymentsType async * chore(backend): getUrl for OutgoingPayment * chore(backend): fix tests with async toOpenPaymentsType * chore(backend): return undefined instead of null * chore(backend): add awaits where necessary * chore(open-payments): make getBody async * chore(backend): fix outgoingPayment model method * chore(backend): fix list tests * chore(backend): update receiver tests * chore(backend): make toOpenPaymentType sync (#1056) * chore(backend): make toOpenPaymentType sync * chore(backend): make quote.toOpenPaymentsType sync * chore(backend): convert tests to sync * chore(backend): update tests * chore(backend): remove $formatJson where applicable * chore(backend): remove $formatJson where applicable * chore(backend): add test for incomingPayment model * chore(backend): fix incomingPayment model test * chore(open-payments): use suggestion * chore(backend): fix test * chore(backend): use suggestion
* feat(open-payments): export the different IncomingPayment types * feat(backend): use open-payment types for IncomingPayment * feat(backend): use open-payment types for Connection * feat(backend): use open-payment types for OutgoingPayment * feat(backend): use open-payment types for Quote * chore(backend): fix IncomingPayments.toOpenPaymentsType * chore(open-payments): update mocks * chore(backend): formatting * chore(backend): add better typing for incomingPayment.toOpenPaymentsType * chore(backend): remove QuoteJSON * chore(open-payments): fix mocks * chore(backend): fix IncomingPayment types * chore(open-payments): fix incoming payment types * chore(backend): fix incoming payment method * chore(backend): make toOpenPaymentsType async * chore(backend): getUrl for OutgoingPayment * chore(backend): fix tests with async toOpenPaymentsType * chore(backend): return undefined instead of null * chore(backend): add awaits where necessary * chore(open-payments): make getBody async * chore(backend): fix outgoingPayment model method * chore(backend): fix list tests * chore(backend): update receiver tests * chore(backend): make toOpenPaymentType sync (#1056) * chore(backend): make toOpenPaymentType sync * chore(backend): make quote.toOpenPaymentsType sync * chore(backend): convert tests to sync * chore(backend): update tests * chore(open-payments): updating AccessType type & exporting AccessToken * chore(auth): adding toOpenPayments type methods for grants & access & accessTokens * chore(auth): remove unused type * chore(backend): remove $formatJson where applicable * chore(backend): remove $formatJson where applicable * chore(backend): add test for incomingPayment model * chore(auth): await createGrantInitiation functions * chore(open-payments): export AccessItem * chore(auth): update toOpenPaymentsAccess * chore(open-payments): update AccessAction type * chore(backend): fix incomingPayment model test * chore(auth): exclude instead of Omit to give us ctx types * chore(open-payments): use suggestion * chore(backend): fix test * chore(backend): use suggestion * chore(auth): updates types for routes tests * chore(auth): update toOpenPaymentsGrant name * chore(auth): update accessToken tests * chore(auth): address feedback * feat(auth): lock grant when rotating accessToken * chore(auth): add tests for revoked accessToken * chore(auth): remove locking for now
Changes proposed in this pull request
Context
Checklist
fixes #number