Advanced Client work for Safeco

This commit is contained in:
Udayboppasafelite 2026-06-15 21:53:47 -04:00
parent 7e87e59683
commit 26406053db

View file

@ -336,8 +336,38 @@ export default class ClientData {
} }
static getClientByTag(clientTag: string) { static getClientByTag(clientTag: string) {
return [...essentialClients, ...advancedClients].find( return this.resolveClientForTest(clientTag);
client => client.clientTag === clientTag }
static getClientByAccountNumber(accountNumber: string) {
const advancedMatch = advancedClients.find(client => client.accountNumber === accountNumber);
if (advancedMatch) {
return advancedMatch;
}
return essentialClients.find(client => client.accountNumber === accountNumber);
}
static resolveClientForTest(clientTag: string, accountNumber?: string): IClient | undefined {
const normalizedTag = clientTag.toLowerCase();
if (accountNumber) {
const clientByAccount = this.getClientByAccountNumber(accountNumber);
if (clientByAccount?.clientTag.toLowerCase() === normalizedTag) {
return clientByAccount;
}
}
const essentialMatch = essentialClients.find(
client => client.clientTag.toLowerCase() === normalizedTag
); );
const advancedMatch = advancedClients.find(
client => client.clientTag.toLowerCase() === normalizedTag
);
if (essentialMatch && advancedMatch) {
return essentialMatch;
}
return advancedMatch ?? essentialMatch;
} }
} }