mangopay4-ruby-sdk 3.52.0 → 4.0.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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/lib/mangopay/authorization_token.rb +1 -1
  4. data/lib/mangopay/version.rb +1 -1
  5. data/mangopay.gemspec +7 -7
  6. metadata +32 -160
  7. data/.github/workflows/ruby_cd.yml +0 -34
  8. data/.github/workflows/ruby_ci.yml +0 -30
  9. data/.gitignore +0 -30
  10. data/.rspec +0 -3
  11. data/Gemfile +0 -2
  12. data/Rakefile +0 -5
  13. data/bin/mangopay +0 -9
  14. data/spec/mangopay/acquiring_spec.rb +0 -207
  15. data/spec/mangopay/authorization_token_spec.rb +0 -70
  16. data/spec/mangopay/bank_account_spec.rb +0 -105
  17. data/spec/mangopay/bankingaliases_spec.rb +0 -29
  18. data/spec/mangopay/card_registration_spec.rb +0 -123
  19. data/spec/mangopay/client_spec.png +0 -0
  20. data/spec/mangopay/client_spec.rb +0 -213
  21. data/spec/mangopay/configuration_spec.rb +0 -249
  22. data/spec/mangopay/conversion_spec.rb +0 -103
  23. data/spec/mangopay/deposit_spec.rb +0 -120
  24. data/spec/mangopay/dispute_spec.png +0 -0
  25. data/spec/mangopay/dispute_spec.rb +0 -294
  26. data/spec/mangopay/event_spec.rb +0 -33
  27. data/spec/mangopay/fetch_filters_spec.rb +0 -63
  28. data/spec/mangopay/hook_spec.rb +0 -37
  29. data/spec/mangopay/idempotency_spec.rb +0 -41
  30. data/spec/mangopay/identity_verification_spec.rb +0 -91
  31. data/spec/mangopay/kyc_document_spec.png +0 -0
  32. data/spec/mangopay/kyc_document_spec.rb +0 -118
  33. data/spec/mangopay/log_requests_filter_spec.rb +0 -26
  34. data/spec/mangopay/mandate_spec.rb +0 -99
  35. data/spec/mangopay/payin_applepay_direct_spec.rb +0 -21
  36. data/spec/mangopay/payin_bancontact_web_spec.rb +0 -30
  37. data/spec/mangopay/payin_bankwire_direct_spec.rb +0 -74
  38. data/spec/mangopay/payin_bankwire_external_instruction_spec.rb +0 -104
  39. data/spec/mangopay/payin_bizum_web_spec.rb +0 -54
  40. data/spec/mangopay/payin_blik_web_spec.rb +0 -41
  41. data/spec/mangopay/payin_card_direct_spec.rb +0 -69
  42. data/spec/mangopay/payin_card_web_spec.rb +0 -64
  43. data/spec/mangopay/payin_directdebit_direct_spec.rb +0 -37
  44. data/spec/mangopay/payin_directdebit_web_spec.rb +0 -38
  45. data/spec/mangopay/payin_giropay_web_spec.rb +0 -30
  46. data/spec/mangopay/payin_googlepay_direct_spec.rb +0 -21
  47. data/spec/mangopay/payin_ideal_web_spec.rb +0 -30
  48. data/spec/mangopay/payin_intent_spec.rb +0 -302
  49. data/spec/mangopay/payin_klarna_web_spec.rb +0 -32
  50. data/spec/mangopay/payin_mbway_web_spec.rb +0 -32
  51. data/spec/mangopay/payin_multibanco_web_spec.rb +0 -31
  52. data/spec/mangopay/payin_paybybank_web_spec.rb +0 -56
  53. data/spec/mangopay/payin_paypal_web_spec.rb +0 -114
  54. data/spec/mangopay/payin_preauthorized_direct_spec.rb +0 -135
  55. data/spec/mangopay/payin_satispay_web_spec.rb +0 -32
  56. data/spec/mangopay/payin_swish_web_spec.rb +0 -30
  57. data/spec/mangopay/payin_twint_web_spec.rb +0 -30
  58. data/spec/mangopay/payment_method_metadata_spec.rb +0 -15
  59. data/spec/mangopay/payout_bankwire_spec.rb +0 -90
  60. data/spec/mangopay/preauthorization_spec.rb +0 -51
  61. data/spec/mangopay/recipient_spec.rb +0 -135
  62. data/spec/mangopay/recurring_payin_spec.rb +0 -557
  63. data/spec/mangopay/refund_spec.rb +0 -34
  64. data/spec/mangopay/regulatory_spec.rb +0 -26
  65. data/spec/mangopay/report_spec.rb +0 -40
  66. data/spec/mangopay/report_v2_spec.rb +0 -117
  67. data/spec/mangopay/report_wallets_spec.rb +0 -40
  68. data/spec/mangopay/settlement_sample.csv +0 -8
  69. data/spec/mangopay/settlement_sample_bad.csv +0 -8
  70. data/spec/mangopay/settlement_spec.rb +0 -65
  71. data/spec/mangopay/shared_resources.rb +0 -1415
  72. data/spec/mangopay/transaction_spec.rb +0 -59
  73. data/spec/mangopay/transfer_spec.rb +0 -77
  74. data/spec/mangopay/ubo_declaration_spec.rb +0 -44
  75. data/spec/mangopay/ubo_spec.rb +0 -39
  76. data/spec/mangopay/user_spec.rb +0 -455
  77. data/spec/mangopay/virtual_account_spec.rb +0 -52
  78. data/spec/mangopay/wallet_spec.rb +0 -100
  79. data/spec/spec_helper.rb +0 -31
  80. data/spec/tmp/.keep +0 -0
