king_dtaus 2.0.0 → 2.0.1.pre

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/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use --create ree@dtazv
data/Gemfile CHANGED
@@ -1,7 +1,3 @@
1
1
  source :rubygems
2
2
 
3
- gemspec
4
-
5
- group :test do
6
- gem "rcov"
7
- end
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,38 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ king_dtaus (2.0.0.pre)
5
+ king_dtaus
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.1.2)
11
+ git (1.2.5)
12
+ jeweler (1.6.2)
13
+ bundler (~> 1.0)
14
+ git (>= 1.2.5)
15
+ rake
16
+ mocha (0.9.12)
17
+ rake (0.9.1)
18
+ rspec (2.6.0)
19
+ rspec-core (~> 2.6.0)
20
+ rspec-expectations (~> 2.6.0)
21
+ rspec-mocks (~> 2.6.0)
22
+ rspec-core (2.6.3)
23
+ rspec-expectations (2.6.0)
24
+ diff-lcs (~> 1.1.2)
25
+ rspec-mocks (2.6.0)
26
+ simplecov (0.4.2)
27
+ simplecov-html (~> 0.4.4)
28
+ simplecov-html (0.4.5)
29
+
30
+ PLATFORMS
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ jeweler
35
+ king_dtaus!
36
+ mocha
37
+ rspec
38
+ simplecov
data/README.rdoc ADDED
@@ -0,0 +1,120 @@
1
+ = DTAUS & DTAZV always comes together
2
+
3
+ DTAUS & DTAZV are formats for German bank transfers and is short for
4
+ "Datenträgeraustausch". The format itself totally sucks because it was
5
+ established in the last century, to be used on floppy disks. Still almost
6
+ all German banks use it (they only seem innovative at robbing), and it is
7
+ therefore supported in common banking programs too.
8
+
9
+ This gem saves you all the trouble when generating DTAUS- or DTAZV-text.
10
+
11
+ We love building payment applications
12
+
13
+ == Install
14
+
15
+ gem install king_dtaus
16
+
17
+ == Features
18
+
19
+ * create DTAUS debit advice (Lastschrift)
20
+ * create DTAUS credit advice (Gutschrift)
21
+ * create DTAZV debit advice
22
+
23
+ == TODOs
24
+
25
+ * first gem with no todo's - never seen it, huh? - just kidding
26
+ * some more edge-case tests needed
27
+
28
+ == Resources
29
+
30
+ * DTAZV-Viewer: http://www.meta-evolutions.de/pages/artikel-20070630-dtazv-datei-betrachter.html
31
+ * DTA/DTAZV PHP Pear: http://pear.php.net/package/Payment_DTA
32
+ * Ruby Kernel Module: http://www.ruby-doc.org/core/classes/Kernel.html
33
+ * Windata ZV-Tools: http://www.windata.de/Site/2Produkte2/ZVTools.aspx
34
+ * The Swift Codes: http://www.theswiftcodes.com/
35
+ * StarMoney: http://www.starmoney.de/index.php?id=starmoneybusiness_testen
36
+ * SalesKing: http://salesking.eu
37
+
38
+ == Examples
39
+
40
+ Here are some examples how to create a DTA- or DTAZV-File. Also check out the spec/dtazv_test.rb to have a running Example of an Export.
41
+
42
+ === DTA
43
+
44
+ # create a new dtaus object
45
+ dta = KingDta::Dtaus.new('LK')
46
+ # set sender account
47
+ dta.account = KingDta::Account.new(:account_number => @kto1.account_number, :bank_number => @kto1.bank_number, :client_name => @kto1.client_name, :bank_name => @kto1.bank_name)
48
+ # the following should be done in a loop to add multiple bookings
49
+ # create receiving account
50
+ rec_acnt = KingDta::Account.new(:account_number => @kto1.account_number, :bank_number => @kto1.bank_number, :client_name => @kto1.client_name, :bank_name => @kto1.bank_name)
51
+ # create booking
52
+ booking = KingDta::Booking.new(rec_acnt, 100.00 )
53
+ # set booking text if you want to
54
+ booking.text = "Thanks for your purchase"
55
+ # add booking
56
+ dta.add( booking )
57
+ # end loop
58
+
59
+ # create datausstring and do with it whatever fits your workflow
60
+ my_str = dta.create
61
+
62
+ === DTAZV
63
+
64
+ @date = Date.today
65
+ @dudes_dtazv_export = KingDta::Dtazv.new(@date)
66
+ @dudes_konto = self.dudes_konto
67
+ @dalai_lamas_account = self.dalai_lamas_account
68
+ @dudes_dtazv_export.account = KingDta::Account.new(
69
+ :account_number => @dudes_konto.account_number,
70
+ :bank_number => @dudes_konto.bank_number,
71
+ :client_name => @dudes_konto.client_name,
72
+ :client_number => @dudes_konto.client_number,
73
+ :bank_street => @dudes_konto.account_street,
74
+ :bank_city => @dudes_konto.account_city,
75
+ :bank_zip_code => @dudes_konto.account_zip_code,
76
+ :bank_name => @dudes_konto.bank_name,
77
+ :client_street => @dudes_konto.client_street,
78
+ :client_city => @dudes_konto.client_city,
79
+ :client_zip_code => @dudes_konto.client_zip_code,
80
+ :bank_country_code => @dudes_konto.bank_country_code,
81
+ :client_country_code => @dudes_konto.client_country_code
82
+ )
83
+
84
+ @dalai_lamas_booking = KingDta::Booking.new(KingDta::Account.new(
85
+ :account_number => @dalai_lamas_account.account_number,
86
+ :bank_number => @dalai_lamas_account.bank_number,
87
+ :client_name => @dalai_lamas_account.client_name,
88
+ :client_number => @dalai_lamas_account.bank_name,
89
+ :bank_street => @dalai_lamas_account.account_street,
90
+ :bank_city => @dalai_lamas_account.account_city,
91
+ :bank_zip_code => @dalai_lamas_account.account_zip_code,
92
+ :bank_name => @dalai_lamas_account.bank_name,
93
+ :client_street => @dalai_lamas_account.client_street,
94
+ :client_city => @dalai_lamas_account.client_city,
95
+ :client_zip_code => @dalai_lamas_account.client_zip_code,
96
+ :bank_country_code => @dalai_lamas_account.bank_country_code,
97
+ :client_country_code => @dalai_lamas_account.client_country_code
98
+ ), 220.25)
99
+
100
+ @dudes_dtazv_export.add(@dalai_lamas_booking)
101
+ @dudes_dtazv_export.create_file
102
+
103
+ # Output is DTAZV0.TXT
104
+
105
+ also make sure to read the specs
106
+
107
+ == Credits
108
+
109
+ Bugfixes and enhancements by
110
+
111
+ * Georg Ledermann - https://github.com/ledermann
112
+ * Kim Rudolph - https://github.com/krudolph
113
+ * Thorsten Böttger - https://github.com/alto
114
+ * Jan Kus - https://github.com/koos
115
+
116
+ This gem used https://rubygems.org/gems/DTAUS as a starting point.
117
+ It was disected, turned into a real class structure, bugs where fixed and
118
+ of course a full test suite ensures its functionality.
119
+
120
+ Copyright (c) 2009-2011 Georg Leciejewski (SalesKing), Jan Kus (Railslove), released under the MIT license
data/Rakefile CHANGED
@@ -6,12 +6,6 @@ RSpec::Core::RakeTask.new
6
6
 
