mollie-api-ruby 3.1.5 → 4.0.0.pre.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +0 -3
- data/CHANGELOG.md +6 -0
- data/README.md +63 -119
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/docs/migration_v2_2_x.md +67 -0
- data/docs/migration_v3_x.md +227 -0
- data/examples/chargebacks/get.rb +4 -0
- data/examples/chargebacks/list.rb +1 -0
- data/{website-docs → examples}/connect/authorize.rb +3 -2
- data/{website-docs → examples}/connect/tokens.rb +1 -1
- data/examples/customers/create-payment.rb +6 -0
- data/examples/customers/create.rb +5 -0
- data/examples/customers/delete.rb +1 -0
- data/examples/customers/get.rb +1 -0
- data/examples/customers/list-payments.rb +1 -0
- data/examples/customers/list.rb +1 -0
- data/examples/customers/update.rb +4 -0
- data/examples/invoices/get.rb +1 -0
- data/examples/invoices/list.rb +1 -0
- data/examples/mandates/create.rb +9 -0
- data/examples/mandates/delete.rb +1 -0
- data/examples/mandates/get.rb +1 -0
- data/examples/mandates/list.rb +1 -0
- data/examples/methods/get.rb +4 -0
- data/examples/methods/list.rb +4 -0
- data/examples/organisations/get-current.rb +1 -0
- data/examples/organisations/get.rb +1 -0
- data/examples/payments/create.rb +9 -0
- data/examples/payments/delete.rb +1 -0
- data/examples/payments/get-customer.rb +2 -0
- data/examples/payments/get-mandate.rb +2 -0
- data/examples/payments/get-settlement.rb +2 -0
- data/examples/payments/get-subscription.rb +2 -0
- data/examples/payments/get.rb +1 -0
- data/examples/payments/list.rb +1 -0
- data/examples/payments/webhook.rb +12 -0
- data/examples/permissions/get.rb +1 -0
- data/examples/permissions/list.rb +1 -0
- data/examples/profiles/create.rb +8 -0
- data/examples/profiles/delete.rb +1 -0
- data/examples/profiles/get.rb +1 -0
- data/examples/profiles/list-chargebacks.rb +2 -0
- data/examples/profiles/list-methods.rb +2 -0
- data/examples/profiles/list-payments.rb +2 -0
- data/examples/profiles/list-refunds.rb +2 -0
- data/examples/profiles/list.rb +1 -0
- data/examples/profiles/update.rb +5 -0
- data/examples/refunds/create.rb +5 -0
- data/examples/refunds/delete.rb +4 -0
- data/examples/refunds/get-payment.rb +2 -0
- data/examples/refunds/get.rb +4 -0
- data/examples/refunds/list.rb +1 -0
- data/examples/settlements/get.rb +1 -0
- data/examples/settlements/list-chargebacks.rb +1 -0
- data/examples/settlements/list-payments.rb +1 -0
- data/examples/settlements/list-refunds.rb +1 -0
- data/examples/settlements/list.rb +1 -0
- data/examples/settlements/next.rb +1 -0
- data/examples/settlements/open.rb +1 -0
- data/examples/subscriptions/create.rb +8 -0
- data/examples/subscriptions/delete.rb +4 -0
- data/examples/subscriptions/get.rb +4 -0
- data/examples/subscriptions/list.rb +1 -0
- data/examples/subscriptions/update.rb +5 -0
- data/lib/cacert.pem +168 -48
- data/lib/mollie.rb +1 -3
- data/lib/mollie/amount.rb +20 -0
- data/lib/mollie/base.rb +9 -8
- data/lib/mollie/chargeback.rb +25 -15
- data/lib/mollie/client.rb +33 -13
- data/lib/mollie/customer.rb +9 -14
- data/lib/mollie/customer/mandate.rb +17 -5
- data/lib/mollie/customer/subscription.rb +14 -15
- data/lib/mollie/exception.rb +15 -3
- data/lib/mollie/invoice.rb +30 -26
- data/lib/mollie/list.rb +27 -18
- data/lib/mollie/method.rb +17 -25
- data/lib/mollie/organization.rb +5 -11
- data/lib/mollie/payment.rb +89 -61
- data/lib/mollie/permission.rb +0 -1
- data/lib/mollie/profile.rb +18 -13
- data/lib/mollie/refund.rb +27 -7
- data/lib/mollie/settlement.rb +50 -9
- data/lib/mollie/util.rb +11 -0
- data/lib/mollie/version.rb +1 -1
- data/mollie-api-ruby.gemspec +0 -7
- data/test/mollie/amount_test.rb +30 -0
- data/test/mollie/base_test.rb +44 -44
- data/test/mollie/chargeback_test.rb +78 -17
- data/test/mollie/client_test.rb +29 -12
- data/test/mollie/customer/mandate_test.rb +85 -9
- data/test/mollie/customer/payment_test.rb +2 -2
- data/test/mollie/customer/subscription_test.rb +71 -20
- data/test/mollie/customer_test.rb +17 -89
- data/test/mollie/invoice_test.rb +40 -24
- data/test/mollie/list_test.rb +62 -18
- data/test/mollie/method_test.rb +2 -8
- data/test/mollie/organization_test.rb +28 -23
- data/test/mollie/payment/chargeback_test.rb +2 -3
- data/test/mollie/payment/refund_test.rb +2 -3
- data/test/mollie/payment_test.rb +272 -86
- data/test/mollie/permission_test.rb +0 -2
- data/test/mollie/profile_test.rb +129 -35
- data/test/mollie/refund_test.rb +90 -10
- data/test/mollie/settlement/chargeback_test.rb +2 -4
- data/test/mollie/settlement/payment_test.rb +2 -2
- data/test/mollie/settlement/refund_test.rb +2 -3
- data/test/mollie/settlement_test.rb +199 -98
- data/test/mollie/util_test.rb +31 -0
- metadata +96 -239
- data/examples/apis/api_docs.rb +0 -37
- data/examples/apis/chargebacks.rb +0 -17
- data/examples/apis/connect.rb +0 -58
- data/examples/apis/customers.rb +0 -116
- data/examples/apis/invoices.rb +0 -38
- data/examples/apis/issuers.rb +0 -35
- data/examples/apis/mandates.rb +0 -83
- data/examples/apis/methods.rb +0 -50
- data/examples/apis/organizations.rb +0 -16
- data/examples/apis/payments.rb +0 -174
- data/examples/apis/permissions.rb +0 -32
- data/examples/apis/profiles.rb +0 -126
- data/examples/apis/refunds.rb +0 -17
- data/examples/apis/settlements.rb +0 -84
- data/examples/apis/subscriptions.rb +0 -165
- data/examples/config.ru +0 -57
- data/examples/public/images/collapse.gif +0 -0
- data/examples/public/images/expand.gif +0 -0
- data/examples/public/images/explorer_icons.png +0 -0
- data/examples/public/images/favicon-16x16.png +0 -0
- data/examples/public/images/favicon-32x32.png +0 -0
- data/examples/public/images/favicon.ico +0 -0
- data/examples/public/images/logo_small.png +0 -0
- data/examples/public/images/pet_store_api.png +0 -0
- data/examples/public/images/throbber.gif +0 -0
- data/examples/public/images/wordnik_api.png +0 -0
- data/examples/public/index.html +0 -101
- data/examples/public/javascripts/lib/backbone-min.js +0 -1
- data/examples/public/javascripts/lib/es5-shim.js +0 -1
- data/examples/public/javascripts/lib/handlebars-4.0.5.js +0 -3
- data/examples/public/javascripts/lib/highlight.9.1.0.pack.js +0 -1
- data/examples/public/javascripts/lib/highlight.9.1.0.pack_extended.js +0 -1
- data/examples/public/javascripts/lib/jquery-1.8.0.min.js +0 -3
- data/examples/public/javascripts/lib/jquery.ba-bbq.min.js +0 -1
- data/examples/public/javascripts/lib/jquery.slideto.min.js +0 -1
- data/examples/public/javascripts/lib/jquery.wiggle.min.js +0 -1
- data/examples/public/javascripts/lib/js-yaml.min.js +0 -2
- data/examples/public/javascripts/lib/jsoneditor.min.js +0 -5
- data/examples/public/javascripts/lib/lodash.min.js +0 -2
- data/examples/public/javascripts/lib/marked.js +0 -1
- data/examples/public/javascripts/lib/object-assign-pollyfill.js +0 -1
- data/examples/public/javascripts/lib/sanitize-html.min.js +0 -4
- data/examples/public/javascripts/lib/swagger-oauth.js +0 -1
- data/examples/public/javascripts/swagger-ui.js +0 -25378
- data/examples/public/javascripts/swagger-ui.min.js +0 -15
- data/examples/public/javascripts/swagger_docs.js +0 -14
- data/examples/public/o2c.html +0 -20
- data/examples/public/stylesheets/reset.css +0 -1
- data/examples/public/stylesheets/screen.css +0 -1545
- data/examples/public/stylesheets/swagger_docs.css +0 -4
- data/examples/public/stylesheets/typography.css +0 -0
- data/lib/mollie/issuer.rb +0 -5
- data/lib/mollie/profile/api_key.rb +0 -19
- data/lib/mollie/relation.rb +0 -36
- data/test/mollie/issuer_test.rb +0 -19
- data/test/mollie/profile/apikey_test.rb +0 -31
- data/website-docs/chargebacks/list-all.rb +0 -12
- data/website-docs/customers/create-payment.rb +0 -13
- data/website-docs/customers/create.rb +0 -12
- data/website-docs/customers/delete.rb +0 -10
- data/website-docs/customers/get.rb +0 -10
- data/website-docs/customers/list-payments.rb +0 -10
- data/website-docs/customers/list.rb +0 -12
- data/website-docs/customers/update.rb +0 -11
- data/website-docs/invoices/get.rb +0 -10
- data/website-docs/invoices/list.rb +0 -12
- data/website-docs/issuers/get.rb +0 -10
- data/website-docs/issuers/list.rb +0 -12
- data/website-docs/mandates/create.rb +0 -16
- data/website-docs/mandates/delete.rb +0 -10
- data/website-docs/mandates/get.rb +0 -10
- data/website-docs/mandates/list.rb +0 -12
- data/website-docs/methods/get.rb +0 -10
- data/website-docs/methods/list.rb +0 -12
- data/website-docs/organisations/get.rb +0 -10
- data/website-docs/payments/create-refund.rb +0 -14
- data/website-docs/payments/create.rb +0 -16
- data/website-docs/payments/delete-refund.rb +0 -13
- data/website-docs/payments/delete.rb +0 -12
- data/website-docs/payments/get-chargeback.rb +0 -11
- data/website-docs/payments/get-refund.rb +0 -11
- data/website-docs/payments/get.rb +0 -10
- data/website-docs/payments/list-chargeback.rb +0 -13
- data/website-docs/payments/list-refunds.rb +0 -13
- data/website-docs/payments/list.rb +0 -12
- data/website-docs/payments/payment-webhook.rb +0 -21
- data/website-docs/permissions/get.rb +0 -10
- data/website-docs/permissions/list.rb +0 -12
- data/website-docs/profiles/create.rb +0 -15
- data/website-docs/profiles/delete.rb +0 -10
- data/website-docs/profiles/get-key.rb +0 -11
- data/website-docs/profiles/get.rb +0 -10
- data/website-docs/profiles/list-keys.rb +0 -13
- data/website-docs/profiles/list.rb +0 -12
- data/website-docs/profiles/reset-key.rb +0 -13
- data/website-docs/profiles/update.rb +0 -12
- data/website-docs/refunds/list.rb +0 -12
- data/website-docs/settlements/get.rb +0 -10
- data/website-docs/settlements/list-chargebacks.rb +0 -13
- data/website-docs/settlements/list-payments.rb +0 -13
- data/website-docs/settlements/list-refunds.rb +0 -13
- data/website-docs/settlements/list.rb +0 -12
- data/website-docs/settlements/next.rb +0 -9
- data/website-docs/settlements/open.rb +0 -9
- data/website-docs/subscriptions/create.rb +0 -14
- data/website-docs/subscriptions/delete.rb +0 -10
- data/website-docs/subscriptions/get.rb +0 -10
- data/website-docs/subscriptions/list.rb +0 -12
data/examples/apis/api_docs.rb
DELETED
@@ -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
|
data/examples/apis/connect.rb
DELETED
@@ -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
|
data/examples/apis/customers.rb
DELETED
@@ -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
|
data/examples/apis/invoices.rb
DELETED
@@ -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
|
data/examples/apis/issuers.rb
DELETED
@@ -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
|
data/examples/apis/mandates.rb
DELETED
@@ -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
|
data/examples/apis/methods.rb
DELETED
@@ -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
|