mangopay 3.0.35 → 3.2.0

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: da86f380ab29a146392b6ba79b5d5518f9dc898c5a22abadfbdfc1e3a93443bc
4
- data.tar.gz: 6a938c0de24f0018ae2c6f0ab4f52ef01334f73a6131aea02b1d5affff317540
3
+ metadata.gz: efb0b3e0cf693443b3c9e18d1553a029762cf2263d6ca10d72cd1e19a075de21
4
+ data.tar.gz: f3a81ab3ed039247efec2bc76f48fe2c28dafb097d6211fbae1d6394b49f8a4d
5
5
  SHA512:
6
- metadata.gz: 112d5afb9ec05f57cf718598c4aebb92f0d5bb68e2647c49706c598e0a98b983067b023a78e7b78075951a160f23fb21c3e033b66c41de03cfe6676867d8276c
7
- data.tar.gz: fd0b5fe4b3be196ca0969d8be3c71308b532d64f6d0710f8a2b379e797a0c05d648c8cdce1719f4d51bcfa7c7641324a418b877d5864e732974f1b65ab4706a7
6
+ metadata.gz: c3132d0152e7c24690c347d761d3d41dfe1e264ae9a7918590cf792223ee7ba071919ef7339a29bfe21fc33a63297c147c5c5cf9d5a84274119acc052de37ad0
7
+ data.tar.gz: 1634c646e41c4948dae6abb69fa93319c28b1e7e1cd3ce4383aa966b2b058808fb94e5f4a8f1b448b746475e42c7a09aa4a5c1a4a84d0568bcccb77ed2f61d87
data/.travis.yml CHANGED
@@ -1,12 +1,13 @@
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
- script: bundle exec rspec
9
+ script:
10
+ - if [ $TRAVIS_BRANCH != "release" ]; then bundle exec rspec; fi
10
11
  deploy:
11
12
  provider: rubygems
12
13
  api_key:
data/CHANGELOG.md CHANGED
@@ -1,6 +1,59 @@
1
+ ## [3.2.0]
2
+ ## Added
3
+
4
+ ### On demand feature for 3DSv2
5
+
6
+ > **This on-demand feature is for testing purposes only and will not be available in production**
7
+
8
+ #### Request
9
+
10
+ We've added a new parameter `Requested3DSVersion` (not mandatory) that allows you to choose between versions of 3DS protocols (managed by the parameter `SecureMode`). Two values are available:
11
+ * `V1`
12
+ * `V2_1`
13
+
14
+ If nothing is sent, the flow will be 3DS V1.
15
+
16
+ The `Requested3DSVersion` may be included on all calls to the following endpoints:
17
+ * `/preauthorizations/card/direct`
18
+ * `/payins/card/direct`
19
+
20
+ #### Response
21
+
22
+ In the API response, the `Requested3DSVersion` will show the value you requested:
23
+ * `V1`
24
+ * `V2_1`
25
+ * `null` – indicates that nothing was requested
26
+
27
+ The parameter `Applied3DSVersion` shows you the version of the 3DS protocol used. Two values are possible:
28
+ * `V1`
29
+ * `V2_1`
30
+
31
+
32
+
33
+
34
+ ## [3.1.0]
35
+ - 3DS2 integration with Shipping and Billing objects, including FirstName and LastName fields
36
+ The objects Billing and Shipping may be included on all calls to the following endpoints:
37
+ - /preauthorizations/card/direct
38
+ - /payins/card/direct
39
+ - /payins/card/web
40
+ - Enable Instant Payment for payouts by adding a new parameter PayoutModeRequested on the following endpoint /payouts/bankwire
41
+ - The new parameter PayoutModeRequested can take two differents values : "INSTANT_PAYMENT" or "STANDARD" (STANDARD = the way we procede normaly a payout request)
42
+ - This new parameter is not mandatory and if empty or not present, the payout will be "STANDARD" by default
43
+ - Instant Payment is in beta all over Europe - SEPA region
44
+ - Add test on new payout mode PayoutModeRequested
45
+ ## [3.0.37] - 2020-10-30
46
+ - Card Validation endpoint fully activated
47
+ - added pre authorizations transactions method
48
+ - added new methods for client bank accounts and payouts
49
+ - Send headers for different api calls
50
+
51
+ ## [3.0.36] - 2020-08-28
52
+ - Forces TLS version to 1.2
53
+
1
54
  ## [3.0.35] - 2020-08-24
