mollie-api-ruby 3.1.5 → 4.0.0.pre.alpha.1

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.
Files changed (220) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +0 -3
  3. data/CHANGELOG.md +6 -0
  4. data/README.md +63 -119
  5. data/bin/console +15 -0
  6. data/bin/setup +8 -0
  7. data/docs/migration_v2_2_x.md +67 -0
  8. data/docs/migration_v3_x.md +227 -0
  9. data/examples/chargebacks/get.rb +4 -0
  10. data/examples/chargebacks/list.rb +1 -0
  11. data/{website-docs → examples}/connect/authorize.rb +3 -2
  12. data/{website-docs → examples}/connect/tokens.rb +1 -1
  13. data/examples/customers/create-payment.rb +6 -0
  14. data/examples/customers/create.rb +5 -0
  15. data/examples/customers/delete.rb +1 -0
  16. data/examples/customers/get.rb +1 -0
  17. data/examples/customers/list-payments.rb +1 -0
  18. data/examples/customers/list.rb +1 -0
  19. data/examples/customers/update.rb +4 -0
  20. data/examples/invoices/get.rb +1 -0
  21. data/examples/invoices/list.rb +1 -0
  22. data/examples/mandates/create.rb +9 -0
  23. data/examples/mandates/delete.rb +1 -0
  24. data/examples/mandates/get.rb +1 -0
  25. data/examples/mandates/list.rb +1 -0
  26. data/examples/methods/get.rb +4 -0
  27. data/examples/methods/list.rb +4 -0
  28. data/examples/organisations/get-current.rb +1 -0
  29. data/examples/organisations/get.rb +1 -0
  30. data/examples/payments/create.rb +9 -0
  31. data/examples/payments/delete.rb +1 -0
  32. data/examples/payments/get-customer.rb +2 -0
  33. data/examples/payments/get-mandate.rb +2 -0
  34. data/examples/payments/get-settlement.rb +2 -0
  35. data/examples/payments/get-subscription.rb +2 -0
  36. data/examples/payments/get.rb +1 -0
  37. data/examples/payments/list.rb +1 -0
  38. data/examples/payments/webhook.rb +12 -0
  39. data/examples/permissions/get.rb +1 -0
  40. data/examples/permissions/list.rb +1 -0
  41. data/examples/profiles/create.rb +8 -0
  42. data/examples/profiles/delete.rb +1 -0
  43. data/examples/profiles/get.rb +1 -0
  44. data/examples/profiles/list-chargebacks.rb +2 -0
  45. data/examples/profiles/list-methods.rb +2 -0
  46. data/examples/profiles/list-payments.rb +2 -0
  47. data/examples/profiles/list-refunds.rb +2 -0
  48. data/examples/profiles/list.rb +1 -0
  49. data/examples/profiles/update.rb +5 -0
  50. data/examples/refunds/create.rb +5 -0
  51. data/examples/refunds/delete.rb +4 -0
  52. data/examples/refunds/get-payment.rb +2 -0
  53. data/examples/refunds/get.rb +4 -0
  54. data/examples/refunds/list.rb +1 -0
  55. data/examples/settlements/get.rb +1 -0
  56. data/examples/settlements/list-chargebacks.rb +1 -0
  57. data/examples/settlements/list-payments.rb +1 -0
  58. data/examples/settlements/list-refunds.rb +1 -0
  59. data/examples/settlements/list.rb +1 -0
  60. data/examples/settlements/next.rb +1 -0
  61. data/examples/settlements/open.rb +1 -0
  62. data/examples/subscriptions/create.rb +8 -0
  63. data/examples/subscriptions/delete.rb +4 -0
  64. data/examples/subscriptions/get.rb +4 -0
  65. data/examples/subscriptions/list.rb +1 -0
  66. data/examples/subscriptions/update.rb +5 -0
  67. data/lib/cacert.pem +168 -48
  68. data/lib/mollie.rb +1 -3
  69. data/lib/mollie/amount.rb +20 -0
  70. data/lib/mollie/base.rb +9 -8
  71. data/lib/mollie/chargeback.rb +25 -15
  72. data/lib/mollie/client.rb +33 -13
  73. data/lib/mollie/customer.rb +9 -14
  74. data/lib/mollie/customer/mandate.rb +17 -5
  75. data/lib/mollie/customer/subscription.rb +14 -15
  76. data/lib/mollie/exception.rb +15 -3
  77. data/lib/mollie/invoice.rb +30 -26
  78. data/lib/mollie/list.rb +27 -18
  79. data/lib/mollie/method.rb +17 -25
  80. data/lib/mollie/organization.rb +5 -11
  81. data/lib/mollie/payment.rb +89 -61
  82. data/lib/mollie/permission.rb +0 -1
  83. data/lib/mollie/profile.rb +18 -13
  84. data/lib/mollie/refund.rb +27 -7
  85. data/lib/mollie/settlement.rb +50 -9
  86. data/lib/mollie/util.rb +11 -0
  87. data/lib/mollie/version.rb +1 -1
  88. data/mollie-api-ruby.gemspec +0 -7
  89. data/test/mollie/amount_test.rb +30 -0
  90. data/test/mollie/base_test.rb +44 -44
  91. data/test/mollie/chargeback_test.rb +78 -17
  92. data/test/mollie/client_test.rb +29 -12
  93. data/test/mollie/customer/mandate_test.rb +85 -9
  94. data/test/mollie/customer/payment_test.rb +2 -2
  95. data/test/mollie/customer/subscription_test.rb +71 -20
  96. data/test/mollie/customer_test.rb +17 -89
  97. data/test/mollie/invoice_test.rb +40 -24
  98. data/test/mollie/list_test.rb +62 -18
  99. data/test/mollie/method_test.rb +2 -8
  100. data/test/mollie/organization_test.rb +28 -23
  101. data/test/mollie/payment/chargeback_test.rb +2 -3
  102. data/test/mollie/payment/refund_test.rb +2 -3
  103. data/test/mollie/payment_test.rb +272 -86
  104. data/test/mollie/permission_test.rb +0 -2
  105. data/test/mollie/profile_test.rb +129 -35
  106. data/test/mollie/refund_test.rb +90 -10
  107. data/test/mollie/settlement/chargeback_test.rb +2 -4
  108. data/test/mollie/settlement/payment_test.rb +2 -2
  109. data/test/mollie/settlement/refund_test.rb +2 -3
  110. data/test/mollie/settlement_test.rb +199 -98
  111. data/test/mollie/util_test.rb +31 -0
  112. metadata +96 -239
  113. data/examples/apis/api_docs.rb +0 -37
  114. data/examples/apis/chargebacks.rb +0 -17
  115. data/examples/apis/connect.rb +0 -58
  116. data/examples/apis/customers.rb +0 -116
  117. data/examples/apis/invoices.rb +0 -38
  118. data/examples/apis/issuers.rb +0 -35
  119. data/examples/apis/mandates.rb +0 -83
  120. data/examples/apis/methods.rb +0 -50
  121. data/examples/apis/organizations.rb +0 -16
  122. data/examples/apis/payments.rb +0 -174
  123. data/examples/apis/permissions.rb +0 -32
  124. data/examples/apis/profiles.rb +0 -126
  125. data/examples/apis/refunds.rb +0 -17
  126. data/examples/apis/settlements.rb +0 -84
  127. data/examples/apis/subscriptions.rb +0 -165
  128. data/examples/config.ru +0 -57
  129. data/examples/public/images/collapse.gif +0 -0
  130. data/examples/public/images/expand.gif +0 -0
  131. data/examples/public/images/explorer_icons.png +0 -0
  132. data/examples/public/images/favicon-16x16.png +0 -0
  133. data/examples/public/images/favicon-32x32.png +0 -0
  134. data/examples/public/images/favicon.ico +0 -0
  135. data/examples/public/images/logo_small.png +0 -0
  136. data/examples/public/images/pet_store_api.png +0 -0
  137. data/examples/public/images/throbber.gif +0 -0
  138. data/examples/public/images/wordnik_api.png +0 -0
  139. data/examples/public/index.html +0 -101
  140. data/examples/public/javascripts/lib/backbone-min.js +0 -1
  141. data/examples/public/javascripts/lib/es5-shim.js +0 -1
  142. data/examples/public/javascripts/lib/handlebars-4.0.5.js +0 -3
  143. data/examples/public/javascripts/lib/highlight.9.1.0.pack.js +0 -1
  144. data/examples/public/javascripts/lib/highlight.9.1.0.pack_extended.js +0 -1
  145. data/examples/public/javascripts/lib/jquery-1.8.0.min.js +0 -3
  146. data/examples/public/javascripts/lib/jquery.ba-bbq.min.js +0 -1
  147. data/examples/public/javascripts/lib/jquery.slideto.min.js +0 -1
  148. data/examples/public/javascripts/lib/jquery.wiggle.min.js +0 -1
  149. data/examples/public/javascripts/lib/js-yaml.min.js +0 -2
  150. data/examples/public/javascripts/lib/jsoneditor.min.js +0 -5
  151. data/examples/public/javascripts/lib/lodash.min.js +0 -2
  152. data/examples/public/javascripts/lib/marked.js +0 -1
  153. data/examples/public/javascripts/lib/object-assign-pollyfill.js +0 -1
  154. data/examples/public/javascripts/lib/sanitize-html.min.js +0 -4
  155. data/examples/public/javascripts/lib/swagger-oauth.js +0 -1
  156. data/examples/public/javascripts/swagger-ui.js +0 -25378
  157. data/examples/public/javascripts/swagger-ui.min.js +0 -15
  158. data/examples/public/javascripts/swagger_docs.js +0 -14
  159. data/examples/public/o2c.html +0 -20
  160. data/examples/public/stylesheets/reset.css +0 -1
  161. data/examples/public/stylesheets/screen.css +0 -1545
  162. data/examples/public/stylesheets/swagger_docs.css +0 -4
  163. data/examples/public/stylesheets/typography.css +0 -0
  164. data/lib/mollie/issuer.rb +0 -5
  165. data/lib/mollie/profile/api_key.rb +0 -19
  166. data/lib/mollie/relation.rb +0 -36
  167. data/test/mollie/issuer_test.rb +0 -19
  168. data/test/mollie/profile/apikey_test.rb +0 -31
  169. data/website-docs/chargebacks/list-all.rb +0 -12
  170. data/website-docs/customers/create-payment.rb +0 -13
  171. data/website-docs/customers/create.rb +0 -12
  172. data/website-docs/customers/delete.rb +0 -10
  173. data/website-docs/customers/get.rb +0 -10
  174. data/website-docs/customers/list-payments.rb +0 -10
  175. data/website-docs/customers/list.rb +0 -12
  176. data/website-docs/customers/update.rb +0 -11
  177. data/website-docs/invoices/get.rb +0 -10
  178. data/website-docs/invoices/list.rb +0 -12
  179. data/website-docs/issuers/get.rb +0 -10
  180. data/website-docs/issuers/list.rb +0 -12
  181. data/website-docs/mandates/create.rb +0 -16
  182. data/website-docs/mandates/delete.rb +0 -10
  183. data/website-docs/mandates/get.rb +0 -10
  184. data/website-docs/mandates/list.rb +0 -12
  185. data/website-docs/methods/get.rb +0 -10
  186. data/website-docs/methods/list.rb +0 -12
  187. data/website-docs/organisations/get.rb +0 -10
  188. data/website-docs/payments/create-refund.rb +0 -14
  189. data/website-docs/payments/create.rb +0 -16
  190. data/website-docs/payments/delete-refund.rb +0 -13
  191. data/website-docs/payments/delete.rb +0 -12
  192. data/website-docs/payments/get-chargeback.rb +0 -11
  193. data/website-docs/payments/get-refund.rb +0 -11
  194. data/website-docs/payments/get.rb +0 -10
  195. data/website-docs/payments/list-chargeback.rb +0 -13
  196. data/website-docs/payments/list-refunds.rb +0 -13
  197. data/website-docs/payments/list.rb +0 -12
  198. data/website-docs/payments/payment-webhook.rb +0 -21
  199. data/website-docs/permissions/get.rb +0 -10
  200. data/website-docs/permissions/list.rb +0 -12
  201. data/website-docs/profiles/create.rb +0 -15
  202. data/website-docs/profiles/delete.rb +0 -10
  203. data/website-docs/profiles/get-key.rb +0 -11
  204. data/website-docs/profiles/get.rb +0 -10
  205. data/website-docs/profiles/list-keys.rb +0 -13
  206. data/website-docs/profiles/list.rb +0 -12
  207. data/website-docs/profiles/reset-key.rb +0 -13
  208. data/website-docs/profiles/update.rb +0 -12
  209. data/website-docs/refunds/list.rb +0 -12
  210. data/website-docs/settlements/get.rb +0 -10
  211. data/website-docs/settlements/list-chargebacks.rb +0 -13
  212. data/website-docs/settlements/list-payments.rb +0 -13
  213. data/website-docs/settlements/list-refunds.rb +0 -13
  214. data/website-docs/settlements/list.rb +0 -12
  215. data/website-docs/settlements/next.rb +0 -9
  216. data/website-docs/settlements/open.rb +0 -9
  217. data/website-docs/subscriptions/create.rb +0 -14
  218. data/website-docs/subscriptions/delete.rb +0 -10
  219. data/website-docs/subscriptions/get.rb +0 -10
  220. data/website-docs/subscriptions/list.rb +0 -12
