---
title: Company identifier lookup
summary: Resolves a company identifier from the ABA vendor service by serial/payee code or by company name.
status: draft
owner: SAIF
last_reviewed: 2026-07-30
library: BankValidator
reference_type: package
operation_id: OP-BV-02
trigger: Caller invokes FindAsCompanyId or FindByCompanyName
---

# Company identifier lookup

This operation covers the two façade methods that resolve a vendor-side company identifier: `FindAsCompanyId` looks up a company by an associated serial number and payee code, and `FindByCompanyName` looks up a company by its name. Both delegate to the ABA vendor service and share the same logon/invoke/logoff shape.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-BV-02 |
| **Trigger** | Caller calls `FindAsCompanyId(inSerialNum, inPayeeCode)` or `FindByCompanyName(inCompanyName)` on a constructed `clsValidateBank` |
| **Inputs** | `inSerialNum` and `inPayeeCode` (for `FindAsCompanyId`), or `inCompanyName` (for `FindByCompanyName`) |
| **Outputs** | `Integer` company ID (defaults to `0` before the vendor call is made) |
| **Primary components** | `clsValidateBank.FindAsCompanyId`, `clsValidateBank.FindByCompanyName`, `clsValidateBank.LogonABA`, `clsValidateBank.LogoffABA` |
| **Entry point** | `Legacy\BankValidator\clsValidateBank.vb` |

## Steps

1. **Initialize the result.** `companyId` is initialized to `0` before any vendor interaction.
2. **Log on to the ABA service.** `LogonABA()` increments `m_LogonAttempts`, lazily constructs `ABAService.ABAService` if needed, sets its `Url` from `URLABA`, and calls `ABA.Logon(CompanyId, UserId, Password)` to obtain a `LogonToken` ([BR-002](../business-rules.md#br-002-vendor-logon-retry-handling)).
   - On failure: recursively retries `LogonABA()` while `m_LogonAttempts < m_LogonAttemptsMax`.
   - On failure after the retry limit is exhausted: throws `ApplicationException("Unable to logon to ABA web service.", ex)`.
3. **Invoke the vendor lookup.**
   - For `FindAsCompanyId`: call `ABA.FindASCompanyID(inSerialNum, inPayeeCode)` and assign the result to `companyId`.
   - For `FindByCompanyName`: call `ABA.FindCompanyID(inCompanyName)` and assign the result to `companyId`.
   - Neither method wraps this call in a `Try/Catch`; an exception raised by the vendor call propagates directly to the caller and skips step 4.*
4. **Log off the ABA service.** `LogoffABA()` calls `ABA.Logoff(LogonToken)`, disposes the `ABA` proxy, and sets it to `Nothing`.
   - On failure: the exception is silently swallowed (the `Throw` line is commented out).
5. **Return the result.** `companyId` is returned to the caller.

## Process flow

The following diagram visualizes the shared control flow for both company-lookup methods.

```mermaid
flowchart TD
	Start([Caller calls FindAsCompanyId<br>or FindByCompanyName]) --> Init[companyId = 0]
	Init --> Logon[LogonABA:<br>logon with retry up to m_LogonAttemptsMax]
	Logon --> LogonOk{Logon succeeded?}
	LogonOk -->|No, retries exhausted| Ex([ApplicationException thrown])
	LogonOk -->|Yes| Which{Which method?}
	Which -->|FindAsCompanyId| BySerial[ABA.FindASCompanyID]
	Which -->|FindByCompanyName| ByName[ABA.FindCompanyID]
	BySerial --> Fault{Vendor call throws?}
	ByName --> Fault
	Fault -->|Yes| Propagate([Exception propagates;<br>LogoffABA skipped])
	Fault -->|No| Logoff[LogoffABA:<br>release token, dispose proxy]
	Logoff --> Done([Return companyId])
```

## Failure and edge-case behavior
- If the ABA logon fails repeatedly, the caller receives an `ApplicationException` after `m_LogonAttemptsMax` retries ([BR-002](../business-rules.md#br-002-vendor-logon-retry-handling)); no lookup is attempted.
- Because the vendor invocation is not wrapped in `Try/Catch`, an exception from `ABA.FindASCompanyID` or `ABA.FindCompanyID` propagates unhandled to the caller and `LogoffABA()` is never reached, leaving the ABA proxy and logon token unreleased.*
- If the vendor returns no match, the observable behavior is a vendor-supplied `Integer` (commonly `0`); no explicit not-found branch exists in the façade code beyond the pre-initialized `companyId = 0`.*
- `LogoffABA` failures are intentionally swallowed and never surface to the caller.*

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `Legacy\BankValidator\clsValidateBank.vb`
