mangopay 3.32.0 → 3.34.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: 9a183b9490a45fa73745d864f9643d9afec4e4ea56b002784e2b888ae7886b7b
4
+ data.tar.gz: 4079521fab8f807345c218e00510e5197d4cb05d8afc4cbd4a332e5231650100
5
5
  SHA512:
6
- metadata.gz: 74ce73c93504fbecef0a12d7ff98bd5f192700b90cf0e555063af16fabf88ffbdf6cb88e973e705f642e870c239bf306c624d97f8c8cc021008e88638cd9d6a1
7
- data.tar.gz: d48f4c254375d55ddd36e911fb7f84cd18f8eeb96ed28081501ed745249abacad3fd6a35ede4e6be972196c0611675e259fea41cdb8e0cee0687cd5d296e0a86
6
+ metadata.gz: 1bb4ea160e1a0f9c93032320a1be553b669b7cc1f07c2b27d822ff7cc22e6015237666bc284f7304ad9d2302cfa9c963db75b81dfcae39645468efb717735c25
7
+ data.tar.gz: 2ee8715ac0e1bc4a96f8773f5bef406fa229a8f7d980b9813e539a4aaa4735451600f130046ae0810921e11e1ae0549d0850c1f1d7b98354228f9fe7c7f6c160
@@ -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,45 @@
1
+ ## [3.34.0] - 2025-05-14
2
+ ### Added and refined
3
+
4
+ #### Hosted KYC/KYB endpoints
5
+
6
+ The following endpoints have been refined following the beta phase, and are now generally available:
7
+ - [POST Create an IDV Session](https://docs.mangopay.com/api-reference/idv-sessions/create-idv-session) (no changes)
8
+ - [GET View an IDV Session](https://docs.mangopay.com/api-reference/idv-sessions/view-idv-session) (includes `Checks` in response)
9
+ - [GET List IDV Sessions for a User](https://docs.mangopay.com/api-reference/idv-sessions/list-idv-sessions-user) (new endpoint)
10
+
11
+ The previously available endpoint GET View Checks for an IDV Session has been removed (as Checks were integrated into the GET by ID).
12
+
13
+ See the [guide](https://docs.mangopay.com/guides/users/verification/hosted) for more details.
14
+
15
+ #### Recipients
16
+
17
+ The `Country` property has been added to [Recipients](https://docs.mangopay.com/guides/sca/recipients), as a required query parameter on [GET View the schema for a Recipient](https://docs.mangopay.com/api-reference/recipients/view-recipient-schema) and as a required body parameter on [POST Validate data for a Recipient](https://docs.mangopay.com/api-reference/recipients/validate-recipient-data) and [POST Create a Recipient](https://docs.mangopay.com/api-reference/recipients/create-recipient).
18
+
19
+ ### Added
20
+
21
+ - [GET List Deposit Preauthorizations for a Card](https://docs.mangopay.com/api-reference/deposit-preauthorizations/list-deposit-preauthorizations-card)
22
+ - [GET List Deposit Preauthorizations for a User](https://docs.mangopay.com/api-reference/deposit-preauthorizations/list-deposit-preauthorizations-user)
23
+
24
+ ## [3.33.0] - 2025-04-29
25
+ ### Added
26
+
27
+ #### SCA on wallet access endpoints
28
+
29
+ `ScaContext` query parameter added on wallet access endpoints for the [introduction of SCA](https://docs.mangopay.com/guides/sca/wallets):
30
+
31
+ - [GET View a Wallet](https://docs.mangopay.com/api-reference/wallets/view-wallet)
32
+ - [GET List Wallets for a User](https://docs.mangopay.com/api-reference/wallets/list-wallets-user)
33
+ - [GET List Transactions for a User](https://docs.mangopay.com/api-reference/transactions/list-transactions-user)
34
+ - [GET List Transactions for a Wallet](https://docs.mangopay.com/api-reference/transactions/list-transactions-wallet)
35
+
36
+ If SCA is required, Mangopay responds with a 401 response code. The `PendingUserAction` `RedirectUrl` is in the dedicated `WWW-Authenticate` response header.
37
+
38
+ See the tests for examples on handling this error.
39
+
40
+ #### BLIK with code
41
+ Support for [BLIK with code endpoint](https://docs.mangopay.com/api-reference/blik/create-blik-payin-with-code)
42
+
1
43
  ## [3.32.0] - 2025-04-16
2
44
  ### Added
3
45
 
@@ -16,5 +16,13 @@ module MangoPay
16
16
  }
17
17
  MangoPay.request(:put, "#{MangoPay.api_path}/deposit-preauthorizations/#{deposit_id}", params)
18
18
  end
19
+
20
+ def self.get_all_for_user(user_id, filters = {})
21
+ MangoPay.request(:get, "#{MangoPay.api_path}/users/#{user_id}/deposit-preauthorizations", {}, filters)
22
+ end
23
+
24
+ def self.get_all_for_card(card_id, filters = {})
25
+ MangoPay.request(:get, "#{MangoPay.api_path}/cards/#{card_id}/deposit-preauthorizations", {}, filters)
26
+ end
19
27
  end
20
28
  end
@@ -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
@@ -9,8 +9,8 @@ module MangoPay
9
9
  MangoPay.request(:get, "#{MangoPay.api_path}/identity-verifications/#{identity_verification_id}", {}, filters)
10
10
  end
11
11
 
12
- def self.get_checks(identity_verification_id, filters = {})
13
- MangoPay.request(:get, "#{MangoPay.api_path}/identity-verifications/#{identity_verification_id}/checks", {}, filters)
12
+ def self.get_all(user_id, filters = {})
13
+ MangoPay.request(:get, "#{MangoPay.api_path}/users/#{user_id}/identity-verifications", {}, filters)
14
14
  end
15
15
  end
16
16
  end
@@ -13,8 +13,8 @@ module MangoPay
13
13
  MangoPay.request(:get, "#{MangoPay.api_path}/users/#{user_id}/recipients", {}, filters)
14
14
  end
15
15
 
16
- def self.get_schema(payout_method_type, recipient_type, currency, filters = {})
17
- MangoPay.request(:get, "#{MangoPay.api_path}/recipients/schema?payoutMethodType=#{payout_method_type}&recipientType=#{recipient_type}&currency=#{currency}", {}, filters)
16
+ def self.get_schema(payout_method_type, recipient_type, currency, country, filters = {})
17
+ MangoPay.request(:get, "#{MangoPay.api_path}/recipients/schema?payoutMethodType=#{payout_method_type}&recipientType=#{recipient_type}&currency=#{currency}&country=#{country}", {}, filters)
18
18
  end
19
19
 
20
20
  def self.get_payout_methods(country, currency, filters = {})
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.32.0'
2
+ VERSION = '3.34.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
 
@@ -40,7 +40,7 @@ describe MangoPay::Client do
40
40
  end
41
41
 
42
42
  describe 'UPLOAD LOGO' do
43
- it 'accepts Base64 encoded file content' do
43
+ xit 'accepts Base64 encoded file content' do
44
44
  fnm = __FILE__.sub('.rb', '.png')
45
45
  bts = File.open(fnm, 'rb') { |f| f.read }
46
46
  b64 = Base64.encode64(bts)
@@ -48,7 +48,7 @@ describe MangoPay::Client do
48
48
  expect(ret).to_not be_nil
49
49
  end
50
50
 
51
- it 'accepts file path' do
51
+ xit 'accepts file path' do
52
52
  fnm = __FILE__.sub('.rb', '.png')
53
53
  ret = MangoPay::Client.upload_logo(nil, fnm)
54
54
  expect(ret).to_not be_nil
@@ -24,6 +24,26 @@ describe MangoPay::Deposit do
24
24
 
25
25
  assert_deposit(fetched_deposit, card_registration['CardId'], author["Id"])
26
26
  end
27
+
28
+ it 'gets all deposits for a user' do
29
+ author = new_natural_user
30
+ card_registration = new_card_registration_completed
31
+ create_new_deposit(card_registration['CardId'], author['Id'])
32
+
33
+ result = MangoPay::Deposit.get_all_for_user(author['Id'])
34
+ expect(result).to be_kind_of(Array)
35
+ expect(result.count).to be > 0
36
+ end
37
+
38
+ it 'gets all deposits for a card' do
39
+ author = new_natural_user
40
+ card_registration = new_card_registration_completed
41
+ create_new_deposit(card_registration['CardId'], author['Id'])
42
+
43
+ result = MangoPay::Deposit.get_all_for_card(card_registration['CardId'])
44
+ expect(result).to be_kind_of(Array)
45
+ expect(result.count).to be > 0
46
+ end
27
47
  end
28
48
 
29
49
  # the Cancel flow will be teste manually for now
@@ -21,22 +21,17 @@ describe MangoPay::IdentityVerification do
21
21
  expect(created['ReturnUrl']).to eq(fetched['ReturnUrl'])
22
22
  expect(created['Status']).to eq(fetched['Status'])
23
23
  end
24
- end
25
24
 
26
- # endpoint returning 404
27
- # describe 'GET CHECKS' do
28
- # it 'fetches checks for an existing identity verification' do
29
- # created = create_new_identity_verification
30
- # checks = MangoPay::IdentityVerification.get_checks(created['Id'])
31
- #
32
- # expect(checks).not_to be_nil
33
- # expect(created['Id']).to eq(checks['SessionId'])
34
- # expect(checks['Status']).not_to be_nil
35
- # expect(checks['CreationDate']).not_to be_nil
36
- # expect(checks['LastUpdate']).not_to be_nil
37
- # expect(checks['Checks']).not_to be_nil
38
- # end
39
- # end
25
+ it 'fetches all identity verifications for a user' do
26
+ create_new_identity_verification
27
+ user = new_natural_user
28
+ fetched = MangoPay::IdentityVerification.get_all(user['Id'])
29
+
30
+ expect(fetched).not_to be_nil
31
+ expect(fetched).to be_kind_of(Array)
32
+ expect(fetched).not_to be_empty
33
+ end
34
+ end
40
35
 
41
36
  def create_new_identity_verification
42
37
  user = new_natural_user
@@ -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
@@ -30,7 +30,7 @@ describe MangoPay::Recipient do
30
30
 
31
31
  describe 'GET Schema' do
32
32
  it 'fetches schema for LocalBankTransfer, Individual' do
33
- schema = MangoPay::Recipient.get_schema('LocalBankTransfer', 'Individual', 'GBP')
33
+ schema = MangoPay::Recipient.get_schema('LocalBankTransfer', 'Individual', 'GBP', 'GB')
34
34
  expect(schema).not_to be_nil
35
35
  expect(schema['DisplayName']).not_to be_nil
36
36
  expect(schema['Currency']).not_to be_nil
@@ -42,10 +42,11 @@ describe MangoPay::Recipient do
42
42
  expect(schema['LocalBankTransfer']).not_to be_nil
43
43
  expect(schema['BusinessRecipient']).to be_nil
44
44
  expect(schema['InternationalBankTransfer']).to be_nil
45
+ expect(schema['Country']).not_to be_nil
45
46
  end
46
47
 
47
48
  it 'fetches schema for InternationalBankTransfer, Business' do
48
- schema = MangoPay::Recipient.get_schema('InternationalBankTransfer', 'Business', 'GBP')
49
+ schema = MangoPay::Recipient.get_schema('InternationalBankTransfer', 'Business', 'GBP', 'GB')
49
50
  expect(schema).not_to be_nil
50
51
  expect(schema['DisplayName']).not_to be_nil
51
52
  expect(schema['Currency']).not_to be_nil
@@ -57,6 +58,7 @@ describe MangoPay::Recipient do
57
58
  expect(schema['InternationalBankTransfer']).not_to be_nil
58
59
  expect(schema['IndividualRecipient']).to be_nil
59
60
  expect(schema['LocalBankTransfer']).to be_nil
61
+ expect(schema['Country']).not_to be_nil
60
62
  end
61
63
  end
62
64
 
@@ -110,4 +112,5 @@ def assert_recipient(recipient)
110
112
  expect(recipient['LocalBankTransfer']).not_to be_nil
111
113
  expect(recipient['RecipientScope']).not_to be_nil
112
114
  expect(recipient['UserId']).not_to be_nil
115
+ expect(recipient['Country']).not_to be_nil
113
116
  end
@@ -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
  ###############################################
@@ -1222,6 +1251,7 @@ shared_context 'recipient' do
1222
1251
  "PayoutMethodType": "LocalBankTransfer",
1223
1252
  "RecipientType": "Individual",
1224
1253
  "Currency": "GBP",
1254
+ "Country": "GB",
1225
1255
  "IndividualRecipient": {
1226
1256
  "FirstName": "Alex",
1227
1257
  "LastName": "Smith",
@@ -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.34.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-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json