moiplabs / moip-php

Biblioteca de integração com o MoIP em PHP
http://labs.moip.com.br/
83 stars 68 forks source link

Payment institution names inconsistent #24

Open holtkamp opened 13 years ago

holtkamp commented 13 years ago

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 = strreplace(' ', '', $institutionName); //replace spaces with underscores $institutionKey = strtolower($institutionKey); //make the whole string lowercase

However, this approach fails for:

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