mollie-api-ruby 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +15 -2
  4. data/examples/apis/api_docs.rb +37 -0
  5. data/examples/apis/connect.rb +58 -0
  6. data/examples/apis/customers.rb +115 -0
  7. data/examples/apis/invoices.rb +38 -0
  8. data/examples/apis/issuers.rb +35 -0
  9. data/examples/apis/mandates.rb +83 -0
  10. data/examples/apis/methods.rb +50 -0
  11. data/examples/apis/organizations.rb +16 -0
  12. data/examples/apis/payments.rb +140 -0
  13. data/examples/apis/permissions.rb +32 -0
  14. data/examples/apis/profiles.rb +126 -0
  15. data/examples/apis/refunds.rb +17 -0
  16. data/examples/apis/settlements.rb +84 -0
  17. data/examples/apis/subscriptions.rb +165 -0
  18. data/examples/config.ru +58 -0
  19. data/examples/public/images/collapse.gif +0 -0
  20. data/examples/public/images/expand.gif +0 -0
  21. data/examples/public/images/explorer_icons.png +0 -0
  22. data/examples/public/images/favicon-16x16.png +0 -0
  23. data/examples/public/images/favicon-32x32.png +0 -0
  24. data/examples/public/images/favicon.ico +0 -0
  25. data/examples/public/images/logo_small.png +0 -0
  26. data/examples/public/images/pet_store_api.png +0 -0
  27. data/examples/public/images/throbber.gif +0 -0
  28. data/examples/public/images/wordnik_api.png +0 -0
  29. data/examples/public/index.html +101 -0
  30. data/examples/public/javascripts/lib/backbone-min.js +1 -0
  31. data/examples/public/javascripts/lib/es5-shim.js +1 -0
  32. data/examples/public/javascripts/lib/handlebars-4.0.5.js +3 -0
  33. data/examples/public/javascripts/lib/highlight.9.1.0.pack.js +1 -0
  34. data/examples/public/javascripts/lib/highlight.9.1.0.pack_extended.js +1 -0
  35. data/examples/public/javascripts/lib/jquery-1.8.0.min.js +3 -0
  36. data/examples/public/javascripts/lib/jquery.ba-bbq.min.js +1 -0
  37. data/examples/public/javascripts/lib/jquery.slideto.min.js +1 -0
  38. data/examples/public/javascripts/lib/jquery.wiggle.min.js +1 -0
  39. data/examples/public/javascripts/lib/js-yaml.min.js +2 -0
  40. data/examples/public/javascripts/lib/jsoneditor.min.js +5 -0
  41. data/examples/public/javascripts/lib/lodash.min.js +2 -0
  42. data/examples/public/javascripts/lib/marked.js +1 -0
  43. data/examples/public/javascripts/lib/object-assign-pollyfill.js +1 -0
  44. data/examples/public/javascripts/lib/sanitize-html.min.js +4 -0
  45. data/examples/public/javascripts/lib/swagger-oauth.js +1 -0
  46. data/examples/public/javascripts/swagger-ui.js +25378 -0
  47. data/examples/public/javascripts/swagger-ui.min.js +15 -0
  48. data/examples/public/javascripts/swagger_docs.js +14 -0
  49. data/examples/public/o2c.html +20 -0
  50. data/examples/public/stylesheets/reset.css +1 -0
  51. data/examples/public/stylesheets/screen.css +1545 -0
  52. data/examples/public/stylesheets/swagger_docs.css +4 -0
  53. data/examples/public/stylesheets/typography.css +0 -0
  54. data/lib/mollie/api/client.rb +42 -22
  55. data/lib/mollie/api/client/version.rb +1 -1
  56. data/lib/mollie/api/object/invoice.rb +70 -0
  57. data/lib/mollie/api/object/method.rb +1 -0
  58. data/lib/mollie/api/object/organization.rb +1 -1
  59. data/lib/mollie/api/object/payment.rb +21 -7
  60. data/lib/mollie/api/object/payment/refund.rb +5 -1
  61. data/lib/mollie/api/resource/base.rb +6 -6
  62. data/lib/mollie/api/resource/invoices.rb +11 -0
  63. data/lib/mollie/api/resource/permissions.rb +20 -0
  64. data/lib/mollie/api/resource/profiles/apikeys.rb +6 -0
  65. data/lib/mollie/api/resource/refunds.rb +11 -0
  66. data/lib/mollie/api/resource/settlements.rb +8 -0
  67. data/lib/mollie/api/resource/settlements/payments.rb +27 -0
  68. data/mollie.gemspec +7 -0
  69. data/test/mollie/api/client_test.rb +12 -5
  70. data/test/mollie/api/object/invoice_test.rb +59 -0
  71. data/test/mollie/api/object/organization_test.rb +0 -6
  72. data/test/mollie/api/object/payment_test.rb +15 -0
  73. data/test/mollie/api/resource/invoices_test.rb +13 -0
  74. metadata +159 -12
  75. data/examples/1-new-payment.rb +0 -56
  76. data/examples/2-webhook-verification.rb +0 -41
  77. data/examples/3-return-page.rb +0 -21
  78. data/examples/4-ideal-payment.rb +0 -79
  79. data/examples/5-payments-history.rb +0 -27
  80. data/examples/6-list-activated-methods.rb +0 -30
  81. data/examples/7-refund-payment.rb +0 -40
  82. data/examples/app.rb +0 -58
  83. data/examples/orders/.gitignore +0 -1
