mangopay 3.0.25 → 3.0.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +30 -28
- data/.rspec +2 -2
- data/.travis.yml +13 -4
- data/Gemfile +2 -2
- data/LICENSE +20 -20
- data/README.md +126 -126
- data/bin/mangopay +9 -9
- data/lib/generators/mangopay/install_generator.rb +60 -60
- data/lib/generators/templates/mangopay.rb.erb +5 -5
- data/lib/mangopay.rb +228 -225
- data/lib/mangopay/authorization_token.rb +88 -88
- data/lib/mangopay/bank_account.rb +38 -38
- data/lib/mangopay/bankingaliases.rb +29 -0
- data/lib/mangopay/bankingaliases_iban.rb +16 -0
- data/lib/mangopay/card.rb +8 -8
- data/lib/mangopay/card_registration.rb +9 -9
- data/lib/mangopay/client.rb +74 -74
- data/lib/mangopay/dispute.rb +130 -130
- data/lib/mangopay/errors.rb +61 -61
- data/lib/mangopay/event.rb +18 -18
- data/lib/mangopay/filter_parameters.rb +46 -46
- data/lib/mangopay/hook.rb +9 -9
- data/lib/mangopay/http_calls.rb +85 -85
- data/lib/mangopay/json.rb +14 -14
- data/lib/mangopay/kyc_document.rb +70 -70
- data/lib/mangopay/legal_user.rb +15 -15
- data/lib/mangopay/mandate.rb +32 -32
- data/lib/mangopay/natural_user.rb +14 -14
- data/lib/mangopay/pay_in.rb +96 -85
- data/lib/mangopay/pay_out.rb +14 -14
- data/lib/mangopay/pre_authorization.rb +13 -13
- data/lib/mangopay/refund.rb +7 -7
- data/lib/mangopay/report.rb +17 -17
- data/lib/mangopay/resource.rb +21 -21
- data/lib/mangopay/transaction.rb +24 -24
- data/lib/mangopay/transfer.rb +9 -9
- data/lib/mangopay/user.rb +43 -43
- data/lib/mangopay/version.rb +3 -3
- data/lib/mangopay/wallet.rb +17 -17
- data/mangopay.gemspec +30 -30
- data/spec/mangopay/authorization_token_spec.rb +70 -70
- data/spec/mangopay/bank_account_spec.rb +97 -97
- data/spec/mangopay/bankingaliases_spec.rb +29 -0
- data/spec/mangopay/card_registration_spec.rb +73 -73
- data/spec/mangopay/client_spec.rb +110 -110
- data/spec/mangopay/configuration_spec.rb +95 -95
- data/spec/mangopay/dispute_spec.rb +262 -262
- data/spec/mangopay/event_spec.rb +31 -31
- data/spec/mangopay/fetch_filters_spec.rb +63 -63
- data/spec/mangopay/hook_spec.rb +37 -37
- data/spec/mangopay/idempotency_spec.rb +41 -41
- data/spec/mangopay/kyc_document_spec.rb +103 -103
- data/spec/mangopay/log_requests_filter_spec.rb +25 -25
- data/spec/mangopay/mandate_spec.rb +92 -92
- data/spec/mangopay/payin_bankwire_direct_spec.rb +74 -74
- data/spec/mangopay/payin_card_direct_spec.rb +68 -68
- data/spec/mangopay/payin_card_web_spec.rb +47 -38
- data/spec/mangopay/payin_directdebit_direct_spec.rb +37 -37
- data/spec/mangopay/payin_directdebit_web_spec.rb +38 -38
- data/spec/mangopay/payin_paypal_web_spec.rb +38 -38
- data/spec/mangopay/payin_preauthorized_direct_spec.rb +68 -68
- data/spec/mangopay/payout_bankwire_spec.rb +54 -54
- data/spec/mangopay/preauthorization_spec.rb +42 -42
- data/spec/mangopay/refund_spec.rb +21 -21
- data/spec/mangopay/report_spec.rb +39 -39
- data/spec/mangopay/shared_resources.rb +397 -381
- data/spec/mangopay/transaction_spec.rb +54 -54
- data/spec/mangopay/transfer_spec.rb +69 -69
- data/spec/mangopay/user_spec.rb +137 -137
- data/spec/mangopay/wallet_spec.rb +80 -80
- data/spec/spec_helper.rb +31 -31
- metadata +7 -6
- data/lib/mangopay/temp.rb +0 -74
- data/spec/mangopay/temp_paymentcard_spec.rb +0 -31
data/lib/mangopay/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module MangoPay
|
2
|
-
VERSION = '3.0.
|
3
|
-
end
|
1
|
+
module MangoPay
|
2
|
+
VERSION = '3.0.26'
|
3
|
+
end
|
data/lib/mangopay/wallet.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
module MangoPay
|
2
|
-
|
3
|
-
# See http://docs.mangopay.com/api-references/wallets/
|
4
|
-
class Wallet < Resource
|
5
|
-
include HTTPCalls::Create
|
6
|
-
include HTTPCalls::Update
|
7
|
-
include HTTPCalls::Fetch
|
8
|
-
|
9
|
-
# Fetches list of transactions belonging to the given +wallet_id+.
|
10
|
-
# Optional +filters+ is a hash accepting following keys:
|
11
|
-
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
12
|
-
# - other keys specific for transactions filtering (see MangoPay::Transaction.fetch)
|
13
|
-
def self.transactions(wallet_id, filters = {})
|
14
|
-
Transaction.fetch(wallet_id, filters)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/wallets/
|
4
|
+
class Wallet < Resource
|
5
|
+
include HTTPCalls::Create
|
6
|
+
include HTTPCalls::Update
|
7
|
+
include HTTPCalls::Fetch
|
8
|
+
|
9
|
+
# Fetches list of transactions belonging to the given +wallet_id+.
|
10
|
+
# Optional +filters+ is a hash accepting following keys:
|
11
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
12
|
+
# - other keys specific for transactions filtering (see MangoPay::Transaction.fetch)
|
13
|
+
def self.transactions(wallet_id, filters = {})
|
14
|
+
Transaction.fetch(wallet_id, filters)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/mangopay.gemspec
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
2
|
-
|
3
|
-
require 'mangopay/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = 'mangopay'
|
7
|
-
s.version = MangoPay::VERSION
|
8
|
-
s.summary = "Ruby bindings for the version 2 of the MANGOPAY API"
|
9
|
-
s.description = <<-EOF
|
10
|
-
The mangopay Gem makes interacting with MANGOPAY Services much easier.
|
11
|
-
For any questions regarding the use of MANGOPAY's Services feel free to contact us at http://www.mangopay.com/get-started-2/
|
12
|
-
You can find more documentation about MANGOPAY Services at http://docs.mangopay.com/
|
13
|
-
EOF
|
14
|
-
s.authors = ['Geoffroy Lorieux', 'Sergiusz Woznicki']
|
15
|
-
s.email = 'support@mangopay.com'
|
16
|
-
s.homepage = 'http://docs.mangopay.com/'
|
17
|
-
s.license = 'MIT'
|
18
|
-
|
19
|
-
s.required_ruby_version = '>= 1.9.2'
|
20
|
-
|
21
|
-
s.add_dependency('multi_json', '>= 1.7.7')
|
22
|
-
|
23
|
-
s.add_development_dependency('rake', '>= 10.1.0')
|
24
|
-
s.add_development_dependency('rspec', '>= 3.0.0')
|
25
|
-
|
26
|
-
s.files = `git ls-files`.split("\n")
|
27
|
-
s.test_files = `git ls-files -- spec/*`.split("\n")
|
28
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
29
|
-
s.require_paths = ['lib']
|
30
|
-
end
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
2
|
+
|
3
|
+
require 'mangopay/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'mangopay'
|
7
|
+
s.version = MangoPay::VERSION
|
8
|
+
s.summary = "Ruby bindings for the version 2 of the MANGOPAY API"
|
9
|
+
s.description = <<-EOF
|
10
|
+
The mangopay Gem makes interacting with MANGOPAY Services much easier.
|
11
|
+
For any questions regarding the use of MANGOPAY's Services feel free to contact us at http://www.mangopay.com/get-started-2/
|
12
|
+
You can find more documentation about MANGOPAY Services at http://docs.mangopay.com/
|
13
|
+
EOF
|
14
|
+
s.authors = ['Geoffroy Lorieux', 'Sergiusz Woznicki']
|
15
|
+
s.email = 'support@mangopay.com'
|
16
|
+
s.homepage = 'http://docs.mangopay.com/'
|
17
|
+
s.license = 'MIT'
|
18
|
+
|
19
|
+
s.required_ruby_version = '>= 1.9.2'
|
20
|
+
|
21
|
+
s.add_dependency('multi_json', '>= 1.7.7')
|
22
|
+
|
23
|
+
s.add_development_dependency('rake', '>= 10.1.0')
|
24
|
+
s.add_development_dependency('rspec', '>= 3.0.0')
|
25
|
+
|
26
|
+
s.files = `git ls-files`.split("\n")
|
27
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
28
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
29
|
+
s.require_paths = ['lib']
|
30
|
+
end
|
@@ -1,70 +1,70 @@
|
|
1
|
-
describe MangoPay::AuthorizationToken do
|
2
|
-
|
3
|
-
_default_static_storage = MangoPay::AuthorizationToken::Manager.storage
|
4
|
-
_new_file_storage = MangoPay::AuthorizationToken::FileStorage.new
|
5
|
-
|
6
|
-
it 'uses StaticStorage strategy by default' do
|
7
|
-
storage = _default_static_storage
|
8
|
-
expect(storage).to be_kind_of MangoPay::AuthorizationToken::StaticStorage
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'allows set different storage strategies' do
|
12
|
-
|
13
|
-
# set to FileStorage
|
14
|
-
file_storage = _new_file_storage
|
15
|
-
MangoPay::AuthorizationToken::Manager.storage = file_storage
|
16
|
-
storage = MangoPay::AuthorizationToken::Manager.storage
|
17
|
-
expect(storage).to be file_storage
|
18
|
-
|
19
|
-
# reset to StaticStorage
|
20
|
-
static_storage = _default_static_storage
|
21
|
-
MangoPay::AuthorizationToken::Manager.storage = static_storage
|
22
|
-
storage = MangoPay::AuthorizationToken::Manager.storage
|
23
|
-
expect(storage).to be static_storage
|
24
|
-
end
|
25
|
-
|
26
|
-
describe MangoPay::AuthorizationToken::StaticStorage do
|
27
|
-
it 'shares tokens between calls' do
|
28
|
-
MangoPay::AuthorizationToken::Manager.storage = _default_static_storage
|
29
|
-
users1 = MangoPay::User.fetch
|
30
|
-
token1 = MangoPay::AuthorizationToken::Manager.get_token
|
31
|
-
users2 = MangoPay::User.fetch
|
32
|
-
token2 = MangoPay::AuthorizationToken::Manager.get_token
|
33
|
-
expect(token1).to eq token2
|
34
|
-
expect(token1).to be token2 # moreover, it's the same instance
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe MangoPay::AuthorizationToken::FileStorage do
|
39
|
-
it 'shares tokens between calls' do
|
40
|
-
MangoPay::AuthorizationToken::Manager.storage = _new_file_storage
|
41
|
-
|
42
|
-
users1 = MangoPay::User.fetch
|
43
|
-
token1 = MangoPay::AuthorizationToken::Manager.get_token
|
44
|
-
users2 = MangoPay::User.fetch
|
45
|
-
token2 = MangoPay::AuthorizationToken::Manager.get_token
|
46
|
-
expect(token1).to eq token2
|
47
|
-
expect(token1).not_to be token2 # it's NOT the same instance
|
48
|
-
|
49
|
-
MangoPay::AuthorizationToken::Manager.storage = _default_static_storage # cleanup
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'uses temp file with serialized token' do
|
53
|
-
MangoPay::AuthorizationToken::Manager.storage = _new_file_storage
|
54
|
-
|
55
|
-
file_path = _new_file_storage.file_path
|
56
|
-
dir_path = MangoPay.configuration.temp_dir
|
57
|
-
expect(file_path.start_with? dir_path).to be(true)
|
58
|
-
|
59
|
-
token = MangoPay::AuthorizationToken::Manager.get_token
|
60
|
-
expect(File.exists? file_path).to be(true)
|
61
|
-
|
62
|
-
f = File.open(file_path, File::RDONLY)
|
63
|
-
txt = f.read
|
64
|
-
f.close
|
65
|
-
expect(txt.include? token['access_token']).to be(true)
|
66
|
-
|
67
|
-
MangoPay::AuthorizationToken::Manager.storage = _default_static_storage # cleanup
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
1
|
+
describe MangoPay::AuthorizationToken do
|
2
|
+
|
3
|
+
_default_static_storage = MangoPay::AuthorizationToken::Manager.storage
|
4
|
+
_new_file_storage = MangoPay::AuthorizationToken::FileStorage.new
|
5
|
+
|
6
|
+
it 'uses StaticStorage strategy by default' do
|
7
|
+
storage = _default_static_storage
|
8
|
+
expect(storage).to be_kind_of MangoPay::AuthorizationToken::StaticStorage
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'allows set different storage strategies' do
|
12
|
+
|
13
|
+
# set to FileStorage
|
14
|
+
file_storage = _new_file_storage
|
15
|
+
MangoPay::AuthorizationToken::Manager.storage = file_storage
|
16
|
+
storage = MangoPay::AuthorizationToken::Manager.storage
|
17
|
+
expect(storage).to be file_storage
|
18
|
+
|
19
|
+
# reset to StaticStorage
|
20
|
+
static_storage = _default_static_storage
|
21
|
+
MangoPay::AuthorizationToken::Manager.storage = static_storage
|
22
|
+
storage = MangoPay::AuthorizationToken::Manager.storage
|
23
|
+
expect(storage).to be static_storage
|
24
|
+
end
|
25
|
+
|
26
|
+
describe MangoPay::AuthorizationToken::StaticStorage do
|
27
|
+
it 'shares tokens between calls' do
|
28
|
+
MangoPay::AuthorizationToken::Manager.storage = _default_static_storage
|
29
|
+
users1 = MangoPay::User.fetch
|
30
|
+
token1 = MangoPay::AuthorizationToken::Manager.get_token
|
31
|
+
users2 = MangoPay::User.fetch
|
32
|
+
token2 = MangoPay::AuthorizationToken::Manager.get_token
|
33
|
+
expect(token1).to eq token2
|
34
|
+
expect(token1).to be token2 # moreover, it's the same instance
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe MangoPay::AuthorizationToken::FileStorage do
|
39
|
+
it 'shares tokens between calls' do
|
40
|
+
MangoPay::AuthorizationToken::Manager.storage = _new_file_storage
|
41
|
+
|
42
|
+
users1 = MangoPay::User.fetch
|
43
|
+
token1 = MangoPay::AuthorizationToken::Manager.get_token
|
44
|
+
users2 = MangoPay::User.fetch
|
45
|
+
token2 = MangoPay::AuthorizationToken::Manager.get_token
|
46
|
+
expect(token1).to eq token2
|
47
|
+
expect(token1).not_to be token2 # it's NOT the same instance
|
48
|
+
|
49
|
+
MangoPay::AuthorizationToken::Manager.storage = _default_static_storage # cleanup
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'uses temp file with serialized token' do
|
53
|
+
MangoPay::AuthorizationToken::Manager.storage = _new_file_storage
|
54
|
+
|
55
|
+
file_path = _new_file_storage.file_path
|
56
|
+
dir_path = MangoPay.configuration.temp_dir
|
57
|
+
expect(file_path.start_with? dir_path).to be(true)
|
58
|
+
|
59
|
+
token = MangoPay::AuthorizationToken::Manager.get_token
|
60
|
+
expect(File.exists? file_path).to be(true)
|
61
|
+
|
62
|
+
f = File.open(file_path, File::RDONLY)
|
63
|
+
txt = f.read
|
64
|
+
f.close
|
65
|
+
expect(txt.include? token['access_token']).to be(true)
|
66
|
+
|
67
|
+
MangoPay::AuthorizationToken::Manager.storage = _default_static_storage # cleanup
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -1,97 +1,97 @@
|
|
1
|
-
describe MangoPay::BankAccount do
|
2
|
-
include_context 'bank_accounts'
|
3
|
-
|
4
|
-
def create(params)
|
5
|
-
user = new_natural_user
|
6
|
-
params_fixed = { OwnerName: 'John', OwnerAddress: user['Address'] }.merge(params)
|
7
|
-
MangoPay::BankAccount.create(user['Id'], params_fixed)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe 'CREATE' do
|
11
|
-
|
12
|
-
it 'creates a new IBAN bank detail' do
|
13
|
-
expect(new_bank_account['Id']).not_to be_nil
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'creates a new GB bank detail' do
|
17
|
-
created = create({
|
18
|
-
Type: 'GB',
|
19
|
-
AccountNumber: '63956474',
|
20
|
-
SortCode: '200000',
|
21
|
-
})
|
22
|
-
expect(created['Id']).not_to be_nil
|
23
|
-
expect(created['Type']).to eq('GB')
|
24
|
-
expect(created['AccountNumber']).to eq('63956474')
|
25
|
-
expect(created['SortCode']).to eq('200000')
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'creates a new US bank detail' do
|
29
|
-
created = create({
|
30
|
-
Type: 'US',
|
31
|
-
AccountNumber: '234234234234',
|
32
|
-
ABA: '234334789',
|
33
|
-
})
|
34
|
-
expect(created['Id']).not_to be_nil
|
35
|
-
expect(created['Type']).to eq('US')
|
36
|
-
expect(created['AccountNumber']).to eq('234234234234')
|
37
|
-
expect(created['ABA']).to eq('234334789')
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'creates a new CA bank detail' do
|
41
|
-
created = create({
|
42
|
-
Type: 'CA',
|
43
|
-
BankName: 'TestBankName',
|
44
|
-
BranchCode: '12345',
|
45
|
-
AccountNumber: '234234234234',
|
46
|
-
InstitutionNumber: '123',
|
47
|
-
})
|
48
|
-
expect(created['Id']).not_to be_nil
|
49
|
-
expect(created['Type']).to eq('CA')
|
50
|
-
expect(created['BankName']).to eq('TestBankName')
|
51
|
-
expect(created['BranchCode']).to eq('12345')
|
52
|
-
expect(created['AccountNumber']).to eq('234234234234')
|
53
|
-
expect(created['InstitutionNumber']).to eq('123')
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'creates a new OTHER bank detail' do
|
57
|
-
created = create({
|
58
|
-
Type: 'OTHER',
|
59
|
-
Country: 'FR',
|
60
|
-
AccountNumber: '234234234234',
|
61
|
-
BIC: 'BINAADADXXX',
|
62
|
-
})
|
63
|
-
expect(created['Id']).not_to be_nil
|
64
|
-
expect(created['Type']).to eq('OTHER')
|
65
|
-
expect(created['Country']).to eq('FR')
|
66
|
-
expect(created['AccountNumber']).to eq('234234234234')
|
67
|
-
expect(created['BIC']).to eq('BINAADADXXX')
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
describe 'FETCH' do
|
73
|
-
|
74
|
-
it 'fetches all the bank details' do
|
75
|
-
list = MangoPay::BankAccount.fetch(new_bank_account['UserId'])
|
76
|
-
expect(list).to be_kind_of(Array)
|
77
|
-
expect(list[0]['Id']).to eq(new_bank_account['Id'])
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'fetches single bank detail' do
|
81
|
-
single = MangoPay::BankAccount.fetch(new_bank_account['UserId'], new_bank_account['Id'])
|
82
|
-
expect(single['Id']).to eq(new_bank_account['Id'])
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe 'UPDATE' do
|
87
|
-
it 'disactivates a bank account' do
|
88
|
-
usr_id = new_bank_account['UserId']
|
89
|
-
acc_id = new_bank_account['Id']
|
90
|
-
|
91
|
-
changed = MangoPay::BankAccount.update(usr_id, acc_id, {Active: false})
|
92
|
-
fetched = MangoPay::BankAccount.fetch(usr_id, acc_id)
|
93
|
-
expect(changed['Active']).to eq(false)
|
94
|
-
expect(fetched['Active']).to eq(false)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
1
|
+
describe MangoPay::BankAccount do
|
2
|
+
include_context 'bank_accounts'
|
3
|
+
|
4
|
+
def create(params)
|
5
|
+
user = new_natural_user
|
6
|
+
params_fixed = { OwnerName: 'John', OwnerAddress: user['Address'] }.merge(params)
|
7
|
+
MangoPay::BankAccount.create(user['Id'], params_fixed)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'CREATE' do
|
11
|
+
|
12
|
+
it 'creates a new IBAN bank detail' do
|
13
|
+
expect(new_bank_account['Id']).not_to be_nil
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'creates a new GB bank detail' do
|
17
|
+
created = create({
|
18
|
+
Type: 'GB',
|
19
|
+
AccountNumber: '63956474',
|
20
|
+
SortCode: '200000',
|
21
|
+
})
|
22
|
+
expect(created['Id']).not_to be_nil
|
23
|
+
expect(created['Type']).to eq('GB')
|
24
|
+
expect(created['AccountNumber']).to eq('63956474')
|
25
|
+
expect(created['SortCode']).to eq('200000')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'creates a new US bank detail' do
|
29
|
+
created = create({
|
30
|
+
Type: 'US',
|
31
|
+
AccountNumber: '234234234234',
|
32
|
+
ABA: '234334789',
|
33
|
+
})
|
34
|
+
expect(created['Id']).not_to be_nil
|
35
|
+
expect(created['Type']).to eq('US')
|
36
|
+
expect(created['AccountNumber']).to eq('234234234234')
|
37
|
+
expect(created['ABA']).to eq('234334789')
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'creates a new CA bank detail' do
|
41
|
+
created = create({
|
42
|
+
Type: 'CA',
|
43
|
+
BankName: 'TestBankName',
|
44
|
+
BranchCode: '12345',
|
45
|
+
AccountNumber: '234234234234',
|
46
|
+
InstitutionNumber: '123',
|
47
|
+
})
|
48
|
+
expect(created['Id']).not_to be_nil
|
49
|
+
expect(created['Type']).to eq('CA')
|
50
|
+
expect(created['BankName']).to eq('TestBankName')
|
51
|
+
expect(created['BranchCode']).to eq('12345')
|
52
|
+
expect(created['AccountNumber']).to eq('234234234234')
|
53
|
+
expect(created['InstitutionNumber']).to eq('123')
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'creates a new OTHER bank detail' do
|
57
|
+
created = create({
|
58
|
+
Type: 'OTHER',
|
59
|
+
Country: 'FR',
|
60
|
+
AccountNumber: '234234234234',
|
61
|
+
BIC: 'BINAADADXXX',
|
62
|
+
})
|
63
|
+
expect(created['Id']).not_to be_nil
|
64
|
+
expect(created['Type']).to eq('OTHER')
|
65
|
+
expect(created['Country']).to eq('FR')
|
66
|
+
expect(created['AccountNumber']).to eq('234234234234')
|
67
|
+
expect(created['BIC']).to eq('BINAADADXXX')
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
describe 'FETCH' do
|
73
|
+
|
74
|
+
it 'fetches all the bank details' do
|
75
|
+
list = MangoPay::BankAccount.fetch(new_bank_account['UserId'])
|
76
|
+
expect(list).to be_kind_of(Array)
|
77
|
+
expect(list[0]['Id']).to eq(new_bank_account['Id'])
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'fetches single bank detail' do
|
81
|
+
single = MangoPay::BankAccount.fetch(new_bank_account['UserId'], new_bank_account['Id'])
|
82
|
+
expect(single['Id']).to eq(new_bank_account['Id'])
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe 'UPDATE' do
|
87
|
+
it 'disactivates a bank account' do
|
88
|
+
usr_id = new_bank_account['UserId']
|
89
|
+
acc_id = new_bank_account['Id']
|
90
|
+
|
91
|
+
changed = MangoPay::BankAccount.update(usr_id, acc_id, {Active: false})
|
92
|
+
fetched = MangoPay::BankAccount.fetch(usr_id, acc_id)
|
93
|
+
expect(changed['Active']).to eq(false)
|
94
|
+
expect(fetched['Active']).to eq(false)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
describe MangoPay::BankingAliases do
|
2
|
+
include_context 'users'
|
3
|
+
include_context 'wallets'
|
4
|
+
include_context 'bankigaliases'
|
5
|
+
|
6
|
+
describe 'CREATE' do
|
7
|
+
it 'creates a new banking alias' do
|
8
|
+
expect(new_banking_alias['CreditedUserId']).to eq(new_natural_user['Id'])
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'UPDATE' do
|
13
|
+
it 'updates a banking alias' do
|
14
|
+
updated_banking_alias = MangoPay::BankingAliases.update(new_banking_alias['Id'] ,{
|
15
|
+
Active: false
|
16
|
+
})
|
17
|
+
expect(updated_banking_alias['Active']).to eq(false)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'FETCH' do
|
22
|
+
it 'fetches all the banking aliases for a wallet' do
|
23
|
+
bankingaliases = MangoPay::BankingAliases.fetch_for_wallet(new_banking_alias['WalletId'])
|
24
|
+
expect(bankingaliases).to be_kind_of(Array)
|
25
|
+
expect(bankingaliases).not_to be_empty
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|