mangopay 3.13.2 → 3.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33c2d6553dc8885b0fe21e619033297cf0b7101a34075ad1bc71ec9a17117707
4
- data.tar.gz: ec0af8fa883f54639840ff7fd47b26f3ac491509122ecb83a755919263d4e811
3
+ metadata.gz: 202974d7cf1a5592a21a8c4bdeb77f5b30d701832f30bcfb81370f7ecba899cf
4
+ data.tar.gz: 6223cb0b60c1879400244935a36703b340e848a1d79ae31dc32b6b046b0d336f
5
5
  SHA512:
6
- metadata.gz: 2be5f515afb4652ec2b18d8411dfcaff56ccde9e7c7a121dc6ce575392165ae1a86a0d245f4553e0a9b94e7d8cefe4acb00284c9946b47d1a3a05ce3a38ad030
7
- data.tar.gz: a67eab6dbb229a8a9d53f4839faa11650de723dda61bf208e8a10c44b7c7fcf47605a7af2620330d501b5a278b891cb57b15f6b58b21275b67de677f812d0d69
6
+ metadata.gz: 847b4ff7fb5334910c45613e5ffb9bb54be337f13f8fb72761e9011a763bb05790f208eb8bf1e34d28fa0e71500b50dd5fad4c189b46ad17d6bc395ad8ee4cab
7
+ data.tar.gz: 6b99e0af648f75578e03adaab4cc3f1887709b14a057a24fe60ee6c6a9dc9b5bff77624cfeb11fc6d63e6791306641be4c06e704bfd46b1e6186992f1ea60ceb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [3.15.0] - 2023-07-07
2
+ ### Added
3
+
4
+ - Google Pay is now available as a payment method with Mangopay. This payment method is in private beta. Please contact support if you have any questions.
5
+ - Paypal integration with Mangopay has been improved. This payment method is in private beta. Please contact support if you have any questions.
6
+
7
+ ### Fixed
8
+
9
+ - `Phone` parameter instead of `PhoneNumber` for MBWay
10
+ - Timeout should be in secondes instead of milliseconds in the configuration
11
+ ## [3.14.0] - 2023-06-21
12
+ ### Added
13
+
14
+ - MB WAY is now available as a payment method with Mangopay. This payment method is in private beta. Please contact support if you have any questions.
15
+
1
16
  ## [3.13.2] - 2023-05-18
2
17
  ### Fixes
3
18
 
@@ -48,7 +48,7 @@ module MangoPay
48
48
  super(message) if message
49
49
  end
50
50
 
51
- def type; @details['Type']; end
51
+ def type; @details['Type'] || @details['type']; end
52
52
  def error; @details['error']; end
53
53
  def errors; @details['errors'] || error; end
54
54
 
@@ -56,7 +56,7 @@ module MangoPay
56
56
  if error
57
57
  msg = error
58
58
  else
59
- msg = @details['Message']
59
+ msg = @details['Message'] || @details['message']
60
60
  msg += errors.sort.map {|k,v| " #{k}: #{v}"}.join if (errors && errors.is_a?(Hash))
61
61
  msg
62
62
  end
@@ -101,6 +101,7 @@ module MangoPay
101
101
  module PayPal
102
102
 
103
103
  # See https://docs.mangopay.com/api-references/payins/paypal-payin/
104
+ # <b>DEPRECATED</b>: Please use the Direct payment method. Web will be removed in a future version.
104
105
  class Web < Resource
105
106
  include HTTPCalls::Create
106
107
  def self.url(*)
@@ -108,6 +109,13 @@ module MangoPay
108
109
  end
109
110
  end
110
111
 
112
+ class Direct < Resource
113
+ include HTTPCalls::Create
114
+ def self.url(*)
115
+ "#{MangoPay.api_path}/payins/payment-methods/paypal"
116
+ end
117
+ end
118
+
111
119
  end
112
120
 
113
121
  module Payconiq
@@ -136,7 +144,17 @@ module MangoPay
136
144
  include HTTPCalls::Create
137
145
 
138
146
  def self.url(*)
139
- "#{MangoPay.api_path}/payins/googlepay/#{CGI.escape(class_name.downcase)}"
147
+ "#{MangoPay.api_path}/payins/payment-methods/googlepay"
148
+ end
149
+ end
150
+ end
151
+
152
+ module Mbway
153
+ class Direct < Resource
154
+ include HTTPCalls::Create
155
+
156
+ def self.url(*)
157
+ "#{MangoPay.api_path}/payins/payment-methods/mbway"
140
158
  end
141
159
  end
142
160
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.13.2'
2
+ VERSION = '3.15.0'
3
3
  end
