mangopay 3.30.2 → 3.31.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: b86fbdaf106d3df4a96899887d53827c18311cec4f1fac5061a434f1422e16e8
4
- data.tar.gz: e9e391b1d317c813b69b97edd85c7c15335b7c3415c266cec1bd4e7b38e72fb7
3
+ metadata.gz: d0c9bf8de0cc8f9ac13e5c0410679c20e38cf971256a7109c034d06bf5ba07a3
4
+ data.tar.gz: 4cf8f88da31fcb566bf2bc5892a507e28e0815c75852fc119ae311b492d6c45d
5
5
  SHA512:
6
- metadata.gz: dd74c5a0ca889cede26fbd4fe5679ce5e8dbb245dc82c0dca3c8d95eb4878df0e16e76e4a1529a2b8d585383cc1131aa1ad85e104f602115d6f5b5ce6eaa7a1a
7
- data.tar.gz: da0238ed1916f0e5fb7798396f1811fc184dfa1028621842d26b39661c82ae967598c8e8487fb47ea9913626fbd50b3b472a60b3fa9195708a115a0ef38d3984
6
+ metadata.gz: b47ea99f7515a53d86d20bff3dba2291f971065e179d88e071cb18a47920969195a200a93192cce7535cb38bfac727e7fd78a233cc31bb2a0f472b399d802acb
7
+ data.tar.gz: 52cce07e5c04322c88c01771434ac5df303c1256558e60f4c32d96386272d3c3ea381ccc18a79061813c93c3336299bf75bb784b151e93fc4bb4f38dc8375b7a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [3.31.0] - 2025-04-16
2
+ ### Added
3
+ - [POST Create a Pay by Bank PayIn](https://docs.mangopay.com/api-reference/pay-by-bank/create-pay-by-bank-payin)
4
+ - PayPal recurring payments, thanks to the `PaymentType` value `PAYPAL` on [Recurring PayIn Registrations](https://docs.mangopay.com/api-reference/recurring-payin-registrations/create-recurring-payin-registration-paypal) and new endpoints ([POST Create a Recurring PayPal PayIn (CIT)](https://docs.mangopay.com/api-reference/paypal/create-recurring-paypal-payin-cit) and [POST Create a Recurring PayPal PayIn (MIT)](https://docs.mangopay.com/api-reference/paypal/create-recurring-paypal-payin-mit)
5
+
1
6
  ## [3.30.2] - 2025-04-02
2
7
  ### Fixed
3
8
  - Fixed the way User-Agent Header is built
@@ -263,6 +263,16 @@ module MangoPay
263
263
  end
264
264
  end
265
265
 
266
+ module PayByBank
267
+ class Web < Resource
268
+ include HTTPCalls::Create
269
+
270
+ def self.url(*)
271
+ "#{MangoPay.api_path}/payins/payment-methods/openbanking"
272
+ end
273
+ end
274
+ end
275
+
266
276
  module RecurringPayments
267
277
  class Recurring < Resource
268
278
  include HTTPCalls::Create
@@ -293,6 +303,22 @@ module MangoPay
293
303
  "#{MangoPay.api_path}/payins/recurring/card/direct"
294
304
  end
295
305
  end
306
+
307
+ class PayPalCIT < Resource
308
+ include HTTPCalls::Create
309
+
310
+ def self.url(*)
311
+ "#{MangoPay.api_path}/payins/payment-methods/paypal/recurring"
312
+ end
313
+ end
314
+
315
+ class PayPalMIT < Resource
316
+ include HTTPCalls::Create
317
+
318
+ def self.url(*)
319
+ "#{MangoPay.api_path}/payins/payment-methods/paypal/recurring"
320
+ end
321
+ end
296
322
  end
297
323
 
298
324
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.30.2'
2
+ VERSION = '3.31.0'
3
3
  end
@@ -23,19 +23,20 @@ describe MangoPay::IdentityVerification do
23
23
  end
24
24
  end
25
25
 
26
- describe 'GET CHECKS' do
27
- it 'fetches checks for an existing identity verification' do
28
- created = create_new_identity_verification
29
- checks = MangoPay::IdentityVerification.get_checks(created['Id'])
30
-
31
- expect(checks).not_to be_nil
32
- expect(created['Id']).to eq(checks['SessionId'])
33
- expect(checks['Status']).not_to be_nil
34
- expect(checks['CreationDate']).not_to be_nil
35
- expect(checks['LastUpdate']).not_to be_nil
36
- expect(checks['Checks']).not_to be_nil
37
- end
38
- end
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
39
40
 
40
41
  def create_new_identity_verification
41
42
  user = new_natural_user
@@ -0,0 +1,30 @@
1
+ describe MangoPay::PayIn::PayByBank::Web, type: :feature do
2
+ include_context 'wallets'
3
+ include_context 'payins'
4
+
5
+ def check_type_and_status(payin)
6
+ expect(payin['Type']).to eq('PAYIN')
7
+ expect(payin['Nature']).to eq('REGULAR')
8
+ expect(payin['PaymentType']).to eq('PAY_BY_BANK')
9
+ expect(payin['ExecutionType']).to eq('WEB')
10
+ expect(payin['Status']).to eq('CREATED')
11
+ end
12
+
13
+ describe 'CREATE' do
14
+ it 'creates a paybybank web payin' do
15
+ created = new_payin_paybybank_web
16
+ expect(created['Id']).not_to be_nil
17
+ check_type_and_status(created)
18
+ end
19
+ end
20
+
21
+ describe 'FETCH' do
22
+ it 'fetches a payin' do
23
+ created = new_payin_paybybank_web
24
+ fetched = MangoPay::PayIn.fetch(created['Id'])
25
+ expect(fetched['Id']).to eq(created['Id'])
26
+ check_type_and_status(created)
27
+ check_type_and_status(fetched)
28
+ end
29
+ end
30
+ end
@@ -78,5 +78,145 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
78
78
 
79
79
  expect(update).not_to be_nil
80
80
  end
81
+
82
+ it 'creates a recurring paypal payment CIT' do
83
+ wallet = new_wallet
84
+ recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
85
+ AuthorId: new_natural_user['Id'],
86
+ CreditedUserId: wallet['Owners'][0],
87
+ CreditedWalletId: wallet['Id'],
88
+ FirstTransactionDebitedFunds: {Currency: 'EUR', Amount: 1000},
89
+ FirstTransactionFees: {Currency: 'EUR', Amount: 0},
90
+ Billing: {
91
+ Address: {
92
+ AddressLine1: 'AddressLine1',
93
+ AddressLine2: 'AddressLine2',
94
+ City: 'City',
95
+ Region: 'Region',
96
+ PostalCode: 'PostalCode',
97
+ Country: 'FR'
98
+ },
99
+ FirstName: 'Joe',
100
+ LastName: 'Blogs'
101
+ },
102
+ Shipping: {
103
+ Address: {
104
+ AddressLine1: 'AddressLine1',
105
+ AddressLine2: 'AddressLine2',
106
+ City: 'City',
107
+ Region: 'Region',
108
+ PostalCode: 'PostalCode',
109
+ Country: 'FR'
110
+ },
111
+ FirstName: 'Joe',
112
+ LastName: 'Blogs'
113
+ },
114
+ PaymentType: 'PAYPAL'
115
+ )
116
+ expect(recurring).not_to be_nil
117
+ expect(recurring['Status']).not_to be_nil
118
+ expect(recurring['Id']).not_to be_nil
119
+
120
+ cit = MangoPay::PayIn::RecurringPayments::PayPalCIT.create(
121
+ {
122
+ "ReturnURL": "http://example.com",
123
+ "CancelURL": "http://example.net",
124
+ "LineItems": [
125
+ {
126
+ "Name": "Running shoes",
127
+ "Quantity": 1,
128
+ "UnitAmount": 1000,
129
+ "TaxAmount": 0,
130
+ "Description": "ID of Seller 1",
131
+ "Category": "PHYSICAL_GOODS"
132
+ }
133
+ ],
134
+ "Tag": "Created using the Mangopay API Postman collection",
135
+ "RecurringPayinRegistrationId": recurring['Id'],
136
+ "ShippingPreference": "SET_PROVIDED_ADDRESS",
137
+ "Reference": "abcd-efgh-ijkl",
138
+ "StatementDescriptor": "Example123"
139
+ }
140
+ )
141
+
142
+ expect(cit).not_to be_nil
143
+ expect(cit['Status']).to eq('CREATED')
144
+ expect(cit['PaymentType']).to eq('PAYPAL')
145
+ expect(cit['ExecutionType']).to eq('WEB')
146
+ end
147
+
148
+ it 'creates a recurring paypal payment MIT' do
149
+ wallet = new_wallet
150
+ recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
151
+ AuthorId: new_natural_user['Id'],
152
+ CreditedUserId: wallet['Owners'][0],
153
+ CreditedWalletId: wallet['Id'],
154
+ FirstTransactionDebitedFunds: {Currency: 'EUR', Amount: 1000},
155
+ FirstTransactionFees: {Currency: 'EUR', Amount: 0},
156
+ Billing: {
157
+ Address: {
158
+ AddressLine1: 'AddressLine1',
159
+ AddressLine2: 'AddressLine2',
160
+ City: 'City',
161
+ Region: 'Region',
162
+ PostalCode: 'PostalCode',
163
+ Country: 'FR'
164
+ },
165
+ FirstName: 'Joe',
166
+ LastName: 'Blogs'
167
+ },
168
+ Shipping: {
169
+ Address: {
170
+ AddressLine1: 'AddressLine1',
171
+ AddressLine2: 'AddressLine2',
172
+ City: 'City',
173
+ Region: 'Region',
174
+ PostalCode: 'PostalCode',
175
+ Country: 'FR'
176
+ },
177
+ FirstName: 'Joe',
178
+ LastName: 'Blogs'
179
+ },
180
+ PaymentType: 'PAYPAL'
181
+ )
182
+ expect(recurring).not_to be_nil
183
+ expect(recurring['Status']).not_to be_nil
184
+ expect(recurring['Id']).not_to be_nil
185
+
186
+ cit = MangoPay::PayIn::RecurringPayments::PayPalMIT.create(
187
+ {
188
+ "ReturnURL": "http://example.com",
189
+ "CancelURL": "http://example.net",
190
+ "LineItems": [
191
+ {
192
+ "Name": "Running shoes",
193
+ "Quantity": 1,
194
+ "UnitAmount": 1000,
195
+ "TaxAmount": 0,
196
+ "Description": "ID of Seller 1",
197
+ "Category": "PHYSICAL_GOODS"
198
+ }
199
+ ],
200
+ "Tag": "Created using the Mangopay API Postman collection",
201
+ "RecurringPayinRegistrationId": recurring['Id'],
202
+ "ShippingPreference": "SET_PROVIDED_ADDRESS",
203
+ "Reference": "abcd-efgh-ijkl",
204
+ "StatementDescriptor": "Example123",
205
+ "DebitedFunds": {
206
+ "Currency": "EUR",
207
+ "Amount": 1000
208
+ },
209
+ "Fees": {
210
+ "Currency": "EUR",
211
+ "Amount": 0
212
+ }
213
+ }
214
+ )
215
+
216
+ expect(cit).not_to be_nil
217
+ expect(cit['Status']).to eq('CREATED')
218
+ expect(cit['PaymentType']).to eq('PAYPAL')
219
+ expect(cit['ExecutionType']).to eq('WEB')
220
+ end
81
221
  end
