mangopay4-ruby-sdk 3.48.0 → 3.50.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: 62c5cad1c06cda65af982d0bea42f8a3cde79beb1aa34b9307acf05eb2c0adda
4
+ data.tar.gz: 8c3adf70afc028198e0cc6a3deb3b57b554f1601fb8651fe277d06cf9b7addd9
5
5
  SHA512:
6
- metadata.gz: d69b73f8eba11516e2cd4c93992732a0eddcc02ab3ba6aa9779b9c692b3a827f17078dba7ce6654d3e2dccf59ab218717dc58111c368ebf790eb17bef05b5df2
7
- data.tar.gz: f1c53aa135c0f4343522bb7d5df8c65ae7d31654a42075cc39322ecbb394c4538777458b54e369bf9dec1549c3b5e9502246d3186b2d716dc2f29016a77ac46e
6
+ metadata.gz: 2a4b76ea41a71b1965b0f2e4b23466fe5435be13b1b94e0f45d705227a2ab4ac472adc1a98d7b0c1a531759f17e1c3aaff0bcc91bbfdb39c2b880fae1916c1e7
7
+ data.tar.gz: 2e09c919825c59b394068d505f5e9fac9d6e1e6bd5696ad19e5de7edaaf8f24fd872f1f626c5bccc990886abbc0e74c800f1206a5b250ece0d23198d79c04a2f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ ## [3.50.0] - 2026-07-13
2
+ ### Deprecated – Non-SCA users and deposit preauthorized complement pay-ins
3
+ - `MangoPay::LegalUser` create, get by id and update operations are deprecated. Use `MangoPay::LegalUserSca` instead.
4
+ - `MangoPay::NaturalUser` create, get by id and update operations are deprecated. Use `MangoPay::NaturalUserSca` instead.
5
+ - `MangoPay::PayIn::PreAuthorized::Direct.create_deposit_preauthorized_pay_in_prior_to_complement` is deprecated.
6
+ - `MangoPay::PayIn::PreAuthorized::Direct.create_deposit_preauthorized_pay_in_complement` is deprecated.
7
+
8
+ ## [3.49.0] - 2026-05-21
9
+ ### Added – PayPal Deposit Preauthorizations
10
+ - Added `MangoPay::Deposit.create_paypal_preauthorization` to create a PayPal deposit preauthorization
11
+ - Added `MangoPay::PayIn::PayPal::Web.create_pre_authorized_deposit_pay_in` to create a PayPal web deposit preauthorized pay-in (full capture)
12
+
13
+ ### Added – Pagination support for Recipients
14
+ - `MangoPay::Recipient.get_user_recipients` now accepts `page` and `per_page` pagination parameters
15
+
16
+ ### Added – Recurring PayIns for Google Pay and Apple Pay
17
+ - Added `MangoPay::PayIn::RecurringPayments::RecurringGooglePayPayIn` to create recurring Google Pay pay-ins
18
+ - Added `MangoPay::PayIn::RecurringPayments::RecurringApplePayPayIn` to create recurring Apple Pay pay-ins
19
+
20
+ ### Changed – Improved naming for Recurring PayIn classes
21
+ New classes were introduced with clearer names, and the old ones are now deprecated (still functional, scheduled for removal in a future release):
22
+ - Added `MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration` — **deprecates** `MangoPay::PayIn::RecurringPayments::Recurring`
23
+ - Added `MangoPay::PayIn::RecurringPayments::RecurringCardPayIn` — **deprecates** `MangoPay::PayIn::RecurringPayments::CIT` and `MangoPay::PayIn::RecurringPayments::MIT`
24
+ - Added `MangoPay::PayIn::RecurringPayments::RecurringPayPalPayIn` — **deprecates** `MangoPay::PayIn::RecurringPayments::PayPalCIT` and `MangoPay::PayIn::RecurringPayments::PayPalMIT`
25
+
26
+ ### Fixed – ReportV2.get_all parameters
27
+ - `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.
28
+
1
29
  ## [3.48.0] - 2026-03-25
2
30
  ### Removed
3
31
  - 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
@@ -2,6 +2,9 @@ module MangoPay
2
2
 
3
3
  # See http://docs.mangopay.com/api-references/users/legal-users/
4
4
  # See also parent class MangoPay::User
5
+ #
6
+ # <b>DEPRECATED</b>: The non-SCA legal user create, get by id and update
7
+ # operations are deprecated. Please use MangoPay::LegalUserSca instead.
5
8
  class LegalUser < User
6
9
 
7
10
  def self.url(id = nil)
@@ -1,6 +1,9 @@
1
1
  module MangoPay
2
2
 
3
3
  # See http://docs.mangopay.com/api-references/users/natural-users/
4
+ #
5
+ # <b>DEPRECATED</b>: The non-SCA natural user create, get by id and update
6
+ # operations are deprecated. Please use MangoPay::NaturalUserSca instead.
4
7
  class NaturalUser < User
5
8
 
6
9
  def self.url(id = nil)
@@ -63,15 +63,25 @@ module MangoPay
63
63
  MangoPay.request(:post, "#{MangoPay.api_path}/payins/deposit-preauthorized/direct/full-capture", params, {}, idempotency_key)
64
64
  end
65
65
 
66
+ # <b>DEPRECATED</b>: 'create_deposit_preauthorized_pay_in_prior_to_complement' function is now deprecated.
66
67
  def self.create_deposit_preauthorized_pay_in_prior_to_complement(params, idempotency_key = nil)
68
+ warn "[DEPRECATION] MangoPay::PayIn::PreAuthorized::Direct.create_deposit_preauthorized_pay_in_prior_to_complement is deprecated."
67
69
  MangoPay.request(:post, "#{MangoPay.api_path}/payins/deposit-preauthorized/direct/capture-with-complement", params, {}, idempotency_key)
68
70
  end
69
71
 
72
+ # <b>DEPRECATED</b>: 'create_deposit_preauthorized_pay_in_complement' function is now deprecated.
70
73
  def self.create_deposit_preauthorized_pay_in_complement(params, idempotency_key = nil)
74
+ warn "[DEPRECATION] MangoPay::PayIn::PreAuthorized::Direct.create_deposit_preauthorized_pay_in_complement is deprecated."
71
75
  MangoPay.request(:post, "#{MangoPay.api_path}/payins/deposit-preauthorized/direct/complement", params, {}, idempotency_key)
72
76
  end
73
77
  end
74
78
 
79
+ class Web < Resource
80
+ def self.create_pre_authorized_deposit_pay_in(params, idempotency_key = nil)
81
+ MangoPay.request(:post, "#{MangoPay.api_path}/payins/deposit-preauthorized/direct/full-capture", params, {}, idempotency_key)
82
+ end
83
+ end
84
+
75
85
  end
76
86
 
77
87
  module BankWire
@@ -294,6 +304,7 @@ module MangoPay
294
304
  end
295
305
 
296
306
  module RecurringPayments
307
+ # <b>DEPRECATED</b>: Please use MangoPay::PayIn::RecurringPayments::RecurringPayInRegistration instead.
297
308
  class Recurring < Resource
298
309
  include HTTPCalls::Create
299
310
  include HTTPCalls::Fetch
@@ -308,6 +319,21 @@ module MangoPay
308
319
  end
309
320
  end
310
321
 
322
+ class RecurringPayInRegistration < Resource
323
+ include HTTPCalls::Create
324
+ include HTTPCalls::Fetch
325
+ include HTTPCalls::Update
326
+
327
+ def self.url(*args)
328
+ if args.any?
329
+ "#{MangoPay.api_path}/recurringpayinregistrations/#{args.first}"
330
+ else
331
+ "#{MangoPay.api_path}/recurringpayinregistrations"
332
+ end
333
+ end
334
+ end
335
+
336
+ # <b>DEPRECATED</b>: Please use MangoPay::PayIn::RecurringPayments::RecurringCardPayIn instead.
311
337
  class CIT < Resource
312
338
  include HTTPCalls::Create
313
339
 
@@ -316,6 +342,7 @@ module MangoPay
316
342
  end
317
343
  end
318
344
 
345
+ # <b>DEPRECATED</b>: Please use MangoPay::PayIn::RecurringPayments::RecurringCardPayIn instead.
319
346
  class MIT < Resource
320
347
  include HTTPCalls::Create
321
348
 
@@ -324,6 +351,15 @@ module MangoPay
324
351
  end
325
352
  end
326
353
 
354
+ class RecurringCardPayIn < Resource
355
+ include HTTPCalls::Create
356
+
357
+ def self.url(*)
358
+ "#{MangoPay.api_path}/payins/recurring/card/direct"
359
+ end
360
+ end
361
+
362
+ # <b>DEPRECATED</b>: Please use MangoPay::PayIn::RecurringPayments::RecurringPayPalPayIn instead.
327
363
  class PayPalCIT < Resource
328
364
  include HTTPCalls::Create
329
365
 
@@ -332,6 +368,7 @@ module MangoPay
332
368
  end
333
369
  end
334
370
 
371
+ # <b>DEPRECATED</b>: Please use MangoPay::PayIn::RecurringPayments::RecurringPayPalPayIn instead.
335
372
  class PayPalMIT < Resource
336
373
  include HTTPCalls::Create
337
374
 
@@ -339,6 +376,30 @@ module MangoPay
339
376
  "#{MangoPay.api_path}/payins/payment-methods/paypal/recurring"
340
377
  end
341
378
  end
379
+
380
+ class RecurringPayPalPayIn < Resource
381
+ include HTTPCalls::Create
382
+
383
+ def self.url(*)
384
+ "#{MangoPay.api_path}/payins/payment-methods/paypal/recurring"
385
+ end
386
+ end
387
+
388
+ class RecurringApplePayPayIn < Resource
389
+ include HTTPCalls::Create
390
+
391
+ def self.url(*)
392
+ "#{MangoPay.api_path}/payins/payment-methods/applepay/recurring"
393
+ end
394
+ end
395
+
396
+ class RecurringGooglePayPayIn < Resource
397
+ include HTTPCalls::Create
398
+
399
+ def self.url(*)
400
+ "#{MangoPay.api_path}/payins/payment-methods/googlepay/recurring"
401
+ end
402
+ end
342
403
  end
343
404
 
344
405
  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.50.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
@@ -77,7 +77,8 @@ describe MangoPay::PayIn::PayPal::Web, type: :feature do
77
77
  expect(created['dataCollectionId']).not_to be_nil
78
78
  end
79
79
 
80
- it 'fetches data collection' do
80
+ xit 'fetches data collection' do
81
+ # skipped because API 500 error
81
82
  created = MangoPay::PayIn::PayPal::Web.create_data_collection(get_data_collection_dto)
82
83
  fetched = MangoPay::PayIn::PayPal::Web.get_data_collection(created['dataCollectionId'])
83
84
  expect(fetched['DataCollectionId']).to eq(created['dataCollectionId'])
@@ -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.50.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-07-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json