mollie-api-ruby 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/1-new-payment.rb +43 -43
- data/examples/2-webhook-verification.rb +31 -31
- data/examples/3-return-page.rb +11 -11
- data/examples/4-ideal-payment.rb +63 -63
- data/examples/5-payments-history.rb +17 -17
- data/examples/6-list-activated-methods.rb +20 -20
- data/examples/7-refund-payment.rb +28 -28
- data/examples/app.rb +30 -30
- data/lib/Mollie/API/Client.rb +92 -92
- data/lib/Mollie/API/Exception.rb +6 -6
- data/lib/Mollie/API/Object/Base.rb +15 -15
- data/lib/Mollie/API/Object/Issuer.rb +10 -10
- data/lib/Mollie/API/Object/List.rb +30 -30
- data/lib/Mollie/API/Object/Method.rb +24 -24
- data/lib/Mollie/API/Object/Payment.rb +45 -33
- data/lib/Mollie/API/Object/Payment/Refund.rb +14 -14
- data/lib/Mollie/API/Resource/Base.rb +51 -51
- data/lib/Mollie/API/Resource/Issuers.rb +9 -9
- data/lib/Mollie/API/Resource/Methods.rb +9 -9
- data/lib/Mollie/API/Resource/Payments.rb +9 -9
- data/lib/Mollie/API/Resource/Payments/Refunds.rb +20 -20
- data/mollie.gemspec +1 -1
- metadata +3 -3
@@ -1,39 +1,51 @@
|
|
1
1
|
module Mollie
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
module API
|
3
|
+
module Object
|
4
|
+
class Payment < Base
|
5
|
+
STATUS_OPEN = "open"
|
6
|
+
STATUS_CANCELLED = "cancelled"
|
7
|
+
STATUS_EXPIRED = "expired"
|
8
|
+
STATUS_PAID = "paid"
|
9
|
+
STATUS_PAIDOUT = "paidout"
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
11
|
+
attr_accessor :id,
|
12
|
+
:status,
|
13
|
+
:mode,
|
14
|
+
:amount,
|
15
|
+
:description,
|
16
|
+
:method,
|
17
|
+
:createdDatetime,
|
18
|
+
:paidDatetime,
|
19
|
+
:expiredDatetime,
|
20
|
+
:cancelledDatetime,
|
21
|
+
:metadata,
|
22
|
+
:details,
|
23
|
+
:links
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def open?
|
26
|
+
@status == STATUS_OPEN
|
27
|
+
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
def cancelled?
|
30
|
+
@status == STATUS_CANCELLED
|
31
|
+
end
|
32
|
+
|
33
|
+
def expired?
|
34
|
+
@status == STATUS_EXPIRED
|
35
|
+
end
|
32
36
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
def paid?
|
38
|
+
!@paidDatetime.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
def paidout?
|
42
|
+
@status == STATUS_PAIDOUT
|
43
|
+
end
|
44
|
+
|
45
|
+
def getPaymentUrl
|
46
|
+
@links && @links.paymentUrl
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
39
51
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module Mollie
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
2
|
+
module API
|
3
|
+
module Object
|
4
|
+
class Payment
|
5
|
+
class Refund < Base
|
6
|
+
attr_accessor :id,
|
7
|
+
:amountRefunded,
|
8
|
+
:amountRemaining,
|
9
|
+
:payment,
|
10
|
+
:refundedDatetime
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,53 +1,53 @@
|
|
1
1
|
module Mollie
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
2
|
+
module API
|
3
|
+
module Resource
|
4
|
+
class Base
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def getResourceName
|
10
|
+
self.class.name.downcase.split("::").slice(3..-1).join "/"
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(data = {})
|
14
|
+
request("POST", nil, data) { |response|
|
15
|
+
newResourceObject response
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def get(id)
|
20
|
+
request("GET", id, {}) { |response|
|
21
|
+
newResourceObject response
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def update(id, data = {})
|
26
|
+
request("POST", id, data) { |response|
|
27
|
+
newResourceObject response
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def delete(id)
|
32
|
+
request "DELETE", id, {}
|
33
|
+
end
|
34
|
+
|
35
|
+
def all
|
36
|
+
request("GET", nil, {}) { |response|
|
37
|
+
Mollie::API::Object::List.new response, getResourceObject
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def newResourceObject(response)
|
42
|
+
getResourceObject.new response
|
43
|
+
end
|
44
|
+
|
45
|
+
def request(method, id = 0, data = {})
|
46
|
+
response = @client.performHttpCall method, getResourceName, id, data
|
47
|
+
|
48
|
+
yield(response) if block_given?
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
53
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Mollie
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
module API
|
3
|
+
module Resource
|
4
|
+
class Issuers < Base
|
5
|
+
def getResourceObject
|
6
|
+
Mollie::API::Object::Issuer
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
11
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Mollie
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
module API
|
3
|
+
module Resource
|
4
|
+
class Methods < Base
|
5
|
+
def getResourceObject
|
6
|
+
Mollie::API::Object::Method
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
11
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Mollie
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
module API
|
3
|
+
module Resource
|
4
|
+
class Payments < Base
|
5
|
+
def getResourceObject
|
6
|
+
Mollie::API::Object::Payment
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
11
|
end
|
@@ -1,27 +1,27 @@
|
|
1
1
|
require 'open-uri'
|
2
2
|
|
3
3
|
module Mollie
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
module API
|
5
|
+
module Resource
|
6
|
+
class Payments
|
7
|
+
class Refunds < Base
|
8
|
+
@payment_id = nil
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
def getResourceObject
|
11
|
+
Mollie::API::Object::Payment::Refund
|
12
|
+
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def getResourceName
|
15
|
+
payment_id = URI::encode(@payment_id)
|
16
|
+
"payments/#{payment_id}/refunds"
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
def with(payment)
|
20
|
+
@payment_id = payment.id
|
21
|
+
self
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
27
|
end
|
data/mollie.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mollie-api-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rick Wong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.4.5
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: Official Mollie API Client for Ruby
|