mangopay 3.0.36 → 3.0.37

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
  SHA256:
3
- metadata.gz: 8cd7631afb582279a222aeb5c81d6f8a507e47bc7a0a6e23e171f34c9e519034
4
- data.tar.gz: 472287e318eb7470c7020a09a889e9b9d630c98db2c095c7a8dd628cdffab223
3
+ metadata.gz: 95f96378128e4073bc8726a16a456a3fabfd34008a30f703cd8d22df86e8506e
4
+ data.tar.gz: e6f80ed1350bd81983a6919ced5bcb7052d3eb5bfe4829e942ff0f4a599ce779
5
5
  SHA512:
6
- metadata.gz: 8748baa780499d4881d9f9a8c9abcbaf5c804a5b9f5bbe78821bc79ea6e26773b40dbb056f6e459ab238e06f21328d87688db12e84cb6a78afb25f6b94f4f818
7
- data.tar.gz: 4e0360de8ff724d8ea0c22796fd719235e5effeea7cce897c6d0a177ebc9589b59d70846d7d7fa18257ce91447fa3bce6789a6dd0856795128ca1f45e69698b7
6
+ metadata.gz: 1b8a4718718e30c6b40e75f166998c39cedeb881b5b42bfdd8b6f0778e1f067c1eccea8d4269b1547e32a1e3cf2ecda56492d05a36423eb24247064a27ca7cb3
7
+ data.tar.gz: 7a736e8e088babb16034733569c3d04fd2d653f03eddaac925fd9951f8a7759d397a5da7925e864303073a79777a717abfe044263928a7cf900cf2ae1c00b84f
@@ -1,10 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
4
- - 2.1
5
- - 2.2
6
- - 2.3
7
- - 2.4
3
+ # - 2.0.0
4
+ # - 2.1
5
+ # - 2.2
6
+ # - 2.3
7
+ # - 2.4
8
8
  - 2.5
9
9
  script: bundle exec rspec
10
10
  deploy:
@@ -1,3 +1,9 @@
1
+ ## [3.0.37] - 2020-10-30
2
+ - Card Validation endpoint fully activated
3
+ - added pre authorizations transactions method
4
+ - added new methods for client bank accounts and payouts
5
+ - Send headers for different api calls
6
+
1
7
  ## [3.0.36] - 2020-08-28
2
8
  - Forces TLS version to 1.2
3
9
 
@@ -69,6 +69,19 @@ module MangoPay
69
69
  MangoPay.request(:get, url() + "/wallets/#{funds_type}/#{currency_iso_code}/transactions", {}, filters)
70
70
  end
71
71
 
72
+ def validate(client_id, card_id)
73
+ url = "#{MangoPay.api_path}/cards/#{card_id}/validate"
74
+ MangoPay.request(:post, url)
75
+ end
76
+
77
+ def create_bank_account(params)
78
+ MangoPay.request(:post, url() + "/bankaccounts/iban", params)
79
+ end
80
+
81
+ def create_payout(params)
82
+ MangoPay.request(:post, url() + "/payouts", params)
83
+ end
84
+
72
85
  end
73
86
  end
74
87
  end
@@ -9,5 +9,9 @@ module MangoPay
9
9
  MangoPay.request(:post, "#{url}/card/direct", params, {}, idempotency_key)
10
10
  end
11
11
 
12
+ def self.transactions(pre_authorization_id, filters = {})
13
+ MangoPay.request(:get, "#{url}/#{pre_authorization_id}/transactions", {}, filters)
14
+ end
15
+
12
16
  end
13
17
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.0.36'
2
+ VERSION = '3.0.37'
3
3
  end
@@ -1,4 +1,6 @@
1
1
  describe MangoPay::Client do
2
+ include_context 'users'
3
+ include_context 'payins'
2
4
 
3
5
  describe 'FETCH' do
4
6
  it 'fetches the current client details' do
@@ -40,7 +42,7 @@ describe MangoPay::Client do
40
42
  describe 'UPLOAD LOGO' do
41
43
  it 'accepts Base64 encoded file content' do
42
44
  fnm = __FILE__.sub('.rb', '.png')
43
- bts = File.open(fnm, 'rb') {|f| f.read}
45
+ bts = File.open(fnm, 'rb') { |f| f.read }
44
46
  b64 = Base64.encode64(bts)
45
47
  ret = MangoPay::Client.upload_logo(b64)
46
48
  expect(ret).to be_nil
@@ -54,7 +56,7 @@ describe MangoPay::Client do
54
56
 
55
57
  it 'fails when input string is not base64-encoded' do
56
58
  file = 'any file content...'
