clieop 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/clieop.gemspec +2 -2
- data/lib/clieop.rb +1 -1
- data/lib/clieop/payment/batch.rb +2 -2
- data/spec/clieop/payment/batch_spec.rb +11 -0
- metadata +5 -5
data/clieop.gemspec
CHANGED
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
|
|
3
3
|
|
4
4
|
# Do not set version and date yourself, this will be done automatically
|
5
5
|
# by the gem release script.
|
6
|
-
s.version = "1.0.
|
7
|
-
s.date = "2012-
|
6
|
+
s.version = "1.0.1"
|
7
|
+
s.date = "2012-10-25"
|
8
8
|
|
9
9
|
s.summary = "A pure Ruby implementation to write CLIEOP files"
|
10
10
|
s.description = "This library is a pure Ruby, MIT licensed implementation of the CLIEOP03 transaction format. CLIEOP03 can be used to communicate direct debt transactions with your (Dutch) bank."
|
data/lib/clieop.rb
CHANGED
data/lib/clieop/payment/batch.rb
CHANGED
@@ -20,7 +20,7 @@ module Clieop
|
|
20
20
|
# :description A description for this transaction (4 lines max)
|
21
21
|
def add_transaction (transaction)
|
22
22
|
raise "No :account_nr given" if transaction[:account_nr].nil?
|
23
|
-
raise "No :amount given" if transaction[:amount].nil?
|
23
|
+
raise "No :amount given" if transaction[:amount].nil? && transaction[:amount_in_cents].nil?
|
24
24
|
raise "No :account_owner given" if transaction[:account_owner].nil?
|
25
25
|
@transactions << transaction
|
26
26
|
end
|
@@ -59,7 +59,7 @@ module Clieop
|
|
59
59
|
transaction_type = tr[:transaction_type] || (transaction_is_payment? ? 1002 : 0)
|
60
60
|
to_account = transaction_is_payment? ? @batch_info[:account_nr] : tr[:account_nr]
|
61
61
|
from_account = transaction_is_payment? ? tr[:account_nr] : @batch_info[:account_nr]
|
62
|
-
amount_in_cents = (tr[:amount] * 100).round.to_i
|
62
|
+
amount_in_cents = tr.fetch(:amount_in_cents) { (tr[:amount] * 100).round }.to_i
|
63
63
|
|
64
64
|
# update checksums
|
65
65
|
total_account += tr[:account_nr].to_i
|
@@ -107,6 +107,17 @@ describe Clieop::Payment::Batch do
|
|
107
107
|
@batch << @transaction
|
108
108
|
end
|
109
109
|
|
110
|
+
it 'should allow specifying amount in cents' do
|
111
|
+
batch_with_cents = Clieop::Payment::Batch.payment_batch(@batch_info.dup)
|
112
|
+
batch_with_euros = Clieop::Payment::Batch.payment_batch(@batch_info.dup)
|
113
|
+
transaction_in_cents = @transaction.dup
|
114
|
+
transaction_in_cents.delete(:amount)
|
115
|
+
transaction_in_cents[:amount_in_cents] = 3010200
|
116
|
+
batch_with_cents << transaction_in_cents
|
117
|
+
batch_with_euros << @transaction
|
118
|
+
batch_with_cents.to_clieop.should == batch_with_euros.to_clieop
|
119
|
+
end
|
120
|
+
|
110
121
|
it "should add transactions to batch" do
|
111
122
|
@batch.batch_info[:transaction_group].should eql(0)
|
112
123
|
@batch.to_clieop.should match(/0010B0001234567890001EUR /)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clieop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-10-25 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -118,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
segments:
|
120
120
|
- 0
|
121
|
-
hash:
|
121
|
+
hash: 633361867559345977
|
122
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
123
|
none: false
|
124
124
|
requirements:
|
@@ -127,10 +127,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
version: '0'
|
128
128
|
segments:
|
129
129
|
- 0
|
130
|
-
hash:
|
130
|
+
hash: 633361867559345977
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
|
-
rubygems_version: 1.8.
|
133
|
+
rubygems_version: 1.8.24
|
134
134
|
signing_key:
|
135
135
|
specification_version: 3
|
136
136
|
summary: A pure Ruby implementation to write CLIEOP files
|