mangopay 3.17.0 → 3.18.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 +4 -0
- data/lib/mangopay/instant_conversion.rb +24 -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/shared_resources.rb +408 -353
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bb8e0bce0fbb8b2a758340182c8be4b0d904ae358cf72637da7e7c63d2413b7
|
4
|
+
data.tar.gz: ebeacb1b39d233d2ebec9326d61c69213111fa1dd945f4541068c73fdcbc5061
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3514922d67baa1a1f21fc2fe459fdeca27fd958c4214f0f66daddf3c29358f22cbbf16eb0ee95930c3f882b9e551340c2d59b6f40cf5578c0b5ab698e71e7ea8
|
7
|
+
data.tar.gz: 2ee8d0c7015e18a84df5468c869dc328a808ef841da61b4ade65d2223d2eb4031de08e3a6628d26510b241d333d7116ada4881e9329bd0d243907773e5239abc
|
data/CHANGELOG.md
CHANGED
@@ -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/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
|
@@ -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',
|
@@ -609,35 +608,35 @@ shared_context 'payins' do
|
|
609
608
|
ShippingPreference: "GET_FROM_FILE",
|
610
609
|
StatementDescriptor: "ruby",
|
611
610
|
Tag: 'Test',
|
612
|
-
|
611
|
+
# Culture: 'FR'
|
613
612
|
)
|
614
613
|
end
|
615
614
|
|
616
615
|
def create_new_payin_card_direct(to_wallet, amnt = 1000)
|
617
616
|
cardreg = new_card_registration_completed
|
618
617
|
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
|
-
|
618
|
+
AuthorId: new_natural_user['Id'],
|
619
|
+
CreditedUserId: to_wallet['Owners'][0],
|
620
|
+
CreditedWalletId: to_wallet['Id'],
|
621
|
+
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
622
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
623
|
+
CardType: 'CB_VISA_MASTERCARD',
|
624
|
+
CardId: cardreg['CardId'],
|
625
|
+
SecureModeReturnURL: 'http://test.com',
|
626
|
+
Tag: 'Test PayIn/Card/Direct',
|
627
|
+
Requested3DSVersion: 'V2_1',
|
628
|
+
BrowserInfo: {
|
629
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
630
|
+
JavaEnabled: true,
|
631
|
+
Language: "FR-FR",
|
632
|
+
ColorDepth: 4,
|
633
|
+
ScreenHeight: 1800,
|
634
|
+
ScreenWidth: 400,
|
635
|
+
JavascriptEnabled: true,
|
636
|
+
TimeZoneOffset: "+60",
|
637
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
638
|
+
},
|
639
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
641
640
|
)
|
642
641
|
end
|
643
642
|
|
@@ -649,25 +648,25 @@ shared_context 'payins' do
|
|
649
648
|
|
650
649
|
def create_new_card_preauthorization(cardreg, amnt = 1000)
|
651
650
|
MangoPay::PreAuthorization.create(
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
651
|
+
AuthorId: new_natural_user['Id'],
|
652
|
+
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
653
|
+
CardId: cardreg['CardId'],
|
654
|
+
SecureMode: 'DEFAULT',
|
655
|
+
SecureModeReturnURL: 'http://test.com',
|
656
|
+
Tag: 'Test Card PreAuthorization',
|
657
|
+
Requested3DSVersion: 'V2_1',
|
658
|
+
BrowserInfo: {
|
659
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
660
|
+
JavaEnabled: true,
|
661
|
+
Language: "FR-FR",
|
662
|
+
ColorDepth: 4,
|
663
|
+
ScreenHeight: 1800,
|
664
|
+
ScreenWidth: 400,
|
665
|
+
JavascriptEnabled: true,
|
666
|
+
TimeZoneOffset: "+60",
|
667
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
668
|
+
},
|
669
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
671
670
|
)
|
672
671
|
end
|
673
672
|
|
@@ -676,25 +675,25 @@ shared_context 'payins' do
|
|
676
675
|
def create_new_payin_preauthorized_direct(to_wallet, amnt = 1000)
|
677
676
|
preauth = new_card_preauthorization
|
678
677
|
MangoPay::PayIn::PreAuthorized::Direct.create(
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
678
|
+
AuthorId: new_natural_user['Id'],
|
679
|
+
CreditedUserId: to_wallet['Owners'][0],
|
680
|
+
CreditedWalletId: to_wallet['Id'],
|
681
|
+
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
682
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
683
|
+
PreauthorizationId: preauth['Id'],
|
684
|
+
Tag: 'Test PayIn/PreAuthorized/Direct',
|
685
|
+
BrowserInfo: {
|
686
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
687
|
+
JavaEnabled: true,
|
688
|
+
Language: "FR-FR",
|
689
|
+
ColorDepth: 4,
|
690
|
+
ScreenHeight: 1800,
|
691
|
+
ScreenWidth: 400,
|
692
|
+
JavascriptEnabled: true,
|
693
|
+
TimeZoneOffset: "+60",
|
694
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
695
|
+
},
|
696
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
698
697
|
)
|
699
698
|
end
|
700
699
|
|
@@ -725,12 +724,12 @@ shared_context 'payins' do
|
|
725
724
|
|
726
725
|
def create_new_payin_pre_authorized_deposit_direct(deposit_id, author_id, credited_wallet_id)
|
727
726
|
MangoPay::PayIn::PreAuthorized::Direct.create_pre_authorized_deposit_pay_in(
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
727
|
+
AuthorId: author_id,
|
728
|
+
CreditedWalletId: credited_wallet_id,
|
729
|
+
DebitedFunds: { Currency: 'EUR', Amount: 500 },
|
730
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
731
|
+
DepositId: deposit_id,
|
732
|
+
Tag: 'lorem ipsum'
|
734
733
|
)
|
735
734
|
end
|
736
735
|
|
@@ -742,14 +741,33 @@ shared_context 'payins' do
|
|
742
741
|
|
743
742
|
def create_new_payin_bankwire_direct(to_wallet, amnt = 1000)
|
744
743
|
MangoPay::PayIn::BankWire::Direct.create(
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
744
|
+
AuthorId: new_natural_user['Id'],
|
745
|
+
CreditedUserId: to_wallet['Owners'][0],
|
746
|
+
CreditedWalletId: to_wallet['Id'],
|
747
|
+
DeclaredDebitedFunds: { Currency: 'EUR', Amount: amnt },
|
748
|
+
DeclaredFees: { Currency: 'EUR', Amount: 0 },
|
749
|
+
Tag: 'Test PayIn/BankWire/Direct'
|
750
|
+
)
|
751
|
+
end
|
752
|
+
|
753
|
+
###############################################
|
754
|
+
# wallet with money
|
755
|
+
###############################################
|
756
|
+
#
|
757
|
+
let(:new_wallet_with_money){ create_new_wallet_with_money(new_natural_user) }
|
758
|
+
|
759
|
+
def create_new_wallet_with_money(user)
|
760
|
+
wallet = MangoPay::Wallet.create(
|
761
|
+
Owners: [user['Id']],
|
762
|
+
Description: 'A test wallet',
|
763
|
+
Currency: 'EUR',
|
764
|
+
Tag: 'Test wallet'
|
751
765
|
)
|
766
|
+
|
767
|
+
pay_in = create_new_payin_card_direct(wallet)
|
768
|
+
MangoPay::Wallet.fetch(pay_in['CreditedWalletId'])
|
752
769
|
end
|
770
|
+
|
753
771
|
end
|
754
772
|
|
755
773
|
###############################################
|
@@ -761,14 +779,14 @@ shared_context 'payouts' do
|
|
761
779
|
|
762
780
|
def create_new_payout_bankwire(payin, amnt = 500)
|
763
781
|
MangoPay::PayOut::BankWire.create(
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
782
|
+
AuthorId: payin['CreditedUserId'],
|
783
|
+
DebitedWalletId: payin['CreditedWalletId'],
|
784
|
+
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
785
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
786
|
+
BankAccountId: new_bank_account['Id'],
|
787
|
+
Communication: 'This is a test',
|
788
|
+
Tag: 'Test PayOut/Bank/Wire',
|
789
|
+
PayoutModeRequested: 'Standard'
|
772
790
|
)
|
773
791
|
end
|
774
792
|
end
|
@@ -789,13 +807,13 @@ shared_context 'transfers' do
|
|
789
807
|
|
790
808
|
def create_new_transfer(from_wallet, to_wallet, amnt = 500)
|
791
809
|
MangoPay::Transfer.create(
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
810
|
+
AuthorId: from_wallet['Owners'][0],
|
811
|
+
DebitedWalletId: from_wallet['Id'],
|
812
|
+
CreditedUserId: to_wallet['Owners'][0],
|
813
|
+
CreditedWalletId: to_wallet['Id'],
|
814
|
+
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
815
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
816
|
+
Tag: 'Test transfer'
|
799
817
|
)
|
800
818
|
end
|
801
819
|
end
|
@@ -807,9 +825,9 @@ shared_context 'hooks' do
|
|
807
825
|
hooks = MangoPay::Hook.fetch('page' => 1, 'per_page' => 1)
|
808
826
|
if hooks.empty?
|
809
827
|
MangoPay::Hook.create(
|
810
|
-
|
811
|
-
|
812
|
-
|
828
|
+
EventType: 'PAYIN_NORMAL_CREATED',
|
829
|
+
Url: 'http://test.com',
|
830
|
+
Tag: 'Test hook'
|
813
831
|
)
|
814
832
|
else
|
815
833
|
hooks[0]
|
@@ -825,64 +843,101 @@ shared_context 'bankingaliases' do
|
|
825
843
|
|
826
844
|
let(:new_banking_alias) do
|
827
845
|
MangoPay::BankingAliasesIBAN.create({
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
846
|
+
CreditedUserId: new_natural_user['Id'],
|
847
|
+
WalletId: new_wallet['Id'],
|
848
|
+
OwnerName: new_natural_user['FirstName'],
|
849
|
+
Country: 'LU'
|
832
850
|
}, new_wallet['Id'])
|
833
851
|
end
|
834
852
|
end
|
835
853
|
|
836
|
-
|
837
854
|
###############################################
|
838
855
|
# deposits
|
839
856
|
###############################################
|
840
857
|
|
841
858
|
def create_new_deposit(card_registration_id, author_id)
|
842
859
|
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
|
-
}
|
860
|
+
{
|
861
|
+
AuthorId: author_id,
|
862
|
+
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
863
|
+
CardId: card_registration_id,
|
864
|
+
SecureModeReturnURL: 'http://mangopay-sandbox-test.com',
|
865
|
+
StatementDescriptor: "lorem",
|
866
|
+
Culture: 'FR',
|
867
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
868
|
+
BrowserInfo: {
|
869
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
870
|
+
JavaEnabled: true,
|
871
|
+
Language: "FR-FR",
|
872
|
+
ColorDepth: 4,
|
873
|
+
ScreenHeight: 1800,
|
874
|
+
ScreenWidth: 400,
|
875
|
+
JavascriptEnabled: true,
|
876
|
+
TimeZoneOffset: "+60",
|
877
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
878
|
+
},
|
879
|
+
Billing: {
|
880
|
+
Address: {
|
881
|
+
AddressLine1: 'AddressLine1',
|
882
|
+
AddressLine2: 'AddressLine2',
|
883
|
+
City: 'City',
|
884
|
+
Region: 'Region',
|
885
|
+
PostalCode: 'PostalCode',
|
886
|
+
Country: 'FR'
|
887
|
+
},
|
888
|
+
FirstName: 'Joe',
|
889
|
+
LastName: 'Blogs'
|
890
|
+
},
|
891
|
+
Shipping: {
|
892
|
+
Address: {
|
893
|
+
AddressLine1: 'AddressLine1',
|
894
|
+
AddressLine2: 'AddressLine2',
|
895
|
+
City: 'City',
|
896
|
+
Region: 'Region',
|
897
|
+
PostalCode: 'PostalCode',
|
898
|
+
Country: 'FR'
|
899
|
+
},
|
900
|
+
FirstName: 'Joe',
|
901
|
+
LastName: 'Blogs'
|
886
902
|
}
|
903
|
+
}
|
887
904
|
)
|
905
|
+
end
|
906
|
+
|
907
|
+
###############################################
|
908
|
+
# instant conversions
|
909
|
+
###############################################
|
910
|
+
shared_context 'instant_conversion' do
|
911
|
+
include_context 'payins'
|
912
|
+
def get_conversion_rate(debited_currency, credited_currency)
|
913
|
+
MangoPay::InstantConversion.get_rate(debited_currency, credited_currency, params = {})
|
914
|
+
end
|
915
|
+
|
916
|
+
def create_instant_conversion()
|
917
|
+
user = new_natural_user
|
918
|
+
credited_wallet = MangoPay::Wallet.create(
|
919
|
+
Owners: [user['Id']],
|
920
|
+
Description: 'A test wallet',
|
921
|
+
Currency: 'GBP',
|
922
|
+
Tag: 'Test wallet'
|
923
|
+
)
|
924
|
+
|
925
|
+
MangoPay::InstantConversion.create(
|
926
|
+
AuthorId: user['Id'],
|
927
|
+
CreditedWalletId: credited_wallet['Id'],
|
928
|
+
DebitedWalletId: new_wallet_with_money['Id'],
|
929
|
+
CreditedFunds: {
|
930
|
+
Currency: 'GBP'
|
931
|
+
},
|
932
|
+
DebitedFunds: {
|
933
|
+
Currency: 'EUR',
|
934
|
+
Amount: 79
|
935
|
+
},
|
936
|
+
Tag: 'Instant conversion test'
|
937
|
+
)
|
938
|
+
end
|
939
|
+
|
940
|
+
def get_instant_conversion(id)
|
941
|
+
MangoPay::InstantConversion.get(id, params = {})
|
942
|
+
end
|
888
943
|
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.18.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-09-
|
12
|
+
date: 2023-09-29 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
|
@@ -197,6 +199,7 @@ test_files:
|
|
197
199
|
- spec/mangopay/fetch_filters_spec.rb
|
198
200
|
- spec/mangopay/hook_spec.rb
|
199
201
|
- spec/mangopay/idempotency_spec.rb
|
202
|
+
- spec/mangopay/instant_conversion_spec.rb
|
200
203
|
- spec/mangopay/kyc_document_spec.png
|
201
204
|
- spec/mangopay/kyc_document_spec.rb
|
202
205
|
- spec/mangopay/log_requests_filter_spec.rb
|