diff --git a/src/templates/generate-ehr-acknowledgement.js b/src/templates/generate-ehr-acknowledgement.js index a97c91d..dd5abaf 100644 --- a/src/templates/generate-ehr-acknowledgement.js +++ b/src/templates/generate-ehr-acknowledgement.js @@ -15,56 +15,56 @@ export const buildEhrAcknowledgementPayload = ({ logInfo('Building positive acknowledgement message with typeCode: AA'); return positiveAckMessageTemplate({ - acknowledgementMessageId: acknowledgementMessageId.toUpperCase(), - timestamp: dateFormat(Date.now(), 'yyyymmddHHMMss'), - acknowledgementTypeCode: 'AA', // positive ACK - acknowledgedMessageId: acknowledgedMessageId.toUpperCase(), - receivingAsid, - sendingAsid - }); + acknowledgementMessageId: acknowledgementMessageId.toUpperCase(), + timestamp: dateFormat(Date.now(), 'yyyymmddHHMMss'), + acknowledgementTypeCode: 'AA', // positive ACK + acknowledgedMessageId: acknowledgedMessageId.toUpperCase(), + receivingAsid, + sendingAsid + }); case '30': // negative ACK, unknown failure reason case '99': // negative ACK, unknown failure reason logInfo( `Building negative acknowledgement message with typeCode: AE, errorCode: ${errorCode} and errorDisplayName: ${errorDisplayName}` ); - + return negativeAckMessageTemplate({ - acknowledgementMessageId: acknowledgementMessageId.toUpperCase(), - timestamp: dateFormat(Date.now(), 'yyyymmddHHMMss'), - acknowledgementTypeCode: 'AE', // negative ACK, unknown failure reason - acknowledgedMessageId: acknowledgedMessageId.toUpperCase(), - receivingAsid, - sendingAsid, - errorCode, - errorDisplayName + acknowledgementMessageId: acknowledgementMessageId.toUpperCase(), + timestamp: dateFormat(Date.now(), 'yyyymmddHHMMss'), + acknowledgementTypeCode: 'AE', // negative ACK, unknown failure reason + acknowledgedMessageId: acknowledgedMessageId.toUpperCase(), + receivingAsid, + sendingAsid, + errorCode, + errorDisplayName }); default: // negative ACK, known failure reason logInfo( `Building negative acknowledgement message with typeCode: AR and errorCode: ${errorCode} and errorDisplayName: ${errorDisplayName}` ); - + return negativeAckMessageTemplate({ - acknowledgementMessageId: acknowledgementMessageId.toUpperCase(), - timestamp: dateFormat(Date.now(), 'yyyymmddHHMMss'), - acknowledgementTypeCode: 'AR', // negative ACK, known failure reason - acknowledgedMessageId: acknowledgedMessageId.toUpperCase(), - receivingAsid, - sendingAsid, - errorCode, - errorDisplayName + acknowledgementMessageId: acknowledgementMessageId.toUpperCase(), + timestamp: dateFormat(Date.now(), 'yyyymmddHHMMss'), + acknowledgementTypeCode: 'AR', // negative ACK, known failure reason + acknowledgedMessageId: acknowledgedMessageId.toUpperCase(), + receivingAsid, + sendingAsid, + errorCode, + errorDisplayName }); } }; const positiveAckMessageTemplate = ({ - acknowledgementMessageId, - timestamp, - acknowledgementTypeCode, - acknowledgedMessageId, - receivingAsid, - sendingAsid, - }) => - ` + acknowledgementMessageId, + timestamp, + acknowledgementTypeCode, + acknowledgedMessageId, + receivingAsid, + sendingAsid +}) => + ` @@ -98,17 +98,17 @@ const positiveAckMessageTemplate = ({ `; - const negativeAckMessageTemplate = ({ - acknowledgementMessageId, - timestamp, - acknowledgementTypeCode, - acknowledgedMessageId, - receivingAsid, - sendingAsid, - errorCode, // not in a positive ack - errorDisplayName // not in a positive ack - }) => - ` +const negativeAckMessageTemplate = ({ + acknowledgementMessageId, + timestamp, + acknowledgementTypeCode, + acknowledgedMessageId, + receivingAsid, + sendingAsid, + errorCode, // not in a positive ack + errorDisplayName // not in a positive ack +}) => + ` @@ -152,4 +152,4 @@ const positiveAckMessageTemplate = ({ - `; \ No newline at end of file + `;