@@ -1,37 +0,0 @@
1
- class Application < Sinatra::Application
2
- ::Application
3
- swagger_root do
4
- key :swagger, '2.0'
5
- info version: Mollie::VERSION,
6
- title: 'Mollie',
7
- description: 'Examples for the mollie api',
8
- termsOfService: 'https://github.com/mollie/mollie-api-ruby',
9
- contact: { name: 'Mollie B.V.' },
10
- license: { name: 'BSD' }
11
- key :basePath, '/'
12
- key :consumes, %w(application/json multipart/form-data)
13
- key :produces, ['application/json', "text/plain"]
14
-
15
- security_definition :api_key do
16
- key :type, :apiKey
17
- key :name, :"X-Mollie-Api-Key"
18
- key :in, :header
19
- end
20
- end
21
-
22
- swagger_schema :ErrorModel do
23
- property :message do
24
- key :type, :string
25
- end
26
- end
27
-
28
- get '/' do
29
- # redirect "http://petstore.swagger.io/?url=#{Ngrok::Tunnel.ngrok_url_https}/api-docs"
30
- redirect "#{Ngrok::Tunnel.ngrok_url_https}/index.html"
31
- end
32
-
33
- get '/api-docs' do
34
- content_type :json
35
- Swagger::Blocks.build_root_json([Application ]).to_json
36
- end
37
- end
@@ -1,17 +0,0 @@
1
- class Application < Sinatra::Application
2
- swagger_path '/v1/chargebacks' do
3
- operation :get, description: 'List chargebacks https://www.mollie.com/en/docs/reference/chargebacks/list', tags: ['Chargebacks'] do
4
- parameter name: :offset, in: 'query', description: 'Offset', type: :integer
5
- parameter name: :count, in: 'query', description: 'Count', type: :integer
6
- parameter name: :testmode, in: 'query', description: 'Test mode', type: :boolean
7
- security api_key: []
8
- response 200, description: 'Successful response'
9
- response 500, description: 'Unexpected error'
10
- end
11
- end
12
-
13
- get '/v1/chargebacks' do
14
- chargebacks = Mollie::Chargeback.all(params[:offset], params[:limit], testmode: params[:test_mode])
15
- JSON.pretty_generate(chargebacks.attributes)
16
- end
17
- end
@@ -1,58 +0,0 @@
1
- require 'rack/oauth2'
2
- class Application < Sinatra::Application
3
- swagger_path '/oauth2/authorize' do
4
- operation :get, description: 'https://www.mollie.com/en/docs/reference/oauth/authorize', tags: ['Connect'] do
5
- parameter name: :client_id, in: 'query', description: 'Client Id', type: :string
6
- parameter name: :secret, in: 'query', description: 'oAuth Secret', type: :string
7
- parameter name: :redirect_uri, in: 'query', description: 'Redirect URI', type: :string, default: "#{Ngrok::Tunnel.ngrok_url_https}/token"
8
- parameter name: :state, in: 'query', description: 'State', type: :string, default: SecureRandom.uuid
9
- parameter name: :scope, in: 'query', description: 'Scope', type: :string, default: Mollie::Permission::AVAILABLE.join(' ')
10
- parameter name: :response_type, in: 'query', description: 'Response Type', type: :string
11
- parameter name: :approval_prompt, in: 'query', description: 'Approval prompt', type: :boolean
12
- security api_key: []
13
- response 301, description: 'Successful response'
14
- response 500, description: 'Unexpected error'
15
- end
16
- end
17
-
18
- swagger_path '/oauth2/token' do
19
- operation :get, description: 'Get access token', tags: ['Connect'] do
20
- parameter name: :client_id, in: 'query', description: 'Client Id', type: :string
21
- parameter name: :secret, in: 'query', description: 'oAuth Secret', type: :string
22
- parameter name: :redirect_uri, in: 'query', description: 'Redirect URI', type: :string, default: "#{Ngrok::Tunnel.ngrok_url_https}/token"
23
- parameter name: :code, in: 'query', description: 'Authorization code', type: :string
24
- security api_key: []
25
- response 200, description: 'Successful response'
26
- response 500, description: 'Unexpected error'
27
- end
28
- end
29
-
30
- get '/oauth2/authorize' do
31
- client = Rack::OAuth2::Client.new(
32
- identifier: params[:client_id],
33
- secret: params[:secret],
34
- state: params[:state],
35
- redirect_uri: params[:redirect_uri],
36
- authorization_endpoint: 'https://www.mollie.com/oauth2/authorize',
37
- token_endpoint: 'https://api.mollie.nl/oauth2/tokens'
38
- )
39
- client.authorization_uri(state: params[:state], scope: params[:scope], approval_prompt: params[:approval_prompt])
40
- end
41
-
42
- get '/token' do
43
- params[:code]
44
- end
45
-
46
- get '/oauth2/token' do
47
- client = Rack::OAuth2::Client.new(
48
- identifier: params[:client_id],
49
- secret: params[:secret],
50
- redirect_uri: params[:redirect_uri],
51
- authorization_endpoint: 'https://www.mollie.com/oauth2/authorize',
52
- token_endpoint: 'https://api.mollie.nl/oauth2/tokens'
53
- )
54
-
55
- client.authorization_code = params['code']
56
- client.access_token!.access_token
57
- end
58
- end
@@ -1,116 +0,0 @@
1
- class Application < Sinatra::Application
2
- swagger_schema :CustomerRequest do
3
- property :name, type: :string, description: 'Name', example: "John doe"
4
- property :email, type: :string, description: 'Email', example: "john@example.com"
5
- property :locale, type: :string, description: 'locale', example: "en_US"
6
- property :metadata, type: :object, description: 'Metadata', example: { "user_id" => "12345" }
7
- property :profileId, type: :object, description: 'ProfileId (Connect api only)', example: "pfl_FxPFwdxxJf"
8
- property :testmode, type: :boolean, description: '(Connect api only)', example: true
9
- end
10
-
11
- swagger_path '/v1/customers' do
12
- operation :get, description: 'https://www.mollie.com/en/docs/reference/customers/list', tags: ['Customers'] do
13
- parameter name: :offset, in: 'query', description: 'Offset', type: :integer
14
- parameter name: :count, in: 'query', description: 'Count', type: :integer
15
- parameter name: :testmode, in: 'query', type: :boolean, description: '(Connect api only)', example: true
16
- security api_key: []
17
- response 200, description: 'Successful response'
18
- response 500, description: 'Unexpected error'
19
- end
20
- end
21
-
22
- swagger_path '/v1/customers' do
23
- operation :post, description: 'https://www.mollie.com/en/docs/reference/customers/create', tags: ['Customers'] do
24
- security api_key: []
25
- parameter name: :customer, in: 'body', description: 'CustomerRequest params', schema: { '$ref' => '#/definitions/CustomerRequest' }
26
- response 200, description: 'Successful response'
27
- response 500, description: 'Unexpected error'
28
- end
29
- end
30
-
31
- swagger_path '/v1/customers/{id}' do
32
- operation :get, description: 'https://www.mollie.com/en/docs/reference/customers/get', tags: ['Customers'] do
33
- parameter name: :id, in: 'path', description: 'Customer id', type: :string, default: 'cst_GUvJFqwVCD'
34
- parameter name: :testmode, in: 'query', type: :boolean, description: '(Connect api only)', example: true
35
- security api_key: []
36
- response 200, description: 'Successful response'
37
- response 500, description: 'Unexpected error'
38
- end
39
- operation :patch, description: 'https://www.mollie.com/en/docs/reference/customers/create', tags: ['Customers'] do
40
- parameter name: :id, in: 'path', description: 'Customer id', type: :string, default: 'cst_GUvJFqwVCD'
41
- security api_key: []
42
- parameter name: :customer, in: 'body', description: 'CustomerRequest params', schema: { '$ref' => '#/definitions/CustomerRequest' }
43
- response 200, description: 'Successful response'
44
- response 500, description: 'Unexpected error'
45
- end
46
- end
47
-
48
- swagger_path '/v1/customers/{customer_id}/payments' do
49
- operation :get, description: 'https://www.mollie.com/en/docs/reference/customers/list-payments', tags: ['Customers'] do
50
- parameter name: :customer_id, in: 'path', description: 'Customer id', type: :string, default: 'cst_GUvJFqwVCD'
51
- parameter name: :testmode, in: 'query', type: :boolean, description: '(Connect api only)', example: true
52
- security api_key: []
53
- response 200, description: 'Successful response'
54
- response 500, description: 'Unexpected error'
55
- end
56
-
57
- operation :post, description: 'https://www.mollie.com/en/docs/reference/customers/create-payment', tags: ['Customers'] do
58
- parameter name: :customer_id, in: 'path', description: 'Customer id', type: :string, default: 'cst_GUvJFqwVCD'
59
- parameter name: :payment, in: 'body', description: 'PaymentRequest params', schema: { '$ref' => '#/definitions/PaymentRequest' }
60
- security api_key: []
61
- response 200, description: 'Successful response'
62
- response 500, description: 'Unexpected error'
63
- end
64
- end
65
-
66
- get '/v1/customers' do
67
- customers = Mollie::Customer.all(params[:offset], params[:count], testmode: params[:testmode])
68
- JSON.pretty_generate(customers.attributes)
69
- end
70
-
71
- get '/v1/customers/:id' do
72
- customer = Mollie::Customer.get(params[:id], testmode: params[:testmode])
73
- JSON.pretty_generate(customer.attributes)
74
- end
75
-
76
- post '/v1/customers' do
77
- customer = Mollie::Customer.create(
78
- name: json_params['name'],
79
- email: json_params['email'],
80
- locale: json_params['locale'],
81
- metadata: json_params['metadata'],
82
- profileId: json_params['profileId'],
83
- testmode: json_params['testmode']
84
- )
85
- JSON.pretty_generate(customer.attributes)
86
- end
87
-
88
- patch '/v1/customers/:id' do
89
- customer = Mollie::Customer.update(params[:id],
90
- name: json_params['name'],
91
- email: json_params['email'],
92
- locale: json_params['locale'],
93
- metadata: json_params['metadata'],
94
- )
95
- JSON.pretty_generate(customer.attributes)
96
- end
97
-
98
- get '/v1/customers/:customer_id/payments' do
99
- payments = Mollie::Customer::Payment.all(customer_id: params[:customer_id], testmode: params[:testmode])
100
- JSON.pretty_generate(payments.attributes)
101
- end
102
-
103
- post '/v1/customers/:customer_id/payments' do
104
- payment = Mollie::Customer::Payment.create(
105
- customer_id: params[:customer_id],
106
- amount: json_params['amount'],
107
- description: json_params['description'],
108
- redirect_url: json_params['redirect_url'],
109
- webhook_url: json_params['webhook_url'],
110
- metadata: json_params['metadata'],
111
- profileId: json_params['profileId'],
112
- testmode: json_params['testmode']
113
- )
114
- JSON.pretty_generate(payment.attributes)
115
- end
116
- end
@@ -1,38 +0,0 @@
1
- class Application < Sinatra::Application
2
- swagger_path '/v1/invoices' do
3
- operation :get, description: 'List invoices https://www.mollie.com/en/docs/reference/invoices/list', tags: ['Invoices'] do
4
- parameter name: :include, in: 'query', description: 'Include', type: :string, example: "lines,settlements"
5
- parameter name: :reference, in: 'query', description: 'Issuer id', type: :string, example: "inv_FrvewDA3Pr"
6
- parameter name: :year, in: 'query', description: 'Issuer id', type: :integer, example: Time.now.year
7
- parameter name: :offset, in: 'query', description: 'Offset', type: :integer
8
- parameter name: :count, in: 'query', description: 'Count', type: :integer
9
- security api_key: []
10
- response 200, description: 'Successful response'
11
- response 500, description: 'Unexpected error'
12
- end
13
- end
14
-
15
- swagger_path '/v1/invoices/{id}' do
16
- operation :get, description: 'Get invoice', tags: ['Invoices'] do
17
- parameter name: :id, in: 'path', description: 'Issuer id', type: :string, example: "inv_FrvewDA3Pr"
18
- parameter name: :include, in: 'query', description: 'Includes', type: :string, example: "lines,settlements"
19
- security api_key: []
20
- response 200, description: 'Successful response'
21
- response 500, description: 'Unexpected error'
22
- end
23
- end
24
-
25
- get '/v1/invoices' do
26
- invoices = Mollie::Invoice.all(params[:offset], params[:count],
27
- include: params[:include],
28
- reference: params[:reference],
29
- year: params[:year]
30
- )
31
- JSON.pretty_generate(invoices.attributes)
32
- end
33
-
34
- get '/v1/invoices/:id' do
35
- invoice = Mollie::Invoice.get(params[:id], include: params[:include])
36
- JSON.pretty_generate(invoice.attributes)
37
- end
38
- end
@@ -1,35 +0,0 @@
1
- class Application < Sinatra::Application
2
- swagger_path '/v1/issuers' do
3
- operation :get, description: 'List issuers https://www.mollie.com/en/docs/reference/issuers/list', tags: ['Issuers'] do
4
- parameter name: :offset, in: 'query', description: 'Offset', type: :integer
5
- parameter name: :count, in: 'query', description: 'Count', type: :integer
6
- parameter name: :testmode, in: 'query', description: 'Test mode', type: :boolean
7
- security api_key: []
8
- response 200, description: 'Successful response'
9
- response 500, description: 'Unexpected error'
10
- end
11
- end
12
-
13
- swagger_path '/v1/issuers/{id}' do
14
- operation :get, description: 'Get issuer', tags: ['Issuers'] do
15
- parameter name: :id, in: 'path', description: 'Issuer id', type: :string
16
- parameter name: :testmode, in: 'query', description: 'Test mode', type: :boolean
17
- security api_key: []
18
- response 200, description: 'Successful response'
19
- response 500, description: 'Unexpected error'
20
- end
21
- end
22
-
23
- get '/v1/issuers' do
24
- issuers = Mollie::Issuer.all(params[:offset], params[:count],
25
- testmode: params[:testmode])
26
- JSON.pretty_generate(issuers.attributes)
27
- end
28
-
29
- get '/v1/issuers/:id' do
30
- issuer = Mollie::Issuer.get(params[:id],
31
- testmode: params[:testmode]
32
- )
33
- JSON.pretty_generate(issuer.attributes)
34
- end
35
- end
@@ -1,83 +0,0 @@
1
- class Application < Sinatra::Application
2
- swagger_schema :MandateRequest do
3
- property :method, type: :decimal, description: 'Method', example: "directdebit"
4
- property :consumer_name, type: :string, description: 'Consumer name', example: "Customer A"
5
- property :consumer_account, type: :string, description: 'Account number', example: "NL17RABO0213698412"
6
- property :consumer_bic, type: :string, description: 'BIC', example: "RABONL2U"
7
- property :signature_date, type: :string, description: 'Date mandate was signed', example: "2016-05-01"
8
- property :mandate_reference, type: :string, description: 'A custom reference', example: "YOUR-COMPANY-MD13804"
9
- property :webhook_url, type: :string, description: 'URL for redirection', example: "https://webshop.example.org/payments/webhook/"
10
- property :testmode, type: :boolean, description: '(Connect api only)', example: true
11
- end
12
-
13
- swagger_path '/v1/customers/{customer_id}/mandates' do
14
- operation :post, description: 'Create mandates', tags: ['Mandates'] do
15
- parameter name: :customer_id, in: 'path', description: 'Customer id', type: :string, default: "cst_GUvJFqwVCD"
16
- security api_key: []
17
- parameter name: :mandate, in: 'body', description: 'MandateRequest params', schema: { '$ref' => '#/definitions/MandateRequest' }
18
- response 200, description: 'Successful response'
19
- response 500, description: 'Unexpected error'
20
- end
21
-
22
- operation :get, description: 'List mandates', tags: ['Mandates'] do
23
- parameter name: :customer_id, in: 'path', description: 'Customer id', type: :string, default: "cst_GUvJFqwVCD"
24
- parameter name: :offset, in: 'query', description: 'Offset', type: :integer
25
- parameter name: :count, in: 'query', description: 'Count', type: :integer
26
- parameter name: :testmode, in: 'query', description: 'Testmode', type: :boolean, default: true
27
- security api_key: []
28
- response 200, description: 'Successful response'
29
- response 500, description: 'Unexpected error'
30
- end
31
- end
32
-
33
- swagger_path '/v1/customers/{customer_id}/mandates/{id}' do
34
- operation :get, description: 'Get mandate', tags: ['Mandates'] do
35
- parameter name: :customer_id, in: 'path', description: 'Customer id', type: :string, default: "cst_GUvJFqwVCD"
36
- parameter name: :id, in: 'path', description: 'Mandate id', type: :string, default: "mdt_qP7Qk6mgaz"
37
- parameter name: :testmode, in: 'query', description: 'Testmode', type: :boolean, default: true
38
- security api_key: []
39
- response 200, description: 'Successful response'
40
- response 500, description: 'Unexpected error'
41
- end
42
-
43
- operation :delete, description: 'Remove mandate', tags: ['Mandates'] do
44
- parameter name: :customer_id, in: 'path', description: 'Customer id', type: :string, default: "cst_GUvJFqwVCD"
45
- parameter name: :id, in: 'path', description: 'Mandate id', type: :string, default: "mdt_qP7Qk6mgaz"
46
- parameter name: :testmode, in: 'query', description: 'Testmode', type: :boolean, default: true
47
- security api_key: []
48
- response 200, description: 'Successful response'
49
- response 500, description: 'Unexpected error'
50
- end
51
- end
52
-
53
- post '/v1/customers/:customer_id/mandates' do
54
- mandate = Mollie::Customer::Mandate.create(
55
- customer_id: params[:customer_id],
56
- method: json_params['method'],
57
- consumer_name: json_params['consumer_name'],
58
- consumer_account: json_params['consumer_account'],
59
- consumer_bic: json_params['consumer_bic'],
60
- signature_date: json_params['signature_date'],
61
- mandate_reference: json_params['mandate_reference'],
62
- webhook_url: json_params['webhook_url'],
63
- testmode: json_params['testmode']
64
- )
65
- JSON.pretty_generate(mandate.attributes)
66
- end
67
-
68
- get '/v1/customers/:customer_id/mandates' do
69
- mandates = Mollie::Customer::Mandate.all(params[:offset], params[:count], testmode: params[:testmode], customer_id: params[:customer_id])
70
- JSON.pretty_generate(mandates.attributes)
71
- end
72
-
73
-
74
- get '/v1/customers/:customer_id/mandates/:id' do
75
- mandate = Mollie::Customer::Mandate.get(params[:id], testmode: params[:testmode], customer_id: params[:customer_id])
76
- JSON.pretty_generate(mandate.attributes)
77
- end
78
-
79
- delete '/v1/customers/:customer_id/mandates/:id' do
80
- Mollie::Customer::Mandate.delete(params[:id], testmode: params[:testmode], customer_id: params[:customer_id])
81
- "deleted"
82
- end
83
- end
@@ -1,50 +0,0 @@
1
- class Application < Sinatra::Application
2
- swagger_path '/v1/methods' do
3
- operation :get, description: 'List methods https://www.mollie.com/en/docs/reference/methods/list', tags: ['Methods'] do
4
- parameter name: :include, in: 'query', description: 'Include additional data, e.g. issuers', type: :string
5
- parameter name: :recurring_type, in: 'query', description: 'Recurring type', type: :string, default: 'first'
6
- parameter name: :locale, in: 'query', description: 'Locale', type: :integer
7
- parameter name: :offset, in: 'query', description: 'Offset', type: :integer
8
- parameter name: :count, in: 'query', description: 'Count', type: :integer
9
- parameter name: :profile_id, in: 'query', description: 'Profile ID', type: :string
10
- parameter name: :testmode, in: 'query', description: 'Test mode', type: :boolean
11
- security api_key: []
12
- response 200, description: 'Successful response'
13
- response 500, description: 'Unexpected error'
14
- end
15
- end
16
-
17
- swagger_path '/v1/methods/{id}' do
18
- operation :get, description: 'Get method', tags: ['Methods'] do
19
- parameter name: :id, in: 'path', description: 'Method id', type: :string
20
- parameter name: :include, in: 'query', description: 'Include additional data, e.g. issuers', type: :string
21
- parameter name: :locale, in: 'query', description: 'Locale', type: :integer
22
- parameter name: :profile_id, in: 'query', description: 'Profile ID', type: :string
23
- parameter name: :testmode, in: 'query', description: 'Test mode', type: :boolean
24
- security api_key: []
25
- response 200, description: 'Successful response'
26
- response 500, description: 'Unexpected error'
27
- end
28
- end
29
-
30
- get '/v1/methods' do
31
- methods = Mollie::Method.all(params[:offset], params[:count],
32
- include: params[:include],
33
- recurring_type: params[:recurring_type],
34
- locale: params[:locale],
35
- profile_id: params[:profile_id],
36
- testmode: params[:testmode]
37
- )
38
- JSON.pretty_generate(methods.attributes)
39
- end
40
-
41
- get '/v1/methods/:id' do
42
- method = Mollie::Method.get(params[:id],
43
- include: params[:include],
44
- locale: params[:locale],
45
- profile_id: params[:profile_id],
46
- testmode: params[:testmode]
47
- )
48
- JSON.pretty_generate(method.attributes)
49
- end
50
- end
@@ -1,16 +0,0 @@
1
- class Application < Sinatra::Application
2
- swagger_path '/v1/organizations/{id}' do
3
- operation :get, description: 'Get organization https://www.mollie.com/en/docs/reference/organizations/get', tags: ['Organizations'] do
4
- parameter name: :id, in: 'path', description: 'Organization id', type: :string
5
- parameter name: :testmode, in: 'query', description: 'Test mode', type: :boolean
6
- security api_key: []
7
- response 200, description: 'Successful response'
8
- response 500, description: 'Unexpected error'
9
- end
10
- end
11
-
12
- get '/v1/organizations/:id' do
13
- organization = Mollie::Organization.get(params[:id], testmode: params[:testmode])
14
- JSON.pretty_generate(organization.attributes)
15
- end
16
- end