mollie-api-ruby 4.10.0 → 4.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/examples/organisations/get-partner.rb +1 -0
- data/lib/mollie/partner.rb +52 -0
- data/lib/mollie/version.rb +1 -1
- data/lib/mollie.rb +1 -0
- data/test/fixtures/organizations/partner.json +26 -0
- data/test/mollie/partner_test.rb +47 -0
- metadata +7 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3771f281c214f0e44afd28c576b79c25aaddb41e8cbb0bb660a17a5ce0381e7e
|
4
|
+
data.tar.gz: 958f0d36aae881909578c746b936f16dbf67a94ae3a7f8d79113f2e9d026b8cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 223833841d3d5c122a81df8985f456a447d5ed1bee91e8daea7b1ffda1ba4c50ec73254dbead5c6efd444e091b9e18038985fb3a3559d1ab33bb8ee665025901
|
7
|
+
data.tar.gz: e57c84fb83b53b0c6ac59dfecc7fbb407f4c33fd84c9c5110e68ac8e381c42eb346f027123554a85d5d8f927178976a872efc0b9005a02b7a808811da687dc54
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@
|
|
4
4
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
6
6
|
|
7
|
+
## 4.11.0 - 2022-03-01
|
8
|
+
|
9
|
+
- (1ef339e) Add Partner API
|
10
|
+
|
7
11
|
## 4.10.0 - 2021-11-20
|
8
12
|
|
9
13
|
:warning: The `Profile#category_code` attribute is deprecated and will be removed in 2022. Please use the `business_category` parameter instead.
|
@@ -0,0 +1 @@
|
|
1
|
+
partner = Mollie::Partner.current
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Mollie
|
2
|
+
class Partner < Base
|
3
|
+
attr_accessor :partner_type,
|
4
|
+
:is_commission_partner,
|
5
|
+
:partner_contract_signed_at,
|
6
|
+
:partner_contract_update_available,
|
7
|
+
:_links
|
8
|
+
|
9
|
+
attr_reader :user_agent_tokens
|
10
|
+
|
11
|
+
alias links _links
|
12
|
+
|
13
|
+
def self.current(options = {})
|
14
|
+
response = Client.instance.perform_http_call('GET', 'organizations/me/partner', nil, {}, options)
|
15
|
+
new(response)
|
16
|
+
end
|
17
|
+
|
18
|
+
def type
|
19
|
+
partner_type
|
20
|
+
end
|
21
|
+
|
22
|
+
def commission_partner?
|
23
|
+
is_commission_partner
|
24
|
+
end
|
25
|
+
|
26
|
+
def contract_signed_at
|
27
|
+
@contract_signed_at = begin
|
28
|
+
Time.parse(partner_contract_signed_at)
|
29
|
+
rescue StandardError
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def contract_update_available?
|
35
|
+
partner_contract_update_available
|
36
|
+
end
|
37
|
+
|
38
|
+
def user_agent_tokens=(tokens)
|
39
|
+
@user_agent_tokens = tokens.map do |token|
|
40
|
+
OpenStruct.new(
|
41
|
+
token: token['token'],
|
42
|
+
starts_at: Time.parse(token['starts_at']),
|
43
|
+
ends_at: (Time.parse(token['ends_at']) unless token['ends_at'].nil?)
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def signuplink
|
49
|
+
Util.extract_url(links, 'signuplink')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/mollie/version.rb
CHANGED
data/lib/mollie.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"resource": "partner",
|
3
|
+
"partnerType": "signuplink",
|
4
|
+
"isCommissionPartner": true,
|
5
|
+
"userAgentTokens": [{
|
6
|
+
"token": "unique-token",
|
7
|
+
"startsAt": "2018-03-20T13:13:37+00:00",
|
8
|
+
"endsAt": null
|
9
|
+
}],
|
10
|
+
"partnerContractSignedAt": "2018-03-20T13:13:37+00:00",
|
11
|
+
"partnerContractUpdateAvailable": true,
|
12
|
+
"_links": {
|
13
|
+
"self": {
|
14
|
+
"href": "https://api.mollie.com/v2/organizations/me/partner",
|
15
|
+
"type": "application/hal+json"
|
16
|
+
},
|
17
|
+
"documentation": {
|
18
|
+
"href": "https://docs.mollie.com/reference/v2/organizations-api/get-partner",
|
19
|
+
"type": "text/html"
|
20
|
+
},
|
21
|
+
"signuplink": {
|
22
|
+
"href": "https://www.mollie.com/dashboard/signup/myCode?lang=en",
|
23
|
+
"type": "text/html"
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
module Mollie
|
4
|
+
class PartnerTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
stub_request(:get, 'https://api.mollie.com/v2/organizations/me/partner')
|
7
|
+
.to_return(status: 200, body: read_fixture('organizations/partner.json'), headers: {})
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_class_type
|
11
|
+
partner = Partner.current
|
12
|
+
assert_equal Mollie::Partner, partner.class
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_partner_type
|
16
|
+
partner = Partner.current
|
17
|
+
assert_equal 'signuplink', partner.type
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_commision_partner
|
21
|
+
partner = Partner.current
|
22
|
+
assert partner.commission_partner?
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_contract_signed_at
|
26
|
+
partner = Partner.current
|
27
|
+
assert_equal Time.parse('2018-03-20T13:13:37+00:00'), partner.contract_signed_at
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_contract_update_available?
|
31
|
+
partner = Partner.current
|
32
|
+
assert partner.contract_update_available?
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_signuplink
|
36
|
+
partner = Partner.current
|
37
|
+
assert_equal 'https://www.mollie.com/dashboard/signup/myCode?lang=en', partner.signuplink
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_user_agent_tokens
|
41
|
+
token = Partner.current.user_agent_tokens.first
|
42
|
+
assert_equal 'unique-token', token.token
|
43
|
+
assert_equal Time.parse('2018-03-20T13:13:37+00:00'), token.starts_at
|
44
|
+
assert_nil nil, token.ends_at
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mollie-api-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mollie B.V.
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- examples/orders/update-orderline.rb
|
132
132
|
- examples/orders/update.rb
|
133
133
|
- examples/organisations/get-current.rb
|
134
|
+
- examples/organisations/get-partner.rb
|
134
135
|
- examples/organisations/get.rb
|
135
136
|
- examples/payments/create.rb
|
136
137
|
- examples/payments/delete.rb
|
@@ -200,6 +201,7 @@ files:
|
|
200
201
|
- lib/mollie/order/refund.rb
|
201
202
|
- lib/mollie/order/shipment.rb
|
202
203
|
- lib/mollie/organization.rb
|
204
|
+
- lib/mollie/partner.rb
|
203
205
|
- lib/mollie/payment.rb
|
204
206
|
- lib/mollie/payment/capture.rb
|
205
207
|
- lib/mollie/payment/chargeback.rb
|
@@ -238,6 +240,7 @@ files:
|
|
238
240
|
- test/fixtures/orders/refund_all.json
|
239
241
|
- test/fixtures/orders/update.json
|
240
242
|
- test/fixtures/orders/update_line.json
|
243
|
+
- test/fixtures/organizations/partner.json
|
241
244
|
- test/fixtures/payments/get.json
|
242
245
|
- test/fixtures/refunds/get.json
|
243
246
|
- test/fixtures/shipments/create.json
|
@@ -264,6 +267,7 @@ files:
|
|
264
267
|
- test/mollie/order/shipment_test.rb
|
265
268
|
- test/mollie/order_test.rb
|
266
269
|
- test/mollie/organization_test.rb
|
270
|
+
- test/mollie/partner_test.rb
|
267
271
|
- test/mollie/payment/capture_test.rb
|
268
272
|
- test/mollie/payment/chargeback_test.rb
|
269
273
|
- test/mollie/payment/refund_test.rb
|
@@ -323,6 +327,7 @@ test_files:
|
|
323
327
|
- test/fixtures/orders/refund_all.json
|
324
328
|
- test/fixtures/orders/update.json
|
325
329
|
- test/fixtures/orders/update_line.json
|
330
|
+
- test/fixtures/organizations/partner.json
|
326
331
|
- test/fixtures/payments/get.json
|
327
332
|
- test/fixtures/refunds/get.json
|
328
333
|
- test/fixtures/shipments/create.json
|
@@ -349,6 +354,7 @@ test_files:
|
|
349
354
|
- test/mollie/order/shipment_test.rb
|
350
355
|
- test/mollie/order_test.rb
|
351
356
|
- test/mollie/organization_test.rb
|
357
|
+
- test/mollie/partner_test.rb
|
352
358
|
- test/mollie/payment/capture_test.rb
|
353
359
|
- test/mollie/payment/chargeback_test.rb
|
354
360
|
- test/mollie/payment/refund_test.rb
|