mangopay 3.0.30.1 → 3.0.35

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -1
  3. data/CHANGELOG.md +36 -0
  4. data/README.md +5 -5
  5. data/lib/generators/mangopay/install_generator.rb +1 -1
  6. data/lib/generators/templates/mangopay.rb.erb +1 -1
  7. data/lib/mangopay.rb +36 -13
  8. data/lib/mangopay/authorization_token.rb +2 -2
  9. data/lib/mangopay/bank_account.rb +11 -0
  10. data/lib/mangopay/card.rb +15 -0
  11. data/lib/mangopay/filter_parameters.rb +6 -1
  12. data/lib/mangopay/http_calls.rb +7 -7
  13. data/lib/mangopay/legal_user.rb +0 -8
  14. data/lib/mangopay/mandate.rb +10 -0
  15. data/lib/mangopay/pay_in.rb +31 -0
  16. data/lib/mangopay/pay_out.rb +11 -0
  17. data/lib/mangopay/refund.rb +11 -0
  18. data/lib/mangopay/transfer.rb +11 -0
  19. data/lib/mangopay/ubo.rb +26 -0
  20. data/lib/mangopay/ubo_declaration.rb +22 -11
  21. data/lib/mangopay/user.rb +18 -7
  22. data/lib/mangopay/version.rb +1 -1
  23. data/spec/mangopay/bank_account_spec.rb +8 -0
  24. data/spec/mangopay/card_registration_spec.rb +7 -0
  25. data/spec/mangopay/client_spec.rb +17 -6
  26. data/spec/mangopay/configuration_spec.rb +53 -1
  27. data/spec/mangopay/event_spec.rb +12 -10
  28. data/spec/mangopay/mandate_spec.rb +7 -0
  29. data/spec/mangopay/payin_applepay_direct_spec.rb +20 -0
  30. data/spec/mangopay/payin_bankwire_external_instruction_spec.rb +43 -4
  31. data/spec/mangopay/payin_card_web_spec.rb +17 -0
  32. data/spec/mangopay/payin_paypal_web_spec.rb +13 -1
  33. data/spec/mangopay/payout_bankwire_spec.rb +8 -0
  34. data/spec/mangopay/preauthorization_spec.rb +9 -0
  35. data/spec/mangopay/refund_spec.rb +13 -0
  36. data/spec/mangopay/shared_resources.rb +346 -240
  37. data/spec/mangopay/transfer_spec.rb +8 -0
  38. data/spec/mangopay/ubo_declaration_spec.rb +13 -17
  39. data/spec/mangopay/ubo_spec.rb +39 -0
  40. data/spec/mangopay/user_spec.rb +34 -16
  41. data/spec/spec_helper.rb +1 -1
  42. metadata +9 -4
@@ -66,4 +66,12 @@ describe MangoPay::Transfer, type: :feature do
66
66
  wallets_reload_and_check_amounts(wlt1, 1000, wlt2, 0)
67
67
  end
68
68
  end
69
+
70
+ describe 'FETCH Refunds' do
71
+ it "fetches a transfer's refunds" do
72
+ transfer = new_transfer
73
+ refunds = MangoPay::Transfer.refunds(transfer['Id'])
74
+ expect(refunds).to be_an(Array)
75
+ end
76
+ end
69
77
  end
@@ -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
- natural_user = define_new_natural_user
8
- natural_user['Capacity'] = 'DECLARATIVE'
9
- natural_user = MangoPay::NaturalUser.create(natural_user)
10
- ubo_declaration = {
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
- natural_user = define_new_natural_user
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
- ubo_declaration = MangoPay::UboDeclaration.update(ubo_declaration['Id'], ubo_declaration)
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
@@ -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,21 +186,26 @@ describe MangoPay::User do
173
186
  end
174
187
  end
175
188
 
176
- describe 'CREATE UBO DECLARATION' do
177
- it 'creates a UBO declaration' do
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
203
+
204
+ describe 'FETCH Pre-Authorizations' do
205
+ it "fetches list of user's pre-authorizations belonging" do
178
206
  legal_user = new_legal_user
179
- natural_user = define_new_natural_user
180
- natural_user['Capacity'] = 'DECLARATIVE'
181
- natural_user = MangoPay::NaturalUser.create(natural_user)
182
- ubo_declaration = {
183
- DeclaredUBOs: [natural_user['Id']]
184
- }
185
- ubo_declaration = MangoPay::LegalUser.create_ubo_declaration(legal_user['Id'], ubo_declaration)
186
-
187
- expect(ubo_declaration).not_to be_nil
188
- expect(ubo_declaration['Status']).to eq 'CREATED'
189
- expect(ubo_declaration['UserId']).to eq legal_user['Id']
190
- expect(ubo_declaration['DeclaredUBOs'][0]['UserId']).to eq natural_user['Id']
207
+ pre_authorizations = MangoPay::User.pre_authorizations(legal_user['Id'])
208
+ expect(pre_authorizations).to be_an(Array)
191
209
  end
192
210
  end
193
211
  end
@@ -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.client_passphrase = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
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.30.1
4
+ version: 3.0.35
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: 2018-01-16 00:00:00.000000000 Z
12
+ date: 2020-08-25 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
- rubyforge_project:
165
- rubygems_version: 2.7.4
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