feat(jubilee): add get_preauthorization_status endpoint and Check Status button#1194
Merged
av-dev2 merged 1 commit intoAakvatech-Limited:nurse-ot-modulefrom Apr 28, 2026
Merged
Conversation
…tus button
Implement Jubilee API endpoint 11 (getPreauthorizationStatus) in the
backend and expose a "Get Pre-Auth Status" button on the Jubilee Service
Request form to allow practitioners to check the outcome of a previously
submitted pre-authorization without leaving the document.
api.py — get_preauthorization_status() new whitelisted function:
- Accepts service_request_name, loads the JSR document
- Validates that submission_id is set (throws if missing)
- Validates that the Jubilee API is enabled for the company
- Sends GET /jubileeapi/getPreauthorizationStatus?submissionID=<id>
with Bearer token authorization
- On success response (status != "ERROR"):
- Extracts preauth_status from description.preathorizationStatus
- Extracts preauth_description from description.details
- Persists both values to the JSR document via frappe.db.set_value
so the form reflects the latest status from Jubilee
- Returns {status, description} to the caller
- On API error response (status == "ERROR"):
- Throws the error description directly so the JS onerror/msgprint
handler can display the Jubilee error message to the user
- On exception (timeout, connection error):
- Captures raw response text or fallback message
- Logs via add_jubilee_log with ref_doctype/ref_docname for auditability
- Returns {status: "ERROR", description: <error_text>}
jubilee_service_request.js — form enhancements:
- refresh: now triggers the get_preauth_status event after rendering
the dashboard headline indicator so the button is always re-evaluated
on every form load
- get_preauth_status new event handler:
- Adds a "Get Pre-Auth Status" custom button when the JSR is submitted
(docstatus == 1), has a submission_id, and is not already in ERROR state
- Button click calls get_preauthorization_status via frappe.call with
freeze: true and freeze_message "Checking Pre-Auth Status..." to block
the screen while waiting for the Jubilee API response
- On success: plays success sound, shows frappe.show_alert with the
preauth description, then calls frm.reload_doc() to display the
newly persisted status on the document
- On error: plays error sound, shows red frappe.msgprint with the
error description from Jubilee
- onerror: shows a generic error msgprint for unexpected JS/network failures
- Prettier reformatting of existing string concatenation in refresh handler
(no functional change)
Bug fixes applied before staging:
- Fixed frappe.call method path from hms_tz.hms_tz.jubilee.api.api to
hms_tz.jubilee.api.api (wrong double-prefix)
- Fixed args key from jsr_name to service_request_name to match the
Python function signature
Not up to standards ⛔
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement Jubilee API endpoint 11 (getPreauthorizationStatus) in the backend and expose a "Get Pre-Auth Status" button on the Jubilee Service Request form to allow practitioners to check the outcome of a previously submitted pre-authorization without leaving the document.
api.py — get_preauthorization_status() new whitelisted function:
jubilee_service_request.js — form enhancements:
Bug fixes applied before staging: