Skip to content

Commit

Permalink
Refactor: Simplify retrieveAccountOpeningRequest handler logic
Browse files Browse the repository at this point in the history
  • Loading branch information
p-janik committed Nov 5, 2024
1 parent e6b5556 commit 0b8c821
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/routes/accountOpeningRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,21 @@ export const retrieveAccountOpeningRequest = async (
let customerType = CustomerType.PERSON;
let entityId: string;
let entity: MockPerson | MockBusiness;
let handlers = getHandlers(customerType);

entityId = await getCustomerIdByAccountOpeningRequest(
accountOpeningRequestId,
customerType
);

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) {
Expand Down

0 comments on commit 0b8c821

Please sign in to comment.