moiplabs/moip-php — Issue #24: Payment institution names inconsistent
Author: holtkamp
Created: 2011-11-11 18:51:22+00:00
State: open

For the various payment institutions (VISA, MasterCard, American Express, Banco do Brasil), an array is used in the ./lib/MoIP.php file:

private $institution = array('moip'=>'MoIP',
'visa'=>'Visa',
'american_express'=>'AmericanExpress',
'mastercard'=>'Mastercard',
'diners'=>'Diners',
'banco_brasil'=>'BancoDoBrasil',
'bradesco'=>'Bradesco',
'itau'=>'Itau',
'real'=>'BancoReal',
'unibanco'=>'Unibanco',
'aura'=>'Aura',
'hipercard'=>'Hipercard',
'paggo'=>'Paggo', //oi paggo
'banrisul'=>'Banrisul'
);

Note that the key => name mappings are not consisten. We have stored the names of the supported institutions in our database and would like to use:
$institutionKey = str_replace(' ', '_', $institutionName); //replace spaces with underscores
$institutionKey = strtolower($institutionKey); //make the whole string lowercase

However, this approach fails for:
- 'Banco do Brasil'
- 'Banco Real'
- 'Oi Paggo'

I would like to suggest to add the following entries to the array:
'banco_do_brasil' => 'BancoBrasil'
'banco_real' => 'BancoReal'
'oi_paggo' => 'Paggo'

This way the client is consistent with general naming of the payment institutions and no changes to the MoIP engine are required, since the keys map to the same name (which is used in the request)

Cheers