7
7
  task :default => :spec
8
8
 
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
9
  Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
16
10
 
17
11
  begin
@@ -22,7 +16,7 @@ begin
22
16
  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
17
  gem.email = "gl@salesking.eu"
24
18
  gem.homepage = "http://github.com/salesking/king_dtaus"
25
- gem.authors = ["Georg Leciejewski", "Georg Ledermann", "Jan Kus"]
19
+ gem.authors = ["Georg Leciejewski", "Georg Ledermann"]
26
20
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
27
21
  end
28
22
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.1.pre
data/king_dtaus.gemspec CHANGED
@@ -5,26 +5,27 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{king_dtaus}
8
- s.version = "2.0.0"
8
+ s.version = "2.0.1.pre"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Georg Leciejewski", "Georg Ledermann", "Jan Kus"]
12
- s.date = %q{2011-11-15}
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"]
12
+ s.date = %q{2011-06-15}
13
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.}
14
14
  s.email = %q{gl@salesking.eu}
15
15
  s.extra_rdoc_files = [
16
- "README.markdown"
16
+ "README.rdoc"
17
17
  ]
18
18
  s.files = [
19
- ".travis.yml",
19
+ ".rvmrc",
20
20
  "Gemfile",
21
+ "Gemfile.lock",
21
22
  "MIT-LICENSE",
22
- "README.markdown",
23
+ "README.rdoc",
23
24
  "Rakefile",
24
25
  "VERSION",
25
26
  "docs/dtazv.pdf",
26
27
  "docs/dtazv_bank_bbk.pdf",
27
- "docs/example.output",
28
+ "example.output",
28
29
  "king_dtaus.gemspec",
29
30
  "lib/king_dta/account.rb",
30
31
  "lib/king_dta/booking.rb",
@@ -38,12 +39,13 @@ Gem::Specification.new do |s|
38
39
  "spec/booking_spec.rb",
39
40
  "spec/dtaus_spec.rb",
40
41
  "spec/dtazv_spec.rb",
42
+ "spec/dtazv_test.rb",
41
43
  "spec/helper_spec.rb",
42
44
  "spec/spec_helper.rb"
43
45
  ]
