DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Check German Account Numbers And Bank Codes
require 'ktoblzcheck'
$bc="20030700"
$an="0"
puts "Testing Bank Code: #{$bc} / Account No. #{$an}"
KtoBlzCheck.new do |kbc|
name,location=kbc.find($bc)
if name
puts "Bank found! #{name} located in #{location}"
else
puts "Bank not found!"
end
case kbc.check($bc,$an)
when KtoBlzCheck::ERROR
puts "Failed, bank code and account number don't match"
when KtoBlzCheck::OK
puts "Success, valid combination of bank code and account number"
when KtoBlzCheck::UNKNOWN
puts "Unknown."
when KtoBlzCheck::BANK_NOT_KNOWN
puts "Unknown bank code"
else
puts "Never reached :)"
end
end
Resources: <a href="http://blog.zopy.de/">Fotos bearbeiten</a>




