Skip to content

New: [AEA-6543] - Create a new $release-unattended endpoint#705

Open
wildjames wants to merge 2 commits intomainfrom
aea-6543-new-unattended-endpoint
Open

New: [AEA-6543] - Create a new $release-unattended endpoint#705
wildjames wants to merge 2 commits intomainfrom
aea-6543-new-unattended-endpoint

Conversation

@wildjames
Copy link
Copy Markdown
Contributor

Summary

  • ✨ New Feature

Details

The $release endpoint should only accept user-restricted requests, and a new endpoint $release-unattended should take application-restricted endpoints. The latter should omit the practitioner role resource.

Copilot AI review requested due to automatic review settings April 2, 2026 10:24
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

This PR is linked to a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket:

AEA-6543

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for a new $release-unattended dispensing endpoint intended for application-restricted (JWT/client-credentials) access, while tightening $release to user-restricted requests and making practitioner role inclusion configurable in the release request payload.

Changes:

  • Updated release request builder to optionally omit the PractitionerRole (“agent”) entry.
  • Added new API method helpers and step definitions for $release-unattended and for negative $release/$release-unattended cases.
  • Expanded dispensing feature coverage with scenarios asserting allowed/forbidden/bad-request behaviour for both endpoints.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
methods/api/eps_api_methods.py Adds helpers for $release-unattended and practitioner-role toggling on $release.
messages/eps_fhir/release.py Makes PractitionerRole inclusion optional in the generated Parameters payload.
features/steps/eps_api_steps.py Wires new Behave steps to the new release helpers.
features/eps_fhir_dispensing/dispense_prescriptions.feature Adds scenarios covering auth-mode and practitioner-role constraints for $release and $release-unattended.

Comment on lines +90 to +95
def release_prescription_unattended(context):
url = f"{DISPENSING_BASE_URL}/FHIR/R4/Task/$release-unattended"
headers = get_headers(context, context.auth_method)

context.release_body = Release(context, include_practitioner_role=False).body
post(data=context.release_body, url=url, context=context, headers=headers)
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

release_prescription_unattended() builds headers via get_headers(context, context.auth_method) only, so when this step is used with user‑restricted auth (see feature scenario using EPS-FHIR-DISPENSING), the request will be missing the NHSD-Session-URID header that all the other dispensing Task operations in this module include (e.g. release_signed_prescription, return_prescription, withdraw_dispense_notification). This can cause the call to fail as a malformed request (or different status) rather than exercising the intended “forbidden because wrong auth type” behaviour.

Consider splitting the unattended release helpers (or adding a flag) so the user‑restricted variant includes NHSD-Session-URID, while the application‑restricted/JWT variant omits it, and update the corresponding step/scenario to use the appropriate helper.

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 2, 2026

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants