mollie-ruby 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/mollie/client.rb +9 -0
- data/lib/mollie/version.rb +1 -1
- data/spec/mollie/client_spec.rb +36 -0
- data/spec/vcr_cassettes/get_ideal_method.yml +44 -0
- data/spec/vcr_cassettes/get_methods_list.yml +47 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 271a00cbef9566cf6fdb2f56c83050135ea692ff
|
4
|
+
data.tar.gz: 21b4d5902a7e975b612bb7e73ff2db7e321b23a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ffec9d08da58a6236a38675fbc9887b334d8862c048239932086c6df86e8c75a8f1ebbbc9f59276ee3b5679f5c876e04a2c9036bc92dd3418e2483d70f35cb4
|
7
|
+
data.tar.gz: bef941cc84448794056318ba28920bc1fa33720a8a1c0045a3a7663c178843e96e204a8844a9916b42ba82939729d1d777470dd29109bca2adc55f9114f33380
|
data/README.md
CHANGED
@@ -5,6 +5,8 @@
|
|
5
5
|
[![Code Climate](https://codeclimate.com/github/pero-ict-solutions/mollie-ruby/badges/gpa.svg)](https://codeclimate.com/github/pero-ict-solutions/mollie-ruby)
|
6
6
|
[![Test Coverage](https://codeclimate.com/github/pero-ict-solutions/mollie-ruby/badges/coverage.svg)](https://codeclimate.com/github/pero-ict-solutions/mollie-ruby)
|
7
7
|
|
8
|
+
[![Stories in Ready](https://badge.waffle.io/pero-ict-solutions/mollie-ruby.svg?label=ready&title=Ready)](http://waffle.io/pero-ict-solutions/mollie-ruby)
|
9
|
+
|
8
10
|
Accepting [iDEAL](https://www.mollie.nl/betaaldiensten/ideal/), [Mister Cash](https://www.mollie.nl/betaaldiensten/mistercash/), [Creditcard](https://www.mollie.nl/betaaldiensten/creditcard/), and [paysafecard](https://www.mollie.nl/betaaldiensten/paysafecard/) online payments without fixed monthly costs or any punishing registration procedures. Just use the Mollie API to receive payments directly on your website.
|
9
11
|
|
10
12
|
## Requirements
|
data/lib/mollie/client.rb
CHANGED
@@ -60,5 +60,14 @@ module Mollie
|
|
60
60
|
JSON.parse(response.body)
|
61
61
|
end
|
62
62
|
|
63
|
+
def payment_methods(method = nil)
|
64
|
+
response = self.class.get("/methods/#{method}",
|
65
|
+
:headers => {
|
66
|
+
'Authorization' => auth_token
|
67
|
+
}
|
68
|
+
)
|
69
|
+
JSON.parse(response.body)
|
70
|
+
end
|
71
|
+
|
63
72
|
end
|
64
73
|
end
|
data/lib/mollie/version.rb
CHANGED
data/spec/mollie/client_spec.rb
CHANGED
@@ -62,6 +62,42 @@ describe Mollie::Client do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
context 'payment_methods' do
|
66
|
+
it 'returns a hash with payment methods' do
|
67
|
+
VCR.use_cassette('get methods list') do
|
68
|
+
client = Mollie::Client.new(api_key)
|
69
|
+
response = client.payment_methods
|
70
|
+
|
71
|
+
expect(response['totalCount']).to eql 8
|
72
|
+
expect(response['data'].first['id']).to eql 'ideal'
|
73
|
+
expect(response['data'].first['description']).to eql 'iDEAL'
|
74
|
+
|
75
|
+
expect(response['data'].first['amount']['minimum']).to eql '0.55'
|
76
|
+
expect(response['data'].first['amount']['maximum']).to eql '50000.00'
|
77
|
+
|
78
|
+
expect(response['data'].first['image']['normal']).to eql 'https://www.mollie.com/images/payscreen/methods/ideal.png'
|
79
|
+
expect(response['data'].first['image']['bigger']).to eql 'https://www.mollie.com/images/payscreen/methods/ideal@2x.png'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'returns a hash for ideal method' do
|
84
|
+
VCR.use_cassette('get ideal method') do
|
85
|
+
|
86
|
+
client = Mollie::Client.new(api_key)
|
87
|
+
response = client.payment_methods('ideal')
|
88
|
+
|
89
|
+
expect(response['id']).to eql 'ideal'
|
90
|
+
expect(response['description']).to eql 'iDEAL'
|
91
|
+
|
92
|
+
expect(response['amount']['minimum']).to eql '0.55'
|
93
|
+
expect(response['amount']['maximum']).to eql '50000.00'
|
94
|
+
|
95
|
+
expect(response['image']['normal']).to eql 'https://www.mollie.com/images/payscreen/methods/ideal.png'
|
96
|
+
expect(response['image']['bigger']).to eql 'https://www.mollie.com/images/payscreen/methods/ideal@2x.png'
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
65
101
|
context "error response" do
|
66
102
|
it "will raise an Exception" do
|
67
103
|
VCR.use_cassette('invalid_key') do
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.mollie.nl/v1/methods/ideal
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer test_4drFuX5HdjBaFxdXoaABYD8yO4HjuT
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- nginx
|
19
|
+
Date:
|
20
|
+
- Fri, 30 Jan 2015 08:41:12 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=utf-8
|
23
|
+
Content-Length:
|
24
|
+
- '236'
|
25
|
+
Connection:
|
26
|
+
- keep-alive
|
27
|
+
Vary:
|
28
|
+
- Accept-Encoding
|
29
|
+
Access-Control-Allow-Credentials:
|
30
|
+
- 'true'
|
31
|
+
Access-Control-Allow-Methods:
|
32
|
+
- GET, POST, HEAD, OPTIONS, DELETE
|
33
|
+
Access-Control-Max-Age:
|
34
|
+
- '300'
|
35
|
+
Strict-Transport-Security:
|
36
|
+
- max-age=31556926; includeSubDomains
|
37
|
+
X-Whom:
|
38
|
+
- dc1-web-3
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"id":"ideal","description":"iDEAL","amount":{"minimum":"0.55","maximum":"50000.00"},"image":{"normal":"https://www.mollie.com/images/payscreen/methods/ideal.png","bigger":"https://www.mollie.com/images/payscreen/methods/ideal@2x.png"}}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Fri, 30 Jan 2015 08:41:13 GMT
|
44
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.mollie.nl/v1/methods/
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer test_4drFuX5HdjBaFxdXoaABYD8yO4HjuT
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- nginx
|
19
|
+
Date:
|
20
|
+
- Fri, 30 Jan 2015 08:39:00 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=utf-8
|
23
|
+
Content-Length:
|
24
|
+
- '2065'
|
25
|
+
Connection:
|
26
|
+
- keep-alive
|
27
|
+
Vary:
|
28
|
+
- Accept-Encoding
|
29
|
+
Access-Control-Allow-Credentials:
|
30
|
+
- 'true'
|
31
|
+
Access-Control-Allow-Methods:
|
32
|
+
- GET, POST, HEAD, OPTIONS, DELETE
|
33
|
+
Access-Control-Max-Age:
|
34
|
+
- '300'
|
35
|
+
Strict-Transport-Security:
|
36
|
+
- max-age=31556926; includeSubDomains
|
37
|
+
X-Whom:
|
38
|
+
- dc1-web-4
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"totalCount":8,"offset":0,"count":8,"data":[{"id":"ideal","description":"iDEAL","amount":{"minimum":"0.55","maximum":"50000.00"},"image":{"normal":"https://www.mollie.com/images/payscreen/methods/ideal.png","bigger":"https://www.mollie.com/images/payscreen/methods/ideal@2x.png"}},{"id":"creditcard","description":"Creditcard","amount":{"minimum":"0.32","maximum":"250.00"},"image":{"normal":"https://www.mollie.com/images/payscreen/methods/creditcard.png","bigger":"https://www.mollie.com/images/payscreen/methods/creditcard@2x.png"}},{"id":"mistercash","description":"Bancontact/Mister
|
42
|
+
Cash","amount":{"minimum":"0.31","maximum":"10000.00"},"image":{"normal":"https://www.mollie.com/images/payscreen/methods/mistercash.png","bigger":"https://www.mollie.com/images/payscreen/methods/mistercash@2x.png"}},{"id":"sofort","description":"SOFORT
|
43
|
+
Banking","amount":{"minimum":"0.31","maximum":"5000.00"},"image":{"normal":"https://www.mollie.com/images/payscreen/methods/sofort.png","bigger":"https://www.mollie.com/images/payscreen/methods/sofort@2x.png"}},{"id":"banktransfer","description":"Bank
|
44
|
+
transfer","amount":{"minimum":"0.31","maximum":"50000.00"},"image":{"normal":"https://www.mollie.com/images/payscreen/methods/banktransfer.png","bigger":"https://www.mollie.com/images/payscreen/methods/banktransfer@2x.png"}},{"id":"bitcoin","description":"Bitcoin","amount":{"minimum":"1.00","maximum":"15000.00"},"image":{"normal":"https://www.mollie.com/images/payscreen/methods/bitcoin.png","bigger":"https://www.mollie.com/images/payscreen/methods/bitcoin@2x.png"}},{"id":"paypal","description":"PayPal","amount":{"minimum":"0.13","maximum":"5000.00"},"image":{"normal":"https://www.mollie.com/images/payscreen/methods/paypal.png","bigger":"https://www.mollie.com/images/payscreen/methods/paypal@2x.png"}},{"id":"paysafecard","description":"paysafecard","amount":{"minimum":"1.00","maximum":"999.99"},"image":{"normal":"https://www.mollie.com/images/payscreen/methods/paysafecard.png","bigger":"https://www.mollie.com/images/payscreen/methods/paysafecard@2x.png"}}]}'
|
45
|
+
http_version:
|
46
|
+
recorded_at: Fri, 30 Jan 2015 08:39:01 GMT
|
47
|
+
recorded_with: VCR 2.9.3
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mollie-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Berkenbosch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -141,7 +141,9 @@ files:
|
|
141
141
|
- mollie.gemspec
|
142
142
|
- spec/mollie/client_spec.rb
|
143
143
|
- spec/spec_helper.rb
|
144
|
+
- spec/vcr_cassettes/get_ideal_method.yml
|
144
145
|
- spec/vcr_cassettes/get_issuers_list.yml
|
146
|
+
- spec/vcr_cassettes/get_methods_list.yml
|
145
147
|
- spec/vcr_cassettes/get_status_paid.yml
|
146
148
|
- spec/vcr_cassettes/invalid_key.yml
|
147
149
|
- spec/vcr_cassettes/prepare_payment.yml
|
@@ -174,7 +176,9 @@ summary: Ruby API Client for Mollie
|
|
174
176
|
test_files:
|
175
177
|
- spec/mollie/client_spec.rb
|
176
178
|
- spec/spec_helper.rb
|
179
|
+
- spec/vcr_cassettes/get_ideal_method.yml
|
177
180
|
- spec/vcr_cassettes/get_issuers_list.yml
|
181
|
+
- spec/vcr_cassettes/get_methods_list.yml
|
178
182
|
- spec/vcr_cassettes/get_status_paid.yml
|
179
183
|
- spec/vcr_cassettes/invalid_key.yml
|
180
184
|
- spec/vcr_cassettes/prepare_payment.yml
|