mollie-api-ruby 4.5.0 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 077c3341a3246c466e7d7d62d32bd68da1957af6c3c646fdaffcda51697efb68
4
- data.tar.gz: b5731818494fb85b6c4c088ea1e4bbfa1d0ecbd9ed3e56d41d5736c3af2d5e11
3
+ metadata.gz: a164bb83c73b590aea58762c39d6ec62a24316b606bd80ca94ddcd2203665015
4
+ data.tar.gz: 8524375f756099e76f1f5b68d6d5761808040fbb3a7c25354e457e09822f71e8
5
5
  SHA512:
6
- metadata.gz: 9498ca7ba156382ad00369ccff33e40018580cd73ba5bfc5a3922262c2627bef527f61532f0f05b35e87c260e5177d297376b5fca96873fbe83605d632808c26
7
- data.tar.gz: e5bd2c61d222ba1f13de30565977fd2d40a08f165eebbb45b8890fff5b76d19c3741ecb00dac98740215e9576bc9a80b78d2357ff4393e4034699e2ab4d29bef
6
+ metadata.gz: c269f9f2f4dca464de98383145b1e80fe9dea93093b7204c0163dadacde28e5d8707c486b904ba2f7b7b7dfe4a9f0992038c134f6fe040e0a8303daae7787b5e
7
+ data.tar.gz: 7c96434960a02ecad76f76d404ae64404c39b20aefa144950d73d844f69241744bc6b41e67cdf2c6c4afa8a7c9ebe42c4f4daa42586bca5cb0a0cebf497f6a75
@@ -4,6 +4,14 @@
4
4
 
5
5
  All notable changes to this project will be documented in this file.
6
6
 
7
+ ## 4.6.0 - 2019-10-01
8
+
9
+ - Add Onboarding APIs (Get onboarding status, Submit onboarding data)
10
+
11
+ ## 4.5.0 - 2019-09-16
12
+
13
+ - Add helper method to retrieve payments for subscription.
14
+
7
15
  ## 4.4.1 - 2019-08-12
8
16
 
9
17
  - Payment: Require customer_id when retrieving a mandate.
@@ -0,0 +1 @@
1
+ Mollie::Onboarding.me
@@ -0,0 +1,20 @@
1
+ Mollie::Onboarding.submit(
2
+ organization: {
3
+ name: "Mollie B.V.",
4
+ address: {
5
+ streetAndNumber: "Keizersgracht 313",
6
+ postalCode: "1018 EE",
7
+ city: "Amsterdam",
8
+ country: "NL"
9
+ },
10
+ registrationNumber: "30204462",
11
+ vatNumber: "NL815839091B01"
12
+ },
13
+ profile: {
14
+ name: "Mollie",
15
+ url: "https://www.mollie.com",
16
+ email: "info@mollie.com",
17
+ phone: "+31208202070",
18
+ categoryCode: 6012
19
+ }
20
+ )
@@ -30,6 +30,7 @@ require 'mollie/refund'
30
30
  require 'mollie/settlement'
31
31
 
32
32
  require 'mollie/customer/payment'
33
+ require 'mollie/onboarding'
33
34
  require 'mollie/order/line'
34
35
  require 'mollie/order/refund'
35
36
  require 'mollie/order/shipment'
@@ -0,0 +1,36 @@
1
+ module Mollie
2
+ class Onboarding < Base
3
+ attr_accessor :name,
4
+ :signed_up_at,
5
+ :status,
6
+ :can_receive_payments,
7
+ :can_receive_settlements,
8
+ :_links
9
+
10
+ alias links _links
11
+
12
+ def self.me(options = {})
13
+ response = Client.instance.perform_http_call('GET', 'onboarding', 'me', {}, options)
14
+ new(response)
15
+ end
16
+
17
+ def self.submit(data = {}, options = {})
18
+ Client.instance.perform_http_call('POST', 'onboarding', 'me', data, options)
19
+ nil
20
+ end
21
+
22
+ def dashboard
23
+ Util.extract_url(links, 'onboarding')
24
+ end
25
+
26
+ def organization(options = {})
27
+ resource_url = Util.extract_url(links, 'organization')
28
+ response = Client.instance.perform_http_call('GET', resource_url, nil, {}, options)
29
+ Organization.new(response)
30
+ end
31
+
32
+ def signed_up_at=(signed_up_at)
33
+ @signed_up_at = Time.parse(signed_up_at.to_s)
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module Mollie
2
- VERSION = '4.5.0'.freeze
2
+ VERSION = '4.6.0'.freeze
3
3
  end
