mollie-api-ruby 2.2.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
mandate = Mollie::Mandate.create(
|
5
|
+
customer_id: "cst_8wmqcHMN4U",
|
6
|
+
method: "directdebit",
|
7
|
+
consumer_name: "John",
|
8
|
+
consumer_account: "NL53INGB0000000000",
|
9
|
+
consumer_bic: "INGBNL2A",
|
10
|
+
signature_date: "2016-05-01",
|
11
|
+
mandate_reference: "ref-123",
|
12
|
+
api_key: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
|
13
|
+
)
|
14
|
+
rescue Mollie::Exception => e
|
15
|
+
puts 'An error has occurred: ' << e.message
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
refund = Mollie::Payment::Refund.create(
|
5
|
+
payment_id: 'tr_7UhSN1zuXS',
|
6
|
+
amount: '5.0',
|
7
|
+
description: 'Did not like it',
|
8
|
+
api_key: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
|
9
|
+
)
|
10
|
+
rescue Mollie::Exception => e
|
11
|
+
puts 'An error has occurred: ' << e.message
|
12
|
+
end
|
13
|
+
|
14
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
payment = Mollie::Payment.create(
|
5
|
+
amount: 10.00,
|
6
|
+
description: 'My first payment',
|
7
|
+
redirectUrl: 'https://webshop.example.org/order/12345/',
|
8
|
+
webhookUrl: 'https://webshop.example.org/payments/webhook/',
|
9
|
+
metadata: {
|
10
|
+
order_id: '12345'
|
11
|
+
},
|
12
|
+
api_key: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
|
13
|
+
)
|
14
|
+
rescue Mollie::Exception => e
|
15
|
+
puts 'An error has occurred: ' << e.message
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
Mollie::Payment::Refund.delete(
|
5
|
+
're_4qqhO89gsT',
|
6
|
+
payment_id: 'tr_7UhSN1zuXS',
|
7
|
+
api_key: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
|
8
|
+
)
|
9
|
+
rescue Mollie::Exception => e
|
10
|
+
puts 'An error has occurred: ' << e.message
|
11
|
+
end
|
12
|
+
|
13
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
chargeback = Mollie::Payment::Chargeback.get(
|
5
|
+
"chb_n9z0tp",
|
6
|
+
payment_id: "tr_7UhSN1zuXS",
|
7
|
+
api_key: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
|
8
|
+
)
|
9
|
+
rescue Mollie::Exception => e
|
10
|
+
puts 'An error has occurred: ' << e.message
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
refund = Mollie::Payment::Refund.get(
|
5
|
+
"re_4qqhO89gsT",
|
6
|
+
payment_id: 'tr_7UhSN1zuXS',
|
7
|
+
api_key: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
|
8
|
+
)
|
9
|
+
rescue Mollie::Exception => e
|
10
|
+
puts 'An error has occurred: ' << e.message
|
11
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
offset = 0
|
5
|
+
limit = 50
|
6
|
+
chargebacks = Mollie::Payment::Chargeback.all(
|
7
|
+
offset, limit,
|
8
|
+
payment_id: 'tr_7UhSN1zuXS',
|
9
|
+
api_key: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
|
10
|
+
)
|
11
|
+
rescue Mollie::Exception => e
|
12
|
+
puts 'An error has occurred: ' << e.message
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
offset = 0
|
5
|
+
limit = 50
|
6
|
+
refunds = Mollie::Payment::Refund.all(
|
7
|
+
offset, limit,
|
8
|
+
payment_id: 'tr_7UhSN1zuXS',
|
9
|
+
api_key: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
|
10
|
+
)
|
11
|
+
rescue Mollie::Exception => e
|
12
|
+
puts 'An error has occurred: ' << e.message
|
13
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
payment = Mollie::Payment.get(
|
5
|
+
"tr_7UhSN1zuXS",
|
6
|
+
api_key: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
|
7
|
+
)
|
8
|
+
|
9
|
+
if payment.paid?
|
10
|
+
#
|
11
|
+
# At this point you'd probably want to start the process of delivering the
|
12
|
+
# product to the customer.
|
13
|
+
#
|
14
|
+
elsif !payment.open?
|
15
|
+
#
|
16
|
+
# The payment isn't paid and isn't open anymore. We can assume it was aborted.
|
17
|
+
#
|
18
|
+
end
|
19
|
+
rescue Mollie::Exception => e
|
20
|
+
puts 'An error has occurred: ' << e.message
|
21
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
offset = 0
|
5
|
+
limit = 50
|
6
|
+
permissions = Mollie::Permission.all(
|
7
|
+
offset, limit,
|
8
|
+
api_key: 'access_Wwvu7egPcJLLJ9Kb7J632x8wJ2zMeJ'
|
9
|
+
)
|
10
|
+
rescue Mollie::Exception => e
|
11
|
+
puts 'An error has occurred: ' << e.message
|
12
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
profile = Mollie::Profile.create(
|
5
|
+
name: "My website name",
|
6
|
+
website: "https://www.mywebsite.com",
|
7
|
+
email: "info@mywebsite.com",
|
8
|
+
phone: "31123456789",
|
9
|
+
categoryCode: "5399",
|
10
|
+
mode: "live",
|
11
|
+
api_key: 'access_Wwvu7egPcJLLJ9Kb7J632x8wJ2zMeJ'
|
12
|
+
)
|
13
|
+
rescue Mollie::Exception => e
|
14
|
+
puts 'An error has occurred: ' << e.message
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
api_key = Mollie::Profile::ApiKey.get(
|
5
|
+
"live",
|
6
|
+
profile_id: "pfl_v9hTwCvYqw",
|
7
|
+
api_key: 'access_Wwvu7egPcJLLJ9Kb7J632x8wJ2zMeJ'
|
8
|
+
)
|
9
|
+
rescue Mollie::Exception => e
|
10
|
+
puts 'An error has occurred: ' << e.message
|
11
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
offset = 0
|
5
|
+
limit = 50
|
6
|
+
api_keys = Mollie::Profile::ApiKey.all(
|
7
|
+
limit, offset,
|
8
|
+
profile_id: "pfl_v9hTwCvYqw",
|
9
|
+
api_key: 'access_Wwvu7egPcJLLJ9Kb7J632x8wJ2zMeJ'
|
10
|
+
)
|
11
|
+
rescue Mollie::Exception => e
|
12
|
+
puts 'An error has occurred: ' << e.message
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
offset = 0
|
5
|
+
limit = 50
|
6
|
+
payment = Mollie::Profile::ApiKey.create(
|
7
|
+
"live",
|
8
|
+
profile_id: "pfl_v9hTwCvYqw",
|
9
|
+
api_key: 'access_Wwvu7egPcJLLJ9Kb7J632x8wJ2zMeJ'
|
10
|
+
)
|
11
|
+
rescue Mollie::Exception => e
|
12
|
+
puts 'An error has occurred: ' << e.message
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
profile = Mollie::Profile.update(
|
5
|
+
"pfl_v9hTwCvYqw",
|
6
|
+
name: "My website name",
|
7
|
+
website: "https://www.mywebsite.com",
|
8
|
+
api_key: 'access_Wwvu7egPcJLLJ9Kb7J632x8wJ2zMeJ'
|
9
|
+
)
|
10
|
+
rescue Mollie::Exception => e
|
11
|
+
puts 'An error has occurred: ' << e.message
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
offset = 0
|
5
|
+
limit = 50
|
6
|
+
payments = Mollie::Settlement::Chargeback.all(
|
7
|
+
offset, limit,
|
8
|
+
settlement_id: "stl_jDk30akdN",
|
9
|
+
api_key: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
|
10
|
+
)
|
11
|
+
rescue Mollie::Exception => e
|
12
|
+
puts 'An error has occurred: ' << e.message
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'mollie-api-ruby'
|
2
|
+
|
3
|
+
begin
|
4
|
+
offset = 0
|
5
|
+
limit = 50
|
6
|
+
payments = Mollie::Settlement::Payment.all(
|
7
|
+
offset, limit,
|
8
|
+
settlement_id: "stl_jDk30akdN",
|
9
|
+
api_key: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
|
10
|
+
)
|
11
|
+
rescue Mollie::Exception => e
|
12
|
+
puts 'An error has occurred: ' << e.message
|
13
|
+
end
|