mangopay 3.14.0 → 3.15.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 +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/mangopay/errors.rb +2 -2
- data/lib/mangopay/pay_in.rb +9 -1
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay.rb +2 -2
- data/spec/mangopay/payin_googlepay_direct_spec.rb +21 -0
- data/spec/mangopay/payin_mbway_direct_spec.rb +1 -1
- data/spec/mangopay/payin_paypal_direct_spec.rb +38 -0
- data/spec/mangopay/shared_resources.rb +83 -16
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 202974d7cf1a5592a21a8c4bdeb77f5b30d701832f30bcfb81370f7ecba899cf
|
4
|
+
data.tar.gz: 6223cb0b60c1879400244935a36703b340e848a1d79ae31dc32b6b046b0d336f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 847b4ff7fb5334910c45613e5ffb9bb54be337f13f8fb72761e9011a763bb05790f208eb8bf1e34d28fa0e71500b50dd5fad4c189b46ad17d6bc395ad8ee4cab
|
7
|
+
data.tar.gz: 6b99e0af648f75578e03adaab4cc3f1887709b14a057a24fe60ee6c6a9dc9b5bff77624cfeb11fc6d63e6791306641be4c06e704bfd46b1e6186992f1ea60ceb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
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
|
1
11
|
## [3.14.0] - 2023-06-21
|
2
12
|
### Added
|
3
13
|
|
data/lib/mangopay/errors.rb
CHANGED
@@ -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
|
data/lib/mangopay/pay_in.rb
CHANGED
@@ -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,7 @@ module MangoPay
|
|
136
144
|
include HTTPCalls::Create
|
137
145
|
|
138
146
|
def self.url(*)
|
139
|
-
"#{MangoPay.api_path}/payins/googlepay
|
147
|
+
"#{MangoPay.api_path}/payins/payment-methods/googlepay"
|
140
148
|
end
|
141
149
|
end
|
142
150
|
end
|
data/lib/mangopay/version.rb
CHANGED
data/lib/mangopay.rb
CHANGED
@@ -64,7 +64,7 @@ module MangoPay
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def http_timeout
|
67
|
-
@http_timeout ||
|
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 ||
|
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
|
+
|
@@ -14,7 +14,7 @@ describe MangoPay::PayIn::Mbway::Direct, type: :feature do
|
|
14
14
|
it 'creates a mbway direct payin' do
|
15
15
|
created = new_payin_mbway_direct
|
16
16
|
expect(created['Id']).not_to be_nil
|
17
|
-
expect(created['
|
17
|
+
expect(created['Phone']).not_to be_nil
|
18
18
|
check_type_and_status(created)
|
19
19
|
end
|
20
20
|
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
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
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
|
@@ -428,7 +451,51 @@ shared_context 'payins' do
|
|
428
451
|
Fees: {Currency: 'EUR', Amount: 1},
|
429
452
|
StatementDescriptor: "ruby",
|
430
453
|
Tag: 'Test PayIn/Mbway/Direct',
|
431
|
-
|
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'
|
432
499
|
)
|
433
500
|
end
|
434
501
|
|
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.
|
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-
|
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,8 +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
|
137
138
|
- spec/mangopay/payin_mbway_direct_spec.rb
|
138
139
|
- spec/mangopay/payin_payconiq_web_spec.rb
|
140
|
+
- spec/mangopay/payin_paypal_direct_spec.rb
|
139
141
|
- spec/mangopay/payin_paypal_web_spec.rb
|
140
142
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
141
143
|
- spec/mangopay/payout_bankwire_spec.rb
|
@@ -203,8 +205,10 @@ test_files:
|
|
203
205
|
- spec/mangopay/payin_card_web_spec.rb
|
204
206
|
- spec/mangopay/payin_directdebit_direct_spec.rb
|
205
207
|
- spec/mangopay/payin_directdebit_web_spec.rb
|
208
|
+
- spec/mangopay/payin_googlepay_direct_spec.rb
|
206
209
|
- spec/mangopay/payin_mbway_direct_spec.rb
|
207
210
|
- spec/mangopay/payin_payconiq_web_spec.rb
|
211
|
+
- spec/mangopay/payin_paypal_direct_spec.rb
|
208
212
|
- spec/mangopay/payin_paypal_web_spec.rb
|
209
213
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
210
214
|
- spec/mangopay/payout_bankwire_spec.rb
|