Skip to content

Commit

Permalink
Update flutter version (#16)
Browse files Browse the repository at this point in the history
* feat: update flutter version to be compatible with 3.24.5

* feat: update bank list

* feat: add correct syntax

* feat: bump version
  • Loading branch information
eduardo-garcia18 authored Jan 25, 2025
1 parent 95b2a1b commit 915aba6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
21 changes: 15 additions & 6 deletions lib/src/banks.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const Map<String, String> banks = {
const banks = {
'138': '40138',
'133': '40133',
'062': '40062',
'661': '90661',
'638': '90638',
'706': '90706',
'659': '90659',
Expand Down Expand Up @@ -32,6 +31,7 @@ const Map<String, String> banks = {
'677': '90677',
'683': '90683',
'630': '90630',
'124': '40124',
'143': '40143',
'631': '90631',
'901': '90901',
Expand All @@ -43,10 +43,12 @@ const Map<String, String> banks = {
'126': '40126',
'680': '90680',
'723': '90723',
'722': '90722',
'151': '40151',
'616': '90616',
'634': '90634',
'689': '90689',
'699': '90699',
'685': '90685',
'601': '90601',
'168': '37168',
Expand All @@ -59,6 +61,7 @@ const Map<String, String> banks = {
'686': '90686',
'059': '40059',
'110': '40110',
'661': '90661',
'653': '90653',
'670': '90670',
'602': '90602',
Expand All @@ -77,6 +80,7 @@ const Map<String, String> banks = {
'014': '40014',
'044': '40044',
'157': '40157',
'728': '90728',
'646': '90646',
'648': '90648',
'656': '90656',
Expand All @@ -88,12 +92,12 @@ const Map<String, String> banks = {
'141': '40141',
};

// Descargado de http://www.banxico.org.mx/cep/ por 2019-01-21
const Map<String, String> bankNames = {
// # Descargado de https://www.banxico.org.mx/cep-scl/listaInstituciones.do
// # 2022-10-18
const bankNames = {
'40138': 'ABC Capital',
'40133': 'Actinver',
'40062': 'Afirme',
'90661': 'ALTERNATIVOS',
'90706': 'Arcus',
'90659': 'Asp Integra Opc',
'40128': 'Autofin',
Expand Down Expand Up @@ -122,6 +126,7 @@ const Map<String, String> bankNames = {
'90677': 'Caja Pop Mexica',
'90683': 'Caja Telefonist',
'90630': 'CB Intercam',
'40124': 'CBM Banco',
'40143': 'CI Banco',
'90631': 'CI Bolsa',
'90901': 'Cls',
Expand All @@ -137,6 +142,7 @@ const Map<String, String> bankNames = {
'90616': 'Finamex',
'90634': 'Fincomun',
'90689': 'Fomped',
'90699': 'Fondeadora',
'90685': 'Fondo (Fira)',
'90601': 'Gbm',
'37168': 'Hipotecaria Fed',
Expand All @@ -149,9 +155,11 @@ const Map<String, String> bankNames = {
'90686': 'Invercap',
'40059': 'Invex',
'40110': 'JP Morgan',
'90661': 'KLAR',
'90653': 'Kuspit',
'90670': 'Libertad',
'90602': 'Masari',
'90722': 'Mercado Pago W',
'40042': 'Mifel',
'40158': 'Mizuho Bank',
'90600': 'Monexcb',
Expand All @@ -161,16 +169,17 @@ const Map<String, String> bankNames = {
'37135': 'Nafin',
'90638': 'NU MEXICO',
'90710': 'NVIO',
'90684': 'Opm',
'40148': 'Pagatodo',
'90620': 'Profuturo',
'40156': 'Sabadell',
'40014': 'Santander',
'40044': 'Scotiabank',
'40157': 'Shinhan',
'90728': 'Spin by OXXO',
'90646': 'STP',
'90648': 'Tactiv Cb',
'90703': 'Tesored',
'90684': 'Transfer',
'90656': 'Unagra',
'90617': 'Valmex',
'90605': 'Value',
Expand Down
6 changes: 4 additions & 2 deletions lib/src/clabe_validation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ String getBankName(String clabe) {
https://es.wikipedia.org/wiki/CLABE#D.C3.ADgito_control
*/
String code = clabe.substring(0, 3);
String bank = bankNames[banks[code]];

final bankCode = banks[code];
if (bankCode == null) throw Exception('Ningún banco tiene código ${code}');
final bank = bankNames[bankCode];
if (bank == null) throw Exception('Ningún banco tiene código ${code}');

return bank;
}
2 changes: 1 addition & 1 deletion lib/src/validations.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Determine if a String is digit
bool isDigit(String s) {
bool isDigit(String? s) {
if (s == null) {
return false;
}
Expand Down
5 changes: 2 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: clabe_dart
description: Validate a CLABE (Clave Bancaria Estandarizada), calculate the control digit and get the name of the bank.
version: 1.1.6
author: Cuenca <[email protected]>
version: 1.2.0
homepage: https://github.com/cuenca-mx/clabe-dart

environment:
sdk: '>=2.0.0 <3.0.0'
sdk: ">=3.3.4 <4.0.0"

#dependencies:

Expand Down
7 changes: 4 additions & 3 deletions test/clabe_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import 'package:test/test.dart';
import 'package:clabe_dart/clabe_dart.dart';

void main() {
String VALID_CLABE;
String INVALID_CLABE;
String INVALID_CLABE_BANK_CODE;
late String VALID_CLABE;
late String INVALID_CLABE;
late String INVALID_CLABE_BANK_CODE;

setUp(() {
VALID_CLABE = '002000000000000008';
INVALID_CLABE = '002000000000000007';
Expand Down

0 comments on commit 915aba6

Please sign in to comment.