@@ -33,14 +33,21 @@ module Mollie
33
33
 
34
34
  def test_perform_http_call_defaults
35
35
  stub_request(:any, "https://api.mollie.nl/v1/my-method")
36
- .with(:headers => { 'Accept' => 'application/json',
37
- 'Authorization' => 'Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM',
38
- 'User-Agent' => /^Mollie\/#{Mollie::API::Client::VERSION} Ruby\/#{RUBY_VERSION} OpenSSL\/.*$/ })
36
+ .with(:headers => { 'Accept' => 'application/json',
37
+ 'Content-type' => 'application/json',
38
+ 'Authorization' => 'Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM',
39
+ 'User-Agent' => /^Mollie\/#{Mollie::API::Client::VERSION} Ruby\/#{RUBY_VERSION} OpenSSL\/.*$/ })
39
40
  .to_return(:status => 200, :body => "{}", :headers => {})
40
41
  client.perform_http_call("GET", "my-method", nil, {})
41
42
  end
42
43
 
43
- def test_get_requests_convert_to_snake_case
44
+ def test_get_request_convert_to_camel_case
45
+ stub_request(:get, "https://api.mollie.nl/v1/my-method?myParam=ok")
46
+ .to_return(:status => 200, :body => "{}", :headers => {})
47
+ client.perform_http_call("GET", "my-method", nil, {}, {my_param: "ok"})
48
+ end
49
+
50
+ def test_get_response_convert_to_snake_case
44
51
  response_body = <<-JSON
45
52
  {
46
53
  "someCamelCased" : {
@@ -91,7 +98,7 @@ module Mollie
91
98
  {"error": {"message": "Error on field", "field": "my-field"}}
92
99
  JSON
93
100
  stub_request(:post, "https://api.mollie.nl/v1/my-method")
94
- .to_return(:status => 500, :body => response, :headers => {})
101
+ .to_return(:status => 500, :body => response, :headers => {})
95
102
 
96
103
  e = assert_raise Mollie::API::Exception.new("Error on field") do
97
104
  client.perform_http_call("POST", "my-method", nil, {})
@@ -0,0 +1,59 @@
1
+ require 'helper'
2
+
3
+ module Mollie
4
+ module API
5
+ module Object
6
+ class InvoiceTest < Test::Unit::TestCase
7
+ def test_setting_attributes
8
+ attributes = {
9
+ resource: "invoice",
10
+ id: "inv_xBEbP9rvAq",
11
+ reference: "2016.10000",
12
+ vat_number: "NL001234567B01",
13
+ status: "open",
14
+ issue_date: "2016-08-31",
15
+ due_date: "2016-09-14",
16
+ amount: {
17
+ net: "45.00",
18
+ vat: "9.45",
19
+ gross: "54.45"
20
+ },
21
+ lines: [{
22
+ period: "2016-09",
23
+ description: "iDEAL transactiekosten",
24
+ count: 100,
25
+ vat_percentage: 21,
26
+ amount: "45.00"
27
+ }],
28
+ links: {
29
+ 'pdf' => "https://www.mollie.com/beheer/facturen/2016.10000/52981a39788e5e0acaf71bbf570e941f/"
30
+ }
31
+ }
32
+
33
+ invoice = Invoice.new(attributes)
34
+
35
+ assert_equal "invoice", invoice.resource
36
+ assert_equal "inv_xBEbP9rvAq", invoice.id
37
+ assert_equal "2016.10000", invoice.reference
38
+ assert_equal "NL001234567B01", invoice.vat_number
39
+ assert_equal "open", invoice.status
40
+ assert_equal Time.parse("2016-08-31"), invoice.issue_date
41
+ assert_equal Time.parse("2016-09-14"), invoice.due_date
42
+ assert_equal 45.0, invoice.amount.net
43
+ assert_equal BigDecimal.new(9.45, 3), invoice.amount.vat
44
+ assert_equal 54.45, invoice.amount.gross
45
+
46
+ line = invoice.lines.first
47
+ assert_equal "2016-09", line.period
48
+ assert_equal "iDEAL transactiekosten", line.description
49
+ assert_equal 100, line.count
50
+ assert_equal 21, line.vat_percentage
51
+ assert_equal 45.0, line.amount
52
+
53
+
54
+ assert_equal "https://www.mollie.com/beheer/facturen/2016.10000/52981a39788e5e0acaf71bbf570e941f/", invoice.pdf
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -36,12 +36,6 @@ module Mollie
36
36
  assert_equal Time.parse('2007-06-29T09:41:00.0Z'), organization.verified_datetime
37
37
  end
38
38
 
39
- def test_registration_datetime_required
40
- assert_raise ArgumentError.new('no time information in ""') do
41
- Organization.new(registration_datetime: nil)
42
- end
43
- end
44
-
45
39
  def test_verified_datetime_optional
46
40
  assert_equal nil, Organization.new(verified_datetime: nil).verified_datetime
47
41
  end
@@ -85,6 +85,21 @@ module Mollie
85
85
  assert Payment.new(paid_datetime: Time.now).paid?
86
86
  assert !Payment.new(paid_datetime: nil).paid?
87
87
  end
88
+
89
+ def test_status_failed
90
+ assert Payment.new(status: Payment::STATUS_FAILED).failed?
91
+ assert !Payment.new(status: 'not-failed').failed?
92
+ end
93
+
94
+ def test_status_pending
95
+ assert Payment.new(status: Payment::STATUS_PENDING).pending?
96
+ assert !Payment.new(status: 'not-pending').pending?
97
+ end
98
+
99
+ def test_status_charged_back
100
+ assert Payment.new(status: Payment::STATUS_CHARGED_BACK).charged_back?
101
+ assert !Payment.new(status: 'not-charged-back').charged_back?
102
+ end
88
103
  end
89
104
  end
90
105
  end
@@ -0,0 +1,13 @@
1
+ require 'helper'
2
+
3
+ module Mollie
4
+ module API
5
+ module Resource
6
+ class InvoicesTest < Test::Unit::TestCase
7
+ def test_resource_object
8
+ assert_equal Object::Invoice, Invoices.new(nil).resource_object
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mollie-api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mollie B.V.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-21 00:00:00.000000000 Z
11
+ date: 2017-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -52,6 +52,104 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thin
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sinatra
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sinatra-contrib
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sinatra-cross_origin
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rack-oauth2
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: swagger-blocks
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: ngrok-tunnel
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
55
153
  description: |-
56
154
  Accepting iDEAL, Bancontact/Mister Cash, SOFORT Banking,
57
155
  Creditcard, SEPA Bank transfer, SEPA Direct debit, Bitcoin,
@@ -71,15 +169,56 @@ files:
71
169
  - LICENSE
72
170
  - README.md
73
171
  - Rakefile
74
- - examples/1-new-payment.rb
75
- - examples/2-webhook-verification.rb
76
- - examples/3-return-page.rb
77
- - examples/4-ideal-payment.rb
78
- - examples/5-payments-history.rb
79
- - examples/6-list-activated-methods.rb
80
- - examples/7-refund-payment.rb
81
- - examples/app.rb
82
- - examples/orders/.gitignore
172
+ - examples/apis/api_docs.rb
173
+ - examples/apis/connect.rb
174
+ - examples/apis/customers.rb
175
+ - examples/apis/invoices.rb
176
+ - examples/apis/issuers.rb
177
+ - examples/apis/mandates.rb
178
+ - examples/apis/methods.rb
179
+ - examples/apis/organizations.rb
180
+ - examples/apis/payments.rb
181
+ - examples/apis/permissions.rb
182
+ - examples/apis/profiles.rb
183
+ - examples/apis/refunds.rb
184
+ - examples/apis/settlements.rb
185
+ - examples/apis/subscriptions.rb
186
+ - examples/config.ru
187
+ - examples/public/images/collapse.gif
188
+ - examples/public/images/expand.gif
189
+ - examples/public/images/explorer_icons.png
190
+ - examples/public/images/favicon-16x16.png
191
+ - examples/public/images/favicon-32x32.png
192
+ - examples/public/images/favicon.ico
193
+ - examples/public/images/logo_small.png
194
+ - examples/public/images/pet_store_api.png
195
+ - examples/public/images/throbber.gif
196
+ - examples/public/images/wordnik_api.png
197
+ - examples/public/index.html
198
+ - examples/public/javascripts/lib/backbone-min.js
199
+ - examples/public/javascripts/lib/es5-shim.js
200
+ - examples/public/javascripts/lib/handlebars-4.0.5.js
201
+ - examples/public/javascripts/lib/highlight.9.1.0.pack.js
202
+ - examples/public/javascripts/lib/highlight.9.1.0.pack_extended.js
203
+ - examples/public/javascripts/lib/jquery-1.8.0.min.js
204
+ - examples/public/javascripts/lib/jquery.ba-bbq.min.js
205
+ - examples/public/javascripts/lib/jquery.slideto.min.js
206
+ - examples/public/javascripts/lib/jquery.wiggle.min.js
207
+ - examples/public/javascripts/lib/js-yaml.min.js
208
+ - examples/public/javascripts/lib/jsoneditor.min.js
209
+ - examples/public/javascripts/lib/lodash.min.js
210
+ - examples/public/javascripts/lib/marked.js
211
+ - examples/public/javascripts/lib/object-assign-pollyfill.js
212
+ - examples/public/javascripts/lib/sanitize-html.min.js
213
+ - examples/public/javascripts/lib/swagger-oauth.js
214
+ - examples/public/javascripts/swagger-ui.js
215
+ - examples/public/javascripts/swagger-ui.min.js
216
+ - examples/public/javascripts/swagger_docs.js
217
+ - examples/public/o2c.html
218
+ - examples/public/stylesheets/reset.css
219
+ - examples/public/stylesheets/screen.css
220
+ - examples/public/stylesheets/swagger_docs.css
221
+ - examples/public/stylesheets/typography.css
83
222
  - lib/mollie/api/cacert.pem
84
223
  - lib/mollie/api/client.rb
85
224
  - lib/mollie/api/client/version.rb
@@ -88,6 +227,7 @@ files:
88
227
  - lib/mollie/api/object/customer.rb
89
228
  - lib/mollie/api/object/customer/mandate.rb
90
229
  - lib/mollie/api/object/customer/subscription.rb
230
+ - lib/mollie/api/object/invoice.rb
91
231
  - lib/mollie/api/object/issuer.rb
92
232
  - lib/mollie/api/object/list.rb
93
233
  - lib/mollie/api/object/method.rb
@@ -103,6 +243,7 @@ files:
103
243
  - lib/mollie/api/resource/customers/mandates.rb
104
244
  - lib/mollie/api/resource/customers/payments.rb
105
245
  - lib/mollie/api/resource/customers/subscriptions.rb
246
+ - lib/mollie/api/resource/invoices.rb
106
247
  - lib/mollie/api/resource/issuers.rb
107
248
  - lib/mollie/api/resource/methods.rb
108
249
  - lib/mollie/api/resource/organizations.rb
@@ -111,7 +252,9 @@ files:
111
252
  - lib/mollie/api/resource/permissions.rb
112
253
  - lib/mollie/api/resource/profiles.rb
113
254
  - lib/mollie/api/resource/profiles/apikeys.rb
255
+ - lib/mollie/api/resource/refunds.rb
114
256
  - lib/mollie/api/resource/settlements.rb
257
+ - lib/mollie/api/resource/settlements/payments.rb
115
258
  - lib/mollie/api/util.rb
116
259
  - mollie.gemspec
117
260
  - test/helper.rb
@@ -120,6 +263,7 @@ files:
120
263
  - test/mollie/api/object/customer/mandate_test.rb
121
264
  - test/mollie/api/object/customer/subscription_test.rb
122
265
  - test/mollie/api/object/customer_test.rb
266
+ - test/mollie/api/object/invoice_test.rb
123
267
  - test/mollie/api/object/issuer_test.rb
124
268
  - test/mollie/api/object/list_test.rb
125
269
  - test/mollie/api/object/method_test.rb
@@ -135,6 +279,7 @@ files:
135
279
  - test/mollie/api/resource/customers/payments_test.rb
136
280
  - test/mollie/api/resource/customers/subscriptions_test.rb
137
281
  - test/mollie/api/resource/customers_test.rb
282
+ - test/mollie/api/resource/invoices_test.rb
138
283
  - test/mollie/api/resource/issuers_test.rb
139
284
  - test/mollie/api/resource/methods_test.rb
140
285
  - test/mollie/api/resource/organizations_test.rb
@@ -166,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
311
  version: '0'
167
312
  requirements: []
168
313
  rubyforge_project:
169
- rubygems_version: 2.2.2
314
+ rubygems_version: 2.4.8
170
315
  signing_key:
171
316
  specification_version: 4
172
317
  summary: Official Mollie API Client for Ruby
@@ -177,6 +322,7 @@ test_files:
177
322
  - test/mollie/api/object/customer/mandate_test.rb
178
323
  - test/mollie/api/object/customer/subscription_test.rb
179
324
  - test/mollie/api/object/customer_test.rb
325
+ - test/mollie/api/object/invoice_test.rb
180
326
  - test/mollie/api/object/issuer_test.rb
181
327
  - test/mollie/api/object/list_test.rb
182
328
  - test/mollie/api/object/method_test.rb
@@ -192,6 +338,7 @@ test_files:
192
338
  - test/mollie/api/resource/customers/payments_test.rb
193
339
  - test/mollie/api/resource/customers/subscriptions_test.rb
194
340
  - test/mollie/api/resource/customers_test.rb
341
+ - test/mollie/api/resource/invoices_test.rb
195
342
  - test/mollie/api/resource/issuers_test.rb
196
343
  - test/mollie/api/resource/methods_test.rb
197
344
  - test/mollie/api/resource/organizations_test.rb
@@ -1,56 +0,0 @@
1
- #
2
- # Example 1 - How to prepare a new payment with the Mollie API.
3
- #
4
- require File.expand_path "../lib/mollie/api/client", File.dirname(__FILE__)
5
-
6
- begin
7
- #
8
- # Initialize the Mollie API library with your API key.
9
- #
10
- # See: https://www.mollie.nl/beheer/account/profielen/
11
- #
12
- mollie = Mollie::API::Client.new
13
- mollie.api_key = "test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM"
14
-
15
- #
16
- # Generate a unique order id for this example. It is important to include this unique attribute
17
- # in the redirectUrl (below) so a proper return page can be shown to the customer.
18
- #
19
- order_id = Time.now.to_i
20
-
21
- #
22
- # Determine the url parts to these example files.
23
- #
24
- protocol = $request.secure? && "https" || "http"
25
- hostname = $request.host || "localhost"
26
- port = $request.port || 80
27
- path = $request.script_name || ""
28
-
29
- #
30
- # Payment parameters:
31
- # amount Amount in EUROs. This example creates a € 10,- payment.
32
- # description Description of the payment.
33
- # redirect_url Redirect location. The customer will be redirected there after the payment.
34
- # webhook_url Webhook location, used to report when the payment changes state.
35
- # metadata Custom metadata that is stored with the payment.
36
- #
37
- payment = mollie.payments.create \
38
- :amount => 10.00,
39
- :description => "My first API payment",
40
- :redirect_url => "#{protocol}://#{hostname}:#{port}#{path}/3-return-page?order_id=#{order_id}",
41
- :webhook_url => "#{protocol}://#{hostname}:#{port}#{path}/2-webhook-verification",
42
- :metadata => {
43
- :order_id => order_id
44
- }
45
- #
46
- # In this example we store the order with its payment status in a database.
47
- #
48
- database_write order_id, payment.status
49
-
50
- #
51
- # Send the customer off to complete the payment.
52
- #
53
- $response.redirect payment.payment_url
54
- rescue Mollie::API::Exception => e
55
- $response.body << "API call failed: " << (CGI.escapeHTML e.message)
56
- end