mollie-api-ruby 2.2.1 → 3.1.0
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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +7 -0
- data/README.md +37 -8
- data/examples/apis/api_docs.rb +1 -1
- data/examples/apis/chargebacks.rb +17 -0
- data/examples/apis/connect.rb +1 -1
- data/examples/apis/customers.rb +7 -6
- data/examples/apis/invoices.rb +2 -2
- data/examples/apis/issuers.rb +2 -2
- data/examples/apis/mandates.rb +5 -5
- data/examples/apis/methods.rb +2 -2
- data/examples/apis/organizations.rb +1 -1
- data/examples/apis/payments.rb +43 -9
- data/examples/apis/permissions.rb +2 -2
- data/examples/apis/profiles.rb +7 -7
- data/examples/apis/refunds.rb +1 -1
- data/examples/apis/settlements.rb +5 -5
- data/examples/apis/subscriptions.rb +7 -7
- data/examples/config.ru +6 -7
- data/lib/{mollie/api/cacert.pem → cacert.pem} +0 -0
- data/lib/mollie-api-ruby.rb +1 -0
- data/lib/mollie.rb +39 -0
- data/lib/mollie/base.rb +91 -0
- data/lib/mollie/chargeback.rb +36 -0
- data/lib/mollie/client.rb +125 -0
- data/lib/mollie/customer.rb +36 -0
- data/lib/mollie/customer/mandate.rb +33 -0
- data/lib/mollie/customer/payment.rb +6 -0
- data/lib/mollie/customer/subscription.rb +65 -0
- data/lib/mollie/exception.rb +8 -0
- data/lib/mollie/invoice.rb +66 -0
- data/lib/mollie/issuer.rb +5 -0
- data/lib/mollie/list.rb +40 -0
- data/lib/mollie/method.rb +38 -0
- data/lib/mollie/organization.rb +24 -0
- data/lib/mollie/payment.rb +142 -0
- data/lib/mollie/payment/chargeback.rb +6 -0
- data/lib/mollie/payment/refund.rb +6 -0
- data/lib/mollie/permission.rb +26 -0
- data/lib/mollie/profile.rb +78 -0
- data/lib/mollie/profile/api_key.rb +19 -0
- data/lib/mollie/refund.rb +42 -0
- data/lib/mollie/relation.rb +36 -0
- data/lib/mollie/settlement.rb +36 -0
- data/lib/mollie/settlement/chargeback.rb +6 -0
- data/lib/mollie/settlement/payment.rb +6 -0
- data/lib/mollie/settlement/refund.rb +6 -0
- data/lib/mollie/util.rb +57 -0
- data/lib/mollie/version.rb +3 -0
- data/mollie.gemspec +2 -2
- data/test/helper.rb +5 -1
- data/test/mollie/base_test.rb +182 -0
- data/test/mollie/chargeback_test.rb +35 -0
- data/test/mollie/client_test.rb +122 -0
- data/test/mollie/customer/mandate_test.rb +43 -0
- data/test/mollie/customer/payment_test.rb +23 -0
- data/test/mollie/customer/subscription_test.rb +66 -0
- data/test/mollie/customer_test.rb +128 -0
- data/test/mollie/invoice_test.rb +55 -0
- data/test/mollie/issuer_test.rb +19 -0
- data/test/mollie/list_test.rb +40 -0
- data/test/mollie/method_test.rb +29 -0
- data/test/mollie/organization_test.rb +41 -0
- data/test/mollie/payment/chargeback_test.rb +22 -0
- data/test/mollie/payment/refund_test.rb +22 -0
- data/test/mollie/payment_test.rb +161 -0
- data/test/mollie/permission_test.rb +21 -0
- data/test/mollie/profile/apikey_test.rb +31 -0
- data/test/mollie/profile_test.rb +98 -0
- data/test/mollie/refund_test.rb +40 -0
- data/test/mollie/settlement/chargeback_test.rb +22 -0
- data/test/mollie/settlement/payment_test.rb +22 -0
- data/test/mollie/settlement/refund_test.rb +22 -0
- data/test/mollie/settlement_test.rb +156 -0
- data/website-docs/chargebacks/list-all.rb +12 -0
- data/website-docs/connect/authorize.rb +15 -0
- data/website-docs/connect/tokens.rb +14 -0
- data/website-docs/customers/create-payment.rb +13 -0
- data/website-docs/customers/create.rb +12 -0
- data/website-docs/customers/delete.rb +10 -0
- data/website-docs/customers/get.rb +10 -0
- data/website-docs/customers/list-payments.rb +10 -0
- data/website-docs/customers/list.rb +12 -0
- data/website-docs/customers/update.rb +11 -0
- data/website-docs/invoices/get.rb +10 -0
- data/website-docs/invoices/list.rb +12 -0
- data/website-docs/issuers/get.rb +10 -0
- data/website-docs/issuers/list.rb +12 -0
- data/website-docs/mandates/create.rb +16 -0
- data/website-docs/mandates/delete.rb +10 -0
- data/website-docs/mandates/get.rb +10 -0
- data/website-docs/mandates/list.rb +12 -0
- data/website-docs/methods/get.rb +10 -0
- data/website-docs/methods/list.rb +12 -0
- data/website-docs/organisations/get.rb +10 -0
- data/website-docs/payments/create-refund.rb +14 -0
- data/website-docs/payments/create.rb +16 -0
- data/website-docs/payments/delete-refund.rb +13 -0
- data/website-docs/payments/delete.rb +12 -0
- data/website-docs/payments/get-chargeback.rb +11 -0
- data/website-docs/payments/get-refund.rb +11 -0
- data/website-docs/payments/get.rb +10 -0
- data/website-docs/payments/list-chargeback.rb +13 -0
- data/website-docs/payments/list-refunds.rb +13 -0
- data/website-docs/payments/list.rb +12 -0
- data/website-docs/payments/payment-webhook.rb +21 -0
- data/website-docs/permissions/get.rb +10 -0
- data/website-docs/permissions/list.rb +12 -0
- data/website-docs/profiles/create.rb +15 -0
- data/website-docs/profiles/delete.rb +10 -0
- data/website-docs/profiles/get-key.rb +11 -0
- data/website-docs/profiles/get.rb +10 -0
- data/website-docs/profiles/list-keys.rb +13 -0
- data/website-docs/profiles/list.rb +12 -0
- data/website-docs/profiles/reset-key.rb +13 -0
- data/website-docs/profiles/update.rb +12 -0
- data/website-docs/refunds/list.rb +12 -0
- data/website-docs/settlements/get.rb +10 -0
- data/website-docs/settlements/list-chargebacks.rb +13 -0
- data/website-docs/settlements/list-payments.rb +13 -0
- data/website-docs/settlements/list-refunds.rb +13 -0
- data/website-docs/settlements/list.rb +12 -0
- data/website-docs/settlements/next.rb +9 -0
- data/website-docs/settlements/open.rb +9 -0
- data/website-docs/subscriptions/create.rb +14 -0
- data/website-docs/subscriptions/delete.rb +10 -0
- data/website-docs/subscriptions/get.rb +10 -0
- data/website-docs/subscriptions/list.rb +12 -0
- metadata +134 -104
- data/lib/mollie/api/client.rb +0 -161
- data/lib/mollie/api/client/version.rb +0 -7
- data/lib/mollie/api/exception.rb +0 -10
- data/lib/mollie/api/object/base.rb +0 -18
- data/lib/mollie/api/object/customer.rb +0 -28
- data/lib/mollie/api/object/customer/mandate.rb +0 -37
- data/lib/mollie/api/object/customer/subscription.rb +0 -69
- data/lib/mollie/api/object/invoice.rb +0 -70
- data/lib/mollie/api/object/issuer.rb +0 -9
- data/lib/mollie/api/object/list.rb +0 -44
- data/lib/mollie/api/object/method.rb +0 -42
- data/lib/mollie/api/object/organization.rb +0 -28
- data/lib/mollie/api/object/payment.rb +0 -137
- data/lib/mollie/api/object/payment/refund.rb +0 -47
- data/lib/mollie/api/object/permission.rb +0 -12
- data/lib/mollie/api/object/profile.rb +0 -78
- data/lib/mollie/api/object/profile/apikey.rb +0 -23
- data/lib/mollie/api/object/settlement.rb +0 -32
- data/lib/mollie/api/resource/base.rb +0 -53
- data/lib/mollie/api/resource/customers.rb +0 -11
- data/lib/mollie/api/resource/customers/mandates.rb +0 -27
- data/lib/mollie/api/resource/customers/payments.rb +0 -27
- data/lib/mollie/api/resource/customers/subscriptions.rb +0 -27
- data/lib/mollie/api/resource/invoices.rb +0 -11
- data/lib/mollie/api/resource/issuers.rb +0 -11
- data/lib/mollie/api/resource/methods.rb +0 -11
- data/lib/mollie/api/resource/organizations.rb +0 -11
- data/lib/mollie/api/resource/payments.rb +0 -11
- data/lib/mollie/api/resource/payments/refunds.rb +0 -27
- data/lib/mollie/api/resource/permissions.rb +0 -31
- data/lib/mollie/api/resource/profiles.rb +0 -11
- data/lib/mollie/api/resource/profiles/apikeys.rb +0 -33
- data/lib/mollie/api/resource/refunds.rb +0 -11
- data/lib/mollie/api/resource/settlements.rb +0 -19
- data/lib/mollie/api/resource/settlements/payments.rb +0 -27
- data/lib/mollie/api/util.rb +0 -53
- data/test/mollie/api/client_test.rb +0 -111
- data/test/mollie/api/object/base_test.rb +0 -21
- data/test/mollie/api/object/customer/mandate_test.rb +0 -47
- data/test/mollie/api/object/customer/subscription_test.rb +0 -70
- data/test/mollie/api/object/customer_test.rb +0 -35
- data/test/mollie/api/object/invoice_test.rb +0 -59
- data/test/mollie/api/object/issuer_test.rb +0 -23
- data/test/mollie/api/object/list_test.rb +0 -44
- data/test/mollie/api/object/method_test.rb +0 -33
- data/test/mollie/api/object/organization_test.rb +0 -45
- data/test/mollie/api/object/payment/refund_test.rb +0 -46
- data/test/mollie/api/object/payment_test.rb +0 -106
- data/test/mollie/api/object/permission_test.rb +0 -25
- data/test/mollie/api/object/profile/apikey_test.rb +0 -35
- data/test/mollie/api/object/profile_test.rb +0 -72
- data/test/mollie/api/object/settlement_test.rb +0 -140
- data/test/mollie/api/resource/base_test.rb +0 -83
- data/test/mollie/api/resource/customers/mandates_test.rb +0 -23
- data/test/mollie/api/resource/customers/payments_test.rb +0 -23
- data/test/mollie/api/resource/customers/subscriptions_test.rb +0 -23
- data/test/mollie/api/resource/customers_test.rb +0 -13
- data/test/mollie/api/resource/invoices_test.rb +0 -13
- data/test/mollie/api/resource/issuers_test.rb +0 -13
- data/test/mollie/api/resource/methods_test.rb +0 -13
- data/test/mollie/api/resource/organizations_test.rb +0 -13
- data/test/mollie/api/resource/payments/refunds_test.rb +0 -23
- data/test/mollie/api/resource/payments_test.rb +0 -13
- data/test/mollie/api/resource/permissions_test.rb +0 -13
- data/test/mollie/api/resource/profiles/apikeys_test.rb +0 -23
- data/test/mollie/api/resource/profiles_test.rb +0 -13
- data/test/mollie/api/resource/settlements_test.rb +0 -13
- data/test/mollie/api/util_test.rb +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1c2e6be24fa39ccf69510523b4b5a40cb6751db4ea6f819cde67fa3ef395586c
|
4
|
+
data.tar.gz: 33c5f94a0ccfe001a1c4762af6bd6e5e1f3759fea8b80ffc845eb2d704ceb778
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d0e2c5c93a303db70129236a2ffd11a9b2008683d02c22a5577971b7b9a894a1d3609caa07b05af3c6231683dec75e7ae4142fc66bd12849b5d15bcd179ee7b
|
7
|
+
data.tar.gz: 76fc4df609c87e70abde982aa12d8190c10e02a3a5c82a1b0ee28c7a3a17eef57f4d4c1b2d0eed24c26776c99ac8300fc8ecdd84a753b799a9898ad582cb112a
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@
|
|
4
4
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
6
6
|
|
7
|
+
#### 3.1.0 - ....
|
8
|
+
- Removed old api
|
9
|
+
|
10
|
+
#### 3.0.0 - ....
|
11
|
+
- Introduced new api
|
12
|
+
- Deprecated old api
|
13
|
+
|
7
14
|
#### 2.2.1 - 2017-09-13
|
8
15
|
- Added support for gift card method.
|
9
16
|
- Added support for `invoice` endpoint.
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|