2
- -> Improvement to Net::ReadTimeout handling
3
- -> "User-agent" format in the headers changed, aligned to other assets 👤
55
+ - Improvement to Net::ReadTimeout handling
56
+ - "User-agent" format in the headers changed, aligned to other assets 👤
4
57
 
5
58
  ## [3.0.34] - 2020-06-25
6
59
  ### Added
data/README.md CHANGED
@@ -15,12 +15,12 @@ Since [v3.0.17](https://github.com/Mangopay/mangopay2-ruby-sdk/releases/tag/v3.0
15
15
 
16
16
  Account creation
17
17
  -------------------------------------------------
18
- You can get yourself a [free sandbox account](https://www.mangopay.com/signup/create-sandbox/) or sign up for a [production account](https://www.mangopay.com/signup/production-account/) (note that validation of your production account can take a few days, so think about doing it in advance of when you actually want to go live).
18
+ You can get yourself a free sandbox account or sign up for a production account by [registering on the Mangopay site](https://www.mangopay.com/start/) (note that validation of your production account involves several steps, so think about doing it in advance of when you actually want to go live).
19
19
 
20
20
  ## Usage
21
21
 
22
22
  ### Install
23
- * You can get yourself a [free sandbox account](https://www.mangopay.com/get-started/create-sandbox/) or sign up for a [production account](https://www.mangopay.com/signup/production-account/) (note that validation of your production account can take a few days, so think about doing it in advance of when you actually want to go live).
23
+ * You can get yourself a free sandbox account or sign up for a production account [on the Mangopay site](https://www.mangopay.com/start/) (note that validation of your production account will involve several steps, so think about doing it in advance of when you actually want to go live).
24
24
 
25
25
  * Install the gem by either running ```gem install mangopay```
26
26
  or by adding it to your Gemfile ```gem 'mangopay'```
data/lib/mangopay.rb CHANGED
@@ -135,7 +135,7 @@ module MangoPay
135
135
  headers['Idempotency-Key'] = headers_or_idempotency_key if headers_or_idempotency_key != nil
136
136
  end
137
137
 
138
- res = Net::HTTP.start(uri.host, uri.port, use_ssl: true, :read_timeout => configuration.http_timeout) do |http|
138
+ res = Net::HTTP.start(uri.host, uri.port, use_ssl: true, :read_timeout => configuration.http_timeout, ssl_version: :TLSv1_2) do |http|
139
139
  req = Net::HTTP::const_get(method.capitalize).new(uri.request_uri, headers)
140
140
  req.body = JSON.dump(params)
141
141
  before_request_proc.call(req) if before_request_proc
@@ -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
@@ -39,12 +39,12 @@ module MangoPay
39
39
  @@res_confidential_params ||= [
40
40
  'access_token', 'AccessKey', 'IBAN', 'CardRegistrationURL',
41
41
  'PreregistrationData', 'RedirectURL', 'RegistrationData',
42
- 'SecureModeRedirectUrl'
42
+ 'SecureModeRedirectUrl', 'OwnerName', 'OwnerAddress', 'BIC'
43
43
  ].freeze
44
44
  end
45
45
 
46
46
  def self.req_confidential_params
47
- @@req_confidential_params ||= ['File', 'IBAN'].freeze
47
+ @@req_confidential_params ||= ['File', 'IBAN', 'OwnerName', 'OwnerAddress', 'BIC'].freeze
48
48
  end
49
49
 
50
50
  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
data/lib/mangopay/user.rb CHANGED
@@ -64,6 +64,16 @@ module MangoPay
64
64
  def pre_authorizations(user_id, filters = {})
65
65
  MangoPay.request(:get, url(user_id) + '/preauthorizations', {}, filters)
66
66
  end
67
+
68
+ # Fetches User Block Status
69
+ def block_status(user_id, filters = {})
70
+ MangoPay.request(:get, url(user_id) + '/blockStatus', {}, filters)
71
+ end
72
+
73
+ # Fetches User Regulatory
74
+ def regulatory(user_id, filters = {})
75
+ MangoPay.request(:get, url(user_id) + '/Regulatory', {}, filters)
76
+ end
67
77
  end
68
78
  end
69
79
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.0.35'
2
+ VERSION = '3.2.0'
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,69 @@ 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
+ PayoutModeRequested: 'STANDARD',
187
+ Tag: 'bla')
188
+
189
+ expect(pay_out).not_to be_nil
190
+ expect(pay_out['Id']).not_to be_nil
191
+ end
192
+ end
193
+
127
194
  end
@@ -11,6 +11,7 @@ describe MangoPay::PayIn::ApplePay::Direct, type: :feature do
11
11
 
12
12
  describe 'CREATE' do
13
13
  it 'creates a applepay direct payin' do
14
+ #pending("no cards to test for")
14
15
  created = new_payin_applepay_direct
15
16
  expect(created['Id']).not_to be_nil
16
17
  check_type_and_status(created)
@@ -19,6 +19,7 @@ describe MangoPay::PayIn::Card::Direct, type: :feature do
19
19
  it 'creates a card direct payin' do
20
20
  created = new_payin_card_direct
21
21
  expect(created['Id']).not_to be_nil
22
+ expect(created['Requested3DSVersion']).not_to be_nil
22
23
  check_type_and_status(created)
23
24
  end
24
25
  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
@@ -15,6 +15,7 @@ describe MangoPay::PreAuthorization do
15
15
  expect(created['PaymentStatus']).to eq('WAITING')
16
16
  expect(created['PaymentType']).to eq('CARD')
17
17
  expect(created['ExecutionType']).to eq('DIRECT')
18
+ expect(created['Requested3DSVersion']).to eq('V1')
18
19
  end
19
20
  end
20
21
 
@@ -368,7 +368,8 @@ shared_context 'payins' do
368
368
  CardType: 'CB_VISA_MASTERCARD',
369
369
  CardId: cardreg['CardId'],
370
370
  SecureModeReturnURL: 'http://test.com',
371
- Tag: 'Test PayIn/Card/Direct'
371
+ Tag: 'Test PayIn/Card/Direct',
372
+ Requested3DSVersion: 'V1'
372
373
  )
373
374
  end
374
375
 
@@ -385,7 +386,8 @@ shared_context 'payins' do
385
386
  CardId: cardreg['CardId'],
386
387
  SecureMode: 'DEFAULT',
387
388
  SecureModeReturnURL: 'http://test.com',
388
- Tag: 'Test Card PreAuthorization'
389
+ Tag: 'Test Card PreAuthorization',
390
+ Requested3DSVersion: 'V1'
389
391
  )
390
392
  end
391
393
 
@@ -208,4 +208,14 @@ describe MangoPay::User do
208
208
  expect(pre_authorizations).to be_an(Array)
209
209
  end
210
210
  end
211
+
212
+ =begin
213
+ describe 'FETCH Block Status' do
214
+ it "fetches user's block status" do
215
+ legal_user = new_legal_user
216
+ block_status = MangoPay::User.block_status(legal_user['Id'])
217
+ expect(block_status).to_not be_nil
218
+ end
219
+ end
220
+ =end
211
221
  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.35
4
+ version: 3.2.0
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-25 00:00:00.000000000 Z
12
+ date: 2021-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json