@@ -0,0 +1,26 @@
1
+ {
2
+ "resource": "onboarding",
3
+ "name": "Mollie B.V.",
4
+ "signedUpAt": "2018-12-20T10:49:08+00:00",
5
+ "status": "completed",
6
+ "canReceivePayments": true,
7
+ "canReceiveSettlements": true,
8
+ "_links": {
9
+ "self": {
10
+ "href": "https://api.mollie.com/v2/onboarding/me",
11
+ "type": "application/hal+json"
12
+ },
13
+ "onboarding": {
14
+ "href": "https://www.mollie.com/dashboard/onboarding",
15
+ "type": "text/html"
16
+ },
17
+ "organization": {
18
+ "href": "https://api.mollie.com/v2/organization/org_12345",
19
+ "type": "application/hal+json"
20
+ },
21
+ "documentation": {
22
+ "href": "https://docs.mollie.com/reference/v2/onboarding-api/get-onboarding-status",
23
+ "type": "text/html"
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "organization": {
3
+ "name": "Mollie B.V.",
4
+ "address": {
5
+ "streetAndNumber": "Keizersgracht 313",
6
+ "postalCode": "1018 EE",
7
+ "city": "Amsterdam",
8
+ "country": "NL"
9
+ },
10
+ "registrationNumber": "30204462",
11
+ "vatNumber": "NL815839091B01"
12
+ },
13
+ "profile": {
14
+ "name": "Mollie",
15
+ "url": "https://www.mollie.com",
16
+ "email": "info@mollie.com",
17
+ "phone": "+31208202070",
18
+ "categoryCode": 6012
19
+ }
20
+ }
@@ -0,0 +1,59 @@
1
+ require 'helper'
2
+
3
+ module Mollie
4
+ class OnboardingTest < Test::Unit::TestCase
5
+ def test_get_onboarding
6
+ stub_request(:get, 'https://api.mollie.com/v2/onboarding/me')
7
+ .to_return(status: 200, body: read_fixture('onboarding/me.json'), headers: {})
8
+
9
+ onboarding = Onboarding.me
10
+ assert_equal 'Mollie B.V.', onboarding.name
11
+ assert_equal 'completed', onboarding.status
12
+ assert_equal true, onboarding.can_receive_payments
13
+ assert_equal true, onboarding.can_receive_settlements
14
+ assert_equal Time.parse('2018-12-20T10:49:08+00:00'), onboarding.signed_up_at
15
+ assert_equal 'https://www.mollie.com/dashboard/onboarding', onboarding.dashboard
16
+ end
17
+
18
+ def test_submit_onboarding_data
19
+ minified_body = JSON.parse(read_fixture('onboarding/submit.json')).to_json
20
+
21
+ stub_request(:post, 'https://api.mollie.com/v2/onboarding/me')
22
+ .with(body: minified_body).to_return(status: 204)
23
+
24
+ assert_nil Onboarding.submit(
25
+ organization: {
26
+ name: "Mollie B.V.",
27
+ address: {
28
+ streetAndNumber: "Keizersgracht 313",
29
+ postalCode: "1018 EE",
30
+ city: "Amsterdam",
31
+ country: "NL"
32
+ },
33
+ registrationNumber: "30204462",
34
+ vatNumber: "NL815839091B01"
35
+ },
36
+ profile: {
37
+ name: "Mollie",
38
+ url: "https://www.mollie.com",
39
+ email: "info@mollie.com",
40
+ phone: "+31208202070",
41
+ categoryCode: 6012
42
+ }
43
+ )
44
+ end
45
+
46
+ def test_get_organization
47
+ stub_request(:get, 'https://api.mollie.com/v2/onboarding/me')
48
+ .to_return(status: 200, body: read_fixture('onboarding/me.json'), headers: {})
49
+
50
+ stub_request(:get, 'https://api.mollie.com/v2/organization/org_12345')
51
+ .to_return(status: 200, body: %({"id": "org_12345"}), headers: {})
52
+
53
+ onboarding = Onboarding.me
54
+ organization = onboarding.organization
55
+
56
+ assert_equal 'org_12345', organization.id
57
+ end
58
+ end
59
+ 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: 4.5.0
4
+ version: 4.6.0
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: 2019-09-16 00:00:00.000000000 Z
11
+ date: 2019-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -117,6 +117,8 @@ files:
117
117
  - examples/mandates/list.rb
118
118
  - examples/methods/get.rb
119
119
  - examples/methods/list.rb
120
+ - examples/onboarding/get.rb
121
+ - examples/onboarding/submit.rb
120
122
  - examples/orders/cancel-lines.rb
121
123
  - examples/orders/cancel.rb
122
124
  - examples/orders/create-refund.rb
@@ -186,6 +188,7 @@ files:
186
188
  - lib/mollie/invoice.rb
187
189
  - lib/mollie/list.rb
188
190
  - lib/mollie/method.rb
191
+ - lib/mollie/onboarding.rb
189
192
  - lib/mollie/order.rb
190
193
  - lib/mollie/order/line.rb
191
194
  - lib/mollie/order/refund.rb
@@ -207,6 +210,8 @@ files:
207
210
  - mollie-api-ruby.gemspec
208
211
  - test/fixtures/captures/get.json
209
212
  - test/fixtures/captures/list.json
213
+ - test/fixtures/onboarding/me.json
214
+ - test/fixtures/onboarding/submit.json
210
215
  - test/fixtures/orders/cancel_line.json
211
216
  - test/fixtures/orders/cancel_line_qty.json
212
217
  - test/fixtures/orders/create.json
@@ -236,6 +241,7 @@ files:
236
241
  - test/mollie/invoice_test.rb
237
242
  - test/mollie/list_test.rb
238
243
  - test/mollie/method_test.rb
244
+ - test/mollie/onboarding_test.rb
239
245
  - test/mollie/order/line_test.rb
240
246
  - test/mollie/order/shipment_test.rb
241
247
  - test/mollie/order_test.rb
@@ -282,6 +288,8 @@ test_files:
282
288
  - test/fixtures/captures/list.json
283
289
  - test/fixtures/subscriptions/get.json
284
290
  - test/fixtures/subscriptions/get_payments.json
291
+ - test/fixtures/onboarding/submit.json
292
+ - test/fixtures/onboarding/me.json
285
293
  - test/fixtures/shipments/get.json
286
294
  - test/fixtures/shipments/create.json
287
295
  - test/fixtures/shipments/update.json
@@ -306,6 +314,7 @@ test_files:
306
314
  - test/mollie/payment_test.rb
307
315
  - test/mollie/amount_test.rb
308
316
  - test/mollie/refund_test.rb
317
+ - test/mollie/onboarding_test.rb
309
318
  - test/mollie/util_test.rb
310
319
  - test/mollie/settlement_test.rb
311
320
  - test/mollie/payment/refund_test.rb