|
2
2
|
|
3
|
+
# LOOKING FOR VERSION v2.2.X README [CLICK HERE](https://github.com/mollie/mollie-api-ruby/tree/2.2.x) #
|
4
|
+
|
3
5
|
# Mollie API client for Ruby #
|
4
6
|
|
5
7
|
[](https://badge.fury.io/rb/mollie-api-ruby)
|
@@ -20,6 +22,9 @@ To use the Mollie API client, the following things are required:
|
|
20
22
|
By far the easiest way to install the Mollie API client is to install it with [gem](http://rubygems.org/).
|
21
23
|
|
22
24
|
```
|
25
|
+
# Gemfile
|
26
|
+
gem 'mollie-api-ruby'
|
27
|
+
|
23
28
|
$ gem install mollie-api-ruby
|
24
29
|
```
|
25
30
|
|
@@ -37,22 +42,46 @@ To successfully receive a payment, these steps should be implemented:
|
|
37
42
|
|
38
43
|
## Getting started ##
|
39
44
|
|
40
|
-
Requiring the Mollie API Client.
|
45
|
+
Requiring the Mollie API Client. *Not required when used with a Gemfile*
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
require 'mollie-api-ruby'
|
49
|
+
```
|
50
|
+
|
51
|
+
Create an initializer and add the following line:
|
41
52
|
|
42
53
|
```ruby
|
43
|
-
|
54
|
+
Mollie::Client.configure do |config|
|
55
|
+
config.api_key = '<your-api-key>'
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
You can also include the API Key in each request you make, for instance if you are using the Connect API
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
Mollie::Payment.get("pay-id", api_key: '<your-api-key>')
|
44
63
|
```
|
45
64
|
|
46
|
-
|
65
|
+
If you need to do multiple calls with the same API Key, use the following helper
|
47
66
|
|
48
67
|
```ruby
|
49
|
-
|
68
|
+
Mollie::Client.with_api_key('<your-api-key>') do
|
69
|
+
mandates = Mollie::Customer::Mandate.all(customer_id: params[:customer_id])
|
70
|
+
if mandates.any?
|
71
|
+
payment = Mollie::Payment.create(
|
72
|
+
amount: 10.00,
|
73
|
+
description: 'My first API payment',
|
74
|
+
redirect_url: 'https://webshop.example.org/order/12345/',
|
75
|
+
webhook_url: 'https://webshop.example.org/mollie-webhook/'
|
76
|
+
)
|
77
|
+
end
|
78
|
+
end
|
50
79
|
```
|
51
80
|
|
52
81
|
Creating a new payment.
|
53
82
|
|
54
83
|
```ruby
|
55
|
-
payment =
|
84
|
+
payment = Mollie::Payment.create(
|
56
85
|
amount: 10.00,
|
57
86
|
description: 'My first API payment',
|
58
87
|
redirect_url: 'https://webshop.example.org/order/12345/',
|
@@ -63,7 +92,7 @@ payment = mollie.payments.create(
|
|
63
92
|
Retrieving a payment.
|
64
93
|
|
65
94
|
```ruby
|
66
|
-
payment =
|
95
|
+
payment = Mollie::Payment.get(payment.id)
|
67
96
|
|
68
97
|
if payment.paid?
|
69
98
|
puts 'Payment received.'
|
@@ -77,8 +106,8 @@ definitive. Refunds are only supported for iDEAL, credit card and Bank Transfer
|
|
77
106
|
be refunded through our API at the moment.
|
78
107
|
|
79
108
|
```ruby
|
80
|
-
payment =
|
81
|
-
refund =
|
109
|
+
payment = Mollie::Payment.get(payment.id)
|
110
|
+
refund = payment.refunds.create
|
82
111
|
```
|
83
112
|
|
84
113
|
## Examples ##
|
data/examples/apis/api_docs.rb
CHANGED
@@ -2,7 +2,7 @@ class Application < Sinatra::Application
|
|
2
2
|
::Application
|
3
3
|
swagger_root do
|
4
4
|
key :swagger, '2.0'
|
5
|
-
info version: Mollie::
|
5
|
+
info version: Mollie::Client::VERSION,
|
6
6
|
title: 'Mollie',
|
7
7
|
description: 'Examples for the mollie api',
|
8
8
|
termsOfService: 'https://github.com/mollie/mollie-api-ruby',
|
@@ -0,0 +1,17 @@
|
|
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
CHANGED
@@ -6,7 +6,7 @@ class Application < Sinatra::Application
|
|
6
6
|
parameter name: :secret, in: 'query', description: 'oAuth Secret', type: :string
|
7
7
|
parameter name: :redirect_uri, in: 'query', description: 'Redirect URI', type: :string, default: "#{Ngrok::Tunnel.ngrok_url_https}/token"
|
8
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::
|
9
|
+
parameter name: :scope, in: 'query', description: 'Scope', type: :string, default: Mollie::Permission::AVAILABLE.join(' ')
|
10
10
|
parameter name: :response_type, in: 'query', description: 'Response Type', type: :string
|
11
11
|
parameter name: :approval_prompt, in: 'query', description: 'Approval prompt', type: :boolean
|
12
12
|
security api_key: []
|
data/examples/apis/customers.rb
CHANGED
@@ -64,17 +64,17 @@ class Application < Sinatra::Application
|
|
64
64
|
end
|
65
65
|
|
66
66
|
get '/v1/customers' do
|
67
|
-
customers =
|
67
|
+
customers = Mollie::Customer.all(params[:offset], params[:count], testmode: params[:testmode])
|
68
68
|
JSON.pretty_generate(customers.attributes)
|
69
69
|
end
|
70
70
|
|
71
71
|
get '/v1/customers/:id' do
|
72
|
-
customer =
|
72
|
+
customer = Mollie::Customer.get(params[:id], testmode: params[:testmode])
|
73
73
|
JSON.pretty_generate(customer.attributes)
|
74
74
|
end
|
75
75
|
|
76
76
|
post '/v1/customers' do
|
77
|
-
customer =
|
77
|
+
customer = Mollie::Customer.create(
|
78
78
|
name: json_params['name'],
|
79
79
|
email: json_params['email'],
|
80
80
|
locale: json_params['locale'],
|
@@ -86,7 +86,7 @@ class Application < Sinatra::Application
|
|
86
86
|
end
|
87
87
|
|
88
88
|
patch '/v1/customers/:id' do
|
89
|
-
customer =
|
89
|
+
customer = Mollie::Customer.update(params[:id],
|
90
90
|
name: json_params['name'],
|
91
91
|
email: json_params['email'],
|
92
92
|
locale: json_params['locale'],
|
@@ -96,12 +96,13 @@ class Application < Sinatra::Application
|
|
96
96
|
end
|
97
97
|
|
98
98
|
get '/v1/customers/:customer_id/payments' do
|
99
|
-
payments =
|
99
|
+
payments = Mollie::Customer::Payment.all(customer_id: params[:customer_id], testmode: params[:testmode])
|
100
100
|
JSON.pretty_generate(payments.attributes)
|
101
101
|
end
|
102
102
|
|
103
103
|
post '/v1/customers/:customer_id/payments' do
|
104
|
-
payment =
|
104
|
+
payment = Mollie::Customer::Payment.create(
|
105
|
+
customer_id: params[:customer_id],
|
105
106
|
amount: json_params['amount'],
|
106
107
|
description: json_params['description'],
|
107
108
|
redirect_url: json_params['redirect_url'],
|
data/examples/apis/invoices.rb
CHANGED
@@ -23,7 +23,7 @@ class Application < Sinatra::Application
|
|
23
23
|
end
|
24
24
|
|
25
25
|
get '/v1/invoices' do
|
26
|
-
invoices =
|
26
|
+
invoices = Mollie::Invoice.all(params[:offset], params[:count],
|
27
27
|
include: params[:include],
|
28
28
|
reference: params[:reference],
|
29
29
|
year: params[:year]
|
@@ -32,7 +32,7 @@ class Application < Sinatra::Application
|
|
32
32
|
end
|
33
33
|
|
34
34
|
get '/v1/invoices/:id' do
|
35
|
-
invoice =
|
35
|
+
invoice = Mollie::Invoice.get(params[:id], include: params[:include])
|
36
36
|
JSON.pretty_generate(invoice.attributes)
|
37
37
|
end
|
38
38
|
end
|
data/examples/apis/issuers.rb
CHANGED
@@ -21,13 +21,13 @@ class Application < Sinatra::Application
|
|
21
21
|
end
|
22
22
|
|
23
23
|
get '/v1/issuers' do
|
24
|
-
issuers =
|
24
|
+
issuers = Mollie::Issuer.all(params[:offset], params[:count],
|
25
25
|
testmode: params[:testmode])
|
26
26
|
JSON.pretty_generate(issuers.attributes)
|
27
27
|
end
|
28
28
|
|
29
29
|
get '/v1/issuers/:id' do
|
30
|
-
issuer =
|
30
|
+
issuer = Mollie::Issuer.get(params[:id],
|
31
31
|
testmode: params[:testmode]
|
32
32
|
)
|
33
33
|
JSON.pretty_generate(issuer.attributes)
|
data/examples/apis/mandates.rb
CHANGED
@@ -51,7 +51,8 @@ class Application < Sinatra::Application
|
|
51
51
|
end
|
52
52
|
|
53
53
|
post '/v1/customers/:customer_id/mandates' do
|
54
|
-
mandate =
|
54
|
+
mandate = Mollie::Customer::Mandate.create(
|
55
|
+
customer_id: params[:customer_id],
|
55
56
|
method: json_params['method'],
|
56
57
|
consumer_name: json_params['consumer_name'],
|
57
58
|
consumer_account: json_params['consumer_account'],
|
@@ -65,19 +66,18 @@ class Application < Sinatra::Application
|
|
65
66
|
end
|
66
67
|
|
67
68
|
get '/v1/customers/:customer_id/mandates' do
|
68
|
-
mandates =
|
69
|
-
)
|
69
|
+
mandates = Mollie::Customer::Mandate.all(params[:offset], params[:count], testmode: params[:testmode], customer_id: params[:customer_id])
|
70
70
|
JSON.pretty_generate(mandates.attributes)
|
71
71
|
end
|
72
72
|
|
73
73
|
|
74
74
|
get '/v1/customers/:customer_id/mandates/:id' do
|
75
|
-
mandate =
|
75
|
+
mandate = Mollie::Customer::Mandate.get(params[:id], testmode: params[:testmode], customer_id: params[:customer_id])
|
76
76
|
JSON.pretty_generate(mandate.attributes)
|
77
77
|
end
|
78
78
|
|
79
79
|
delete '/v1/customers/:customer_id/mandates/:id' do
|
80
|
-
|
80
|
+
Mollie::Customer::Mandate.delete(params[:id], testmode: params[:testmode], customer_id: params[:customer_id])
|
81
81
|
"deleted"
|
82
82
|
end
|
83
83
|
end
|
data/examples/apis/methods.rb
CHANGED
@@ -28,7 +28,7 @@ class Application < Sinatra::Application
|
|
28
28
|
end
|
29
29
|
|
30
30
|
get '/v1/methods' do
|
31
|
-
methods =
|
31
|
+
methods = Mollie::Method.all(params[:offset], params[:count],
|
32
32
|
include: params[:include],
|
33
33
|
recurring_type: params[:recurring_type],
|
34
34
|
locale: params[:locale],
|
@@ -39,7 +39,7 @@ class Application < Sinatra::Application
|
|
39
39
|
end
|
40
40
|
|
41
41
|
get '/v1/methods/:id' do
|
42
|
-
method =
|
42
|
+
method = Mollie::Method.get(params[:id],
|
43
43
|
include: params[:include],
|
44
44
|
locale: params[:locale],
|
45
45
|
profile_id: params[:profile_id],
|
@@ -10,7 +10,7 @@ class Application < Sinatra::Application
|
|
10
10
|
end
|
11
11
|
|
12
12
|
get '/v1/organizations/:id' do
|
13
|
-
organization =
|
13
|
+
organization = Mollie::Organization.get(params[:id], testmode: params[:testmode])
|
14
14
|
JSON.pretty_generate(organization.attributes)
|
15
15
|
end
|
16
16
|
end
|
data/examples/apis/payments.rb
CHANGED
@@ -67,7 +67,7 @@ class Application < Sinatra::Application
|
|
67
67
|
end
|
68
68
|
|
69
69
|
swagger_path '/v1/payments/{payment_id}/refunds/{id}' do
|
70
|
-
operation :get, description: '
|
70
|
+
operation :get, description: 'Get refund https://www.mollie.com/nl/docs/reference/refunds/get', tags: ['Payments'] do
|
71
71
|
parameter name: :payment_id, in: 'path', description: 'Payment id', type: :string
|
72
72
|
parameter name: :id, in: 'path', description: 'Refund id', type: :string
|
73
73
|
parameter name: :testmode, in: 'query', description: 'Testmode', type: :boolean, default: true
|
@@ -76,7 +76,7 @@ class Application < Sinatra::Application
|
|
76
76
|
response 500, description: 'Unexpected error'
|
77
77
|
end
|
78
78
|
|
79
|
-
operation :delete, description: 'Delete
|
79
|
+
operation :delete, description: 'Delete refund https://www.mollie.com/nl/docs/reference/refunds/delete', tags: ['Payments'] do
|
80
80
|
parameter name: :payment_id, in: 'path', description: 'Payment id', type: :string
|
81
81
|
parameter name: :id, in: 'path', description: 'Refund id', type: :string
|
82
82
|
parameter name: :testmode, in: 'query', description: 'Testmode', type: :boolean, default: true
|
@@ -86,8 +86,31 @@ class Application < Sinatra::Application
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
swagger_path '/v1/payments/{payment_id}/chargebacks' do
|
90
|
+
operation :get, description: 'List payment chargebacks https://www.mollie.com/en/docs/reference/chargebacks/list', tags: ['Payments'] do
|
91
|
+
parameter name: :payment_id, in: 'path', description: 'Payment id', type: :string
|
92
|
+
parameter name: :offset, in: 'query', description: 'Offset', type: :integer
|
93
|
+
parameter name: :count, in: 'query', description: 'Count', type: :integer
|
94
|
+
parameter name: :testmode, in: 'query', description: 'Testmode', type: :boolean, default: true
|
95
|
+
security api_key: []
|
96
|
+
response 200, description: 'Successful response'
|
97
|
+
response 500, description: 'Unexpected error'
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
swagger_path '/v1/payments/{payment_id}/chargebacks/{id}' do
|
102
|
+
operation :get, description: 'Get chargeback https://www.mollie.com/nl/docs/reference/chargebacks/get', tags: ['Payments'] do
|
103
|
+
parameter name: :payment_id, in: 'path', description: 'Payment id', type: :string
|
104
|
+
parameter name: :id, in: 'path', description: 'Refund id', type: :string
|
105
|
+
parameter name: :testmode, in: 'query', description: 'Testmode', type: :boolean, default: true
|
106
|
+
security api_key: []
|
107
|
+
response 200, description: 'Successful response'
|
108
|
+
response 500, description: 'Unexpected error'
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
89
112
|
get '/v1/payments' do
|
90
|
-
payments =
|
113
|
+
payments = Mollie::Payment.all(params[:offset], params[:count],
|
91
114
|
profile_id: params[:profile_id],
|
92
115
|
testmode: params[:testmode]
|
93
116
|
)
|
@@ -96,12 +119,12 @@ class Application < Sinatra::Application
|
|
96
119
|
end
|
97
120
|
|
98
121
|
get '/v1/payments/:id' do
|
99
|
-
payment =
|
122
|
+
payment = Mollie::Payment.get(params[:id], testmode: params[:testmode])
|
100
123
|
JSON.pretty_generate(payment.attributes)
|
101
124
|
end
|
102
125
|
|
103
126
|
post '/v1/payments' do
|
104
|
-
payment =
|
127
|
+
payment = Mollie::Payment.create(
|
105
128
|
amount: json_params['amount'],
|
106
129
|
description: json_params['description'],
|
107
130
|
redirect_url: json_params['redirect_url'],
|
@@ -114,7 +137,8 @@ class Application < Sinatra::Application
|
|
114
137
|
end
|
115
138
|
|
116
139
|
post '/v1/payments/:payment_id/refunds' do
|
117
|
-
refund =
|
140
|
+
refund = Mollie::Payment::Refund.create(
|
141
|
+
payment_id: params[:payment_id],
|
118
142
|
amount: json_params['amount'],
|
119
143
|
description: json_params['description'],
|
120
144
|
testmode: json_params['testmode']
|
@@ -123,18 +147,28 @@ class Application < Sinatra::Application
|
|
123
147
|
end
|
124
148
|
|
125
149
|
get '/v1/payments/:payment_id/refunds/:id' do
|
126
|
-
refund =
|
150
|
+
refund = Mollie::Payment::Refund.get(params[:id], testmode: params[:testmode], payment_id: params[:payment_id])
|
127
151
|
JSON.pretty_generate(refund.attributes)
|
128
152
|
end
|
129
153
|
|
130
154
|
delete '/v1/payments/:payment_id/refunds/:id' do
|
131
|
-
|
155
|
+
Mollie::Payment::Refund.delete(params[:id], testmode: params[:testmode], payment_id: params[:payment_id])
|
132
156
|
"deleted"
|
133
157
|
end
|
134
158
|
|
135
159
|
get '/v1/payments/:payment_id/refunds' do
|
136
|
-
refunds =
|
160
|
+
refunds = Mollie::Payment::Refund.all(params[:offset], params[:count], testmode: params[:testmode], payment_id: params[:payment_id])
|
137
161
|
JSON.pretty_generate(refunds.attributes)
|
138
162
|
end
|
139
163
|
|
164
|
+
get '/v1/payments/:payment_id/chargebacks/:id' do
|
165
|
+
chargeback = Mollie::Payment::Chargeback.get(params[:id], testmode: params[:testmode], payment_id: params[:payment_id])
|
166
|
+
JSON.pretty_generate(chargeback.attributes)
|
167
|
+
end
|
168
|
+
|
169
|
+
get '/v1/payments/:payment_id/chargebacks' do
|
170
|
+
chargebacks = Mollie::Payment::Chargeback.all(params[:offset], params[:count], testmode: params[:testmode], payment_id: params[:payment_id])
|
171
|
+
JSON.pretty_generate(chargebacks.attributes)
|
172
|
+
end
|
173
|
+
|
140
174
|
end
|
@@ -21,12 +21,12 @@ class Application < Sinatra::Application
|
|
21
21
|
end
|
22
22
|
|
23
23
|
get '/v1/permissions' do
|
24
|
-
permissions =
|
24
|
+
permissions = Mollie::Permission.all(params[:offset], params[:count], testmode: params[:testmode])
|
25
25
|
JSON.pretty_generate(permissions.attributes)
|
26
26
|
end
|
27
27
|
|
28
28
|
get '/v1/permissions/:id' do
|
29
|
-
permission =
|
29
|
+
permission = Mollie::Permission.get(params[:id], testmode: params[:testmode])
|
30
30
|
JSON.pretty_generate(permission.attributes)
|
31
31
|
end
|
32
32
|
end
|
data/examples/apis/profiles.rb
CHANGED
@@ -76,17 +76,17 @@ class Application < Sinatra::Application
|
|
76
76
|
end
|
77
77
|
|
78
78
|
get '/v1/profiles' do
|
79
|
-
profiles =
|
79
|
+
profiles = Mollie::Profile.all(params[:offset], params[:count])
|
80
80
|
JSON.pretty_generate(profiles.attributes)
|
81
81
|
end
|
82
82
|
|
83
83
|
get '/v1/profiles/:id' do
|
84
|
-
profile =
|
84
|
+
profile = Mollie::Profile.get(params[:id])
|
85
85
|
JSON.pretty_generate(profile.attributes)
|
86
86
|
end
|
87
87
|
|
88
88
|
post '/v1/profiles' do
|
89
|
-
profile =
|
89
|
+
profile = Mollie::Profile.create(
|
90
90
|
name: json_params['name'],
|
91
91
|
website: json_params['website'],
|
92
92
|
email: json_params['email'],
|
@@ -98,7 +98,7 @@ class Application < Sinatra::Application
|
|
98
98
|
end
|
99
99
|
|
100
100
|
patch '/v1/profiles/:id' do
|
101
|
-
profile =
|
101
|
+
profile = Mollie::Profile.update(params[:id],
|
102
102
|
name: json_params['name'],
|
103
103
|
website: json_params['website'],
|
104
104
|
email: json_params['email'],
|
@@ -110,17 +110,17 @@ class Application < Sinatra::Application
|
|
110
110
|
end
|
111
111
|
|
112
112
|
get '/v1/profiles/:profile_id/apikeys' do
|
113
|
-
api_keys =
|
113
|
+
api_keys = Mollie::Profile::ApiKey.all(profile_id: params[:profile_id])
|
114
114
|
JSON.pretty_generate(api_keys.attributes)
|
115
115
|
end
|
116
116
|
|
117
117
|
get '/v1/profiles/:profile_id/apikeys/:mode' do
|
118
|
-
api_key =
|
118
|
+
api_key = Mollie::Profile::ApiKey.get(params[:mode], profile_id: params[:profile_id])
|
119
119
|
JSON.pretty_generate(api_key.attributes)
|
120
120
|
end
|
121
121
|
|
122
122
|
post '/v1/profiles/:profile_id/apikeys/:mode' do
|
123
|
-
payment =
|
123
|
+
payment = Mollie::Profile::ApiKey.create(params[:mode], profile_id: params[:profile_id])
|
124
124
|
JSON.pretty_generate(payment.attributes)
|
125
125
|
end
|
126
126
|
end
|