Skip to content

Comments

Refactor easy renewals to use new renewals data service#2310

Open
lailien3 wants to merge 5 commits intodevelopfrom
feature/iwtf-4147-refactor-renewals-service
Open

Refactor easy renewals to use new renewals data service#2310
lailien3 wants to merge 5 commits intodevelopfrom
feature/iwtf-4147-refactor-renewals-service

Conversation

@lailien3
Copy link
Contributor

https://eaflood.atlassian.net/browse/IWTF-4147

As part of IWTF-4017, we added a new service to the Sales API that prepares data for renewals. This service will further be enhanced by IWTF-3916

The new service duplicates a lot of the logic we use for easy renewals in the renewals-write-cache.js processor, so we should be able to replace quite a lot of that with a single call to the Sales API instead.

https://eaflood.atlassian.net/browse/IWTF-4147

As part of IWTF-4017: GAFL: Dev – RP job provisions new permissions in DynamoDB
Done
 we added a new service to the Sales API that prepares data for renewals. This service will further be enhanced by IWTF-3916: GAFL: Dev – Permissions created by RP job have correct concessions applied
Done

The new service duplicates a lot of the logic we use for easy renewals in the renewals-write-cache.js processor, so we should be able to replace quite a lot of that with a single call to the Sales API instead.
https://eaflood.atlassian.net/browse/IWTF-4147

As part of IWTF-4017: GAFL: Dev – RP job provisions new permissions in DynamoDB
Done
 we added a new service to the Sales API that prepares data for renewals. This service will further be enhanced by IWTF-3916: GAFL: Dev – Permissions created by RP job have correct concessions applied
Done

The new service duplicates a lot of the logic we use for easy renewals in the renewals-write-cache.js processor, so we should be able to replace quite a lot of that with a single call to the Sales API instead.
@lailien3 lailien3 self-assigned this Feb 16, 2026
@lailien3 lailien3 added the enhancement New feature or request label Feb 16, 2026
permit: permission.expanded.permit.entity.toJSON()
})
return h.response(permissionData)
return h.response({ permission: permissionData })
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not 100% certain about this - I can't see modifications for consumers of this endpoint to access the permission of the returned object. Have you checked that works?

Copy link
Member

@irisfaraway irisfaraway left a comment

Choose a reason for hiding this comment

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

Some minor bits, just to add to Phil's comment.

})

const mockPreparePermissionDataForRenewal = auth =>
salesApi.preparePermissionDataForRenewal.mockResolvedValue({
Copy link
Member

Choose a reason for hiding this comment

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

Could this be a mockResolvedValueOnce?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in this test file, i tried to use mockResolvedValueOnce, but got a few fails - i expect this is becuase preparePermissionDataForRenewal is called many times in the job and mockResolvedValueOnce only stubs the first call, so later calls are undefinied.

Do you think it is ok to keep it as mockResolvedValue in this instance?

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants