mangopay4-ruby-sdk 3.52.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/lib/mangopay/authorization_token.rb +1 -1
- data/lib/mangopay/version.rb +1 -1
- data/mangopay.gemspec +7 -7
- metadata +32 -160
- data/.github/workflows/ruby_cd.yml +0 -34
- data/.github/workflows/ruby_ci.yml +0 -30
- data/.gitignore +0 -30
- data/.rspec +0 -3
- data/Gemfile +0 -2
- data/Rakefile +0 -5
- data/bin/mangopay +0 -9
- data/spec/mangopay/acquiring_spec.rb +0 -207
- data/spec/mangopay/authorization_token_spec.rb +0 -70
- data/spec/mangopay/bank_account_spec.rb +0 -105
- data/spec/mangopay/bankingaliases_spec.rb +0 -29
- data/spec/mangopay/card_registration_spec.rb +0 -123
- data/spec/mangopay/client_spec.png +0 -0
- data/spec/mangopay/client_spec.rb +0 -213
- data/spec/mangopay/configuration_spec.rb +0 -249
- data/spec/mangopay/conversion_spec.rb +0 -103
- data/spec/mangopay/deposit_spec.rb +0 -120
- data/spec/mangopay/dispute_spec.png +0 -0
- data/spec/mangopay/dispute_spec.rb +0 -294
- data/spec/mangopay/event_spec.rb +0 -33
- data/spec/mangopay/fetch_filters_spec.rb +0 -63
- data/spec/mangopay/hook_spec.rb +0 -37
- data/spec/mangopay/idempotency_spec.rb +0 -41
- data/spec/mangopay/identity_verification_spec.rb +0 -91
- data/spec/mangopay/kyc_document_spec.png +0 -0
- data/spec/mangopay/kyc_document_spec.rb +0 -118
- data/spec/mangopay/log_requests_filter_spec.rb +0 -26
- data/spec/mangopay/mandate_spec.rb +0 -99
- data/spec/mangopay/payin_applepay_direct_spec.rb +0 -21
- data/spec/mangopay/payin_bancontact_web_spec.rb +0 -30
- data/spec/mangopay/payin_bankwire_direct_spec.rb +0 -74
- data/spec/mangopay/payin_bankwire_external_instruction_spec.rb +0 -104
- data/spec/mangopay/payin_bizum_web_spec.rb +0 -54
- data/spec/mangopay/payin_blik_web_spec.rb +0 -41
- data/spec/mangopay/payin_card_direct_spec.rb +0 -69
- data/spec/mangopay/payin_card_web_spec.rb +0 -64
- data/spec/mangopay/payin_directdebit_direct_spec.rb +0 -37
- data/spec/mangopay/payin_directdebit_web_spec.rb +0 -38
- data/spec/mangopay/payin_giropay_web_spec.rb +0 -30
- data/spec/mangopay/payin_googlepay_direct_spec.rb +0 -21
- data/spec/mangopay/payin_ideal_web_spec.rb +0 -30
- data/spec/mangopay/payin_intent_spec.rb +0 -302
- data/spec/mangopay/payin_klarna_web_spec.rb +0 -32
- data/spec/mangopay/payin_mbway_web_spec.rb +0 -32
- data/spec/mangopay/payin_multibanco_web_spec.rb +0 -31
- data/spec/mangopay/payin_paybybank_web_spec.rb +0 -56
- data/spec/mangopay/payin_paypal_web_spec.rb +0 -114
- data/spec/mangopay/payin_preauthorized_direct_spec.rb +0 -135
- data/spec/mangopay/payin_satispay_web_spec.rb +0 -32
- data/spec/mangopay/payin_swish_web_spec.rb +0 -30
- data/spec/mangopay/payin_twint_web_spec.rb +0 -30
- data/spec/mangopay/payment_method_metadata_spec.rb +0 -15
- data/spec/mangopay/payout_bankwire_spec.rb +0 -90
- data/spec/mangopay/preauthorization_spec.rb +0 -51
- data/spec/mangopay/recipient_spec.rb +0 -135
- data/spec/mangopay/recurring_payin_spec.rb +0 -557
- data/spec/mangopay/refund_spec.rb +0 -34
- data/spec/mangopay/regulatory_spec.rb +0 -26
- data/spec/mangopay/report_spec.rb +0 -40
- data/spec/mangopay/report_v2_spec.rb +0 -117
- data/spec/mangopay/report_wallets_spec.rb +0 -40
- data/spec/mangopay/settlement_sample.csv +0 -8
- data/spec/mangopay/settlement_sample_bad.csv +0 -8
- data/spec/mangopay/settlement_spec.rb +0 -65
- data/spec/mangopay/shared_resources.rb +0 -1415
- data/spec/mangopay/transaction_spec.rb +0 -59
- data/spec/mangopay/transfer_spec.rb +0 -77
- data/spec/mangopay/ubo_declaration_spec.rb +0 -44
- data/spec/mangopay/ubo_spec.rb +0 -39
- data/spec/mangopay/user_spec.rb +0 -455
- data/spec/mangopay/virtual_account_spec.rb +0 -52
- data/spec/mangopay/wallet_spec.rb +0 -100
- data/spec/spec_helper.rb +0 -31
- data/spec/tmp/.keep +0 -0
|
@@ -1,1415 +0,0 @@
|
|
|
1
|
-
###############################################
|
|
2
|
-
shared_context 'users' do
|
|
3
|
-
###############################################
|
|
4
|
-
|
|
5
|
-
let(:new_natural_user) { create_new_natural_user }
|
|
6
|
-
let(:new_natural_user_sca_payer) { create_new_natural_user_sca_payer }
|
|
7
|
-
let(:new_natural_user_sca_owner) { create_new_natural_user_sca_owner }
|
|
8
|
-
let(:new_legal_user_sca_payer) { create_new_legal_user_sca_payer }
|
|
9
|
-
let(:new_legal_user_sca_owner) { create_new_legal_user_sca_owner }
|
|
10
|
-
|
|
11
|
-
def define_new_natural_user
|
|
12
|
-
{
|
|
13
|
-
Tag: 'Test natural user',
|
|
14
|
-
Email: 'my@email.com',
|
|
15
|
-
FirstName: 'John',
|
|
16
|
-
LastName: 'Doe',
|
|
17
|
-
Address: {
|
|
18
|
-
AddressLine1: 'Le Palais Royal',
|
|
19
|
-
AddressLine2: '8 Rue de Montpensier',
|
|
20
|
-
City: 'Paris',
|
|
21
|
-
Region: '',
|
|
22
|
-
PostalCode: '75001',
|
|
23
|
-
Country: 'FR'
|
|
24
|
-
},
|
|
25
|
-
Birthday: 1_300_186_358,
|
|
26
|
-
Birthplace: 'Paris',
|
|
27
|
-
Nationality: 'FR',
|
|
28
|
-
CountryOfResidence: 'FR',
|
|
29
|
-
Occupation: 'Worker',
|
|
30
|
-
IncomeRange: 1,
|
|
31
|
-
TermsAndConditionsAccepted: true
|
|
32
|
-
}
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def define_new_natural_user_sca_payer
|
|
36
|
-
{
|
|
37
|
-
"UserCategory": "PAYER",
|
|
38
|
-
"TermsAndConditionsAccepted": true,
|
|
39
|
-
"FirstName": "Alex",
|
|
40
|
-
"LastName": "Smith",
|
|
41
|
-
"Email": "alex.smith@example.com",
|
|
42
|
-
"Address": {
|
|
43
|
-
"AddressLine1": "3 rue de la Cité",
|
|
44
|
-
"AddressLine2": "Appartement 7",
|
|
45
|
-
"City": "Paris",
|
|
46
|
-
"Region": "Île-de-France",
|
|
47
|
-
"PostalCode": "75004",
|
|
48
|
-
"Country": "FR"
|
|
49
|
-
},
|
|
50
|
-
"Tag": "Created using the Mangopay API Postman collection",
|
|
51
|
-
"PhoneNumber": "0611111111",
|
|
52
|
-
"PhoneNumberCountry": "FR"
|
|
53
|
-
}
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def define_new_natural_user_sca_owner
|
|
57
|
-
{
|
|
58
|
-
"UserCategory": "OWNER",
|
|
59
|
-
"TermsAndConditionsAccepted": true,
|
|
60
|
-
"FirstName": "Alex",
|
|
61
|
-
"LastName": "Smith",
|
|
62
|
-
"Email": "alex.smith@example.com",
|
|
63
|
-
"Address": {
|
|
64
|
-
"AddressLine1": "3 rue de la Cité",
|
|
65
|
-
"AddressLine2": "Appartement 7",
|
|
66
|
-
"City": "Paris",
|
|
67
|
-
"Region": "Île-de-France",
|
|
68
|
-
"PostalCode": "75004",
|
|
69
|
-
"Country": "FR"
|
|
70
|
-
},
|
|
71
|
-
"Birthday": 652117514,
|
|
72
|
-
"CountryOfResidence": "FR",
|
|
73
|
-
"Nationality": "FR",
|
|
74
|
-
"Tag": "Created using the Mangopay API Postman collection",
|
|
75
|
-
"PhoneNumber": "0611111111",
|
|
76
|
-
"PhoneNumberCountry": "FR"
|
|
77
|
-
}
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def define_new_legal_user_sca_payer
|
|
81
|
-
{
|
|
82
|
-
"UserCategory": "PAYER",
|
|
83
|
-
"TermsAndConditionsAccepted": true,
|
|
84
|
-
"LegalPersonType": "SOLETRADER",
|
|
85
|
-
"Name": "Alex Smith",
|
|
86
|
-
"Email": "alex.smith.services@example.com",
|
|
87
|
-
"LegalRepresentative": {
|
|
88
|
-
"FirstName": "Alex",
|
|
89
|
-
"LastName": "Smith",
|
|
90
|
-
"Birthday": 652117514,
|
|
91
|
-
"Nationality": "FR",
|
|
92
|
-
"CountryOfResidence": "FR",
|
|
93
|
-
"Email": "alex.smith@example.com",
|
|
94
|
-
"PhoneNumber": "0611111111",
|
|
95
|
-
"PhoneNumberCountry": "FR"
|
|
96
|
-
},
|
|
97
|
-
"LegalRepresentativeAddress": {
|
|
98
|
-
"AddressLine1": "3 rue de la Cité",
|
|
99
|
-
"AddressLine2": "Appartement 7",
|
|
100
|
-
"City": "Paris",
|
|
101
|
-
"Region": "Île-de-France",
|
|
102
|
-
"PostalCode": "75004",
|
|
103
|
-
"Country": "FR"
|
|
104
|
-
},
|
|
105
|
-
"Tag": "Created using the Mangopay API Postman collection"
|
|
106
|
-
}
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
def define_new_legal_user_sca_owner
|
|
110
|
-
{
|
|
111
|
-
"UserCategory": "OWNER",
|
|
112
|
-
"TermsAndConditionsAccepted": true,
|
|
113
|
-
"LegalPersonType": "SOLETRADER",
|
|
114
|
-
"Name": "Alex Smith",
|
|
115
|
-
"Email": "alex.smith.services@example.com",
|
|
116
|
-
"LegalRepresentative": {
|
|
117
|
-
"FirstName": "Alex",
|
|
118
|
-
"LastName": "Smith",
|
|
119
|
-
"Birthday": 652117514,
|
|
120
|
-
"Nationality": "FR",
|
|
121
|
-
"CountryOfResidence": "FR",
|
|
122
|
-
"Email": "alex.smith@example.com",
|
|
123
|
-
"PhoneNumber": "0611111111",
|
|
124
|
-
"PhoneNumberCountry": "FR"
|
|
125
|
-
},
|
|
126
|
-
"CompanyNumber": "123456789",
|
|
127
|
-
"HeadquartersAddress": {
|
|
128
|
-
"AddressLine1": "3 rue de la Cité",
|
|
129
|
-
"AddressLine2": "Appartement 7",
|
|
130
|
-
"City": "Paris",
|
|
131
|
-
"Region": "Île-de-France",
|
|
132
|
-
"PostalCode": "75004",
|
|
133
|
-
"Country": "FR"
|
|
134
|
-
},
|
|
135
|
-
"LegalRepresentativeAddress": {
|
|
136
|
-
"AddressLine1": "3 rue de la Cité",
|
|
137
|
-
"AddressLine2": "Appartement 7",
|
|
138
|
-
"City": "Paris",
|
|
139
|
-
"Region": "Île-de-France",
|
|
140
|
-
"PostalCode": "75004",
|
|
141
|
-
"Country": "FR"
|
|
142
|
-
},
|
|
143
|
-
"Tag": "Created using the Mangopay API Postman collection"
|
|
144
|
-
}
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
def create_new_natural_user
|
|
148
|
-
MangoPay::NaturalUser.create(define_new_natural_user)
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
def create_new_natural_user_sca_payer
|
|
152
|
-
MangoPay::NaturalUserSca.create(define_new_natural_user_sca_payer)
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
def create_new_natural_user_sca_owner
|
|
156
|
-
MangoPay::NaturalUserSca.create(define_new_natural_user_sca_owner)
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
def create_new_legal_user_sca_payer
|
|
160
|
-
MangoPay::LegalUserSca.create(define_new_legal_user_sca_payer)
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
def create_new_legal_user_sca_owner
|
|
164
|
-
MangoPay::LegalUserSca.create(define_new_legal_user_sca_owner)
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
let(:new_legal_user) do
|
|
168
|
-
MangoPay::LegalUser.create(
|
|
169
|
-
Name: 'Super',
|
|
170
|
-
Email: 'super@email.com',
|
|
171
|
-
LegalPersonType: 'BUSINESS',
|
|
172
|
-
HeadquartersAddress: {
|
|
173
|
-
AddressLine1: '6 Parvis Notre-Dame',
|
|
174
|
-
AddressLine2: 'Pl. Jean-Paul II',
|
|
175
|
-
City: 'Paris',
|
|
176
|
-
Region: 'FR',
|
|
177
|
-
PostalCode: '75004',
|
|
178
|
-
Country: 'FR'
|
|
179
|
-
},
|
|
180
|
-
LegalRepresentativeFirstName: 'John',
|
|
181
|
-
LegalRepresentativeLastName: 'Doe',
|
|
182
|
-
LegalRepresentativeAdress: {
|
|
183
|
-
AddressLine1: '38 Rue de Montpensier',
|
|
184
|
-
AddressLine2: '',
|
|
185
|
-
City: 'Paris',
|
|
186
|
-
Region: '',
|
|
187
|
-
PostalCode: '75001',
|
|
188
|
-
Country: 'FR'
|
|
189
|
-
},
|
|
190
|
-
LegalRepresentativeEmail: 'john@doe.com',
|
|
191
|
-
LegalRepresentativeBirthday: 1_300_186_358,
|
|
192
|
-
LegalRepresentativeNationality: 'FR',
|
|
193
|
-
LegalRepresentativeCountryOfResidence: 'FR',
|
|
194
|
-
CompanyNumber: 'LU123456789',
|
|
195
|
-
Statute: '',
|
|
196
|
-
ProofOfRegistration: '',
|
|
197
|
-
ShareholderDeclaration: '',
|
|
198
|
-
TermsAndConditionsAccepted: true
|
|
199
|
-
)
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
###############################################
|
|
204
|
-
shared_context 'wallets' do
|
|
205
|
-
###############################################
|
|
206
|
-
include_context 'users'
|
|
207
|
-
|
|
208
|
-
let(:new_wallet) { create_new_wallet(new_natural_user) }
|
|
209
|
-
let(:new_wallet_legal) { create_new_wallet(new_legal_user) }
|
|
210
|
-
|
|
211
|
-
def create_new_wallet(user)
|
|
212
|
-
MangoPay::Wallet.create(
|
|
213
|
-
Owners: [user['Id']],
|
|
214
|
-
Description: 'A test wallet',
|
|
215
|
-
Currency: 'EUR',
|
|
216
|
-
Tag: 'Test wallet'
|
|
217
|
-
)
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
def create_new_custom_wallet(user, currency)
|
|
221
|
-
MangoPay::Wallet.create(
|
|
222
|
-
Owners: [user['Id']],
|
|
223
|
-
Description: 'A test wallet',
|
|
224
|
-
Currency: currency,
|
|
225
|
-
Tag: 'Test wallet'
|
|
226
|
-
)
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
def wallets_check_amounts(wlt1, amnt1, wlt2 = nil, amnt2 = nil)
|
|
230
|
-
expect(wlt1['Balance']['Amount']).to eq amnt1
|
|
231
|
-
expect(wlt2['Balance']['Amount']).to eq amnt2 if wlt2
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
def wallets_reload_and_check_amounts(wlt1, amnt1, wlt2 = nil, amnt2 = nil)
|
|
235
|
-
wlt1 = MangoPay::Wallet.fetch(wlt1['Id'])
|
|
236
|
-
wlt2 = MangoPay::Wallet.fetch(wlt2['Id']) if wlt2
|
|
237
|
-
wallets_check_amounts(wlt1, amnt1, wlt2, amnt2)
|
|
238
|
-
end
|
|
239
|
-
end
|
|
240
|
-
|
|
241
|
-
shared_context 'ubo' do
|
|
242
|
-
def new_ubo(user, ubo_declaration)
|
|
243
|
-
ubo = {
|
|
244
|
-
FirstName: 'John',
|
|
245
|
-
LastName: 'Doe',
|
|
246
|
-
Address: {
|
|
247
|
-
AddressLine1: '6 Parvis Notre-Dame',
|
|
248
|
-
AddressLine2: 'Pl. Jean-Paul II',
|
|
249
|
-
City: 'Paris',
|
|
250
|
-
Region: '',
|
|
251
|
-
PostalCode: '75004',
|
|
252
|
-
Country: 'FR'
|
|
253
|
-
},
|
|
254
|
-
Nationality: 'FR',
|
|
255
|
-
Birthday: 1_300_186_358,
|
|
256
|
-
Birthplace: {
|
|
257
|
-
City: 'Paris',
|
|
258
|
-
Country: 'FR'
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
MangoPay::Ubo.create(user['Id'], ubo_declaration['Id'], ubo)
|
|
262
|
-
end
|
|
263
|
-
end
|
|
264
|
-
|
|
265
|
-
###############################################
|
|
266
|
-
shared_context 'bank_accounts' do
|
|
267
|
-
###############################################
|
|
268
|
-
include_context 'users'
|
|
269
|
-
|
|
270
|
-
let(:new_bank_account) do
|
|
271
|
-
MangoPay::BankAccount.create(new_natural_user['Id'],
|
|
272
|
-
Type: 'IBAN',
|
|
273
|
-
OwnerName: 'John',
|
|
274
|
-
OwnerAddress: {
|
|
275
|
-
AddressLine1: 'Le Palais Royal',
|
|
276
|
-
AddressLine2: '8 Rue de Montpensier',
|
|
277
|
-
City: 'Paris',
|
|
278
|
-
Region: '',
|
|
279
|
-
PostalCode: '75001',
|
|
280
|
-
Country: 'FR'
|
|
281
|
-
},
|
|
282
|
-
IBAN: 'FR7630004000031234567890143',
|
|
283
|
-
BIC: 'BNPAFRPP',
|
|
284
|
-
Tag: 'Test bank account')
|
|
285
|
-
end
|
|
286
|
-
end
|
|
287
|
-
|
|
288
|
-
###############################################
|
|
289
|
-
shared_context 'mandates' do
|
|
290
|
-
###############################################
|
|
291
|
-
include_context 'bank_accounts'
|
|
292
|
-
|
|
293
|
-
let(:new_mandate) { create_new_mandate }
|
|
294
|
-
|
|
295
|
-
def create_new_mandate
|
|
296
|
-
MangoPay::Mandate.create(
|
|
297
|
-
BankAccountId: new_bank_account['Id'],
|
|
298
|
-
Culture: 'FR',
|
|
299
|
-
ReturnURL: MangoPay.configuration.root_url,
|
|
300
|
-
Tag: 'Test mandate'
|
|
301
|
-
)
|
|
302
|
-
end
|
|
303
|
-
end
|
|
304
|
-
|
|
305
|
-
###############################################
|
|
306
|
-
shared_context 'kyc_documents' do
|
|
307
|
-
###############################################
|
|
308
|
-
include_context 'users'
|
|
309
|
-
|
|
310
|
-
let(:new_document) { create_new_document(new_natural_user) }
|
|
311
|
-
|
|
312
|
-
def create_new_document(user)
|
|
313
|
-
MangoPay::KycDocument.create(user['Id'],
|
|
314
|
-
Type: 'IDENTITY_PROOF',
|
|
315
|
-
Tag: 'Test document')
|
|
316
|
-
end
|
|
317
|
-
end
|
|
318
|
-
|
|
319
|
-
###############################################
|
|
320
|
-
shared_context 'payins' do
|
|
321
|
-
###############################################
|
|
322
|
-
include_context 'users'
|
|
323
|
-
include_context 'wallets'
|
|
324
|
-
include_context 'mandates'
|
|
325
|
-
|
|
326
|
-
###############################################
|
|
327
|
-
# directdebit/web
|
|
328
|
-
###############################################
|
|
329
|
-
|
|
330
|
-
let(:new_payin_directdebit_web) do
|
|
331
|
-
MangoPay::PayIn::DirectDebit::Web.create(
|
|
332
|
-
AuthorId: new_natural_user['Id'],
|
|
333
|
-
CreditedUserId: new_wallet['Owners'][0],
|
|
334
|
-
CreditedWalletId: new_wallet['Id'],
|
|
335
|
-
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
|
336
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
337
|
-
DirectDebitType: 'GIROPAY',
|
|
338
|
-
ReturnURL: MangoPay.configuration.root_url,
|
|
339
|
-
Culture: 'FR',
|
|
340
|
-
Tag: 'Test PayIn/DirectDebit/Web'
|
|
341
|
-
)
|
|
342
|
-
end
|
|
343
|
-
|
|
344
|
-
###############################################
|
|
345
|
-
# paypal/web
|
|
346
|
-
###############################################
|
|
347
|
-
|
|
348
|
-
let(:new_payin_paypal_web) do
|
|
349
|
-
MangoPay::PayIn::PayPal::Web.create(
|
|
350
|
-
AuthorId: new_natural_user['Id'],
|
|
351
|
-
CreditedUserId: new_wallet['Owners'][0],
|
|
352
|
-
CreditedWalletId: new_wallet['Id'],
|
|
353
|
-
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
|
354
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
355
|
-
ReturnURL: MangoPay.configuration.root_url,
|
|
356
|
-
Culture: "FR",
|
|
357
|
-
Tag: 'Test PayIn/PayPal/Web'
|
|
358
|
-
)
|
|
359
|
-
end
|
|
360
|
-
|
|
361
|
-
###############################################
|
|
362
|
-
# applepay/direct
|
|
363
|
-
###############################################
|
|
364
|
-
|
|
365
|
-
let(:new_payin_applepay_direct) do
|
|
366
|
-
MangoPay::PayIn::ApplePay::Direct.create(
|
|
367
|
-
AuthorId: new_natural_user['Id'],
|
|
368
|
-
CreditedUserId: new_wallet['Owners'][0],
|
|
369
|
-
CreditedWalletId: new_wallet['Id'],
|
|
370
|
-
DebitedFunds: { Currency: 'EUR', Amount: 199 },
|
|
371
|
-
Fees: { Currency: 'EUR', Amount: 1 },
|
|
372
|
-
PaymentType: 'APPLEPAY',
|
|
373
|
-
PaymentData: {
|
|
374
|
-
TransactionId: '061EB32181A2D9CA42AD16031B476EEBAA62A9A095AD660E2759FBA52B51A61',
|
|
375
|
-
Network: 'VISA',
|
|
376
|
-
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\"}}"
|
|
377
|
-
},
|
|
378
|
-
StatementDescriptor: "php",
|
|
379
|
-
ReturnURL: MangoPay.configuration.root_url,
|
|
380
|
-
Tag: 'Test PayIn/ApplePay/Direct'
|
|
381
|
-
)
|
|
382
|
-
end
|
|
383
|
-
|
|
384
|
-
###############################################
|
|
385
|
-
# CANNOT BE TESTED AS WE CAN'T MOCK TOKEN GENERATION
|
|
386
|
-
# googlepay/direct
|
|
387
|
-
###############################################
|
|
388
|
-
let(:new_payin_googlepay_direct) do
|
|
389
|
-
MangoPay::PayIn::GooglePay::Direct.create(
|
|
390
|
-
AuthorId: new_natural_user['Id'],
|
|
391
|
-
CreditedWalletId: new_wallet['Id'],
|
|
392
|
-
DebitedFunds: { Currency: 'EUR', Amount: 199 },
|
|
393
|
-
Fees: { Currency: 'EUR', Amount: 1 },
|
|
394
|
-
StatementDescriptor: "ruby",
|
|
395
|
-
Tag: 'Test PayIn/GooglePay/Direct',
|
|
396
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
|
397
|
-
SecureModeReturnURL: 'http://test.com',
|
|
398
|
-
SecureMode: 'DEFAULT',
|
|
399
|
-
ReturnURL: 'https://mangopay.com/docs/please-ignore',
|
|
400
|
-
BrowserInfo: {
|
|
401
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
402
|
-
JavaEnabled: true,
|
|
403
|
-
Language: "fr-FR",
|
|
404
|
-
ColorDepth: 4,
|
|
405
|
-
ScreenHeight: 1800,
|
|
406
|
-
ScreenWidth: 400,
|
|
407
|
-
JavascriptEnabled: true,
|
|
408
|
-
TimeZoneOffset: "+60",
|
|
409
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
410
|
-
},
|
|
411
|
-
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\\\"}\"}",
|
|
412
|
-
Billing: {
|
|
413
|
-
FirstName: 'FName',
|
|
414
|
-
LastName: 'LName',
|
|
415
|
-
Address: {
|
|
416
|
-
AddressLine1: 'AddressLine1',
|
|
417
|
-
AddressLine2: 'AddressLine2',
|
|
418
|
-
City: 'City',
|
|
419
|
-
Region: 'Region',
|
|
420
|
-
PostalCode: 'PostalCode',
|
|
421
|
-
Country: 'FR'
|
|
422
|
-
}
|
|
423
|
-
},
|
|
424
|
-
Shipping: {
|
|
425
|
-
FirstName: 'FName',
|
|
426
|
-
LastName: 'LName',
|
|
427
|
-
Address: {
|
|
428
|
-
AddressLine1: 'AddressLine1',
|
|
429
|
-
AddressLine2: 'AddressLine2',
|
|
430
|
-
City: 'City',
|
|
431
|
-
Region: 'Region',
|
|
432
|
-
PostalCode: 'PostalCode',
|
|
433
|
-
Country: 'FR'
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
)
|
|
437
|
-
end
|
|
438
|
-
|
|
439
|
-
###############################################
|
|
440
|
-
# directdebit/direct
|
|
441
|
-
###############################################
|
|
442
|
-
|
|
443
|
-
let(:new_payin_directdebit_direct) do
|
|
444
|
-
MangoPay::PayIn::DirectDebit::Direct.create(
|
|
445
|
-
AuthorId: new_natural_user['Id'],
|
|
446
|
-
CreditedUserId: new_wallet['Owners'][0],
|
|
447
|
-
CreditedWalletId: new_wallet['Id'],
|
|
448
|
-
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
|
449
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
450
|
-
MandateId: new_mandate['Id'],
|
|
451
|
-
ReturnURL: MangoPay.configuration.root_url,
|
|
452
|
-
Tag: 'Test PayIn/DirectDebit/Direct'
|
|
453
|
-
)
|
|
454
|
-
end
|
|
455
|
-
|
|
456
|
-
###############################################
|
|
457
|
-
# card/web
|
|
458
|
-
###############################################
|
|
459
|
-
|
|
460
|
-
let(:new_payin_card_web) do
|
|
461
|
-
MangoPay::PayIn::Card::Web.create(
|
|
462
|
-
AuthorId: new_natural_user['Id'],
|
|
463
|
-
CreditedUserId: new_wallet['Owners'][0],
|
|
464
|
-
CreditedWalletId: new_wallet['Id'],
|
|
465
|
-
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
|
466
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
467
|
-
CardType: 'CB_VISA_MASTERCARD',
|
|
468
|
-
ReturnURL: MangoPay.configuration.root_url,
|
|
469
|
-
Culture: 'FR',
|
|
470
|
-
Tag: 'Test PayIn/Card/Web'
|
|
471
|
-
)
|
|
472
|
-
end
|
|
473
|
-
|
|
474
|
-
let(:new_payin_card_web_payline) do
|
|
475
|
-
MangoPay::PayIn::Card::Web.create(
|
|
476
|
-
AuthorId: new_natural_user['Id'],
|
|
477
|
-
CreditedUserId: new_wallet['Owners'][0],
|
|
478
|
-
CreditedWalletId: new_wallet['Id'],
|
|
479
|
-
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
|
480
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
481
|
-
CardType: 'CB_VISA_MASTERCARD',
|
|
482
|
-
ReturnURL: MangoPay.configuration.root_url,
|
|
483
|
-
Culture: 'FR',
|
|
484
|
-
Tag: 'Test PayIn/Card/Web',
|
|
485
|
-
TemplateURLOptions: { PAYLINEV2: "https://www.maysite.com/payline_template/" }
|
|
486
|
-
)
|
|
487
|
-
end
|
|
488
|
-
|
|
489
|
-
###############################################
|
|
490
|
-
# card/direct
|
|
491
|
-
###############################################
|
|
492
|
-
|
|
493
|
-
let(:new_card_registration) do
|
|
494
|
-
MangoPay::CardRegistration.create(
|
|
495
|
-
UserId: new_natural_user['Id'],
|
|
496
|
-
Currency: 'EUR',
|
|
497
|
-
Tag: 'Test Card Registration'
|
|
498
|
-
)
|
|
499
|
-
end
|
|
500
|
-
|
|
501
|
-
let(:new_card_registration_completed) do
|
|
502
|
-
# 1st step: create
|
|
503
|
-
cardreg = new_card_registration
|
|
504
|
-
|
|
505
|
-
# 2nd step: tokenize by payline (fills-in RegistrationData)
|
|
506
|
-
data = {
|
|
507
|
-
data: cardreg['PreregistrationData'],
|
|
508
|
-
accessKeyRef: cardreg['AccessKey'],
|
|
509
|
-
cardNumber: 4970107111111119,
|
|
510
|
-
cardExpirationDate: 1229,
|
|
511
|
-
cardCvx: 123 }
|
|
512
|
-
|
|
513
|
-
res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
|
|
514
|
-
raise Exception, [res, res.body] unless res.is_a?(Net::HTTPOK) && res.body.start_with?('data=')
|
|
515
|
-
|
|
516
|
-
cardreg['RegistrationData'] = res.body
|
|
517
|
-
|
|
518
|
-
# 3rd step: update (fills-in CardId) and return it
|
|
519
|
-
MangoPay::CardRegistration.update(cardreg['Id'],
|
|
520
|
-
RegistrationData: cardreg['RegistrationData'])
|
|
521
|
-
end
|
|
522
|
-
|
|
523
|
-
let(:new_payin_card_direct) { create_new_payin_card_direct(new_wallet) }
|
|
524
|
-
|
|
525
|
-
###############################################
|
|
526
|
-
# MBWAY/web
|
|
527
|
-
###############################################
|
|
528
|
-
let(:new_payin_mbway_web) do
|
|
529
|
-
MangoPay::PayIn::Mbway::Web.create(
|
|
530
|
-
AuthorId: new_natural_user['Id'],
|
|
531
|
-
CreditedWalletId: new_wallet['Id'],
|
|
532
|
-
DebitedFunds: { Currency: 'EUR', Amount: 199 },
|
|
533
|
-
Fees: { Currency: 'EUR', Amount: 1 },
|
|
534
|
-
StatementDescriptor: "ruby",
|
|
535
|
-
Tag: 'Test PayIn/Mbway/Web',
|
|
536
|
-
Phone: '351#269458236'
|
|
537
|
-
)
|
|
538
|
-
end
|
|
539
|
-
|
|
540
|
-
###############################################
|
|
541
|
-
# MULTIBANCO/web
|
|
542
|
-
###############################################
|
|
543
|
-
let(:new_payin_multibanco_web) do
|
|
544
|
-
MangoPay::PayIn::Multibanco::Web.create(
|
|
545
|
-
AuthorId: new_natural_user['Id'],
|
|
546
|
-
DebitedFunds: { Currency: 'EUR', Amount: 199 },
|
|
547
|
-
Fees: { Currency: 'EUR', Amount: 1 },
|
|
548
|
-
CreditedWalletId: new_wallet['Id'],
|
|
549
|
-
StatementDescriptor: "ruby",
|
|
550
|
-
Tag: 'Test PayIn/Multibanco/Web',
|
|
551
|
-
ReturnURL: 'http://www.my-site.com/returnURL'
|
|
552
|
-
)
|
|
553
|
-
end
|
|
554
|
-
|
|
555
|
-
###############################################
|
|
556
|
-
# BLIK/web
|
|
557
|
-
###############################################
|
|
558
|
-
let(:new_payin_blik_web) do
|
|
559
|
-
user = new_natural_user
|
|
560
|
-
wallet = MangoPay::Wallet.create(
|
|
561
|
-
Owners: [user['Id']],
|
|
562
|
-
Description: 'A test wallet',
|
|
563
|
-
Currency: 'PLN',
|
|
564
|
-
Tag: 'Test wallet'
|
|
565
|
-
)
|
|
566
|
-
MangoPay::PayIn::Blik::Web.create(define_new_blik(user, wallet))
|
|
567
|
-
end
|
|
568
|
-
|
|
569
|
-
let(:new_payin_blik_web_with_code) do
|
|
570
|
-
user = new_natural_user
|
|
571
|
-
wallet = MangoPay::Wallet.create(
|
|
572
|
-
Owners: [user['Id']],
|
|
573
|
-
Description: 'A test wallet',
|
|
574
|
-
Currency: 'PLN',
|
|
575
|
-
Tag: 'Test wallet'
|
|
576
|
-
)
|
|
577
|
-
blik = define_new_blik(user, wallet)
|
|
578
|
-
blik['Code'] = '777365'
|
|
579
|
-
blik['IpAddress'] = '159.180.248.187'
|
|
580
|
-
blik['BrowserInfo'] = {
|
|
581
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
582
|
-
JavaEnabled: true,
|
|
583
|
-
Language: "FR-FR",
|
|
584
|
-
ColorDepth: 4,
|
|
585
|
-
ScreenHeight: 1800,
|
|
586
|
-
ScreenWidth: 400,
|
|
587
|
-
JavascriptEnabled: true,
|
|
588
|
-
TimeZoneOffset: "+60",
|
|
589
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
590
|
-
}
|
|
591
|
-
MangoPay::PayIn::Blik::Web.create(blik)
|
|
592
|
-
end
|
|
593
|
-
|
|
594
|
-
def define_new_blik(user, wallet)
|
|
595
|
-
{
|
|
596
|
-
AuthorId: user['Id'],
|
|
597
|
-
CreditedWalletId: wallet['Id'],
|
|
598
|
-
DebitedFunds: { Currency: 'PLN', Amount: 199 },
|
|
599
|
-
Fees: { Currency: 'PLN', Amount: 1 },
|
|
600
|
-
StatementDescriptor: "ruby",
|
|
601
|
-
Tag: 'Test PayIn/Blik/Web',
|
|
602
|
-
ReturnURL: 'https://example.com'
|
|
603
|
-
}
|
|
604
|
-
end
|
|
605
|
-
|
|
606
|
-
###############################################
|
|
607
|
-
# SATISPAY/web
|
|
608
|
-
###############################################
|
|
609
|
-
let(:new_payin_satispay_web) do
|
|
610
|
-
MangoPay::PayIn::Satispay::Web.create(
|
|
611
|
-
AuthorId: new_natural_user['Id'],
|
|
612
|
-
CreditedWalletId: new_wallet['Id'],
|
|
613
|
-
DebitedFunds: { Currency: 'EUR', Amount: 199 },
|
|
614
|
-
Fees: { Currency: 'EUR', Amount: 1 },
|
|
615
|
-
StatementDescriptor: "ruby",
|
|
616
|
-
Tag: 'Test PayIn/Mbway/Web',
|
|
617
|
-
Country: 'IT',
|
|
618
|
-
ReturnURL: 'http://www.my-site.com/returnURL'
|
|
619
|
-
)
|
|
620
|
-
end
|
|
621
|
-
|
|
622
|
-
###############################################
|
|
623
|
-
# KLARNA/web
|
|
624
|
-
###############################################
|
|
625
|
-
let(:new_payin_klarna_web) do
|
|
626
|
-
MangoPay::PayIn::Klarna::Web.create(
|
|
627
|
-
AuthorId: new_natural_user['Id'],
|
|
628
|
-
CreditedWalletId: new_wallet['Id'],
|
|
629
|
-
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
|
630
|
-
Fees: { Currency: 'EUR', Amount: 10 },
|
|
631
|
-
ReturnURL: 'http://www.my-site.com/returnURL',
|
|
632
|
-
LineItems: [
|
|
633
|
-
{
|
|
634
|
-
Name: "running shoes",
|
|
635
|
-
Quantity: 1,
|
|
636
|
-
UnitAmount: 200,
|
|
637
|
-
TaxAmount: 0,
|
|
638
|
-
Description: "seller1 ID"
|
|
639
|
-
},
|
|
640
|
-
{
|
|
641
|
-
Name: "running shoes",
|
|
642
|
-
Quantity: 1,
|
|
643
|
-
UnitAmount: 200,
|
|
644
|
-
TaxAmount: 0,
|
|
645
|
-
Description: "seller2 ID"
|
|
646
|
-
}
|
|
647
|
-
],
|
|
648
|
-
Country: 'FR',
|
|
649
|
-
Culture: 'FR',
|
|
650
|
-
Phone: '33#607080900',
|
|
651
|
-
Email: 'mango@mangopay.com',
|
|
652
|
-
AdditionalData: '{}',
|
|
653
|
-
Billing: {
|
|
654
|
-
Address: {
|
|
655
|
-
AddressLine1: 'AddressLine1',
|
|
656
|
-
AddressLine2: 'AddressLine2',
|
|
657
|
-
City: 'City',
|
|
658
|
-
Region: 'Region',
|
|
659
|
-
PostalCode: 'PostalCode',
|
|
660
|
-
Country: 'FR'
|
|
661
|
-
},
|
|
662
|
-
FirstName: 'Joe',
|
|
663
|
-
LastName: 'Blogs'
|
|
664
|
-
},
|
|
665
|
-
Shipping: {
|
|
666
|
-
Address: {
|
|
667
|
-
AddressLine1: 'AddressLine1',
|
|
668
|
-
AddressLine2: 'AddressLine2',
|
|
669
|
-
City: 'City',
|
|
670
|
-
Region: 'Region',
|
|
671
|
-
PostalCode: 'PostalCode',
|
|
672
|
-
Country: 'FR'
|
|
673
|
-
},
|
|
674
|
-
FirstName: 'Joe',
|
|
675
|
-
LastName: 'Blogs'
|
|
676
|
-
},
|
|
677
|
-
Reference: 'afd48-879d-48fg',
|
|
678
|
-
Tag: 'Test PayIn/Klarna/Web'
|
|
679
|
-
)
|
|
680
|
-
end
|
|
681
|
-
|
|
682
|
-
###############################################
|
|
683
|
-
# IDEAL/web
|
|
684
|
-
###############################################
|
|
685
|
-
let(:new_payin_ideal_web) do
|
|
686
|
-
MangoPay::PayIn::Ideal::Web.create(
|
|
687
|
-
AuthorId: new_natural_user['Id'],
|
|
688
|
-
CreditedWalletId: new_wallet['Id'],
|
|
689
|
-
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
|
690
|
-
Fees: { Currency: 'EUR', Amount: 10 },
|
|
691
|
-
ReturnURL: 'http://www.my-site.com/returnURL',
|
|
692
|
-
Bic: 'REVOLT21',
|
|
693
|
-
StatementDescriptor: "test",
|
|
694
|
-
Tag: 'Test PayIn/Ideal/Web'
|
|
695
|
-
)
|
|
696
|
-
end
|
|
697
|
-
|
|
698
|
-
###############################################
|
|
699
|
-
# Giropay/web
|
|
700
|
-
###############################################
|
|
701
|
-
let(:new_payin_giropay_web) do
|
|
702
|
-
MangoPay::PayIn::Giropay::Web.create(
|
|
703
|
-
AuthorId: new_natural_user['Id'],
|
|
704
|
-
CreditedWalletId: new_wallet['Id'],
|
|
705
|
-
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
|
706
|
-
Fees: { Currency: 'EUR', Amount: 10 },
|
|
707
|
-
ReturnURL: 'http://www.my-site.com/returnURL',
|
|
708
|
-
StatementDescriptor: "test",
|
|
709
|
-
Tag: 'Test PayIn/Giropay/Web'
|
|
710
|
-
)
|
|
711
|
-
end
|
|
712
|
-
|
|
713
|
-
###############################################
|
|
714
|
-
# Bancontact/web
|
|
715
|
-
###############################################
|
|
716
|
-
let(:new_payin_bancontact_web) do
|
|
717
|
-
MangoPay::PayIn::Bancontact::Web.create(
|
|
718
|
-
AuthorId: new_natural_user['Id'],
|
|
719
|
-
CreditedWalletId: new_wallet['Id'],
|
|
720
|
-
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
|
721
|
-
Fees: { Currency: 'EUR', Amount: 10 },
|
|
722
|
-
ReturnURL: 'http://www.my-site.com/returnURL',
|
|
723
|
-
StatementDescriptor: "test",
|
|
724
|
-
Tag: 'Test PayIn/Bancontact/Web',
|
|
725
|
-
Culture: 'FR'
|
|
726
|
-
)
|
|
727
|
-
end
|
|
728
|
-
|
|
729
|
-
###############################################
|
|
730
|
-
# Bizum/web
|
|
731
|
-
###############################################
|
|
732
|
-
let(:new_payin_bizum_web_with_phone) do
|
|
733
|
-
user = new_natural_user
|
|
734
|
-
wallet = new_wallet
|
|
735
|
-
bizum = define_new_bizum(user, wallet, '+34700000000', nil)
|
|
736
|
-
MangoPay::PayIn::Bizum::Web.create(bizum)
|
|
737
|
-
end
|
|
738
|
-
|
|
739
|
-
let(:new_payin_bizum_web_with_return_url) do
|
|
740
|
-
user = new_natural_user
|
|
741
|
-
wallet = new_wallet
|
|
742
|
-
bizum = define_new_bizum(user, wallet, nil, 'https://docs.mangopay.com/please-ignore')
|
|
743
|
-
MangoPay::PayIn::Bizum::Web.create(bizum)
|
|
744
|
-
end
|
|
745
|
-
|
|
746
|
-
def define_new_bizum(user, wallet, phone, return_url)
|
|
747
|
-
{
|
|
748
|
-
AuthorId: user['Id'],
|
|
749
|
-
CreditedWalletId: wallet['Id'],
|
|
750
|
-
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
|
751
|
-
Fees: { Currency: 'EUR', Amount: 1 },
|
|
752
|
-
StatementDescriptor: "test bizum",
|
|
753
|
-
Phone: phone,
|
|
754
|
-
ReturnUrl: return_url,
|
|
755
|
-
Tag: 'Test PayIn/Bizum/Web',
|
|
756
|
-
ProfilingAttemptReference: nil
|
|
757
|
-
}
|
|
758
|
-
end
|
|
759
|
-
|
|
760
|
-
###############################################
|
|
761
|
-
# Twint/web
|
|
762
|
-
###############################################
|
|
763
|
-
let(:new_payin_twint_web) do
|
|
764
|
-
MangoPay::PayIn::Twint::Web.create(
|
|
765
|
-
AuthorId: new_natural_user['Id'],
|
|
766
|
-
CreditedWalletId: create_new_custom_wallet(new_natural_user, 'CHF')['Id'],
|
|
767
|
-
DebitedFunds: { Currency: 'CHF', Amount: 50 },
|
|
768
|
-
Fees: { Currency: 'CHF', Amount: 10 },
|
|
769
|
-
ReturnURL: 'http://www.my-site.com/returnURL',
|
|
770
|
-
StatementDescriptor: "test",
|
|
771
|
-
Tag: 'Test PayIn/Twint/Web'
|
|
772
|
-
)
|
|
773
|
-
end
|
|
774
|
-
|
|
775
|
-
###############################################
|
|
776
|
-
# Swish/web
|
|
777
|
-
###############################################
|
|
778
|
-
let(:new_payin_swish_web) do
|
|
779
|
-
MangoPay::PayIn::Swish::Web.create(
|
|
780
|
-
AuthorId: new_natural_user['Id'],
|
|
781
|
-
CreditedWalletId: create_new_custom_wallet(new_natural_user, 'SEK')['Id'],
|
|
782
|
-
DebitedFunds: { Currency: 'SEK', Amount: 400 },
|
|
783
|
-
Fees: { Currency: 'SEK', Amount: 10 },
|
|
784
|
-
ReturnURL: 'http://www.my-site.com/returnURL',
|
|
785
|
-
StatementDescriptor: "test",
|
|
786
|
-
Tag: 'Test PayIn/Swish/Web'
|
|
787
|
-
)
|
|
788
|
-
end
|
|
789
|
-
|
|
790
|
-
###############################################
|
|
791
|
-
# PAYPAL/web V2
|
|
792
|
-
###############################################
|
|
793
|
-
let(:new_payin_paypal_web_v2) do
|
|
794
|
-
MangoPay::PayIn::PayPal::Web.create_v2(
|
|
795
|
-
AuthorId: new_natural_user['Id'],
|
|
796
|
-
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
|
797
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
798
|
-
CreditedWalletId: new_wallet['Id'],
|
|
799
|
-
ReturnUrl: "http://example.com",
|
|
800
|
-
LineItems: [
|
|
801
|
-
{
|
|
802
|
-
Name: "running shoes",
|
|
803
|
-
Quantity: 1,
|
|
804
|
-
UnitAmount: 200,
|
|
805
|
-
TaxAmount: 0,
|
|
806
|
-
Description: "seller1 ID"
|
|
807
|
-
},
|
|
808
|
-
{
|
|
809
|
-
Name: "running shoes",
|
|
810
|
-
Quantity: 1,
|
|
811
|
-
UnitAmount: 200,
|
|
812
|
-
TaxAmount: 0,
|
|
813
|
-
Description: "seller2 ID"
|
|
814
|
-
}
|
|
815
|
-
],
|
|
816
|
-
Shipping: {
|
|
817
|
-
Address: {
|
|
818
|
-
AddressLine1: 'AddressLine1',
|
|
819
|
-
AddressLine2: 'AddressLine2',
|
|
820
|
-
City: 'City',
|
|
821
|
-
Region: 'Region',
|
|
822
|
-
PostalCode: 'PostalCode',
|
|
823
|
-
Country: 'FR'
|
|
824
|
-
},
|
|
825
|
-
FirstName: 'Joe',
|
|
826
|
-
LastName: 'Blogs'
|
|
827
|
-
},
|
|
828
|
-
ShippingPreference: "GET_FROM_FILE",
|
|
829
|
-
StatementDescriptor: "ruby",
|
|
830
|
-
Tag: 'Test',
|
|
831
|
-
# Culture: 'FR'
|
|
832
|
-
)
|
|
833
|
-
end
|
|
834
|
-
|
|
835
|
-
def create_new_payin_card_direct(to_wallet, amnt = 1000)
|
|
836
|
-
cardreg = new_card_registration_completed
|
|
837
|
-
MangoPay::PayIn::Card::Direct.create(
|
|
838
|
-
AuthorId: new_natural_user['Id'],
|
|
839
|
-
CreditedUserId: to_wallet['Owners'][0],
|
|
840
|
-
CreditedWalletId: to_wallet['Id'],
|
|
841
|
-
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
|
842
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
843
|
-
CardType: 'CB_VISA_MASTERCARD',
|
|
844
|
-
CardId: cardreg['CardId'],
|
|
845
|
-
SecureModeReturnURL: 'http://test.com',
|
|
846
|
-
Tag: 'Test PayIn/Card/Direct',
|
|
847
|
-
Requested3DSVersion: 'V2_1',
|
|
848
|
-
BrowserInfo: {
|
|
849
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
850
|
-
JavaEnabled: true,
|
|
851
|
-
Language: "FR-FR",
|
|
852
|
-
ColorDepth: 4,
|
|
853
|
-
ScreenHeight: 1800,
|
|
854
|
-
ScreenWidth: 400,
|
|
855
|
-
JavascriptEnabled: true,
|
|
856
|
-
TimeZoneOffset: "+60",
|
|
857
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
858
|
-
},
|
|
859
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
|
860
|
-
)
|
|
861
|
-
end
|
|
862
|
-
|
|
863
|
-
###############################################
|
|
864
|
-
# card/direct with pre-authorization
|
|
865
|
-
###############################################
|
|
866
|
-
|
|
867
|
-
let(:new_card_preauthorization) { create_new_card_preauthorization(new_card_registration_completed) }
|
|
868
|
-
|
|
869
|
-
def create_new_card_preauthorization(cardreg, amnt = 1000)
|
|
870
|
-
MangoPay::PreAuthorization.create(
|
|
871
|
-
AuthorId: new_natural_user['Id'],
|
|
872
|
-
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
|
873
|
-
CardId: cardreg['CardId'],
|
|
874
|
-
SecureMode: 'DEFAULT',
|
|
875
|
-
SecureModeReturnURL: 'http://test.com',
|
|
876
|
-
Tag: 'Test Card PreAuthorization',
|
|
877
|
-
Requested3DSVersion: 'V2_1',
|
|
878
|
-
BrowserInfo: {
|
|
879
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
880
|
-
JavaEnabled: true,
|
|
881
|
-
Language: "FR-FR",
|
|
882
|
-
ColorDepth: 4,
|
|
883
|
-
ScreenHeight: 1800,
|
|
884
|
-
ScreenWidth: 400,
|
|
885
|
-
JavascriptEnabled: true,
|
|
886
|
-
TimeZoneOffset: "+60",
|
|
887
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
888
|
-
},
|
|
889
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
|
890
|
-
)
|
|
891
|
-
end
|
|
892
|
-
|
|
893
|
-
let(:new_payin_preauthorized_direct) { create_new_payin_preauthorized_direct(new_wallet) }
|
|
894
|
-
|
|
895
|
-
def create_new_payin_preauthorized_direct(to_wallet, amnt = 1000)
|
|
896
|
-
preauth = new_card_preauthorization
|
|
897
|
-
MangoPay::PayIn::PreAuthorized::Direct.create(
|
|
898
|
-
AuthorId: new_natural_user['Id'],
|
|
899
|
-
CreditedUserId: to_wallet['Owners'][0],
|
|
900
|
-
CreditedWalletId: to_wallet['Id'],
|
|
901
|
-
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
|
902
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
903
|
-
PreauthorizationId: preauth['Id'],
|
|
904
|
-
Tag: 'Test PayIn/PreAuthorized/Direct',
|
|
905
|
-
BrowserInfo: {
|
|
906
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
907
|
-
JavaEnabled: true,
|
|
908
|
-
Language: "FR-FR",
|
|
909
|
-
ColorDepth: 4,
|
|
910
|
-
ScreenHeight: 1800,
|
|
911
|
-
ScreenWidth: 400,
|
|
912
|
-
JavascriptEnabled: true,
|
|
913
|
-
TimeZoneOffset: "+60",
|
|
914
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
915
|
-
},
|
|
916
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
|
917
|
-
)
|
|
918
|
-
end
|
|
919
|
-
|
|
920
|
-
def create_card_validation(author_id, card_id)
|
|
921
|
-
params = {
|
|
922
|
-
AuthorId: author_id,
|
|
923
|
-
SecureModeReturnURL: "https://mangopay.com",
|
|
924
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
|
925
|
-
Tag: "custom meta",
|
|
926
|
-
BrowserInfo: {
|
|
927
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
928
|
-
JavaEnabled: true,
|
|
929
|
-
Language: "FR-FR",
|
|
930
|
-
ColorDepth: 4,
|
|
931
|
-
ScreenHeight: 1800,
|
|
932
|
-
ScreenWidth: 400,
|
|
933
|
-
JavascriptEnabled: true,
|
|
934
|
-
TimeZoneOffset: "+60",
|
|
935
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
MangoPay::Card.validate(card_id, params)
|
|
939
|
-
end
|
|
940
|
-
|
|
941
|
-
###############################################
|
|
942
|
-
# pre-authorized direct deposit
|
|
943
|
-
###############################################
|
|
944
|
-
|
|
945
|
-
def create_new_payin_pre_authorized_deposit_direct(deposit_id, author_id, credited_wallet_id)
|
|
946
|
-
MangoPay::PayIn::PreAuthorized::Direct.create_pre_authorized_deposit_pay_in(
|
|
947
|
-
AuthorId: author_id,
|
|
948
|
-
CreditedWalletId: credited_wallet_id,
|
|
949
|
-
DebitedFunds: { Currency: 'EUR', Amount: 500 },
|
|
950
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
951
|
-
DepositId: deposit_id,
|
|
952
|
-
Tag: 'lorem ipsum'
|
|
953
|
-
)
|
|
954
|
-
end
|
|
955
|
-
|
|
956
|
-
def create_new_payin_pre_authorized_deposit_web(deposit_id, author_id, credited_wallet_id)
|
|
957
|
-
MangoPay::PayIn::PreAuthorized::Web.create_pre_authorized_deposit_pay_in(
|
|
958
|
-
AuthorId: author_id,
|
|
959
|
-
CreditedWalletId: credited_wallet_id,
|
|
960
|
-
DebitedFunds: { Currency: 'EUR', Amount: 500 },
|
|
961
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
962
|
-
DepositId: deposit_id,
|
|
963
|
-
Tag: 'lorem ipsum'
|
|
964
|
-
)
|
|
965
|
-
end
|
|
966
|
-
|
|
967
|
-
def create_new_deposit_pre_authorized_pay_in_prior_to_complement(deposit_id, author_id, credited_wallet_id)
|
|
968
|
-
MangoPay::PayIn::PreAuthorized::Direct.create_deposit_preauthorized_pay_in_prior_to_complement(
|
|
969
|
-
AuthorId: author_id,
|
|
970
|
-
CreditedWalletId: credited_wallet_id,
|
|
971
|
-
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
|
972
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
973
|
-
DepositId: deposit_id,
|
|
974
|
-
Tag: 'lorem ipsum'
|
|
975
|
-
)
|
|
976
|
-
end
|
|
977
|
-
|
|
978
|
-
def create_new_deposit_pre_authorized_pay_in_complement(deposit_id, author_id, credited_wallet_id)
|
|
979
|
-
MangoPay::PayIn::PreAuthorized::Direct.create_deposit_preauthorized_pay_in_complement(
|
|
980
|
-
AuthorId: author_id,
|
|
981
|
-
CreditedWalletId: credited_wallet_id,
|
|
982
|
-
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
|
983
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
984
|
-
DepositId: deposit_id,
|
|
985
|
-
Tag: 'lorem ipsum'
|
|
986
|
-
)
|
|
987
|
-
end
|
|
988
|
-
|
|
989
|
-
###############################################
|
|
990
|
-
# bankwire/direct
|
|
991
|
-
###############################################
|
|
992
|
-
|
|
993
|
-
let(:new_payin_bankwire_direct) { create_new_payin_bankwire_direct(new_wallet) }
|
|
994
|
-
|
|
995
|
-
def create_new_payin_bankwire_direct(to_wallet, amnt = 1000)
|
|
996
|
-
MangoPay::PayIn::BankWire::Direct.create(
|
|
997
|
-
AuthorId: new_natural_user['Id'],
|
|
998
|
-
CreditedUserId: to_wallet['Owners'][0],
|
|
999
|
-
CreditedWalletId: to_wallet['Id'],
|
|
1000
|
-
DeclaredDebitedFunds: { Currency: 'EUR', Amount: amnt },
|
|
1001
|
-
DeclaredFees: { Currency: 'EUR', Amount: 0 },
|
|
1002
|
-
Tag: 'Test PayIn/BankWire/Direct'
|
|
1003
|
-
)
|
|
1004
|
-
end
|
|
1005
|
-
|
|
1006
|
-
###############################################
|
|
1007
|
-
# wallet with money
|
|
1008
|
-
###############################################
|
|
1009
|
-
#
|
|
1010
|
-
let(:new_wallet_with_money) { create_new_wallet_with_money(new_natural_user) }
|
|
1011
|
-
|
|
1012
|
-
def create_new_wallet_with_money(user)
|
|
1013
|
-
wallet = MangoPay::Wallet.create(
|
|
1014
|
-
Owners: [user['Id']],
|
|
1015
|
-
Description: 'A test wallet',
|
|
1016
|
-
Currency: 'EUR',
|
|
1017
|
-
Tag: 'Test wallet'
|
|
1018
|
-
)
|
|
1019
|
-
|
|
1020
|
-
pay_in = create_new_payin_card_direct(wallet)
|
|
1021
|
-
MangoPay::Wallet.fetch(pay_in['CreditedWalletId'])
|
|
1022
|
-
end
|
|
1023
|
-
|
|
1024
|
-
let(:new_payin_paybybank_web) do
|
|
1025
|
-
MangoPay::PayIn::PayByBank::Web.create(
|
|
1026
|
-
AuthorId: new_natural_user['Id'],
|
|
1027
|
-
CreditedWalletId: create_new_custom_wallet(new_natural_user, 'EUR')['Id'],
|
|
1028
|
-
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
|
1029
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
1030
|
-
ReturnURL: 'http://www.my-site.com/returnURL',
|
|
1031
|
-
StatementDescriptor: "test",
|
|
1032
|
-
Tag: 'Test PayIn/PayByBank/Web',
|
|
1033
|
-
Country: 'DE',
|
|
1034
|
-
IBAN: 'DE03500105177564668331',
|
|
1035
|
-
BIC: 'AACSDE33',
|
|
1036
|
-
Scheme: 'SEPA_INSTANT_CREDIT_TRANSFER',
|
|
1037
|
-
BankName: 'de-demobank-open-banking-embedded-templates',
|
|
1038
|
-
Culture: 'EN',
|
|
1039
|
-
PaymentFlow: 'WEB'
|
|
1040
|
-
)
|
|
1041
|
-
end
|
|
1042
|
-
|
|
1043
|
-
end
|
|
1044
|
-
|
|
1045
|
-
###############################################
|
|
1046
|
-
shared_context 'payouts' do
|
|
1047
|
-
###############################################
|
|
1048
|
-
include_context 'bank_accounts'
|
|
1049
|
-
|
|
1050
|
-
let(:new_payout_bankwire) { create_new_payout_bankwire(new_payin_card_direct) }
|
|
1051
|
-
|
|
1052
|
-
def create_new_payout_bankwire(payin, amnt = 500)
|
|
1053
|
-
MangoPay::PayOut::BankWire.create(
|
|
1054
|
-
AuthorId: payin['CreditedUserId'],
|
|
1055
|
-
DebitedWalletId: payin['CreditedWalletId'],
|
|
1056
|
-
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
|
1057
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
1058
|
-
BankAccountId: new_bank_account['Id'],
|
|
1059
|
-
Communication: 'This is a test',
|
|
1060
|
-
Tag: 'Test PayOut/Bank/Wire',
|
|
1061
|
-
PayoutModeRequested: 'Standard'
|
|
1062
|
-
)
|
|
1063
|
-
end
|
|
1064
|
-
end
|
|
1065
|
-
|
|
1066
|
-
###############################################
|
|
1067
|
-
shared_context 'transfers' do
|
|
1068
|
-
###############################################
|
|
1069
|
-
include_context 'users'
|
|
1070
|
-
include_context 'wallets'
|
|
1071
|
-
include_context 'payins'
|
|
1072
|
-
|
|
1073
|
-
let(:new_transfer) do
|
|
1074
|
-
wlt1 = new_wallet
|
|
1075
|
-
wlt2 = new_wallet_legal
|
|
1076
|
-
create_new_payin_card_direct(wlt1, 1000) # feed wlt1 with money
|
|
1077
|
-
create_new_transfer(wlt1, wlt2, 500) # transfer wlt1 => wlt2
|
|
1078
|
-
end
|
|
1079
|
-
|
|
1080
|
-
def create_new_transfer(from_wallet, to_wallet, amnt = 500)
|
|
1081
|
-
MangoPay::Transfer.create(
|
|
1082
|
-
AuthorId: from_wallet['Owners'][0],
|
|
1083
|
-
DebitedWalletId: from_wallet['Id'],
|
|
1084
|
-
CreditedUserId: to_wallet['Owners'][0],
|
|
1085
|
-
CreditedWalletId: to_wallet['Id'],
|
|
1086
|
-
DebitedFunds: { Currency: 'EUR', Amount: amnt },
|
|
1087
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
1088
|
-
Tag: 'Test transfer'
|
|
1089
|
-
)
|
|
1090
|
-
end
|
|
1091
|
-
end
|
|
1092
|
-
|
|
1093
|
-
###############################################
|
|
1094
|
-
shared_context 'hooks' do
|
|
1095
|
-
###############################################
|
|
1096
|
-
let(:new_hook) do
|
|
1097
|
-
hooks = MangoPay::Hook.fetch('page' => 1, 'per_page' => 1)
|
|
1098
|
-
if hooks.empty?
|
|
1099
|
-
MangoPay::Hook.create(
|
|
1100
|
-
EventType: 'PAYIN_NORMAL_CREATED',
|
|
1101
|
-
Url: 'http://test.com',
|
|
1102
|
-
Tag: 'Test hook'
|
|
1103
|
-
)
|
|
1104
|
-
else
|
|
1105
|
-
hooks[0]
|
|
1106
|
-
end
|
|
1107
|
-
end
|
|
1108
|
-
end
|
|
1109
|
-
|
|
1110
|
-
###############################################
|
|
1111
|
-
shared_context 'bankingaliases' do
|
|
1112
|
-
###############################################
|
|
1113
|
-
include_context 'users'
|
|
1114
|
-
include_context 'wallets'
|
|
1115
|
-
|
|
1116
|
-
let(:new_banking_alias) do
|
|
1117
|
-
MangoPay::BankingAliasesIBAN.create({
|
|
1118
|
-
CreditedUserId: new_natural_user['Id'],
|
|
1119
|
-
WalletId: new_wallet['Id'],
|
|
1120
|
-
OwnerName: new_natural_user['FirstName'],
|
|
1121
|
-
Country: 'LU'
|
|
1122
|
-
}, new_wallet['Id'])
|
|
1123
|
-
end
|
|
1124
|
-
end
|
|
1125
|
-
|
|
1126
|
-
###############################################
|
|
1127
|
-
# deposits
|
|
1128
|
-
###############################################
|
|
1129
|
-
|
|
1130
|
-
def create_new_deposit(card_registration_id, author_id)
|
|
1131
|
-
MangoPay::Deposit.create(
|
|
1132
|
-
{
|
|
1133
|
-
AuthorId: author_id,
|
|
1134
|
-
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
|
1135
|
-
CardId: card_registration_id,
|
|
1136
|
-
SecureModeReturnURL: 'http://mangopay-sandbox-test.com',
|
|
1137
|
-
StatementDescriptor: "lorem",
|
|
1138
|
-
Culture: 'FR',
|
|
1139
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
|
1140
|
-
BrowserInfo: {
|
|
1141
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
1142
|
-
JavaEnabled: true,
|
|
1143
|
-
Language: "FR-FR",
|
|
1144
|
-
ColorDepth: 4,
|
|
1145
|
-
ScreenHeight: 1800,
|
|
1146
|
-
ScreenWidth: 400,
|
|
1147
|
-
JavascriptEnabled: true,
|
|
1148
|
-
TimeZoneOffset: "+60",
|
|
1149
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
1150
|
-
},
|
|
1151
|
-
Billing: {
|
|
1152
|
-
Address: {
|
|
1153
|
-
AddressLine1: 'AddressLine1',
|
|
1154
|
-
AddressLine2: 'AddressLine2',
|
|
1155
|
-
City: 'City',
|
|
1156
|
-
Region: 'Region',
|
|
1157
|
-
PostalCode: 'PostalCode',
|
|
1158
|
-
Country: 'FR'
|
|
1159
|
-
},
|
|
1160
|
-
FirstName: 'Joe',
|
|
1161
|
-
LastName: 'Blogs'
|
|
1162
|
-
},
|
|
1163
|
-
Shipping: {
|
|
1164
|
-
Address: {
|
|
1165
|
-
AddressLine1: 'AddressLine1',
|
|
1166
|
-
AddressLine2: 'AddressLine2',
|
|
1167
|
-
City: 'City',
|
|
1168
|
-
Region: 'Region',
|
|
1169
|
-
PostalCode: 'PostalCode',
|
|
1170
|
-
Country: 'FR'
|
|
1171
|
-
},
|
|
1172
|
-
FirstName: 'Joe',
|
|
1173
|
-
LastName: 'Blogs'
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
)
|
|
1177
|
-
end
|
|
1178
|
-
|
|
1179
|
-
def create_new_paypal_deposit_preauthorization(author_id)
|
|
1180
|
-
MangoPay::Deposit.create_paypal_preauthorization(
|
|
1181
|
-
{
|
|
1182
|
-
AuthorId: author_id,
|
|
1183
|
-
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
|
1184
|
-
ReturnURL: 'https://mangopay-sandbox-test.com',
|
|
1185
|
-
Shipping: {
|
|
1186
|
-
Address: {
|
|
1187
|
-
AddressLine1: 'AddressLine1',
|
|
1188
|
-
AddressLine2: 'AddressLine2',
|
|
1189
|
-
City: 'City',
|
|
1190
|
-
Region: 'Region',
|
|
1191
|
-
PostalCode: 'PostalCode',
|
|
1192
|
-
Country: 'FR'
|
|
1193
|
-
},
|
|
1194
|
-
FirstName: 'Joe',
|
|
1195
|
-
LastName: 'Blogs'
|
|
1196
|
-
},
|
|
1197
|
-
ShippingPreference: 'SET_PROVIDED_ADDRESS',
|
|
1198
|
-
Reference: '1234',
|
|
1199
|
-
LineItems: [
|
|
1200
|
-
{
|
|
1201
|
-
Name: "running shoes",
|
|
1202
|
-
Quantity: 1,
|
|
1203
|
-
UnitAmount: 1000,
|
|
1204
|
-
TaxAmount: 0,
|
|
1205
|
-
Description: "seller1 ID"
|
|
1206
|
-
}
|
|
1207
|
-
]
|
|
1208
|
-
}
|
|
1209
|
-
)
|
|
1210
|
-
end
|
|
1211
|
-
|
|
1212
|
-
###############################################
|
|
1213
|
-
# instant conversions
|
|
1214
|
-
###############################################
|
|
1215
|
-
shared_context 'instant_conversion' do
|
|
1216
|
-
include_context 'payins'
|
|
1217
|
-
|
|
1218
|
-
def get_conversion_rate(debited_currency, credited_currency)
|
|
1219
|
-
MangoPay::Conversion.get_rate(debited_currency, credited_currency, params = {})
|
|
1220
|
-
end
|
|
1221
|
-
|
|
1222
|
-
def create_instant_conversion()
|
|
1223
|
-
user = new_natural_user
|
|
1224
|
-
credited_wallet = MangoPay::Wallet.create(
|
|
1225
|
-
Owners: [user['Id']],
|
|
1226
|
-
Description: 'A test wallet',
|
|
1227
|
-
Currency: 'GBP',
|
|
1228
|
-
Tag: 'Test wallet'
|
|
1229
|
-
)
|
|
1230
|
-
|
|
1231
|
-
MangoPay::Conversion.create_instant_conversion(
|
|
1232
|
-
AuthorId: user['Id'],
|
|
1233
|
-
CreditedWalletId: credited_wallet['Id'],
|
|
1234
|
-
DebitedWalletId: new_wallet_with_money['Id'],
|
|
1235
|
-
CreditedFunds: {
|
|
1236
|
-
Currency: 'GBP'
|
|
1237
|
-
},
|
|
1238
|
-
DebitedFunds: {
|
|
1239
|
-
Currency: 'EUR',
|
|
1240
|
-
Amount: 79
|
|
1241
|
-
},
|
|
1242
|
-
Fees: {
|
|
1243
|
-
Currency: 'EUR',
|
|
1244
|
-
Amount: 10,
|
|
1245
|
-
Type: 'PERCENTAGE'
|
|
1246
|
-
},
|
|
1247
|
-
Tag: 'Instant conversion test'
|
|
1248
|
-
)
|
|
1249
|
-
end
|
|
1250
|
-
|
|
1251
|
-
def create_quoted_conversion()
|
|
1252
|
-
user = new_natural_user
|
|
1253
|
-
credited_wallet = MangoPay::Wallet.create(
|
|
1254
|
-
Owners: [user['Id']],
|
|
1255
|
-
Description: 'A test wallet',
|
|
1256
|
-
Currency: 'GBP',
|
|
1257
|
-
Tag: 'Test wallet'
|
|
1258
|
-
)
|
|
1259
|
-
quote = create_conversion_quote
|
|
1260
|
-
|
|
1261
|
-
MangoPay::Conversion.create_quoted_conversion(
|
|
1262
|
-
AuthorId: user['Id'],
|
|
1263
|
-
QuoteId: quote['Id'],
|
|
1264
|
-
CreditedWalletId: credited_wallet['Id'],
|
|
1265
|
-
DebitedWalletId: new_wallet_with_money['Id'],
|
|
1266
|
-
Tag: 'Quoted conversion test'
|
|
1267
|
-
)
|
|
1268
|
-
end
|
|
1269
|
-
|
|
1270
|
-
def create_conversion_quote
|
|
1271
|
-
MangoPay::Conversion.create_quote(
|
|
1272
|
-
CreditedFunds: { Currency: 'GBP' },
|
|
1273
|
-
DebitedFunds: { Currency: 'EUR', Amount: 50 },
|
|
1274
|
-
Duration: 300,
|
|
1275
|
-
Tag: 'Created using the Mangopay Ruby SDK'
|
|
1276
|
-
)
|
|
1277
|
-
end
|
|
1278
|
-
|
|
1279
|
-
def create_conversion_quote_with_fees
|
|
1280
|
-
MangoPay::Conversion.create_quote(
|
|
1281
|
-
CreditedFunds: { Currency: 'GBP' },
|
|
1282
|
-
DebitedFunds: { Currency: 'EUR', Amount: 50 },
|
|
1283
|
-
Duration: 300,
|
|
1284
|
-
Tag: 'Created using the Mangopay Ruby SDK',
|
|
1285
|
-
Fees: {
|
|
1286
|
-
Currency: 'EUR',
|
|
1287
|
-
Amount: 1,
|
|
1288
|
-
Type: 'FIXED'
|
|
1289
|
-
},
|
|
1290
|
-
UserMargin: {
|
|
1291
|
-
Type: "PERCENTAGE",
|
|
1292
|
-
Value: 0.01
|
|
1293
|
-
}
|
|
1294
|
-
)
|
|
1295
|
-
end
|
|
1296
|
-
|
|
1297
|
-
def get_conversion(id)
|
|
1298
|
-
MangoPay::Conversion.get(id, params = {})
|
|
1299
|
-
end
|
|
1300
|
-
|
|
1301
|
-
def get_conversion_quote(id)
|
|
1302
|
-
MangoPay::Conversion.get_quote(id, params = {})
|
|
1303
|
-
end
|
|
1304
|
-
end
|
|
1305
|
-
|
|
1306
|
-
###############################################
|
|
1307
|
-
# payment methods metadata
|
|
1308
|
-
###############################################
|
|
1309
|
-
shared_context 'payment_method_metadata' do
|
|
1310
|
-
include_context 'payins'
|
|
1311
|
-
|
|
1312
|
-
def get_payment_method_metadata
|
|
1313
|
-
|
|
1314
|
-
wlt = new_wallet
|
|
1315
|
-
pay_in = create_new_payin_card_direct(wlt, 1000)
|
|
1316
|
-
|
|
1317
|
-
MangoPay::PaymentMethodMetadata.get_metadata(
|
|
1318
|
-
Type: 'BIN',
|
|
1319
|
-
Bin: pay_in['CardInfo']['BIN']
|
|
1320
|
-
)
|
|
1321
|
-
end
|
|
1322
|
-
end
|
|
1323
|
-
|
|
1324
|
-
###############################################
|
|
1325
|
-
shared_context 'virtual_account' do
|
|
1326
|
-
###############################################
|
|
1327
|
-
include_context 'users'
|
|
1328
|
-
include_context 'wallets'
|
|
1329
|
-
|
|
1330
|
-
def new_virtual_account(wallet_id)
|
|
1331
|
-
create_virtual_account = {
|
|
1332
|
-
Country: 'FR',
|
|
1333
|
-
VirtualAccountPurpose: 'Collection',
|
|
1334
|
-
Tag: 'create virtual account tag'
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
MangoPay::VirtualAccount.create(wallet_id, create_virtual_account)
|
|
1338
|
-
end
|
|
1339
|
-
end
|
|
1340
|
-
|
|
1341
|
-
shared_context 'recipient' do
|
|
1342
|
-
include_context 'users'
|
|
1343
|
-
|
|
1344
|
-
let(:new_recipient) { create_new_recipient(create_new_natural_user_sca_owner['Id']) }
|
|
1345
|
-
|
|
1346
|
-
def create_new_recipient(user_id)
|
|
1347
|
-
MangoPay::Recipient.create(define_new_recipient, user_id)
|
|
1348
|
-
end
|
|
1349
|
-
|
|
1350
|
-
def define_new_recipient
|
|
1351
|
-
{
|
|
1352
|
-
"DisplayName": "Alex Smith GBP account",
|
|
1353
|
-
"PayoutMethodType": "LocalBankTransfer",
|
|
1354
|
-
"RecipientType": "Individual",
|
|
1355
|
-
"Currency": "GBP",
|
|
1356
|
-
"Country": "GB",
|
|
1357
|
-
"IndividualRecipient": {
|
|
1358
|
-
"FirstName": "Alex",
|
|
1359
|
-
"LastName": "Smith",
|
|
1360
|
-
"Address": {
|
|
1361
|
-
"AddressLine1": "10 Kingsway",
|
|
1362
|
-
"City": "London",
|
|
1363
|
-
"PostalCode": "WC2B 6LH",
|
|
1364
|
-
"Country": "GB"
|
|
1365
|
-
}
|
|
1366
|
-
},
|
|
1367
|
-
"LocalBankTransfer": {
|
|
1368
|
-
"GBP": {
|
|
1369
|
-
"SortCode": "200000",
|
|
1370
|
-
"AccountNumber": "55779911"
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
end
|
|
1375
|
-
end
|
|
1376
|
-
|
|
1377
|
-
shared_context 'intents' do
|
|
1378
|
-
include_context 'users'
|
|
1379
|
-
|
|
1380
|
-
let(:new_payin_intent_authorization) { create_new_payin_intent_authorization(create_new_natural_user_sca_payer) }
|
|
1381
|
-
|
|
1382
|
-
def create_new_payin_intent_authorization(user)
|
|
1383
|
-
MangoPay::PayIn::PayInIntent::Authorization.create(define_new_payin_intent_authorization(user))
|
|
1384
|
-
end
|
|
1385
|
-
|
|
1386
|
-
def define_new_payin_intent_authorization(user)
|
|
1387
|
-
wallet = create_new_wallet(user)
|
|
1388
|
-
{
|
|
1389
|
-
"Amount": 1000,
|
|
1390
|
-
"Currency": "EUR",
|
|
1391
|
-
"ExternalData": {
|
|
1392
|
-
"ExternalProcessingDate": 1728133765,
|
|
1393
|
-
"ExternalProviderReference": SecureRandom.uuid,
|
|
1394
|
-
"ExternalMerchantReference": "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
|
|
1395
|
-
"ExternalProviderName": "Stripe",
|
|
1396
|
-
"ExternalProviderPaymentMethod": "PAYPAL"
|
|
1397
|
-
},
|
|
1398
|
-
"Buyer": {
|
|
1399
|
-
"Id": user['Id']
|
|
1400
|
-
},
|
|
1401
|
-
"LineItems": [
|
|
1402
|
-
{
|
|
1403
|
-
"Seller": {
|
|
1404
|
-
"AuthorId": user['Id'],
|
|
1405
|
-
"WalletId": wallet['Id'],
|
|
1406
|
-
"TransferDate": 1728133765
|
|
1407
|
-
},
|
|
1408
|
-
"Sku": "item-123456",
|
|
1409
|
-
"Quantity": 1,
|
|
1410
|
-
"UnitAmount": 1000,
|
|
1411
|
-
}
|
|
1412
|
-
]
|
|
1413
|
-
}
|
|
1414
|
-
end
|
|
1415
|
-
end
|