44
46
  s.homepage = %q{http://github.com/salesking/king_dtaus}
45
47
  s.require_paths = ["lib"]
46
- s.rubygems_version = %q{1.6.2}
48
+ s.rubygems_version = %q{1.5.0}
47
49
  s.summary = %q{Generate DTAUS strings and files}
48
50
 
49
51
  if s.respond_to? :specification_version then
@@ -55,14 +57,12 @@ Gem::Specification.new do |s|
55
57
  s.add_development_dependency(%q<jeweler>, [">= 0"])
56
58
  s.add_development_dependency(%q<simplecov>, [">= 0"])
57
59
  s.add_development_dependency(%q<mocha>, [">= 0"])
58
- s.add_development_dependency(%q<i18n>, [">= 0"])
59
60
  else
60
61
  s.add_dependency(%q<king_dtaus>, [">= 0"])
61
62
  s.add_dependency(%q<rspec>, [">= 0"])
62
63
  s.add_dependency(%q<jeweler>, [">= 0"])
63
64
  s.add_dependency(%q<simplecov>, [">= 0"])
64
65
  s.add_dependency(%q<mocha>, [">= 0"])
65
- s.add_dependency(%q<i18n>, [">= 0"])
66
66
  end
67
67
  else
68
68
  s.add_dependency(%q<king_dtaus>, [">= 0"])
@@ -70,7 +70,6 @@ Gem::Specification.new do |s|
70
70
  s.add_dependency(%q<jeweler>, [">= 0"])
71
71
  s.add_dependency(%q<simplecov>, [">= 0"])
72
72
  s.add_dependency(%q<mocha>, [">= 0"])
73
- s.add_dependency(%q<i18n>, [">= 0"])
74
73
  end
75
74
  end
76
75
 
@@ -1,15 +1,11 @@
1
1
  # encoding: utf-8
2
2
  module KingDta
3
- # A bank account with name of the account owner,
4
- # Kontodaten verwalten mit Name des Inhabers und Bank, Bankleitzahl und Kontonummer.
3
+ #Kontodaten verwalten mit Name des Inhabers und Bank, Bankleitzahl und Kontonummer.
5
4
  class Account
6
5
  include KingDta::Helper
7
-
8
- attr_accessor :bank_account_number, :bank_number, :bank_street, :bank_city,
9
- :bank_zip, :bank_name, :bank_country_code, :bank_iban,
10
- :bank_bic,
11
- :owner_name, :owner_number, :owner_street, :owner_city,
12
- :owner_zip_code, :owner_country_code
6
+ # dta~ jeweilige Feld in DTAUS-Norm
7
+ attr_accessor :account_number, :bank_number, :client_number, :bank_street, :bank_city, :bank_zip_code, :bank_name,
8
+ :client_name, :client_street, :client_city, :client_zip_code, :bank_country_code, :client_country_code
13
9
 
14
10
  # TODO test
15
11
  def initialize(args={})
@@ -17,40 +13,43 @@ module KingDta
17
13
  @bank_street = convert_text(args.delete(:bank_street))
18
14
  @bank_city = convert_text(args.delete(:bank_city))
19
15
  @bank_name = convert_text(args.delete(:bank_name))
20
- @owner_name = convert_text(args.delete(:owner_name))
21
- @owner_street = convert_text(args.delete(:owner_street))
22
- @owner_city = convert_text(args.delete(:owner_city))
16
+ @client_name = convert_text(args.delete(:client_name))
17
+ @client_street = convert_text(args.delete(:client_street))
18
+ @client_city = convert_text(args.delete(:client_city))
23
19
 
24
20
  args.each do |key,value|
25
21
  self.send("#{key}=",value)
26
22
  end
27
23
 
28
- raise ArgumentError.new('Owner number too long, max 10 allowed') if @owner_number && "#{@owner_number}".length > 10
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
-
33
- raise ArgumentError.new('Bank account number too long, max 10 allowed') if @bank_account_number && "#{@bank_account_number}".length > 10
34
- raise ArgumentError.new("Bank account number cannot be 0") if @bank_account_number && @bank_account_number == 0
35
- raise ArgumentError.new("Bank iban wrong length: #{@bank_iban.length}, must be between 15-34") if @bank_iban && !@bank_iban.length.between?(15,34)
36
- raise ArgumentError.new("Bank bic wrong length: #{@bank_bic.length} must be between 8-11") if @bank_bic && !@bank_bic.length.between?(8,11)
37
- raise ArgumentError.new('Bank number too long, max 8 allowed') if @bank_number && "#{@bank_number}".length > 8
24
+ raise ArgumentError.new('Account number too long, max 35 allowed') if @account_number && "#{@account_number}".length > 35
25
+ raise ArgumentError.new('Bank number too long, max 11 allowed') if @bank_number && "#{@bank_number}".length > 11
26
+ raise ArgumentError.new('Client number too long, max 10 allowed') if @client_number && "#{@client_number}".length > 10
27
+ raise ArgumentError.new("Bank account number cannot be 0") if @account_number && @account_number == 0
38
28
  raise ArgumentError.new("Bank number cannot be 0") if @bank_number && @bank_number == 0
39
- raise ArgumentError.new("Bank street too long, max 35 allowed") if @bank_street && @bank_street.length > 35
40
- raise ArgumentError.new("Bank city too long, max 35 allowed") if @bank_city && @bank_city.length > 35
41
- raise ArgumentError.new("Bank name too long, max 35 allowed") if @bank_name && @bank_name.length > 35
42
- raise ArgumentError.new("Bank country code too long, max 2 allowed") if @bank_country_code && @bank_country_code.length > 2
29
+ raise ArgumentError.new("Street and/or Zip Code too long, max 35 allowed") if @bank_street && @bank_zip_code && "#{@bank_street} #{@bank_zip_code}".length > 35
30
+ raise ArgumentError.new("City too long, max 35 allowed") if @bank_city && @bank_city.length > 35
31
+ raise ArgumentError.new("Bank Name too long, max 35 allowed") if @bank_name && @bank_name.length > 35
32
+ raise ArgumentError.new("Client Street and/or Zip Code too long, max 35 allowed") if @client_street && @client_zip_code && "#{@client_street} #{@client_zip_code}".length > 35
33
+ raise ArgumentError.new("Client City too long, max 35 allowed") if @client_city && @client_city.length > 35
34
+ raise ArgumentError.new("Bank Country code too long, max 2 allowed") if @bank_country_code && @bank_country_code.length > 2
35
+ raise ArgumentError.new("Client Country code too long, max 2 allowed") if @client_country_code && @client_country_code.length > 2
36
+
37
+ end
43
38
 
44
- @owner_country_code = @bank_iban[0..1 ] if @bank_iban && !@owner_country_code
39
+ def client_name_1
40
+ @client_name[0..35]
41
+ end
45
42
 
43
+ def client_name_2
44
+ @client_name[36..70]
46
45
  end
47
46
 
48
- def bank_zip_city
49
- "#{@bank_zip} #{@bank_city}"
47
+ def zip_city
48
+ "#{@bank_zip_code} #{@bank_city}"
50
49
  end
51
50
 
52
- def owner_zip_city
53
- "#{@owner_zip_code} #{@owner_city}"
51
+ def client_zip_city
52
+ "#{@client_zip_code} #{@client_city}"
54
53
  end
55
54
 
56
55
  end
data/lib/king_dta/dta.rb CHANGED
@@ -4,16 +4,6 @@ module KingDta
4
4
  include KingDta::Helper
5
5
  attr_reader :default_text
6
6
 
7
- # Create a new dta string.
8
- # === Parameter #
9
- # typ<Date>:: date when the the transfer is to be created
10
- def initialize(date=Date.today )
11
- raise ArgumentError.new("Wrong date format. Make it a Time or Date object with yyyy-mm-dd") unless date.respond_to?(:strftime)
12
- @date = date
13
- @value_pos = true #values are positive by default changed by first booking
14
- @closed = false
15
- @default_text = ''
16
- end
17
7
  # Set the sending account(you own)
18
8
  # === Parameter
19
9
  # account<Account>:: the sending account, must be an instance of class