mangopay 3.0.31 → 3.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -1
- data/CHANGELOG.md +39 -0
- data/README.md +5 -5
- data/lib/generators/mangopay/install_generator.rb +1 -1
- data/lib/generators/templates/mangopay.rb.erb +1 -1
- data/lib/mangopay.rb +37 -14
- data/lib/mangopay/authorization_token.rb +2 -2
- data/lib/mangopay/filter_parameters.rb +6 -1
- data/lib/mangopay/http_calls.rb +7 -7
- data/lib/mangopay/legal_user.rb +0 -8
- data/lib/mangopay/pay_in.rb +20 -0
- data/lib/mangopay/ubo.rb +26 -0
- data/lib/mangopay/ubo_declaration.rb +22 -11
- data/lib/mangopay/user.rb +12 -8
- data/lib/mangopay/version.rb +1 -1
- data/spec/mangopay/client_spec.rb +17 -6
- data/spec/mangopay/configuration_spec.rb +53 -1
- data/spec/mangopay/event_spec.rb +12 -10
- data/spec/mangopay/payin_applepay_direct_spec.rb +20 -0
- data/spec/mangopay/payin_bankwire_external_instruction_spec.rb +43 -4
- data/spec/mangopay/payin_card_web_spec.rb +9 -0
- data/spec/mangopay/payin_paypal_web_spec.rb +13 -1
- data/spec/mangopay/refund_spec.rb +12 -12
- data/spec/mangopay/shared_resources.rb +346 -240
- data/spec/mangopay/ubo_declaration_spec.rb +13 -17
- data/spec/mangopay/ubo_spec.rb +39 -0
- data/spec/mangopay/user_spec.rb +29 -19
- data/spec/spec_helper.rb +1 -1
- metadata +9 -4
@@ -1,37 +1,33 @@
|
|
1
1
|
describe MangoPay::UboDeclaration do
|
2
2
|
include_context 'users'
|
3
|
+
include_context 'ubo'
|
3
4
|
|
4
5
|
describe 'FETCH' do
|
5
6
|
it 'can fetch a UBO declaration' do
|
6
7
|
legal_user = new_legal_user
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
DeclaredUBOs: [natural_user['Id']]
|
12
|
-
}
|
13
|
-
ubo_declaration = MangoPay::LegalUser.create_ubo_declaration(legal_user['Id'], ubo_declaration)
|
14
|
-
ubo_declaration = MangoPay::UboDeclaration.fetch(ubo_declaration['Id'])
|
8
|
+
|
9
|
+
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
|
10
|
+
|
11
|
+
ubo_declaration_byId = MangoPay::UboDeclaration.fetch(legal_user['Id'], ubo_declaration['Id'])
|
15
12
|
|
16
13
|
expect(ubo_declaration).not_to be_nil
|
14
|
+
expect(ubo_declaration_byId).not_to be_nil
|
17
15
|
end
|
18
16
|
|
19
17
|
describe 'UPDATE' do
|
20
18
|
it 'can update a UBO declaration' do
|
21
19
|
legal_user = new_legal_user
|
22
|
-
|
23
|
-
natural_user['Capacity'] = 'DECLARATIVE'
|
24
|
-
natural_user = MangoPay::NaturalUser.create(natural_user)
|
25
|
-
ubo_declaration = {
|
26
|
-
DeclaredUBOs: [natural_user['Id']]
|
27
|
-
}
|
28
|
-
ubo_declaration = MangoPay::LegalUser.create_ubo_declaration(legal_user['Id'], ubo_declaration)
|
20
|
+
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
|
29
21
|
ubo_declaration['Status'] = 'VALIDATION_ASKED'
|
30
|
-
|
22
|
+
|
23
|
+
ubo = new_ubo(legal_user, ubo_declaration)
|
24
|
+
|
25
|
+
ubo_declaration['Ubos'] = [ubo]
|
26
|
+
ubo_declaration = MangoPay::UboDeclaration.update(legal_user['Id'], ubo_declaration['Id'], ubo_declaration)
|
31
27
|
|
32
28
|
expect(ubo_declaration).not_to be_nil
|
33
29
|
expect(ubo_declaration['Status']).to eq 'VALIDATION_ASKED'
|
34
30
|
end
|
35
31
|
end
|
36
32
|
end
|
37
|
-
end
|
33
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
describe MangoPay::Ubo do
|
2
|
+
include_context 'users'
|
3
|
+
include_context 'ubo'
|
4
|
+
|
5
|
+
describe 'FETCH' do
|
6
|
+
it 'can fetch a Ubo' do
|
7
|
+
legal_user = new_legal_user
|
8
|
+
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
|
9
|
+
ubo = new_ubo(legal_user, ubo_declaration)
|
10
|
+
result = MangoPay::Ubo.fetch(legal_user['Id'], ubo_declaration['Id'], ubo['Id'])
|
11
|
+
expect(result).not_to be_nil
|
12
|
+
expect(result['Id']).equal? ubo['Id']
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'CREATE' do
|
17
|
+
it 'can create a new Ubo' do
|
18
|
+
legal_user = new_legal_user
|
19
|
+
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
|
20
|
+
result = new_ubo(legal_user, ubo_declaration)
|
21
|
+
expect(result).not_to be_nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'UPDATE' do
|
26
|
+
it 'can update a Ubo' do
|
27
|
+
legal_user = new_legal_user
|
28
|
+
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
|
29
|
+
ubo = new_ubo(legal_user, ubo_declaration)
|
30
|
+
ubo['FirstName'] = 'Santa'
|
31
|
+
ubo['LastName'] = 'Clause'
|
32
|
+
|
33
|
+
result = MangoPay::Ubo.update(legal_user['Id'], ubo_declaration['Id'], ubo['Id'], ubo)
|
34
|
+
expect(result).not_to be_nil
|
35
|
+
expect(result['FirstName']).equal? ubo['FirstName']
|
36
|
+
expect(result['LastName']).equal? ubo['LastName']
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/spec/mangopay/user_spec.rb
CHANGED
@@ -13,6 +13,10 @@ describe MangoPay::User do
|
|
13
13
|
it 'creates a new legal user' do
|
14
14
|
expect(new_legal_user["LegalRepresentativeFirstName"]).to eq('John')
|
15
15
|
end
|
16
|
+
|
17
|
+
it 'creates a new legal user' do
|
18
|
+
expect(new_legal_user["CompanyNumber"]).to eq('LU123456789')
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
22
|
describe 'UPDATE' do
|
@@ -147,8 +151,17 @@ describe MangoPay::User do
|
|
147
151
|
end
|
148
152
|
|
149
153
|
describe 'FETCH EMONEY' do
|
150
|
-
it 'fetches emoney for the user' do
|
151
|
-
emoney = MangoPay::User.emoney(new_natural_user['Id'])
|
154
|
+
it 'fetches emoney for the user for year 2019' do
|
155
|
+
emoney = MangoPay::User.emoney(new_natural_user['Id'], 2019)
|
156
|
+
expect(emoney['UserId']).to eq new_natural_user['Id']
|
157
|
+
expect(emoney['CreditedEMoney']['Amount']).to eq 0
|
158
|
+
expect(emoney['CreditedEMoney']['Currency']).to eq 'EUR'
|
159
|
+
expect(emoney['DebitedEMoney']['Amount']).to eq 0
|
160
|
+
expect(emoney['DebitedEMoney']['Currency']).to eq 'EUR'
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'fetches emoney for the user for date 08/2019' do
|
164
|
+
emoney = MangoPay::User.emoney(new_natural_user['Id'], 2019, 8)
|
152
165
|
expect(emoney['UserId']).to eq new_natural_user['Id']
|
153
166
|
expect(emoney['CreditedEMoney']['Amount']).to eq 0
|
154
167
|
expect(emoney['CreditedEMoney']['Currency']).to eq 'EUR'
|
@@ -173,23 +186,20 @@ describe MangoPay::User do
|
|
173
186
|
end
|
174
187
|
end
|
175
188
|
|
176
|
-
describe 'CREATE UBO DECLARATION' do
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
expect(ubo_declaration['DeclaredUBOs'][0]['UserId']).to eq natural_user['Id']
|
191
|
-
end
|
192
|
-
end
|
189
|
+
#describe 'CREATE UBO DECLARATION' do
|
190
|
+
# it 'creates a UBO declaration' do
|
191
|
+
# legal_user = new_legal_user
|
192
|
+
# natural_user = define_new_natural_user
|
193
|
+
# natural_user['Capacity'] = 'DECLARATIVE'
|
194
|
+
# natural_user = MangoPay::NaturalUser.create(natural_user)
|
195
|
+
# ubo_declaration = MangoPay::LegalUser.create_ubo_declaration(legal_user['Id'])
|
196
|
+
|
197
|
+
# expect(ubo_declaration).not_to be_nil
|
198
|
+
# expect(ubo_declaration['Status']).to eq 'CREATED'
|
199
|
+
# expect(ubo_declaration['UserId']).to eq legal_user['Id']
|
200
|
+
# expect(ubo_declaration['DeclaredUBOs'][0]['UserId']).to eq natural_user['Id']
|
201
|
+
# end
|
202
|
+
#end
|
193
203
|
|
194
204
|
describe 'FETCH Pre-Authorizations' do
|
195
205
|
it "fetches list of user's pre-authorizations belonging" do
|
data/spec/spec_helper.rb
CHANGED
@@ -11,7 +11,7 @@ def reset_mangopay_configuration
|
|
11
11
|
|
12
12
|
# sandbox environment:
|
13
13
|
c.root_url = 'https://api.sandbox.mangopay.com'
|
14
|
-
c.
|
14
|
+
c.client_apiKey = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
|
15
15
|
|
16
16
|
c.temp_dir = File.expand_path('../tmp', __FILE__)
|
17
17
|
require 'fileutils'
|
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.0.
|
4
|
+
version: 3.0.36
|
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:
|
12
|
+
date: 2020-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- ".gitignore"
|
67
67
|
- ".rspec"
|
68
68
|
- ".travis.yml"
|
69
|
+
- CHANGELOG.md
|
69
70
|
- Gemfile
|
70
71
|
- LICENSE
|
71
72
|
- README.md
|
@@ -99,6 +100,7 @@ files:
|
|
99
100
|
- lib/mangopay/resource.rb
|
100
101
|
- lib/mangopay/transaction.rb
|
101
102
|
- lib/mangopay/transfer.rb
|
103
|
+
- lib/mangopay/ubo.rb
|
102
104
|
- lib/mangopay/ubo_declaration.rb
|
103
105
|
- lib/mangopay/user.rb
|
104
106
|
- lib/mangopay/version.rb
|
@@ -121,6 +123,7 @@ files:
|
|
121
123
|
- spec/mangopay/kyc_document_spec.rb
|
122
124
|
- spec/mangopay/log_requests_filter_spec.rb
|
123
125
|
- spec/mangopay/mandate_spec.rb
|
126
|
+
- spec/mangopay/payin_applepay_direct_spec.rb
|
124
127
|
- spec/mangopay/payin_bankwire_direct_spec.rb
|
125
128
|
- spec/mangopay/payin_bankwire_external_instruction_spec.rb
|
126
129
|
- spec/mangopay/payin_card_direct_spec.rb
|
@@ -138,6 +141,7 @@ files:
|
|
138
141
|
- spec/mangopay/transaction_spec.rb
|
139
142
|
- spec/mangopay/transfer_spec.rb
|
140
143
|
- spec/mangopay/ubo_declaration_spec.rb
|
144
|
+
- spec/mangopay/ubo_spec.rb
|
141
145
|
- spec/mangopay/user_spec.rb
|
142
146
|
- spec/mangopay/wallet_spec.rb
|
143
147
|
- spec/spec_helper.rb
|
@@ -161,8 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
165
|
- !ruby/object:Gem::Version
|
162
166
|
version: '0'
|
163
167
|
requirements: []
|
164
|
-
|
165
|
-
rubygems_version: 2.7.6
|
168
|
+
rubygems_version: 3.0.8
|
166
169
|
signing_key:
|
167
170
|
specification_version: 4
|
168
171
|
summary: Ruby bindings for the version 2 of the MANGOPAY API
|
@@ -184,6 +187,7 @@ test_files:
|
|
184
187
|
- spec/mangopay/kyc_document_spec.rb
|
185
188
|
- spec/mangopay/log_requests_filter_spec.rb
|
186
189
|
- spec/mangopay/mandate_spec.rb
|
190
|
+
- spec/mangopay/payin_applepay_direct_spec.rb
|
187
191
|
- spec/mangopay/payin_bankwire_direct_spec.rb
|
188
192
|
- spec/mangopay/payin_bankwire_external_instruction_spec.rb
|
189
193
|
- spec/mangopay/payin_card_direct_spec.rb
|
@@ -201,6 +205,7 @@ test_files:
|
|
201
205
|
- spec/mangopay/transaction_spec.rb
|
202
206
|
- spec/mangopay/transfer_spec.rb
|
203
207
|
- spec/mangopay/ubo_declaration_spec.rb
|
208
|
+
- spec/mangopay/ubo_spec.rb
|
204
209
|
- spec/mangopay/user_spec.rb
|
205
210
|
- spec/mangopay/wallet_spec.rb
|
206
211
|
- spec/spec_helper.rb
|