mangopay 3.17.0 → 3.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/mangopay/instant_conversion.rb +24 -0
- data/lib/mangopay/pay_in.rb +20 -0
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay.rb +1 -0
- data/spec/mangopay/instant_conversion_spec.rb +33 -0
- data/spec/mangopay/payin_giropay_web_spec.rb +30 -0
- data/spec/mangopay/payin_ideal_web_spec.rb +30 -0
- data/spec/mangopay/shared_resources.rb +440 -354
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2459553bb0f22fb9230f0b13fa8068e6dccb7996c3436a669bea65e05af3e575
|
4
|
+
data.tar.gz: 1242453e9fd1f2d9fb943c737c0eef69e1caf26aed2aaae24ee2012803816ddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3478fdff62b888c86e3e38d1079cd467eb0e7860e16fc9977d9e6be49bec4c645e5a63b0a954c2f416577788abd125759d6b079e191b55a846af524044598e9
|
7
|
+
data.tar.gz: 11634f163a8d798787a4a1a200592b2387caf05df99df24a4089add703d6128f648aaa8c884c590bbaba2e53ab85ca45100e52fbb3ff89e218a6e0c9d7ddfedb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## [3.19.0] - 2023-11-02
|
2
|
+
### Updated
|
3
|
+
|
4
|
+
- Giropay and Ideal integrations with Mangopay have been improved.
|
5
|
+
- Klarna param "MerchantOrderId" has been renamed to "Reference"
|
6
|
+
|
7
|
+
## [3.18.0] - 2023-09-29
|
8
|
+
### Added
|
9
|
+
- Instantly convert funds between 2 wallets of different currencies owned by the same user with the new SPOT FX endpoints
|
10
|
+
|
1
11
|
## [3.17.0] - 2023-09-20
|
2
12
|
### Added
|
3
13
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
class InstantConversion < Resource
|
4
|
+
include HTTPCalls::Fetch
|
5
|
+
include HTTPCalls::Update
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def get_rate(debited_currency, credited_currency, params)
|
9
|
+
url = "#{MangoPay.api_path}/conversion/rate/#{debited_currency}/#{credited_currency}"
|
10
|
+
MangoPay.request(:get, url, params)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
url = "#{MangoPay.api_path}/instant-conversion"
|
15
|
+
MangoPay.request(:post, url, params)
|
16
|
+
end
|
17
|
+
|
18
|
+
def get(id, params)
|
19
|
+
url = "#{MangoPay.api_path}/instant-conversion/#{id}"
|
20
|
+
MangoPay.request(:get, url, params)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/mangopay/pay_in.rb
CHANGED
@@ -197,6 +197,26 @@ module MangoPay
|
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
+
module Ideal
|
201
|
+
class Web < Resource
|
202
|
+
include HTTPCalls::Create
|
203
|
+
|
204
|
+
def self.url(*)
|
205
|
+
"#{MangoPay.api_path}/payins/payment-methods/ideal"
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
module Giropay
|
211
|
+
class Web < Resource
|
212
|
+
include HTTPCalls::Create
|
213
|
+
|
214
|
+
def self.url(*)
|
215
|
+
"#{MangoPay.api_path}/payins/payment-methods/giropay"
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
200
220
|
module RecurringPayments
|
201
221
|
class Recurring < Resource
|
202
222
|
include HTTPCalls::Create
|
data/lib/mangopay/version.rb
CHANGED
data/lib/mangopay.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
describe MangoPay::InstantConversion, type: :feature do
|
2
|
+
include_context 'instant_conversion'
|
3
|
+
|
4
|
+
describe 'GET CONVERSION RATE' do
|
5
|
+
it 'get a conversion rate' do
|
6
|
+
conversion_rate = get_conversion_rate('EUR','GBP')
|
7
|
+
|
8
|
+
expect(conversion_rate['ClientRate']).not_to be_nil
|
9
|
+
expect(conversion_rate['MarketRate']).not_to be_nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'CREATE CONVERSION' do
|
14
|
+
it 'creates a new conversion' do
|
15
|
+
conversion = create_instant_conversion
|
16
|
+
|
17
|
+
expect(conversion['DebitedFunds']['Amount']).not_to be_nil
|
18
|
+
expect(conversion['CreditedFunds']['Amount']).not_to be_nil
|
19
|
+
expect(conversion['Status']).equal? 'SUCCEEDED'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'GET EXISTING CONVERSION' do
|
24
|
+
it 'get an existing conversion' do
|
25
|
+
conversion = create_instant_conversion
|
26
|
+
returned_conversion = get_instant_conversion(conversion['Id'])
|
27
|
+
|
28
|
+
expect(returned_conversion['DebitedFunds']['Amount']).not_to be_nil
|
29
|
+
expect(returned_conversion['CreditedFunds']['Amount']).not_to be_nil
|
30
|
+
expect(returned_conversion['Status']).equal? 'SUCCEEDED'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
describe MangoPay::PayIn::Giropay::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('GIROPAY')
|
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 giropay web payin' do
|
15
|
+
created = new_payin_giropay_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_giropay_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
|
@@ -0,0 +1,30 @@
|
|
1
|
+
describe MangoPay::PayIn::Ideal::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('IDEAL')
|
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 ideal web payin' do
|
15
|
+
created = new_payin_ideal_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_ideal_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
|
@@ -6,24 +6,24 @@ shared_context 'users' do
|
|
6
6
|
|
7
7
|
def define_new_natural_user
|
8
8
|
{
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
9
|
+
Tag: 'Test natural user',
|
10
|
+
Email: 'my@email.com',
|
11
|
+
FirstName: 'John',
|
12
|
+
LastName: 'Doe',
|
13
|
+
Address: {
|
14
|
+
AddressLine1: 'Le Palais Royal',
|
15
|
+
AddressLine2: '8 Rue de Montpensier',
|
16
|
+
City: 'Paris',
|
17
|
+
Region: '',
|
18
|
+
PostalCode: '75001',
|
19
|
+
Country: 'FR'
|
20
|
+
},
|
21
|
+
Birthday: 1_300_186_358,
|
22
|
+
Birthplace: 'Paris',
|
23
|
+
Nationality: 'FR',
|
24
|
+
CountryOfResidence: 'FR',
|
25
|
+
Occupation: 'Worker',
|
26
|
+
IncomeRange: 1
|
27
27
|
}
|
28
28
|
end
|
29
29
|
|
@@ -33,35 +33,35 @@ shared_context 'users' do
|
|
33
33
|
|
34
34
|
let(:new_legal_user) do
|
35
35
|
MangoPay::LegalUser.create(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
36
|
+
Name: 'Super',
|
37
|
+
Email: 'super@email.com',
|
38
|
+
LegalPersonType: 'BUSINESS',
|
39
|
+
HeadquartersAddress: {
|
40
|
+
AddressLine1: '6 Parvis Notre-Dame',
|
41
|
+
AddressLine2: 'Pl. Jean-Paul II',
|
42
|
+
City: 'Paris',
|
43
|
+
Region: 'FR',
|
44
|
+
PostalCode: '75004',
|
45
|
+
Country: 'FR'
|
46
|
+
},
|
47
|
+
LegalRepresentativeFirstName: 'John',
|
48
|
+
LegalRepresentativeLastName: 'Doe',
|
49
|
+
LegalRepresentativeAdress: {
|
50
|
+
AddressLine1: '38 Rue de Montpensier',
|
51
|
+
AddressLine2: '',
|
52
|
+
City: 'Paris',
|
53
|
+
Region: '',
|
54
|
+
PostalCode: '75001',
|
55
|
+
Country: 'FR'
|
56
|
+
},
|
57
|
+
LegalRepresentativeEmail: 'john@doe.com',
|
58
|
+
LegalRepresentativeBirthday: 1_300_186_358,
|
59
|
+
LegalRepresentativeNationality: 'FR',
|
60
|
+
LegalRepresentativeCountryOfResidence: 'FR',
|
61
|
+
CompanyNumber: 'LU123456789',
|
62
|
+
Statute: '',
|
63
|
+
ProofOfRegistration: '',
|
64
|
+
ShareholderDeclaration: ''
|
65
65
|
)
|
66
66
|
end
|
67
67
|
end
|
@@ -76,10 +76,10 @@ shared_context 'wallets' do
|
|
76
76
|
|
77
77
|
def create_new_wallet(user)
|
78
78
|
MangoPay::Wallet.create(
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
Owners: [user['Id']],
|
80
|
+
Description: 'A test wallet',
|
81
|
+
Currency: 'EUR',
|
82
|
+
Tag: 'Test wallet'
|
83
83
|
)
|
84
84
|
end
|
85
85
|
|
@@ -98,22 +98,22 @@ end
|
|
98
98
|
shared_context 'ubo' do
|
99
99
|
def new_ubo(user, ubo_declaration)
|
100
100
|
ubo = {
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
101
|
+
FirstName: 'John',
|
102
|
+
LastName: 'Doe',
|
103
|
+
Address: {
|
104
|
+
AddressLine1: '6 Parvis Notre-Dame',
|
105
|
+
AddressLine2: 'Pl. Jean-Paul II',
|
106
|
+
City: 'Paris',
|
107
|
+
Region: '',
|
108
|
+
PostalCode: '75004',
|
109
|
+
Country: 'FR'
|
110
|
+
},
|
111
|
+
Nationality: 'FR',
|
112
|
+
Birthday: 1_300_186_358,
|
113
|
+
Birthplace: {
|
114
|
+
City: 'Paris',
|
115
|
+
Country: 'FR'
|
116
|
+
}
|
117
117
|
}
|
118
118
|
MangoPay::Ubo.create(user['Id'], ubo_declaration['Id'], ubo)
|
119
119
|
end
|
@@ -129,12 +129,12 @@ shared_context 'bank_accounts' do
|
|
129
129
|
Type: 'IBAN',
|
130
130
|
OwnerName: 'John',
|
131
131
|
OwnerAddress: {
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
132
|
+
AddressLine1: 'Le Palais Royal',
|
133
|
+
AddressLine2: '8 Rue de Montpensier',
|
134
|
+
City: 'Paris',
|
135
|
+
Region: '',
|
136
|
+
PostalCode: '75001',
|
137
|
+
Country: 'FR'
|
138
138
|
},
|
139
139
|
IBAN: 'FR7630004000031234567890143',
|
140
140
|
BIC: 'BNPAFRPP',
|
@@ -151,10 +151,10 @@ shared_context 'mandates' do
|
|
151
151
|
|
152
152
|
def create_new_mandate
|
153
153
|
MangoPay::Mandate.create(
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
154
|
+
BankAccountId: new_bank_account['Id'],
|
155
|
+
Culture: 'FR',
|
156
|
+
ReturnURL: MangoPay.configuration.root_url,
|
157
|
+
Tag: 'Test mandate'
|
158
158
|
)
|
159
159
|
end
|
160
160
|
end
|
@@ -186,15 +186,15 @@ shared_context 'payins' do
|
|
186
186
|
|
187
187
|
let(:new_payin_directdebit_web) do
|
188
188
|
MangoPay::PayIn::DirectDebit::Web.create(
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
189
|
+
AuthorId: new_natural_user['Id'],
|
190
|
+
CreditedUserId: new_wallet['Owners'][0],
|
191
|
+
CreditedWalletId: new_wallet['Id'],
|
192
|
+
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
193
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
194
|
+
DirectDebitType: 'GIROPAY',
|
195
|
+
ReturnURL: MangoPay.configuration.root_url,
|
196
|
+
Culture: 'FR',
|
197
|
+
Tag: 'Test PayIn/DirectDebit/Web'
|
198
198
|
)
|
199
199
|
end
|
200
200
|
|
@@ -204,14 +204,14 @@ shared_context 'payins' do
|
|
204
204
|
|
205
205
|
let(:new_payin_paypal_web) do
|
206
206
|
MangoPay::PayIn::PayPal::Web.create(
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
207
|
+
AuthorId: new_natural_user['Id'],
|
208
|
+
CreditedUserId: new_wallet['Owners'][0],
|
209
|
+
CreditedWalletId: new_wallet['Id'],
|
210
|
+
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
211
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
212
|
+
ReturnURL: MangoPay.configuration.root_url,
|
213
|
+
Culture: "FR",
|
214
|
+
Tag: 'Test PayIn/PayPal/Web'
|
215
215
|
)
|
216
216
|
end
|
217
217
|
|
@@ -221,13 +221,13 @@ shared_context 'payins' do
|
|
221
221
|
|
222
222
|
let(:new_payin_payconiq_web) do
|
223
223
|
MangoPay::PayIn::Payconiq::Web.create(
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
224
|
+
AuthorId: new_natural_user['Id'],
|
225
|
+
CreditedWalletId: new_wallet['Id'],
|
226
|
+
DebitedFunds: { Currency: 'EUR', Amount: 100 },
|
227
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
228
|
+
ReturnURL: MangoPay.configuration.root_url,
|
229
|
+
Country: "BE",
|
230
|
+
Tag: 'Custom Meta'
|
231
231
|
)
|
232
232
|
end
|
233
233
|
|
@@ -237,20 +237,20 @@ shared_context 'payins' do
|
|
237
237
|
|
238
238
|
let(:new_payin_applepay_direct) do
|
239
239
|
MangoPay::PayIn::ApplePay::Direct.create(
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
240
|
+
AuthorId: new_natural_user['Id'],
|
241
|
+
CreditedUserId: new_wallet['Owners'][0],
|
242
|
+
CreditedWalletId: new_wallet['Id'],
|
243
|
+
DebitedFunds: { Currency: 'EUR', Amount: 199 },
|
244
|
+
Fees: { Currency: 'EUR', Amount: 1 },
|
245
|
+
PaymentType: 'APPLEPAY',
|
246
|
+
PaymentData: {
|
247
|
+
TransactionId: '061EB32181A2D9CA42AD16031B476EEBAA62A9A095AD660E2759FBA52B51A61',
|
248
|
+
Network: 'VISA',
|
249
|
+
TokenData: "{\"version\":\"EC_v1\",\"data\":\"w4HMBVqNC9ghPP4zncTA\\/0oQAsduERfsx78oxgniynNjZLANTL6+0koEtkQnW\\/K38Zew8qV1GLp+fLHo+qCBpiKCIwlz3eoFBTbZU+8pYcjaeIYBX9SOxcwxXsNGrGLk+kBUqnpiSIPaAG1E+WPT8R1kjOCnGvtdombvricwRTQkGjtovPfzZo8LzD3ZQJnHMsWJ8QYDLyr\\/ZN9gtLAtsBAMvwManwiaG3pOIWpyeOQOb01YcEVO16EZBjaY4x4C\\/oyFLWDuKGvhbJwZqWh1d1o9JT29QVmvy3Oq2JEjq3c3NutYut4rwDEP4owqI40Nb7mP2ebmdNgnYyWfPmkRfDCRHIWtbMC35IPg5313B1dgXZ2BmyZRXD5p+mr67vAk7iFfjEpu3GieFqwZrTl3\\/pI5V8Sxe3SIYKgT5Hr7ow==\",\"signature\":\"MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCAMIID5jCCA4ugAwIBAgIIaGD2mdnMpw8wCgYIKoZIzj0EAwIwejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTE2MDYwMzE4MTY0MFoXDTIxMDYwMjE4MTY0MFowYjEoMCYGA1UEAwwfZWNjLXNtcC1icm9rZXItc2lnbl9VQzQtU0FOREJPWDEUMBIGA1UECwwLaU9TIFN5c3RlbXMxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEgjD9q8Oc914gLFDZm0US5jfiqQHdbLPgsc1LUmeY+M9OvegaJajCHkwz3c6OKpbC9q+hkwNFxOh6RCbOlRsSlaOCAhEwggINMEUGCCsGAQUFBwEBBDkwNzA1BggrBgEFBQcwAYYpaHR0cDovL29jc3AuYXBwbGUuY29tL29jc3AwNC1hcHBsZWFpY2EzMDIwHQYDVR0OBBYEFAIkMAua7u1GMZekplopnkJxghxFMAwGA1UdEwEB\\/wQCMAAwHwYDVR0jBBgwFoAUI\\/JJxE+T5O8n5sT2KGw\\/orv9LkswggEdBgNVHSAEggEUMIIBEDCCAQwGCSqGSIb3Y2QFATCB\\/jCBwwYIKwYBBQUHAgIwgbYMgbNSZWxpYW5jZSBvbiB0aGlzIGNlcnRpZmljYXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRlIHBvbGljeSBhbmQgY2VydGlmaWNhdGlvbiBwcmFjdGljZSBzdGF0ZW1lbnRzLjA2BggrBgEFBQcCARYqaHR0cDovL3d3dy5hcHBsZS5jb20vY2VydGlmaWNhdGVhdXRob3JpdHkvMDQGA1UdHwQtMCswKaAnoCWGI2h0dHA6Ly9jcmwuYXBwbGUuY29tL2FwcGxlYWljYTMuY3JsMA4GA1UdDwEB\\/wQEAwIHgDAPBgkqhkiG92NkBh0EAgUAMAoGCCqGSM49BAMCA0kAMEYCIQDaHGOui+X2T44R6GVpN7m2nEcr6T6sMjOhZ5NuSo1egwIhAL1a+\\/hp88DKJ0sv3eT3FxWcs71xmbLKD\\/QJ3mWagrJNMIIC7jCCAnWgAwIBAgIISW0vvzqY2pcwCgYIKoZIzj0EAwIwZzEbMBkGA1UEAwwSQXBwbGUgUm9vdCBDQSAtIEczMSYwJAYDVQQLDB1BcHBsZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMwHhcNMTQwNTA2MjM0NjMwWhcNMjkwNTA2MjM0NjMwWjB6MS4wLAYDVQQDDCVBcHBsZSBBcHBsaWNhdGlvbiBJbnRlZ3JhdGlvbiBDQSAtIEczMSYwJAYDVQQLDB1BcHBsZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATwFxGEGddkhdUaXiWBB3bogKLv3nuuTeCN\\/EuT4TNW1WZbNa4i0Jd2DSJOe7oI\\/XYXzojLdrtmcL7I6CmE\\/1RFo4H3MIH0MEYGCCsGAQUFBwEBBDowODA2BggrBgEFBQcwAYYqaHR0cDovL29jc3AuYXBwbGUuY29tL29jc3AwNC1hcHBsZXJvb3RjYWczMB0GA1UdDgQWBBQj8knET5Pk7yfmxPYobD+iu\\/0uSzAPBgNVHRMBAf8EBTADAQH\\/MB8GA1UdIwQYMBaAFLuw3qFYM4iapIqZ3r6966\\/ayySrMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly9jcmwuYXBwbGUuY29tL2FwcGxlcm9vdGNhZzMuY3JsMA4GA1UdDwEB\\/wQEAwIBBjAQBgoqhkiG92NkBgIOBAIFADAKBggqhkjOPQQDAgNnADBkAjA6z3KDURaZsYb7NcNWymK\\/9Bft2Q91TaKOvvGcgV5Ct4n4mPebWZ+Y1UENj53pwv4CMDIt1UQhsKMFd2xd8zg7kGf9F3wsIW2WT8ZyaYISb1T4en0bmcubCYkhYQaZDwmSHQAAMYIBizCCAYcCAQEwgYYwejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTAghoYPaZ2cynDzANBglghkgBZQMEAgEFAKCBlTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xOTA1MjMxMTA1MDdaMCoGCSqGSIb3DQEJNDEdMBswDQYJYIZIAWUDBAIBBQChCgYIKoZIzj0EAwIwLwYJKoZIhvcNAQkEMSIEIIvfGVQYBeOilcB7GNI8m8+FBVZ28QfA6BIXaggBja2PMAoGCCqGSM49BAMCBEYwRAIgU01yYfjlx9bvGeC5CU2RS5KBEG+15HH9tz\\/sg3qmQ14CID4F4ZJwAz+tXAUcAIzoMpYSnM8YBlnGJSTSp+LhspenAAAAAAAA\",\"header\":{\"ephemeralPublicKey\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE0rs3wRpirXjPbFDQfPRdfEzRIZDWm0qn7Y0HB0PNzV1DDKfpYrnhRb4GEhBF\\/oEXBOe452PxbCnN1qAlqcSUWw==\",\"publicKeyHash\":\"saPRAqS7TZ4bAYwzBj8ezDDC55ZolyH1FL+Xc8fd93o=\",\"transactionId\":\"b061eb32181a2d9ca42ad16031b476eebaa62a9a095ad660e2759fba52b51a61\"}}"
|
250
|
+
},
|
251
|
+
StatementDescriptor: "php",
|
252
|
+
ReturnURL: MangoPay.configuration.root_url,
|
253
|
+
Tag: 'Test PayIn/ApplePay/Direct'
|
254
254
|
)
|
255
255
|
end
|
256
256
|
|
@@ -260,70 +260,69 @@ shared_context 'payins' do
|
|
260
260
|
###############################################
|
261
261
|
let(:new_payin_googlepay_direct) do
|
262
262
|
MangoPay::PayIn::GooglePay::Direct.create(
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
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
|
-
}
|
263
|
+
AuthorId: new_natural_user['Id'],
|
264
|
+
CreditedWalletId: new_wallet['Id'],
|
265
|
+
DebitedFunds: { Currency: 'EUR', Amount: 199 },
|
266
|
+
Fees: { Currency: 'EUR', Amount: 1 },
|
267
|
+
StatementDescriptor: "ruby",
|
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\\\"}\"}",
|
285
|
+
Billing: {
|
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'
|
308
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
|
+
}
|
308
|
+
}
|
309
309
|
)
|
310
310
|
end
|
311
311
|
|
312
|
-
|
313
312
|
###############################################
|
314
313
|
# directdebit/direct
|
315
314
|
###############################################
|
316
315
|
|
317
316
|
let(:new_payin_directdebit_direct) do
|
318
317
|
MangoPay::PayIn::DirectDebit::Direct.create(
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
318
|
+
AuthorId: new_natural_user['Id'],
|
319
|
+
CreditedUserId: new_wallet['Owners'][0],
|
320
|
+
CreditedWalletId: new_wallet['Id'],
|
321
|
+
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
322
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
323
|
+
MandateId: new_mandate['Id'],
|
324
|
+
ReturnURL: MangoPay.configuration.root_url,
|
325
|
+
Tag: 'Test PayIn/DirectDebit/Direct'
|
327
326
|
)
|
328
327
|
end
|
329
328
|
|
@@ -333,30 +332,30 @@ shared_context 'payins' do
|
|
333
332
|
|
334
333
|
let(:new_payin_card_web) do
|
335
334
|
MangoPay::PayIn::Card::Web.create(
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
335
|
+
AuthorId: new_natural_user['Id'],
|
336
|
+
CreditedUserId: new_wallet['Owners'][0],
|
337
|
+
CreditedWalletId: new_wallet['Id'],
|
338
|
+
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
339
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
340
|
+
CardType: 'CB_VISA_MASTERCARD',
|
341
|
+
ReturnURL: MangoPay.configuration.root_url,
|
342
|
+
Culture: 'FR',
|
343
|
+
Tag: 'Test PayIn/Card/Web'
|
345
344
|
)
|
346
345
|
end
|
347
346
|
|
348
347
|
let(:new_payin_card_web_payline) do
|
349
348
|
MangoPay::PayIn::Card::Web.create(
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
349
|
+
AuthorId: new_natural_user['Id'],
|
350
|
+
CreditedUserId: new_wallet['Owners'][0],
|
351
|
+
CreditedWalletId: new_wallet['Id'],
|
352
|
+
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
353
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
354
|
+
CardType: 'CB_VISA_MASTERCARD',
|
355
|
+
ReturnURL: MangoPay.configuration.root_url,
|
356
|
+
Culture: 'FR',
|
357
|
+
Tag: 'Test PayIn/Card/Web',
|
358
|
+
TemplateURLOptions: { PAYLINEV2: "https://www.maysite.com/payline_template/" }
|
360
359
|
)
|
361
360
|
end
|
362
361
|
|
@@ -366,9 +365,9 @@ shared_context 'payins' do
|
|
366
365
|
|
367
366
|
let(:new_card_registration) do
|
368
367
|
MangoPay::CardRegistration.create(
|
369
|
-
|
370
|
-
|
371
|
-
|
368
|
+
UserId: new_natural_user['Id'],
|
369
|
+
Currency: 'EUR',
|
370
|
+
Tag: 'Test Card Registration'
|
372
371
|
)
|
373
372
|
end
|
374
373
|
|
@@ -378,11 +377,11 @@ shared_context 'payins' do
|
|
378
377
|
|
379
378
|
# 2nd step: tokenize by payline (fills-in RegistrationData)
|
380
379
|
data = {
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
380
|
+
data: cardreg['PreregistrationData'],
|
381
|
+
accessKeyRef: cardreg['AccessKey'],
|
382
|
+
cardNumber: 4970105191923460,
|
383
|
+
cardExpirationDate: 1226,
|
384
|
+
cardCvx: 123 }
|
386
385
|
|
387
386
|
res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
|
388
387
|
raise Exception, [res, res.body] unless res.is_a?(Net::HTTPOK) && res.body.start_with?('data=')
|
@@ -400,11 +399,11 @@ shared_context 'payins' do
|
|
400
399
|
|
401
400
|
# 2nd step: tokenize by payline (fills-in RegistrationData)
|
402
401
|
data = {
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
402
|
+
data: cardreg['PreregistrationData'],
|
403
|
+
accessKeyRef: cardreg['AccessKey'],
|
404
|
+
cardNumber: 4970105191923460,
|
405
|
+
cardExpirationDate: 1224,
|
406
|
+
cardCvx: 123 }
|
408
407
|
|
409
408
|
res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
|
410
409
|
raise Exception, [res, res.body] unless res.is_a?(Net::HTTPOK) && res.body.start_with?('data=')
|
@@ -422,11 +421,11 @@ shared_context 'payins' do
|
|
422
421
|
|
423
422
|
# 2nd step: tokenize by payline (fills-in RegistrationData)
|
424
423
|
data = {
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
424
|
+
data: cardreg['PreregistrationData'],
|
425
|
+
accessKeyRef: cardreg['AccessKey'],
|
426
|
+
cardNumber: 4970105181818183,
|
427
|
+
cardExpirationDate: 1226,
|
428
|
+
cardCvx: 123 }
|
430
429
|
|
431
430
|
res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
|
432
431
|
raise Exception, [res, res.body] unless res.is_a?(Net::HTTPOK) && res.body.start_with?('data=')
|
@@ -447,8 +446,8 @@ shared_context 'payins' do
|
|
447
446
|
MangoPay::PayIn::Mbway::Web.create(
|
448
447
|
AuthorId: new_natural_user['Id'],
|
449
448
|
CreditedWalletId: new_wallet['Id'],
|
450
|
-
DebitedFunds: {Currency: 'EUR', Amount: 199},
|
451
|
-
Fees: {Currency: 'EUR', Amount: 1},
|
449
|
+
DebitedFunds: { Currency: 'EUR', Amount: 199 },
|
450
|
+
Fees: { Currency: 'EUR', Amount: 1 },
|
452
451
|
StatementDescriptor: "ruby",
|
453
452
|
Tag: 'Test PayIn/Mbway/Web',
|
454
453
|
Phone: '351#269458236'
|
@@ -461,8 +460,8 @@ shared_context 'payins' do
|
|
461
460
|
let(:new_payin_multibanco_web) do
|
462
461
|
MangoPay::PayIn::Multibanco::Web.create(
|
463
462
|
AuthorId: new_natural_user['Id'],
|
464
|
-
DebitedFunds: {Currency: 'EUR', Amount: 199},
|
465
|
-
Fees: {Currency: 'EUR', Amount: 1},
|
463
|
+
DebitedFunds: { Currency: 'EUR', Amount: 199 },
|
464
|
+
Fees: { Currency: 'EUR', Amount: 1 },
|
466
465
|
CreditedWalletId: new_wallet['Id'],
|
467
466
|
StatementDescriptor: "ruby",
|
468
467
|
Tag: 'Test PayIn/Multibanco/Web',
|
@@ -484,8 +483,8 @@ shared_context 'payins' do
|
|
484
483
|
MangoPay::PayIn::Blik::Web.create(
|
485
484
|
AuthorId: user['Id'],
|
486
485
|
CreditedWalletId: wallet['Id'],
|
487
|
-
DebitedFunds: {Currency: 'PLN', Amount: 199},
|
488
|
-
Fees: {Currency: 'PLN', Amount: 1},
|
486
|
+
DebitedFunds: { Currency: 'PLN', Amount: 199 },
|
487
|
+
Fees: { Currency: 'PLN', Amount: 1 },
|
489
488
|
StatementDescriptor: "ruby",
|
490
489
|
Tag: 'Test PayIn/Blik/Web',
|
491
490
|
ReturnURL: 'https://example.com'
|
@@ -499,8 +498,8 @@ shared_context 'payins' do
|
|
499
498
|
MangoPay::PayIn::Satispay::Web.create(
|
500
499
|
AuthorId: new_natural_user['Id'],
|
501
500
|
CreditedWalletId: new_wallet['Id'],
|
502
|
-
DebitedFunds: {Currency: 'EUR', Amount: 199},
|
503
|
-
Fees: {Currency: 'EUR', Amount: 1},
|
501
|
+
DebitedFunds: { Currency: 'EUR', Amount: 199 },
|
502
|
+
Fees: { Currency: 'EUR', Amount: 1 },
|
504
503
|
StatementDescriptor: "ruby",
|
505
504
|
Tag: 'Test PayIn/Mbway/Web',
|
506
505
|
Country: 'IT',
|
@@ -563,11 +562,42 @@ shared_context 'payins' do
|
|
563
562
|
FirstName: 'Joe',
|
564
563
|
LastName: 'Blogs'
|
565
564
|
},
|
566
|
-
|
565
|
+
Reference: 'afd48-879d-48fg',
|
567
566
|
Tag: 'Test PayIn/Klarna/Web'
|
568
567
|
)
|
569
568
|
end
|
570
569
|
|
570
|
+
###############################################
|
571
|
+
# IDEAL/web
|
572
|
+
###############################################
|
573
|
+
let(:new_payin_ideal_web) do
|
574
|
+
MangoPay::PayIn::Ideal::Web.create(
|
575
|
+
AuthorId: new_natural_user['Id'],
|
576
|
+
CreditedWalletId: new_wallet['Id'],
|
577
|
+
DebitedFunds: {Currency: 'EUR', Amount: 400},
|
578
|
+
Fees: {Currency: 'EUR', Amount: 10},
|
579
|
+
ReturnURL: 'http://www.my-site.com/returnURL',
|
580
|
+
Bic: 'REVOLT21',
|
581
|
+
StatementDescriptor: "test",
|
582
|
+
Tag: 'Test PayIn/Ideal/Web'
|
583
|
+
)
|
584
|
+
end
|
585
|
+
|
586
|
+
###############################################
|
587
|
+
# Giropay/web
|
588
|
+
###############################################
|
589
|
+
let(:new_payin_giropay_web) do
|
590
|
+
MangoPay::PayIn::Giropay::Web.create(
|
591
|
+
AuthorId: new_natural_user['Id'],
|
592
|
+
CreditedWalletId: new_wallet['Id'],
|
593
|
+
DebitedFunds: {Currency: 'EUR', Amount: 400},
|
594
|
+
Fees: {Currency: 'EUR', Amount: 10},
|
595
|
+
ReturnURL: 'http://www.my-site.com/returnURL',
|
596
|
+
StatementDescriptor: "test",
|
597
|
+
Tag: 'Test PayIn/Giropay/Web'
|
598
|
+
)
|
599
|
+
end
|
600
|
+
|
571
601
|
###############################################
|
572
602
|
# PAYPAL/web V2
|
573
603
|
###############################################
|
@@ -609,35 +639,35 @@ shared_context 'payins' do
|
|
609
639
|
ShippingPreference: "GET_FROM_FILE",
|
610
640
|
StatementDescriptor: "ruby",
|
611
641
|
Tag: 'Test',
|
612
|
-
|
642
|
+
# Culture: 'FR'
|
613
643
|
)
|
614
644
|
end
|
615
645
|
|
616
646
|
def create_new_payin_card_direct(to_wallet, amnt = 1000)
|
617
647
|
cardreg = new_card_registration_completed
|
618
648
|
MangoPay::PayIn::Card::Direct.create(
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
649
|
+
AuthorId: new_natural_user['Id'],
|
650
|
+
CreditedUserId: to_wallet['Owners'][0],
|
651
|
+
CreditedWalletId: to_wallet['Id'],
|
652
|
+
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
653
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
654
|
+
CardType: 'CB_VISA_MASTERCARD',
|
655
|
+
CardId: cardreg['CardId'],
|
656
|
+
SecureModeReturnURL: 'http://test.com',
|
657
|
+
Tag: 'Test PayIn/Card/Direct',
|
658
|
+
Requested3DSVersion: 'V2_1',
|
659
|
+
BrowserInfo: {
|
660
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
661
|
+
JavaEnabled: true,
|
662
|
+
Language: "FR-FR",
|
663
|
+
ColorDepth: 4,
|
664
|
+
ScreenHeight: 1800,
|
665
|
+
ScreenWidth: 400,
|
666
|
+
JavascriptEnabled: true,
|
667
|
+
TimeZoneOffset: "+60",
|
668
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
669
|
+
},
|
670
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
641
671
|
)
|
642
672
|
end
|
643
673
|
|
@@ -649,25 +679,25 @@ shared_context 'payins' do
|
|
649
679
|
|
650
680
|
def create_new_card_preauthorization(cardreg, amnt = 1000)
|
651
681
|
MangoPay::PreAuthorization.create(
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
682
|
+
AuthorId: new_natural_user['Id'],
|
683
|
+
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
684
|
+
CardId: cardreg['CardId'],
|
685
|
+
SecureMode: 'DEFAULT',
|
686
|
+
SecureModeReturnURL: 'http://test.com',
|
687
|
+
Tag: 'Test Card PreAuthorization',
|
688
|
+
Requested3DSVersion: 'V2_1',
|
689
|
+
BrowserInfo: {
|
690
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
691
|
+
JavaEnabled: true,
|
692
|
+
Language: "FR-FR",
|
693
|
+
ColorDepth: 4,
|
694
|
+
ScreenHeight: 1800,
|
695
|
+
ScreenWidth: 400,
|
696
|
+
JavascriptEnabled: true,
|
697
|
+
TimeZoneOffset: "+60",
|
698
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
699
|
+
},
|
700
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
671
701
|
)
|
672
702
|
end
|
673
703
|
|
@@ -676,25 +706,25 @@ shared_context 'payins' do
|
|
676
706
|
def create_new_payin_preauthorized_direct(to_wallet, amnt = 1000)
|
677
707
|
preauth = new_card_preauthorization
|
678
708
|
MangoPay::PayIn::PreAuthorized::Direct.create(
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
709
|
+
AuthorId: new_natural_user['Id'],
|
710
|
+
CreditedUserId: to_wallet['Owners'][0],
|
711
|
+
CreditedWalletId: to_wallet['Id'],
|
712
|
+
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
713
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
714
|
+
PreauthorizationId: preauth['Id'],
|
715
|
+
Tag: 'Test PayIn/PreAuthorized/Direct',
|
716
|
+
BrowserInfo: {
|
717
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
718
|
+
JavaEnabled: true,
|
719
|
+
Language: "FR-FR",
|
720
|
+
ColorDepth: 4,
|
721
|
+
ScreenHeight: 1800,
|
722
|
+
ScreenWidth: 400,
|
723
|
+
JavascriptEnabled: true,
|
724
|
+
TimeZoneOffset: "+60",
|
725
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
726
|
+
},
|
727
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
698
728
|
)
|
699
729
|
end
|
700
730
|
|
@@ -725,12 +755,12 @@ shared_context 'payins' do
|
|
725
755
|
|
726
756
|
def create_new_payin_pre_authorized_deposit_direct(deposit_id, author_id, credited_wallet_id)
|
727
757
|
MangoPay::PayIn::PreAuthorized::Direct.create_pre_authorized_deposit_pay_in(
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
758
|
+
AuthorId: author_id,
|
759
|
+
CreditedWalletId: credited_wallet_id,
|
760
|
+
DebitedFunds: { Currency: 'EUR', Amount: 500 },
|
761
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
762
|
+
DepositId: deposit_id,
|
763
|
+
Tag: 'lorem ipsum'
|
734
764
|
)
|
735
765
|
end
|
736
766
|
|
@@ -742,14 +772,33 @@ shared_context 'payins' do
|
|
742
772
|
|
743
773
|
def create_new_payin_bankwire_direct(to_wallet, amnt = 1000)
|
744
774
|
MangoPay::PayIn::BankWire::Direct.create(
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
775
|
+
AuthorId: new_natural_user['Id'],
|
776
|
+
CreditedUserId: to_wallet['Owners'][0],
|
777
|
+
CreditedWalletId: to_wallet['Id'],
|
778
|
+
DeclaredDebitedFunds: { Currency: 'EUR', Amount: amnt },
|
779
|
+
DeclaredFees: { Currency: 'EUR', Amount: 0 },
|
780
|
+
Tag: 'Test PayIn/BankWire/Direct'
|
751
781
|
)
|
752
782
|
end
|
783
|
+
|
784
|
+
###############################################
|
785
|
+
# wallet with money
|
786
|
+
###############################################
|
787
|
+
#
|
788
|
+
let(:new_wallet_with_money){ create_new_wallet_with_money(new_natural_user) }
|
789
|
+
|
790
|
+
def create_new_wallet_with_money(user)
|
791
|
+
wallet = MangoPay::Wallet.create(
|
792
|
+
Owners: [user['Id']],
|
793
|
+
Description: 'A test wallet',
|
794
|
+
Currency: 'EUR',
|
795
|
+
Tag: 'Test wallet'
|
796
|
+
)
|
797
|
+
|
798
|
+
pay_in = create_new_payin_card_direct(wallet)
|
799
|
+
MangoPay::Wallet.fetch(pay_in['CreditedWalletId'])
|
800
|
+
end
|
801
|
+
|
753
802
|
end
|
754
803
|
|
755
804
|
###############################################
|
@@ -761,14 +810,14 @@ shared_context 'payouts' do
|
|
761
810
|
|
762
811
|
def create_new_payout_bankwire(payin, amnt = 500)
|
763
812
|
MangoPay::PayOut::BankWire.create(
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
813
|
+
AuthorId: payin['CreditedUserId'],
|
814
|
+
DebitedWalletId: payin['CreditedWalletId'],
|
815
|
+
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
816
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
817
|
+
BankAccountId: new_bank_account['Id'],
|
818
|
+
Communication: 'This is a test',
|
819
|
+
Tag: 'Test PayOut/Bank/Wire',
|
820
|
+
PayoutModeRequested: 'Standard'
|
772
821
|
)
|
773
822
|
end
|
774
823
|
end
|
@@ -789,13 +838,13 @@ shared_context 'transfers' do
|
|
789
838
|
|
790
839
|
def create_new_transfer(from_wallet, to_wallet, amnt = 500)
|
791
840
|
MangoPay::Transfer.create(
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
841
|
+
AuthorId: from_wallet['Owners'][0],
|
842
|
+
DebitedWalletId: from_wallet['Id'],
|
843
|
+
CreditedUserId: to_wallet['Owners'][0],
|
844
|
+
CreditedWalletId: to_wallet['Id'],
|
845
|
+
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
846
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
847
|
+
Tag: 'Test transfer'
|
799
848
|
)
|
800
849
|
end
|
801
850
|
end
|
@@ -807,9 +856,9 @@ shared_context 'hooks' do
|
|
807
856
|
hooks = MangoPay::Hook.fetch('page' => 1, 'per_page' => 1)
|
808
857
|
if hooks.empty?
|
809
858
|
MangoPay::Hook.create(
|
810
|
-
|
811
|
-
|
812
|
-
|
859
|
+
EventType: 'PAYIN_NORMAL_CREATED',
|
860
|
+
Url: 'http://test.com',
|
861
|
+
Tag: 'Test hook'
|
813
862
|
)
|
814
863
|
else
|
815
864
|
hooks[0]
|
@@ -825,64 +874,101 @@ shared_context 'bankingaliases' do
|
|
825
874
|
|
826
875
|
let(:new_banking_alias) do
|
827
876
|
MangoPay::BankingAliasesIBAN.create({
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
877
|
+
CreditedUserId: new_natural_user['Id'],
|
878
|
+
WalletId: new_wallet['Id'],
|
879
|
+
OwnerName: new_natural_user['FirstName'],
|
880
|
+
Country: 'LU'
|
832
881
|
}, new_wallet['Id'])
|
833
882
|
end
|
834
883
|
end
|
835
884
|
|
836
|
-
|
837
885
|
###############################################
|
838
886
|
# deposits
|
839
887
|
###############################################
|
840
888
|
|
841
889
|
def create_new_deposit(card_registration_id, author_id)
|
842
890
|
MangoPay::Deposit.create(
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
}
|
891
|
+
{
|
892
|
+
AuthorId: author_id,
|
893
|
+
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
894
|
+
CardId: card_registration_id,
|
895
|
+
SecureModeReturnURL: 'http://mangopay-sandbox-test.com',
|
896
|
+
StatementDescriptor: "lorem",
|
897
|
+
Culture: 'FR',
|
898
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
899
|
+
BrowserInfo: {
|
900
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
901
|
+
JavaEnabled: true,
|
902
|
+
Language: "FR-FR",
|
903
|
+
ColorDepth: 4,
|
904
|
+
ScreenHeight: 1800,
|
905
|
+
ScreenWidth: 400,
|
906
|
+
JavascriptEnabled: true,
|
907
|
+
TimeZoneOffset: "+60",
|
908
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
909
|
+
},
|
910
|
+
Billing: {
|
911
|
+
Address: {
|
912
|
+
AddressLine1: 'AddressLine1',
|
913
|
+
AddressLine2: 'AddressLine2',
|
914
|
+
City: 'City',
|
915
|
+
Region: 'Region',
|
916
|
+
PostalCode: 'PostalCode',
|
917
|
+
Country: 'FR'
|
918
|
+
},
|
919
|
+
FirstName: 'Joe',
|
920
|
+
LastName: 'Blogs'
|
921
|
+
},
|
922
|
+
Shipping: {
|
923
|
+
Address: {
|
924
|
+
AddressLine1: 'AddressLine1',
|
925
|
+
AddressLine2: 'AddressLine2',
|
926
|
+
City: 'City',
|
927
|
+
Region: 'Region',
|
928
|
+
PostalCode: 'PostalCode',
|
929
|
+
Country: 'FR'
|
930
|
+
},
|
931
|
+
FirstName: 'Joe',
|
932
|
+
LastName: 'Blogs'
|
886
933
|
}
|
934
|
+
}
|
887
935
|
)
|
936
|
+
end
|
937
|
+
|
938
|
+
###############################################
|
939
|
+
# instant conversions
|
940
|
+
###############################################
|
941
|
+
shared_context 'instant_conversion' do
|
942
|
+
include_context 'payins'
|
943
|
+
def get_conversion_rate(debited_currency, credited_currency)
|
944
|
+
MangoPay::InstantConversion.get_rate(debited_currency, credited_currency, params = {})
|
945
|
+
end
|
946
|
+
|
947
|
+
def create_instant_conversion()
|
948
|
+
user = new_natural_user
|
949
|
+
credited_wallet = MangoPay::Wallet.create(
|
950
|
+
Owners: [user['Id']],
|
951
|
+
Description: 'A test wallet',
|
952
|
+
Currency: 'GBP',
|
953
|
+
Tag: 'Test wallet'
|
954
|
+
)
|
955
|
+
|
956
|
+
MangoPay::InstantConversion.create(
|
957
|
+
AuthorId: user['Id'],
|
958
|
+
CreditedWalletId: credited_wallet['Id'],
|
959
|
+
DebitedWalletId: new_wallet_with_money['Id'],
|
960
|
+
CreditedFunds: {
|
961
|
+
Currency: 'GBP'
|
962
|
+
},
|
963
|
+
DebitedFunds: {
|
964
|
+
Currency: 'EUR',
|
965
|
+
Amount: 79
|
966
|
+
},
|
967
|
+
Tag: 'Instant conversion test'
|
968
|
+
)
|
969
|
+
end
|
970
|
+
|
971
|
+
def get_instant_conversion(id)
|
972
|
+
MangoPay::InstantConversion.get(id, params = {})
|
973
|
+
end
|
888
974
|
end
|
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.19.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-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/mangopay/filter_parameters.rb
|
90
90
|
- lib/mangopay/hook.rb
|
91
91
|
- lib/mangopay/http_calls.rb
|
92
|
+
- lib/mangopay/instant_conversion.rb
|
92
93
|
- lib/mangopay/json.rb
|
93
94
|
- lib/mangopay/kyc_document.rb
|
94
95
|
- lib/mangopay/legal_user.rb
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- spec/mangopay/fetch_filters_spec.rb
|
124
125
|
- spec/mangopay/hook_spec.rb
|
125
126
|
- spec/mangopay/idempotency_spec.rb
|
127
|
+
- spec/mangopay/instant_conversion_spec.rb
|
126
128
|
- spec/mangopay/kyc_document_spec.png
|
127
129
|
- spec/mangopay/kyc_document_spec.rb
|
128
130
|
- spec/mangopay/log_requests_filter_spec.rb
|
@@ -135,7 +137,9 @@ files:
|
|
135
137
|
- spec/mangopay/payin_card_web_spec.rb
|
136
138
|
- spec/mangopay/payin_directdebit_direct_spec.rb
|
137
139
|
- spec/mangopay/payin_directdebit_web_spec.rb
|
140
|
+
- spec/mangopay/payin_giropay_web_spec.rb
|
138
141
|
- spec/mangopay/payin_googlepay_direct_spec.rb
|
142
|
+
- spec/mangopay/payin_ideal_web_spec.rb
|
139
143
|
- spec/mangopay/payin_klarna_web_spec.rb
|
140
144
|
- spec/mangopay/payin_mbway_web_spec.rb
|
141
145
|
- spec/mangopay/payin_multibanco_web_spec.rb
|
@@ -197,6 +201,7 @@ test_files:
|
|
197
201
|
- spec/mangopay/fetch_filters_spec.rb
|
198
202
|
- spec/mangopay/hook_spec.rb
|
199
203
|
- spec/mangopay/idempotency_spec.rb
|
204
|
+
- spec/mangopay/instant_conversion_spec.rb
|
200
205
|
- spec/mangopay/kyc_document_spec.png
|
201
206
|
- spec/mangopay/kyc_document_spec.rb
|
202
207
|
- spec/mangopay/log_requests_filter_spec.rb
|
@@ -209,7 +214,9 @@ test_files:
|
|
209
214
|
- spec/mangopay/payin_card_web_spec.rb
|
210
215
|
- spec/mangopay/payin_directdebit_direct_spec.rb
|
211
216
|
- spec/mangopay/payin_directdebit_web_spec.rb
|
217
|
+
- spec/mangopay/payin_giropay_web_spec.rb
|
212
218
|
- spec/mangopay/payin_googlepay_direct_spec.rb
|
219
|
+
- spec/mangopay/payin_ideal_web_spec.rb
|
213
220
|
- spec/mangopay/payin_klarna_web_spec.rb
|
214
221
|
- spec/mangopay/payin_mbway_web_spec.rb
|
215
222
|
- spec/mangopay/payin_multibanco_web_spec.rb
|