king_dtaus 2.0.2 → 2.0.3.pre

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,2 +1,7 @@
1
1
  source :rubygems
2
- gemspec
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem "rcov"
7
+ end
data/README.markdown CHANGED
@@ -18,35 +18,37 @@ We love building payment applications.
18
18
 
19
19
  ## Features
20
20
 
21
- * Create DTAUS debit transfer (Lastschrift)
22
- * Create DTAUS credit transfer (Gutschrift)
23
- * Create DTAZV debit transfer
24
- * 100% test coverage to ensure software quality
25
- * works with ruby 1.8 & 1.9.2
21
+ * Create DTAUS debit advice (Lastschrift)
22
+ * Create DTAUS credit advice (Gutschrift)
23
+ * Create DTAZV debit advice
24
+ * High test coverage to ensure software quality
26
25
 
27
- ## Version Info
26
+ ## Beta Version Info
28
27
 
29
- Version 2 has breaking changes!
28
+ We are working on version 2 of the gem with some breaking changes!
30
29
 
31
30
  * account attributes now passed in as hash
32
- * renamed account.client_xy => owner_xy
33
- * renamed account.account_number => bank_account_number
31
+ * renamed of account attributes client_xy => owner_xy
32
+ * renamed account.account_number to bank_account_number
34
33
  * added iban/bic to account
35
34
  * DTAZV added
36
35
 
37
- If you want to stay with v1 just pin it in your Gemfile:
38
-
39
- gem "king_dtaus", "<2"
36
+ To try it use:
37
+ gem install king_dtaus --pre
38
+ # or add a pre version to your Gemfile
39
+ gem 'king_dtaus', '2.0.3.pre'
40
40
 
41
41
  ## TODOs
42
42
 
43
- * some more edge-case tests needed, we need your feedback here!
43
+ * first gem with no todo's - never seen it, huh? - just kidding
44
+ * some more edge-case tests needed
44
45
 
45
46
  ## Resources
46
47
 
47
48
  * SalesKing: http://salesking.eu
48
49
  * DTAZV-Viewer: http://www.meta-evolutions.de/pages/artikel-20070630-dtazv-datei-betrachter.html
49
50
  * DTA/DTAZV PHP Pear: http://pear.php.net/package/Payment_DTA
51
+ * Ruby Kernel Module: http://www.ruby-doc.org/core/classes/Kernel.html
50
52
  * Windata ZV-Tools: http://www.windata.de/Site/2Produkte2/ZVTools.aspx
51
53
  * The Swift Codes: http://www.theswiftcodes.com/
52
54
  * StarMoney: http://www.starmoney.de/index.php?id=starmoneybusiness_testen
@@ -89,7 +91,7 @@ Here are some examples how to create a DTA- or DTAZV-File. Also check out the sp
89
91
 
90
92
  ### DTAZV
91
93
 
92
- @dtazv = KingDta::Dtazv.new()
94
+ @dtazv = KingDta::Dtazv.new(Date.today)
93
95
 
94
96
  # sender account
