rbktoblzcheck 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +38 -0
- data/README +172 -0
- data/Rakefile +19 -0
- data/VERSION.yml +4 -0
- data/bin/kbc-ruby +156 -0
- data/ext/extconf.rb +13 -0
- data/ext/ktoblzcheck.c +208 -0
- data/lib/ktoblzcheck.rb +5 -0
- data/rbktoblzcheck.gemspec +51 -0
- data/test/test-bankdata.txt +158 -0
- data/test/test-ktoblzcheck-all.rb +50 -0
- data/test/test-ktoblzcheck.rb +65 -0
- metadata +78 -0
data/LICENSE
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
(c) Copyright 2004, Sascha Loetz (sloetz (a t) web.de). All rights reserved.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms of this software, with
|
|
6
|
+
or without modification, are permitted provided that the following
|
|
7
|
+
conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain any existing copyright
|
|
10
|
+
notice, and this entire permission notice in its entirety,
|
|
11
|
+
including the disclaimer of warranties.
|
|
12
|
+
|
|
13
|
+
2. Redistributions in binary form must reproduce all prior and current
|
|
14
|
+
copyright notices, this list of conditions, and the following
|
|
15
|
+
disclaimer in the documentation and/or other materials provided
|
|
16
|
+
with the distribution.
|
|
17
|
+
|
|
18
|
+
3. The name of any author may not be used to endorse or promote
|
|
19
|
+
products derived from this software without their specific prior
|
|
20
|
+
written permission.
|
|
21
|
+
|
|
22
|
+
ALTERNATIVELY, this product may be distributed under the terms of the
|
|
23
|
+
GNU General Public License, in which case the provisions of the GNU
|
|
24
|
+
GPL are required INSTEAD OF the above restrictions. (This clause is
|
|
25
|
+
necessary due to a potential conflict between the GNU GPL and the
|
|
26
|
+
restrictions contained in a BSD-style copyright.)
|
|
27
|
+
|
|
28
|
+
THIS SOFTWARE IS PROVIDED AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
29
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
30
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
31
|
+
IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
32
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
33
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
34
|
+
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
35
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
36
|
+
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
|
37
|
+
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
38
|
+
DAMAGE.
|
data/README
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Ruby KtoBlzCheck
|
|
2
|
+
================
|
|
3
|
+
|
|
4
|
+
rbKtoBlzCheck is a small Ruby extension for Linux (written in C) that provides
|
|
5
|
+
an interface for libktoblzcheck, a library to check German account numbers and
|
|
6
|
+
bank codes. See http://ktoblzcheck.sourceforge.net for details.
|
|
7
|
+
|
|
8
|
+
Install instructions
|
|
9
|
+
--------------------
|
|
10
|
+
|
|
11
|
+
Just install the gem with the following command:
|
|
12
|
+
|
|
13
|
+
$ gem install ktoblzcheck
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Common errors:
|
|
17
|
+
--------------
|
|
18
|
+
|
|
19
|
+
* ruby extconf.rb fails with
|
|
20
|
+
"Couldn't find header file..." or
|
|
21
|
+
"Couldn't find link library..."
|
|
22
|
+
|
|
23
|
+
=> Make sure the ktoblzcheck library and header files are correctly installed.
|
|
24
|
+
=> Consult the file mkmf.log for details of build time checks
|
|
25
|
+
=> Hint: If you've build and installed the ktoblzcheck library from source, make sure
|
|
26
|
+
the install locations of the library files are listed in /etc/ld.so.conf and you've run
|
|
27
|
+
`ldconfig`
|
|
28
|
+
|
|
29
|
+
* compile errors
|
|
30
|
+
|
|
31
|
+
Nothing to mention here: the code compiles without warning on Linux 2.6.7,
|
|
32
|
+
glibc-2.3.2, gcc version 3.3.4 (Debian 1:3.3.4-7) with ruby 1.8.2
|
|
33
|
+
(2004-07-29) [i386-linux].
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
Dependencies:
|
|
37
|
+
-------------
|
|
38
|
+
|
|
39
|
+
- Ruby >= 1.8
|
|
40
|
+
- libktoblzcheck (obviously :)
|
|
41
|
+
|
|
42
|
+
The ktoblzcheck package can be downloaded from
|
|
43
|
+
http://ktoblzcheck.sourceforge.net/ as source distribution tar-ball or RPM.
|
|
44
|
+
|
|
45
|
+
Debian has a package named 'libktoblzcheck1-dev' available in testing and
|
|
46
|
+
unstable, simply apt-get install it.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Other platforms:
|
|
51
|
+
----------------
|
|
52
|
+
|
|
53
|
+
As I have no suitable non-Linux systems to mess around with, I have no idea
|
|
54
|
+
whether this Ruby extension compiles and/or runs correctly on other platforms.
|
|
55
|
+
|
|
56
|
+
I guess, there should be no problems on BSDish systems. While the C-code should
|
|
57
|
+
be quiet portable, I'm not sure if linking works correctly on Microsoft (R)
|
|
58
|
+
Windows (R).
|
|
59
|
+
|
|
60
|
+
Comments on problems with OSes other than Linux are always welcome.
|
|
61
|
+
|
|
62
|
+
License:
|
|
63
|
+
--------
|
|
64
|
+
|
|
65
|
+
BSD-style, see LICENSE
|
|
66
|
+
|
|
67
|
+
This project is based on the work of Sascha Loetz (blog.cadego.de, info@cadego(dot)de).
|
|
68
|
+
|
|
69
|
+
Ruby Interface:
|
|
70
|
+
===============
|
|
71
|
+
|
|
72
|
+
Example:
|
|
73
|
+
-----------------------------------------------------------------------
|
|
74
|
+
require 'ktoblzcheck'
|
|
75
|
+
|
|
76
|
+
$bc="20030700"
|
|
77
|
+
$an="0"
|
|
78
|
+
|
|
79
|
+
puts "Testing Bank Code: #{$bc} / Account No. #{$an}"
|
|
80
|
+
|
|
81
|
+
KtoBlzCheck.new do |kbc|
|
|
82
|
+
name,location=kbc.find($bc)
|
|
83
|
+
if name
|
|
84
|
+
puts "Bank found! #{name} located in #{location}"
|
|
85
|
+
else
|
|
86
|
+
puts "Bank not found!"
|
|
87
|
+
end
|
|
88
|
+
case kbc.check($bc,$an)
|
|
89
|
+
when KtoBlzCheck::ERROR
|
|
90
|
+
puts "Failed, bank code and account number don't match"
|
|
91
|
+
when KtoBlzCheck::OK
|
|
92
|
+
puts "Success, valid combination of bank code and account number"
|
|
93
|
+
when KtoBlzCheck::UNKNOWN
|
|
94
|
+
puts "Unknown."
|
|
95
|
+
when KtoBlzCheck::BANK_NOT_KNOWN
|
|
96
|
+
puts "Unknown bank code"
|
|
97
|
+
else
|
|
98
|
+
puts "Never reached :)"
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
-----------------------------------------------------------------------
|
|
102
|
+
|
|
103
|
+
For more code examples refer to the rbkbc program and the test-*.rb files
|
|
104
|
+
provided with this distribution.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
Interface documentation:
|
|
108
|
+
========================
|
|
109
|
+
|
|
110
|
+
-----------------------------------------------------------------------
|
|
111
|
+
KtoBlzCheck.new [ |block| ] -> obj
|
|
112
|
+
KtoBlzCheck.new(datafilepath) [ |block| ] -> obj
|
|
113
|
+
-----------------------------------------------------------------------
|
|
114
|
+
|
|
115
|
+
Constructs a new KtoBlzCheck object, returns it or passes it to an
|
|
116
|
+
optional code block. If no block is provided, the user must call
|
|
117
|
+
KtoBlzCheck#close to ensure that all resources are freed
|
|
118
|
+
after usage.
|
|
119
|
+
|
|
120
|
+
If a parameter is passed to new it is interpreted as the path to the
|
|
121
|
+
data file to be used by libktoblzcheck. When the parameter is omitted,
|
|
122
|
+
the default file of libktoblzcheck is used
|
|
123
|
+
(usually /usr/[local/]share/[lib]ktoblzcheck[*]/bankdata.txt).
|
|
124
|
+
|
|
125
|
+
A nil value passed as parameter is ignored.
|
|
126
|
+
-----------------------------------------------------------------------
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
-----------------------------------------------------------------------
|
|
130
|
+
KtoBlzCheck#close
|
|
131
|
+
-----------------------------------------------------------------------
|
|
132
|
+
Closes the KtoBlzCheck object's handle for libktoblzcheck. Must be
|
|
133
|
+
called to prevent resource leaks if KtoBlzCheck#new is not used with
|
|
134
|
+
block syntax.
|
|
135
|
+
-----------------------------------------------------------------------
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
-----------------------------------------------------------------------
|
|
139
|
+
KtoBlzCheck#num_records -> aFixnum
|
|
140
|
+
-----------------------------------------------------------------------
|
|
141
|
+
Returns the number of entries in the currently used data file for
|
|
142
|
+
libktoblzcheck.
|
|
143
|
+
-----------------------------------------------------------------------
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
-----------------------------------------------------------------------
|
|
147
|
+
KtoBlzCheck#check(bank_code, account_no) -> aFixnum
|
|
148
|
+
-----------------------------------------------------------------------
|
|
149
|
+
Checks if bank_code and account_no form a valid combination. The
|
|
150
|
+
returned Fixnum indicates the result. The following constants can be
|
|
151
|
+
used test the result:
|
|
152
|
+
|
|
153
|
+
KtoBlzCheck::OK -> valid combination of bank code and account number
|
|
154
|
+
KtoBlzCheck::ERROR -> !OK
|
|
155
|
+
KtoBlzCheck::UNKNOWN -> no verification possible for unknown reason
|
|
156
|
+
KtoBlzCheck::BANK_NOT_KNOWN -> bank code not known
|
|
157
|
+
|
|
158
|
+
If bank_code and account_no are not of type String a TypeError is
|
|
159
|
+
raised.
|
|
160
|
+
-----------------------------------------------------------------------
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
-----------------------------------------------------------------------
|
|
164
|
+
KtoBlzCheck#find(bank_code) -> anArray
|
|
165
|
+
-----------------------------------------------------------------------
|
|
166
|
+
Looks up bank name and bank location (city) for the bank identified
|
|
167
|
+
by bank_code.
|
|
168
|
+
|
|
169
|
+
Returns an array with the bank's name (index 0) and the bank's location
|
|
170
|
+
(index 1). The returned array is empty if no bank is found for the given
|
|
171
|
+
bank code.
|
|
172
|
+
-----------------------------------------------------------------------
|
data/Rakefile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
begin
|
|
3
|
+
require 'jeweler'
|
|
4
|
+
Jeweler::Tasks.new do |gem|
|
|
5
|
+
gem.name = "rbktoblzcheck"
|
|
6
|
+
gem.summary = "rbktoblzcheck is an interface for libktoblzcheck, a library to check German account numbers and
|
|
7
|
+
bank codes. See http://ktoblzcheck.sourceforge.net for details."
|
|
8
|
+
gem.email = "kim.rudolph@web.de"
|
|
9
|
+
gem.homepage = "http://github.com/krudolph/rbktoblzcheck"
|
|
10
|
+
gem.authors = ["Sascha Loetz", "Kim Rudolph"]
|
|
11
|
+
gem.require_paths = ["lib", "ext"]
|
|
12
|
+
gem.extra_rdoc_files = `git ls-files *.rdoc`.split("\n")
|
|
13
|
+
gem.files = `git ls-files`.split("\n")
|
|
14
|
+
gem.extensions = ["ext/extconf.rb"]
|
|
15
|
+
gem.files.include %w(lib/jeweler/templates/.document lib/jeweler/templates/.gitignore)
|
|
16
|
+
end
|
|
17
|
+
rescue LoadError
|
|
18
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
|
19
|
+
end
|
data/VERSION.yml
ADDED
data/bin/kbc-ruby
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# Sample program for rbktoblzcheck
|
|
4
|
+
#
|
|
5
|
+
# Mimics the functions of the ktoblzcheck tool
|
|
6
|
+
# which is part of the ktoblzcheck distribution
|
|
7
|
+
#
|
|
8
|
+
# (c) 2004 Sascha Loetz (sloetz (a t) web.de)
|
|
9
|
+
#
|
|
10
|
+
# See LICENSE for the BSD-style license for this code
|
|
11
|
+
#
|
|
12
|
+
# This program is part of the rbktoblzcheck package
|
|
13
|
+
# available at http://www.vdp-software.com/Rbktoblzcheck.html
|
|
14
|
+
#
|
|
15
|
+
# $Id: rbkbc,v 1.1 2004/10/28 19:10:19 vdpsoftware Exp $
|
|
16
|
+
|
|
17
|
+
require 'getoptlong'
|
|
18
|
+
require 'ktoblzcheck'
|
|
19
|
+
|
|
20
|
+
# modes of operation
|
|
21
|
+
FIND=1
|
|
22
|
+
CHECK=2
|
|
23
|
+
|
|
24
|
+
$bc=nil # bank code
|
|
25
|
+
$an=nil # account number
|
|
26
|
+
$ec=0 # exit code
|
|
27
|
+
$df=nil # data file
|
|
28
|
+
$verbose=false
|
|
29
|
+
$prg=File.basename($0)
|
|
30
|
+
|
|
31
|
+
def print_help
|
|
32
|
+
puts "Usage: #{$prg} [OPTIONS]"
|
|
33
|
+
puts "--verbose, -v\t\t\treport --check results as text and return code"
|
|
34
|
+
puts "--find, -f\t\t\tfind mode: lookup details for a bank code (-b required)"
|
|
35
|
+
puts "--check,-c\t\t\tcheck mode: validate bank code and account number\n\t\t\t\t(-b and -a required)"
|
|
36
|
+
puts "--bank-code, -b bank code\tspecify bank code for --find or --check"
|
|
37
|
+
puts "--account-no, -a account number\tspecify account number for --check"
|
|
38
|
+
puts "--data-file,-d path\t\tuse a different data file"
|
|
39
|
+
puts
|
|
40
|
+
puts "Return codes:"
|
|
41
|
+
puts "0 OK"
|
|
42
|
+
puts "1 Failed"
|
|
43
|
+
puts "2 Unknown Error"
|
|
44
|
+
puts "3 Unknown Bank Code"
|
|
45
|
+
puts "4 Option Error"
|
|
46
|
+
puts
|
|
47
|
+
puts "Examples:"
|
|
48
|
+
puts "#{$prg} --verbose --check --bank-code 20030700 --account-no 0"
|
|
49
|
+
puts "#{$prg} -f -b 20030700"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
begin # options
|
|
53
|
+
|
|
54
|
+
opts = GetoptLong.new(
|
|
55
|
+
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT],
|
|
56
|
+
[ "--data-file", "-d", GetoptLong::REQUIRED_ARGUMENT],
|
|
57
|
+
[ "--find", "-f", GetoptLong::NO_ARGUMENT],
|
|
58
|
+
[ "--check", "-c", GetoptLong::NO_ARGUMENT],
|
|
59
|
+
[ "--account-no", "-a", GetoptLong::REQUIRED_ARGUMENT],
|
|
60
|
+
[ "--bank-code", "-b", GetoptLong::REQUIRED_ARGUMENT],
|
|
61
|
+
[ "--help", "-h", GetoptLong::NO_ARGUMENT ] )
|
|
62
|
+
|
|
63
|
+
opts.quiet=true
|
|
64
|
+
|
|
65
|
+
# process the parsed options
|
|
66
|
+
|
|
67
|
+
opts.each do |opt, arg|
|
|
68
|
+
case opt
|
|
69
|
+
when "--account-no"
|
|
70
|
+
$an=arg.to_s
|
|
71
|
+
when "--bank-code"
|
|
72
|
+
$bc=arg.to_s
|
|
73
|
+
when "--data-file"
|
|
74
|
+
$df=arg.to_s
|
|
75
|
+
when "--check"
|
|
76
|
+
$mode=CHECK
|
|
77
|
+
when "--find"
|
|
78
|
+
$mode=FIND
|
|
79
|
+
when "--verbose"
|
|
80
|
+
$verbose=true
|
|
81
|
+
when "--help"
|
|
82
|
+
print_help
|
|
83
|
+
exit 0
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
rescue => se
|
|
88
|
+
STDERR.print "#{$prg}: ",se.message,"\n"
|
|
89
|
+
exit 1
|
|
90
|
+
end # rescue options
|
|
91
|
+
|
|
92
|
+
#
|
|
93
|
+
# option checking
|
|
94
|
+
#
|
|
95
|
+
case $mode
|
|
96
|
+
when FIND
|
|
97
|
+
if $bc.nil?
|
|
98
|
+
STDERR.puts "--find without --bank-code, not an easy task -- aborted"
|
|
99
|
+
exit 4
|
|
100
|
+
end
|
|
101
|
+
when CHECK
|
|
102
|
+
if $bc.nil?
|
|
103
|
+
STDERR.puts "--check without --bank-code, not an easy task -- aborted"
|
|
104
|
+
exit 4
|
|
105
|
+
end
|
|
106
|
+
if $an.nil?
|
|
107
|
+
STDERR.puts "--check without --account-no, not an easy task -- aborted"
|
|
108
|
+
exit 4
|
|
109
|
+
end
|
|
110
|
+
else
|
|
111
|
+
print_help
|
|
112
|
+
exit 4
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
#
|
|
116
|
+
#
|
|
117
|
+
# the "program"
|
|
118
|
+
#
|
|
119
|
+
#
|
|
120
|
+
begin
|
|
121
|
+
|
|
122
|
+
KtoBlzCheck.new($df) do |kbc|
|
|
123
|
+
case $mode
|
|
124
|
+
when FIND
|
|
125
|
+
name,location=kbc.find($bc)
|
|
126
|
+
if name
|
|
127
|
+
puts "Found #{name} located in #{location}"
|
|
128
|
+
else
|
|
129
|
+
puts "No bank found for bank code #{$bc}"
|
|
130
|
+
end
|
|
131
|
+
when CHECK
|
|
132
|
+
case kbc.check($bc,$an)
|
|
133
|
+
when KtoBlzCheck::OK
|
|
134
|
+
puts "Valid bank code / account number combination" if $verbose
|
|
135
|
+
when KtoBlzCheck::ERROR
|
|
136
|
+
puts "Failed bank code / account number combination not valid" if $verbose
|
|
137
|
+
$ec=1
|
|
138
|
+
when KtoBlzCheck::UNKNOWN
|
|
139
|
+
puts "Couldn't check input for unknown reasons (shit happens)" if $verbose
|
|
140
|
+
$ec=2
|
|
141
|
+
when KtoBlzCheck::BANK_NOT_KNOWN
|
|
142
|
+
puts "Unknown bank for bank code #{bc}" if $verbose
|
|
143
|
+
$ec=3
|
|
144
|
+
else
|
|
145
|
+
puts "Funny, that you see this message. Something went terribly wrong." if $verbose
|
|
146
|
+
$ec=2
|
|
147
|
+
end # case kbc.check
|
|
148
|
+
end # case
|
|
149
|
+
end # new do
|
|
150
|
+
|
|
151
|
+
rescue => se
|
|
152
|
+
STDERR.puts "#{$prg} error: "+se.message
|
|
153
|
+
exit 2
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
exit $ec
|
data/ext/extconf.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'mkmf'
|
|
2
|
+
if !have_header('ktoblzcheck.h')
|
|
3
|
+
STDERR.puts "Couldn't find header file ktoblzcheck.h. Install library files and try again\n"
|
|
4
|
+
STDERR.puts "Hint: visit http://ktoblzcheck.sourceforge.net to obtain a source distribution tar-ball or check the package archives of your distribution (e.g. for Debian `apt-get install libktoblzcheck1-dev`)"
|
|
5
|
+
exit 1
|
|
6
|
+
end
|
|
7
|
+
if !have_library('ktoblzcheck')
|
|
8
|
+
STDERR.puts "Couldn't find link library libktoblzcheck. Install library files and try again\n"
|
|
9
|
+
STDERR.puts "Hint: visit http://ktoblzcheck.sourceforge.net to obtain a source distribution tar-ball or check the package archives of your distribution (e.g. for Debian `apt-get install libktoblzcheck1-dev`)"
|
|
10
|
+
exit 1
|
|
11
|
+
end
|
|
12
|
+
dir_config('ktoblzcheck_ext')
|
|
13
|
+
create_makefile('ktoblzcheck_ext')
|
data/ext/ktoblzcheck.c
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/***************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* (c) 2004 Sascha Loetz (sloetz ( a t ) web.de). All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* Redistribution and use in source and binary forms of this software, with
|
|
7
|
+
* or without modification, are permitted provided that the following
|
|
8
|
+
* conditions are met:
|
|
9
|
+
*
|
|
10
|
+
* 1. Redistributions of source code must retain any existing copyright
|
|
11
|
+
* notice, and this entire permission notice in its entirety,
|
|
12
|
+
* including the disclaimer of warranties.
|
|
13
|
+
*
|
|
14
|
+
* 2. Redistributions in binary form must reproduce all prior and current
|
|
15
|
+
* copyright notices, this list of conditions, and the following
|
|
16
|
+
* disclaimer in the documentation and/or other materials provided
|
|
17
|
+
* with the distribution.
|
|
18
|
+
*
|
|
19
|
+
* 3. The name of any author may not be used to endorse or promote
|
|
20
|
+
* products derived from this software without their specific prior
|
|
21
|
+
* written permission.
|
|
22
|
+
*
|
|
23
|
+
* ALTERNATIVELY, this product may be distributed under the terms of the
|
|
24
|
+
* GNU General Public License, in which case the provisions of the GNU
|
|
25
|
+
* GPL are required INSTEAD OF the above restrictions. (This clause is
|
|
26
|
+
* necessary due to a potential conflict between the GNU GPL and the
|
|
27
|
+
* restrictions contained in a BSD-style copyright.)
|
|
28
|
+
*
|
|
29
|
+
* THIS SOFTWARE IS PROVIDED AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
30
|
+
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
31
|
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
32
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
33
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
34
|
+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
35
|
+
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
36
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
37
|
+
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
|
38
|
+
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
39
|
+
* DAMAGE.
|
|
40
|
+
*************************************************************************
|
|
41
|
+
*
|
|
42
|
+
* This file is part of the rbktoblzcheck package available as a gem
|
|
43
|
+
*
|
|
44
|
+
* $Id: ktoblzcheck.c,v 1.1 2004/10/28 19:10:19 vdpsoftware Exp $
|
|
45
|
+
*
|
|
46
|
+
*************************************************************************/
|
|
47
|
+
#include <stdio.h>
|
|
48
|
+
#include <stdlib.h>
|
|
49
|
+
#include <unistd.h>
|
|
50
|
+
#include <ruby.h>
|
|
51
|
+
#include <ktoblzcheck.h>
|
|
52
|
+
|
|
53
|
+
static VALUE g_error;
|
|
54
|
+
static VALUE g_ktoblzcheck;
|
|
55
|
+
static AccountNumberCheck* g_anc=NULL;
|
|
56
|
+
|
|
57
|
+
#ifndef RUBY_19
|
|
58
|
+
#ifndef RSTRING_PTR
|
|
59
|
+
#define RSTRING_PTR(v) (RSTRING(v)->ptr)
|
|
60
|
+
#endif
|
|
61
|
+
#endif
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* KtoBlzCheck#close
|
|
65
|
+
*/
|
|
66
|
+
static VALUE close_anc(VALUE self)
|
|
67
|
+
{
|
|
68
|
+
if (NULL!=g_anc) {
|
|
69
|
+
AccountNumberCheck_delete(g_anc);
|
|
70
|
+
} else {
|
|
71
|
+
rb_raise(g_error, "Already closed" );
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return self;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
* KtoBlzCheck.new [ |block| ]
|
|
79
|
+
* KtoBlzCheck.new(datapath) [ |block| ]
|
|
80
|
+
*/
|
|
81
|
+
static VALUE init(int argc, VALUE *argv, VALUE self)
|
|
82
|
+
{
|
|
83
|
+
VALUE dp=Qnil;
|
|
84
|
+
|
|
85
|
+
rb_scan_args(argc,argv,"01",&dp);
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
if (Qnil==dp) { /* no parameter given */
|
|
89
|
+
|
|
90
|
+
g_anc=AccountNumberCheck_new();
|
|
91
|
+
|
|
92
|
+
} else { /* a path to a different data path was passed to method */
|
|
93
|
+
|
|
94
|
+
Check_Type(dp,T_STRING);
|
|
95
|
+
|
|
96
|
+
/*
|
|
97
|
+
* The libktoblzcheck constructor writes an error
|
|
98
|
+
* message to stderr if the given data filen can not
|
|
99
|
+
* be accessed :( Additionally, we don't get a proper
|
|
100
|
+
* return value which could be used to test for success
|
|
101
|
+
* (it's a C++ constructor that we are calling). Even a
|
|
102
|
+
* successful intialization (i.e. we get a pointer != NULL
|
|
103
|
+
* from AccountNumberCheck_new_file doesn't mean that the
|
|
104
|
+
* opened file is a valid data file).
|
|
105
|
+
*
|
|
106
|
+
* We do basic access checking ourselves and hope for the best :)
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
if (0!=access(RSTRING_PTR(dp),R_OK)) {
|
|
110
|
+
rb_raise(g_error,"Can't access file %s",RSTRING_PTR(dp));
|
|
111
|
+
}
|
|
112
|
+
g_anc=AccountNumberCheck_new_file(RSTRING_PTR(dp));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/*
|
|
116
|
+
* did we successfully obtain an AccountNumberCheck handle?
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
if (NULL==g_anc) {
|
|
120
|
+
rb_raise(g_error,"Couldn't initialize libktoblzcheck");
|
|
121
|
+
return Qnil;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/*
|
|
125
|
+
* block syntax
|
|
126
|
+
*
|
|
127
|
+
* KtoBlzCheck.new do |kbc| ... end
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
if (rb_block_given_p()) {
|
|
131
|
+
return rb_ensure(rb_yield, self, close_anc, self);
|
|
132
|
+
} else {
|
|
133
|
+
return self;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/*
|
|
138
|
+
*
|
|
139
|
+
* KtoBlzCheck#check(bank_code,account_no)
|
|
140
|
+
*
|
|
141
|
+
*/
|
|
142
|
+
static VALUE check(VALUE self, VALUE blz, VALUE account)
|
|
143
|
+
{
|
|
144
|
+
AccountNumberCheck_Result res;
|
|
145
|
+
|
|
146
|
+
Check_Type(blz,T_STRING);
|
|
147
|
+
Check_Type(account,T_STRING);
|
|
148
|
+
|
|
149
|
+
/*
|
|
150
|
+
* OK = 0,
|
|
151
|
+
* UNKNOWN = 1,
|
|
152
|
+
* ERROR = 2,
|
|
153
|
+
* BANK_NOT_KNOWN = 3
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
res=AccountNumberCheck_check(g_anc,RSTRING_PTR(blz),RSTRING_PTR(account));
|
|
157
|
+
|
|
158
|
+
return INT2FIX(res);
|
|
159
|
+
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/*
|
|
163
|
+
*
|
|
164
|
+
* KtoBlzCheck.num_records
|
|
165
|
+
*
|
|
166
|
+
*/
|
|
167
|
+
static VALUE num_records(VALUE self)
|
|
168
|
+
{
|
|
169
|
+
return INT2FIX(AccountNumberCheck_bankCount(g_anc));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/*
|
|
173
|
+
*
|
|
174
|
+
* KtoBlzCheck.find(bank_code)
|
|
175
|
+
*
|
|
176
|
+
*/
|
|
177
|
+
static VALUE find_info(VALUE self, VALUE blz)
|
|
178
|
+
{
|
|
179
|
+
VALUE ret=rb_ary_new2(2);
|
|
180
|
+
Check_Type(blz, T_STRING);
|
|
181
|
+
|
|
182
|
+
const AccountNumberCheck_Record* cr=AccountNumberCheck_findBank(g_anc,RSTRING_PTR(blz));
|
|
183
|
+
|
|
184
|
+
if (NULL!=cr) {
|
|
185
|
+
rb_ary_push(ret,rb_str_new2(AccountNumberCheck_Record_bankName(cr)));
|
|
186
|
+
rb_ary_push(ret,rb_str_new2(AccountNumberCheck_Record_location(cr)));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return ret;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/*
|
|
193
|
+
* Ruby extension stuff
|
|
194
|
+
*/
|
|
195
|
+
void Init_ktoblzcheck_ext()
|
|
196
|
+
{
|
|
197
|
+
g_ktoblzcheck = rb_define_module("KtoBlzCheck");
|
|
198
|
+
g_error = rb_define_class_under(g_ktoblzcheck, "Error", rb_eStandardError);
|
|
199
|
+
rb_define_method(g_ktoblzcheck, "initialize", init, -1);
|
|
200
|
+
rb_define_method(g_ktoblzcheck, "check", check, 2 );
|
|
201
|
+
rb_define_method(g_ktoblzcheck, "num_records", num_records, 0 );
|
|
202
|
+
rb_define_method(g_ktoblzcheck, "close", close_anc, 0);
|
|
203
|
+
rb_define_method(g_ktoblzcheck, "find", find_info, 1 );
|
|
204
|
+
rb_define_const(g_ktoblzcheck, "OK", INT2FIX(0));
|
|
205
|
+
rb_define_const(g_ktoblzcheck, "UNKNOWN", INT2FIX(1));
|
|
206
|
+
rb_define_const(g_ktoblzcheck, "ERROR", INT2FIX(2));
|
|
207
|
+
rb_define_const(g_ktoblzcheck, "BANK_NOT_KNOWN", INT2FIX(3));
|
|
208
|
+
}
|
data/lib/ktoblzcheck.rb
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Generated by jeweler
|
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
|
4
|
+
# -*- encoding: utf-8 -*-
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = %q{rbktoblzcheck}
|
|
8
|
+
s.version = "0.1.0"
|
|
9
|
+
|
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
+
s.authors = ["Sascha Loetz", "Kim Rudolph"]
|
|
12
|
+
s.date = %q{2010-07-20}
|
|
13
|
+
s.default_executable = %q{kbc-ruby}
|
|
14
|
+
s.email = %q{kim.rudolph@web.de}
|
|
15
|
+
s.executables = ["kbc-ruby"]
|
|
16
|
+
s.extensions = ["ext/extconf.rb"]
|
|
17
|
+
s.files = [
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"README",
|
|
20
|
+
"Rakefile",
|
|
21
|
+
"VERSION.yml",
|
|
22
|
+
"bin/kbc-ruby",
|
|
23
|
+
"ext/extconf.rb",
|
|
24
|
+
"ext/ktoblzcheck.c",
|
|
25
|
+
"lib/ktoblzcheck.rb",
|
|
26
|
+
"rbktoblzcheck.gemspec",
|
|
27
|
+
"test/test-bankdata.txt",
|
|
28
|
+
"test/test-ktoblzcheck-all.rb",
|
|
29
|
+
"test/test-ktoblzcheck.rb"
|
|
30
|
+
]
|
|
31
|
+
s.homepage = %q{http://github.com/krudolph/rbktoblzcheck}
|
|
32
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
33
|
+
s.require_paths = ["lib", "ext"]
|
|
34
|
+
s.rubygems_version = %q{1.3.7}
|
|
35
|
+
s.summary = %q{rbktoblzcheck is an interface for libktoblzcheck, a library to check German account numbers and bank codes. See http://ktoblzcheck.sourceforge.net for details.}
|
|
36
|
+
s.test_files = [
|
|
37
|
+
"test/test-ktoblzcheck-all.rb",
|
|
38
|
+
"test/test-ktoblzcheck.rb"
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
if s.respond_to? :specification_version then
|
|
42
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
43
|
+
s.specification_version = 3
|
|
44
|
+
|
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
46
|
+
else
|
|
47
|
+
end
|
|
48
|
+
else
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
10000000 09 Bundesbank Berlin
|
|
2
|
+
10010010 24 Postbank Berlin
|
|
3
|
+
10010111 13 SEB Berlin
|
|
4
|
+
10010222 10 ABN AMRO Bank Ndl Deutschland Berlin
|
|
5
|
+
10010424 09 Aareal Bank Berlin
|
|
6
|
+
10020000 69 Berliner Bank Ndl d Landesbank Berlin Berlin
|
|
7
|
+
10020100 09 Riggs Bank Europe Berlin
|
|
8
|
+
10020200 60 ING BHF-BANK Berlin
|
|
9
|
+
10020500 09 Sozialbank Berlin
|
|
10
|
+
10020890 99 Bayer Hypo- und Vereinsbank Berlin
|
|
11
|
+
10022200 69 Bankgesellschaft Berlin Berlin
|
|
12
|
+
10030200 09 Berlin-Hannoversche Hypothekenbank Berlin
|
|
13
|
+
10030400 09 ABK-Kreditbank Berlin
|
|
14
|
+
10030500 09 Bankhaus L�bbecke Ndl Berlin, Fasanenstra�e Berlin
|
|
15
|
+
10030600 09 Bankhaus Oswald Kruber Berlin
|
|
16
|
+
10030700 16 Gries & Heissel - Bankiers Berlin
|
|
17
|
+
10040000 13 Commerzbank Berlin (West) Berlin
|
|
18
|
+
10045050 13 Commerzbank Service-BZ Berlin
|
|
19
|
+
10050000 20 Landesbank Berlin -Gz- zgl Berliner Sparkasse Berlin
|
|
20
|
+
10050001 20 Landesbank Berlin -Girozentrale- Berlin
|
|
21
|
+
10050005 09 Landesbank Berlin -Girozentrale- E 1 Berlin
|
|
22
|
+
10050006 09 Landesbank Berlin -Girozentrale- E 2 Berlin
|
|
23
|
+
10050500 09 LBS Ost Berlin Berlin
|
|
24
|
+
10050600 08 WestLB Berlin Berlin
|
|
25
|
+
10050999 09 DekaBank Berlin Berlin
|
|
26
|
+
10060198 06 Pax-Bank Berlin
|
|
27
|
+
10060237 33 Evangelische Darlehnsgenossenschaft Berlin
|
|
28
|
+
10070000 63 Deutsche Bank Fil Berlin Berlin
|
|
29
|
+
10070024 63 Deutsche Bank Privat und Gesch�ftskunden F 700 Berlin
|
|
30
|
+
10070989 63 Eurohypo Ndl DB Berlin
|
|
31
|
+
10080000 76 Dresdner Bank zgl f Bank f Handel u Industrie Berlin
|
|
32
|
+
10080005 76 Dresdner Bank Zw A Berlin
|
|
33
|
+
10080006 76 Dresdner Bank Zw B Berlin
|
|
34
|
+
10080088 76 Dresdner Bank Berlin Bs 88 Berlin
|
|
35
|
+
10080090 76 Dresdner Bank Gf Berlin Berlin
|
|
36
|
+
10080900 76 Dresdner Bank Otto Scheurmann Berlin
|
|
37
|
+
10089260 09 Dresdner Bank ITGK Berlin
|
|
38
|
+
10090000 06 Berliner Volksbank Berlin
|
|
39
|
+
10090300 09 Bank f�r Schiffahrt (BFS) Fil d Ostfr VB Leer Berlin
|
|
40
|
+
10090400 09 Deutsche Genossenschafts-Hypothekenbank Berlin
|
|
41
|
+
10090603 14 Deutsche Apotheker- und �rztebank Berlin
|
|
42
|
+
20000000 09 Bundesbank Hamburg
|
|
43
|
+
20010020 24 Postbank (Giro) Hamburg
|
|
44
|
+
20010111 13 SEB Hamburg
|
|
45
|
+
20010200 09 HSH Nordbank Hypo Hamburg
|
|
46
|
+
20010424 09 Aareal Bank Hamburg
|
|
47
|
+
20010800 09 Hanseatische i-Bank Hamburg
|
|
48
|
+
20020200 09 SEB Merchant Bank Hamburg Hamburg
|
|
49
|
+
20020500 09 Jyske Bank Fil Hamburg Hamburg
|
|
50
|
+
20020860 70 Bayer Hypo- und Vereinsbank(ehem. Hypo) Hamburg
|
|
51
|
+
20020900 09 Signal Iduna Bauspar Hamburg
|
|
52
|
+
20030000 68 Vereins- und Westbank Hamburg
|
|
53
|
+
20030300 06 Donner Bank, C.H. Hamburg
|
|
54
|
+
20030400 00 Marcard, Stein & Co Bankiers Hamburg
|
|
55
|
+
20030500 06 Yapi Kredi Bank Deutschland Hamburg
|
|
56
|
+
20030600 09 Sydbank Fil Hamburg Hamburg
|
|
57
|
+
20030700 10 Merck Finck & Co Hamburg
|
|
58
|
+
20030900 06 Bankhaus W�lbern & Co Hamburg
|
|
59
|
+
20040000 13 Commerzbank Hamburg
|
|
60
|
+
30000000 09 Bundesbank D�sseldorf
|
|
61
|
+
30010111 13 SEB D�sseldorf
|
|
62
|
+
30010200 09 AEGON Bank D�sseldorf
|
|
63
|
+
30010400 09 IKB Deutsche Industriebank D�sseldorf
|
|
64
|
+
30010700 09 Bank of Tokyo-Mitsubishi, The - D�sseldorf
|
|
65
|
+
30010900 09 Nationalbank von Griechenland Fil D�sseldorf D�sseldorf
|
|
66
|
+
30020000 32 Westfalenbank D�sseldorf
|
|
67
|
+
30020300 10 Comfort Card Services Ratingen
|
|
68
|
+
30020400 00 Falke Bank D�sseldorf
|
|
69
|
+
30020500 60 ING BHF-BANK D�sseldorf
|
|
70
|
+
30020700 09 Mizuho Corporate Bank Ltd Fil D�sseldorf D�sseldorf
|
|
71
|
+
30020800 06 Commercial Bank of Greece (Germany) D�sseldorf
|
|
72
|
+
30020900 57 Citibank Privatkunden D�sseldorf
|
|
73
|
+
30020941 57 Citibank Privatkunden Region M�nchen M�nchen
|
|
74
|
+
30020944 57 Citibank Privatkunden Region Duisburg Duisburg
|
|
75
|
+
30020945 57 Citibank Privatkunden Region Hannover Hannover
|
|
76
|
+
30020946 57 Citibank Privatkunden Region Mannheim Mannheim
|
|
77
|
+
30020947 57 Citibank Privatkunden Region Gelsenkirchen Gelsenkirchen
|
|
78
|
+
30020948 57 Citibank Privatkunden Region Hamburg Hamburg
|
|
79
|
+
30020949 57 Citibank Privatkunden Region K�ln K�ln
|
|
80
|
+
30030100 56 SBroker Wiesbaden
|
|
81
|
+
30030880 56 HSBC Trinkaus & Burkhardt D�sseldorf
|
|
82
|
+
30030900 00 Merck Finck & Co D�sseldorf
|
|
83
|
+
30040000 13 Commerzbank D�sseldorf
|
|
84
|
+
30050000 08 WestLB D�sseldorf D�sseldorf
|
|
85
|
+
30050110 00 Stadtsparkasse D�sseldorf D�sseldorf
|
|
86
|
+
30052525 08 Landesbank NRW D�sseldorf D�sseldorf
|
|
87
|
+
30055500 09 dwpbank D�sseldorf
|
|
88
|
+
30060010 44 Westdeutsche Genossenschafts-Zentralbank D�sseldorf
|
|
89
|
+
30060601 14 Deutsche Apotheker- und �rztebank Ndl D�sseldorf
|
|
90
|
+
30060992 91 PSD Bank Rhein-Ruhr D�sseldorf
|
|
91
|
+
30070010 63 Deutsche Bank D�sseldorf
|
|
92
|
+
30070024 63 Deutsche Bank Privat und Gesch�ftskunden D�sseldorf
|
|
93
|
+
30070989 63 Eurohypo Ndl DB D�sseldorf
|
|
94
|
+
30080000 76 Dresdner Bank D�sseldorf
|
|
95
|
+
30080005 76 Dresdner Bank Zw 05 D�sseldorf
|
|
96
|
+
30080022 76 Dresdner Bank Ztv 22 D�sseldorf
|
|
97
|
+
30080038 76 Dresdner Bank Zw 38 D�sseldorf
|
|
98
|
+
40000000 09 Bundesbank M�nster, Westf
|
|
99
|
+
40010111 13 SEB M�nster, Westf
|
|
100
|
+
40030000 61 M�nsterl�ndische Bank Thie & Co M�nster, Westf
|
|
101
|
+
40040028 13 Commerzbank M�nster, Westf
|
|
102
|
+
40050000 08 WestLB M�nster M�nster, Westf
|
|
103
|
+
40050150 00 Sparkasse M�nsterland Ost M�nster, Westf
|
|
104
|
+
40051475 00 Sparkasse Warendorf -alt- Warendorf
|
|
105
|
+
40052525 08 Landesbank NRW M�nster M�nster, Westf
|
|
106
|
+
40060000 44 Westdeutsche Genossenschafts-Zentralbank M�nster, Westf
|
|
107
|
+
40060104 34 DGM Ev Darlehns-Genossenschaft -alt- M�nster, Westf
|
|
108
|
+
40060265 34 DKM Darlehnskasse M�nster M�nster, Westf
|
|
109
|
+
40060300 09 Westf�lische Landschaft Bodenkreditbank M�nster, Westf
|
|
110
|
+
50000000 09 Bundesbank Frankfurt am Main
|
|
111
|
+
50010060 24 Postbank Frankfurt am Main
|
|
112
|
+
50010111 13 SEB Frankfurt am Main
|
|
113
|
+
50010200 09 Akbank T.A.S. Ndl Deutschland Frankfurt am Main
|
|
114
|
+
50010424 09 Aareal Bank Frankfurt am Main
|
|
115
|
+
50010517 09 Allgemeine Deutsche Direktbank Frankfurt am Main
|
|
116
|
+
50010700 09 Degussa Bank Frankfurt am Main
|
|
117
|
+
50010800 09 DEPFA Deutsche Pfandbriefbank Frankfurt am Main
|
|
118
|
+
50010900 09 Bank of America Frankfurt am Main
|
|
119
|
+
50012800 09 Alte Leipziger Bauspar Bad Homburg v d H�he
|
|
120
|
+
50020160 70 Bayer Hypo- und Vereinsbank Ndl 427 Aschheim
|
|
121
|
+
50020200 60 ING BHF-BANK Frankfurt am Main
|
|
122
|
+
60000000 09 Bundesbank Stuttgart
|
|
123
|
+
60010070 24 Postbank Stuttgart
|
|
124
|
+
60010111 13 SEB Stuttgart
|
|
125
|
+
60010424 09 Aareal Bank Stuttgart
|
|
126
|
+
60010500 09 W�rttembergische Hypothekenbank Stuttgart
|
|
127
|
+
60010600 09 Nationalbank von Griechenland Fil Stuttgart Stuttgart
|
|
128
|
+
60010700 09 Landeskreditbank Baden-W�rttemberg F�rderbank Stuttgart
|
|
129
|
+
60020030 65 Baden-W�rttembergische Bank Stuttgart
|
|
130
|
+
60020100 09 Schw�bische Bank Stuttgart
|
|
131
|
+
60020290 99 Bayer Hypo- und Vereinsbank Stuttgart
|
|
132
|
+
60020300 09 VON ESSEN Bankgesellschaft Stuttgart
|
|
133
|
+
60020400 09 GE Bank K�ln
|
|
134
|
+
70000000 09 Bundesbank M�nchen
|
|
135
|
+
70010080 24 Postbank (Giro) M�nchen
|
|
136
|
+
70010111 13 SEB M�nchen
|
|
137
|
+
70010424 09 Aareal Bank M�nchen
|
|
138
|
+
70010500 09 Hypo Real Estate Bank M�nchen M�nchen
|
|
139
|
+
70011000 09 HSH Nordbank Hypo Hamburg
|
|
140
|
+
70011200 09 Bank Vontobel �sterreich M�nchen
|
|
141
|
+
80000000 09 Bundesbank Halle (Saale)
|
|
142
|
+
80020086 99 Bayer Hypo- und Vereinsbank Halle (Saale)
|
|
143
|
+
80020087 99 Bayer Hypo- und Vereinsbank Dessau, Anh
|
|
144
|
+
80020130 65 Baden-W�rttembergische Bank Halle (Saale)
|
|
145
|
+
80040000 13 Commerzbank Halle (Saale)
|
|
146
|
+
80050500 20 Kreissparkasse Merseburg-Querfurt Merseburg
|
|
147
|
+
80053000 20 Sparkasse Burgenlandkreis Zeitz, Elster
|
|
148
|
+
80053502 52 Kreissparkasse Quedlinburg Quedlinburg
|
|
149
|
+
80053522 52 Kreissparkasse Aschersleben Aschersleben, Sachs-Anh
|
|
150
|
+
80053552 52 Kreissparkasse Sangerhausen Sangerhausen
|
|
151
|
+
87080000 76 Dresdner Bank Chemnitz, Sachs
|
|
152
|
+
87095824 06 Volksbank Vogtland Plauen, Vogtl
|
|
153
|
+
87095934 06 Volksbank Zwickau Zwickau
|
|
154
|
+
87095974 06 Volksbank-Raiffeisenbank Glauchau Glauchau
|
|
155
|
+
87096034 06 Volksbank Erzgebirge Annaberg-Buchholz
|
|
156
|
+
87096074 06 Freiberger Bank Freiberg, Sachs
|
|
157
|
+
87096124 06 Volksbank Mittweida
|
|
158
|
+
87096214 06 Volksbank Chemnitz Chemnitz, Sachs
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# Test program for rbktoblzcheck Ruby extension:
|
|
4
|
+
#
|
|
5
|
+
# Reads all bank codes from an ktoblzcheck data file
|
|
6
|
+
# and checks them against the same file using the Ruby
|
|
7
|
+
# bindings for libktoblzecheck.
|
|
8
|
+
#
|
|
9
|
+
# Path to data file must be given as command line parameter.
|
|
10
|
+
#
|
|
11
|
+
# (c) 2004 Sascha Loetz (sloetz ( a t ) web.de)
|
|
12
|
+
#
|
|
13
|
+
# See LICENSE for the BSD-style license for this code.
|
|
14
|
+
#
|
|
15
|
+
# This file is part of the rbktoblzcheck package
|
|
16
|
+
# available at http://www.vdp-software.com/Rbktoblzcheck.html
|
|
17
|
+
#
|
|
18
|
+
# $Id: test-ktoblzcheck-all.rb,v 1.1 2004/10/28 19:10:19 vdpsoftware Exp $
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
require 'ktoblzcheck'
|
|
22
|
+
|
|
23
|
+
$failed=0
|
|
24
|
+
$ok=0
|
|
25
|
+
|
|
26
|
+
if ARGV[0].nil?
|
|
27
|
+
STDERR.puts "Usage: #{File.basename($0)} /path/to/bankdata.file"
|
|
28
|
+
exit(2)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
KtoBlzCheck.new(ARGV[0]) do |kbc|
|
|
32
|
+
File.open(ARGV[0],"r") do |df|
|
|
33
|
+
while line=df.gets
|
|
34
|
+
blz,algo,name,location=line.chomp.split("\t");
|
|
35
|
+
res=kbc.find(blz.to_s)
|
|
36
|
+
print "File: #{blz} / #{name} / #{location} => KtoBlzCheck name: #{res[0]} location: #{res[1]} ==> "
|
|
37
|
+
if res[0]==name and res[1]==location
|
|
38
|
+
print "OK\n"
|
|
39
|
+
$ok+=1
|
|
40
|
+
else
|
|
41
|
+
print "FAILED\n"
|
|
42
|
+
$failed+=1
|
|
43
|
+
end
|
|
44
|
+
end # while
|
|
45
|
+
end # File.open
|
|
46
|
+
end # new
|
|
47
|
+
|
|
48
|
+
print "\n\nResult:\nLines checked: #{$ok+$failed}\nOK: #{$ok}\nFailure: #{$failed}\n"
|
|
49
|
+
|
|
50
|
+
exit(1) if $failed>0
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# Test program for rbktoblzcheck Ruby extension:
|
|
4
|
+
#
|
|
5
|
+
# Checks some bank codes with both initialisation modes
|
|
6
|
+
# for KtoBlzCheck.
|
|
7
|
+
#
|
|
8
|
+
# (c) 2004 Sascha Loetz (sloetz ( a t ) web.de)
|
|
9
|
+
#
|
|
10
|
+
# See LICENSE for the BSD-style license for this code.
|
|
11
|
+
#
|
|
12
|
+
# This file is part of the rbktoblzcheck package
|
|
13
|
+
# available at http://www.vdp-software.com/Rbktoblzcheck.html
|
|
14
|
+
#
|
|
15
|
+
# $Id: test-ktoblzcheck.rb,v 1.1 2004/10/28 19:10:19 vdpsoftware Exp $
|
|
16
|
+
|
|
17
|
+
require 'ktoblzcheck'
|
|
18
|
+
|
|
19
|
+
# file with testdata
|
|
20
|
+
$df='test-bankdata.txt'
|
|
21
|
+
# some bank codes to ck, all listed in the test data file
|
|
22
|
+
$find=[20040000,30020947,40050150,50012800,60020300,70010500,80053552,87096124]
|
|
23
|
+
|
|
24
|
+
# exit code
|
|
25
|
+
$ec=0
|
|
26
|
+
|
|
27
|
+
#
|
|
28
|
+
# Use block syntax
|
|
29
|
+
#
|
|
30
|
+
print "\nUsing block syntax...\n"
|
|
31
|
+
KtoBlzCheck.new($df) do |kbc|
|
|
32
|
+
print "\nCurrently #{kbc.num_records} records available in the database\n"
|
|
33
|
+
$find.each do |bc|
|
|
34
|
+
res=kbc.find(bc.to_s)
|
|
35
|
+
if nil==res[0]
|
|
36
|
+
print "Couldn't find bank code #{bc}\n"
|
|
37
|
+
$ec=1
|
|
38
|
+
else
|
|
39
|
+
print "Bank code #{bc} => bank name: #{res[0]} / location (city): #{res[1]}\n"
|
|
40
|
+
end
|
|
41
|
+
end # each
|
|
42
|
+
end # do
|
|
43
|
+
|
|
44
|
+
#
|
|
45
|
+
# Use "normal" syntax
|
|
46
|
+
#
|
|
47
|
+
# IMPORTANT: you must call #close when your finished,
|
|
48
|
+
# otherwise resource leaks may occur.
|
|
49
|
+
#
|
|
50
|
+
print "\nUsing 'normal' syntax...\n"
|
|
51
|
+
$kbc=KtoBlzCheck.new($df)
|
|
52
|
+
print "\nCurrently #{$kbc.num_records} records available in the database\n"
|
|
53
|
+
$find.each do |bc|
|
|
54
|
+
res=$kbc.find(bc.to_s)
|
|
55
|
+
if nil==res[0]
|
|
56
|
+
print "Couldn't find bank code #{bc}\n"
|
|
57
|
+
$ec=1
|
|
58
|
+
else
|
|
59
|
+
print "Bank code: #{bc} => name: #{res[0]} / location (city): #{res[1]}\n"
|
|
60
|
+
end
|
|
61
|
+
end # do
|
|
62
|
+
|
|
63
|
+
$kbc.close
|
|
64
|
+
|
|
65
|
+
exit $ec
|
metadata
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rbktoblzcheck
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
prerelease: false
|
|
5
|
+
segments:
|
|
6
|
+
- 0
|
|
7
|
+
- 1
|
|
8
|
+
- 0
|
|
9
|
+
version: 0.1.0
|
|
10
|
+
platform: ruby
|
|
11
|
+
authors:
|
|
12
|
+
- Sascha Loetz
|
|
13
|
+
- Kim Rudolph
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2010-07-20 00:00:00 +02:00
|
|
19
|
+
default_executable: kbc-ruby
|
|
20
|
+
dependencies: []
|
|
21
|
+
|
|
22
|
+
description:
|
|
23
|
+
email: kim.rudolph@web.de
|
|
24
|
+
executables:
|
|
25
|
+
- kbc-ruby
|
|
26
|
+
extensions:
|
|
27
|
+
- ext/extconf.rb
|
|
28
|
+
extra_rdoc_files: []
|
|
29
|
+
|
|
30
|
+
files:
|
|
31
|
+
- LICENSE
|
|
32
|
+
- README
|
|
33
|
+
- Rakefile
|
|
34
|
+
- VERSION.yml
|
|
35
|
+
- bin/kbc-ruby
|
|
36
|
+
- ext/extconf.rb
|
|
37
|
+
- ext/ktoblzcheck.c
|
|
38
|
+
- lib/ktoblzcheck.rb
|
|
39
|
+
- rbktoblzcheck.gemspec
|
|
40
|
+
- test/test-bankdata.txt
|
|
41
|
+
- test/test-ktoblzcheck-all.rb
|
|
42
|
+
- test/test-ktoblzcheck.rb
|
|
43
|
+
has_rdoc: true
|
|
44
|
+
homepage: http://github.com/krudolph/rbktoblzcheck
|
|
45
|
+
licenses: []
|
|
46
|
+
|
|
47
|
+
post_install_message:
|
|
48
|
+
rdoc_options:
|
|
49
|
+
- --charset=UTF-8
|
|
50
|
+
require_paths:
|
|
51
|
+
- lib
|
|
52
|
+
- ext
|
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
|
+
none: false
|
|
55
|
+
requirements:
|
|
56
|
+
- - ">="
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
segments:
|
|
59
|
+
- 0
|
|
60
|
+
version: "0"
|
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
|
+
none: false
|
|
63
|
+
requirements:
|
|
64
|
+
- - ">="
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
segments:
|
|
67
|
+
- 0
|
|
68
|
+
version: "0"
|
|
69
|
+
requirements: []
|
|
70
|
+
|
|
71
|
+
rubyforge_project:
|
|
72
|
+
rubygems_version: 1.3.7
|
|
73
|
+
signing_key:
|
|
74
|
+
specification_version: 3
|
|
75
|
+
summary: rbktoblzcheck is an interface for libktoblzcheck, a library to check German account numbers and bank codes. See http://ktoblzcheck.sourceforge.net for details.
|
|
76
|
+
test_files:
|
|
77
|
+
- test/test-ktoblzcheck-all.rb
|
|
78
|
+
- test/test-ktoblzcheck.rb
|