...and not just because of the inconsistent naming.
- we define an array of accounts, but only ever use the first one in the list
- accountInfo is usually just a subset of values from account_config with renamed keys
- for gateways that have multiple accounts, we still always set queue message key 'gateway_account' to the key of the first account in the list.
Maybe move all the account stuff into authentication helper objects?
$authenticator->addCredentials( $this, &$staged_data );
The authenticator can fetch the global var, call whatever GatewayType methods it needs to determine the correct account and current txn, and add the appropriate keys and values to the staged data.