diff --git a/src/store/index.js b/src/store/index.js index 978dc68a..805a974b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1617,12 +1617,15 @@ export const useMainStore = defineStore({ } }); }, - async loadSession(duplicate) { - const { order } = this; + async loadSession(duplicate) { + const { applicationUser, order } = this; + // NOTE: We are re-using the current user's saved session id (this is required on the load-session call). + // This should be ok, but should probably validate. const response = await globalMethods.callHttpClient({ method: endpoints.LoadSession.method, endpoint: endpoints.LoadSession.url, payload: { + savedSessionId: applicationUser.savedSessionId, referralNumber: duplicate.referralNumber, referralDate: duplicate.referralDate, parentAccountNumber: order.parentAccountNumber, diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 8cf40ee3..0fc1ddd0 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -2236,12 +2236,14 @@ describe('Store', () => { describe('loadSession method', () => { let mockDuplicate; let mockResponse; + let savedSessionId = getRandomGuid(); beforeEach(() => { mockDuplicate = { referralNumber: getRandomString(10, 10), referralDate: new Date().toISOString(), - correlationId: getRandomGuid() + correlationId: getRandomGuid(), + savedSessionId: savedSessionId }; mockResponse = { @@ -2291,6 +2293,7 @@ describe('Store', () => { it('should call callHttpClient with correct parameters', async () => { // Arrange globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(mockResponse)); + store.applicationUser.savedSessionId = savedSessionId; // Act await store.loadSession(mockDuplicate); @@ -2300,6 +2303,7 @@ describe('Store', () => { method: endpoints.LoadSession.method, endpoint: endpoints.LoadSession.url, payload: { + savedSessionId: mockDuplicate.savedSessionId, referralNumber: mockDuplicate.referralNumber, referralDate: mockDuplicate.referralDate, parentAccountNumber: store.order.parentAccountNumber,