mollie-api-ruby 1.4.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -0
- data/CHANGELOG.md +6 -0
- data/README.mdown +5 -5
- data/Rakefile +6 -0
- data/examples/1-new-payment.rb +4 -5
- data/examples/2-webhook-verification.rb +2 -2
- data/examples/4-ideal-payment.rb +3 -3
- data/examples/5-payments-history.rb +3 -3
- data/examples/6-list-activated-methods.rb +3 -3
- data/examples/7-refund-payment.rb +5 -5
- data/lib/{Mollie/API → mollie/api}/cacert.pem +0 -0
- data/lib/mollie/api/client.rb +120 -0
- data/lib/{Mollie/API/Client/Version.rb → mollie/api/client/version.rb} +1 -1
- data/lib/{Mollie/API/Exception.rb → mollie/api/exception.rb} +0 -0
- data/lib/mollie/api/object/base.rb +18 -0
- data/lib/mollie/api/object/customer.rb +28 -0
- data/lib/{Mollie/API/Object/Issuer.rb → mollie/api/object/issuer.rb} +1 -3
- data/lib/mollie/api/object/list.rb +44 -0
- data/lib/mollie/api/object/mandate.rb +35 -0
- data/lib/{Mollie/API/Object/Method.rb → mollie/api/object/method.rb} +12 -4
- data/lib/mollie/api/object/payment.rb +123 -0
- data/lib/mollie/api/object/payment/refund.rb +43 -0
- data/lib/mollie/api/object/subscription.rb +67 -0
- data/lib/{Mollie/API/Resource/Base.rb → mollie/api/resource/base.rb} +8 -8
- data/lib/{Mollie/API/Resource/Customers.rb → mollie/api/resource/customers.rb} +2 -2
- data/lib/{Mollie/API/Resource/Customers/Mandates.rb → mollie/api/resource/customers/mandates.rb} +5 -5
- data/lib/{Mollie/API/Resource/Customers/Payments.rb → mollie/api/resource/customers/payments.rb} +5 -5
- data/lib/mollie/api/resource/customers/subscriptions.rb +27 -0
- data/lib/{Mollie/API/Resource/Issuers.rb → mollie/api/resource/issuers.rb} +2 -2
- data/lib/{Mollie/API/Resource/Methods.rb → mollie/api/resource/methods.rb} +2 -2
- data/lib/{Mollie/API/Resource/Payments.rb → mollie/api/resource/payments.rb} +2 -2
- data/lib/{Mollie/API/Resource/Payments/Refunds.rb → mollie/api/resource/payments/refunds.rb} +5 -5
- data/lib/mollie/api/util.rb +37 -0
- data/mollie.gemspec +16 -14
- data/test/helper.rb +4 -0
- data/test/mollie/api/client_test.rb +99 -0
- data/test/mollie/api/object/base_test.rb +21 -0
- data/test/mollie/api/object/customer_test.rb +35 -0
- data/test/mollie/api/object/issuer_test.rb +23 -0
- data/test/mollie/api/object/list_test.rb +44 -0
- data/test/mollie/api/object/mandate_test.rb +45 -0
- data/test/mollie/api/object/method_test.rb +33 -0
- data/test/mollie/api/object/payment/refund_test.rb +46 -0
- data/test/mollie/api/object/payment_test.rb +91 -0
- data/test/mollie/api/object/subscription_test.rb +68 -0
- data/test/mollie/api/resource/base_test.rb +83 -0
- data/test/mollie/api/resource/customers/mandates_test.rb +23 -0
- data/test/mollie/api/resource/customers/payments_test.rb +23 -0
- data/test/mollie/api/resource/customers/subscriptions_test.rb +23 -0
- data/test/mollie/api/resource/customers_test.rb +13 -0
- data/test/mollie/api/resource/issuers_test.rb +13 -0
- data/test/mollie/api/resource/methods_test.rb +13 -0
- data/test/mollie/api/resource/payments/refunds_test.rb +23 -0
- data/test/mollie/api/resource/payments_test.rb +13 -0
- data/test/run-test.rb +15 -0
- metadata +99 -52
- data/lib/Mollie/API/Client.rb +0 -130
- data/lib/Mollie/API/Object/Base.rb +0 -18
- data/lib/Mollie/API/Object/Customer.rb +0 -16
- data/lib/Mollie/API/Object/List.rb +0 -35
- data/lib/Mollie/API/Object/Mandate.rb +0 -22
- data/lib/Mollie/API/Object/Payment.rb +0 -68
- data/lib/Mollie/API/Object/Payment/Refund.rb +0 -15
- data/lib/Mollie/API/Object/Subscription.rb +0 -26
- data/lib/Mollie/API/Resource/Customers/Subscriptions.rb +0 -27
@@ -1,22 +0,0 @@
|
|
1
|
-
module Mollie
|
2
|
-
module API
|
3
|
-
module Object
|
4
|
-
class Mandate < Base
|
5
|
-
STATUS_VALID = "valid"
|
6
|
-
STATUS_INVALID = "invalid"
|
7
|
-
|
8
|
-
attr_accessor :resource,
|
9
|
-
:id,
|
10
|
-
:status,
|
11
|
-
:method,
|
12
|
-
:customerId,
|
13
|
-
:details,
|
14
|
-
:createdDatetime
|
15
|
-
|
16
|
-
def valid?
|
17
|
-
@status == STATUS_VALID
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
module Mollie
|
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
|
-
STATUS_FAILED = "failed"
|
11
|
-
STATUS_REFUNDED = "refunded"
|
12
|
-
|
13
|
-
RECURRINGTYPE_NONE = nil
|
14
|
-
RECURRINGTYPE_FIRST = "first"
|
15
|
-
RECURRINGTYPE_RECURRING = "recurring"
|
16
|
-
|
17
|
-
attr_accessor :id,
|
18
|
-
:status,
|
19
|
-
:mode,
|
20
|
-
:amount,
|
21
|
-
:description,
|
22
|
-
:method,
|
23
|
-
:createdDatetime,
|
24
|
-
:paidDatetime,
|
25
|
-
:expiredDatetime,
|
26
|
-
:cancelledDatetime,
|
27
|
-
:customerId,
|
28
|
-
:recurringType,
|
29
|
-
:mandateId,
|
30
|
-
:subscriptionId,
|
31
|
-
:settlementId,
|
32
|
-
:metadata,
|
33
|
-
:details,
|
34
|
-
:links
|
35
|
-
|
36
|
-
def open?
|
37
|
-
@status == STATUS_OPEN
|
38
|
-
end
|
39
|
-
|
40
|
-
def cancelled?
|
41
|
-
@status == STATUS_CANCELLED
|
42
|
-
end
|
43
|
-
|
44
|
-
def expired?
|
45
|
-
@status == STATUS_EXPIRED
|
46
|
-
end
|
47
|
-
|
48
|
-
def paid?
|
49
|
-
!@paidDatetime.nil?
|
50
|
-
end
|
51
|
-
|
52
|
-
def paidout?
|
53
|
-
@status == STATUS_PAIDOUT
|
54
|
-
end
|
55
|
-
|
56
|
-
def refunded?
|
57
|
-
@status == STATUS_REFUNDED
|
58
|
-
end
|
59
|
-
|
60
|
-
def getPaymentUrl
|
61
|
-
@links && @links.paymentUrl
|
62
|
-
end
|
63
|
-
|
64
|
-
alias_method :payment_url, :getPaymentUrl
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Mollie
|
2
|
-
module API
|
3
|
-
module Object
|
4
|
-
class Subscription < Base
|
5
|
-
STATUS_ACTIVE = "active"
|
6
|
-
STATUS_PENDING = "pending" # Waiting for a valid mandate.
|
7
|
-
STATUS_CANCELLED = "cancelled"
|
8
|
-
STATUS_SUSPENDED = "suspended" # Active, but mandate became invalid.
|
9
|
-
STATUS_COMPLETED = "completed"
|
10
|
-
|
11
|
-
attr_accessor :resource,
|
12
|
-
:id,
|
13
|
-
:customerId,
|
14
|
-
:mode,
|
15
|
-
:createdDatetime,
|
16
|
-
:status,
|
17
|
-
:amount,
|
18
|
-
:times,
|
19
|
-
:interval,
|
20
|
-
:description,
|
21
|
-
:method,
|
22
|
-
:cancelledDatetime
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'open-uri'
|
2
|
-
|
3
|
-
module Mollie
|
4
|
-
module API
|
5
|
-
module Resource
|
6
|
-
class Customers
|
7
|
-
class Subscriptions < Base
|
8
|
-
@parent_id = nil
|
9
|
-
|
10
|
-
def getResourceObject
|
11
|
-
Mollie::API::Object::Subscription
|
12
|
-
end
|
13
|
-
|
14
|
-
def getResourceName
|
15
|
-
customer_id = URI::encode(@parent_id)
|
16
|
-
"customers/#{customer_id}/subscriptions"
|
17
|
-
end
|
18
|
-
|
19
|
-
def with(customer)
|
20
|
-
@parent_id = customer.id
|
21
|
-
self
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|