mollie-ruby-multi-version 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +66 -0
- data/Rakefile +1 -0
- data/lib/mollie.rb +2 -0
- data/lib/mollie/client.rb +74 -0
- data/lib/mollie/version.rb +3 -0
- data/mollie.gemspec +30 -0
- data/spec/mollie/client_spec.rb +111 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/vcr_cassettes/get_ideal_method.yml +44 -0
- data/spec/vcr_cassettes/get_issuers_list.yml +43 -0
- data/spec/vcr_cassettes/get_methods_list.yml +47 -0
- data/spec/vcr_cassettes/get_status_paid.yml +44 -0
- data/spec/vcr_cassettes/invalid_key.yml +42 -0
- data/spec/vcr_cassettes/prepare_payment.yml +43 -0
- data/spec/vcr_cassettes/refund_payment.yml +44 -0
- data/wercker.yml +25 -0
- metadata +185 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 70a8285a20d713a4b90f9b1626d9a09ebb5f5783
|
4
|
+
data.tar.gz: cf3604e99b660cf7f7c51bff0bce6f7fb9a9a110
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 72cb540fd9aa833d7f6fc609b66e12d3523b83a006fd09ad2f93b55bb643c36cdba446210a14b21d69d64107ee6c0b0b3e168cd7e2de0f8a1b2deeceeab8b077
|
7
|
+
data.tar.gz: fa76d6cfc471840b80c509a89978c59bb41ce2ef1c4406966354ff8cbed78e292ab6eee12c3d55fe9370b674094c018efb0b3d81c198789a4c2709688c8ce1fc
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Peter Berkenbosch
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# Mollie API client for Ruby
|
2
|
+
|
3
|
+
[](https://app.wercker.com/project/bykey/a8cb5d924bf5a477b7e7b0b971a51470)
|
4
|
+
[](http://badge.fury.io/rb/mollie-ruby)
|
5
|
+
[](https://codeclimate.com/github/pero-ict-solutions/mollie-ruby)
|
6
|
+
[](https://codeclimate.com/github/pero-ict-solutions/mollie-ruby)
|
7
|
+
|
8
|
+
[](http://waffle.io/pero-ict-solutions/mollie-ruby)
|
9
|
+
|
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.
|
11
|
+
|
12
|
+
## Requirements
|
13
|
+
To use the Mollie API client, the following things are required:
|
14
|
+
|
15
|
+
+ Get yourself a free [Mollie account](https://www.mollie.nl/aanmelden). No sign up costs.
|
16
|
+
+ Create a new [Website profile](https://www.mollie.nl/beheer/account/profielen/) to generate API keys (live and test mode) and setup your webhook.
|
17
|
+
+ Now you're ready to use the Mollie API client in test mode.
|
18
|
+
+ In order to accept payments in live mode, payment methods must be activated in your account. Follow [a few of steps](https://www.mollie.nl/beheer/diensten), and let us handle the rest.
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
Add this line to your application's Gemfile:
|
23
|
+
|
24
|
+
gem 'mollie-ruby', require: 'mollie'
|
25
|
+
|
26
|
+
And then execute:
|
27
|
+
|
28
|
+
$ bundle
|
29
|
+
|
30
|
+
### Using from github source
|
31
|
+
|
32
|
+
If you want to use the latest 'edge' code, you can use this line in your Gemfile:
|
33
|
+
|
34
|
+
gem 'mollie-ruby', github: 'pero-ict-solutions/mollie-ruby', require: 'mollie'
|
35
|
+
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
the most basic way of getting paid is to prepare the payment on the Mollie server and then redirect the user to the provided `paymentUrl`. Make sure you store the payment `id` for further references. When the user makes a payment, Mollie will call the provided `redirect_url` webhook with the `id` as the POST parameter.
|
39
|
+
|
40
|
+
### Prepare payment
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
amount = 99.99
|
44
|
+
description = "My Cool product"
|
45
|
+
redirect_url = "http://mystore.com/orders/update"
|
46
|
+
client = Mollie::Client.new(api_key)
|
47
|
+
response = client.prepare_payment(amount, description, redirect_url)
|
48
|
+
payment_id = response["id"]
|
49
|
+
redirect_to response["links"]["paymentUrl"]
|
50
|
+
```
|
51
|
+
|
52
|
+
### Get status
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
client = Mollie::Client.new(api_key)
|
56
|
+
response = client.payment_status(payment_id)
|
57
|
+
response["status"]
|
58
|
+
```
|
59
|
+
|
60
|
+
## Contributing
|
61
|
+
|
62
|
+
1. Fork it
|
63
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
64
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
65
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
66
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/mollie.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Mollie
|
5
|
+
class Client
|
6
|
+
include HTTParty
|
7
|
+
base_uri "https://api.mollie.nl"
|
8
|
+
format :json
|
9
|
+
attr_accessor :api_key, :api_version
|
10
|
+
|
11
|
+
def initialize(api_key, api_version = 'v1')
|
12
|
+
self.api_key = api_key
|
13
|
+
self.api_version = api_version
|
14
|
+
end
|
15
|
+
|
16
|
+
def auth_token
|
17
|
+
"Bearer " + self.api_key
|
18
|
+
end
|
19
|
+
|
20
|
+
def prepare_payment(amount, description, redirect_url, metadata = {}, method=nil, method_params = {})
|
21
|
+
response = self.class.post("/#{self.api_version}/payments",
|
22
|
+
:body => {
|
23
|
+
:amount => amount,
|
24
|
+
:description => description,
|
25
|
+
:redirectUrl => redirect_url,
|
26
|
+
:metadata => metadata,
|
27
|
+
:method => method
|
28
|
+
}.merge(method_params),
|
29
|
+
:headers => {
|
30
|
+
'Authorization' => auth_token
|
31
|
+
}
|
32
|
+
)
|
33
|
+
JSON.parse(response.body)
|
34
|
+
end
|
35
|
+
|
36
|
+
def issuers
|
37
|
+
response = self.class.get("/#{self.api_version}/issuers",
|
38
|
+
:headers => {
|
39
|
+
'Authorization' => auth_token
|
40
|
+
}
|
41
|
+
)
|
42
|
+
response = JSON.parse(response.body)
|
43
|
+
response["data"].map {|issuer| {id: issuer["id"], name: issuer["name"]} }
|
44
|
+
end
|
45
|
+
|
46
|
+
def payment_status(payment_id)
|
47
|
+
response = self.class.get("/#{self.api_version}/payments/#{payment_id}",
|
48
|
+
:headers => {
|
49
|
+
'Authorization' => auth_token
|
50
|
+
}
|
51
|
+
)
|
52
|
+
JSON.parse(response.body)
|
53
|
+
end
|
54
|
+
|
55
|
+
def refund_payment(payment_id)
|
56
|
+
response = self.class.post("/#{self.api_version}/payments/#{payment_id}/refunds",
|
57
|
+
:headers => {
|
58
|
+
'Authorization' => auth_token
|
59
|
+
}
|
60
|
+
)
|
61
|
+
JSON.parse(response.body)
|
62
|
+
end
|
63
|
+
|
64
|
+
def payment_methods(method = nil)
|
65
|
+
response = self.class.get("/#{self.api_version}/methods/#{method}",
|
66
|
+
:headers => {
|
67
|
+
'Authorization' => auth_token
|
68
|
+
}
|
69
|
+
)
|
70
|
+
JSON.parse(response.body)
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
data/mollie.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mollie/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mollie-ruby-multi-version"
|
8
|
+
spec.version = Mollie::VERSION
|
9
|
+
spec.authors = ["Isabella Santos"]
|
10
|
+
spec.email = ["isabella.cdossantos@gmail.com"]
|
11
|
+
spec.description = %q{Ruby API Client for Mollie}
|
12
|
+
spec.summary = spec.description
|
13
|
+
spec.homepage = "https://github.com/isabellaSantos/mollie-ruby"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "httparty"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'vcr'
|
27
|
+
spec.add_development_dependency 'webmock'
|
28
|
+
spec.add_development_dependency 'pry'
|
29
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
30
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mollie::Client do
|
4
|
+
|
5
|
+
let(:api_key) { "test_4drFuX5HdjBaFxdXoaABYD8yO4HjuT" }
|
6
|
+
|
7
|
+
context '#prepare' do
|
8
|
+
|
9
|
+
it "will setup the payment on mollie" do
|
10
|
+
|
11
|
+
VCR.use_cassette('prepare_payment') do
|
12
|
+
client = Mollie::Client.new(api_key)
|
13
|
+
amount = 99.99
|
14
|
+
description = "My fantastic product"
|
15
|
+
redirect_url = "http://localhost:3000/payments/1/update"
|
16
|
+
response = client.prepare_payment(amount, description, redirect_url, {:order_id => "R232454365"})
|
17
|
+
|
18
|
+
expect(response["id"]).to eql "tr_ALc7B2h9UM"
|
19
|
+
expect(response["mode"]).to eql "test"
|
20
|
+
expect(response["status"]).to eql "open"
|
21
|
+
expect(response["amount"]).to eql "99.99"
|
22
|
+
expect(response["description"]).to eql description
|
23
|
+
|
24
|
+
expect(response["metadata"]["order_id"]).to eql "R232454365"
|
25
|
+
|
26
|
+
expect(response["links"]["paymentUrl"]).to eql "https://www.mollie.nl/payscreen/pay/ALc7B2h9UM"
|
27
|
+
expect(response["links"]["redirectUrl"]).to eql redirect_url
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "issuers" do
|
33
|
+
it "returns a hash with the iDeal issuers" do
|
34
|
+
VCR.use_cassette('get_issuers_list') do
|
35
|
+
client = Mollie::Client.new(api_key)
|
36
|
+
response = client.issuers
|
37
|
+
expect(response.first[:id]).to eql "ideal_TESTNL99"
|
38
|
+
expect(response.first[:name]).to eql "TBM Bank"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'status' do
|
44
|
+
context 'when payment is paid' do
|
45
|
+
it "returns the paid status" do
|
46
|
+
VCR.use_cassette('get_status_paid') do
|
47
|
+
client = Mollie::Client.new(api_key)
|
48
|
+
response = client.payment_status("tr_8NQDMOE7EC")
|
49
|
+
expect(response["status"]).to eql "paid"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "refund" do
|
56
|
+
it "refunds the payment" do
|
57
|
+
VCR.use_cassette('refund payment') do
|
58
|
+
client = Mollie::Client.new(api_key)
|
59
|
+
response = client.refund_payment("tr_8NQDMOE7EC")
|
60
|
+
expect(response["payment"]["status"]).to eql "refunded"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
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
|
+
|
101
|
+
context "error response" do
|
102
|
+
it "will raise an Exception" do
|
103
|
+
VCR.use_cassette('invalid_key') do
|
104
|
+
client = Mollie::Client.new(api_key << "foo")
|
105
|
+
response = client.refund_payment("tr_8NQDMOE7EC")
|
106
|
+
expect(response["error"]).to_not be nil
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#require "codeclimate-test-reporter"
|
2
|
+
#CodeClimate::TestReporter.start
|
3
|
+
|
4
|
+
require 'mollie'
|
5
|
+
require 'vcr'
|
6
|
+
require 'pry'
|
7
|
+
|
8
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
9
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
10
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
11
|
+
# loaded once.
|
12
|
+
#
|
13
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
14
|
+
RSpec.configure do |config|
|
15
|
+
config.run_all_when_everything_filtered = true
|
16
|
+
config.filter_run :focus
|
17
|
+
|
18
|
+
# Run specs in random order to surface order dependencies. If you find an
|
19
|
+
# order dependency and want to debug it, you can fix the order by providing
|
20
|
+
# the seed, which is printed after each run.
|
21
|
+
# --seed 1234
|
22
|
+
config.order = 'random'
|
23
|
+
end
|
24
|
+
|
25
|
+
VCR.configure do |c|
|
26
|
+
c.cassette_library_dir = 'spec/vcr_cassettes'
|
27
|
+
c.hook_into :webmock # or :fakeweb
|
28
|
+
c.ignore_hosts 'codeclimate.com'
|
29
|
+
end
|
@@ -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,43 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.mollie.nl/v1/issuers
|
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
|
+
- Wed, 08 Oct 2014 20:21:37 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=utf-8
|
23
|
+
Content-Length:
|
24
|
+
- '105'
|
25
|
+
Connection:
|
26
|
+
- keep-alive
|
27
|
+
Access-Control-Allow-Credentials:
|
28
|
+
- 'true'
|
29
|
+
Access-Control-Allow-Methods:
|
30
|
+
- GET, POST, HEAD, OPTIONS, DELETE
|
31
|
+
Access-Control-Max-Age:
|
32
|
+
- '300'
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=31556926; includeSubDomains
|
35
|
+
X-Whom:
|
36
|
+
- dc1-web-1
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"totalCount":1,"offset":0,"count":1,"data":[{"id":"ideal_TESTNL99","name":"TBM
|
40
|
+
Bank","method":"ideal"}]}'
|
41
|
+
http_version:
|
42
|
+
recorded_at: Wed, 08 Oct 2014 20:21:37 GMT
|
43
|
+
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
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.mollie.nl/v1/payments/tr_8NQDMOE7EC
|
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
|
+
- Tue, 12 Aug 2014 12:33:39 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=utf-8
|
23
|
+
Content-Length:
|
24
|
+
- '403'
|
25
|
+
Connection:
|
26
|
+
- keep-alive
|
27
|
+
Access-Control-Allow-Credentials:
|
28
|
+
- 'true'
|
29
|
+
Access-Control-Allow-Methods:
|
30
|
+
- GET, POST, HEAD, OPTIONS, DELETE
|
31
|
+
Access-Control-Max-Age:
|
32
|
+
- '300'
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=31556926; includeSubDomains
|
35
|
+
X-Whom:
|
36
|
+
- dc1-web-1
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"id":"tr_8NQDMOE7EC","mode":"test","createdDatetime":"2014-08-12T12:27:26.0Z","status":"paid","paidDatetime":"2014-08-12T12:33:23.0Z","amount":"99.99","description":"My
|
40
|
+
fantastic product","method":"ideal","metadata":null,"details":{"consumerName":"T.
|
41
|
+
TEST","consumerAccount":"NL17RABO0213698412","consumerBic":"TESTNL99"},"locale":"nl","links":{"redirectUrl":"http://localhost:3000/payments/1/update"}}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Tue, 12 Aug 2014 12:33:39 GMT
|
44
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.mollie.nl/v1/payments/tr_8NQDMOE7EC/refunds
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer test_4drFuX5HdjBaFxdXoaABYD8yO4HjuTfoo
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 401
|
15
|
+
message: Authorization Required
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- nginx
|
19
|
+
Date:
|
20
|
+
- Wed, 08 Oct 2014 20:27:36 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=utf-8
|
23
|
+
Content-Length:
|
24
|
+
- '121'
|
25
|
+
Connection:
|
26
|
+
- keep-alive
|
27
|
+
Access-Control-Allow-Credentials:
|
28
|
+
- 'true'
|
29
|
+
Access-Control-Allow-Methods:
|
30
|
+
- GET, POST, HEAD, OPTIONS, DELETE
|
31
|
+
Access-Control-Max-Age:
|
32
|
+
- '300'
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=31556926; includeSubDomains
|
35
|
+
Www-Authenticate:
|
36
|
+
- Basic realm="Mollie API Key"
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"error":{"type":"request","message":"Unauthorized request","links":{"documentation":"https://www.mollie.nl/api/docs/"}}}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Wed, 08 Oct 2014 20:27:36 GMT
|
42
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.mollie.nl/v1/payments
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: amount=99.99&description=My%20fantastic%20product&redirectUrl=http%3A%2F%2Flocalhost%3A3000%2Fpayments%2F1%2Fupdate&metadata[order_id]=R232454365&method=
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer test_4drFuX5HdjBaFxdXoaABYD8yO4HjuT
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 201
|
15
|
+
message: Created
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- nginx
|
19
|
+
Date:
|
20
|
+
- Wed, 08 Oct 2014 08:40:18 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=utf-8
|
23
|
+
Content-Length:
|
24
|
+
- '366'
|
25
|
+
Connection:
|
26
|
+
- keep-alive
|
27
|
+
Access-Control-Allow-Credentials:
|
28
|
+
- 'true'
|
29
|
+
Access-Control-Allow-Methods:
|
30
|
+
- GET, POST, HEAD, OPTIONS, DELETE
|
31
|
+
Access-Control-Max-Age:
|
32
|
+
- '300'
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=31556926; includeSubDomains
|
35
|
+
X-Whom:
|
36
|
+
- dc1-web-2
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"id":"tr_ALc7B2h9UM","mode":"test","createdDatetime":"2014-10-08T08:40:18.0Z","status":"open","expiryPeriod":"PT15M","amount":"99.99","description":"My
|
40
|
+
fantastic product","method":null,"metadata":{"order_id":"R232454365"},"details":null,"links":{"paymentUrl":"https://www.mollie.nl/payscreen/pay/ALc7B2h9UM","redirectUrl":"http://localhost:3000/payments/1/update"}}'
|
41
|
+
http_version:
|
42
|
+
recorded_at: Wed, 08 Oct 2014 08:40:17 GMT
|
43
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.mollie.nl/v1/payments/tr_8NQDMOE7EC/refunds
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer test_4drFuX5HdjBaFxdXoaABYD8yO4HjuT
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 201
|
15
|
+
message: Created
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- nginx
|
19
|
+
Date:
|
20
|
+
- Tue, 12 Aug 2014 14:11:32 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=utf-8
|
23
|
+
Content-Length:
|
24
|
+
- '514'
|
25
|
+
Connection:
|
26
|
+
- keep-alive
|
27
|
+
Access-Control-Allow-Credentials:
|
28
|
+
- 'true'
|
29
|
+
Access-Control-Allow-Methods:
|
30
|
+
- GET, POST, HEAD, OPTIONS, DELETE
|
31
|
+
Access-Control-Max-Age:
|
32
|
+
- '300'
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=31556926; includeSubDomains
|
35
|
+
X-Whom:
|
36
|
+
- dc1-web-2
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"id":"re_O5sCpw4kwb","payment":{"id":"tr_8NQDMOE7EC","mode":"test","createdDatetime":"2014-08-12T12:27:26.0Z","status":"refunded","expiryPeriod":"PT","amount":"99.99","description":"My
|
40
|
+
fantastic product","method":"ideal","metadata":null,"details":{"consumerName":"T.
|
41
|
+
TEST","consumerAccount":"NL17RABO0213698412","consumerBic":"TESTNL99"},"locale":"nl","links":{"redirectUrl":"http://localhost:3000/payments/1/update"}},"amountRefunded":"99.99","amountRemaining":"0.00","refundedDatetime":"2014-08-12T14:11:32.0Z"}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Tue, 12 Aug 2014 14:11:32 GMT
|
44
|
+
recorded_with: VCR 2.9.2
|
data/wercker.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
box: wercker/rvm
|
2
|
+
# Build definition
|
3
|
+
build:
|
4
|
+
# The steps that will be executed on build
|
5
|
+
# See the Ruby section on the wercker devcenter:
|
6
|
+
# http://devcenter.wercker.com/articles/languages/ruby.html
|
7
|
+
steps:
|
8
|
+
# Uncomment this to force RVM to use a specific Ruby version
|
9
|
+
# - rvm-use:
|
10
|
+
# version: 2.1.3
|
11
|
+
|
12
|
+
# A step that executes `bundle install` command
|
13
|
+
- bundle-install
|
14
|
+
|
15
|
+
# A custom script step, name value is used in the UI
|
16
|
+
# and the code value contains the command that get executed
|
17
|
+
- script:
|
18
|
+
name: echo ruby information
|
19
|
+
code: |
|
20
|
+
echo "ruby version $(ruby --version) running"
|
21
|
+
echo "from location $(which ruby)"
|
22
|
+
echo -p "gem list: $(gem list)"
|
23
|
+
- script:
|
24
|
+
name: rspec
|
25
|
+
code: bundle exec rspec
|
metadata
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mollie-ruby-multi-version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Isabella Santos
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
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
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: vcr
|
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: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: codeclimate-test-reporter
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: Ruby API Client for Mollie
|
126
|
+
email:
|
127
|
+
- isabella.cdossantos@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rspec"
|
134
|
+
- Gemfile
|
135
|
+
- LICENSE.txt
|
136
|
+
- README.md
|
137
|
+
- Rakefile
|
138
|
+
- lib/mollie.rb
|
139
|
+
- lib/mollie/client.rb
|
140
|
+
- lib/mollie/version.rb
|
141
|
+
- mollie.gemspec
|
142
|
+
- spec/mollie/client_spec.rb
|
143
|
+
- spec/spec_helper.rb
|
144
|
+
- spec/vcr_cassettes/get_ideal_method.yml
|
145
|
+
- spec/vcr_cassettes/get_issuers_list.yml
|
146
|
+
- spec/vcr_cassettes/get_methods_list.yml
|
147
|
+
- spec/vcr_cassettes/get_status_paid.yml
|
148
|
+
- spec/vcr_cassettes/invalid_key.yml
|
149
|
+
- spec/vcr_cassettes/prepare_payment.yml
|
150
|
+
- spec/vcr_cassettes/refund_payment.yml
|
151
|
+
- wercker.yml
|
152
|
+
homepage: https://github.com/isabellaSantos/mollie-ruby
|
153
|
+
licenses:
|
154
|
+
- MIT
|
155
|
+
metadata: {}
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
requirements: []
|
171
|
+
rubyforge_project:
|
172
|
+
rubygems_version: 2.5.1
|
173
|
+
signing_key:
|
174
|
+
specification_version: 4
|
175
|
+
summary: Ruby API Client for Mollie
|
176
|
+
test_files:
|
177
|
+
- spec/mollie/client_spec.rb
|
178
|
+
- spec/spec_helper.rb
|
179
|
+
- spec/vcr_cassettes/get_ideal_method.yml
|
180
|
+
- spec/vcr_cassettes/get_issuers_list.yml
|
181
|
+
- spec/vcr_cassettes/get_methods_list.yml
|
182
|
+
- spec/vcr_cassettes/get_status_paid.yml
|
183
|
+
- spec/vcr_cassettes/invalid_key.yml
|
184
|
+
- spec/vcr_cassettes/prepare_payment.yml
|
185
|
+
- spec/vcr_cassettes/refund_payment.yml
|