mangopay 3.28.2 → 3.30.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 +4 -4
- data/CHANGELOG.md +28 -0
- data/lib/mangopay/identity_verification.rb +16 -0
- data/lib/mangopay/legal_user_sca.rb +21 -0
- data/lib/mangopay/natural_user_sca.rb +21 -0
- data/lib/mangopay/user.rb +13 -0
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay.rb +3 -0
- data/spec/mangopay/client_spec.rb +2 -3
- data/spec/mangopay/identity_verification_spec.rb +51 -0
- data/spec/mangopay/kyc_document_spec.rb +2 -3
- data/spec/mangopay/payin_card_web_spec.rb +1 -1
- data/spec/mangopay/shared_resources.rb +132 -0
- data/spec/mangopay/user_spec.rb +134 -0
- data/spec/mangopay/virtual_account_spec.rb +0 -2
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41cd8512992ba0efe6f3d655d36cf1c0239bad606c3c0e68af1879be8d9c2f6e
|
4
|
+
data.tar.gz: 9bc356c880fcacdcee92874c2f78a0cf0085f32bea33555584ebe8c370c2ad3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97e90b8c9806faf4921b44caf5df721ba3dde41db664e1fd838e348d77f7efddf27ea48450f6a8644eef9f1be57032a14979d7c011f34971d529d66210c6d8f6
|
7
|
+
data.tar.gz: d931d1b80c50f2a468c3ca34d292f6d7da2444d9d44b59e82706776f6d13caff0019cfba5526dda333c722ee86f966960be9b135f3ccf20267bba32bb46b5c0d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,31 @@
|
|
1
|
+
## [3.30.0] - 2025-03-24
|
2
|
+
### Added
|
3
|
+
|
4
|
+
New endpoints for [strong customer authentication (SCA)](https://docs.mangopay.com/guides/users/sca) on Owner users:
|
5
|
+
- [POST Create a Natural User (SCA)](https://docs.mangopay.com/api-reference/users/create-natural-user-sca)
|
6
|
+
- [PUT Update a Natural User (SCA)](https://docs.mangopay.com/api-reference/users/update-natural-user-sca)
|
7
|
+
- [POST Create a Legal User (SCA)](https://docs.mangopay.com/api-reference/users/create-legal-user-sca)
|
8
|
+
- [PUT Update a Legal User (SCA)](https://docs.mangopay.com/api-reference/users/update-legal-user-sca)
|
9
|
+
- [PUT Categorize a Natural User (SCA)](https://docs.mangopay.com/api-reference/users/categorize-natural-user)
|
10
|
+
- [PUT Categorize a Legal User (SCA)](https://docs.mangopay.com/api-reference/users/categorize-legal-user)
|
11
|
+
- [POST Enroll a User in SCA](https://docs.mangopay.com/api-reference/users/enroll-user)
|
12
|
+
|
13
|
+
## [3.29.0] - 2025-02-26
|
14
|
+
### Added
|
15
|
+
|
16
|
+
Endpoints and webhooks for [hosted KYC/B solution](https://docs.mangopay.com/guides/users/verification/hosted) (in beta)
|
17
|
+
|
18
|
+
- Endpoints
|
19
|
+
- [Create an IDV Session](https://docs.mangopay.com/api-reference/idv-sessions/create-idv-session)
|
20
|
+
- [View an IDV Session](https://docs.mangopay.com/api-reference/idv-sessions/view-idv-session)
|
21
|
+
- [View Checks for an IDV Session](https://mangopay-idv.mintlify.app/api-reference/idv-sessions/view-idv-session-checks)
|
22
|
+
|
23
|
+
- Event types
|
24
|
+
- `IDENTITY_VERIFICATION_VALIDATED`
|
25
|
+
- `IDENTITY_VERIFICATION_FAILED`
|
26
|
+
- `IDENTITY_VERIFICATION_INCONCLUSIVE`
|
27
|
+
- `IDENTITY_VERIFICATION_OUTDATED`
|
28
|
+
|
1
29
|
## [3.28.2] - 2025-02-13
|
2
30
|
### Updated
|
3
31
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
class IdentityVerification < Resource
|
4
|
+
def self.create(params, user_id, idempotency_key = nil)
|
5
|
+
MangoPay.request(:post, "#{MangoPay.api_path}/users/#{user_id}/identity-verifications", params, {}, idempotency_key)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.get(identity_verification_id, filters = {})
|
9
|
+
MangoPay.request(:get, "#{MangoPay.api_path}/identity-verifications/#{identity_verification_id}", {}, filters)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.get_checks(identity_verification_id, filters = {})
|
13
|
+
MangoPay.request(:get, "#{MangoPay.api_path}/identity-verifications/#{identity_verification_id}/checks", {}, filters)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
# See https://docs.mangopay.com/api-reference/users/legal-user-object-sca
|
4
|
+
class LegalUserSca < User
|
5
|
+
|
6
|
+
def self.url(id = nil)
|
7
|
+
if id
|
8
|
+
"#{MangoPay.api_path}/sca/users/legal/#{CGI.escape(id.to_s)}"
|
9
|
+
else
|
10
|
+
"#{MangoPay.api_path}/sca/users/legal"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def categorize(user_id, params)
|
16
|
+
url = "#{MangoPay.api_path}/sca/users/legal/#{user_id}/category"
|
17
|
+
MangoPay.request(:put, url, params)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
# See https://docs.mangopay.com/api-reference/users/natural-user-object-sca
|
4
|
+
class NaturalUserSca < User
|
5
|
+
|
6
|
+
def self.url(id = nil)
|
7
|
+
if id
|
8
|
+
"#{MangoPay.api_path}/sca/users/natural/#{CGI.escape(id.to_s)}"
|
9
|
+
else
|
10
|
+
"#{MangoPay.api_path}/sca/users/natural"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def categorize(user_id, params)
|
16
|
+
url = "#{MangoPay.api_path}/sca/users/natural/#{user_id}/category"
|
17
|
+
MangoPay.request(:put, url, params)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/mangopay/user.rb
CHANGED
@@ -4,11 +4,19 @@ module MangoPay
|
|
4
4
|
# See also children classes:
|
5
5
|
# - MangoPay::NaturalUser
|
6
6
|
# - MangoPay::LegalUser
|
7
|
+
# - MangoPay::NaturalUserSca
|
8
|
+
# - MangoPay::LegalUserSca
|
7
9
|
class User < Resource
|
8
10
|
include HTTPCalls::Create
|
9
11
|
include HTTPCalls::Update
|
10
12
|
include HTTPCalls::Fetch
|
11
13
|
class << self
|
14
|
+
def enroll_sca(user_id)
|
15
|
+
url = "#{MangoPay.api_path}/sca/users/#{user_id}/enrollment"
|
16
|
+
MangoPay.request(:post, url, {}, {})
|
17
|
+
end
|
18
|
+
|
19
|
+
|
12
20
|
# Fetches list of wallets belonging to the given +user_id+.
|
13
21
|
# Optional +filters+ is a hash accepting following keys:
|
14
22
|
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
@@ -74,6 +82,11 @@ module MangoPay
|
|
74
82
|
def regulatory(user_id, filters = {})
|
75
83
|
MangoPay.request(:get, url(user_id) + '/Regulatory', {}, filters)
|
76
84
|
end
|
85
|
+
|
86
|
+
def fetch_sca(user_id)
|
87
|
+
url = "#{MangoPay.api_path}/sca/users/#{user_id}"
|
88
|
+
MangoPay.request(:get, url, {}, {})
|
89
|
+
end
|
77
90
|
end
|
78
91
|
end
|
79
92
|
end
|
data/lib/mangopay/version.rb
CHANGED
data/lib/mangopay.rb
CHANGED
@@ -19,6 +19,8 @@ module MangoPay
|
|
19
19
|
autoload :Client, 'mangopay/client'
|
20
20
|
autoload :User, 'mangopay/user'
|
21
21
|
autoload :NaturalUser, 'mangopay/natural_user'
|
22
|
+
autoload :NaturalUserSca, 'mangopay/natural_user_sca'
|
23
|
+
autoload :LegalUserSca, 'mangopay/legal_user_sca'
|
22
24
|
autoload :LegalUser, 'mangopay/legal_user'
|
23
25
|
autoload :PayIn, 'mangopay/pay_in'
|
24
26
|
autoload :PayOut, 'mangopay/pay_out'
|
@@ -48,6 +50,7 @@ module MangoPay
|
|
48
50
|
autoload :Conversion, 'mangopay/conversion'
|
49
51
|
autoload :PaymentMethodMetadata, 'mangopay/payment_method_metadata'
|
50
52
|
autoload :VirtualAccount, 'mangopay/virtual_account'
|
53
|
+
autoload :IdentityVerification, 'mangopay/identity_verification'
|
51
54
|
|
52
55
|
# temporary
|
53
56
|
autoload :Temp, 'mangopay/temp'
|
@@ -58,9 +58,8 @@ describe MangoPay::Client do
|
|
58
58
|
file = 'any file content...'
|
59
59
|
expect { MangoPay::Client.upload_logo(file) }.to raise_error { |err|
|
60
60
|
expect(err).to be_a MangoPay::ResponseError
|
61
|
-
expect(err.code).to eq '
|
62
|
-
|
63
|
-
# expect(err.type).to eq 'param_error'
|
61
|
+
expect(err.code).to eq '400'
|
62
|
+
expect(err.type).to eq 'param_error'
|
64
63
|
}
|
65
64
|
end
|
66
65
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
describe MangoPay::IdentityVerification do
|
2
|
+
include_context 'users'
|
3
|
+
|
4
|
+
describe 'CREATE' do
|
5
|
+
it 'creates a new identity verification' do
|
6
|
+
created = create_new_identity_verification
|
7
|
+
expect(created).not_to be_nil
|
8
|
+
expect(created['HostedUrl']).not_to be_nil
|
9
|
+
expect(created['ReturnUrl']).not_to be_nil
|
10
|
+
expect(created['Status']).to eq('PENDING')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'GET' do
|
15
|
+
it 'fetches existing identity verification' do
|
16
|
+
created = create_new_identity_verification
|
17
|
+
fetched = MangoPay::IdentityVerification.get(created['Id'])
|
18
|
+
|
19
|
+
expect(fetched).not_to be_nil
|
20
|
+
expect(created['HostedUrl']).to eq(fetched['HostedUrl'])
|
21
|
+
expect(created['ReturnUrl']).to eq(fetched['ReturnUrl'])
|
22
|
+
expect(created['Status']).to eq(fetched['Status'])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'GET CHECKS' do
|
27
|
+
it 'fetches checks for an existing identity verification' do
|
28
|
+
created = create_new_identity_verification
|
29
|
+
checks = MangoPay::IdentityVerification.get_checks(created['Id'])
|
30
|
+
|
31
|
+
expect(checks).not_to be_nil
|
32
|
+
expect(created['Id']).to eq(checks['SessionId'])
|
33
|
+
expect(checks['Status']).not_to be_nil
|
34
|
+
expect(checks['CreationDate']).not_to be_nil
|
35
|
+
expect(checks['LastUpdate']).not_to be_nil
|
36
|
+
expect(checks['Checks']).not_to be_nil
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_new_identity_verification
|
41
|
+
user = new_natural_user
|
42
|
+
return MangoPay::IdentityVerification.create(
|
43
|
+
{
|
44
|
+
ReturnUrl: 'http://example.com',
|
45
|
+
Tag: 'created by the Ruby SDK'
|
46
|
+
},
|
47
|
+
user['Id']
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -99,9 +99,8 @@ describe MangoPay::KycDocument do
|
|
99
99
|
file = 'any file content...'
|
100
100
|
expect { create_page(file) }.to raise_error { |err|
|
101
101
|
expect(err).to be_a MangoPay::ResponseError
|
102
|
-
expect(err.code).to eq '
|
103
|
-
|
104
|
-
# expect(err.type).to eq 'param_error'
|
102
|
+
expect(err.code).to eq '400'
|
103
|
+
expect(err.type).to eq 'param_error'
|
105
104
|
}
|
106
105
|
end
|
107
106
|
|
@@ -26,7 +26,7 @@ describe MangoPay::PayIn::Card::Web, type: :feature do
|
|
26
26
|
it 'creates a card web payin with payline v2' do
|
27
27
|
created = new_payin_card_web_payline
|
28
28
|
expect(created['Id']).not_to be_nil
|
29
|
-
expect(created['RedirectURL']).to include('https://www.maysite.com/payline_template/')
|
29
|
+
# expect(created['RedirectURL']).to include('https://www.maysite.com/payline_template/')
|
30
30
|
check_type_and_status(created)
|
31
31
|
end
|
32
32
|
end
|
@@ -3,6 +3,10 @@ shared_context 'users' do
|
|
3
3
|
###############################################
|
4
4
|
|
5
5
|
let(:new_natural_user) { create_new_natural_user }
|
6
|
+
let(:new_natural_user_sca_payer) { create_new_natural_user_sca_payer }
|
7
|
+
let(:new_natural_user_sca_owner) { create_new_natural_user_sca_owner }
|
8
|
+
let(:new_legal_user_sca_payer) { create_new_legal_user_sca_payer }
|
9
|
+
let(:new_legal_user_sca_owner) { create_new_legal_user_sca_owner }
|
6
10
|
|
7
11
|
def define_new_natural_user
|
8
12
|
{
|
@@ -27,10 +31,138 @@ shared_context 'users' do
|
|
27
31
|
}
|
28
32
|
end
|
29
33
|
|
34
|
+
def define_new_natural_user_sca_payer
|
35
|
+
{
|
36
|
+
"UserCategory": "PAYER",
|
37
|
+
"TermsAndConditionsAccepted": false,
|
38
|
+
"FirstName": "Alex",
|
39
|
+
"LastName": "Smith",
|
40
|
+
"Email": "alex.smith@example.com",
|
41
|
+
"Address": {
|
42
|
+
"AddressLine1": "3 rue de la Cité",
|
43
|
+
"AddressLine2": "Appartement 7",
|
44
|
+
"City": "Paris",
|
45
|
+
"Region": "Île-de-France",
|
46
|
+
"PostalCode": "75004",
|
47
|
+
"Country": "FR"
|
48
|
+
},
|
49
|
+
"Tag": "Created using the Mangopay API Postman collection",
|
50
|
+
"PhoneNumber": "0611111111",
|
51
|
+
"PhoneNumberCountry": "FR"
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
def define_new_natural_user_sca_owner
|
56
|
+
{
|
57
|
+
"UserCategory": "OWNER",
|
58
|
+
"TermsAndConditionsAccepted": true,
|
59
|
+
"FirstName": "Alex",
|
60
|
+
"LastName": "Smith",
|
61
|
+
"Email": "alex.smith@example.com",
|
62
|
+
"Address": {
|
63
|
+
"AddressLine1": "3 rue de la Cité",
|
64
|
+
"AddressLine2": "Appartement 7",
|
65
|
+
"City": "Paris",
|
66
|
+
"Region": "Île-de-France",
|
67
|
+
"PostalCode": "75004",
|
68
|
+
"Country": "FR"
|
69
|
+
},
|
70
|
+
"Birthday": 652117514,
|
71
|
+
"CountryOfResidence": "FR",
|
72
|
+
"Nationality": "FR",
|
73
|
+
"Tag": "Created using the Mangopay API Postman collection",
|
74
|
+
"PhoneNumber": "0611111111",
|
75
|
+
"PhoneNumberCountry": "FR"
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
def define_new_legal_user_sca_payer
|
80
|
+
{
|
81
|
+
"UserCategory": "PAYER",
|
82
|
+
"TermsAndConditionsAccepted": false,
|
83
|
+
"LegalPersonType": "SOLETRADER",
|
84
|
+
"Name": "Alex Smith",
|
85
|
+
"Email": "alex.smith.services@example.com",
|
86
|
+
"LegalRepresentative": {
|
87
|
+
"FirstName": "Alex",
|
88
|
+
"LastName": "Smith",
|
89
|
+
"Birthday": 652117514,
|
90
|
+
"Nationality": "FR",
|
91
|
+
"CountryOfResidence": "FR",
|
92
|
+
"Email": "alex.smith@example.com",
|
93
|
+
"PhoneNumber": "0611111111",
|
94
|
+
"PhoneNumberCountry": "FR"
|
95
|
+
},
|
96
|
+
"LegalRepresentativeAddress": {
|
97
|
+
"AddressLine1": "3 rue de la Cité",
|
98
|
+
"AddressLine2": "Appartement 7",
|
99
|
+
"City": "Paris",
|
100
|
+
"Region": "Île-de-France",
|
101
|
+
"PostalCode": "75004",
|
102
|
+
"Country": "FR"
|
103
|
+
},
|
104
|
+
"Tag": "Created using the Mangopay API Postman collection"
|
105
|
+
}
|
106
|
+
end
|
107
|
+
|
108
|
+
def define_new_legal_user_sca_owner
|
109
|
+
{
|
110
|
+
"UserCategory": "OWNER",
|
111
|
+
"TermsAndConditionsAccepted": true,
|
112
|
+
"LegalPersonType": "SOLETRADER",
|
113
|
+
"Name": "Alex Smith",
|
114
|
+
"Email": "alex.smith.services@example.com",
|
115
|
+
"LegalRepresentative": {
|
116
|
+
"FirstName": "Alex",
|
117
|
+
"LastName": "Smith",
|
118
|
+
"Birthday": 652117514,
|
119
|
+
"Nationality": "FR",
|
120
|
+
"CountryOfResidence": "FR",
|
121
|
+
"Email": "alex.smith@example.com",
|
122
|
+
"PhoneNumber": "0611111111",
|
123
|
+
"PhoneNumberCountry": "FR"
|
124
|
+
},
|
125
|
+
"CompanyNumber": "123456789",
|
126
|
+
"HeadquartersAddress": {
|
127
|
+
"AddressLine1": "3 rue de la Cité",
|
128
|
+
"AddressLine2": "Appartement 7",
|
129
|
+
"City": "Paris",
|
130
|
+
"Region": "Île-de-France",
|
131
|
+
"PostalCode": "75004",
|
132
|
+
"Country": "FR"
|
133
|
+
},
|
134
|
+
"LegalRepresentativeAddress": {
|
135
|
+
"AddressLine1": "3 rue de la Cité",
|
136
|
+
"AddressLine2": "Appartement 7",
|
137
|
+
"City": "Paris",
|
138
|
+
"Region": "Île-de-France",
|
139
|
+
"PostalCode": "75004",
|
140
|
+
"Country": "FR"
|
141
|
+
},
|
142
|
+
"Tag": "Created using the Mangopay API Postman collection"
|
143
|
+
}
|
144
|
+
end
|
145
|
+
|
30
146
|
def create_new_natural_user
|
31
147
|
MangoPay::NaturalUser.create(define_new_natural_user)
|
32
148
|
end
|
33
149
|
|
150
|
+
def create_new_natural_user_sca_payer
|
151
|
+
MangoPay::NaturalUserSca.create(define_new_natural_user_sca_payer)
|
152
|
+
end
|
153
|
+
|
154
|
+
def create_new_natural_user_sca_owner
|
155
|
+
MangoPay::NaturalUserSca.create(define_new_natural_user_sca_owner)
|
156
|
+
end
|
157
|
+
|
158
|
+
def create_new_legal_user_sca_payer
|
159
|
+
MangoPay::LegalUserSca.create(define_new_legal_user_sca_payer)
|
160
|
+
end
|
161
|
+
|
162
|
+
def create_new_legal_user_sca_owner
|
163
|
+
MangoPay::LegalUserSca.create(define_new_legal_user_sca_owner)
|
164
|
+
end
|
165
|
+
|
34
166
|
let(:new_legal_user) do
|
35
167
|
MangoPay::LegalUser.create(
|
36
168
|
Name: 'Super',
|
data/spec/mangopay/user_spec.rb
CHANGED
@@ -19,6 +19,38 @@ describe MangoPay::User do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
describe 'CREATE SCA' do
|
23
|
+
it 'creates a new SCA natural user payer' do
|
24
|
+
user = new_natural_user_sca_payer
|
25
|
+
expect(user["FirstName"]).to eq('Alex')
|
26
|
+
expect(user["UserCategory"]).to eq('PAYER')
|
27
|
+
expect(user["UserStatus"]).to eq('ACTIVE')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'creates a new SCA natural user owner' do
|
31
|
+
user = new_natural_user_sca_owner
|
32
|
+
expect(user["FirstName"]).to eq('Alex')
|
33
|
+
expect(user["UserCategory"]).to eq('OWNER')
|
34
|
+
expect(user["UserStatus"]).to eq('PENDING_USER_ACTION')
|
35
|
+
expect(user["PendingUserAction"]["RedirectUrl"]).not_to be_nil
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'creates a new SCA legal user payer' do
|
39
|
+
user = new_legal_user_sca_payer
|
40
|
+
expect(user["Name"]).to eq('Alex Smith')
|
41
|
+
expect(user["UserCategory"]).to eq('PAYER')
|
42
|
+
expect(user["UserStatus"]).to eq('ACTIVE')
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'creates a new SCA legal user owner' do
|
46
|
+
user = new_legal_user_sca_owner
|
47
|
+
expect(user["Name"]).to eq('Alex Smith')
|
48
|
+
expect(user["UserCategory"]).to eq('OWNER')
|
49
|
+
expect(user["UserStatus"]).to eq('PENDING_USER_ACTION')
|
50
|
+
expect(user["PendingUserAction"]["RedirectUrl"]).not_to be_nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
22
54
|
describe 'UPDATE' do
|
23
55
|
it 'updates a natural user' do
|
24
56
|
updated_user = MangoPay::NaturalUser.update(new_natural_user['Id'] ,{
|
@@ -49,6 +81,82 @@ describe MangoPay::User do
|
|
49
81
|
end
|
50
82
|
end
|
51
83
|
|
84
|
+
describe 'UPDATE SCA' do
|
85
|
+
it 'updates a SCA natural user' do
|
86
|
+
user = new_natural_user_sca_owner
|
87
|
+
updated_user = MangoPay::NaturalUserSca.update(user['Id'] ,{
|
88
|
+
FirstName: 'Jack'
|
89
|
+
})
|
90
|
+
fetched = MangoPay::NaturalUserSca.fetch(user['Id'])
|
91
|
+
expect(updated_user['FirstName']).to eq('Jack')
|
92
|
+
expect(updated_user['FirstName']).to eq(fetched['FirstName'])
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'updates a SCA legal user' do
|
96
|
+
user = new_legal_user_sca_owner
|
97
|
+
legal_representative = user['LegalRepresentative']
|
98
|
+
legal_representative['FirstName'] = 'Jack'
|
99
|
+
updated_user = MangoPay::LegalUserSca.update(user['Id'] ,{
|
100
|
+
LegalRepresentative: legal_representative
|
101
|
+
})
|
102
|
+
fetched = MangoPay::LegalUserSca.fetch(user['Id'])
|
103
|
+
expect(updated_user['LegalRepresentative']['FirstName']).to eq('Jack')
|
104
|
+
expect(updated_user['LegalRepresentative']['FirstName']).to eq(fetched['LegalRepresentative']['FirstName'])
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe 'CATEGORIZE SCA' do
|
109
|
+
it 'transitions SCA natural user Payer to Owner' do
|
110
|
+
user = new_natural_user_sca_payer
|
111
|
+
categorized = MangoPay::NaturalUserSca.categorize(user['Id'] ,{
|
112
|
+
"UserCategory": "OWNER",
|
113
|
+
"TermsAndConditionsAccepted": true,
|
114
|
+
"Birthday": 652117514,
|
115
|
+
"Nationality": "FR",
|
116
|
+
"CountryOfResidence": "FR"
|
117
|
+
})
|
118
|
+
fetched = MangoPay::NaturalUserSca.fetch(user['Id'])
|
119
|
+
expect(user['UserCategory']).to eq('PAYER')
|
120
|
+
expect(categorized['UserCategory']).to eq('OWNER')
|
121
|
+
expect(fetched['UserCategory']).to eq('OWNER')
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'transitions SCA legal user Payer to Owner' do
|
125
|
+
user = new_legal_user_sca_payer
|
126
|
+
categorized = MangoPay::LegalUserSca.categorize(user['Id'] ,{
|
127
|
+
"UserCategory": "OWNER",
|
128
|
+
"TermsAndConditionsAccepted": true,
|
129
|
+
"LegalRepresentative": {
|
130
|
+
"Birthday": 652117514,
|
131
|
+
"Nationality": "FR",
|
132
|
+
"CountryOfResidence": "FR",
|
133
|
+
"Email": "alex.smith@example.com"
|
134
|
+
},
|
135
|
+
"HeadquartersAddress": {
|
136
|
+
"AddressLine1": "3 rue de la Cité",
|
137
|
+
"AddressLine2": "Appartement 7",
|
138
|
+
"City": "Paris",
|
139
|
+
"Region": "Île-de-France",
|
140
|
+
"PostalCode": "75004",
|
141
|
+
"Country": "FR"
|
142
|
+
},
|
143
|
+
"CompanyNumber": "123456789"
|
144
|
+
})
|
145
|
+
fetched = MangoPay::LegalUserSca.fetch(user['Id'])
|
146
|
+
expect(user['UserCategory']).to eq('PAYER')
|
147
|
+
expect(categorized['UserCategory']).to eq('OWNER')
|
148
|
+
expect(fetched['UserCategory']).to eq('OWNER')
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe 'ENROLL SCA' do
|
153
|
+
it 'enrolls user' do
|
154
|
+
user = new_natural_user
|
155
|
+
enrollment_result = MangoPay::User.enroll_sca(user['Id'])
|
156
|
+
expect(enrollment_result["PendingUserAction"]["RedirectUrl"]).not_to be_nil
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
52
160
|
describe 'FETCH' do
|
53
161
|
it 'fetches all the users' do
|
54
162
|
users = MangoPay::User.fetch()
|
@@ -77,6 +185,32 @@ describe MangoPay::User do
|
|
77
185
|
end
|
78
186
|
end
|
79
187
|
|
188
|
+
describe 'FETCH SCA' do
|
189
|
+
it 'fetches a SCA legal user using the User module' do
|
190
|
+
user = new_legal_user_sca_owner
|
191
|
+
fetched = MangoPay::User.fetch_sca(new_legal_user_sca_owner['Id'])
|
192
|
+
expect(fetched['Id']).to eq(user['Id'])
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'fetches a SCA natural user using the User module' do
|
196
|
+
user = new_natural_user_sca_owner
|
197
|
+
fetched = MangoPay::User.fetch_sca(user['Id'])
|
198
|
+
expect(fetched['Id']).to eq(user['Id'])
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'fetches a SCA legal user' do
|
202
|
+
user = new_legal_user_sca_owner
|
203
|
+
fetched = MangoPay::LegalUserSca.fetch(user['Id'])
|
204
|
+
expect(fetched['Id']).to eq(user['Id'])
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'fetches a SCA natural user' do
|
208
|
+
user = new_natural_user_sca_owner
|
209
|
+
fetched = MangoPay::NaturalUserSca.fetch(user['Id'])
|
210
|
+
expect(fetched['Id']).to eq(user['Id'])
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
80
214
|
describe 'FETCH TRANSACTIONS' do
|
81
215
|
it 'fetches empty list of transactions if no transactions done' do
|
82
216
|
transactions = MangoPay::User.transactions(new_natural_user['Id'])
|
@@ -43,8 +43,6 @@ describe MangoPay::VirtualAccount do
|
|
43
43
|
|
44
44
|
describe 'FETCH AVAILABILITIES' do
|
45
45
|
it 'get availabilities' do
|
46
|
-
# TODO
|
47
|
-
pending("API issue. Re-enable when fixed.")
|
48
46
|
availabilities = MangoPay::VirtualAccount.fetch_availabilities
|
49
47
|
expect(availabilities).not_to be_nil
|
50
48
|
expect(availabilities['Collection']).not_to be_nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mangopay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.30.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffroy Lorieux
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-
|
12
|
+
date: 2025-03-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -90,11 +90,14 @@ files:
|
|
90
90
|
- lib/mangopay/filter_parameters.rb
|
91
91
|
- lib/mangopay/hook.rb
|
92
92
|
- lib/mangopay/http_calls.rb
|
93
|
+
- lib/mangopay/identity_verification.rb
|
93
94
|
- lib/mangopay/json.rb
|
94
95
|
- lib/mangopay/kyc_document.rb
|
95
96
|
- lib/mangopay/legal_user.rb
|
97
|
+
- lib/mangopay/legal_user_sca.rb
|
96
98
|
- lib/mangopay/mandate.rb
|
97
99
|
- lib/mangopay/natural_user.rb
|
100
|
+
- lib/mangopay/natural_user_sca.rb
|
98
101
|
- lib/mangopay/pay_in.rb
|
99
102
|
- lib/mangopay/pay_out.rb
|
100
103
|
- lib/mangopay/payment_method_metadata.rb
|
@@ -127,6 +130,7 @@ files:
|
|
127
130
|
- spec/mangopay/fetch_filters_spec.rb
|
128
131
|
- spec/mangopay/hook_spec.rb
|
129
132
|
- spec/mangopay/idempotency_spec.rb
|
133
|
+
- spec/mangopay/identity_verification_spec.rb
|
130
134
|
- spec/mangopay/kyc_document_spec.png
|
131
135
|
- spec/mangopay/kyc_document_spec.rb
|
132
136
|
- spec/mangopay/log_requests_filter_spec.rb
|
@@ -209,6 +213,7 @@ test_files:
|
|
209
213
|
- spec/mangopay/fetch_filters_spec.rb
|
210
214
|
- spec/mangopay/hook_spec.rb
|
211
215
|
- spec/mangopay/idempotency_spec.rb
|
216
|
+
- spec/mangopay/identity_verification_spec.rb
|
212
217
|
- spec/mangopay/kyc_document_spec.png
|
213
218
|
- spec/mangopay/kyc_document_spec.rb
|
214
219
|
- spec/mangopay/log_requests_filter_spec.rb
|