@@ -1,557 +0,0 @@
1
- describe MangoPay::PayIn::RecurringPayments, type: :feature do
2
- include_context 'wallets'
3
- include_context 'users'
4
- include_context 'payins'
5
-
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
-
161
- it 'creates a recurring payment' do
162
- cardreg = new_card_registration_completed
163
- wallet = new_wallet
164
- recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
165
- AuthorId: new_natural_user['Id'],
166
- CardId: cardreg['CardId'],
167
- CreditedUserId: wallet['Owners'][0],
168
- CreditedWalletId: wallet['Id'],
169
- FirstTransactionDebitedFunds: { Currency: 'EUR', Amount: 10 },
170
- FirstTransactionFees: { Currency: 'EUR', Amount: 1 },
171
- Billing: {
172
- Address: {
173
- AddressLine1: 'AddressLine1',
174
- AddressLine2: 'AddressLine2',
175
- City: 'City',
176
- Region: 'Region',
177
- PostalCode: 'PostalCode',
178
- Country: 'FR'
179
- },
180
- FirstName: 'Joe',
181
- LastName: 'Blogs'
182
- },
183
- Shipping: {
184
- Address: {
185
- AddressLine1: 'AddressLine1',
186
- AddressLine2: 'AddressLine2',
187
- City: 'City',
188
- Region: 'Region',
189
- PostalCode: 'PostalCode',
190
- Country: 'FR'
191
- },
192
- FirstName: 'Joe',
193
- LastName: 'Blogs'
194
- },
195
- FreeCycles: 0
196
- )
197
- expect(recurring).not_to be_nil
198
- expect(recurring['Status']).not_to be_nil
199
- expect(recurring['Id']).not_to be_nil
200
- expect(recurring['FreeCycles']).not_to be_nil
201
-
202
- id = recurring['Id']
203
-
204
- get = MangoPay::PayIn::RecurringPayments::Recurring.fetch(id)
205
- expect(get).not_to be_nil
206
- expect(get['FreeCycles']).not_to be_nil
207
-
208
- cit = MangoPay::PayIn::RecurringPayments::CIT.create(
209
- RecurringPayinRegistrationId: recurring['Id'],
210
- IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
211
- SecureModeReturnURL: "http://www.my-site.com/returnurl",
212
- StatementDescriptor: "lorem",
213
- Tag: "custom meta",
214
- BrowserInfo: {
215
- AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
216
- JavaEnabled: true,
217
- Language: "FR-FR",
218
- ColorDepth: 4,
219
- ScreenHeight: 1800,
220
- ScreenWidth: 400,
221
- JavascriptEnabled: true,
222
- TimeZoneOffset: "+60",
223
- UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
224
- }
225
- )
226
-
227
- expect(cit).not_to be_nil
228
-
229
- update = MangoPay::PayIn::RecurringPayments::Recurring.update(id, {
230
- Status: 'ENDED'
231
- })
232
-
233
- expect(update).not_to be_nil
234
- end
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
-
354
- it 'creates a recurring paypal payment CIT' do
355
- wallet = new_wallet
356
- recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
357
- AuthorId: new_natural_user['Id'],
358
- CreditedUserId: wallet['Owners'][0],
359
- CreditedWalletId: wallet['Id'],
360
- FirstTransactionDebitedFunds: { Currency: 'EUR', Amount: 1000 },
361
- FirstTransactionFees: { Currency: 'EUR', Amount: 0 },
362
- Billing: {
363
- Address: {
364
- AddressLine1: 'AddressLine1',
365
- AddressLine2: 'AddressLine2',
366
- City: 'City',
367
- Region: 'Region',
368
- PostalCode: 'PostalCode',
369
- Country: 'FR'
370
- },
371
- FirstName: 'Joe',
372
- LastName: 'Blogs'
373
- },
374
- Shipping: {
375
- Address: {
376
- AddressLine1: 'AddressLine1',
377
- AddressLine2: 'AddressLine2',
378
- City: 'City',
379
- Region: 'Region',
380
- PostalCode: 'PostalCode',
381
- Country: 'FR'
382
- },
383
- FirstName: 'Joe',
384
- LastName: 'Blogs'
385
- },
386
- PaymentType: 'PAYPAL'
387
- )
388
- expect(recurring).not_to be_nil
389
- expect(recurring['Status']).not_to be_nil
390
- expect(recurring['Id']).not_to be_nil
391
-
392
- cit = MangoPay::PayIn::RecurringPayments::PayPalCIT.create(
393
- {
394
- "ReturnURL": "http://example.com",
395
- "CancelURL": "http://example.net",
396
- "LineItems": [
397
- {
398
- "Name": "Running shoes",
399
- "Quantity": 1,
400
- "UnitAmount": 1000,
401
- "TaxAmount": 0,
402
- "Description": "ID of Seller 1",
403
- "Category": "PHYSICAL_GOODS"
404
- }
405
- ],
406
- "Tag": "Created using the Mangopay API Postman collection",
407
- "RecurringPayinRegistrationId": recurring['Id'],
408
- "ShippingPreference": "SET_PROVIDED_ADDRESS",
409
- "Reference": "abcd-efgh-ijkl",
410
- "StatementDescriptor": "Example123"
411
- }
412
- )
413
-
414
- expect(cit).not_to be_nil
415
- # expect(cit['Status']).to eq('CREATED')
416
- expect(cit['PaymentType']).to eq('PAYPAL')
417
- expect(cit['ExecutionType']).to eq('WEB')
418
- end
419
-
420
- it 'creates a recurring paypal payment MIT' do
421
- wallet = new_wallet
422
- recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
423
- AuthorId: new_natural_user['Id'],
424
- CreditedUserId: wallet['Owners'][0],
425
- CreditedWalletId: wallet['Id'],
426
- FirstTransactionDebitedFunds: { Currency: 'EUR', Amount: 1000 },
427
- FirstTransactionFees: { Currency: 'EUR', Amount: 0 },
428
- Billing: {
429
- Address: {
430
- AddressLine1: 'AddressLine1',
431
- AddressLine2: 'AddressLine2',
432
- City: 'City',
433
- Region: 'Region',
434
- PostalCode: 'PostalCode',
435
- Country: 'FR'
436
- },
437
- FirstName: 'Joe',
438
- LastName: 'Blogs'
439
- },
440
- Shipping: {
441
- Address: {
442
- AddressLine1: 'AddressLine1',
443
- AddressLine2: 'AddressLine2',
444
- City: 'City',
445
- Region: 'Region',
446
- PostalCode: 'PostalCode',
447
- Country: 'FR'
448
- },
449
- FirstName: 'Joe',
450
- LastName: 'Blogs'
451
- },
452
- PaymentType: 'PAYPAL'
453
- )
454
- expect(recurring).not_to be_nil
455
- expect(recurring['Status']).not_to be_nil
456
- expect(recurring['Id']).not_to be_nil
457
-
458
- cit = MangoPay::PayIn::RecurringPayments::PayPalMIT.create(
459
- {
460
- "ReturnURL": "http://example.com",
461
- "CancelURL": "http://example.net",
462
- "LineItems": [
463
- {
464
- "Name": "Running shoes",
465
- "Quantity": 1,
466
- "UnitAmount": 1000,
467
- "TaxAmount": 0,
468
- "Description": "ID of Seller 1",
469
- "Category": "PHYSICAL_GOODS"
470
- }
471
- ],
472
- "Tag": "Created using the Mangopay API Postman collection",
473
- "RecurringPayinRegistrationId": recurring['Id'],
474
- "ShippingPreference": "SET_PROVIDED_ADDRESS",
475
- "Reference": "abcd-efgh-ijkl",
476
- "StatementDescriptor": "Example123",
477
- "DebitedFunds": {
478
- "Currency": "EUR",
479
- "Amount": 1000
480
- },
481
- "Fees": {
482
- "Currency": "EUR",
483
- "Amount": 0
484
- }
485
- }
486
- )
487
-
488
- expect(cit).not_to be_nil
489
- # expect(cit['Status']).to eq('CREATED')
490
- expect(cit['PaymentType']).to eq('PAYPAL')
491
- expect(cit['ExecutionType']).to eq('WEB')
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
556
- end
557
- end
@@ -1,34 +0,0 @@
1
- describe MangoPay::Refund do
2
- include_context 'transfers'
3
-
4
- describe 'FETCH' do
5
- it 'fetches a refund' do
6
- transfer = new_transfer
7
- resource = MangoPay::Transfer.refund(transfer['Id'], { AuthorId: transfer['AuthorId'] })
8
-
9
- refund = MangoPay::Refund.fetch(resource['Id'])
10
-
11
- expect(refund['Id']).not_to be_nil
12
- expect(refund['Status']).to eq('SUCCEEDED')
13
- expect(refund['Type']).to eq('TRANSFER')
14
- expect(refund['Nature']).to eq('REFUND')
15
- expect(refund['InitialTransactionType']).to eq('TRANSFER')
16
- expect(refund['InitialTransactionId']).to eq(transfer['Id'])
17
- expect(refund['DebitedWalletId']).to eq(transfer['CreditedWalletId'])
18
- expect(refund['CreditedWalletId']).to eq(transfer['DebitedWalletId'])
19
- end
20
- end
21
-
22
- #describe 'FETCH for Repudiation' do
23
- # it "fetches a repudiation's refunds" do
24
- # disputes = MangoPay::Dispute.fetch
25
- # dispute = disputes.find do |dispute|
26
- # dispute['DisputeType'] == 'NOT_CONTESTABLE'\
27
- # && !dispute['InitialTransactionId'].nil?
28
- # end
29
- # repudiation_id = MangoPay::Dispute.transactions(dispute['Id'])[0]['Id']
30
- # refunds = MangoPay::Refund.of_repudiation(repudiation_id)
31
- # expect(refunds).to be_an(Array)
32
- # end
33
- # end
34
- end
@@ -1,26 +0,0 @@
1
- describe MangoPay::Regulatory do
2
-
3
- describe 'GET Country Authorizations' do
4
- it 'can get country authorizations' do
5
- country_authorizations = MangoPay::Regulatory.get_country_authorizations('FR')
6
-
7
- expect(country_authorizations).not_to be_nil
8
- expect(country_authorizations['CountryCode']).not_to be_nil
9
- expect(country_authorizations['CountryName']).not_to be_nil
10
- expect(country_authorizations['Authorization']).not_to be_nil
11
- expect(country_authorizations['LastUpdate']).not_to be_nil
12
- end
13
- end
14
-
15
- describe 'GET All Countries Authorizations' do
16
- it 'can get all countries authorizations' do
17
- country_authorizations = MangoPay::Regulatory.get_all_countries_authorizations
18
-
19
- expect(country_authorizations).not_to be_nil
20
- expect(country_authorizations[0]['CountryCode']).not_to be_nil
21
- expect(country_authorizations[0]['CountryName']).not_to be_nil
22
- expect(country_authorizations[0]['Authorization']).not_to be_nil
23
- expect(country_authorizations[0]['LastUpdate']).not_to be_nil
24
- end
25
- end
26
- end
@@ -1,40 +0,0 @@
1
- describe MangoPay::Report do
2
-
3
- def create
4
- params = {
5
- Tag: 'custom meta',
6
- CallbackURL: 'http://www.my-site.com/callbackURL/',
7
- DownloadFormat: 'CSV',
8
- Sort: 'CreationDate:DESC',
9
- Preview: false,
10
- Filters: {},
11
- Columns: [ 'Id', 'CreationDate' ],
12
- ReportType: 'transactions'
13
- }
14
- MangoPay::Report.create(params)
15
- end
16
-
17
- describe 'CREATE' do
18
- it 'creates a report' do
19
- created = create
20
- expect(created['Id']).to_not be_nil
21
- end
22
- end
23
-
24
- describe 'FETCH' do
25
-
26
- it 'fetches a report' do
27
- created = create
28
- fetched = MangoPay::Report.fetch(created['Id'])
29
- expect(fetched['Id']).to eq(created['Id'])
30
- end
31
-
32
- it 'fetches all the reports' do
33
- reports = MangoPay::Report.fetch()
34
- expect(reports).to be_kind_of(Array)
35
- expect(reports).not_to be_empty
36
- end
37
-
38
- end
39
-
40
- end