mangopay4-ruby-sdk 3.48.0 → 3.49.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: 674878e4aba915f0f767a1a58f76f9330bb0000628d0ea0d5fca7ca124eaa3bc
4
- data.tar.gz: 5a4dcd8a5b50557536daf8f57b82fb8ebefa8c73cb963a4e5087ab6dfaf6b4e9
3
+ metadata.gz: 496595e3a0551d362d0c69d662cde17b4c859c734e6fb628d6101abcb5bcefea
4
+ data.tar.gz: c32443ad0259ea64fed3273b9ab26225d70874e97d1d63d700a89ab140a985a1
5
5
  SHA512:
6
- metadata.gz: d69b73f8eba11516e2cd4c93992732a0eddcc02ab3ba6aa9779b9c692b3a827f17078dba7ce6654d3e2dccf59ab218717dc58111c368ebf790eb17bef05b5df2
7
- data.tar.gz: f1c53aa135c0f4343522bb7d5df8c65ae7d31654a42075cc39322ecbb394c4538777458b54e369bf9dec1549c3b5e9502246d3186b2d716dc2f29016a77ac46e
6
+ metadata.gz: 9b4d7bc2f12d34834f67ef9f8cf8bb86eda154753afb882a33dd7e52161bf1cee2c3ec841e73558af8b81e355a3a7f0e79c83b6a8603daacc1ec28144959303c
7
+ data.tar.gz: c382ac7dbc3d626ec639cbeb7b8d5977b103ffb0d027cee05e4453ff54208e98f7f6957061d6bb7b99d74808016655a9e68fb352df8f0378495a38016d8d9848
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## [3.49.0] - 2026-05-21
2
+ ### Added – PayPal Deposit Preauthorizations
3
+ - Added `MangoPay::Deposit.create_paypal_preauthorization` to create a PayPal deposit preauthorization
4
+ - Added `MangoPay::PayIn::PayPal::Web.create_pre_authorized_deposit_pay_in` to create a PayPal web deposit preauthorized pay-in (full capture)
5
+
6
+ ### Added – Pagination support for Recipients
7
+ - `MangoPay::Recipient.get_user_recipients` now accepts `page` and `per_page` pagination parameters
8
+
9
+ ### Added – Recurring PayIns for Google Pay and Apple Pay
10
+ - Added `MangoPay::PayIn::RecurringPayments::RecurringGooglePayPayIn` to create recurring Google Pay pay-ins
11
+ - Added `MangoPay::PayIn::RecurringPayments::RecurringApplePayPayIn` to create recurring Apple Pay pay-ins
12
+
13
+ ### Changed – Improved naming for Recurring PayIn classes
14
+ New classes were introduced with clearer names, and the old ones are now deprecated (still functional, scheduled for removal in a future release):
15
+ - Added `MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration` — **deprecates** `MangoPay::PayIn::RecurringPayments::Recurring`
16
+ - Added `MangoPay::PayIn::RecurringPayments::RecurringCardPayIn` — **deprecates** `MangoPay::PayIn::RecurringPayments::CIT` and `MangoPay::PayIn::RecurringPayments::MIT`
17
+ - Added `MangoPay::PayIn::RecurringPayments::RecurringPayPalPayIn` — **deprecates** `MangoPay::PayIn::RecurringPayments::PayPalCIT` and `MangoPay::PayIn::RecurringPayments::PayPalMIT`
18
+
19
+ ### Fixed – ReportV2.get_all parameters
20
+ - `MangoPay::ReportV2.get_all` now accepts a `filters` hash (sent as query parameters) and defaults to `{}` instead of `nil`. This fixes a crash when calling the method with no arguments while request logging is enabled, and ensures any provided values are actually sent to the API.
21
+
1
22
  ## [3.48.0] - 2026-03-25
2
23
  ### Removed
