mollie-bank 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 447a33be843cdf4f114a7ff497b7bbd8b65b2644
4
- data.tar.gz: 32288ae9b7b745babb662e74bdcccc1bc6e70a63
3
+ metadata.gz: 5e462fc0f3743651dd3d3f49d4910cfc1a7af94b
4
+ data.tar.gz: f1fdf9a28e7da8c14724c71967576111258a2d84
5
5
  SHA512:
6
- metadata.gz: c27098173e74b9efca5bdfe74fcb455075723dea6dfb514a05150e2b677c8b0ae068476d1833bc9551577034c957f5dd373d609685937b0c04d53dbbb6684fa8
7
- data.tar.gz: 1c66daea1abc9f0e93458f5c22911fd2ca65fe71c27958fd3d348afd412a91f0d5f2bd9a53b5c62aad2b77b4f5df6eaf7fbe52d686afeab002880f5244621ac6
6
+ metadata.gz: 1f1063f3e1df266b53bdde17ab41ad16f5dda6ef8d12c87652ed33f4d21747dbc05d13aa4931e92f3520f1d9bd2e187cb470b4cc400b545c831e332abb6f6fb5
7
+ data.tar.gz: 109587dd68addbaead2181d7b9f5fa202559d21f0d4ee68a6b329fc461f90d1fd83fcbe3ca1d8b30ee5946d865c3dc605094dfa8b155efe241919cbd07c89eeb
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ mollie-bank
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0
data/CHANGELOG.md CHANGED
@@ -1,9 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ - **14 May 2013**: version 0.0.4
4
+ - Fixed issue #5: Support both GET and POST requests for `/xml/ideal`
5
+ - Upgraded dependencies
6
+
7
+ - **14 May 2013**: version 0.0.3
8
+ - Added coveralls
9
+ - Upgraded dependencies
10
+
3
11
  - **23 February 2012**: version 0.0.2
4
- - New way for storing transactions
5
- - Fully tested
6
- - Documented
12
+ - New way for storing transactions
13
+ - Fully tested
14
+ - Documented
7
15
 
8
16
  - **16 February 2012**: version 0.0.1
9
- - Initial release
17
+ - Initial release
@@ -12,6 +12,11 @@ module MollieBank
12
12
 
13
13
  set :storage, MollieBank::Storage
14
14
 
15
+ def self.get_or_post(path, opts={}, &block)
16
+ get(path, opts, &block)
17
+ post(path, opts, &block)
18
+ end
19
+
15
20
  # Displays a information page of the Mollie-Bank gem
16
21
  get '/' do
17
22
  haml :info
@@ -69,7 +74,7 @@ module MollieBank
69
74
 
70
75
  begin
71
76
  reporturl = URI("#{reporturl}?transaction_id=#{transaction_id}")
72
- res = Net::HTTP.get(reporturl)
77
+ Net::HTTP.get(reporturl)
73
78
  rescue
74
79
  end
75
80
 
@@ -94,7 +99,7 @@ module MollieBank
94
99
  # @example
95
100
  # # checks if a order was paid
96
101
  # http://localhost:4567/xml/ideal?a=check
97
- post '/xml/ideal', '/xml/ideal/' do
102
+ get_or_post '/xml/ideal', '/xml/ideal/' do
98
103
  content_type 'text/xml'
99
104
  case params[:a]
100
105
  when "banklist"
@@ -108,12 +113,10 @@ module MollieBank
108
113
  return error(-14) unless params[:amount].to_i > 118
109
114
  return error(-6) unless params.has_key?("bank_id")
110
115
 
111
- partnerid = params[:partnerid]
112
116
  description = params[:description]
113
117
  reporturl = params[:reporturl]
114
118
  returnurl = params[:returnurl]
115
119
  amount = params[:amount]
116
- bank_id = params[:bank_id]
117
120
 
118
121
  transaction_id = UUID.new.generate.gsub('-', '')
