mangopay 3.0.1 → 3.0.2
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/.gitignore +1 -1
- data/README.md +43 -14
- data/lib/mangopay.rb +43 -34
- data/lib/mangopay/authorization_token.rb +76 -0
- data/lib/mangopay/bank_account.rb +14 -7
- data/lib/mangopay/client.rb +11 -17
- data/lib/mangopay/errors.rb +22 -2
- data/lib/mangopay/http_calls.rb +24 -2
- data/lib/mangopay/legal_user.rb +1 -1
- data/lib/mangopay/natural_user.rb +1 -1
- data/lib/mangopay/payin.rb +2 -2
- data/lib/mangopay/payout.rb +1 -1
- data/lib/mangopay/resource.rb +1 -1
- data/lib/mangopay/transaction.rb +17 -2
- data/lib/mangopay/version.rb +1 -1
- data/spec/lib/mangopay/authorization_token_spec.rb +72 -0
- data/spec/lib/mangopay/bank_account_spec.rb +25 -26
- data/spec/lib/mangopay/card_registration_spec.rb +40 -16
- data/spec/lib/mangopay/client_spec.rb +14 -9
- data/spec/lib/mangopay/configuration_spec.rb +20 -0
- data/spec/lib/mangopay/fetch_filters_spec.rb +65 -0
- data/spec/lib/mangopay/payin_card_direct_spec.rb +70 -0
- data/spec/lib/mangopay/payin_card_web_spec.rb +53 -0
- data/spec/lib/mangopay/payout_bankwire_spec.rb +56 -0
- data/spec/lib/mangopay/shared_resources.rb +123 -82
- data/spec/lib/mangopay/transaction_spec.rb +48 -2
- data/spec/lib/mangopay/transfer_spec.rb +51 -15
- data/spec/lib/mangopay/user_spec.rb +1 -0
- data/spec/lib/mangopay/wallet_spec.rb +31 -32
- data/spec/spec_helper.rb +11 -4
- data/spec/tmp/.keep +0 -0
- metadata +17 -8
- data/spec/lib/mangopay/card_spec.rb +0 -35
- data/spec/lib/mangopay/payin_spec.rb +0 -34
- data/spec/lib/mangopay/payout_spec.rb +0 -34
@@ -1,32 +1,31 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe MangoPay::Wallet do
|
4
|
-
include_context '
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
expect(new_wallet['
|
10
|
-
expect(new_wallet['Balance']['
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
expect(updated_wallet['
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
wallet
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe MangoPay::Wallet do
|
4
|
+
include_context 'wallets'
|
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
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,11 +3,18 @@ require_relative './lib/mangopay/shared_resources'
|
|
3
3
|
|
4
4
|
require 'capybara/rspec'
|
5
5
|
require 'capybara-webkit'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'pp'
|
6
8
|
|
7
9
|
Capybara.default_driver = :webkit
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
def reset_mangopay_configuration
|
12
|
+
MangoPay.configure do |c|
|
13
|
+
c.preproduction = true
|
14
|
+
c.client_id = 'example'
|
15
|
+
c.client_passphrase = 'uyWsmnwMQyTnqKgi8Y35A3eVB7bGhqrebYqA1tL6x2vYNpGPiY'
|
16
|
+
c.temp_dir = File.expand_path('../tmp', __FILE__)
|
17
|
+
FileUtils.mkdir_p(c.temp_dir) unless File.directory?(c.temp_dir)
|
18
|
+
end
|
13
19
|
end
|
20
|
+
reset_mangopay_configuration
|
data/spec/tmp/.keep
ADDED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffroy Lorieux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/generators/mangopay/install_generator.rb
|
114
114
|
- lib/generators/templates/mangopay.rb
|
115
115
|
- lib/mangopay.rb
|
116
|
+
- lib/mangopay/authorization_token.rb
|
116
117
|
- lib/mangopay/bank_account.rb
|
117
118
|
- lib/mangopay/card.rb
|
118
119
|
- lib/mangopay/card_registration.rb
|
@@ -131,18 +132,22 @@ files:
|
|
131
132
|
- lib/mangopay/version.rb
|
132
133
|
- lib/mangopay/wallet.rb
|
133
134
|
- mangopay.gemspec
|
135
|
+
- spec/lib/mangopay/authorization_token_spec.rb
|
134
136
|
- spec/lib/mangopay/bank_account_spec.rb
|
135
137
|
- spec/lib/mangopay/card_registration_spec.rb
|
136
|
-
- spec/lib/mangopay/card_spec.rb
|
137
138
|
- spec/lib/mangopay/client_spec.rb
|
138
|
-
- spec/lib/mangopay/
|
139
|
-
- spec/lib/mangopay/
|
139
|
+
- spec/lib/mangopay/configuration_spec.rb
|
140
|
+
- spec/lib/mangopay/fetch_filters_spec.rb
|
141
|
+
- spec/lib/mangopay/payin_card_direct_spec.rb
|
142
|
+
- spec/lib/mangopay/payin_card_web_spec.rb
|
143
|
+
- spec/lib/mangopay/payout_bankwire_spec.rb
|
140
144
|
- spec/lib/mangopay/shared_resources.rb
|
141
145
|
- spec/lib/mangopay/transaction_spec.rb
|
142
146
|
- spec/lib/mangopay/transfer_spec.rb
|
143
147
|
- spec/lib/mangopay/user_spec.rb
|
144
148
|
- spec/lib/mangopay/wallet_spec.rb
|
145
149
|
- spec/spec_helper.rb
|
150
|
+
- spec/tmp/.keep
|
146
151
|
homepage: http://www.mangopay.com/
|
147
152
|
licenses:
|
148
153
|
- MIT
|
@@ -168,15 +173,19 @@ signing_key:
|
|
168
173
|
specification_version: 4
|
169
174
|
summary: Ruby bindings for the version 2 of the MangoPay API
|
170
175
|
test_files:
|
176
|
+
- spec/lib/mangopay/authorization_token_spec.rb
|
171
177
|
- spec/lib/mangopay/bank_account_spec.rb
|
172
178
|
- spec/lib/mangopay/card_registration_spec.rb
|
173
|
-
- spec/lib/mangopay/card_spec.rb
|
174
179
|
- spec/lib/mangopay/client_spec.rb
|
175
|
-
- spec/lib/mangopay/
|
176
|
-
- spec/lib/mangopay/
|
180
|
+
- spec/lib/mangopay/configuration_spec.rb
|
181
|
+
- spec/lib/mangopay/fetch_filters_spec.rb
|
182
|
+
- spec/lib/mangopay/payin_card_direct_spec.rb
|
183
|
+
- spec/lib/mangopay/payin_card_web_spec.rb
|
184
|
+
- spec/lib/mangopay/payout_bankwire_spec.rb
|
177
185
|
- spec/lib/mangopay/shared_resources.rb
|
178
186
|
- spec/lib/mangopay/transaction_spec.rb
|
179
187
|
- spec/lib/mangopay/transfer_spec.rb
|
180
188
|
- spec/lib/mangopay/user_spec.rb
|
181
189
|
- spec/lib/mangopay/wallet_spec.rb
|
182
190
|
- spec/spec_helper.rb
|
191
|
+
- spec/tmp/.keep
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe MangoPay::Card do
|
4
|
-
|
5
|
-
# TODO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
6
|
-
# include_context 'users'
|
7
|
-
# include_context 'card'
|
8
|
-
|
9
|
-
# describe 'CREATE' do
|
10
|
-
# it 'creates a new card' do
|
11
|
-
#pp new_card
|
12
|
-
# expect(new_card['Id']).not_to be_nil
|
13
|
-
# expect(new_card['Id'].to_i).to be > 0
|
14
|
-
# expect(new_card['Currency']).to eq('EUR')
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# describe 'UPDATE' do
|
19
|
-
# it 'updates a card' do
|
20
|
-
# updated = MangoPay::Card.update(new_card['Id'] ,{
|
21
|
-
# ___SomeProperty___: 'test value of ___SomeProperty___'
|
22
|
-
# })
|
23
|
-
# expect(updated['___SomeProperty___']).to eq('test value of ___SomeProperty___')
|
24
|
-
# end
|
25
|
-
# end
|
26
|
-
#
|
27
|
-
# describe 'FETCH' do
|
28
|
-
# it 'fetches a card' do
|
29
|
-
# fetched = MangoPay::Card.fetch(new_card['Id'])
|
30
|
-
# expect(fetched['Id']).to eq(new_card['Id'])
|
31
|
-
# expect(fetched['Tag']).to eq(new_card['Tag'])
|
32
|
-
# end
|
33
|
-
# end
|
34
|
-
|
35
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe MangoPay::PayIn::Card::Web, type: :feature do
|
4
|
-
include_context 'users'
|
5
|
-
include_context 'wallets'
|
6
|
-
include_context 'payin_card_web'
|
7
|
-
|
8
|
-
describe 'CREATE' do
|
9
|
-
it 'creates a card web payin' do
|
10
|
-
expect(new_payin_card_web['Id']).not_to be_nil
|
11
|
-
#expect(new_payin_card_web['Status']).to eq('SUCCEEDED') # cannot test yet
|
12
|
-
expect(new_payin_card_web['Status']).to eq('CREATED')
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'FETCH' do
|
17
|
-
it 'fetches a payin' do
|
18
|
-
payin = MangoPay::PayIn.fetch(new_payin_card_web['Id'])
|
19
|
-
expect(payin['Id']).to eq(new_payin_card_web['Id'])
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe 'REFUND' do
|
24
|
-
it 'refunds a payin' do
|
25
|
-
payin_refund = MangoPay::PayIn.refund(new_payin_card_web['Id'], {
|
26
|
-
AuthorId: new_payin_card_web['AuthorId']
|
27
|
-
})
|
28
|
-
expect(payin_refund['Id']).not_to be_nil
|
29
|
-
#expect(payin_refund['Status']).to eq('SUCCEEDED') # cannot test yet
|
30
|
-
expect(payin_refund['Status']).to be_nil
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe MangoPay::PayOut::BankWire, type: :feature do
|
4
|
-
include_context 'users'
|
5
|
-
include_context 'wallets'
|
6
|
-
include_context 'bank_details'
|
7
|
-
include_context 'payin_card_web'
|
8
|
-
include_context 'payout_bankwire'
|
9
|
-
|
10
|
-
describe 'CREATE' do
|
11
|
-
it 'fails cause not enough money' do
|
12
|
-
expect(new_payout_bankwire['Message']).to eq("The amount you wish to spend must be smaller than the amount left in your collection.")
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
# cannot test yet:
|
17
|
-
# describe 'CREATE' do
|
18
|
-
# it 'creates a bank wire payout' do
|
19
|
-
# expect(new_payout_bankwire['Id']).not_to be_nil
|
20
|
-
# #expect(new_payout_bankwire['Status']).to eq('CREATED')
|
21
|
-
# expect(new_payout_bankwire['Status']).to be_nil
|
22
|
-
# "The amount you wish to spend must be smaller than the amount left in your collection."
|
23
|
-
# end
|
24
|
-
# end
|
25
|
-
#
|
26
|
-
# describe 'FETCH' do
|
27
|
-
# it 'fetches a payout' do
|
28
|
-
# bank_wire = MangoPay::PayOut.fetch(new_payout_bankwire['Id'])
|
29
|
-
# expect(bank_wire['Id']).to eq(new_payout_bankwire['Id'])
|
30
|
-
# expect(new_payout_bankwire['Status']).to eq('CREATED')
|
31
|
-
# end
|
32
|
-
# end
|
33
|
-
|
34
|
-
end
|