data/lib/mangopay.rb CHANGED
@@ -64,7 +64,7 @@ module MangoPay
64
64
  end
65
65
 
66
66
  def http_timeout
67
- @http_timeout || 30000
67
+ @http_timeout || 30
68
68
  end
69
69
 
70
70
  def http_max_retries
@@ -72,7 +72,7 @@ module MangoPay
72
72
  end
73
73
 
74
74
  def http_open_timeout
75
- @http_open_timeout || 60000
75
+ @http_open_timeout || 30
76
76
  end
77
77
  end
78
78
 
@@ -0,0 +1,21 @@
1
+ describe MangoPay::PayIn::GooglePay::Direct, type: :feature do
2
+ include_context 'payins'
3
+
4
+ def check_type_and_status(payin)
5
+ expect(payin['Type']).to eq('PAYIN')
6
+ expect(payin['Nature']).to eq('REGULAR')
7
+ expect(payin['PaymentType']).to eq('GOOGLE_PAY')
8
+ expect(payin['ExecutionType']).to eq('DIRECT')
9
+ expect(payin['Status']).to eq('CREATED')
10
+ end
11
+
12
+ describe 'CREATE' do
13
+ it 'creates a googlepay direct payin' do
14
+ pending("Cannot be tested due to impossibility to generate payment_data in test")
15
+ created = new_payin_googlepay_direct
16
+ expect(created['Id']).not_to be_nil
17
+ check_type_and_status(created)
18
+ end
19
+ end
20
+ end
21
+
@@ -0,0 +1,32 @@
1
+ describe MangoPay::PayIn::Mbway::Direct, 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('MBWAY')
9
+ expect(payin['ExecutionType']).to eq('DIRECT')
10
+ expect(payin['Status']).to eq('CREATED')
11
+ end
12
+
13
+ describe 'CREATE' do
14
+ it 'creates a mbway direct payin' do
15
+ created = new_payin_mbway_direct
16
+ expect(created['Id']).not_to be_nil
17
+ expect(created['Phone']).not_to be_nil
18
+ check_type_and_status(created)
19
+ end
20
+ end
21
+
22
+ describe 'FETCH' do
23
+ it 'fetches a payin' do
24
+ created = new_payin_mbway_direct
25
+ fetched = MangoPay::PayIn.fetch(created['Id'])
26
+ expect(fetched['Id']).to eq(created['Id'])
27
+ check_type_and_status(created)
28
+ check_type_and_status(fetched)
29
+ end
30
+ end
31
+
32
+ end
@@ -0,0 +1,38 @@
1
+ describe MangoPay::PayIn::PayPal::Direct, type: :feature do
2
+ include_context 'payins'
3
+
4
+ def check_type_and_status(payin)
5
+ expect(payin['Type']).to eq('PAYIN')
6
+ expect(payin['Nature']).to eq('REGULAR')
7
+ expect(payin['PaymentType']).to eq('PAYPAL')
8
+ expect(payin['ExecutionType']).to eq('DIRECT')
9
+
10
+ # not SUCCEEDED yet: waiting for processing
11
+ expect(payin['Status']).to eq('CREATED')
12
+ expect(payin['ResultCode']).to be_nil
13
+ expect(payin['ResultMessage']).to be_nil
14
+ expect(payin['ExecutionDate']).to be_nil
15
+ end
16
+
17
+ describe 'CREATE' do
18
+ it 'creates a paypal direct payin' do
19
+ created = new_payin_paypal_direct
20
+ expect(created['Id']).not_to be_nil
21
+ check_type_and_status(created)
22
+ end
23
+ end
24
+
25
+ describe 'FETCH' do
26
+ it 'fetches a payin' do
27
+ created = new_payin_paypal_direct
28
+ fetched = MangoPay::PayIn.fetch(created['Id'])
29
+ expect(fetched['Id']).to eq(created['Id'])
30
+ expect(fetched['CreationDate']).to eq(created['CreationDate'])
31
+ expect(fetched['CreditedFunds']).to eq(created['CreditedFunds'])
32
+ expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
33
+ check_type_and_status(created)
34
+ check_type_and_status(fetched)
35
+ end
36
+ end
37
+
38
+ end
@@ -261,27 +261,50 @@ shared_context 'payins' do
261
261
  let(:new_payin_googlepay_direct) do