95
97
  @dtazv.account = KingDta::Account.new(
@@ -113,7 +115,7 @@ Here are some examples how to create a DTA- or DTAZV-File. Also check out the sp
113
115
  # get output as string
114
116
  @dtazv.create
115
117
 
116
- also make sure to read the code and the specs
118
+ also make sure to read the specs
117
119
 
118
120
  ## Credits
119
121
 
@@ -123,6 +125,9 @@ Bugfixes and enhancements by
123
125
  * Kim Rudolph - https://github.com/krudolph
124
126
  * Thorsten Böttger - https://github.com/alto
125
127
  * Jan Kus - https://github.com/koos
126
- * used https://rubygems.org/gems/DTAUS as a starting point
127
128
 
128
- Copyright (c) 2009-2011 Georg Leciejewski (SalesKing), Jan Kus (Railslove), released under the MIT license
129
+ This gem used https://rubygems.org/gems/DTAUS as a starting point.
130
+ It was disected, turned into a real class structure, bugs were fixed and
131
+ of course a full test suite ensures its functionality.
132
+
133
+ Copyright (c) 2009-2011 Georg Leciejewski (SalesKing), Jan Kus (Railslove), released under the MIT license
data/Rakefile CHANGED
@@ -1,18 +1,31 @@
1
1
  require 'rake'
2
- require 'rspec'
3
2
  require 'rspec/core/rake_task'
4
- require 'rdoc/task'
5
- require 'bundler/gem_helper'
6
- Bundler::GemHelper.install_tasks
3
+
7
4
  desc "Run specs"
8
5
  RSpec::Core::RakeTask.new
6
+
9
7
  task :default => :spec
10
8
 
11
- desc 'Generate documentation'
12
- Rake::RDocTask.new(:rdoc) do |rdoc|
13
- rdoc.rdoc_dir = 'docs/rdoc'
14
- rdoc.title = 'KingPdf'
15
- rdoc.options << '--line-numbers' << '--inline-source'
16
- rdoc.rdoc_files.include('README')
17
- rdoc.rdoc_files.include('lib/**/*.rb')
9
+ RSpec::Core::RakeTask.new(:coverage) do |t|
10
+ t.rcov = true
11
+ t.rcov_opts = %q[--exclude "spec"]
12
+ t.verbose = true
13
+ end
14
+
15
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
16
+
17
+ begin
18
+ require 'jeweler'
19
+ Jeweler::Tasks.new do |gem|
20
+ gem.name = "king_dtaus"
21
+ gem.summary = %Q{Generate DTAUS strings and files}
22
+ gem.description = %Q{DTAUS is a text-based format, to create bank transfers for german banks. This gem helps with the creation of those transfer files.}
23
+ gem.email = "gl@salesking.eu"
24
+ gem.homepage = "http://github.com/salesking/king_dtaus"
25
+ gem.authors = ["Georg Leciejewski", "Georg Ledermann", "Jan Kus"]
26
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
27
+ end
28
+ Jeweler::GemcutterTasks.new
29
+ rescue LoadError
30
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
18
31
  end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.0.3.pre
data/docs/dtazv.pdf ADDED
Binary file
Binary file
@@ -0,0 +1,7 @@
1
+ 0256P37040044 Commerzbank Köln 5th avenue 55323 los angeles1106080100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2
+
3
+ 0256Q370400447828970037 GIMME YOUR MONEY AG 6th avenue 445555 los angeles11060801110608N000000000000000000000000000000000000000000000000000000000000000000000000000000
4
+
5
+ 0572T37040044EUR782897003711060837040044EUR0037040044 MARKF1100 FIDEL CASTRO 0 GR1601101250000000012300695EUR00000000000220025 0 0 0 0 00013 0 00000000000000000000000000000000000000000000000000000 00
6
+
7
+ 256Y000000000000000000000000000000000000000000000000000000000000000000000001 0
data/king_dtaus.gemspec CHANGED
@@ -1,34 +1,76 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
1
4
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path('../lib', __FILE__)
3
- require 'king_dta/version'
4
5
 
5
6
  Gem::Specification.new do |s|
6
7
  s.name = %q{king_dtaus}
7
- s.version = KingDta::VERSION
8
+ s.version = "2.0.3.pre"
8
9
 
9
- s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
10
- s.authors = ['Georg Leciejewski', 'Georg Ledermann', 'Jan Kus']
11
- s.date = %q{2011-11-15}
12
- s.summary = %q{Generate DTA/DTAUS and DTAZV bank transfer files .. the easy way}
13
- s.description = %q{DTA/DTAUS and DTAZV are text-based formats to create bank transfers for german banks.
14
- This gem creates DTA/DATAUS files for inner german credit and debit(Gutschrift/Lastschrift) transfers.
15
- It is also capable of creating DTAZV credit-files for transfers from Germany to European SEPA region.}
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Georg Leciejewski", "Georg Ledermann", "Jan Kus"]
12
+ s.date = %q{2011-09-03}
13
+ s.description = %q{DTAUS is a text-based format, to create bank transfers for german banks. This gem helps with the creation of those transfer files.}
16
14
  s.email = %q{gl@salesking.eu}
17
- s.extra_rdoc_files = ['README.markdown']
18
- s.executables = nil
19
- s.files = `git ls-files`.split("\n").reject{|i| i[/^docs\//] }
20
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
-
15
+ s.extra_rdoc_files = [
16
+ "README.markdown"
17
+ ]
18
+ s.files = [
19
+ ".travis.yml",
20
+ "Gemfile",
21
+ "MIT-LICENSE",
22
+ "README.markdown",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "docs/dtazv.pdf",
26
+ "docs/dtazv_bank_bbk.pdf",
27
+ "docs/example.output",
28
+ "king_dtaus.gemspec",
29
+ "lib/king_dta/account.rb",
30
+ "lib/king_dta/booking.rb",
31
+ "lib/king_dta/dta.rb",
32
+ "lib/king_dta/dtaus.rb",
33
+ "lib/king_dta/dtazv.rb",
34
+ "lib/king_dta/exception.rb",
35
+ "lib/king_dta/helper.rb",
36
+ "lib/king_dtaus.rb",
37
+ "spec/account_spec.rb",
38
+ "spec/booking_spec.rb",
39
+ "spec/dtaus_spec.rb",
40
+ "spec/dtazv_spec.rb",
41
+ "spec/helper_spec.rb",
42
+ "spec/spec_helper.rb"
43
+ ]
22
44
  s.homepage = %q{http://github.com/salesking/king_dtaus}
23
- s.require_paths = ['lib']
45
+ s.require_paths = ["lib"]
24
46
  s.rubygems_version = %q{1.6.2}
47
+ s.summary = %q{Generate DTAUS strings and files}
25
48
 
26
- s.add_runtime_dependency 'i18n'
27
- s.add_development_dependency 'rdoc'
28
- s.add_development_dependency 'rspec'
29
- s.add_development_dependency 'simplecov'
30
- s.add_development_dependency 'mocha'
31
- s.add_development_dependency 'rake', '>= 0.9.2'
49
+ if s.respond_to? :specification_version then
50
+ s.specification_version = 3
32
51
 
52
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
53
+ s.add_runtime_dependency(%q<king_dtaus>, [">= 0"])
54
+ s.add_development_dependency(%q<rspec>, [">= 0"])
55
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
56
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
57
+ s.add_development_dependency(%q<mocha>, [">= 0"])
58
+ s.add_development_dependency(%q<i18n>, [">= 0"])
59
+ else
60
+ s.add_dependency(%q<king_dtaus>, [">= 0"])
61
+ s.add_dependency(%q<rspec>, [">= 0"])
62
+ s.add_dependency(%q<jeweler>, [">= 0"])
63
+ s.add_dependency(%q<simplecov>, [">= 0"])
64
+ s.add_dependency(%q<mocha>, [">= 0"])
65
+ s.add_dependency(%q<i18n>, [">= 0"])
66
+ end
67
+ else
68
+ s.add_dependency(%q<king_dtaus>, [">= 0"])
69
+ s.add_dependency(%q<rspec>, [">= 0"])
70
+ s.add_dependency(%q<jeweler>, [">= 0"])
71
+ s.add_dependency(%q<simplecov>, [">= 0"])
72
+ s.add_dependency(%q<mocha>, [">= 0"])
73
+ s.add_dependency(%q<i18n>, [">= 0"])
74
+ end
33
75
  end
34
76
 
@@ -1,16 +1,17 @@
1
1
  # encoding: utf-8
2
2
  module KingDta
3
- # Bank account and owner information
3
+ # A bank account with name of the account owner,
4
+ # Kontodaten verwalten mit Name des Inhabers und Bank, Bankleitzahl und Kontonummer.
4
5
  class Account
5
6
  include KingDta::Helper
6
-
7
- attr_accessor :bank_street, :bank_city,
7
+
8
+ attr_accessor :bank_account_number, :bank_number, :bank_street, :bank_city,
8
9
  :bank_zip, :bank_name, :bank_country_code, :bank_iban,
9
10
  :bank_bic,
10
11
  :owner_name, :owner_number, :owner_street, :owner_city,
11
12
  :owner_zip_code, :owner_country_code
12
- attr_reader :bank_account_number, :bank_number
13
13
 
14
+ # TODO test
14
15
  def initialize(args={})
15
16
 
16
17
  @bank_street = convert_text(args.delete(:bank_street))
@@ -25,44 +26,23 @@ module KingDta
25
26
  end
26
27
 
27
28
  raise ArgumentError.new('Owner number too long, max 10 allowed') if @owner_number && "#{@owner_number}".length > 10
28
- raise ArgumentError.new('Owner street too long, max 35 allowed') if @owner_street && @owner_street.length > 35
29
- raise ArgumentError.new('Owner city too long, max 35 allowed') if @owner_city && @owner_city.length > 35
30
- raise ArgumentError.new('Owner country code too long, max 2 allowed') if @owner_country_code && @owner_country_code.length > 2
31
-
29
+ raise ArgumentError.new("Owner street too long, max 35 allowed") if @owner_street && @owner_street.length > 35
30
+ raise ArgumentError.new("Owner city too long, max 35 allowed") if @owner_city && @owner_city.length > 35
31
+ raise ArgumentError.new("Owner country code too long, max 2 allowed") if @owner_country_code && @owner_country_code.length > 2
32
32
 
33
- raise ArgumentError.new("Bank iban wrong length: #{@bank_iban.length}, must be between 15-34") if @bank_iban && !@bank_iban.length.between?(15,34)
34
- raise ArgumentError.new("Bank bic wrong length: #{@bank_bic.length} must be between 8-11") if @bank_bic && !@bank_bic.length.between?(8,11)
33
+ raise ArgumentError.new('Bank account number too long, max 35 allowed') if @bank_account_number && "#{@bank_account_number}".length > 35
34
+ raise ArgumentError.new("Bank account number cannot be 0") if @bank_account_number && @bank_account_number == 0
35
+ # raise ArgumentError.new('Bank iban too long, max 11 allowed') if @bank_iban && @bank_iban.between?(15,32)
35
36
 
36
- raise ArgumentError.new('Bank street too long, max 35 allowed') if @bank_street && @bank_street.length > 35
37
- raise ArgumentError.new('Bank city too long, max 35 allowed') if @bank_city && @bank_city.length > 35
38
- raise ArgumentError.new('Bank name too long, max 35 allowed') if @bank_name && @bank_name.length > 35
39
- raise ArgumentError.new('Bank country code too long, max 2 allowed') if @bank_country_code && @bank_country_code.length > 2
40
-
41
- @owner_country_code = @bank_iban[0..1 ] if @bank_iban && !@owner_country_code
42
- end
43
-
44
- # Cast given account number to integer. Strips spaces and leading zeros
45
- # from the bank account number.
46
- # DTA relies on integers for checksums and field values.
47
- # @param [String|Integer] number
48
- def bank_account_number=(number)
49
- nr_str = "#{number}".gsub(/\s/,'')
50
- raise ArgumentError.new('Bank account number too long, max 10 allowed') if nr_str.length > 10
51
- raise ArgumentError.new('Bank account number cannot be 0') if nr_str == '0'
52
-
53
- @bank_account_number = nr_str.to_i
54
- end
37
+ raise ArgumentError.new("Bank bic wrong length,#{@bank_bic.length} must be between 8-11") if @bank_bic && !@bank_bic.length.between?(8,11)
55
38
 
56
- # Cast given bank number to integer. Strips spaces and leading zeros
57
- # from the bank account number.
58
- # DTA relies on integers for checksums and field values.
59
- # @param [String|Integer] number
60
- def bank_number=(number)
61
- nr_str = "#{number}".gsub(/\s/,'')
62
- raise ArgumentError.new('Bank number too long, max 8 allowed') if nr_str.length > 8
63
- raise ArgumentError.new('Bank number cannot be 0') if nr_str == '0'
39
+ raise ArgumentError.new('Bank number too long, max 11 allowed') if @bank_number && "#{@bank_number}".length > 11
40
+ raise ArgumentError.new("Bank number cannot be 0") if @bank_number && @bank_number == 0
41
+ raise ArgumentError.new("Bank street too long, max 35 allowed") if @bank_street && @bank_street.length > 35
42
+ raise ArgumentError.new("Bank city too long, max 35 allowed") if @bank_city && @bank_city.length > 35
43
+ raise ArgumentError.new("Bank name too long, max 35 allowed") if @bank_name && @bank_name.length > 35
44
+ raise ArgumentError.new("Bank country code too long, max 2 allowed") if @bank_country_code && @bank_country_code.length > 2
64
45
 
65
- @bank_number = nr_str.to_i
66
46
  end
67
47
 
68
48
  def bank_zip_city
@@ -36,8 +36,8 @@ module KingDta
36
36
  def set_checksums
37
37
  @sum_bank_account_numbers, @sum_bank_numbers, @sum_values = 0,0,0
38
38
  bookings.each do |b|
39
- @sum_bank_account_numbers += b.account.bank_account_number
40
- @sum_bank_numbers += b.account.bank_number
39
+ @sum_bank_account_numbers += b.account.bank_account_number.to_i
40
+ @sum_bank_numbers += b.account.bank_number.to_i
41
41
  @sum_values += b.value
42
42
  end
43
43
  end
@@ -63,7 +63,7 @@ module KingDta
63
63
  # 11b 95 8 Ausführungsdatum Format DDMMJJJJ. max A7 + 15 Tage. Default Blanks.
64
64
  # 11c 103 24 Reserviert, 24 Blanks
65
65
  # 12 127 1 Währungskennzeichen "1" = Euro
66
- #
66
+ #
67
67
  # Insgesamt 128 Zeichen
68
68
  def add_a
69
69
  data = '0128'
@@ -74,7 +74,7 @@ module KingDta
74
74
  data += '%-27.27s' % @account.owner_name
75
75
  data += @date.strftime("%d%m%y") # creation date - today
76
76
  data += ' ' * 4
77
- data += '%010i' % @account.bank_account_number
77
+ data += '%010i' % @account.bank_account_number.to_i
78
78
  data += '%010i' % 0
79
79
  data += ' ' * 15
80
80
  data += '%8s' % @date.strftime("%d%m%Y") #Ausführungsdatum - ja hier 8 Stellen
@@ -153,13 +153,13 @@ module KingDta
153
153
  data1 = 'C'
154
154
  data1 += '%08i' % 0
155
155
  data1 += '%-08i' % booking.account.bank_number
156
- data1 += '%010i' % booking.account.bank_account_number
156
+ data1 += '%010i' % booking.account.bank_account_number.to_i
157
157
  data1 += '0%011i0' % (booking.account.owner_number || 0) #interne Kundennummer
158
158
  data1 += zahlungsart
159
159
  data1 += ' '
160
160
  data1 += '0' * 11
161
161
  data1 += '%08i' % @account.bank_number
162
- data1 += '%010i' % @account.bank_account_number
162
+ data1 += '%010i' % @account.bank_account_number.to_i
163
163
  data1 += '%011i' % booking.value #Betrag in Euro einschl. Nachkomma
164
164
  data1 += ' ' * 3
165
165
  data1 += '%-27.27s' % booking.account.owner_name
@@ -172,7 +172,7 @@ module KingDta
172
172
  booking_txt = booking.text || default_text
173
173
  #Erste 27 Zeichen
174
174
  #if text < 26 fill with spaces
175
- data2 += booking_txt[0..26].ljust(27)
175
+ data2 += booking_txt[0..26].ljust(27)
176
176
  booking_txt = booking_txt[27..999]
177
177
  # cut text into 27 long pieces
178
178
  while booking_txt && booking_txt.size > 0 && exts.size < 13
@@ -184,7 +184,7 @@ module KingDta
184
184
  data2 += '1' #EUR
185
185
  data2 += ' ' * 2
186
186
  # Gesamte Satzlänge ermitteln ( data1(+4) + data2 + Erweiterungen )
187
- data1 = "%04i#{data1}" % ( data1.size + 4 + data2.size + 2 + exts.size * 29 )
187
+ data1 = "%04i#{data1}" % ( data1.size + 4 + data2.size+ 2 + exts.size * 29 )
188
188
  raise "DTAUS: Längenfehler C/1 #{data1.size} nicht 128, #{booking.account.owner_name}" unless data1.size == 128
189
189
  dta_string << data1
190
190
  #Anzahl Erweiterungen anfügen
@@ -35,8 +35,9 @@ module KingDta
35
35
  # Datensatz Q - kurze Variante
36
36
  # Die Bundesbank nimmt Q-Sätze in 2 Varianten entgegen. Die lange Variante ist identisch mit
37
37
  # den von den Auftraggebern gelieferten Q-Sätzen. In der kurzen Variante sind nur die Felder
38
- # enthalten, die von der Bundesbank bei der Bearbeitung der Meldungen benötigt werden.
39
- # Beide Varianten dürfen in einer Datei vorkommen.
38
+ # enthalten, die von der Bundesbank bei der Bearbeitung der Meldungen benötigt werden; das in der
39
+ # kurzen Variante nicht enthaltene Feld ist in der folgenden Tabelle durch Schattierung und Kursivschrift
40
+ # kenntlich gemacht. Beide Varianten dürfen in einer Datei vorkommen.
40
41
  # [ Anmerk.: Bei der Kurzen Variante entfällt die Kundennummer ]
41
42
  #
42
43
  # === Fields
@@ -44,7 +45,7 @@ module KingDta
44
45
  # 1 1 4 Satzlänge numerisch bei Disketten und DFÜ
45
46
  # 2 5 1 Satzart Konstante "Q"
46
47
  # 3 6 8 BLZ Erstbeauftragtes Kreditinstitut
47
- # 4 14 10 Kontonummer Auftraggeber Entfällt bei der kurzen Variante
48
+ # 4 14 10 Kundennummer Entfällt bei der kurzen Variante
48
49
  # 5 24 4x35 Auftraggeberdaten Zeile 1 und 2: Name;
49
50
  # Zeile 3: Straße/Postfach; Zeile 4: Ort
50
51
  # 6 164 6 Erstellungsdatum Format: JJMMTT
@@ -66,7 +67,7 @@ module KingDta
66
67
  data1 += @date.strftime("%y%m%d") # Erstellungsdatum
67
68
  data1 += '01'
68
69
  data1 += @date.strftime("%y%m%d") # Ausführungstermin
69
- data1 += "N"
70
+ data1 += "N"
70
71
  data1 += "%02i" % 0
71
72
  data1 += '%08i' % 0
72
73
  data1 += '%068s' % ''
@@ -111,11 +112,13 @@ module KingDta
111
112
  # Pflicht, wenn T8 nicht belegt; nicht zu belegen bei Scheckziehungen,
112
113
  # 9b 68 4x35 Anschrift Bank des Zahlungsempfängers. Pflicht wenn T8 nicht belegt
113
114
  # Wenn Anschrift nicht bekannt„UNBEKANNT"
114
- # Zeile 1 und 2: Name Zeile 3: Straße Zeile 4: Ort
115
+ # Zeile 1 und 2: Name Zeile 3: Straße Zeile 4: Ort
115
116
  # Nicht zu belegen bei Scheckziehungen
116
117
  #
117
- # 10a 208 3 2-stelliger ISO-alpha-Ländercode des Zahlungsempfänger gemäß Länderverzeichnis für die Zahlungsbilanzstatistik; linksbündig zu belegen; 3. Stelle Leerzeichen
118
- # 10b 211 4x35 alpha Zahlungsempfänger bzw. Bei Zahlungsauftrag: Zahlungsempfänger Bei P P Angabe eines Scheckempfängers nicht P Angabe eines Scheck­ empfängers nicht möglich
118
+ # 10a 3 208 alpha Ländercode für Land des 2-stelliger ISO-alpha-Ländercode gemäß P P - P
119
+ # Zahlungsempfängers bzw. Länderverzeichnis für die Zahlungsbilanzstatistik;
120
+ # Scheckempfängers linksbündig zu belegen; 3. Stelle Leerzeichen
121
+ # 10b 4x35 211 alpha Zahlungsempfänger bzw. Bei Zahlungsauftrag: Zahlungsempfänger Bei P P Angabe eines Scheckempfängers nicht P Angabe eines Scheck­ empfängers nicht möglich
119
122
  # Scheckempfänger Scheckziehung: Scheckempfänger Zeile 1 und 2: möglich
120
123
  # Name Zeile 3 : Straße Zeile 4 : Ort/Land.
121
124
  # Entfällt bei der kurzen Variante NUR FUER DIE BEARBEITUNG DER MELDUNGEN--------------------------------------------------------------------------------------------------------
@@ -204,7 +207,7 @@ module KingDta
204
207
  data2 += '%08i' % 0 # KANN/PFLICHT 6 BLZ
205
208
  data2 += '%03s' % '' # KANN/PFLICHT 7a ISO-Währungscode
206
209
  data2 += '%010i' % 0 # KANN/PFLICHT 7b BLZ
207
- data2 += '%-011s' % booking.account.bank_bic
210
+ data2 += '%-011s' % booking.account.bank_bic
208
211
  data2 += '%-03s' % booking.account.bank_country_code # Pflichtfelder wenn T8 leer
209
212
  data2 += '%-070s' % booking.account.bank_name
210
213
  data2 += '%-035.35s' % booking.account.bank_street
data/spec/account_spec.rb CHANGED
@@ -8,7 +8,7 @@ describe KingDta::Account do
8
8
  end
9
9
 
10
10
  it "should initialize a new account" do
11
- lambda{
11
+ lambda{
12
12
  KingDta::Account.new(:bank_account_number => @ba.bank_account_number,
13
13
  :bank_number => @ba.bank_number,
14
14
  :owner_name => @ba.owner_name)
@@ -16,58 +16,37 @@ describe KingDta::Account do
16
16
  end
17
17
 
18
18
  it "should initialize a new dtazv account" do
19
- lambda{
19
+ lambda{
20
20
  KingDta::Account.new(sender_opts)
21
21
  }.should_not raise_error
22
22
  end
23
23
 
24
- it "should convert bank_account_number to integer" do
25
- opts = {:bank_account_number => '0123456',
26
- :bank_number => @ba.bank_number,
27
- :owner_name => @ba.owner_name}
28
- anct = KingDta::Account.new(opts)
29
- anct.bank_account_number.should == 123456
30
-
31
- anct2 = KingDta::Account.new(opts.merge(:bank_account_number=>'012 345 6'))
32
- anct2.bank_account_number.should == 123456
33
- end
34
-
35
- it "should convert bank_number to integer" do
36
- opts = {:bank_account_number => @ba.bank_account_number,
37
- :bank_number => '0123',
38
- :owner_name => @ba.owner_name}
39
- anct = KingDta::Account.new(opts)
40
- anct.bank_number.should == 123
41
-
42
- anct2 = KingDta::Account.new(opts.merge(:bank_number=>'012 34 5'))
43
- anct2.bank_number.should == 12345
44
- end
45
-
46
24
  it "should fail if bank account number is invalid" do
47
- lambda{
25
+ # lambda{ KingDta::Account.new(0, @ba.bank_number, @ba.owner_name) }.should raise_error(ArgumentError)
26
+ lambda{
48
27
  KingDta::Account.new(:bank_account_number => 123456789011123456789011123456789011,
49
28
  :bank_number => @ba.bank_number,
50
29
  :owner_name => @ba.owner_name)
51
30
 
52
- }.should raise_error(ArgumentError, 'Bank account number too long, max 10 allowed')
31
+ }.should raise_error(ArgumentError, 'Bank account number too long, max 35 allowed')
53
32
  end
54
33
 
55
34
  it "should fail if bank number is invalid" do
56
- lambda{
35
+ lambda{
57
36
  KingDta::Account.new( :bank_account_number => @ba.bank_account_number,
58
37
  :bank_number => 0,
59
38
  :owner_name => @ba.owner_name)
60
39
  }.should raise_error(ArgumentError)
61
40
 
62
- lambda{
41
+ lambda{
63
42
  KingDta::Account.new( :bank_account_number => @ba.bank_account_number,
64
43
  :bank_number => 123456789101112,
65
44
  :owner_name => @ba.owner_name)
66
- }.should raise_error(ArgumentError, 'Bank number too long, max 8 allowed')
45
+ }.should raise_error(ArgumentError, 'Bank number too long, max 11 allowed')
67
46
  end
68
47
 
69
48
  it "should fail if owner number is too long" do
70
- lambda{
49
+ lambda{
71
50
  KingDta::Account.new( :bank_account_number => @ba.bank_account_number,
72
51
  :bank_number => @ba.bank_number,
73
52
  :owner_name => @ba.owner_name,
@@ -75,7 +54,7 @@ describe KingDta::Account do
75
54
  }.should raise_error(ArgumentError, 'Owner number too long, max 10 allowed')
76
55
  end
77
56
 
78
- it "should fail if street and/or Zip Code is too long" do
57
+ it "should fail if street and/or Zip Code is too long" do
79
58
  opts = sender_opts.merge( :bank_street => "Lorem ipsum dolor sit amet, consectetur")
80
59
  lambda{
81
60
  KingDta::Account.new(opts)
@@ -84,7 +63,7 @@ describe KingDta::Account do
84
63
 
85
64
  it "should fail if city is too long" do
86
65
  opts = sender_opts.merge( :bank_city => "Lorem ipsum dolor sit amet, consecte")
87
- lambda{
66
+ lambda{
88
67
  KingDta::Account.new opts
89
68
  }.should raise_error(ArgumentError, 'Bank city too long, max 35 allowed')
90
69
  end
@@ -111,19 +90,12 @@ describe KingDta::Account do
111
90
  end
112
91
 
113
92
  it "should return account street and zip" do
114
- acnt = KingDta::Account.new( sender_opts )
115
- acnt.bank_zip_city.should == "51063 BANK KOELN"
93
+ konto = KingDta::Account.new( sender_opts )
94
+ konto.bank_zip_city.should == "51063 BANK KOELN"
116
95
  end
117
96
 
118
97
  it "should return sender street and zip" do
119
- acnt = KingDta::Account.new( sender_opts )
120
- acnt.owner_zip_city.should == "51063 MEINE KOELN"
121
- end
122
-
123
- it "should set owner country code from iban" do
124
- opts = receiver_opts
125
- opts[:owner_country_code] = nil
126
- acnt = KingDta::Account.new( opts )
127
- acnt.owner_country_code.should == "PL"
98
+ konto = KingDta::Account.new( sender_opts )
99
+ konto.owner_zip_city.should == "51063 MEINE KOELN"
128
100
  end
129
101
  end
data/spec/dtaus_spec.rb CHANGED
@@ -90,20 +90,6 @@ describe KingDta::Dtaus do
90
90
  str.should == out
91
91
  end
92
92
 
93
- it "should create c-sektion with long account owner name in extension" do
94
- @dtaus.account = KingDta::Account.new(:bank_account_number => @kto1.bank_account_number, :bank_number => @kto1.bank_number,
95
- :owner_name => 'A very long name exeeding 27 characters even longer 54 chars', :bank_name => @kto1.bank_name)
96
-
97
- @dtaus.add(@booking)
98
- @dtaus.bookings.first.text = 'SalesKing Monatsbeitrag 08/10 Freelancer Version'
99
- @dtaus.add_c(@booking)
100
- str = @dtaus.dta_string
101
- str.length.should == 256
102
- str.should include(@kto2.owner_name.upcase)
103
- out = "0245C00000000370400440002787777000000000000005000 0000000000037040044782897003700000022025 PETER & MAY GMBH A VERY LONG NAME EXEEDING 2SALESKING MONATSBEITRAG 08/1 020210 FREELANCER VERSION 037 CHARACTERS EVEN LONGER 54 "
104
- str.should == out
105
- end
106
-
107
93
  it "should create c-sektion with default booking text" do
108
94
  @dtaus.default_text = 'Default verwendungszweck'
109
95
  @dtaus.add_c(@booking)
@@ -128,15 +114,6 @@ describe KingDta::Dtaus do
128
114
  str.should == out
129
115
  end
130
116
 
131
- it "should create whole dta string with long texts exeeding extension" do
132
- @dtaus.account = KingDta::Account.new(:bank_account_number => @kto1.bank_account_number, :bank_number => @kto1.bank_number,
133
- :owner_name => 'A very long name exeeding 27 characters even longer 54 chars', :bank_name => @kto1.bank_name)
134
- @dtaus.add(@booking)
135
- @dtaus.bookings.first.text = 'Rgn R-3456-0102220 Monatsbeitrag 08/10 Freelancer Version Vielen Dank Ihre SalesKing GmbH' * 20
136
- @dtaus.bookings.first.account.owner_name = 'A very long name exeeding 27 characters even longer 54 chars'
137
- str = @dtaus.create ## should not raise error
138
- end
139
-
140
117
  it "should create whole dta string with long booking text in extension" do
141
118
  @dtaus.add(@booking)
142
119
  @dtaus.bookings.first.text = 'Rgn R-3456-0102220 Monatsbeitrag 08/10 Freelancer Version Vielen Dank Ihre SalesKing GmbH'
data/spec/spec_helper.rb CHANGED
@@ -4,10 +4,10 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
4
 
5
5
  require 'simplecov'
6
6
  SimpleCov.start 'rails'
7
- SimpleCov.coverage_dir 'coverage'
7
+ SimpleCov.coverage_dir 'coverage/rspec'
8
8
 
9
9
  require 'rubygems'
10
- require 'king_dtaus'
10
+ require "king_dtaus"
11
11
  require 'rspec'
12
12
  require 'ostruct'
13
13
  require 'date'
@@ -21,16 +21,16 @@ def sender_opts
21
21
  :bank_account_number => '1326049634',
22
22
  :bank_number => '37050299',
23
23
  :bank_name => 'Kreissparkasse Köln',
24
- :bank_street => 'Bank Eine Straße 2',
25
- :bank_city => 'Bank Köln',
26
- :bank_zip => '51063',
27
- :bank_country_code => 'DE',
28
- :owner_number => '',
24
+ :bank_street => "Bank Eine Straße 2",
25
+ :bank_city => "Bank Köln",
26
+ :bank_zip => "51063",
27
+ :bank_country_code => "DE",
28
+ :owner_number => "",
29
29
  :owner_name =>'Jan Kus',
30
- :owner_street => 'Meine Eine Straße 2',
31
- :owner_city => 'Meine Köln',
32
- :owner_zip_code => '51063',
33
- :owner_country_code => 'DE'
30
+ :owner_street => "Meine Eine Straße 2",
31
+ :owner_city => "Meine Köln",
32
+ :owner_zip_code => "51063",
33
+ :owner_country_code => "DE"
34
34
  }
35
35
  end
36
36
 
@@ -39,10 +39,10 @@ def receiver_opts
39
39
  :bank_iban => 'PL10105013151000002308622378',
40
40
  :bank_bic => 'COBADEFF366',
41
41
  :owner_name =>'Dalai Lama',
42
- :owner_street => 'Bush-Avenue 55',
43
- :owner_city => 'India',
44
- :owner_zip_code => '445555',
45
- :owner_country_code => 'DE' # actually wrong since iban is in poland
42
+ :owner_street => "Bush-Avenue 55",
43
+ :owner_city => "India",
44
+ :owner_zip_code => "445555",
45
+ :owner_country_code => "DE"
46
46
  # only needed if no bic present
47
47
  # :bank_name => 'Dalai Lamas Bank',
48
48
  # :bank_street => "5th avenue",
metadata CHANGED
@@ -1,134 +1,128 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: king_dtaus
3
- version: !ruby/object:Gem::Version
4
- version: 2.0.2
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ hash: 961916008
5
+ prerelease: 6
6
+ segments:
7
+ - 2
8
+ - 0
9
+ - 3
10
+ - pre
11
+ version: 2.0.3.pre
6
12
  platform: ruby
7
- authors:
13
+ authors:
8
14
  - Georg Leciejewski
9
15
  - Georg Ledermann
10
16
  - Jan Kus
11
17
  autorequire:
12
18
  bindir: bin
13
19
  cert_chain: []
14
- date: 2011-11-15 00:00:00.000000000 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: i18n
18
- requirement: !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ! '>='
22
- - !ruby/object:Gem::Version
23
- version: '0'
20
+
21
+ date: 2011-09-03 00:00:00 +02:00
22
+ default_executable:
23
+ dependencies:
24
+ - !ruby/object:Gem::Dependency
24
25
  type: :runtime
25
- prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
27
  none: false
28
- requirements:
29
- - - ! '>='
30
- - !ruby/object:Gem::Version
31
- version: '0'
32
- - !ruby/object:Gem::Dependency
33
- name: rdoc
34
- requirement: !ruby/object:Gem::Requirement
35
- none: false
36
- requirements:
37
- - - ! '>='
38
- - !ruby/object:Gem::Version
39
- version: '0'
40
- type: :development
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ version: "0"
35
+ name: king_dtaus
36
+ version_requirements: *id001
41
37
  prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
38
+ - !ruby/object:Gem::Dependency
39
+ type: :development
40
+ requirement: &id002 !ruby/object:Gem::Requirement
43
41
  none: false
44
- requirements:
45
- - - ! '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- - !ruby/object:Gem::Dependency
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
49
  name: rspec
50
- requirement: !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
53
- - - ! '>='
54
- - !ruby/object:Gem::Version
55
- version: '0'
50
+ version_requirements: *id002
51
+ prerelease: false
52
+ - !ruby/object:Gem::Dependency
56
53
  type: :development
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ name: jeweler
64
+ version_requirements: *id003
57
65
  prerelease: false
58
- version_requirements: !ruby/object:Gem::Requirement
66
+ - !ruby/object:Gem::Dependency
67
+ type: :development
68
+ requirement: &id004 !ruby/object:Gem::Requirement
59
69
  none: false
60
- requirements:
61
- - - ! '>='
62
- - !ruby/object:Gem::Version
63
- version: '0'
64
- - !ruby/object:Gem::Dependency
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
65
77
  name: simplecov
66
- requirement: !ruby/object:Gem::Requirement
67
- none: false
68
- requirements:
69
- - - ! '>='
70
- - !ruby/object:Gem::Version
71
- version: '0'
72
- type: :development
78
+ version_requirements: *id004
73
79
  prerelease: false
74
- version_requirements: !ruby/object:Gem::Requirement
80
+ - !ruby/object:Gem::Dependency
81
+ type: :development
82
+ requirement: &id005 !ruby/object:Gem::Requirement
75
83
  none: false
76
- requirements:
77
- - - ! '>='
78
- - !ruby/object:Gem::Version
79
- version: '0'
80
- - !ruby/object:Gem::Dependency
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
81
91
  name: mocha
82
- requirement: !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: '0'
88
- type: :development
92
+ version_requirements: *id005
89
93
  prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- none: false
92
- requirements:
93
- - - ! '>='
94
- - !ruby/object:Gem::Version
95
- version: '0'
96
- - !ruby/object:Gem::Dependency
97
- name: rake
98
- requirement: !ruby/object:Gem::Requirement
99
- none: false
100
- requirements:
101
- - - ! '>='
102
- - !ruby/object:Gem::Version
103
- version: 0.9.2
94
+ - !ruby/object:Gem::Dependency
104
95
  type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
96
+ requirement: &id006 !ruby/object:Gem::Requirement
107
97
  none: false
108
- requirements:
109
- - - ! '>='
110
- - !ruby/object:Gem::Version
111
- version: 0.9.2
112
- description: ! 'DTA/DTAUS and DTAZV are text-based formats to create bank transfers
113
- for german banks.
114
-
115
- This gem creates DTA/DATAUS files for inner german credit and debit(Gutschrift/Lastschrift)
116
- transfers.
117
-
118
- It is also capable of creating DTAZV credit-files for transfers from Germany to
119
- European SEPA region.'
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ name: i18n
106
+ version_requirements: *id006
107
+ prerelease: false
108
+ description: DTAUS is a text-based format, to create bank transfers for german banks. This gem helps with the creation of those transfer files.
120
109
  email: gl@salesking.eu
121
110
  executables: []
111
+
122
112
  extensions: []
123
- extra_rdoc_files:
113
+
114
+ extra_rdoc_files:
124
115
  - README.markdown
125
- files:
126
- - .gitignore
116
+ files:
127
117
  - .travis.yml
128
118
  - Gemfile
129
119
  - MIT-LICENSE
130
120
  - README.markdown
131
121
  - Rakefile
122
+ - VERSION
123
+ - docs/dtazv.pdf
124
+ - docs/dtazv_bank_bbk.pdf
125
+ - docs/example.output
132
126
  - king_dtaus.gemspec
133
127
  - lib/king_dta/account.rb
134
128
  - lib/king_dta/booking.rb
@@ -137,7 +131,6 @@ files:
137
131
  - lib/king_dta/dtazv.rb
138
132
  - lib/king_dta/exception.rb
139
133
  - lib/king_dta/helper.rb
140
- - lib/king_dta/version.rb
141
134
  - lib/king_dtaus.rb
142
135
  - spec/account_spec.rb
143
136
  - spec/booking_spec.rb
@@ -145,31 +138,41 @@ files:
145
138
  - spec/dtazv_spec.rb
146
139
  - spec/helper_spec.rb
147
140
  - spec/spec_helper.rb
141
+ has_rdoc: true
148
142
  homepage: http://github.com/salesking/king_dtaus
149
143
  licenses: []
144
+
150
145
  post_install_message:
151
146
  rdoc_options: []
152
- require_paths:
147
+
148
+ require_paths:
153
149
  - lib
154
- required_ruby_version: !ruby/object:Gem::Requirement
150
+ required_ruby_version: !ruby/object:Gem::Requirement
155
151
  none: false
156
- requirements:
157
- - - ! '>='
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- segments:
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ hash: 3
156
+ segments:
161
157
  - 0
162
- hash: 1476023920337176562
163
- required_rubygems_version: !ruby/object:Gem::Requirement
158
+ version: "0"
159
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
160
  none: false
165
- requirements:
166
- - - ! '>='
167
- - !ruby/object:Gem::Version
168
- version: '0'
161
+ requirements:
162
+ - - ">"
163
+ - !ruby/object:Gem::Version
164
+ hash: 25
165
+ segments:
166
+ - 1
167
+ - 3
168
+ - 1
169
+ version: 1.3.1
169
170
  requirements: []
171
+
170
172
  rubyforge_project:
171
- rubygems_version: 1.8.24
173
+ rubygems_version: 1.6.2
172
174
  signing_key:
173
175
  specification_version: 3
174
- summary: Generate DTA/DTAUS and DTAZV bank transfer files .. the easy way
176
+ summary: Generate DTAUS strings and files
175
177
  test_files: []
178
+
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- nbproject/*
2
- .rvmrc
3
- coverage/*
4
- rdoc/*
5
- pkg/*
6
- .DS_Store
7
- DTAUS0.TXT
8
- dta.txt
9
- Gemfile.lock
@@ -1,3 +0,0 @@
1
- module KingDta
2
- VERSION='2.0.2'
3
- end