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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +12 -0
  3. data/CHANGELOG.md +6 -0
  4. data/README.mdown +5 -5
  5. data/Rakefile +6 -0
  6. data/examples/1-new-payment.rb +4 -5
  7. data/examples/2-webhook-verification.rb +2 -2
  8. data/examples/4-ideal-payment.rb +3 -3
  9. data/examples/5-payments-history.rb +3 -3
  10. data/examples/6-list-activated-methods.rb +3 -3
  11. data/examples/7-refund-payment.rb +5 -5
  12. data/lib/{Mollie/API → mollie/api}/cacert.pem +0 -0
  13. data/lib/mollie/api/client.rb +120 -0
  14. data/lib/{Mollie/API/Client/Version.rb → mollie/api/client/version.rb} +1 -1
  15. data/lib/{Mollie/API/Exception.rb → mollie/api/exception.rb} +0 -0
  16. data/lib/mollie/api/object/base.rb +18 -0
  17. data/lib/mollie/api/object/customer.rb +28 -0
  18. data/lib/{Mollie/API/Object/Issuer.rb → mollie/api/object/issuer.rb} +1 -3
  19. data/lib/mollie/api/object/list.rb +44 -0
  20. data/lib/mollie/api/object/mandate.rb +35 -0
  21. data/lib/{Mollie/API/Object/Method.rb → mollie/api/object/method.rb} +12 -4
  22. data/lib/mollie/api/object/payment.rb +123 -0
  23. data/lib/mollie/api/object/payment/refund.rb +43 -0
  24. data/lib/mollie/api/object/subscription.rb +67 -0
  25. data/lib/{Mollie/API/Resource/Base.rb → mollie/api/resource/base.rb} +8 -8
  26. data/lib/{Mollie/API/Resource/Customers.rb → mollie/api/resource/customers.rb} +2 -2
  27. data/lib/{Mollie/API/Resource/Customers/Mandates.rb → mollie/api/resource/customers/mandates.rb} +5 -5
  28. data/lib/{Mollie/API/Resource/Customers/Payments.rb → mollie/api/resource/customers/payments.rb} +5 -5
  29. data/lib/mollie/api/resource/customers/subscriptions.rb +27 -0
  30. data/lib/{Mollie/API/Resource/Issuers.rb → mollie/api/resource/issuers.rb} +2 -2
  31. data/lib/{Mollie/API/Resource/Methods.rb → mollie/api/resource/methods.rb} +2 -2
  32. data/lib/{Mollie/API/Resource/Payments.rb → mollie/api/resource/payments.rb} +2 -2
  33. data/lib/{Mollie/API/Resource/Payments/Refunds.rb → mollie/api/resource/payments/refunds.rb} +5 -5
  34. data/lib/mollie/api/util.rb +37 -0
  35. data/mollie.gemspec +16 -14
  36. data/test/helper.rb +4 -0
  37. data/test/mollie/api/client_test.rb +99 -0
  38. data/test/mollie/api/object/base_test.rb +21 -0
  39. data/test/mollie/api/object/customer_test.rb +35 -0
  40. data/test/mollie/api/object/issuer_test.rb +23 -0
  41. data/test/mollie/api/object/list_test.rb +44 -0
  42. data/test/mollie/api/object/mandate_test.rb +45 -0
  43. data/test/mollie/api/object/method_test.rb +33 -0
  44. data/test/mollie/api/object/payment/refund_test.rb +46 -0
  45. data/test/mollie/api/object/payment_test.rb +91 -0
  46. data/test/mollie/api/object/subscription_test.rb +68 -0
  47. data/test/mollie/api/resource/base_test.rb +83 -0
  48. data/test/mollie/api/resource/customers/mandates_test.rb +23 -0
  49. data/test/mollie/api/resource/customers/payments_test.rb +23 -0
  50. data/test/mollie/api/resource/customers/subscriptions_test.rb +23 -0
  51. data/test/mollie/api/resource/customers_test.rb +13 -0
  52. data/test/mollie/api/resource/issuers_test.rb +13 -0
  53. data/test/mollie/api/resource/methods_test.rb +13 -0
  54. data/test/mollie/api/resource/payments/refunds_test.rb +23 -0
  55. data/test/mollie/api/resource/payments_test.rb +13 -0
  56. data/test/run-test.rb +15 -0
  57. metadata +99 -52
  58. data/lib/Mollie/API/Client.rb +0 -130
  59. data/lib/Mollie/API/Object/Base.rb +0 -18
  60. data/lib/Mollie/API/Object/Customer.rb +0 -16
  61. data/lib/Mollie/API/Object/List.rb +0 -35
  62. data/lib/Mollie/API/Object/Mandate.rb +0 -22
  63. data/lib/Mollie/API/Object/Payment.rb +0 -68
  64. data/lib/Mollie/API/Object/Payment/Refund.rb +0 -15
  65. data/lib/Mollie/API/Object/Subscription.rb +0 -26
  66. 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,15 +0,0 @@
1
- module Mollie
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,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