mangopay 3.34.0 → 3.35.1

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: 9a183b9490a45fa73745d864f9643d9afec4e4ea56b002784e2b888ae7886b7b
4
- data.tar.gz: 4079521fab8f807345c218e00510e5197d4cb05d8afc4cbd4a332e5231650100
3
+ metadata.gz: 15264b27e3c6d9543eb22df8793bb0fb37870aa19d6c12c5d9c41f7ae3e37f7a
4
+ data.tar.gz: 8333f909cf729a462acd645a4b68aa03a048a6490fe16881eb675a818e25a0c8
5
5
  SHA512:
6
- metadata.gz: 1bb4ea160e1a0f9c93032320a1be553b669b7cc1f07c2b27d822ff7cc22e6015237666bc284f7304ad9d2302cfa9c963db75b81dfcae39645468efb717735c25
7
- data.tar.gz: 2ee8715ac0e1bc4a96f8773f5bef406fa229a8f7d980b9813e539a4aaa4735451600f130046ae0810921e11e1ae0549d0850c1f1d7b98354228f9fe7c7f6c160
6
+ metadata.gz: 2522a4843d777f4db554b7df2ab8c331d592155288fd641deaf17e19de28e426df70eeca7041e8007c9732aae4663c1fe93677d1c9a71fcb8244b7b8cf766490
7
+ data.tar.gz: 607684d9029548a5798d1274938f74d8c0fad61591d3ca68bf56a8a90247741d475a34ddb0dbe06c20def8f06810d6d3cdd6ceb47a75221086baf480cb30ec3b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## [3.35.1] - 2025-06-05
2
+ ### Added
3
+ - Support for `RecipientScope` query parameter on [GET List Recipients for a User](https://docs.mangopay.com/api-reference/recipients/list-recipients-user)
4
+ - [POST Validate the format of User data](https://docs.mangopay.com/api-reference/user-data-format/validate-user-data-format)
5
+
6
+ ### Fixed
7
+ - Support for legacy Payconiq integration via `MangoPay::PayIn::Payconiq::Web.create_legacy` (removed in error).
8
+
9
+ ## [3.35.0] - 2025-05-23
10
+ ### Added
11
+
12
+ Support for [30-day deposit preauthorization](https://docs.mangopay.com/guides/payment-methods/card/deposit-preauthorization) features:
13
+ - [POST Create a Deposit Preauthorized PayIn prior to complement](https://docs.mangopay.com/api-reference/deposit-preauthorizations/create-deposit-preauthorized-payin-prior-to-complement)
14
+ - [POST Create a Deposit Preauthorized PayIn complement](https://docs.mangopay.com/api-reference/deposit-preauthorizations/create-deposit-preauthorized-payin-complement)
15
+ - `NO_SHOW_REQUESTED` on `updateDeposit` method for [PUT Cancel a Deposit Preauthorization or request a no-show](https://docs.mangopay.com/api-reference/deposit-preauthorizations/cancel-deposit-preauthorization-request-no-show)
16
+ - [GET View a PayIn (Deposit Preauthorized Card](https://docs.mangopay.com/api-reference/deposit-preauthorizations/view-payin-deposit-preauthorized)
17
+ - [GET List Transactions for a Deposit Preauthorization](https://docs.mangopay.com/api-reference/transactions/list-transactions-deposit-preauthorization)
18
+
1
19
  ## [3.34.0] - 2025-05-14
2
20
  ### Added and refined
3
21
 
@@ -17,6 +17,10 @@ module MangoPay
17
17
  MangoPay.request(:put, "#{MangoPay.api_path}/deposit-preauthorizations/#{deposit_id}", params)
18
18
  end
19
19
 
20
+ def self.update(deposit_id, params)
21
+ MangoPay.request(:put, "#{MangoPay.api_path}/deposit-preauthorizations/#{deposit_id}", params)
22
+ end
23
+
20
24
  def self.get_all_for_user(user_id, filters = {})
21
25
  MangoPay.request(:get, "#{MangoPay.api_path}/users/#{user_id}/deposit-preauthorizations", {}, filters)
22
26
  end
@@ -24,5 +28,9 @@ module MangoPay
24
28
  def self.get_all_for_card(card_id, filters = {})
25
29
  MangoPay.request(:get, "#{MangoPay.api_path}/cards/#{card_id}/deposit-preauthorizations", {}, filters)
26
30
  end
31
+
32
+ def self.get_transactions(deposit_id, filters = {})
33
+ MangoPay.request(:get, "#{MangoPay.api_path}/deposit-preauthorizations/#{deposit_id}/transactions", {}, filters)
34
+ end
27
35
  end
28
36
  end
@@ -62,6 +62,14 @@ module MangoPay
62
62
  def self.create_pre_authorized_deposit_pay_in(params, idempotency_key = nil)
63
63
  MangoPay.request(:post, "#{MangoPay.api_path}/payins/deposit-preauthorized/direct/full-capture", params, {}, idempotency_key)
64
64
  end
65
+
66
+ def self.create_deposit_preauthorized_pay_in_prior_to_complement(params, idempotency_key = nil)
67
+ MangoPay.request(:post, "#{MangoPay.api_path}/payins/deposit-preauthorized/direct/capture-with-complement", params, {}, idempotency_key)
68
+ end
69
+
70
+ def self.create_deposit_preauthorized_pay_in_complement(params, idempotency_key = nil)
71
+ MangoPay.request(:post, "#{MangoPay.api_path}/payins/deposit-preauthorized/direct/complement", params, {}, idempotency_key)
72
+ end
65
73
  end
66
74
 
67
75
  end
@@ -139,6 +147,10 @@ module MangoPay
139
147
  def self.url(*)
140
148
  "#{MangoPay.api_path}/payins/payment-methods/payconiq"
141
149
  end
150
+
151
+ def self.create_legacy(params, idempotency_key = nil)
152
+ MangoPay.request(:post, "#{MangoPay.api_path}/payins/payconiq/web", params, {}, idempotency_key)
153
+ end
142
154
  end
143
155
 
144
156
  end
data/lib/mangopay/user.rb CHANGED
@@ -87,6 +87,10 @@ module MangoPay
87
87
  url = "#{MangoPay.api_path}/sca/users/#{user_id}"
88
88
  MangoPay.request(:get, url, {}, {})
89
89
  end
90
+
91
+ def validate_data_format(params, idempotency_key = nil)
92
+ MangoPay.request(:post, "#{MangoPay.api_path}/users/data-formats/validation", params, {}, idempotency_key)
93
+ end
90
94
  end
91
95
  end
92
96
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.34.0'
2
+ VERSION = '3.35.1'
3
3
  end
@@ -44,6 +44,18 @@ describe MangoPay::Deposit do
44
44
  expect(result).to be_kind_of(Array)
45
45
  expect(result.count).to be > 0
46
46
  end
47
+
48
+ it 'fetches transactions for a deposit' do
49
+ author = new_natural_user
50
+ wallet = new_wallet
51
+ card_registration = new_card_registration_completed
52
+ deposit = create_new_deposit(card_registration['CardId'], author['Id'])
53
+ create_new_payin_pre_authorized_deposit_direct(deposit['Id'], author['Id'], wallet['Id'])
54
+
55
+ transactions = MangoPay::Deposit.get_transactions(deposit['Id'])
56
+ expect(transactions).to be_kind_of(Array)
57
+ expect(transactions.count).to be > 0
58
+ end
47
59
  end
48
60
 
49
61
  # the Cancel flow will be teste manually for now
@@ -20,6 +20,12 @@ describe MangoPay::PayIn::Payconiq::Web, type: :feature do
20
20
  expect(created['Id']).not_to be_nil
21
21
  check_type_and_status(created)
22
22
  end
23
+
24
+ it 'creates a payconiq web payin using the old endpoint' do
25
+ created = new_payin_payconiq_web_legacy
26
+ expect(created['Id']).not_to be_nil
27
+ check_type_and_status(created)
28
+ end
23
29
  end
24
30
 
25
31
  end
@@ -45,7 +45,7 @@ describe MangoPay::PayIn::PreAuthorized::Direct, type: :feature do
45
45
  it 'refunds a payin' do
46
46
  payin = new_payin_preauthorized_direct
47
47
  sleep(2)
48
- refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']})
48
+ refund = MangoPay::PayIn.refund(payin['Id'], { AuthorId: payin['AuthorId'] })
49
49
  expect(refund['Id']).not_to be_nil
50
50
  expect(refund['Status']).to eq('SUCCEEDED')
51
51
  expect(refund['Type']).to eq('PAYOUT')
@@ -66,26 +66,52 @@ describe MangoPay::PayIn::PreAuthorized::Direct, type: :feature do
66
66
  wallets_reload_and_check_amounts(wlt, 1000)
67
67
 
68
68
  # refund the payin
69
- refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']})
69
+ refund = MangoPay::PayIn.refund(payin['Id'], { AuthorId: payin['AuthorId'] })
70
70
  wallets_reload_and_check_amounts(wlt, 0)
71
71
  end
72
72
  end
73
73
 
74
- # this flow is tested manually for the moment
75
- =begin
76
- describe 'CREATE AND VIEW PRE AUTHORIZED DEPOSIT' do
77
- it 'creates a card direct pre authorized deposit payin' do
78
- wallet = new_wallet
79
- author = new_natural_user
80
- card_registration = new_card_registration_completed
81
- deposit = create_new_deposit(card_registration['CardId'], author['Id'])
74
+ begin
75
+ describe 'CREATE AND VIEW PRE AUTHORIZED DEPOSIT' do
76
+ it 'creates a card direct pre authorized deposit payin' do
77
+ wallet = new_wallet
78
+ author = new_natural_user
79
+ card_registration = new_card_registration_completed
80
+ deposit = create_new_deposit(card_registration['CardId'], author['Id'])
82
81
 
83
- created = create_new_payin_pre_authorized_deposit_direct(deposit['Id'], author['Id'], wallet['Id'])
82
+ created = create_new_payin_pre_authorized_deposit_direct(deposit['Id'], author['Id'], wallet['Id'])
84
83
 
85
- expect(created['Id']).not_to be_nil
86
- check_type_and_status(created)
87
- expect(created['DepositId']).to eq(deposit['Id'])
84
+ expect(created['Id']).not_to be_nil
85
+ check_type_and_status(created)
86
+ expect(created['DepositId']).to eq(deposit['Id'])
87
+ end
88
+
89
+ it 'creates a card direct pre authorized deposit payin prior to complement' do
90
+ wallet = new_wallet
91
+ author = new_natural_user
92
+ card_registration = new_card_registration_completed
93
+ deposit = create_new_deposit(card_registration['CardId'], author['Id'])
94
+
95
+ created = create_new_deposit_pre_authorized_pay_in_prior_to_complement(deposit['Id'], author['Id'], wallet['Id'])
96
+
97
+ expect(created['Id']).not_to be_nil
98
+ check_type_and_status(created)
99
+ expect(created['DepositId']).to eq(deposit['Id'])
100
+ end
101
+
102
+ it 'creates a card direct pre authorized deposit payin complement' do
103
+ wallet = new_wallet
104
+ author = new_natural_user
105
+ card_registration = new_card_registration_completed
106
+ deposit = create_new_deposit(card_registration['CardId'], author['Id'])
107
+ MangoPay::Deposit.update(deposit['Id'], {PaymentStatus: 'NO_SHOW_REQUESTED'})
108
+
109
+ created = create_new_deposit_pre_authorized_pay_in_complement(deposit['Id'], author['Id'], wallet['Id'])
110
+
111
+ expect(created['Id']).not_to be_nil
112
+ check_type_and_status(created)
113
+ expect(created['DepositId']).to eq(deposit['Id'])
114
+ end
88
115
  end
89
116
  end
90
- =end
91
117
  end
@@ -18,7 +18,7 @@ describe MangoPay::Recipient do
18
18
  end
19
19
 
20
20
  describe 'GET User Recipients' do
21
- it 'fetches a recipient' do
21
+ it 'fetches recipients without query param' do
22
22
  john = create_new_natural_user_sca_owner
23
23
  create_new_recipient(john['Id'])
24
24
  fetched = MangoPay::Recipient.get_user_recipients(john['Id'])
@@ -26,6 +26,24 @@ describe MangoPay::Recipient do
26
26
  expect(fetched).to be_kind_of(Array)
27
27
  expect(fetched).not_to be_empty
28
28
  end
29
+
30
+ it 'fetches recipients with scope PAYOUT' do
31
+ john = create_new_natural_user_sca_owner
32
+ create_new_recipient(john['Id'])
33
+ fetched = MangoPay::Recipient.get_user_recipients(john['Id'], {RecipientScope: "PAYOUT"})
34
+ expect(fetched).not_to be_nil
35
+ expect(fetched).to be_kind_of(Array)
36
+ expect(fetched).not_to be_empty
37
+ end
38
+
39
+ it 'fetches recipients with scope PAYIN' do
40
+ john = create_new_natural_user_sca_owner
41
+ create_new_recipient(john['Id'])
42
+ fetched = MangoPay::Recipient.get_user_recipients(john['Id'], {RecipientScope: "PAYIN"})
43
+ expect(fetched).not_to be_nil
44
+ expect(fetched).to be_kind_of(Array)
45
+ expect(fetched).to be_empty
46
+ end
29
47
  end
30
48
 
31
49
  describe 'GET Schema' do
@@ -372,6 +372,18 @@ shared_context 'payins' do
372
372
  )
373
373
  end
374
374
 
375
+ let(:new_payin_payconiq_web_legacy) do
376
+ MangoPay::PayIn::Payconiq::Web.create_legacy(
377
+ AuthorId: new_natural_user['Id'],
378
+ CreditedWalletId: new_wallet['Id'],
379
+ DebitedFunds: { Currency: 'EUR', Amount: 100 },
380
+ Fees: { Currency: 'EUR', Amount: 0 },
381
+ ReturnURL: MangoPay.configuration.root_url,
382
+ Country: "BE",
383
+ Tag: 'Custom Meta'
384
+ )
385
+ end
386
+
375
387
  ###############################################
376
388
  # applepay/direct
377
389
  ###############################################
@@ -936,6 +948,28 @@ shared_context 'payins' do
936
948
  )
937
949
  end
938
950
 
951
+ def create_new_deposit_pre_authorized_pay_in_prior_to_complement(deposit_id, author_id, credited_wallet_id)
952
+ MangoPay::PayIn::PreAuthorized::Direct.create_deposit_preauthorized_pay_in_prior_to_complement(
953
+ AuthorId: author_id,
954
+ CreditedWalletId: credited_wallet_id,
955
+ DebitedFunds: { Currency: 'EUR', Amount: 1000 },
956
+ Fees: { Currency: 'EUR', Amount: 0 },
957
+ DepositId: deposit_id,
958
+ Tag: 'lorem ipsum'
959
+ )
960
+ end
961
+
962
+ def create_new_deposit_pre_authorized_pay_in_complement(deposit_id, author_id, credited_wallet_id)
963
+ MangoPay::PayIn::PreAuthorized::Direct.create_deposit_preauthorized_pay_in_complement(
964
+ AuthorId: author_id,
965
+ CreditedWalletId: credited_wallet_id,
966
+ DebitedFunds: { Currency: 'EUR', Amount: 1000 },
967
+ Fees: { Currency: 'EUR', Amount: 0 },
968
+ DepositId: deposit_id,
969
+ Tag: 'lorem ipsum'
970
+ )
971
+ end
972
+
939
973
  ###############################################
940
974
  # bankwire/direct
941
975
  ###############################################
@@ -399,4 +399,30 @@ describe MangoPay::User do
399
399
  expect(closed['UserStatus']).to eq('CLOSED')
400
400
  end
401
401
  end
402
+
403
+ describe 'Validate User Data Format' do
404
+ it 'validates successfully' do
405
+ validation = {
406
+ "CompanyNumber": {
407
+ "CompanyNumber": "AB123456",
408
+ "CountryCode": "IT"
409
+ }
410
+ }
411
+ result = MangoPay::User.validate_data_format(validation)
412
+ expect(result['CompanyNumber']).not_to be_nil
413
+ end
414
+
415
+ it 'validates with error' do
416
+ validation = {
417
+ "CompanyNumber": {
418
+ "CompanyNumber": "123"
419
+ }
420
+ }
421
+ expect { MangoPay::User.validate_data_format(validation) }.to raise_error { |err|
422
+ expect(err).to be_a MangoPay::ResponseError
423
+ expect(err.code).to eq '400'
424
+ expect(err.type).to eq 'param_error'
425
+ }
426
+ end
427
+ end
402
428
  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.34.0
4
+ version: 3.35.1
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-05-14 00:00:00.000000000 Z
12
+ date: 2025-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json