262
262
  MangoPay::PayIn::GooglePay::Direct.create(
263
263
  AuthorId: new_natural_user['Id'],
264
- CreditedUserId: new_wallet['Owners'][0],
265
264
  CreditedWalletId: new_wallet['Id'],
266
265
  DebitedFunds: {Currency: 'EUR', Amount: 199},
267
266
  Fees: {Currency: 'EUR', Amount: 1},
268
- PaymentData: {
269
- TransactionId: '061EB32181A2D9CA42AD16031B476EEBAA62A9A095AD660E2759FBA52B51A61',
270
- Network: 'VISA',
271
- TokenData: "tokenData"
272
- },
273
267
  StatementDescriptor: "ruby",
274
- ReturnURL: MangoPay.configuration.root_url,
275
268
  Tag: 'Test PayIn/GooglePay/Direct',
269
+ IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
270
+ SecureModeReturnURL: 'http://test.com',
271
+ SecureMode: 'DEFAULT',
272
+ ReturnURL: 'https://mangopay.com/docs/please-ignore',
273
+ BrowserInfo: {
274
+ AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
275
+ JavaEnabled: true,
276
+ Language: "fr-FR",
277
+ ColorDepth: 4,
278
+ ScreenHeight: 1800,
279
+ ScreenWidth: 400,
280
+ JavascriptEnabled: true,
281
+ TimeZoneOffset: "+60",
282
+ UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
283
+ },
284
+ PaymentData: "{\"signature\":\"MEUCIQCLXOan2Y9DobLVSOeD5V64Peayvz0ZAWisdz/1iTdthAIgVFb4Hve4EhtW81k46SiMlnXLIiCn1h2+vVQGjHe+sSo\\u003d\",\"intermediateSigningKey\":{\"signedKey\":\"{\\\"keyValue\\\":\\\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEDGRER6R6PH6K39YTIYX+CpDNej6gQgvi/Wx19SOPtiDnkjAl4/LF9pXlvZYe+aJH0Dy095I6BlfY8bNBB5gjPg\\\\u003d\\\\u003d\\\",\\\"keyExpiration\\\":\\\"1688521049102\\\"}\",\"signatures\":[\"MEYCIQDup1B+rkiPAWmpg7RmqY0NfgdGhmdyL8wvAX+6C1aOU2QIhAIZACSDQ/ZexIyEia5KrRlG2B+y3AnKNlhRzumRcnNOR\"]},\"protocolVersion\":\"ECv2\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"YSSGK9yFdKP+mJB5+wAjnOujnThPM1E/KbbJxd3MDzPVI66ip1DBESldvQXYjjeLq6Rf1tKE9oLwwaj6u0/gU7Z9t3g1MoW+9YoEE1bs1IxImif7IQGAosfYjjbBBfDkOaqEs2JJC5qt6xjKO9lQ/E6JPkPFGqF7+OJ1vzmD83Pi3sHWkVge5MhxXQ3yBNhrjus3kV7zUoYA+uqNrciWcWypc1NndF/tiwSkvUTzM6n4dS8X84fkJiSO7PZ65C0yw0mdybRRnyL2fFdWGssve1zZFAvYfzcpNamyuZGGlu/SCoayitojmMsqe5Cu0efD9+WvvDr9PA+Vo1gzuz7LmiZe81SGvdFhRoq62FBAUiwSsi2A3pWinZxM2XbYNph+HJ5FCNspWhz4ur9JG4ZMLemCXuaybvL++W6PWywAtoiE0mQcBIX3vhOq5itv0RkaKVe6nbcAS2UryRz2u/nDCJLKpIv2Wi11NtCUT2mgD8F6qfcXhvVZHyeLqZ1OLgCudTTSdKirzezbgPTg4tQpW++KufeD7bgG+01XhCWt+7/ftqcSf8n//gSRINne8j2G6w+2\\\",\\\"ephemeralPublicKey\\\":\\\"BLY2+R8C0T+BSf/W3HEq305qH63IGmJxMVmbfJ6+x1V7GQg9W9v7eHc3j+8TeypVn+nRlPu98tivuMXECg+rWZs\\\\u003d\\\",\\\"tag\\\":\\\"MmEjNdLfsDNfYd/FRUjoJ4/IfLypNRqx8zgHfa6Ftmo\\\\u003d\\\"}\"}",
276
285
  Billing: {
277
- Address: {
278
- AddressLine1: 'AddressLine1',
279
- AddressLine2: 'AddressLine2',
280
- City: 'City',
281
- Region: 'Region',
282
- PostalCode: 'PostalCode',
283
- CountryIso: 'FR'
284
- }
286
+ FirstName: 'FName',
287
+ LastName: 'LName',
288
+ Address: {
289
+ AddressLine1: 'AddressLine1',
290
+ AddressLine2: 'AddressLine2',
291
+ City: 'City',
292
+ Region: 'Region',
293
+ PostalCode: 'PostalCode',
294
+ Country: 'FR'
295
+ }
296
+ },
297
+ Shipping: {
298
+ FirstName: 'FName',
299
+ LastName: 'LName',
300
+ Address: {
301
+ AddressLine1: 'AddressLine1',
302
+ AddressLine2: 'AddressLine2',
303
+ City: 'City',
304
+ Region: 'Region',
305
+ PostalCode: 'PostalCode',
306
+ Country: 'FR'
307
+ }
285
308
  }
286
309
  )
