From 0b8c8216a098756d9a875fbbcb2b40843cefca00 Mon Sep 17 00:00:00 2001 From: Pawel Janik Date: Tue, 5 Nov 2024 11:56:48 +0200 Subject: [PATCH] Refactor: Simplify retrieveAccountOpeningRequest handler logic --- src/routes/accountOpeningRequest.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/routes/accountOpeningRequest.ts b/src/routes/accountOpeningRequest.ts index c66a8bf8df..e2b34cda33 100644 --- a/src/routes/accountOpeningRequest.ts +++ b/src/routes/accountOpeningRequest.ts @@ -146,7 +146,6 @@ export const retrieveAccountOpeningRequest = async ( let customerType = CustomerType.PERSON; let entityId: string; let entity: MockPerson | MockBusiness; - let handlers = getHandlers(customerType); entityId = await getCustomerIdByAccountOpeningRequest( accountOpeningRequestId, @@ -154,15 +153,14 @@ export const retrieveAccountOpeningRequest = async ( ); if (entityId) { - entity = await handlers.getEntity(entityId); + entity = await getHandlers(customerType).getEntity(entityId); } else { customerType = CustomerType.BUSINESS; - handlers = getHandlers(customerType); entityId = await getCustomerIdByAccountOpeningRequest( accountOpeningRequestId, customerType ); - entity = await handlers.getEntity(entityId); + entity = await getHandlers(customerType).getEntity(entityId); } if (!entity) {