function getBBPSConfig() {
  const baseUrl  = process.env.BBPS_BASE_URL;
  const clientId = process.env.BBPS_CLIENT_ID;
  const encKey   = process.env.BBPS_SECRET_KEY;
  const sigKey   = process.env.BBPS_SIGNING_KEY;
  const sourceId = process.env.BBPS_SOURCE_ID;

  const missing = [];
  if (!baseUrl)  missing.push('BBPS_BASE_URL');
  if (!clientId) missing.push('BBPS_CLIENT_ID');
  if (!encKey)   missing.push('BBPS_SECRET_KEY');
  if (!sigKey)   missing.push('BBPS_SIGNING_KEY');
  if (!sourceId) missing.push('BBPS_SOURCE_ID');

  if (missing.length) {
    const err = new Error(`Missing required env: ${missing.join(', ')}`);
    err.code = 'CONFIG_MISSING';
    throw err;
  }

  return { baseUrl, clientId, encKey, sigKey, sourceId };
}

module.exports = { getBBPSConfig };