287
310
  end
@@ -417,6 +440,65 @@ shared_context 'payins' do
417
440
 
418
441
  let(:new_payin_card_direct) { create_new_payin_card_direct(new_wallet) }
419
442
 
443
+ ###############################################
444
+ # MBWAY/direct
445
+ ###############################################
446
+ let(:new_payin_mbway_direct) do
447
+ MangoPay::PayIn::Mbway::Direct.create(
448
+ AuthorId: new_natural_user['Id'],
449
+ CreditedWalletId: new_wallet['Id'],
450
+ DebitedFunds: {Currency: 'EUR', Amount: 199},
451
+ Fees: {Currency: 'EUR', Amount: 1},
452
+ StatementDescriptor: "ruby",
453
+ Tag: 'Test PayIn/Mbway/Direct',
454
+ Phone: '351#269458236'
455
+ )
456
+ end
457
+
458
+ ###############################################
459
+ # PAYPAL/direct
460
+ ###############################################
461
+ let(:new_payin_paypal_direct) do
462
+ MangoPay::PayIn::PayPal::Direct.create(
463
+ AuthorId: new_natural_user['Id'],
464
+ DebitedFunds: { Currency: 'EUR', Amount: 400 },
465
+ Fees: { Currency: 'EUR', Amount: 0 },
466
+ CreditedWalletId: new_wallet['Id'],
467
+ ReturnUrl: "http://example.com",
468
+ LineItems: [
469
+ {
470
+ Name: "running shoes",
471
+ Quantity: 1,
472
+ UnitAmount: 200,
473
+ TaxAmount: 0,
474
+ Description: "seller1 ID"
475
+ },
476
+ {
477
+ Name: "running shoes",
478
+ Quantity: 1,
479
+ UnitAmount: 200,
480
+ TaxAmount: 0,
481
+ Description: "seller2 ID"
482
+ }
483
+ ],
484
+ Shipping: {
485
+ Address: {
486
+ AddressLine1: 'AddressLine1',
487
+ AddressLine2: 'AddressLine2',
488
+ City: 'City',
489
+ Region: 'Region',
490
+ PostalCode: 'PostalCode',
491
+ Country: 'FR'
492
+ },
493
+ FirstName: 'Joe',
494
+ LastName: 'Blogs'
495
+ },
496
+ StatementDescriptor: "ruby",
497
+ Tag: 'Test',
498
+ # Culture: 'FR'
499
+ )
500
+ end
501
+
420
502
  def create_new_payin_card_direct(to_wallet, amnt = 1000)
421
503
  cardreg = new_card_registration_completed
422
504
  MangoPay::PayIn::Card::Direct.create(
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.13.2
4
+ version: 3.15.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: 2023-05-18 00:00:00.000000000 Z
12
+ date: 2023-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -134,7 +134,10 @@ files:
134
134
  - spec/mangopay/payin_card_web_spec.rb
135
135
  - spec/mangopay/payin_directdebit_direct_spec.rb
136
136
  - spec/mangopay/payin_directdebit_web_spec.rb
137
+ - spec/mangopay/payin_googlepay_direct_spec.rb
138
+ - spec/mangopay/payin_mbway_direct_spec.rb
137
139
  - spec/mangopay/payin_payconiq_web_spec.rb
140
+ - spec/mangopay/payin_paypal_direct_spec.rb
138
141
  - spec/mangopay/payin_paypal_web_spec.rb
139
142
  - spec/mangopay/payin_preauthorized_direct_spec.rb
140
143
  - spec/mangopay/payout_bankwire_spec.rb
@@ -202,7 +205,10 @@ test_files:
202
205
  - spec/mangopay/payin_card_web_spec.rb
203
206
  - spec/mangopay/payin_directdebit_direct_spec.rb
204
207
  - spec/mangopay/payin_directdebit_web_spec.rb
208
+ - spec/mangopay/payin_googlepay_direct_spec.rb
209
+ - spec/mangopay/payin_mbway_direct_spec.rb
205
210
  - spec/mangopay/payin_payconiq_web_spec.rb
211
+ - spec/mangopay/payin_paypal_direct_spec.rb
206
212
  - spec/mangopay/payin_paypal_web_spec.rb
207
213
  - spec/mangopay/payin_preauthorized_direct_spec.rb
208
214
  - spec/mangopay/payout_bankwire_spec.rb