mangopay 3.0.25.pre.alpha.pre.20 → 3.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +28 -28
- data/.rspec +2 -2
- data/.travis.yml +4 -13
- 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 +225 -225
- data/lib/mangopay/authorization_token.rb +88 -88
- data/lib/mangopay/bank_account.rb +38 -38
- 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 +85 -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/temp.rb +74 -74
- 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 -31
- data/spec/mangopay/authorization_token_spec.rb +70 -70
- data/spec/mangopay/bank_account_spec.rb +97 -97
- 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 +38 -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 +381 -381
- data/spec/mangopay/temp_paymentcard_spec.rb +31 -31
- 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 +5 -5
@@ -1,80 +1,80 @@
|
|
1
|
-
describe MangoPay::Wallet do
|
2
|
-
include_context 'wallets'
|
3
|
-
include_context 'payins'
|
4
|
-
include_context 'payouts'
|
5
|
-
|
6
|
-
describe 'CREATE' do
|
7
|
-
it 'creates a wallet' do
|
8
|
-
expect(new_wallet['Id']).to_not be_nil
|
9
|
-
expect(new_wallet['Balance']['Currency']).to eq('EUR')
|
10
|
-
expect(new_wallet['Balance']['Amount']).to eq(0)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe 'UPDATE' do
|
15
|
-
it 'updates a wallet' do
|
16
|
-
updated_wallet = MangoPay::Wallet.update(new_wallet['Id'], {
|
17
|
-
Description: 'Updated Description',
|
18
|
-
Tag: 'Updated Tag'
|
19
|
-
})
|
20
|
-
expect(updated_wallet['Description']).to eq('Updated Description')
|
21
|
-
expect(updated_wallet['Tag']).to eq('Updated Tag')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe 'FETCH' do
|
26
|
-
it 'fetches a wallet' do
|
27
|
-
wallet = MangoPay::Wallet.fetch(new_wallet['Id'])
|
28
|
-
expect(wallet['Id']).to eq(new_wallet['Id'])
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe 'FETCH TRANSACTIONS' do
|
33
|
-
|
34
|
-
it 'fetches empty list of transactions if no transactions done' do
|
35
|
-
transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
|
36
|
-
expect(transactions).to be_kind_of(Array)
|
37
|
-
expect(transactions).to be_empty
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'fetches list with single transaction after payin done' do
|
41
|
-
payin = new_payin_card_direct
|
42
|
-
transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
|
43
|
-
expect(transactions).to be_kind_of(Array)
|
44
|
-
expect(transactions.count).to eq 1
|
45
|
-
expect(transactions.first['Id']).to eq payin['Id']
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'fetches list with two transactions after payin and payout done' do
|
49
|
-
payin = new_payin_card_direct
|
50
|
-
payout = create_new_payout_bankwire(payin)
|
51
|
-
transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
|
52
|
-
|
53
|
-
expect(transactions).to be_kind_of(Array)
|
54
|
-
expect(transactions.count).to eq 2
|
55
|
-
|
56
|
-
transactions_ids = transactions.map {|t| t['Id']}
|
57
|
-
expect(transactions_ids).to include payin['Id']
|
58
|
-
expect(transactions_ids).to include payout['Id']
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'accepts filtering params' do
|
62
|
-
payin = new_payin_card_direct
|
63
|
-
payout = create_new_payout_bankwire(payin)
|
64
|
-
wallet_id = new_wallet['Id']
|
65
|
-
|
66
|
-
by_nature_reg = MangoPay::Wallet.transactions(wallet_id, {'Nature' => 'REGULAR'})
|
67
|
-
by_nature_ref = MangoPay::Wallet.transactions(wallet_id, {'Nature' => 'REFUND'})
|
68
|
-
expect(by_nature_reg.count).to eq 2
|
69
|
-
expect(by_nature_ref.count).to eq 0
|
70
|
-
|
71
|
-
by_type_pyin = MangoPay::Wallet.transactions(wallet_id, {'Type' => 'PAYIN'})
|
72
|
-
by_type_pyout = MangoPay::Wallet.transactions(wallet_id, {'Type' => 'PAYOUT'})
|
73
|
-
expect(by_type_pyin.count).to eq 1
|
74
|
-
expect(by_type_pyout.count).to eq 1
|
75
|
-
expect(by_type_pyin.first['Id']).to eq payin['Id']
|
76
|
-
expect(by_type_pyout.first['Id']).to eq payout['Id']
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
end
|
1
|
+
describe MangoPay::Wallet do
|
2
|
+
include_context 'wallets'
|
3
|
+
include_context 'payins'
|
4
|
+
include_context 'payouts'
|
5
|
+
|
6
|
+
describe 'CREATE' do
|
7
|
+
it 'creates a wallet' do
|
8
|
+
expect(new_wallet['Id']).to_not be_nil
|
9
|
+
expect(new_wallet['Balance']['Currency']).to eq('EUR')
|
10
|
+
expect(new_wallet['Balance']['Amount']).to eq(0)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'UPDATE' do
|
15
|
+
it 'updates a wallet' do
|
16
|
+
updated_wallet = MangoPay::Wallet.update(new_wallet['Id'], {
|
17
|
+
Description: 'Updated Description',
|
18
|
+
Tag: 'Updated Tag'
|
19
|
+
})
|
20
|
+
expect(updated_wallet['Description']).to eq('Updated Description')
|
21
|
+
expect(updated_wallet['Tag']).to eq('Updated Tag')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'FETCH' do
|
26
|
+
it 'fetches a wallet' do
|
27
|
+
wallet = MangoPay::Wallet.fetch(new_wallet['Id'])
|
28
|
+
expect(wallet['Id']).to eq(new_wallet['Id'])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'FETCH TRANSACTIONS' do
|
33
|
+
|
34
|
+
it 'fetches empty list of transactions if no transactions done' do
|
35
|
+
transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
|
36
|
+
expect(transactions).to be_kind_of(Array)
|
37
|
+
expect(transactions).to be_empty
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'fetches list with single transaction after payin done' do
|
41
|
+
payin = new_payin_card_direct
|
42
|
+
transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
|
43
|
+
expect(transactions).to be_kind_of(Array)
|
44
|
+
expect(transactions.count).to eq 1
|
45
|
+
expect(transactions.first['Id']).to eq payin['Id']
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'fetches list with two transactions after payin and payout done' do
|
49
|
+
payin = new_payin_card_direct
|
50
|
+
payout = create_new_payout_bankwire(payin)
|
51
|
+
transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
|
52
|
+
|
53
|
+
expect(transactions).to be_kind_of(Array)
|
54
|
+
expect(transactions.count).to eq 2
|
55
|
+
|
56
|
+
transactions_ids = transactions.map {|t| t['Id']}
|
57
|
+
expect(transactions_ids).to include payin['Id']
|
58
|
+
expect(transactions_ids).to include payout['Id']
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'accepts filtering params' do
|
62
|
+
payin = new_payin_card_direct
|
63
|
+
payout = create_new_payout_bankwire(payin)
|
64
|
+
wallet_id = new_wallet['Id']
|
65
|
+
|
66
|
+
by_nature_reg = MangoPay::Wallet.transactions(wallet_id, {'Nature' => 'REGULAR'})
|
67
|
+
by_nature_ref = MangoPay::Wallet.transactions(wallet_id, {'Nature' => 'REFUND'})
|
68
|
+
expect(by_nature_reg.count).to eq 2
|
69
|
+
expect(by_nature_ref.count).to eq 0
|
70
|
+
|
71
|
+
by_type_pyin = MangoPay::Wallet.transactions(wallet_id, {'Type' => 'PAYIN'})
|
72
|
+
by_type_pyout = MangoPay::Wallet.transactions(wallet_id, {'Type' => 'PAYOUT'})
|
73
|
+
expect(by_type_pyin.count).to eq 1
|
74
|
+
expect(by_type_pyout.count).to eq 1
|
75
|
+
expect(by_type_pyin.first['Id']).to eq payin['Id']
|
76
|
+
expect(by_type_pyout.first['Id']).to eq payout['Id']
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
require 'mangopay'
|
2
|
-
require_relative 'mangopay/shared_resources'
|
3
|
-
|
4
|
-
|
5
|
-
################################################################################
|
6
|
-
# mangopay test account config (re-called once in configuration_spec)
|
7
|
-
def reset_mangopay_configuration
|
8
|
-
MangoPay.configure do |c|
|
9
|
-
c.preproduction = true
|
10
|
-
c.client_id = 'sdk-unit-tests'
|
11
|
-
|
12
|
-
# sandbox environment:
|
13
|
-
c.root_url = 'https://api.sandbox.mangopay.com'
|
14
|
-
c.client_passphrase = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
|
15
|
-
|
16
|
-
c.temp_dir = File.expand_path('../tmp', __FILE__)
|
17
|
-
require 'fileutils'
|
18
|
-
FileUtils.mkdir_p(c.temp_dir) unless File.directory?(c.temp_dir)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
reset_mangopay_configuration
|
22
|
-
|
23
|
-
|
24
|
-
################################################################################
|
25
|
-
# uncomment it for logging all http calls in tests
|
26
|
-
# require 'pp'
|
27
|
-
# require 'http_logger'
|
28
|
-
# require 'logger'
|
29
|
-
# HttpLogger.logger = Logger.new(STDOUT)
|
30
|
-
# HttpLogger.colorize = true
|
31
|
-
# HttpLogger.log_headers = true # false
|
1
|
+
require 'mangopay'
|
2
|
+
require_relative 'mangopay/shared_resources'
|
3
|
+
|
4
|
+
|
5
|
+
################################################################################
|
6
|
+
# mangopay test account config (re-called once in configuration_spec)
|
7
|
+
def reset_mangopay_configuration
|
8
|
+
MangoPay.configure do |c|
|
9
|
+
c.preproduction = true
|
10
|
+
c.client_id = 'sdk-unit-tests'
|
11
|
+
|
12
|
+
# sandbox environment:
|
13
|
+
c.root_url = 'https://api.sandbox.mangopay.com'
|
14
|
+
c.client_passphrase = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
|
15
|
+
|
16
|
+
c.temp_dir = File.expand_path('../tmp', __FILE__)
|
17
|
+
require 'fileutils'
|
18
|
+
FileUtils.mkdir_p(c.temp_dir) unless File.directory?(c.temp_dir)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
reset_mangopay_configuration
|
22
|
+
|
23
|
+
|
24
|
+
################################################################################
|
25
|
+
# uncomment it for logging all http calls in tests
|
26
|
+
# require 'pp'
|
27
|
+
# require 'http_logger'
|
28
|
+
# require 'logger'
|
29
|
+
# HttpLogger.logger = Logger.new(STDOUT)
|
30
|
+
# HttpLogger.colorize = true
|
31
|
+
# HttpLogger.log_headers = true # false
|
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.25
|
4
|
+
version: 3.0.25
|
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: 2016-12
|
12
|
+
date: 2016-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -152,12 +152,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
152
|
version: 1.9.2
|
153
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
|
-
- - "
|
155
|
+
- - ">="
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
157
|
+
version: '0'
|
158
158
|
requirements: []
|
159
159
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.6.
|
160
|
+
rubygems_version: 2.6.7
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Ruby bindings for the version 2 of the MANGOPAY API
|