mangopay 3.32.0 → 3.33.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8e3054c801c2db4879dc5ee322b442204351fd2c96458345b865c7f30a8accf
4
- data.tar.gz: e59f212b984b311a3999c1f768532798c072d60f40d692d1a90ae755a81a01d7
3
+ metadata.gz: e2ea73775e3cbe39be6e8c2ab08353e325e4022c8e880c91ec39a2f7815158a5
4
+ data.tar.gz: e7a4e7daa408c976653cc7b45bb143e1e7d88b8c8267980bc26a03cd9483e100
5
5
  SHA512:
6
- metadata.gz: 74ce73c93504fbecef0a12d7ff98bd5f192700b90cf0e555063af16fabf88ffbdf6cb88e973e705f642e870c239bf306c624d97f8c8cc021008e88638cd9d6a1
7
- data.tar.gz: d48f4c254375d55ddd36e911fb7f84cd18f8eeb96ed28081501ed745249abacad3fd6a35ede4e6be972196c0611675e259fea41cdb8e0cee0687cd5d296e0a86
6
+ metadata.gz: a237843330abcee5203d85c86fcfcdf4d4e549b1ff3c0662f502d9d064de94de512dd358a26b930a55ae133852bf8aba5b92b91c3f92391806b1cc47797977e4
7
+ data.tar.gz: c15777f6e7043c031371dcf1aaca92ed2396402c68fa9a3c2d8ab0e8a8cf6bfdb4f516b55602d5fa32ae543bbb9254e0b3fc0f557630e7e1806601d3b4043a02
@@ -1,4 +1,4 @@
1
- name: mangopay2-net-ruby-cd
1
+ name: mangopay2-ruby-cd
2
2
 
3
3
  on:
4
4
  push:
@@ -1,4 +1,4 @@
1
- name: mangopay2-net-ruby-ci
1
+ name: mangopay2-ruby-ci
2
2
 
3
3
  on:
4
4
  push:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [3.33.0] - 2025-04-29
