Skip to content

Commit

Permalink
feat(interaction): return grantId (#2843)
Browse files Browse the repository at this point in the history
* feat(auth): return granId for the grant lookup via interaction id

* test(auth): check grantId is returned for grant lookup via interaction id

* docs(openapi): auth return grantId for grant lookup via interaction id
  • Loading branch information
golobitch authored Aug 7, 2024
1 parent 2c8887d commit 969301c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/auth/src/interaction/routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ describe('Interaction Routes', (): void => {
describe('IDP - Grant details', (): void => {
let grant: Grant
let access: Access
let interaction: Interaction

beforeAll(async (): Promise<void> => {
grant = await Grant.query().insert({
Expand All @@ -539,6 +540,10 @@ describe('Interaction Routes', (): void => {
...BASE_GRANT_ACCESS,
grantId: grant.id
})

interaction = await Interaction.query().insert(
generateBaseInteraction(grant)
)
})

test('Can get grant details', async (): Promise<void> => {
Expand All @@ -558,6 +563,7 @@ describe('Interaction Routes', (): void => {
await expect(interactionRoutes.details(ctx)).resolves.toBeUndefined()
expect(ctx.status).toBe(200)
expect(ctx.body).toEqual({
grantId: grant.id,
access: [
{
actions: access.actions,
Expand Down
1 change: 1 addition & 0 deletions packages/auth/src/interaction/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ async function getGrantDetails(
)

ctx.body = {
grantId: interaction.grant.id,
access: access.map(toOpenPaymentsAccess),
state: interaction.state
}
Expand Down
3 changes: 3 additions & 0 deletions packages/auth/src/openapi/specs/id-provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ paths:
- PENDING
- APPROVED
- DENIED
grantId:
description: Id of a grant
type: string
'401':
description: Unauthorized
'404':
Expand Down

0 comments on commit 969301c

Please sign in to comment.