3
24
  - Payconiq PayIn (`MangoPay::PayIn::PayconiqWeb::Create`) removed following provider discontinuation on 4 Dec 2025 (#334)
@@ -6,6 +6,10 @@ module MangoPay
6
6
  MangoPay.request(:post, "#{MangoPay.api_path}/deposit-preauthorizations/card/direct", params, {}, idempotency_key)
7
7
  end
8
8
 
9
+ def self.create_paypal_preauthorization(params, idempotency_key = nil)
10
+ MangoPay.request(:post, "#{MangoPay.api_path}/deposit-preauthorizations/payment-methods/paypal", params, {}, idempotency_key)
11
+ end
12
+
9
13
  def self.get(deposit_id, filters = {})
10
14
  MangoPay.request(:get, "#{MangoPay.api_path}/deposit-preauthorizations/#{deposit_id}", {}, filters)
11
15
  end
@@ -72,6 +72,12 @@ module MangoPay
72
72
  end
73
73
  end
74
74
 
75
+ class Web < Resource
76
+ def self.create_pre_authorized_deposit_pay_in(params, idempotency_key = nil)
77
+ MangoPay.request(:post, "#{MangoPay.api_path}/payins/deposit-preauthorized/direct/full-capture", params, {}, idempotency_key)
78
+ end
79
+ end
80
+
75
81
  end
76
82
 
77
83
  module BankWire
@@ -294,6 +300,7 @@ module MangoPay
294
300
  end
295
301
 
296
302
  module RecurringPayments
303
+ # <b>DEPRECATED</b>: Please use MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration instead.
297
304
  class Recurring < Resource
298
305
  include HTTPCalls::Create
299
306
  include HTTPCalls::Fetch
@@ -308,6 +315,21 @@ module MangoPay
308
315
  end
309
316
  end
310
317
 
318
+ class RecurringPayInRegistration < Resource
319
+ include HTTPCalls::Create
320
+ include HTTPCalls::Fetch
321
+ include HTTPCalls::Update
322
+
323
+ def self.url(*args)
324
+ if args.any?
325
+ "#{MangoPay.api_path}/recurringpayinregistrations/#{args.first}"
326
+ else
327
+ "#{MangoPay.api_path}/recurringpayinregistrations"
328
+ end
329
+ end
330
+ end
331
+
332
+ # <b>DEPRECATED</b>: Please use MangoPay::PayIn::RecurringPayments::RecurringCardPayIn instead.
311
333
  class CIT < Resource
312
334
  include HTTPCalls::Create
313
335
 
@@ -316,6 +338,7 @@ module MangoPay
316
338
  end
317
339
  end
318
340
 
341
+ # <b>DEPRECATED</b>: Please use MangoPay::PayIn::RecurringPayments::RecurringCardPayIn instead.
319
342
  class MIT < Resource
320
343
  include HTTPCalls::Create
321
344
 
@@ -324,6 +347,15 @@ module MangoPay
324
347
  end
325
348
  end
326
349
 
350
+ class RecurringCardPayIn < Resource
351
+ include HTTPCalls::Create
352
+
353
+ def self.url(*)
354
+ "#{MangoPay.api_path}/payins/recurring/card/direct"
355
+ end
356
+ end
357
+
358
+ # <b>DEPRECATED</b>: Please use MangoPay::PayIn::RecurringPayments::RecurringPayPalPayIn instead.
327
359
  class PayPalCIT < Resource
328
360
  include HTTPCalls::Create
329
361
 
@@ -332,6 +364,7 @@ module MangoPay
332
364
  end
333
365
  end
334
366
 
367
+ # <b>DEPRECATED</b>: Please use MangoPay::PayIn::RecurringPayments::RecurringPayPalPayIn instead.
335
368
  class PayPalMIT < Resource
336
369
  include HTTPCalls::Create
337
370
 
@@ -339,6 +372,30 @@ module MangoPay
339
372
  "#{MangoPay.api_path}/payins/payment-methods/paypal/recurring"
340
373
  end
341
374
  end
375
+
376
+ class RecurringPayPalPayIn < Resource
377
+ include HTTPCalls::Create
378
+
379
+ def self.url(*)
380
+ "#{MangoPay.api_path}/payins/payment-methods/paypal/recurring"
381
+ end
382
+ end
383
+
384
+ class RecurringApplePayPayIn < Resource
385
+ include HTTPCalls::Create
386
+
387
+ def self.url(*)
388
+ "#{MangoPay.api_path}/payins/payment-methods/applepay/recurring"
389
+ end
390
+ end
391
+
392
+ class RecurringGooglePayPayIn < Resource
393
+ include HTTPCalls::Create
394
+
395
+ def self.url(*)
396
+ "#{MangoPay.api_path}/payins/payment-methods/googlepay/recurring"
397
+ end
398
+ end
342
399
  end
343
400
 
344
401
  module PayInIntent
@@ -12,8 +12,8 @@ module MangoPay
12
12
  MangoPay.request(:get, "#{MangoPay.api_path}/reporting/reports/#{id}")
13
13
  end
14
14
 
15
- def get_all(params = nil)
16
- MangoPay.request(:get, "#{MangoPay.api_path}/reporting/reports", params)
15
+ def get_all(filters = {})
16
+ MangoPay.request(:get, "#{MangoPay.api_path}/reporting/reports", {}, filters)
17
17
  end
18
18
 
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.48.0'
2
+ VERSION = '3.49.0'
3
3
  end
@@ -10,6 +10,19 @@ describe MangoPay::Deposit do
10
10
 
11
11
  assert_deposit(deposit, card_registration['CardId'], author["Id"])
12
12
  end
13
+
14
+ it 'creates a new paypal deposit preauthorization' do
15
+ author = new_natural_user
16
+ preauthorization = create_new_paypal_deposit_preauthorization(author['Id'])
17
+
18
+ expect(preauthorization['Id']).not_to be_nil
19
+ expect(preauthorization['PaymentType']).to eq('PAYPAL')
20
+ expect(preauthorization['Status']).to eq('CREATED')
21
+ expect(preauthorization['PaymentStatus']).to eq('WAITING')
22
+ expect(preauthorization['Reference']).not_to be_nil
23
+ expect(preauthorization['LineItems']).not_to be_nil
24
+ expect(preauthorization['ShippingPreference']).not_to be_nil
25
+ end
13
26
  end
14
27
 
15
28
  describe 'GET' do
@@ -86,6 +86,23 @@ describe MangoPay::PayIn::PreAuthorized::Direct, type: :feature do
86
86
  expect(created['DepositId']).to eq(deposit['Id'])
87
87
  end
88
88
 
89
+ xit 'creates a paypal web preauthorized deposit payin' do
90
+ # skipped: The Deposit Status value has to be up to SUCCEEDED
91
+ wallet = new_wallet
92
+ author = new_natural_user
93
+ deposit = create_new_paypal_deposit_preauthorization(author['Id'])
94
+
95
+ created = create_new_payin_pre_authorized_deposit_web(deposit['Id'], author['Id'], wallet['Id'])
96
+
97
+ expect(created['Id']).not_to be_nil
98
+ expect(created['Type']).to eq('PAYIN')
99
+ expect(created['Nature']).to eq('REGULAR')
100
+ expect(created['PaymentType']).to eq('PREAUTHORIZED')
101
+ expect(created['ExecutionType']).to eq('WEB')
102
+ expect(created['Status']).to eq('SUCCEEDED')
103
+ expect(created['DepositId']).to eq(deposit['Id'])
104
+ end
105
+
89
106
  it 'creates a card direct pre authorized deposit payin prior to complement' do
90
107
  wallet = new_wallet
91
108
  author = new_natural_user
@@ -33,12 +33,9 @@ describe MangoPay::PayOut::BankWire, type: :feature do
33
33
  it 'fails if not enough money' do
34
34
  payin = new_payin_card_web # this payin is NOT processed yet so payout may NOT happen
35
35
  payout = create_new_payout_bankwire(payin, 100)
36
- sleep(2)
37
- fetched = MangoPay::PayOut::BankWire.get_bankwire(payout['Id'])
38
- check_type_and_status(payout, true)
39
- expect(fetched['Status']).to eq('FAILED')
40
- expect(fetched['ResultCode']).to eq('002998')
41
- # expect(fetched['ResultMessage']).to eq('Unsufficient wallet balance')
36
+ expect(payout['Status']).to eq('FAILED')
37
+ expect(payout['ResultCode']).to eq('001001')
38
+ expect(payout['ResultMessage']).to eq('Insufficient wallet balance')
42
39
  end
43
40
  end
44
41
 
@@ -30,10 +30,11 @@ describe MangoPay::Recipient do
30
30
  it 'fetches recipients with scope PAYOUT' do
31
31
  john = create_new_natural_user_sca_owner
32
32
  create_new_recipient(john['Id'])
33
- fetched = MangoPay::Recipient.get_user_recipients(john['Id'], {RecipientScope: "PAYOUT"})
33
+ fetched = MangoPay::Recipient.get_user_recipients(john['Id'], {RecipientScope: "PAYOUT", page: 1, per_page: 1})
34
34
  expect(fetched).not_to be_nil
35
35
  expect(fetched).to be_kind_of(Array)
36
36
  expect(fetched).not_to be_empty
37
+ expect(fetched.count).to eq(1)
37
38
  end
38
39
 
39
40
  it 'fetches recipients with scope PAYIN' do
@@ -4,6 +4,160 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
4
4
  include_context 'payins'
5
5
 
6
6
  describe 'CREATE' do
7
+ def create_card_pay_in_registration
8
+ card_registration = new_card_registration_completed
9
+ wallet = new_wallet
10
+ MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration.create(
11
+ AuthorId: new_natural_user['Id'],
12
+ CardId: card_registration['CardId'],
13
+ CreditedUserId: wallet['Owners'][0],
14
+ CreditedWalletId: wallet['Id'],
15
+ FirstTransactionDebitedFunds: { Currency: 'EUR', Amount: 10 },
16
+ FirstTransactionFees: { Currency: 'EUR', Amount: 1 },
17
+ Billing: {
18
+ Address: {
19
+ AddressLine1: 'AddressLine1',
20
+ AddressLine2: 'AddressLine2',
21
+ City: 'City',
22
+ Region: 'Region',
23
+ PostalCode: 'PostalCode',
24
+ Country: 'FR'
25
+ },
26
+ FirstName: 'Joe',
27
+ LastName: 'Blogs'
28
+ },
29
+ Shipping: {
30
+ Address: {
31
+ AddressLine1: 'AddressLine1',
32
+ AddressLine2: 'AddressLine2',
33
+ City: 'City',
34
+ Region: 'Region',
35
+ PostalCode: 'PostalCode',
36
+ Country: 'FR'
37
+ },
38
+ FirstName: 'Joe',
39
+ LastName: 'Blogs'
40
+ },
41
+ FreeCycles: 0
42
+ )
43
+ end
44
+
45
+ def create_paypal_pay_in_registration
46
+ wallet = new_wallet
47
+ MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration.create(
48
+ AuthorId: new_natural_user['Id'],
49
+ CreditedWalletId: wallet['Id'],
50
+ FirstTransactionDebitedFunds: { Currency: 'EUR', Amount: 1000 },
51
+ FirstTransactionFees: { Currency: 'EUR', Amount: 0 },
52
+ Billing: {
53
+ Address: {
54
+ AddressLine1: 'AddressLine1',
55
+ AddressLine2: 'AddressLine2',
56
+ City: 'City',
57
+ Region: 'Region',
58
+ PostalCode: 'PostalCode',
59
+ Country: 'FR'
60
+ },
61
+ FirstName: 'Joe',
62
+ LastName: 'Blogs'
63
+ },
64
+ Shipping: {
65
+ Address: {
66
+ AddressLine1: 'AddressLine1',
67
+ AddressLine2: 'AddressLine2',
68
+ City: 'City',
69
+ Region: 'Region',
70
+ PostalCode: 'PostalCode',
71
+ Country: 'FR'
72
+ },
73
+ FirstName: 'Joe',
74
+ LastName: 'Blogs'
75
+ },
76
+ FreeCycles: 0,
77
+ PaymentType: 'PAYPAL'
78
+ )
79
+ end
80
+
81
+ def create_apple_pay_pay_in_registration
82
+ wallet = new_wallet
83
+ MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration.create(
84
+ AuthorId: new_natural_user['Id'],
85
+ CreditedUserId: wallet['Owners'][0],
86
+ CreditedWalletId: wallet['Id'],
87
+ FirstTransactionDebitedFunds: { Currency: 'EUR', Amount: 10 },
88
+ FirstTransactionFees: { Currency: 'EUR', Amount: 1 },
89
+ Billing: {
90
+ Address: {
91
+ AddressLine1: 'AddressLine1',
92
+ AddressLine2: 'AddressLine2',
93
+ City: 'City',
94
+ Region: 'Region',
95
+ PostalCode: 'PostalCode',
96
+ Country: 'FR'
97
+ },
98
+ FirstName: 'Joe',
99
+ LastName: 'Blogs'
100
+ },
101
+ Shipping: {
102
+ Address: {
103
+ AddressLine1: 'AddressLine1',
104
+ AddressLine2: 'AddressLine2',
105
+ City: 'City',
106
+ Region: 'Region',
107
+ PostalCode: 'PostalCode',
108
+ Country: 'FR'
109
+ },
110
+ FirstName: 'Joe',
111
+ LastName: 'Blogs'
112
+ },
113
+ FreeCycles: 0,
114
+ PaymentData: {
115
+ TokenData: 'placeholder',
116
+ Network: 'placeholder',
117
+ TransactionId: 'placeholder'
118
+ },
119
+ PaymentType: 'APPLEPAY'
120
+ )
121
+ end
122
+
123
+ def create_google_pay_pay_in_registration
124
+ wallet = new_wallet
125
+ MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration.create(
126
+ AuthorId: new_natural_user['Id'],
127
+ CreditedUserId: wallet['Owners'][0],
128
+ CreditedWalletId: wallet['Id'],
129
+ FirstTransactionDebitedFunds: { Currency: 'EUR', Amount: 10 },
130
+ FirstTransactionFees: { Currency: 'EUR', Amount: 1 },
131
+ Billing: {
132
+ Address: {
133
+ AddressLine1: 'AddressLine1',
134
+ AddressLine2: 'AddressLine2',
135
+ City: 'City',
136
+ Region: 'Region',
137
+ PostalCode: 'PostalCode',
138
+ Country: 'FR'
139
+ },
140
+ FirstName: 'Joe',
141
+ LastName: 'Blogs'
142
+ },
143
+ Shipping: {
144
+ Address: {
145
+ AddressLine1: 'AddressLine1',
146
+ AddressLine2: 'AddressLine2',
147
+ City: 'City',
148
+ Region: 'Region',
149
+ PostalCode: 'PostalCode',
150
+ Country: 'FR'
151
+ },
152
+ FirstName: 'Joe',
153
+ LastName: 'Blogs'
154
+ },
155
+ FreeCycles: 0,
156
+ PaymentData: 'placeholder',
157
+ PaymentType: 'GOOGLEPAY'
158
+ )
159
+ end
160
+
7
161
  it 'creates a recurring payment' do
8
162
  cardreg = new_card_registration_completed
9
163
  wallet = new_wallet
@@ -12,8 +166,8 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
12
166
  CardId: cardreg['CardId'],
13
167
  CreditedUserId: wallet['Owners'][0],
14
168
  CreditedWalletId: wallet['Id'],
15
- FirstTransactionDebitedFunds: {Currency: 'EUR', Amount: 10},
16
- FirstTransactionFees: {Currency: 'EUR', Amount: 1},
169
+ FirstTransactionDebitedFunds: { Currency: 'EUR', Amount: 10 },
170
+ FirstTransactionFees: { Currency: 'EUR', Amount: 1 },
17
171
  Billing: {
18
172
  Address: {
19
173
  AddressLine1: 'AddressLine1',
@@ -79,14 +233,132 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
79
233
  expect(update).not_to be_nil
80
234
  end
81
235
 
236
+ it 'handles a card pay in registration' do
237
+ pay_in_registration = create_card_pay_in_registration
238
+
239
+ expect(pay_in_registration).not_to be_nil
240
+ expect(pay_in_registration['Status']).not_to be_nil
241
+ expect(pay_in_registration['Id']).not_to be_nil
242
+ expect(pay_in_registration['FreeCycles']).not_to be_nil
243
+ expect(pay_in_registration['PaymentType']).to eq('CARD_DIRECT')
244
+
245
+ get = MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration.fetch(pay_in_registration['Id'])
246
+ expect(get).not_to be_nil
247
+ expect(get['Status']).not_to be_nil
248
+
249
+ update = MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration.update(pay_in_registration['Id'], {
250
+ Status: 'ENDED'
251
+ })
252
+
253
+ expect(update).not_to be_nil
254
+ expect(update['Status']).to eq('ENDED')
255
+ end
256
+
257
+ it 'handles a PayPal pay in registration' do
258
+ pay_in_registration = create_paypal_pay_in_registration
259
+
260
+ expect(pay_in_registration).not_to be_nil
261
+ expect(pay_in_registration['Status']).not_to be_nil
262
+ expect(pay_in_registration['Id']).not_to be_nil
263
+ expect(pay_in_registration['FreeCycles']).not_to be_nil
264
+ expect(pay_in_registration['PaymentType']).to eq('PAYPAL')
265
+
266
+ get = MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration.fetch(pay_in_registration['Id'])
267
+ expect(get).not_to be_nil
268
+ expect(get['Status']).not_to be_nil
269
+
270
+ update = MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration.update(pay_in_registration['Id'], {
271
+ Status: 'ENDED'
272
+ })
273
+
274
+ expect(update).not_to be_nil
275
+ expect(update['Status']).to eq('ENDED')
276
+ end
277
+
278
+ xit 'handles a ApplePay pay in registration' do
279
+ pay_in_registration = create_apple_pay_pay_in_registration
280
+
281
+ expect(pay_in_registration).not_to be_nil
282
+ expect(pay_in_registration['Status']).not_to be_nil
283
+ expect(pay_in_registration['Id']).not_to be_nil
284
+ expect(pay_in_registration['FreeCycles']).not_to be_nil
285
+ expect(pay_in_registration['PaymentType']).to eq('APPLEPAY')
286
+
287
+ get = MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration.fetch(pay_in_registration['Id'])
288
+ expect(get).not_to be_nil
289
+ expect(get['Status']).not_to be_nil
290
+
291
+ update = MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration.update(pay_in_registration['Id'], {
292
+ Status: 'ENDED'
293
+ })
294
+
295
+ expect(update).not_to be_nil
296
+ expect(update['Status']).to eq('ENDED')
297
+ end
298
+
299
+ xit 'handles a GooglePay pay in registration' do
300
+ pay_in_registration = create_google_pay_pay_in_registration
301
+
302
+ expect(pay_in_registration).not_to be_nil
303
+ expect(pay_in_registration['Status']).not_to be_nil
304
+ expect(pay_in_registration['Id']).not_to be_nil
305
+ expect(pay_in_registration['FreeCycles']).not_to be_nil
306
+ expect(pay_in_registration['PaymentType']).to eq('GOOGLEPAY')
307
+
308
+ get = MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration.fetch(pay_in_registration['Id'])
309
+ expect(get).not_to be_nil
310
+ expect(get['Status']).not_to be_nil
311
+
312
+ update = MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration.update(pay_in_registration['Id'], {
313
+ Status: 'ENDED'
314
+ })
315
+
316
+ expect(update).not_to be_nil
317
+ expect(update['Status']).to eq('ENDED')
318
+ end
319
+
320
+ it 'creates recurring card payins' do
321
+ pay_in_registration = create_card_pay_in_registration
322
+
323
+ recurring_card_pay_in_cit = MangoPay::PayIn::RecurringPayments::RecurringCardPayIn.create(
324
+ RecurringPayinRegistrationId: pay_in_registration['Id'],
325
+ IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
326
+ SecureModeReturnURL: "http://www.my-site.com/returnurl",
327
+ StatementDescriptor: "lorem",
328
+ Tag: "custom meta",
329
+ BrowserInfo: {
330
+ AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
331
+ JavaEnabled: true,
332
+ Language: "FR-FR",
333
+ ColorDepth: 4,
334
+ ScreenHeight: 1800,
335
+ ScreenWidth: 400,
336
+ JavascriptEnabled: true,
337
+ TimeZoneOffset: "+60",
338
+ UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
339
+ }
340
+ )
341
+
342
+ expect(recurring_card_pay_in_cit).not_to be_nil
343
+ expect(recurring_card_pay_in_cit['Status']).not_to be_nil
344
+
345
+ recurring_card_pay_in_mit = MangoPay::PayIn::RecurringPayments::RecurringCardPayIn.create(
346
+ RecurringPayinRegistrationId: pay_in_registration['Id'],
347
+ DebitedFunds: { Currency: 'EUR', Amount: 100 },
348
+ Fees: { Currency: 'EUR', Amount: 10 },
349
+ )
350
+ expect(recurring_card_pay_in_mit).not_to be_nil
351
+ expect(recurring_card_pay_in_mit['Status']).not_to be_nil
352
+ end
353
+
82
354
  it 'creates a recurring paypal payment CIT' do
83
355
  wallet = new_wallet
84
356
  recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
85
357
  AuthorId: new_natural_user['Id'],
86
358
  CreditedUserId: wallet['Owners'][0],
87
359
  CreditedWalletId: wallet['Id'],
88
- FirstTransactionDebitedFunds: {Currency: 'EUR', Amount: 1000},
89
- FirstTransactionFees: {Currency: 'EUR', Amount: 0},
360
+ FirstTransactionDebitedFunds: { Currency: 'EUR', Amount: 1000 },
361
+ FirstTransactionFees: { Currency: 'EUR', Amount: 0 },
90
362
  Billing: {
91
363
  Address: {
92
364
  AddressLine1: 'AddressLine1',
@@ -151,8 +423,8 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
151
423
  AuthorId: new_natural_user['Id'],
152
424
  CreditedUserId: wallet['Owners'][0],
153
425
  CreditedWalletId: wallet['Id'],
154
- FirstTransactionDebitedFunds: {Currency: 'EUR', Amount: 1000},
155
- FirstTransactionFees: {Currency: 'EUR', Amount: 0},
426
+ FirstTransactionDebitedFunds: { Currency: 'EUR', Amount: 1000 },
427
+ FirstTransactionFees: { Currency: 'EUR', Amount: 0 },
156
428
  Billing: {
157
429
  Address: {
158
430
  AddressLine1: 'AddressLine1',
@@ -218,5 +490,68 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
218
490
  expect(cit['PaymentType']).to eq('PAYPAL')
219
491
  expect(cit['ExecutionType']).to eq('WEB')
220
492
  end
493
+
494
+ it 'creates recurring PayPal payins' do
495
+ pay_in_registration = create_paypal_pay_in_registration
496
+
497
+ recurring_paypal_pay_in_cit = MangoPay::PayIn::RecurringPayments::RecurringPayPalPayIn.create(
498
+ {
499
+ "ReturnURL": "http://example.com",
500
+ "CancelURL": "http://example.net",
501
+ "LineItems": [
502
+ {
503
+ "Name": "Running shoes",
504
+ "Quantity": 1,
505
+ "UnitAmount": 1000,
506
+ "TaxAmount": 0,
507
+ "Description": "ID of Seller 1",
508
+ "Category": "PHYSICAL_GOODS"
509
+ }
510
+ ],
511
+ "Tag": "Created using the Mangopay API Postman collection",
512
+ "RecurringPayinRegistrationId": pay_in_registration['Id'],
513
+ "ShippingPreference": "SET_PROVIDED_ADDRESS",
514
+ "Reference": "abcd-efgh-ijkl",
515
+ "StatementDescriptor": "Example123"
516
+ }
517
+ )
518
+
519
+ expect(recurring_paypal_pay_in_cit).not_to be_nil
520
+ expect(recurring_paypal_pay_in_cit['Status']).to eq('CREATED')
521
+ expect(recurring_paypal_pay_in_cit['PaymentType']).to eq('PAYPAL')
522
+
523
+ recurring_paypal_pay_in_mit = MangoPay::PayIn::RecurringPayments::RecurringPayPalPayIn.create(
524
+ {
525
+ "ReturnURL": "http://example.com",
526
+ "CancelURL": "http://example.net",
527
+ "LineItems": [
528
+ {
529
+ "Name": "Running shoes",
530
+ "Quantity": 1,
531
+ "UnitAmount": 1000,
532
+ "TaxAmount": 0,
533
+ "Description": "ID of Seller 1",
534
+ "Category": "PHYSICAL_GOODS"
535
+ }
536
+ ],
537
+ "Tag": "Created using the Mangopay API Postman collection",
538
+ "RecurringPayinRegistrationId": pay_in_registration['Id'],
539
+ "ShippingPreference": "SET_PROVIDED_ADDRESS",
540
+ "Reference": "abcd-efgh-ijkl",
541
+ "StatementDescriptor": "Example123",
542
+ "DebitedFunds": {
543
+ "Currency": "EUR",
544
+ "Amount": 1000
545
+ },
546
+ "Fees": {
547
+ "Currency": "EUR",
548
+ "Amount": 0
549
+ }
550
+ }
551
+ )
552
+ expect(recurring_paypal_pay_in_mit).not_to be_nil
553
+ expect(recurring_paypal_pay_in_mit['Status']).to eq('CREATED')
554
+ expect(recurring_paypal_pay_in_mit['PaymentType']).to eq('PAYPAL')
555
+ end
221
556
  end
222
557
  end
@@ -953,6 +953,17 @@ shared_context 'payins' do
953
953
  )
954
954
  end
955
955
 
956
+ def create_new_payin_pre_authorized_deposit_web(deposit_id, author_id, credited_wallet_id)
957
+ MangoPay::PayIn::PreAuthorized::Web.create_pre_authorized_deposit_pay_in(
958
+ AuthorId: author_id,
959
+ CreditedWalletId: credited_wallet_id,
960
+ DebitedFunds: { Currency: 'EUR', Amount: 500 },
961
+ Fees: { Currency: 'EUR', Amount: 0 },
962
+ DepositId: deposit_id,
963
+ Tag: 'lorem ipsum'
964
+ )
965
+ end
966
+
956
967
  def create_new_deposit_pre_authorized_pay_in_prior_to_complement(deposit_id, author_id, credited_wallet_id)
957
968
  MangoPay::PayIn::PreAuthorized::Direct.create_deposit_preauthorized_pay_in_prior_to_complement(
958
969
  AuthorId: author_id,
@@ -1165,6 +1176,39 @@ def create_new_deposit(card_registration_id, author_id)
1165
1176
  )
1166
1177
  end
1167
1178
 
1179
+ def create_new_paypal_deposit_preauthorization(author_id)
1180
+ MangoPay::Deposit.create_paypal_preauthorization(
1181
+ {
1182
+ AuthorId: author_id,
1183
+ DebitedFunds: { Currency: 'EUR', Amount: 1000 },
1184
+ ReturnURL: 'https://mangopay-sandbox-test.com',
1185
+ Shipping: {
1186
+ Address: {
1187
+ AddressLine1: 'AddressLine1',
1188
+ AddressLine2: 'AddressLine2',
1189
+ City: 'City',
1190
+ Region: 'Region',
1191
+ PostalCode: 'PostalCode',
1192
+ Country: 'FR'
1193
+ },
1194
+ FirstName: 'Joe',
1195
+ LastName: 'Blogs'
1196
+ },
1197
+ ShippingPreference: 'SET_PROVIDED_ADDRESS',
1198
+ Reference: '1234',
1199
+ LineItems: [
1200
+ {
1201
+ Name: "running shoes",
1202
+ Quantity: 1,
1203
+ UnitAmount: 1000,
1204
+ TaxAmount: 0,
1205
+ Description: "seller1 ID"
1206
+ }
1207
+ ]
1208
+ }
1209
+ )
1210
+ end
1211
+
1168
1212
  ###############################################
1169
1213
  # instant conversions
1170
1214
  ###############################################
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mangopay4-ruby-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.48.0
4
+ version: 3.49.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: 2026-03-30 00:00:00.000000000 Z
12
+ date: 2026-05-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json