mangopay 3.0.11 → 3.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/README.md +26 -0
- data/lib/mangopay.rb +97 -105
- data/lib/mangopay/bank_account.rb +4 -4
- data/lib/mangopay/card.rb +2 -2
- data/lib/mangopay/card_registration.rb +3 -3
- data/lib/mangopay/client.rb +1 -1
- data/lib/mangopay/errors.rb +35 -1
- data/lib/mangopay/event.rb +16 -16
- data/lib/mangopay/hook.rb +3 -3
- data/lib/mangopay/http_calls.rb +1 -1
- data/lib/mangopay/json.rb +6 -15
- data/lib/mangopay/kyc_document.rb +3 -3
- data/lib/mangopay/legal_user.rb +2 -2
- data/lib/mangopay/natural_user.rb +2 -2
- data/lib/mangopay/pay_in.rb +47 -0
- data/lib/mangopay/pay_out.rb +13 -0
- data/lib/mangopay/pre_authorization.rb +11 -0
- data/lib/mangopay/refund.rb +1 -1
- data/lib/mangopay/resource.rb +3 -3
- data/lib/mangopay/transaction.rb +1 -1
- data/lib/mangopay/transfer.rb +3 -3
- data/lib/mangopay/user.rb +3 -3
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay/wallet.rb +5 -5
- data/mangopay.gemspec +3 -6
- data/spec/{lib/mangopay → mangopay}/authorization_token_spec.rb +70 -72
- data/spec/{lib/mangopay → mangopay}/bank_account_spec.rb +0 -2
- data/spec/{lib/mangopay → mangopay}/card_registration_spec.rb +0 -2
- data/spec/{lib/mangopay → mangopay}/client_spec.rb +2 -4
- data/spec/{lib/mangopay → mangopay}/configuration_spec.rb +18 -20
- data/spec/{lib/mangopay → mangopay}/event_spec.rb +31 -33
- data/spec/{lib/mangopay → mangopay}/fetch_filters_spec.rb +0 -2
- data/spec/{lib/mangopay → mangopay}/hook_spec.rb +0 -2
- data/spec/{lib/mangopay → mangopay}/kyc_document_spec.rb +58 -60
- data/spec/{lib/mangopay → mangopay}/payin_bankwire_direct_spec.rb +0 -2
- data/spec/{lib/mangopay → mangopay}/payin_card_direct_spec.rb +0 -2
- data/spec/{lib/mangopay → mangopay}/payin_card_web_spec.rb +54 -56
- data/spec/{lib/mangopay → mangopay}/payin_preauthorized_direct_spec.rb +0 -2
- data/spec/{lib/mangopay → mangopay}/payout_bankwire_spec.rb +54 -56
- data/spec/{lib/mangopay → mangopay}/preauthorization_spec.rb +0 -2
- data/spec/{lib/mangopay → mangopay}/refund_spec.rb +0 -2
- data/spec/{lib/mangopay → mangopay}/shared_resources.rb +0 -4
- data/spec/{lib/mangopay → mangopay}/transaction_spec.rb +0 -2
- data/spec/{lib/mangopay → mangopay}/transfer_spec.rb +0 -2
- data/spec/{lib/mangopay → mangopay}/user_spec.rb +0 -2
- data/spec/{lib/mangopay → mangopay}/wallet_spec.rb +87 -89
- data/spec/spec_helper.rb +28 -20
- metadata +53 -95
- data/lib/mangopay/payin.rb +0 -47
- data/lib/mangopay/payout.rb +0 -13
- data/lib/mangopay/preauthorization.rb +0 -11
@@ -175,10 +175,6 @@ shared_context 'payins' do
|
|
175
175
|
cardExpirationDate: 1214,
|
176
176
|
cardCvx: 123}
|
177
177
|
res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
|
178
|
-
############### TEMP!!!! #######################################################
|
179
|
-
#pp :post, cardreg['CardRegistrationURL'], data
|
180
|
-
#pp res, res.body
|
181
|
-
#puts
|
182
178
|
raise Exception, [res, res.body] unless (res.is_a?(Net::HTTPOK) && res.body.start_with?('data='))
|
183
179
|
cardreg['RegistrationData'] = res.body
|
184
180
|
|
@@ -1,89 +1,87 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
include_context '
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
expect(new_wallet['
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
transactions
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
transactions
|
45
|
-
expect(transactions).to
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
transactions
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
transactions_ids
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
by_nature_reg
|
69
|
-
by_nature_ref
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
by_type_pyin
|
74
|
-
by_type_pyout
|
75
|
-
expect(by_type_pyin.
|
76
|
-
expect(by_type_pyout.
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
by_dir_cred
|
81
|
-
by_dir_debt
|
82
|
-
expect(by_dir_cred.
|
83
|
-
expect(by_dir_debt.
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
89
|
-
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
|
+
|
78
|
+
by_dir_cred = MangoPay::Wallet.transactions(wallet_id, {'Direction' => 'CREDIT'})
|
79
|
+
by_dir_debt = MangoPay::Wallet.transactions(wallet_id, {'Direction' => 'DEBIT'})
|
80
|
+
expect(by_dir_cred.count).to eq 1
|
81
|
+
expect(by_dir_debt.count).to eq 1
|
82
|
+
expect(by_dir_cred.first['Id']).to eq payin['Id']
|
83
|
+
expect(by_dir_debt.first['Id']).to eq payout['Id']
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,20 +1,28 @@
|
|
1
|
-
|
2
|
-
require_relative '
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
c.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
+
c.client_passphrase = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
|
12
|
+
c.temp_dir = File.expand_path('../tmp', __FILE__)
|
13
|
+
require 'fileutils'
|
14
|
+
FileUtils.mkdir_p(c.temp_dir) unless File.directory?(c.temp_dir)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
reset_mangopay_configuration
|
18
|
+
|
19
|
+
|
20
|
+
################################################################################
|
21
|
+
# uncomment it for logging all http calls in tests
|
22
|
+
#require 'http_logger'
|
23
|
+
#require 'logger'
|
24
|
+
#HttpLogger.logger = Logger.new(STDOUT)
|
25
|
+
#HttpLogger.colorize = true
|
26
|
+
#HttpLogger.log_headers = false
|
27
|
+
#HttpLogger.log_request_body = true
|
28
|
+
#HttpLogger.log_response_body = true
|
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.12
|
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: 2014-
|
12
|
+
date: 2014-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -29,72 +29,30 @@ dependencies:
|
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 10.1.0
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 10.1.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: 2.14.1
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 2.14.1
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: capybara
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 2.1.0
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 2.1.0
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: capybara-webkit
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - ~>
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: 1.0.0
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ~>
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: 1.0.0
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rails
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ~>
|
46
|
+
- - '>='
|
89
47
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
48
|
+
version: 3.0.0
|
91
49
|
type: :development
|
92
50
|
prerelease: false
|
93
51
|
version_requirements: !ruby/object:Gem::Requirement
|
94
52
|
requirements:
|
95
|
-
- -
|
53
|
+
- - '>='
|
96
54
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
55
|
+
version: 3.0.0
|
98
56
|
description: |2
|
99
57
|
The mangopay Gem makes interacting with MangoPay Services much easier.
|
100
58
|
For any questions regarding the use of MangoPay's Services feel free to contact us at http://www.mangopay.com/get-started-2/
|
@@ -127,9 +85,9 @@ files:
|
|
127
85
|
- lib/mangopay/kyc_document.rb
|
128
86
|
- lib/mangopay/legal_user.rb
|
129
87
|
- lib/mangopay/natural_user.rb
|
130
|
-
- lib/mangopay/
|
131
|
-
- lib/mangopay/
|
132
|
-
- lib/mangopay/
|
88
|
+
- lib/mangopay/pay_in.rb
|
89
|
+
- lib/mangopay/pay_out.rb
|
90
|
+
- lib/mangopay/pre_authorization.rb
|
133
91
|
- lib/mangopay/refund.rb
|
134
92
|
- lib/mangopay/resource.rb
|
135
93
|
- lib/mangopay/transaction.rb
|
@@ -138,27 +96,27 @@ files:
|
|
138
96
|
- lib/mangopay/version.rb
|
139
97
|
- lib/mangopay/wallet.rb
|
140
98
|
- mangopay.gemspec
|
141
|
-
- spec/
|
142
|
-
- spec/
|
143
|
-
- spec/
|
144
|
-
- spec/
|
145
|
-
- spec/
|
146
|
-
- spec/
|
147
|
-
- spec/
|
148
|
-
- spec/
|
149
|
-
- spec/
|
150
|
-
- spec/
|
151
|
-
- spec/
|
152
|
-
- spec/
|
153
|
-
- spec/
|
154
|
-
- spec/
|
155
|
-
- spec/
|
156
|
-
- spec/
|
157
|
-
- spec/
|
158
|
-
- spec/
|
159
|
-
- spec/
|
160
|
-
- spec/
|
161
|
-
- spec/
|
99
|
+
- spec/mangopay/authorization_token_spec.rb
|
100
|
+
- spec/mangopay/bank_account_spec.rb
|
101
|
+
- spec/mangopay/card_registration_spec.rb
|
102
|
+
- spec/mangopay/client_spec.rb
|
103
|
+
- spec/mangopay/configuration_spec.rb
|
104
|
+
- spec/mangopay/event_spec.rb
|
105
|
+
- spec/mangopay/fetch_filters_spec.rb
|
106
|
+
- spec/mangopay/hook_spec.rb
|
107
|
+
- spec/mangopay/kyc_document_spec.rb
|
108
|
+
- spec/mangopay/payin_bankwire_direct_spec.rb
|
109
|
+
- spec/mangopay/payin_card_direct_spec.rb
|
110
|
+
- spec/mangopay/payin_card_web_spec.rb
|
111
|
+
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
112
|
+
- spec/mangopay/payout_bankwire_spec.rb
|
113
|
+
- spec/mangopay/preauthorization_spec.rb
|
114
|
+
- spec/mangopay/refund_spec.rb
|
115
|
+
- spec/mangopay/shared_resources.rb
|
116
|
+
- spec/mangopay/transaction_spec.rb
|
117
|
+
- spec/mangopay/transfer_spec.rb
|
118
|
+
- spec/mangopay/user_spec.rb
|
119
|
+
- spec/mangopay/wallet_spec.rb
|
162
120
|
- spec/spec_helper.rb
|
163
121
|
- spec/tmp/.keep
|
164
122
|
homepage: http://docs.mangopay.com/
|
@@ -186,26 +144,26 @@ signing_key:
|
|
186
144
|
specification_version: 4
|
187
145
|
summary: Ruby bindings for the version 2 of the MangoPay API
|
188
146
|
test_files:
|
189
|
-
- spec/
|
190
|
-
- spec/
|
191
|
-
- spec/
|
192
|
-
- spec/
|
193
|
-
- spec/
|
194
|
-
- spec/
|
195
|
-
- spec/
|
196
|
-
- spec/
|
197
|
-
- spec/
|
198
|
-
- spec/
|
199
|
-
- spec/
|
200
|
-
- spec/
|
201
|
-
- spec/
|
202
|
-
- spec/
|
203
|
-
- spec/
|
204
|
-
- spec/
|
205
|
-
- spec/
|
206
|
-
- spec/
|
207
|
-
- spec/
|
208
|
-
- spec/
|
209
|
-
- spec/
|
147
|
+
- spec/mangopay/authorization_token_spec.rb
|
148
|
+
- spec/mangopay/bank_account_spec.rb
|
149
|
+
- spec/mangopay/card_registration_spec.rb
|
150
|
+
- spec/mangopay/client_spec.rb
|
151
|
+
- spec/mangopay/configuration_spec.rb
|
152
|
+
- spec/mangopay/event_spec.rb
|
153
|
+
- spec/mangopay/fetch_filters_spec.rb
|
154
|
+
- spec/mangopay/hook_spec.rb
|
155
|
+
- spec/mangopay/kyc_document_spec.rb
|
156
|
+
- spec/mangopay/payin_bankwire_direct_spec.rb
|
157
|
+
- spec/mangopay/payin_card_direct_spec.rb
|
158
|
+
- spec/mangopay/payin_card_web_spec.rb
|
159
|
+
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
160
|
+
- spec/mangopay/payout_bankwire_spec.rb
|
161
|
+
- spec/mangopay/preauthorization_spec.rb
|
162
|
+
- spec/mangopay/refund_spec.rb
|
163
|
+
- spec/mangopay/shared_resources.rb
|
164
|
+
- spec/mangopay/transaction_spec.rb
|
165
|
+
- spec/mangopay/transfer_spec.rb
|
166
|
+
- spec/mangopay/user_spec.rb
|
167
|
+
- spec/mangopay/wallet_spec.rb
|
210
168
|
- spec/spec_helper.rb
|
211
169
|
- spec/tmp/.keep
|