mangopay 3.0.26 → 3.0.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c19ff2ef0f7aa01b41358106dd62a827816285b
4
- data.tar.gz: 4d5324d03c874f70950a7eeb1ee643bddf2367c7
3
+ metadata.gz: 96bc27cb89ac223b63f92df2b3829e9916b88783
4
+ data.tar.gz: eff362d7ca2ca3678a37ca0a8aacc3297c26c2aa
5
5
  SHA512:
6
- metadata.gz: e49f9d0f623fc9bbd564182b65d41eff6d39e9a1f0beaf6cfe47263892ca241d2655ce78b633245e9fc4f70209e1f8e387a8101a22f2632e1d4a94ed6b50100d
7
- data.tar.gz: 7e3edc86ee6bb3eaa7a3d6462b3e836e23ce000b6b80183da025fa31f7724b0186f82b99a5ffcc1ddfdcc190cfca8aa9a60f1bfc7b4094be0cbe72174f5fe4b1
6
+ metadata.gz: 9f544a5e67d734e3aab210e388ae2307fa087856a9acc142aafc2b598fa94a086a95896ae8ddce70a077695b8a1ead6168fbb5ca17a6acf15a5c41ca7e64414f
7
+ data.tar.gz: 84aa434caaf6d4144d986ca711ca310c337f2761fe0ea59bee93ecdc13d1abf067c2dee5ca057787c36a76c4c9a7663e2b971aa8d7305d1e53c75d5db0c2105e
data/README.md CHANGED
@@ -55,6 +55,9 @@ pagination = {'page' => 1, 'per_page' => 8} # get 1st page, 8 items per page
55
55
  users = MangoPay::User.fetch(pagination) # => [{...}, ...]: list of 8 users data hashes
56
56
  pagination # => {"page"=>1, "per_page"=>8, "total_pages"=>748, "total_items"=>5978}
57
57
 
58
+ # pass custom filters (transactions reporting filters)
59
+ filters = {'MinFeesAmount' => 1, 'MinFeesCurrency' => 'EUR', 'MaxFeesAmount' => 1000, 'MaxFeesCurrency' => 'EUR'}
60
+ reports = MangoPay::Report.fetch(filters) # => [{...}, ...]: list of transaction reports between 1 and 1000 EUR
58
61
 
59
62
  # get John's bank accounts
60
63
  accounts = MangoPay::BankAccount.fetch(john_id) # => [{...}, ...]: list of accounts data hashes (10 per page by default)
@@ -21,6 +21,7 @@ module MangoPay
21
21
  cfg = MangoPay.configuration
22
22
  req.basic_auth cfg.client_id, cfg.client_passphrase
23
23
  req.body = 'grant_type=client_credentials'
24
+ req.add_field('Content-Type', 'application/x-www-form-urlencoded')
24
25
  end)
25
26
  token['timestamp'] = Time.now + (token['expires_in'].to_i - 10)
26
27
  token['environment_key'] = env_key
data/lib/mangopay/user.rb CHANGED
@@ -38,6 +38,15 @@ module MangoPay
38
38
  def transactions(user_id, filters={})
39
39
  MangoPay.request(:get, url(user_id) + '/transactions', {}, filters)
40
40
  end
41
+
42
+ # View EMoney belonging to the given +user_id+.
43
+ # Optional +filters+ is a hash accepting following keys:
44
+ # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
45
+ # - other keys specific for transactions filtering (see MangoPay::Transaction#fetch)
46
+ def emoney(user_id, filters={})
47
+ MangoPay.request(:get, url(user_id) + '/emoney', {}, filters)
48
+ end
49
+
41
50
  end
42
51
  end
43
52
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.0.26'
2
+ VERSION = '3.0.27'
3
3
  end
@@ -140,6 +140,10 @@ and it's infact not suitable like that
140
140
 
141
141
  it 'updates dispute document' do
142
142
  created_doc = create_doc
143
+
144
+ fnm = __FILE__.sub('.rb', '.png')
145
+ ret = MangoPay::Dispute.create_document_page(created_doc['dispute']['Id'], created_doc['Id'], nil, fnm)
146
+
143
147
  changed_doc = MangoPay::Dispute.update_document(created_doc['dispute']['Id'], created_doc['Id'], {
144
148
  Status: 'VALIDATION_ASKED'
145
149
  })
@@ -13,6 +13,9 @@ describe MangoPay::KycDocument do
13
13
 
14
14
  describe 'UPDATE' do
15
15
  it 'updates a document' do
16
+ fnm = __FILE__.sub('.rb', '.png')
17
+ ret = MangoPay::KycDocument.create_page(new_natural_user['Id'], new_document['Id'], nil, fnm)
18
+
16
19
  updated_document = MangoPay::KycDocument.update(new_natural_user['Id'], new_document['Id'], {
17
20
  Status: 'VALIDATION_ASKED'
18
21
  })
@@ -117,6 +117,16 @@ describe MangoPay::User do
117
117
  expect(cards.count).to eq 1
118
118
  expect(cards.first['Id']).to eq card['CardId']
119
119
  end
120
+
121
+ it 'fetches card details' do
122
+ card = new_card_registration_completed
123
+ fetched = MangoPay::Card.fetch(card['CardId'])
124
+
125
+ expect(fetched['Id']).not_to be_nil
126
+ expect(fetched['Id'].to_i).to be > 0
127
+ expect(fetched['UserId']).to eq(new_natural_user["Id"])
128
+ expect(fetched['Currency']).to eq('EUR')
129
+ end
120
130
  end
121
131
 
122
132
  describe 'FETCH BANK ACCOUNTS' do
@@ -134,4 +144,15 @@ describe MangoPay::User do
134
144
  expect(bank_accounts.first['Id']).to eq bank_account['Id']
135
145
  end
136
146
  end
147
+
148
+ describe 'FETCH EMONEY' do
149
+ it 'fetches emoney for the user' do
150
+ emoney = MangoPay::User.emoney(new_natural_user['Id'])
151
+ expect(emoney['UserId']).to eq new_natural_user['Id']
152
+ expect(emoney['CreditedEMoney']['Amount']).to eq 0
153
+ expect(emoney['CreditedEMoney']['Currency']).to eq 'EUR'
154
+ expect(emoney['DebitedEMoney']['Amount']).to eq 0
155
+ expect(emoney['DebitedEMoney']['Currency']).to eq 'EUR'
156
+ end
157
+ end
137
158
  end
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.26
4
+ version: 3.0.27
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: 2017-03-02 00:00:00.000000000 Z
12
+ date: 2017-05-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  requirements: []
160
160
  rubyforge_project:
161
- rubygems_version: 2.6.8
161
+ rubygems_version: 2.6.11
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: Ruby bindings for the version 2 of the MANGOPAY API