57
- expect {MangoPay::Client.upload_logo(file)}.to raise_error {|err|
59
+ expect { MangoPay::Client.upload_logo(file) }.to raise_error { |err|
58
60
  expect(err).to be_a MangoPay::ResponseError
59
61
  expect(err.code).to eq '400'
60
62
  expect(err.type).to eq 'param_error'
@@ -73,14 +75,14 @@ describe MangoPay::Client do
73
75
  wlts = MangoPay::Client.fetch_wallets('fees')
74
76
  expect(wlts).to be_kind_of(Array)
75
77
  expect(wlts).not_to be_empty
76
- expect((wlts.map {|m| m['FundsType']}).uniq).to eq(['FEES'])
78
+ expect((wlts.map { |m| m['FundsType'] }).uniq).to eq(['FEES'])
77
79
  end
78
80
 
79
81
  it 'fetches all client credit wallets' do
80
82
  wlts = MangoPay::Client.fetch_wallets('credit')
81
83
  expect(wlts).to be_kind_of(Array)
82
84
  expect(wlts).not_to be_empty
83
- expect((wlts.map {|m| m['FundsType']}).uniq).to eq(['CREDIT'])
85
+ expect((wlts.map { |m| m['FundsType'] }).uniq).to eq(['CREDIT'])
84
86
  end
85
87
  end
86
88
 
@@ -124,4 +126,68 @@ describe MangoPay::Client do
124
126
  end
125
127
  end
126
128
 
129
+ describe 'validate' do
130
+ it 'validates card' do
131
+ client = MangoPay::Client.fetch
132
+ completed = new_card_registration_completed
133
+ card_id = completed['CardId']
134
+ client_id = client['ClientId']
135
+
136
+ card = MangoPay::Client.validate(client_id, card_id)
137
+ expect(client).not_to be_nil
138
+ expect(card).not_to be_nil
139
+ end
140
+ end
141
+
142
+ describe 'create_bank_account' do
143
+ it 'creates a new bank account' do
144
+ bank_account = MangoPay::Client.create_bank_account(Type: 'IBAN',
145
+ OwnerName: 'John',
146
+ OwnerAddress: {
147
+ AddressLine1: 'Le Palais Royal',
148
+ AddressLine2: '8 Rue de Montpensier',
149
+ City: 'Paris',
150
+ Region: '',
151
+ PostalCode: '75001',
152
+ Country: 'FR'
153
+ },
154
+ IBAN: 'FR7618829754160173622224154',
155
+ BIC: 'CMBRFR2BCME',
156
+ Tag: 'Test bank account')
157
+ expect(bank_account).not_to be_nil
158
+ expect(bank_account['Id']).not_to be_nil
159
+ end
160
+ end
161
+
162
+ describe 'create_payout' do
163
+ it 'creates a new payout' do
164
+ wallets = MangoPay::Client.fetch_wallets('FEES')
165
+ bank_account = MangoPay::Client.create_bank_account(Type: 'IBAN',
166
+ OwnerName: 'John',
167
+ OwnerAddress: {
168
+ AddressLine1: 'Le Palais Royal',
169
+ AddressLine2: '8 Rue de Montpensier',
170
+ City: 'Paris',
171
+ Region: '',
172
+ PostalCode: '75001',
173
+ Country: 'FR'
174
+ },
175
+ IBAN: 'FR7618829754160173622224154',
176
+ BIC: 'CMBRFR2BCME',
177
+ Tag: 'Test bank account')
178
+ pay_out = MangoPay::Client.create_payout(BankAccountId: bank_account['Id'],
179
+
180
+ DebitedFunds: {
181
+ Currency: 'EUR',
182
+ Amount: 12
183
+ },
184
+ DebitedWalletId: wallets[0]['Id'],
185
+ BankWireRef: 'invoice 7282',
186
+ Tag: 'bla')
187
+
188
+ expect(pay_out).not_to be_nil
189
+ expect(pay_out['Id']).not_to be_nil
190
+ end
191
+ end
192
+
127
193
  end
@@ -18,7 +18,9 @@ describe MangoPay::PayIn::PreAuthorized::Direct, type: :feature do
18
18
  describe 'CREATE' do
19
19
  it 'creates a preauthorized direct payin' do
20
20
  created = new_payin_preauthorized_direct
21
+ transactions = MangoPay::PreAuthorization.transactions(created['PreauthorizationId'])
21
22
  expect(created['Id']).not_to be_nil
23
+ expect(transactions[0]['Status']).to eq('SUCCEEDED')
22
24
  check_type_and_status(created)
23
25
  end
24
26
  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.36
4
+ version: 3.0.37
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: 2020-08-28 00:00:00.000000000 Z
12
+ date: 2020-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json