119
122
 
@@ -1,4 +1,4 @@
1
1
  module MollieBank
2
2
  # Version number of MollieBank
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
data/mollie-bank.gemspec CHANGED
@@ -28,9 +28,9 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency "simplecov"
29
29
  s.add_development_dependency "coveralls"
30
30
 
31
- s.add_dependency "rake", "> 0.9.0"
32
- s.add_dependency "uuid", "> 1.0"
33
- s.add_dependency "haml", "> 3.0"
31
+ s.add_dependency "rake", "~> 10.1.0"
32
+ s.add_dependency "uuid", "~> 2.3.7"
33
+ s.add_dependency "haml", "~> 4.0.4"
34
34
  s.add_dependency "sinatra", "~> 1.4.0"
35
35
  s.add_dependency "sinatra-contrib", "~> 1.4.0"
36
36
  end
data/spec/backend_spec.rb CHANGED
@@ -1,6 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "backend" do
4
+ it "should support GET requests to the /xml/ideal endpoint" do
5
+ get '/xml/ideal', {
6
+ :a => 'banklist'
7
+ }
8
+ last_response.should be_ok
9
+ end
4
10
  it "should return the Mollie Bank when requesting /xml/ideal?a=banklist" do
5
11
  post '/xml/ideal', {
6
12
  :a => 'banklist'
@@ -8,8 +14,8 @@ describe "backend" do
8
14
 
9
15
  last_response.should be_ok
10
16
  xml = Nokogiri::Slop(last_response.body)
11
- xml.response.bank.bank_id.content.should == "0001"
12
- xml.response.bank.bank_name.content.should == "Mollie Bank"
17
+ xml.response.bank.bank_id.content.should eq "0001"
18
+ xml.response.bank.bank_name.content.should eq "Mollie Bank"
13
19
  end
14
20
  it "should also return the Mollie bank when requesting /xml/ideal/?a=banklist" do
15
21
  post '/xml/ideal/', {
@@ -18,8 +24,8 @@ describe "backend" do
18
24
 
19
25
  last_response.should be_ok
20
26
  xml = Nokogiri::Slop(last_response.body)
21
- xml.response.bank.bank_id.content.should == "0001"
22
- xml.response.bank.bank_name.content.should == "Mollie Bank"
27
+ xml.response.bank.bank_id.content.should eq "0001"
28
+ xml.response.bank.bank_name.content.should eq "Mollie Bank"
23
29
  end
24
30
  it "should return the correct xml for /xml/ideal?a=fetch" do
25
31
  post '/xml/ideal', {
@@ -35,10 +41,10 @@ describe "backend" do
35
41
 
36
42
  xml = Nokogiri::Slop(last_response.body)
37
43
  xml.response.order.transaction_id.content.should_not be_blank
38
- xml.response.order.amount.content.should == "1000"
39
- xml.response.order.currency.content.should == "EUR"
44
+ xml.response.order.amount.content.should eq "1000"
45
+ xml.response.order.currency.content.should eq "EUR"
40
46
  xml.response.order.URL.content.should contain "http://example.org:4567/ideal?transaction_id="
41
- xml.response.order.message.content.should == "Your iDEAL-payment has successfully been setup. Your customer should visit the given URL to make the payment"
47
+ xml.response.order.message.content.should eq "Your iDEAL-payment has successfully been setup. Your customer should visit the given URL to make the payment"
42
48
  end
43
49
  it "should return the true if paid" do
44
50
  MollieBank::Storage.set('987654', {
@@ -52,7 +58,7 @@ describe "backend" do
52
58
 
53
59
  last_response.should be_ok
54
60
  xml = Nokogiri::Slop(last_response.body)
55
- xml.response.order.payed.content.should == "true"
61
+ xml.response.order.payed.content.should eq "true"
56
62
  end
57
63
  it "should return the false not paid" do
58
64
  MollieBank::Storage.set('987654', {
@@ -66,6 +72,6 @@ describe "backend" do
66
72
 
67
73
  last_response.should be_ok
68
74
  xml = Nokogiri::Slop(last_response.body)
69
- xml.response.order.payed.content.should == "false"
75
+ xml.response.order.payed.content.should eq "false"
70
76
  end
71
77
  end
data/spec/errors_spec.rb CHANGED
@@ -7,10 +7,10 @@ describe "errors" do
7
7
  :a => 'unknown'
8
8
  }
9
9
  xml = Nokogiri::Slop(last_response.body)
10
- xml.response.item["type"].should == "error"
10
+ xml.response.item["type"].should eq "error"
11
11
 
12
- xml.response.item.errorcode.content.should == "-1"
13
- xml.response.item.message.content.should == "Did not receive a proper input value."
12
+ xml.response.item.errorcode.content.should eq "-1"
13
+ xml.response.item.message.content.should eq "Did not receive a proper input value."
14
14
  end
15
15
  end
16
16
  describe "/xml/ideal?a=fetch" do
@@ -25,10 +25,10 @@ describe "errors" do
25
25
  }
26
26
  last_response.should be_ok
27
27
  xml = Nokogiri::Slop(last_response.body)
28
- xml.response.item["type"].should == "error"
28
+ xml.response.item["type"].should eq "error"
29
29
 
30
- xml.response.item.errorcode.content.should == "-2"
31
- xml.response.item.message.content.should == "A fetch was issued without specification of 'partnerid'."
30
+ xml.response.item.errorcode.content.should eq "-2"
31
+ xml.response.item.message.content.should eq "A fetch was issued without specification of 'partnerid'."
32
32
  end
33
33
  it "should return error -7 if description isn't provided" do
34
34
  post '/xml/ideal', {
@@ -41,10 +41,10 @@ describe "errors" do
41
41
  }
42
42
  last_response.should be_ok
43
43
  xml = Nokogiri::Slop(last_response.body)
44
- xml.response.item["type"].should == "error"
44
+ xml.response.item["type"].should eq "error"
45
45
 
46
- xml.response.item.errorcode.content.should == "-7"
47
- xml.response.item.message.content.should == "A fetch was issued without specification of 'description'."
46
+ xml.response.item.errorcode.content.should eq "-7"
47
+ xml.response.item.message.content.should eq "A fetch was issued without specification of 'description'."
48
48
  end
49
49
  it "should return error -3 if reporturl isn't provided" do
50
50
  post '/xml/ideal', {
@@ -57,10 +57,10 @@ describe "errors" do
57
57
  }
58
58
  last_response.should be_ok
59
59
  xml = Nokogiri::Slop(last_response.body)
60
- xml.response.item["type"].should == "error"
60
+ xml.response.item["type"].should eq "error"
61
61
 
62
- xml.response.item.errorcode.content.should == "-3"
63
- xml.response.item.message.content.should == "A fetch was issued without (proper) specification of 'reporturl'."
62
+ xml.response.item.errorcode.content.should eq "-3"
63
+ xml.response.item.message.content.should eq "A fetch was issued without (proper) specification of 'reporturl'."
64
64
  end
65
65
  it "should return error -12 if returnurl isn't provided" do
66
66
  post '/xml/ideal', {
@@ -73,10 +73,10 @@ describe "errors" do
73
73
  }
74
74
  last_response.should be_ok
75
75
  xml = Nokogiri::Slop(last_response.body)
76
- xml.response.item["type"].should == "error"
76
+ xml.response.item["type"].should eq "error"
77
77
 
78
- xml.response.item.errorcode.content.should == "-12"
79
- xml.response.item.message.content.should == "A fetch was issued without (proper) specification of 'returnurl'."
78
+ xml.response.item.errorcode.content.should eq "-12"
79
+ xml.response.item.message.content.should eq "A fetch was issued without (proper) specification of 'returnurl'."
80
80
  end
81
81
  it "should return error -4 if amount isn't provided" do
82
82
  post '/xml/ideal', {
@@ -89,10 +89,10 @@ describe "errors" do
89
89
  }
90
90
  last_response.should be_ok
91
91
  xml = Nokogiri::Slop(last_response.body)
92
- xml.response.item["type"].should == "error"
92
+ xml.response.item["type"].should eq "error"
93
93
 
94
- xml.response.item.errorcode.content.should == "-4"
95
- xml.response.item.message.content.should == "A fetch was issued without specification of 'amount'."
94
+ xml.response.item.errorcode.content.should eq "-4"
95
+ xml.response.item.message.content.should eq "A fetch was issued without specification of 'amount'."
96
96
  end
97
97
  it "should return error -14 if amount is to low" do
98
98
  post '/xml/ideal', {
@@ -106,10 +106,10 @@ describe "errors" do
106
106
  }
107
107
  last_response.should be_ok
108
108
  xml = Nokogiri::Slop(last_response.body)
109
- xml.response.item["type"].should == "error"
109
+ xml.response.item["type"].should eq "error"
110
110
 
111
- xml.response.item.errorcode.content.should == "-14"
112
- xml.response.item.message.content.should == "Minimum amount for an ideal transaction is 1,18 EUR."
111
+ xml.response.item.errorcode.content.should eq "-14"
112
+ xml.response.item.message.content.should eq "Minimum amount for an ideal transaction is 1,18 EUR."
113
113
  end
114
114
  it "should return error -6 if bank_id isn't provided" do
115
115
  post '/xml/ideal', {
@@ -122,10 +122,10 @@ describe "errors" do
122
122
  }
123
123
  last_response.should be_ok
124
124
  xml = Nokogiri::Slop(last_response.body)
125
- xml.response.item["type"].should == "error"
125
+ xml.response.item["type"].should eq "error"
126
126
 
127
- xml.response.item.errorcode.content.should == "-6"
128
- xml.response.item.message.content.should == "A fetch was issues without specification of a known 'bank_id'."
127
+ xml.response.item.errorcode.content.should eq "-6"
128
+ xml.response.item.message.content.should eq "A fetch was issues without specification of a known 'bank_id'."
129
129
  end
130
130
  end
131
131
  describe "/xml/ideal?a=check" do
@@ -136,10 +136,10 @@ describe "errors" do
136
136
  }
137
137
  last_response.should be_ok
138
138
  xml = Nokogiri::Slop(last_response.body)
139
- xml.response.item["type"].should == "error"
139
+ xml.response.item["type"].should eq "error"
140
140
 
141
- xml.response.item.errorcode.content.should == "-11"
142
- xml.response.item.message.content.should == "A check was issued without specification of your partner_id."
141
+ xml.response.item.errorcode.content.should eq "-11"
142
+ xml.response.item.message.content.should eq "A check was issued without specification of your partner_id."
143
143
  end
144
144
  it "should return error -8 if transaction_id isn't provided" do
145
145
  post '/xml/ideal', {
@@ -148,10 +148,10 @@ describe "errors" do
148
148
  }
149
149
  last_response.should be_ok
150
150
  xml = Nokogiri::Slop(last_response.body)
151
- xml.response.item["type"].should == "error"
151
+ xml.response.item["type"].should eq "error"
152
152
 
153
- xml.response.item.errorcode.content.should == "-8"
154
- xml.response.item.message.content.should == "A check was issued without specification of transaction_id."
153
+ xml.response.item.errorcode.content.should eq "-8"
154
+ xml.response.item.message.content.should eq "A check was issued without specification of transaction_id."
155
155
  end
156
156
  it "should return error -10 if transaction_id is unknown" do
157
157
  post '/xml/ideal', {
@@ -161,10 +161,10 @@ describe "errors" do
161
161
  }
162
162
  last_response.should be_ok
163
163
  xml = Nokogiri::Slop(last_response.body)
164
- xml.response.item["type"].should == "error"
164
+ xml.response.item["type"].should eq "error"
165
165
 
166
- xml.response.item.errorcode.content.should == "-10"
167
- xml.response.item.message.content.should == "This is an unknown order."
166
+ xml.response.item.errorcode.content.should eq "-10"
167
+ xml.response.item.message.content.should eq "This is an unknown order."
168
168
  end
169
169
  end
170
170
  end
@@ -57,6 +57,6 @@ describe "frontend" do
57
57
 
58
58
  last_response.should be_redirect
59
59
  follow_redirect!
60
- last_request.url.should == 'http://example.org/return.html?transaction_id=987654'
60
+ last_request.url.should eq 'http://example.org/return.html?transaction_id=987654'
61
61
  end
62
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mollie-bank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel van Rijn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-14 00:00:00.000000000 Z
11
+ date: 2014-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -126,44 +126,44 @@ dependencies:
126
126
  name: rake
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>'
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
- version: 0.9.0
131
+ version: 10.1.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>'
136
+ - - ~>
137
137
  - !ruby/object:Gem::Version
138
- version: 0.9.0
138
+ version: 10.1.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: uuid
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>'
143
+ - - ~>
144
144
  - !ruby/object:Gem::Version
145
- version: '1.0'
145
+ version: 2.3.7
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>'
150
+ - - ~>
151
151
  - !ruby/object:Gem::Version
152
- version: '1.0'
152
+ version: 2.3.7
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: haml
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '>'
157
+ - - ~>
158
158
  - !ruby/object:Gem::Version
159
- version: '3.0'
159
+ version: 4.0.4
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '>'
164
+ - - ~>
165
165
  - !ruby/object:Gem::Version
166
- version: '3.0'
166
+ version: 4.0.4
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: sinatra
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -204,7 +204,8 @@ extra_rdoc_files: []
204
204
  files:
205
205
  - .gitignore
206
206
  - .rspec
207
- - .rvmrc
207
+ - .ruby-gemset
208
+ - .ruby-version
208
209
  - .travis.yml
209
210
  - .yardopts
210
211
  - CHANGELOG.md
@@ -259,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
260
  version: '0'
260
261
  requirements: []
261
262
  rubyforge_project: mollie-bank
262
- rubygems_version: 2.0.0
263
+ rubygems_version: 2.1.11
263
264
  signing_key:
264
265
  specification_version: 4
265
266
  summary: Mollie Bank server to make Mollie iDeal payments on your local machine
data/.rvmrc DELETED
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
- # Only full ruby name is supported here, for short names use:
8
- # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-p125@mollie-bank"
10
-
11
- # Uncomment the following lines if you want to verify rvm version per project
12
- # rvmrc_rvm_version="1.10.3" # 1.10.1 seams as a safe start
13
- # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
- # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
- # return 1
16
- # }
17
-
18
- # First we attempt to load the desired environment directly from the environment
19
- # file. This is very fast and efficient compared to running through the entire
20
- # CLI and selector. If you want feedback on which environment was used then
21
- # insert the word 'use' after --create as this triggers verbose mode.
22
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
- then
25
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
- [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
- \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
- else
29
- # If the environment file has not yet been created, use the RVM CLI to select.
30
- rvm --create "$environment_id" || {
31
- echo "Failed to create RVM environment '${environment_id}'."
32
- return 1
33
- }
34
- fi
35
-
36
- # If you use bundler, this might be useful to you:
37
- # if [[ -s Gemfile ]] && {
38
- # ! builtin command -v bundle >/dev/null ||
39
- # builtin command -v bundle | grep $rvm_path/bin/bundle >/dev/null
40
- # }
41
- # then
42
- # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
- # gem install bundler
44
- # fi
45
- # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
- # then
47
- # bundle install | grep -vE '^Using|Your bundle is complete'
48
- # fi