82
222
  end
@@ -942,6 +942,25 @@ shared_context 'payins' do
942
942
  MangoPay::Wallet.fetch(pay_in['CreditedWalletId'])
943
943
  end
944
944
 
945
+ let(:new_payin_paybybank_web) do
946
+ MangoPay::PayIn::PayByBank::Web.create(
947
+ AuthorId: new_natural_user['Id'],
948
+ CreditedWalletId: create_new_custom_wallet(new_natural_user, 'EUR')['Id'],
949
+ DebitedFunds: { Currency: 'EUR', Amount: 400 },
950
+ Fees: { Currency: 'EUR', Amount: 0 },
951
+ ReturnURL: 'http://www.my-site.com/returnURL',
952
+ StatementDescriptor: "test",
953
+ Tag: 'Test PayIn/PayByBank/Web',
954
+ Country: 'DE',
955
+ IBAN: 'DE03500105177564668331',
956
+ BIC: 'AACSDE33',
957
+ Scheme: 'SEPA_INSTANT_CREDIT_TRANSFER',
958
+ BankName: 'de-demobank-open-banking-embedded-templates',
959
+ Culture: 'EN',
960
+ PaymentFlow: 'WEB'
961
+ )
962
+ end
963
+
945
964
  end
946
965
 
947
966
  ###############################################
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.30.2
4
+ version: 3.31.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-02 00:00:00.000000000 Z
12
+ date: 2025-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -150,6 +150,7 @@ files:
150
150
  - spec/mangopay/payin_klarna_web_spec.rb
151
151
  - spec/mangopay/payin_mbway_web_spec.rb
152
152
  - spec/mangopay/payin_multibanco_web_spec.rb
153
+ - spec/mangopay/payin_paybybank_web_spec.rb
153
154
  - spec/mangopay/payin_payconiq_web_spec.rb
154
155
  - spec/mangopay/payin_paypal_web_spec.rb
155
156
  - spec/mangopay/payin_preauthorized_direct_spec.rb
@@ -233,6 +234,7 @@ test_files:
233
234
  - spec/mangopay/payin_klarna_web_spec.rb
234
235
  - spec/mangopay/payin_mbway_web_spec.rb
235
236
  - spec/mangopay/payin_multibanco_web_spec.rb
237
+ - spec/mangopay/payin_paybybank_web_spec.rb
236
238
  - spec/mangopay/payin_payconiq_web_spec.rb
237
239
  - spec/mangopay/payin_paypal_web_spec.rb
238
240
  - spec/mangopay/payin_preauthorized_direct_spec.rb