Skip to content

Commit a0e5b78

Browse files
committed
chore: optum post dated updates
1 parent 2c2f4dd commit a0e5b78

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

packages/common/commonTypes/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ export interface PSUDataItem {
1111
TerminalStatus: string
1212
ApplicationName: string
1313
ExpiryTime: number
14+
// (Optional, Optum only) Indicates that {@link LastModified} is postdated;
15+
// contains the ISO 8601 timestamp when the postdated update was set.
16+
OptumPostDatedLastModifiedSetAt?: string
1417
}
1518

1619
export interface NotifyDataItem {

packages/updatePrescriptionStatus/src/updatePrescriptionStatus.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ export function buildDataItems(
381381
TaskID: task.id!,
382382
TerminalStatus: task.status,
383383
ApplicationName: applicationName,
384-
ExpiryTime: (Math.floor(+new Date() / 1000) + TTL_DELTA)
384+
ExpiryTime: (Math.floor(+new Date() / 1000) + TTL_DELTA),
385+
OptumPostDatedLastModifiedSetAt: task.meta?.lastUpdated
385386
}
386387

387388
dataItems.push(dataItem)

packages/updatePrescriptionStatus/tests/testUpdatePrescriptionStatus.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,4 +287,22 @@ describe("buildDataItems", () => {
287287

288288
expect(dataItems[0].ExpiryTime).toBeGreaterThan(expectedExpiryTime)
289289
})
290+
291+
it("should include OptumPostDatedLastModifiedSetAt in data item when meta.lastUpdated is defined", () => {
292+
const task = validTask()
293+
const lastUpdated = "2024-01-15T10:30:00.000Z"
294+
task.meta = {
295+
lastUpdated: lastUpdated
296+
}
297+
298+
const requestEntry: BundleEntry = {
299+
resource: task,
300+
fullUrl: ""
301+
}
302+
303+
const dataItems = buildDataItems([requestEntry], "", "")
304+
console.log(dataItems[0])
305+
306+
expect(dataItems[0].OptumPostDatedLastModifiedSetAt).toEqual(lastUpdated)
307+
})
290308
})

0 commit comments

Comments
 (0)