payment_dta 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.gitignore +9 -0
- data/.travis.yml +6 -0
- data/CHANGELOG +20 -0
- data/Gemfile +4 -0
- data/Rakefile +23 -0
- data/lib/payment_dta.rb +2 -1
- data/lib/payment_dta/character_conversion.rb +3 -4
- data/lib/payment_dta/character_conversion_hash.rb +15 -0
- data/lib/payment_dta/dta_file.rb +19 -12
- data/lib/payment_dta/payments/bank_cheque_payment.rb +1 -1
- data/lib/payment_dta/payments/base.rb +33 -33
- data/lib/payment_dta/payments/financial_institution_payment.rb +1 -1
- data/lib/payment_dta/payments/iban_payment.rb +1 -1
- data/lib/payment_dta/payments/special_financial_institution_payment.rb +1 -1
- data/lib/payment_dta/payments/total_record.rb +9 -8
- data/lib/payment_dta/version.rb +3 -0
- data/payment_dta.gemspec +29 -0
- data/spec/factory.rb +3 -2
- data/spec/lib/bank_cheque_payment_spec.rb +1 -1
- data/spec/lib/character_conversion_spec.rb +5 -9
- data/spec/lib/domestic_chf_payment_spec.rb +6 -1
- data/spec/lib/dta_file_spec.rb +16 -3
- data/spec/lib/esr_payment_spec.rb +2 -2
- data/spec/lib/financial_institution_payment_spec.rb +1 -1
- data/spec/lib/iban_payment_spec.rb +13 -1
- data/spec/lib/payment_header_spec.rb +57 -57
- data/spec/lib/payment_spec.rb +2 -1
- data/spec/lib/special_financial_institution_payment_spec.rb +1 -1
- data/spec/spec_helper.rb +8 -4
- data/test/test_generator_helper.rb +29 -0
- data/test/test_payment_generator.rb +46 -0
- data/tmp/.gitkeep +0 -0
- metadata +126 -58
- data/VERSION +0 -1
data/spec/lib/payment_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
3
|
require 'payments/esr_payment'
|
3
4
|
require 'payments/total_record'
|
@@ -12,4 +13,4 @@ describe "dta payments" do
|
|
12
13
|
record = Factory.create_total_record(:data_file_sender_identification => 'ÄÜ2')
|
13
14
|
record.to_dta.should == Test.dta_string(record.record)
|
14
15
|
end
|
15
|
-
end
|
16
|
+
end
|
@@ -32,7 +32,7 @@ describe SpecialFinancialInstitutionPayment do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should have a payment amount justified left filled with blanks' do
|
35
|
-
Factory.create_special_financial_institution_payment(:payment_amount => '3949.75').segment1[112,15].should == '3949
|
35
|
+
Factory.create_special_financial_institution_payment(:payment_amount => '3949.75').segment1[112,15].should == '3949,75'.ljust(15)
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'should have a reserve field' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_filter '/spec'
|
4
|
+
end
|
5
|
+
|
1
6
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
7
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib','payment_dta'))
|
3
|
-
require '
|
4
|
-
require '
|
8
|
+
require 'rspec'
|
9
|
+
require 'rspec/autorun'
|
5
10
|
require 'factory'
|
6
11
|
|
7
|
-
|
8
|
-
|
12
|
+
RSpec.configure do |config|
|
9
13
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
begin
|
2
|
+
require File.dirname(__FILE__) + '/test_helper'
|
3
|
+
rescue LoadError
|
4
|
+
require 'test/unit'
|
5
|
+
end
|
6
|
+
require 'fileutils'
|
7
|
+
|
8
|
+
# Must set before requiring generator libs.
|
9
|
+
TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
|
10
|
+
PROJECT_NAME = "myproject" unless defined?(PROJECT_NAME)
|
11
|
+
app_root = File.join(TMP_ROOT, PROJECT_NAME)
|
12
|
+
if defined?(APP_ROOT)
|
13
|
+
APP_ROOT.replace(app_root)
|
14
|
+
else
|
15
|
+
APP_ROOT = app_root
|
16
|
+
end
|
17
|
+
if defined?(RAILS_ROOT)
|
18
|
+
RAILS_ROOT.replace(app_root)
|
19
|
+
else
|
20
|
+
RAILS_ROOT = app_root
|
21
|
+
end
|
22
|
+
|
23
|
+
begin
|
24
|
+
require 'rubigen'
|
25
|
+
rescue LoadError
|
26
|
+
require 'rubygems'
|
27
|
+
require 'rubigen'
|
28
|
+
end
|
29
|
+
require 'rubigen/helpers/generator_test_helper'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
+
|
3
|
+
|
4
|
+
class TestPaymentGenerator < Test::Unit::TestCase
|
5
|
+
include RubiGen::GeneratorTestHelper
|
6
|
+
|
7
|
+
def setup
|
8
|
+
bare_setup
|
9
|
+
end
|
10
|
+
|
11
|
+
def teardown
|
12
|
+
bare_teardown
|
13
|
+
end
|
14
|
+
|
15
|
+
# Some generator-related assertions:
|
16
|
+
# assert_generated_file(name, &block) # block passed the file contents
|
17
|
+
# assert_directory_exists(name)
|
18
|
+
# assert_generated_class(name, &block)
|
19
|
+
# assert_generated_module(name, &block)
|
20
|
+
# assert_generated_test_for(name, &block)
|
21
|
+
# The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
|
22
|
+
# assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
|
23
|
+
#
|
24
|
+
# Other helper methods are:
|
25
|
+
# app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
|
26
|
+
# bare_setup - place this in setup method to create the APP_ROOT folder for each test
|
27
|
+
# bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
|
28
|
+
|
29
|
+
def test_generator_without_options
|
30
|
+
name = "iban"
|
31
|
+
run_generator('payment', [name], sources)
|
32
|
+
assert_directory_exists "lib/payments"
|
33
|
+
assert_generated_file "lib/payments/iban_payment.rb"
|
34
|
+
assert_generated_file "spec/lib/#{name}_payment_spec.rb"
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
def sources
|
39
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
40
|
+
]
|
41
|
+
end
|
42
|
+
|
43
|
+
def generator_path
|
44
|
+
"generators"
|
45
|
+
end
|
46
|
+
end
|
data/tmp/.gitkeep
ADDED
File without changes
|
metadata
CHANGED
@@ -1,56 +1,123 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: payment_dta
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Patrick Huesler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
date: 2014-01-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubigen
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdoc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
16
56
|
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
17
62
|
type: :development
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
21
66
|
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
24
|
-
|
25
|
-
|
26
|
-
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
27
90
|
type: :development
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
31
94
|
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
|
35
|
-
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Generate Swiss DTA payment files to extract payments from your existing
|
98
|
+
application
|
36
99
|
email: patrick.huesler@gmail.com
|
37
100
|
executables: []
|
38
|
-
|
39
101
|
extensions: []
|
40
|
-
|
41
|
-
extra_rdoc_files:
|
102
|
+
extra_rdoc_files:
|
42
103
|
- LICENSE
|
43
104
|
- README.rdoc
|
44
|
-
files:
|
105
|
+
files:
|
106
|
+
- ".document"
|
107
|
+
- ".gitignore"
|
108
|
+
- ".travis.yml"
|
109
|
+
- CHANGELOG
|
110
|
+
- Gemfile
|
45
111
|
- LICENSE
|
46
112
|
- README.rdoc
|
47
|
-
-
|
113
|
+
- Rakefile
|
48
114
|
- generators/payment/USAGE
|
49
115
|
- generators/payment/payment_generator.rb
|
50
116
|
- generators/payment/templates/model.rb.erb
|
51
117
|
- generators/payment/templates/spec.rb.erb
|
52
118
|
- lib/payment_dta.rb
|
53
119
|
- lib/payment_dta/character_conversion.rb
|
120
|
+
- lib/payment_dta/character_conversion_hash.rb
|
54
121
|
- lib/payment_dta/dta_file.rb
|
55
122
|
- lib/payment_dta/payment_sorting.rb
|
56
123
|
- lib/payment_dta/payments/bank_cheque_payment.rb
|
@@ -61,37 +128,10 @@ files:
|
|
61
128
|
- lib/payment_dta/payments/iban_payment.rb
|
62
129
|
- lib/payment_dta/payments/special_financial_institution_payment.rb
|
63
130
|
- lib/payment_dta/payments/total_record.rb
|
131
|
+
- lib/payment_dta/version.rb
|
132
|
+
- payment_dta.gemspec
|
64
133
|
- script/destroy
|
65
134
|
- script/generate
|
66
|
-
has_rdoc: true
|
67
|
-
homepage: http://github.com/phuesler/payment_dta
|
68
|
-
licenses: []
|
69
|
-
|
70
|
-
post_install_message:
|
71
|
-
rdoc_options:
|
72
|
-
- --charset=UTF-8
|
73
|
-
require_paths:
|
74
|
-
- lib
|
75
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
77
|
-
- - ">="
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: "0"
|
80
|
-
version:
|
81
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
-
requirements:
|
83
|
-
- - ">="
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: "0"
|
86
|
-
version:
|
87
|
-
requirements: []
|
88
|
-
|
89
|
-
rubyforge_project:
|
90
|
-
rubygems_version: 1.3.5
|
91
|
-
signing_key:
|
92
|
-
specification_version: 3
|
93
|
-
summary: Ruby library to generate Swiss DTA payment files
|
94
|
-
test_files:
|
95
135
|
- spec/factory.rb
|
96
136
|
- spec/lib/bank_cheque_payment_spec.rb
|
97
137
|
- spec/lib/character_conversion_spec.rb
|
@@ -105,3 +145,31 @@ test_files:
|
|
105
145
|
- spec/lib/special_financial_institution_payment_spec.rb
|
106
146
|
- spec/lib/total_record_spec.rb
|
107
147
|
- spec/spec_helper.rb
|
148
|
+
- test/test_generator_helper.rb
|
149
|
+
- test/test_payment_generator.rb
|
150
|
+
- tmp/.gitkeep
|
151
|
+
homepage: http://github.com/phuesler/payment_dta
|
152
|
+
licenses:
|
153
|
+
- MIT
|
154
|
+
metadata: {}
|
155
|
+
post_install_message:
|
156
|
+
rdoc_options: []
|
157
|
+
require_paths:
|
158
|
+
- lib
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
requirements: []
|
170
|
+
rubyforge_project:
|
171
|
+
rubygems_version: 2.2.1
|
172
|
+
signing_key:
|
173
|
+
specification_version: 4
|
174
|
+
summary: Ruby library to generate Swiss DTA payment files
|
175
|
+
test_files: []
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.1
|