ideal-mollie 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0e9f6082bfd278054ec3e8c1d46f579f43862267
4
+ data.tar.gz: b02f3689af3dcca3b8ed91fd5ff73c8313950285
5
+ SHA512:
6
+ metadata.gz: b47b01505d78009453f1e7247a2d48baeb3774036e73c3eae5b061e96dcd24bab7b8a6636cd529e00fd2a24a4ee38274c4fc29c1da10bf7a0ba2809a86e71d31
7
+ data.tar.gz: de1f9e1f2187e399b106ad86fb770af212853cb39cae58c7a3ee0e1a41512ce8bc0f762d5296cc71765c15b0fb1fb417031d794f32545f30231a33f2bc3da72c
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.travis.yml CHANGED
@@ -1,14 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
3
  - 1.9.2
5
4
  - 1.9.3
6
- - jruby-18mode
5
+ - 2.0.0
7
6
  - ruby-head
8
7
  - jruby-head
9
- - ree
10
- env:
11
- - TRAVIS_BUILD=true
12
8
  matrix:
13
9
  allow_failures:
14
10
  - rvm: ruby-head
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ - **TBA**: version 1.0.4
4
+
5
+ - **25 June 2013**: version 1.0.3
6
+ - Make Nokogiri version less restrictive by [@tijmenb](https://github.com/tijmenb)
7
+ - Added different argument passing for `IdealMollie.new_order`
8
+
3
9
  - **11 Februari 2012**: version 1.0.2
4
10
  - Fix for verify sha512
5
11
 
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Manuel van Rijn, http://manuel.manuelles.nl/
1
+ Copyright (c) 2013 Manuel van Rijn, http://manuel.manuelles.nl/
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
- # Ideal Mollie (ideal-mollie) [![Gem Version](https://badge.fury.io/rb/ideal-mollie.png)][gemversion] [![Build Status](https://secure.travis-ci.org/manuelvanrijn/ideal-mollie.png?branch=master)][travis]
1
+ # Ideal Mollie (ideal-mollie) [![Gem Version](https://badge.fury.io/rb/ideal-mollie.png)][gemversion] [![Build Status](https://secure.travis-ci.org/manuelvanrijn/ideal-mollie.png?branch=master)][travis] [![Coverage Status](https://coveralls.io/repos/manuelvanrijn/ideal-mollie/badge.png?branch=coveralls)][coveralls]
2
2
 
3
3
  [gemversion]: http://badge.fury.io/rb/ideal-mollie
4
4
  [travis]: http://travis-ci.org/manuelvanrijn/ideal-mollie
5
+ [coveralls]: https://coveralls.io/r/manuelvanrijn/ideal-mollie?branch=coveralls
5
6
 
6
7
  A simple Ruby implementation for handling iDeal transactions with the [Mollie API](https://www.mollie.nl/support/documentatie/betaaldiensten/ideal/).
7
8
 
@@ -13,13 +14,13 @@ Here you can find the [Documentation](http://rubydoc.info/github/manuelvanrijn/i
13
14
 
14
15
  To install the gem you could execute
15
16
 
16
- ```
17
+ ```ruby
17
18
  sudo gem install ideal-mollie
18
19
  ```
19
20
 
20
21
  Or you could add the gem into your `Gemfile`.
21
22
 
22
- ```
23
+ ```ruby
23
24
  gem 'ideal-mollie'
24
25
  ```
25
26
 
@@ -34,7 +35,7 @@ git clone --depth 1 git://github.com/manuelvanrijn/ideal-mollie.git ideal-mollie
34
35
 
35
36
  Add the following config parameters to your environment config file
36
37
 
37
- ```
38
+ ```ruby
38
39
  config.ideal_mollie.partner_id = 123456
39
40
  config.ideal_mollie.report_url = "http://example.org/report"
40
41
  config.ideal_mollie.return_url = "http://example.org/return"
@@ -43,7 +44,7 @@ config.ideal_mollie.test_mode = false
43
44
 
44
45
  Optionally you can add a profile_key if you have multiple profile's
45
46
 
46
- ```
47
+ ```ruby
47
48
  config.ideal_mollie.profile_key = "123abc45"
48
49
  ```
49
50
 
@@ -65,7 +66,19 @@ class TransactionsController < ApplicationController
65
66
  bank_id = params[:bank_id]
66
67
 
67
68
  # 10,00 EUR
68
- request = IdealMollie.new_order(1000, 'some payment description', bank_id)
69
+ request = IdealMollie.new_order(
70
+ amount: 1000,
71
+ description: 'some payment description',
72
+ bank_id: bank_id
73
+ )
74
+ # Optionally you could override the report_url and return_url here, by doing:
75
+ # request = IdealMollie.new_order(
76
+ # amount: 1000,
77
+ # description: 'some payment description',
78
+ # bank_id: bank_id,
79
+ # report_url: "http://url.org/report",
80
+ # return_url: "http://url.org/return"
81
+ # )
69
82
 
70
83
  transaction_id = request.transaction_id
71
84
 
@@ -131,6 +144,6 @@ A detailed overview can be found in the [CHANGELOG](https://github.com/manuelvan
131
144
 
132
145
  ## Copyright
133
146
 
134
- Copyright © 2012 Manuel van Rijn. See [LICENSE](https://github.com/manuelvanrijn/ideal-mollie/blob/master/LICENSE.md) for further details.
147
+ Copyright © 2013 Manuel van Rijn. See [LICENSE](https://github.com/manuelvanrijn/ideal-mollie/blob/master/LICENSE.md) for further details.
135
148
 
136
149
  [![githalytics.com alpha](https://cruel-carlota.pagodabox.com/c3b01a288913d7f68d75d2fd837d9dcd "githalytics.com")](http://githalytics.com/manuelvanrijn/ideal-mollie)
data/Rakefile CHANGED
@@ -2,9 +2,7 @@ require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
  RSpec::Core::RakeTask.new("spec")
4
4
 
5
- if ENV['TRAVIS_BUILD'].nil?
6
- require "yard"
7
- YARD::Rake::YardocTask.new do |t|
8
- t.options += ["--title", "Ideal-Mollie #{IdealMollie::VERSION} Documentation"]
9
- end
5
+ require "yard"
6
+ YARD::Rake::YardocTask.new do |t|
7
+ t.options += ["--title", "Ideal-Mollie #{IdealMollie::VERSION} Documentation"]
10
8
  end
data/ideal-mollie.gemspec CHANGED
@@ -21,17 +21,13 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency "rspec"
22
22
  s.add_development_dependency "vcr"
23
23
  s.add_development_dependency "fakeweb"
24
-
25
- # skipped gems on travis ci
26
- if ENV['TRAVIS_BUILD'].nil?
27
- s.add_development_dependency "simplecov"
28
- s.add_development_dependency "yard"
29
- s.add_development_dependency "redcarpet"
30
- end
24
+ s.add_development_dependency "coveralls"
25
+ s.add_development_dependency "simplecov"
26
+ s.add_development_dependency "yard"
31
27
 
32
28
  s.add_dependency "rake", "> 0.9.0"
33
29
  s.add_dependency "faraday", "~> 0.8.0"
34
30
  s.add_dependency "faraday_middleware", "~> 0.9.0"
35
31
  s.add_dependency "multi_xml", "~> 0.5.2"
36
- s.add_dependency "nokogiri", "~> 1.5.0"
32
+ s.add_dependency "nokogiri", "~> 1.5"
37
33
  end
data/lib/ideal-mollie.rb CHANGED
@@ -41,19 +41,38 @@ module IdealMollie
41
41
  #
42
42
  # @visibility public
43
43
  #
44
- # @param [int] amount The amount of money to transfer (defined in cents).
44
+ # @param [Hash or int] hash_or_amount The amount of money to transfer (defined in cents) or a Hash.
45
45
  # @param [String] description The description of the payment on the bank transfer.
46
46
  # @param [String] bank_id The id of the bank selected from one of the supported banks.
47
47
  # @param [String] return_url Optional override of the return url specified in the Config
48
48
  #
49
49
  # @example
50
- # IdealMollie.new_order(1000, "Ordernumber #123: new gadget", "0031")
50
+ # # as a Hash
51
+ # IdealMollie.new_order(amount: 1000, description: "Ordernumber #123: new gadget", bank_id: "0031")
52
+ # IdealMollie.new_order(
53
+ # amount: 1000,
54
+ # description: "Ordernumber #123: new gadget",
55
+ # bank_id: "0031",
56
+ # return_url: "http://override.url/controller/return_action",
57
+ # report_url: "http://override.url/controller/report_action"
58
+ # )
51
59
  #
52
- # @example
60
+ # # as arguments
61
+ # IdealMollie.new_order(1000, "Ordernumber #123: new gadget", "0031")
53
62
  # IdealMollie.new_order(1000, "Ordernumber #123: new gadget", "0031", "http://override.url/controller/return_action")
63
+ # IdealMollie.new_order(1000, "Ordernumber #123: new gadget", "0031", "http://override.url/controller/return_action", "http://override.url/controller/report_action")
64
+ #
54
65
  # @return [IdealMollie::Order] the +Order+.
55
- def self.new_order(amount, description, bank_id, return_url=nil)
56
- params = new_order_params(amount, description, bank_id, return_url)
66
+ def self.new_order(hash_or_amount, description=nil, bank_id=nil, return_url=nil, report_url=nil)
67
+ amount = hash_or_amount
68
+ if hash_or_amount.is_a?(Hash)
69
+ amount = hash_or_amount[:amount]
70
+ description = hash_or_amount[:description]
71
+ bank_id = hash_or_amount[:bank_id]
72
+ return_url = hash_or_amount[:return_url] if hash_or_amount.has_key?(:return_url)
73
+ report_url = hash_or_amount[:report_url] if hash_or_amount.has_key?(:report_url)
74
+ end
75
+ params = new_order_params(amount, description, bank_id, return_url, report_url)
57
76
  response = IdealMollie.request("fetch", params)
58
77
 
59
78
  IdealMollie::Order.new(response["order"])
@@ -120,11 +139,13 @@ module IdealMollie
120
139
  # @param [String] return_url Optional override of the return url specified in the Config
121
140
  #
122
141
  # @return [Hash] the parameter +Hash+ for the new order.
123
- def new_order_params(amount, description, bank_id, return_url=nil)
142
+ def new_order_params(amount, description, bank_id, return_url=nil, report_url=nil)
124
143
  return_url = Config.return_url if return_url.nil?
144
+ report_url = Config.report_url if report_url.nil?
145
+
125
146
  params = {
126
147
  :partnerid => Config.partner_id,
127
- :reporturl => Config.report_url,
148
+ :reporturl => report_url,
128
149
  :returnurl => return_url,
129
150
  :description => description,
130
151
  :amount => amount,
@@ -1,4 +1,4 @@
1
1
  module IdealMollie
2
2
  # Version number of IdealMollie
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
@@ -65,6 +65,67 @@ describe IdealMollie do
65
65
  params = IdealMollie.new_order_params(1200, "test", "0031")
66
66
  params.has_key?(:profile_key).should be_true
67
67
  end
68
+ it "should override the report url when specified" do
69
+ params = IdealMollie.new_order_params(1200, "test", "0031")
70
+ params[:reporturl].should eq "http://example.org/report"
71
+
72
+ params = IdealMollie.new_order_params(1200, "test", "0031", nil, "http://another.example.org/report")
73
+ params[:reporturl].should eq "http://another.example.org/report"
74
+ end
75
+ it "should accept hash as arguments for new_order" do
76
+ VCR.use_cassette("new_order", :match_requests_on => [:ignore_query_param_ordering]) do
77
+ order = IdealMollie.new_order(amount: 1000, description: "test", bank_id: "0031")
78
+ order.amount.should eq 1000
79
+ end
80
+ end
81
+ it "should accept changing the report_url in the hash for new_order" do
82
+ VCR.use_cassette("new_order", :match_requests_on => [:ignore_query_param_ordering]) do
83
+ # should recieve
84
+ params = {
85
+ :partnerid => 987654,
86
+ :reporturl => "http://another.example.org/report",
87
+ :returnurl => "http://example.org/return",
88
+ :description => "test",
89
+ :amount => 1000,
90
+ :bank_id => "0031"
91
+ }
92
+ # dummy result
93
+ result = {}
94
+ result["order"] = nil
95
+
96
+ IdealMollie.should_receive(:request).with("fetch", params).and_return(result)
97
+
98
+ order = IdealMollie.new_order(
99
+ amount: 1000,
100
+ description: "test",
101
+ bank_id: "0031",
102
+ report_url: "http://another.example.org/report")
103
+ end
104
+ end
105
+ it "should accept changing the return_url in the hash for new_order" do
106
+ VCR.use_cassette("new_order", :match_requests_on => [:ignore_query_param_ordering]) do
107
+ # should recieve
108
+ params = {
109
+ :partnerid => 987654,
110
+ :reporturl => "http://example.org/report",
111
+ :returnurl => "http://another.example.org/return",
112
+ :description => "test",
113
+ :amount => 1000,
114
+ :bank_id => "0031"
115
+ }
116
+ # dummy result
117
+ result = {}
118
+ result["order"] = nil
119
+
120
+ IdealMollie.should_receive(:request).with("fetch", params).and_return(result)
121
+
122
+ order = IdealMollie.new_order(
123
+ amount: 1000,
124
+ description: "test",
125
+ bank_id: "0031",
126
+ return_url: "http://another.example.org/return")
127
+ end
128
+ end
68
129
  end
69
130
 
70
131
  context "#check_order" do
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,10 @@
1
- if ENV['TRAVIS_BUILD'].nil?
2
- require 'simplecov'
3
- SimpleCov.start
4
- end
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
4
+ SimpleCov::Formatter::HTMLFormatter,
5
+ Coveralls::SimpleCov::Formatter
6
+ ]
7
+ SimpleCov.start
5
8
 
6
9
  require 'rubygems'
7
10
  require 'bundler/setup'
metadata CHANGED
@@ -1,132 +1,116 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ideal-mollie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
5
- prerelease:
4
+ version: 1.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Manuel van Rijn
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-11 00:00:00.000000000 Z
11
+ date: 2013-06-25 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: vcr
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: fakeweb
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
- name: simplecov
56
+ name: coveralls
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
- name: yard
70
+ name: simplecov
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
- name: redcarpet
84
+ name: yard
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: rake
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>'
101
+ - - '>'
116
102
  - !ruby/object:Gem::Version
117
103
  version: 0.9.0
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>'
108
+ - - '>'
124
109
  - !ruby/object:Gem::Version
125
110
  version: 0.9.0
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: faraday
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ~>
132
116
  - !ruby/object:Gem::Version
@@ -134,7 +118,6 @@ dependencies:
134
118
  type: :runtime
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ~>
140
123
  - !ruby/object:Gem::Version
@@ -142,7 +125,6 @@ dependencies:
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: faraday_middleware
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
129
  - - ~>
148
130
  - !ruby/object:Gem::Version
@@ -150,7 +132,6 @@ dependencies:
150
132
  type: :runtime
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
136
  - - ~>
156
137
  - !ruby/object:Gem::Version
@@ -158,7 +139,6 @@ dependencies:
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: multi_xml
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
143
  - - ~>
164
144
  - !ruby/object:Gem::Version
@@ -166,7 +146,6 @@ dependencies:
166
146
  type: :runtime
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
150
  - - ~>
172
151
  - !ruby/object:Gem::Version
@@ -174,19 +153,17 @@ dependencies:
174
153
  - !ruby/object:Gem::Dependency
175
154
  name: nokogiri
176
155
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
156
  requirements:
179
157
  - - ~>
180
158
  - !ruby/object:Gem::Version
181
- version: 1.5.0
159
+ version: '1.5'
182
160
  type: :runtime
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
163
  requirements:
187
164
  - - ~>
188
165
  - !ruby/object:Gem::Version
189
- version: 1.5.0
166
+ version: '1.5'
190
167
  description: A simple Ruby implementation for handeling iDeal transactions with the
191
168
  Mollie API
192
169
  email:
@@ -195,8 +172,8 @@ executables: []
195
172
  extensions: []
196
173
  extra_rdoc_files: []
197
174
  files:
175
+ - .coveralls.yml
198
176
  - .gitignore
199
- - .rbenv-version
200
177
  - .rspec
201
178
  - .rvmrc
202
179
  - .travis.yml
@@ -224,33 +201,26 @@ files:
224
201
  - spec/vcr_cassettes/new_order.yml
225
202
  homepage: https://github.com/manuelvanrijn/ideal-mollie
226
203
  licenses: []
204
+ metadata: {}
227
205
  post_install_message:
228
206
  rdoc_options: []
229
207
  require_paths:
230
208
  - lib
231
209
  required_ruby_version: !ruby/object:Gem::Requirement
232
- none: false
233
210
  requirements:
234
- - - ! '>='
211
+ - - '>='
235
212
  - !ruby/object:Gem::Version
236
213
  version: '0'
237
- segments:
238
- - 0
239
- hash: 1589694370849706436
240
214
  required_rubygems_version: !ruby/object:Gem::Requirement
241
- none: false
242
215
  requirements:
243
- - - ! '>='
216
+ - - '>='
244
217
  - !ruby/object:Gem::Version
245
218
  version: '0'
246
- segments:
247
- - 0
248
- hash: 1589694370849706436
249
219
  requirements: []
250
220
  rubyforge_project: ideal-mollie
251
- rubygems_version: 1.8.23
221
+ rubygems_version: 2.0.2
252
222
  signing_key:
253
- specification_version: 3
223
+ specification_version: 4
254
224
  summary: Make iDeal Mollie payments without the pain
255
225
  test_files:
256
226
  - spec/config_spec.rb
data/.rbenv-version DELETED
@@ -1 +0,0 @@
1
- 1.9.3-p194