2
+ ### Added
3
+
4
+ #### SCA on wallet access endpoints
5
+
6
+ `ScaContext` query parameter added on wallet access endpoints for the [introduction of SCA](https://docs.mangopay.com/guides/sca/wallets):
7
+
8
+ - [GET View a Wallet](https://docs.mangopay.com/api-reference/wallets/view-wallet)
9
+ - [GET List Wallets for a User](https://docs.mangopay.com/api-reference/wallets/list-wallets-user)
10
+ - [GET List Transactions for a User](https://docs.mangopay.com/api-reference/transactions/list-transactions-user)
11
+ - [GET List Transactions for a Wallet](https://docs.mangopay.com/api-reference/transactions/list-transactions-wallet)
12
+
13
+ If SCA is required, Mangopay responds with a 401 response code. The `PendingUserAction` `RedirectUrl` is in the dedicated `WWW-Authenticate` response header.
14
+
15
+ See the tests for examples on handling this error.
16
+
17
+ #### BLIK with code
18
+ Support for [BLIK with code endpoint](https://docs.mangopay.com/api-reference/blik/create-blik-payin-with-code)
19
+
1
20
  ## [3.32.0] - 2025-04-16
2
21
  ### Added
3
22
 
@@ -52,8 +52,11 @@ module MangoPay
52
52
  # MangoPay::User.fetch(filter = {'page' => 2, 'per_page' => 3})
53
53
  # filter # => {"page"=>2, "per_page"=>3, "total_pages"=>1969, "total_items"=>5905}
54
54
  #
55
- def fetch(id_or_filters = nil, idempotency_key = nil)
55
+ def fetch(id_or_filters = nil, idempotency_key = nil, query_params_get_by_id = nil)
56
56
  id, filters = HTTPCalls::Fetch.parse_id_or_filters(id_or_filters)
57
+ if query_params_get_by_id != nil and query_params_get_by_id != {}
58
+ filters = query_params_get_by_id
59
+ end
57
60
  response = MangoPay.request(:get, url(id), {}, filters, idempotency_key)
58
61
  end
59
62
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.32.0'
2
+ VERSION = '3.33.0'
3
3
  end
data/lib/mangopay.rb CHANGED
@@ -234,6 +234,12 @@ module MangoPay
234
234
  end
235
235
 
236
236
  unless res.is_a?(Net::HTTPOK) or res.is_a?(Net::HTTPCreated) or res.is_a?(Net::HTTPNoContent)
237
+ if res.is_a?(Net::HTTPUnauthorized) and res['www-authenticate'] != nil
238
+ redirect_url = res['www-authenticate'][/RedirectUrl=(.+)/, 1]
239
+ data['RedirectUrl'] = redirect_url
240
+ data['message'] = 'SCA required to perform this action.'
241
+ raise MangoPay::ResponseError.new(uri, res.code, data)
242
+ end
237
243
  raise MangoPay::ResponseError.new(uri, res.code, data)
238
244
  end
239
245
 
@@ -17,6 +17,15 @@ describe MangoPay::PayIn::Blik::Web, type: :feature do
17
17
  expect(created['ReturnURL']).not_to be_nil
18
18
  check_type_and_status(created)
19
19
  end
20
+
21
+ it 'creates a blik web payin with code' do
22
+ created = new_payin_blik_web_with_code
23
+ expect(created['Id']).not_to be_nil
24
+ expect(created['Code']).not_to be_nil
25
+ expect(created['IpAddress']).not_to be_nil
26
+ expect(created['BrowserInfo']).not_to be_nil
27
+ check_type_and_status(created)
28
+ end
20
29
  end
21
30
 
22
31
  describe 'FETCH' do
@@ -577,7 +577,36 @@ shared_context 'payins' do
577
577
  Currency: 'PLN',
578
578
  Tag: 'Test wallet'
579
579
  )
580
- MangoPay::PayIn::Blik::Web.create(
580
+ MangoPay::PayIn::Blik::Web.create(define_new_blik(user, wallet))
581
+ end
582
+
583
+ let(:new_payin_blik_web_with_code) do
584
+ user = new_natural_user
585
+ wallet = MangoPay::Wallet.create(
586
+ Owners: [user['Id']],
587
+ Description: 'A test wallet',
588
+ Currency: 'PLN',
589
+ Tag: 'Test wallet'
590
+ )
591
+ blik = define_new_blik(user, wallet)
592
+ blik['Code'] = '777365'
593
+ blik['IpAddress'] = '159.180.248.187'
594
+ blik['BrowserInfo'] = {
595
+ AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
596
+ JavaEnabled: true,
597
+ Language: "FR-FR",
598
+ ColorDepth: 4,
599
+ ScreenHeight: 1800,
600
+ ScreenWidth: 400,
601
+ JavascriptEnabled: true,
602
+ TimeZoneOffset: "+60",
603
+ UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
604
+ }
605
+ MangoPay::PayIn::Blik::Web.create(blik)
606
+ end
607
+
608
+ def define_new_blik(user, wallet)
609
+ {
581
610
  AuthorId: user['Id'],
582
611
  CreditedWalletId: wallet['Id'],
583
612
  DebitedFunds: { Currency: 'PLN', Amount: 199 },
@@ -585,7 +614,7 @@ shared_context 'payins' do
585
614
  StatementDescriptor: "ruby",
586
615
  Tag: 'Test PayIn/Blik/Web',
587
616
  ReturnURL: 'https://example.com'
588
- )
617
+ }
589
618
  end
590
619
 
591
620
  ###############################################
@@ -240,6 +240,14 @@ describe MangoPay::User do
240
240
  expect(transactions_ids).to include payin['Id']
241
241
  expect(transactions_ids).to include payout['Id']
242
242
  end
243
+
244
+ it 'fetches transactions sca' do
245
+ begin
246
+ MangoPay::User.transactions(new_natural_user['Id'], {'ScaContext': 'USER_PRESENT'})
247
+ rescue MangoPay::ResponseError => ex
248
+ expect(ex.details['RedirectUrl']).not_to be_nil
249
+ end
250
+ end
243
251
  end
244
252
 
245
253
  describe 'FETCH WALLETS' do
@@ -256,6 +264,14 @@ describe MangoPay::User do
256
264
  expect(wallets.count).to eq 1
257
265
  expect(wallets.first['Id']).to eq wallet['Id']
258
266
  end
267
+
268
+ it 'fetches wallets sca' do
269
+ begin
270
+ MangoPay::User.wallets(new_natural_user['Id'], {'ScaContext': 'USER_PRESENT'})
271
+ rescue MangoPay::ResponseError => ex
272
+ expect(ex.details['RedirectUrl']).not_to be_nil
273
+ end
274
+ end
259
275
  end
260
276
 
261
277
  describe 'FETCH CARDS' do
@@ -27,6 +27,14 @@ describe MangoPay::Wallet do
27
27
  wallet = MangoPay::Wallet.fetch(new_wallet['Id'])
28
28
  expect(wallet['Id']).to eq(new_wallet['Id'])
29
29
  end
30
+
31
+ it 'fetches a wallet sca' do
32
+ begin
33
+ MangoPay::Wallet.fetch(new_wallet['Id'], nil, {'ScaContext': 'USER_PRESENT'})
34
+ rescue MangoPay::ResponseError => ex
35
+ expect(ex.details['RedirectUrl']).not_to be_nil
36
+ end
37
+ end
30
38
  end
31
39
 
32
40
  describe 'FETCH TRANSACTIONS' do
@@ -81,5 +89,12 @@ describe MangoPay::Wallet do
81
89
  expect(by_type_pyout.first['Id']).to eq payout['Id']
82
90
  end
83
91
 
92
+ it 'fetches transactions sca' do
93
+ begin
94
+ MangoPay::Wallet.transactions(new_wallet['Id'], {'ScaContext': 'USER_PRESENT'})
95
+ rescue MangoPay::ResponseError => ex
96
+ expect(ex.details['RedirectUrl']).not_to be_nil
97
+ end
98
+ end
84
99
  end
85
100
  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.32.0
4
+ version: 3.33.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: 2025-04-16 00:00:00.000000000 Z
12
+ date: 2025-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json