mangopay 3.26.1 → 3.27.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 +10 -0
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay/virtual_account.rb +44 -0
- data/lib/mangopay.rb +1 -0
- data/spec/mangopay/shared_resources.rb +17 -0
- data/spec/mangopay/virtual_account_spec.rb +52 -0
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9aacfa6dd021ce341e9f435dcca6b77eed14b6a85d9c9e4907bad599f4bcb313
|
4
|
+
data.tar.gz: 22ad8f7d5179689c6841537d73729a4dd3430fb9cf42b9d9caca55658ef31be0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da2fa47b3367011d9c7ead37af5646aea23ef4b2fab2fb6859ce770a913774d601e7b9b22877ede7709735a502667f626e154aeb10d3637e4dd650fe46029b2d
|
7
|
+
data.tar.gz: afb180e3d2040d91e9827cce7eba960332d6132a316924dcbea3e6aafa990ab7139262abaad98ea9d53c70ada3d43e865b6b91afc849443ef6c319b05fd3345b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## [3.27.0] - 2024-10-29
|
2
|
+
### Added
|
3
|
+
|
4
|
+
New endpoints for The Virtual Account object:
|
5
|
+
- [Create a Virtual Account]()
|
6
|
+
- [Deactivate a Virtual Account]()
|
7
|
+
- [View a Virtual Account]()
|
8
|
+
- [List Virtual Accounts for a Wallet]()
|
9
|
+
- [View Client Availabilities]()
|
10
|
+
|
1
11
|
## [3.26.1] - 2024-10-03
|
2
12
|
### Fixed
|
3
13
|
|
data/lib/mangopay/version.rb
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
class VirtualAccount < Resource
|
4
|
+
class << self
|
5
|
+
# Creates a new virtual account
|
6
|
+
def create(wallet_id, params, idempotency_key = nil)
|
7
|
+
url = "#{MangoPay.api_path}/wallets/#{wallet_id}/virtual-accounts"
|
8
|
+
MangoPay.request(:post, url, params, {}, idempotency_key)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Updates:
|
12
|
+
# - irreversibly deactivates a virtual account with +virtual_account_id+
|
13
|
+
# see https://docs.mangopay.com/api-reference/virtual-accounts/deactivate-virtual-account
|
14
|
+
def deactivate(wallet_id, virtual_account_id, idempotency_key = nil)
|
15
|
+
url = "#{MangoPay.api_path}/wallets/#{wallet_id}/virtual-accounts/#{virtual_account_id}"
|
16
|
+
MangoPay.request(:put, url, {}, {}, idempotency_key)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Fetches:
|
20
|
+
# - view a virtual account with +virtual_account_id+
|
21
|
+
# see https://docs.mangopay.com/api-reference/virtual-accounts/view-virtual-account
|
22
|
+
def fetch(wallet_id, virtual_account_id)
|
23
|
+
url = "#{MangoPay.api_path}/wallets/#{wallet_id}/virtual-accounts/#{virtual_account_id}"
|
24
|
+
MangoPay.request(:get, url, {})
|
25
|
+
end
|
26
|
+
|
27
|
+
# Fetches:
|
28
|
+
# - view virtual accounts for given +wallet_id+
|
29
|
+
# see https://docs.mangopay.com/api-reference/virtual-accounts/list-virtual-accounts-wallet
|
30
|
+
def fetch_all(wallet_id, filters = {})
|
31
|
+
url = "#{MangoPay.api_path}/wallets/#{wallet_id}/virtual-accounts"
|
32
|
+
MangoPay.request(:get, url, {}, filters)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Fetches:
|
36
|
+
# Allows to check which account countries and currencies are available
|
37
|
+
# see https://docs.mangopay.com/api-reference/virtual-accounts/view-virtual-account-availabilities
|
38
|
+
def fetch_availabilities(filters = {})
|
39
|
+
url = "#{MangoPay.api_path}/virtual-accounts/availability"
|
40
|
+
MangoPay.request(:get, url, {}, filters)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/mangopay.rb
CHANGED
@@ -47,6 +47,7 @@ module MangoPay
|
|
47
47
|
autoload :Deposit, 'mangopay/deposit'
|
48
48
|
autoload :Conversion, 'mangopay/conversion'
|
49
49
|
autoload :PaymentMethodMetadata, 'mangopay/payment_method_metadata'
|
50
|
+
autoload :VirtualAccount, 'mangopay/virtual_account'
|
50
51
|
|
51
52
|
# temporary
|
52
53
|
autoload :Temp, 'mangopay/temp'
|
@@ -998,4 +998,21 @@ shared_context 'payment_method_metadata' do
|
|
998
998
|
Bin: pay_in['CardInfo']['BIN']
|
999
999
|
)
|
1000
1000
|
end
|
1001
|
+
end
|
1002
|
+
|
1003
|
+
###############################################
|
1004
|
+
shared_context 'virtual_account' do
|
1005
|
+
###############################################
|
1006
|
+
include_context 'users'
|
1007
|
+
include_context 'wallets'
|
1008
|
+
|
1009
|
+
def new_virtual_account(wallet_id)
|
1010
|
+
create_virtual_account = {
|
1011
|
+
Country: 'FR',
|
1012
|
+
VirtualAccountPurpose: 'Collection',
|
1013
|
+
Tag: 'create virtual account tag'
|
1014
|
+
}
|
1015
|
+
|
1016
|
+
MangoPay::VirtualAccount.create(wallet_id, create_virtual_account)
|
1017
|
+
end
|
1001
1018
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
describe MangoPay::VirtualAccount do
|
2
|
+
include_context 'virtual_account'
|
3
|
+
include_context 'wallets'
|
4
|
+
|
5
|
+
describe 'CREATE' do
|
6
|
+
it 'can create a Virtual Account' do
|
7
|
+
wallet = new_wallet
|
8
|
+
virtual_account = new_virtual_account(wallet['Id'])
|
9
|
+
expect(virtual_account).not_to be_nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'DEACTIVATE' do
|
14
|
+
it 'deactivates a Virtual Account' do
|
15
|
+
wallet = new_wallet
|
16
|
+
virtual_account = new_virtual_account(wallet['Id'])
|
17
|
+
deactivated = MangoPay::VirtualAccount.deactivate(wallet['Id'], virtual_account['Id'])
|
18
|
+
expect(deactivated).not_to be_nil
|
19
|
+
expect(deactivated['Status']).to eq 'CLOSED'
|
20
|
+
expect(deactivated['Id']).to eq(virtual_account['Id'])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'FETCH' do
|
25
|
+
it 'can get a Virtual Account' do
|
26
|
+
wallet = new_wallet
|
27
|
+
virtual_account = new_virtual_account(wallet['Id'])
|
28
|
+
fetched = MangoPay::VirtualAccount.fetch(wallet['Id'], virtual_account['Id'])
|
29
|
+
expect(fetched).not_to be_nil
|
30
|
+
expect(fetched['Id']).to eq(virtual_account['Id'])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'FETCH ALL' do
|
35
|
+
it 'can get all Virtual Accounts for a wallet' do
|
36
|
+
wallet = new_wallet
|
37
|
+
virtual_account = new_virtual_account(wallet['Id'])
|
38
|
+
fetched_list = MangoPay::VirtualAccount.fetch_all(wallet['Id'])
|
39
|
+
expect(fetched_list).not_to be_nil
|
40
|
+
expect(fetched_list[0]['Id']).to eq(virtual_account['Id'])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'FETCH AVAILABILITIES' do
|
45
|
+
it 'get availabilities' do
|
46
|
+
availabilities = MangoPay::VirtualAccount.fetch_availabilities
|
47
|
+
expect(availabilities).not_to be_nil
|
48
|
+
expect(availabilities['Collection']).not_to be_nil
|
49
|
+
expect(availabilities['UserOwned']).not_to be_nil
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mangopay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.27.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffroy Lorieux
|
8
8
|
- Sergiusz Woznicki
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-10-
|
12
|
+
date: 2024-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- lib/mangopay/ubo_declaration.rb
|
110
110
|
- lib/mangopay/user.rb
|
111
111
|
- lib/mangopay/version.rb
|
112
|
+
- lib/mangopay/virtual_account.rb
|
112
113
|
- lib/mangopay/wallet.rb
|
113
114
|
- mangopay.gemspec
|
114
115
|
- spec/mangopay/authorization_token_spec.rb
|
@@ -163,6 +164,7 @@ files:
|
|
163
164
|
- spec/mangopay/ubo_declaration_spec.rb
|
164
165
|
- spec/mangopay/ubo_spec.rb
|
165
166
|
- spec/mangopay/user_spec.rb
|
167
|
+
- spec/mangopay/virtual_account_spec.rb
|
166
168
|
- spec/mangopay/wallet_spec.rb
|
167
169
|
- spec/spec_helper.rb
|
168
170
|
- spec/tmp/.keep
|
@@ -170,7 +172,7 @@ homepage: http://docs.mangopay.com/
|
|
170
172
|
licenses:
|
171
173
|
- MIT
|
172
174
|
metadata: {}
|
173
|
-
post_install_message:
|
175
|
+
post_install_message:
|
174
176
|
rdoc_options: []
|
175
177
|
require_paths:
|
176
178
|
- lib
|
@@ -186,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
188
|
version: '0'
|
187
189
|
requirements: []
|
188
190
|
rubygems_version: 3.0.3.1
|
189
|
-
signing_key:
|
191
|
+
signing_key:
|
190
192
|
specification_version: 4
|
191
193
|
summary: Ruby bindings for the version 2 of the MANGOPAY API
|
192
194
|
test_files:
|
@@ -242,6 +244,7 @@ test_files:
|
|
242
244
|
- spec/mangopay/ubo_declaration_spec.rb
|
243
245
|
- spec/mangopay/ubo_spec.rb
|
244
246
|
- spec/mangopay/user_spec.rb
|
247
|
+
- spec/mangopay/virtual_account_spec.rb
|
245
248
|
- spec/mangopay/wallet_spec.rb
|
246
249
|
- spec/spec_helper.rb
|
247
250
|
- spec/tmp/.keep
|