apeiros / iso-iban Goto Github PK
View Code? Open in Web Editor NEWDeal with International Bank Account Numbers (IBAN).
License: BSD 2-Clause "Simplified" License
Deal with International Bank Account Numbers (IBAN).
License: BSD 2-Clause "Simplified" License
Can somebody help me with this error?
When i use anywhere in application
Rails.logger.info("+++++++++logger info++++ ISO +++++#{ISO::IBAN.valid ('CH35 1234
5987 6543 2109 A')}")
this error is screaming
RuntimeError (No specifications have been loaded yet.):
I can't find anything about specification which has something to do with iso-iban gem.
Thanks for reply.
Martin
Hi there, I have been maintaining php-iban
at https://github.com/globalcitizen/php-iban for years. Much of the effort is in normalizing, error-correcting and updating the registry as published by SWIFT. It appears you guys are doing this too. Perhaps we should combine efforts?
My approach to the problem space was to create a new, normalized text file holding the corrected registry information. This is available at https://raw.githubusercontent.com/globalcitizen/php-iban/master/registry.txt and offers as many features as I could claw out of the data.
Perhaps you may wish to use that, or we could pull that out in to a new project and collaborate on that?
I'm sure it would increase the overall efficiency of updates and the greater userbase would provide increased responsiveness. In the past I have found that often I only become aware of issues when real world users get in touch.
One idea that I have in the pipeline, which may be worth bearing in mind here, is support for non-standard or unofficial IBAN codes. For instance, someone contacted me recently about the Ukraine - I'm pretty sure they have no official code as it's not listed in either the text or PDF versions of the registry, though perhaps something is currently in use. It wouldn't surprise me, particularly given the political expedience of tying it to the Eurozone.
Let me know your thoughts...
I wrote a short script expecting .bank_code and .branch_code to return the same values I pass into .generate. It worked well for all cases except for 2 of them. IT and SM. They are the only 2 countries whose bank_code does not start at position 4.
See the following snippet.
ISO::IBAN.specifications.keys.reject do |country|
spec = ISO::IBAN.specification(country)
bank_code = ('1' * spec.bank_code_length).presence
branch_code = ('2' * spec.branch_code_length).presence
account_code = ('3' * spec.account_code_length).presence
iban = ISO::IBAN.generate(country, *[bank_code, branch_code, account_code].compact)
iban.bank_code == bank_code && iban.branch_code == branch_code && iban.account_code == account_code
end
The resulting array contains just 'IT' and 'SM'.
If the former behaviour is expected, then please tell me how is generate supposed to be used.
Using ruby 2.3.3p222 on mac os and iso-iban (0.1.3).
irb(main):005:0* ISO::IBAN.generate('ES', '2077002400', '3102575766')
NoMethodError: undefined method `rjust' for nil:NilClass
from /var/lib/gems/2.1.0/gems/iso-iban-0.1.3/lib/iso/iban/no_autoload.rb:220:in `block in generate'
from /var/lib/gems/2.1.0/gems/iso-iban-0.1.3/lib/iso/iban/no_autoload.rb:220:in `map'
from /var/lib/gems/2.1.0/gems/iso-iban-0.1.3/lib/iso/iban/no_autoload.rb:220:in `generate'
from (irb):5
from /var/lib/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/console.rb:90:in `start'
from /var/lib/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/console.rb:9:in `start'
from /var/lib/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:69:in `console'
from /var/lib/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /var/lib/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `block in require'
from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /home/juanma/Proyectos/flexnet2/bin/rails:8:in `<top (required)>'
from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `load'
from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `block in load'
from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `load'
from /var/lib/gems/2.1.0/gems/spring-1.2.0/lib/spring/commands/rails.rb:6:in `call'
from /var/lib/gems/2.1.0/gems/spring-1.2.0/lib/spring/command_wrapper.rb:38:in `call'
from /var/lib/gems/2.1.0/gems/spring-1.2.0/lib/spring/application.rb:183:in `block in serve'
from /var/lib/gems/2.1.0/gems/spring-1.2.0/lib/spring/application.rb:156:in `fork'
from /var/lib/gems/2.1.0/gems/spring-1.2.0/lib/spring/application.rb:156:in `serve'
from /var/lib/gems/2.1.0/gems/spring-1.2.0/lib/spring/application.rb:131:in `block in run'
from /var/lib/gems/2.1.0/gems/spring-1.2.0/lib/spring/application.rb:125:in `loop'
from /var/lib/gems/2.1.0/gems/spring-1.2.0/lib/spring/application.rb:125:in `run'
from /var/lib/gems/2.1.0/gems/spring-1.2.0/lib/spring/application/boot.rb:18:in `<top (required)>'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'irb(main):006:0>
EDIT:
After some research, I've discovered the problem was, for ES accounts, iso-iban is expecting three parameters besides the country code... Maybe iso-iban should raise a self-explanatory exception.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.