diff --git a/extensions/elation/actions/updateReferralOrderResolution/config/fields.ts b/extensions/elation/actions/updateReferralOrderResolution/config/fields.ts index 98d258c5..50085192 100644 --- a/extensions/elation/actions/updateReferralOrderResolution/config/fields.ts +++ b/extensions/elation/actions/updateReferralOrderResolution/config/fields.ts @@ -28,9 +28,20 @@ export const fields = { ), }, }, + resolvingDocument: { + id: 'resolvingDocument', + label: 'Resolving document', + type: FieldType.NUMERIC, + required: true, + description: + 'The ID of the document that resolves the referral order. Can be f.e. a reference to a non-visit note. Required if the resolution state is "fulfilled".', + }, } satisfies Record export const FieldsValidationSchema = z.object({ referralOrderId: NumericIdSchema, resolutionState: ResolutionStateSchema, + // Making it optional as making it required would break the extension for existing workflows + // I'll make it required once we've updated the Suvida flows + resolvingDocument: NumericIdSchema.optional(), } satisfies Record) diff --git a/extensions/elation/actions/updateReferralOrderResolution/updateReferralOrderResolution.test.ts b/extensions/elation/actions/updateReferralOrderResolution/updateReferralOrderResolution.test.ts index 0e65ce0d..9f7520ef 100644 --- a/extensions/elation/actions/updateReferralOrderResolution/updateReferralOrderResolution.test.ts +++ b/extensions/elation/actions/updateReferralOrderResolution/updateReferralOrderResolution.test.ts @@ -91,6 +91,7 @@ describe('Elation - Update referral order resolution', () => { fields: { referralOrderId: 142685415604249, resolutionState: 'fulfilled', + resolvingDocument: 1234567890, }, settings: { client_id: 'clientId', diff --git a/extensions/elation/actions/updateReferralOrderResolution/updateReferralOrderResolution.ts b/extensions/elation/actions/updateReferralOrderResolution/updateReferralOrderResolution.ts index c3480f26..59bc2600 100644 --- a/extensions/elation/actions/updateReferralOrderResolution/updateReferralOrderResolution.ts +++ b/extensions/elation/actions/updateReferralOrderResolution/updateReferralOrderResolution.ts @@ -18,15 +18,15 @@ export const updateReferralOrderResolution: Action< previewable: false, dataPoints, onEvent: async ({ payload, onComplete, onError }): Promise => { - const { referralOrderId, resolutionState } = FieldsValidationSchema.parse( - payload.fields, - ) + const { referralOrderId, resolutionState, resolvingDocument } = + FieldsValidationSchema.parse(payload.fields) const api = makeAPIClient(payload.settings) try { await api.updateReferralOrder(referralOrderId, { resolution: { state: resolutionState, + resolving_document: resolvingDocument, }, }) } catch (error) {