mangopay 3.25.1 → 3.32.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 +98 -0
- data/lib/mangopay/conversion.rb +6 -6
- data/lib/mangopay/identity_verification.rb +16 -0
- data/lib/mangopay/legal_user.rb +3 -0
- data/lib/mangopay/legal_user_sca.rb +25 -0
- data/lib/mangopay/natural_user.rb +6 -0
- data/lib/mangopay/natural_user_sca.rb +25 -0
- data/lib/mangopay/pay_in.rb +57 -1
- data/lib/mangopay/recipient.rb +35 -0
- data/lib/mangopay/user.rb +13 -0
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay/virtual_account.rb +44 -0
- data/lib/mangopay.rb +7 -2
- data/spec/mangopay/client_spec.rb +3 -2
- data/spec/mangopay/identity_verification_spec.rb +52 -0
- data/spec/mangopay/kyc_document_spec.rb +4 -4
- data/spec/mangopay/payin_bancontact_web_spec.rb +30 -0
- data/spec/mangopay/payin_bankwire_external_instruction_spec.rb +3 -3
- data/spec/mangopay/payin_card_web_spec.rb +1 -1
- data/spec/mangopay/payin_paybybank_web_spec.rb +30 -0
- data/spec/mangopay/payin_paypal_web_spec.rb +1 -0
- data/spec/mangopay/payin_preauthorized_direct_spec.rb +1 -0
- data/spec/mangopay/payin_swish_web_spec.rb +30 -0
- data/spec/mangopay/payin_twint_web_spec.rb +30 -0
- data/spec/mangopay/payout_bankwire_spec.rb +7 -5
- data/spec/mangopay/recipient_spec.rb +113 -0
- data/spec/mangopay/recurring_payin_spec.rb +140 -0
- data/spec/mangopay/shared_resources.rb +260 -2
- data/spec/mangopay/user_spec.rb +150 -0
- data/spec/mangopay/virtual_account_spec.rb +52 -0
- metadata +24 -5
@@ -3,6 +3,10 @@ shared_context 'users' do
|
|
3
3
|
###############################################
|
4
4
|
|
5
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 }
|
6
10
|
|
7
11
|
def define_new_natural_user
|
8
12
|
{
|
@@ -27,10 +31,138 @@ shared_context 'users' do
|
|
27
31
|
}
|
28
32
|
end
|
29
33
|
|
34
|
+
def define_new_natural_user_sca_payer
|
35
|
+
{
|
36
|
+
"UserCategory": "PAYER",
|
37
|
+
"TermsAndConditionsAccepted": false,
|
38
|
+
"FirstName": "Alex",
|
39
|
+
"LastName": "Smith",
|
40
|
+
"Email": "alex.smith@example.com",
|
41
|
+
"Address": {
|
42
|
+
"AddressLine1": "3 rue de la Cité",
|
43
|
+
"AddressLine2": "Appartement 7",
|
44
|
+
"City": "Paris",
|
45
|
+
"Region": "Île-de-France",
|
46
|
+
"PostalCode": "75004",
|
47
|
+
"Country": "FR"
|
48
|
+
},
|
49
|
+
"Tag": "Created using the Mangopay API Postman collection",
|
50
|
+
"PhoneNumber": "0611111111",
|
51
|
+
"PhoneNumberCountry": "FR"
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
def define_new_natural_user_sca_owner
|
56
|
+
{
|
57
|
+
"UserCategory": "OWNER",
|
58
|
+
"TermsAndConditionsAccepted": true,
|
59
|
+
"FirstName": "Alex",
|
60
|
+
"LastName": "Smith",
|
61
|
+
"Email": "alex.smith@example.com",
|
62
|
+
"Address": {
|
63
|
+
"AddressLine1": "3 rue de la Cité",
|
64
|
+
"AddressLine2": "Appartement 7",
|
65
|
+
"City": "Paris",
|
66
|
+
"Region": "Île-de-France",
|
67
|
+
"PostalCode": "75004",
|
68
|
+
"Country": "FR"
|
69
|
+
},
|
70
|
+
"Birthday": 652117514,
|
71
|
+
"CountryOfResidence": "FR",
|
72
|
+
"Nationality": "FR",
|
73
|
+
"Tag": "Created using the Mangopay API Postman collection",
|
74
|
+
"PhoneNumber": "0611111111",
|
75
|
+
"PhoneNumberCountry": "FR"
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
def define_new_legal_user_sca_payer
|
80
|
+
{
|
81
|
+
"UserCategory": "PAYER",
|
82
|
+
"TermsAndConditionsAccepted": false,
|
83
|
+
"LegalPersonType": "SOLETRADER",
|
84
|
+
"Name": "Alex Smith",
|
85
|
+
"Email": "alex.smith.services@example.com",
|
86
|
+
"LegalRepresentative": {
|
87
|
+
"FirstName": "Alex",
|
88
|
+
"LastName": "Smith",
|
89
|
+
"Birthday": 652117514,
|
90
|
+
"Nationality": "FR",
|
91
|
+
"CountryOfResidence": "FR",
|
92
|
+
"Email": "alex.smith@example.com",
|
93
|
+
"PhoneNumber": "0611111111",
|
94
|
+
"PhoneNumberCountry": "FR"
|
95
|
+
},
|
96
|
+
"LegalRepresentativeAddress": {
|
97
|
+
"AddressLine1": "3 rue de la Cité",
|
98
|
+
"AddressLine2": "Appartement 7",
|
99
|
+
"City": "Paris",
|
100
|
+
"Region": "Île-de-France",
|
101
|
+
"PostalCode": "75004",
|
102
|
+
"Country": "FR"
|
103
|
+
},
|
104
|
+
"Tag": "Created using the Mangopay API Postman collection"
|
105
|
+
}
|
106
|
+
end
|
107
|
+
|
108
|
+
def define_new_legal_user_sca_owner
|
109
|
+
{
|
110
|
+
"UserCategory": "OWNER",
|
111
|
+
"TermsAndConditionsAccepted": true,
|
112
|
+
"LegalPersonType": "SOLETRADER",
|
113
|
+
"Name": "Alex Smith",
|
114
|
+
"Email": "alex.smith.services@example.com",
|
115
|
+
"LegalRepresentative": {
|
116
|
+
"FirstName": "Alex",
|
117
|
+
"LastName": "Smith",
|
118
|
+
"Birthday": 652117514,
|
119
|
+
"Nationality": "FR",
|
120
|
+
"CountryOfResidence": "FR",
|
121
|
+
"Email": "alex.smith@example.com",
|
122
|
+
"PhoneNumber": "0611111111",
|
123
|
+
"PhoneNumberCountry": "FR"
|
124
|
+
},
|
125
|
+
"CompanyNumber": "123456789",
|
126
|
+
"HeadquartersAddress": {
|
127
|
+
"AddressLine1": "3 rue de la Cité",
|
128
|
+
"AddressLine2": "Appartement 7",
|
129
|
+
"City": "Paris",
|
130
|
+
"Region": "Île-de-France",
|
131
|
+
"PostalCode": "75004",
|
132
|
+
"Country": "FR"
|
133
|
+
},
|
134
|
+
"LegalRepresentativeAddress": {
|
135
|
+
"AddressLine1": "3 rue de la Cité",
|
136
|
+
"AddressLine2": "Appartement 7",
|
137
|
+
"City": "Paris",
|
138
|
+
"Region": "Île-de-France",
|
139
|
+
"PostalCode": "75004",
|
140
|
+
"Country": "FR"
|
141
|
+
},
|
142
|
+
"Tag": "Created using the Mangopay API Postman collection"
|
143
|
+
}
|
144
|
+
end
|
145
|
+
|
30
146
|
def create_new_natural_user
|
31
147
|
MangoPay::NaturalUser.create(define_new_natural_user)
|
32
148
|
end
|
33
149
|
|
150
|
+
def create_new_natural_user_sca_payer
|
151
|
+
MangoPay::NaturalUserSca.create(define_new_natural_user_sca_payer)
|
152
|
+
end
|
153
|
+
|
154
|
+
def create_new_natural_user_sca_owner
|
155
|
+
MangoPay::NaturalUserSca.create(define_new_natural_user_sca_owner)
|
156
|
+
end
|
157
|
+
|
158
|
+
def create_new_legal_user_sca_payer
|
159
|
+
MangoPay::LegalUserSca.create(define_new_legal_user_sca_payer)
|
160
|
+
end
|
161
|
+
|
162
|
+
def create_new_legal_user_sca_owner
|
163
|
+
MangoPay::LegalUserSca.create(define_new_legal_user_sca_owner)
|
164
|
+
end
|
165
|
+
|
34
166
|
let(:new_legal_user) do
|
35
167
|
MangoPay::LegalUser.create(
|
36
168
|
Name: 'Super',
|
@@ -83,6 +215,15 @@ shared_context 'wallets' do
|
|
83
215
|
)
|
84
216
|
end
|
85
217
|
|
218
|
+
def create_new_custom_wallet(user, currency)
|
219
|
+
MangoPay::Wallet.create(
|
220
|
+
Owners: [user['Id']],
|
221
|
+
Description: 'A test wallet',
|
222
|
+
Currency: currency,
|
223
|
+
Tag: 'Test wallet'
|
224
|
+
)
|
225
|
+
end
|
226
|
+
|
86
227
|
def wallets_check_amounts(wlt1, amnt1, wlt2 = nil, amnt2 = nil)
|
87
228
|
expect(wlt1['Balance']['Amount']).to eq amnt1
|
88
229
|
expect(wlt2['Balance']['Amount']).to eq amnt2 if wlt2
|
@@ -380,7 +521,7 @@ shared_context 'payins' do
|
|
380
521
|
data: cardreg['PreregistrationData'],
|
381
522
|
accessKeyRef: cardreg['AccessKey'],
|
382
523
|
cardNumber: 4970107111111119,
|
383
|
-
cardExpirationDate:
|
524
|
+
cardExpirationDate: 1229,
|
384
525
|
cardCvx: 123 }
|
385
526
|
|
386
527
|
res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
|
@@ -554,6 +695,52 @@ shared_context 'payins' do
|
|
554
695
|
)
|
555
696
|
end
|
556
697
|
|
698
|
+
###############################################
|
699
|
+
# Bancontact/web
|
700
|
+
###############################################
|
701
|
+
let(:new_payin_bancontact_web) do
|
702
|
+
MangoPay::PayIn::Bancontact::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/Bancontact/Web',
|
710
|
+
Culture: 'FR'
|
711
|
+
)
|
712
|
+
end
|
713
|
+
|
714
|
+
###############################################
|
715
|
+
# Twint/web
|
716
|
+
###############################################
|
717
|
+
let(:new_payin_twint_web) do
|
718
|
+
MangoPay::PayIn::Twint::Web.create(
|
719
|
+
AuthorId: new_natural_user['Id'],
|
720
|
+
CreditedWalletId: create_new_custom_wallet(new_natural_user, 'CHF')['Id'],
|
721
|
+
DebitedFunds: { Currency: 'CHF', Amount: 50 },
|
722
|
+
Fees: { Currency: 'CHF', Amount: 10 },
|
723
|
+
ReturnURL: 'http://www.my-site.com/returnURL',
|
724
|
+
StatementDescriptor: "test",
|
725
|
+
Tag: 'Test PayIn/Twint/Web'
|
726
|
+
)
|
727
|
+
end
|
728
|
+
|
729
|
+
###############################################
|
730
|
+
# Swish/web
|
731
|
+
###############################################
|
732
|
+
let(:new_payin_swish_web) do
|
733
|
+
MangoPay::PayIn::Swish::Web.create(
|
734
|
+
AuthorId: new_natural_user['Id'],
|
735
|
+
CreditedWalletId: create_new_custom_wallet(new_natural_user, 'SEK')['Id'],
|
736
|
+
DebitedFunds: { Currency: 'SEK', Amount: 400 },
|
737
|
+
Fees: { Currency: 'SEK', Amount: 10 },
|
738
|
+
ReturnURL: 'http://www.my-site.com/returnURL',
|
739
|
+
StatementDescriptor: "test",
|
740
|
+
Tag: 'Test PayIn/Swish/Web'
|
741
|
+
)
|
742
|
+
end
|
743
|
+
|
557
744
|
###############################################
|
558
745
|
# PAYPAL/web V2
|
559
746
|
###############################################
|
@@ -755,6 +942,25 @@ shared_context 'payins' do
|
|
755
942
|
MangoPay::Wallet.fetch(pay_in['CreditedWalletId'])
|
756
943
|
end
|
757
944
|
|
945
|
+
let(:new_payin_paybybank_web) do
|
946
|
+
MangoPay::PayIn::PayByBank::Web.create(
|
947
|
+
AuthorId: new_natural_user['Id'],
|
948
|
+
CreditedWalletId: create_new_custom_wallet(new_natural_user, 'EUR')['Id'],
|
949
|
+
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
950
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
951
|
+
ReturnURL: 'http://www.my-site.com/returnURL',
|
952
|
+
StatementDescriptor: "test",
|
953
|
+
Tag: 'Test PayIn/PayByBank/Web',
|
954
|
+
Country: 'DE',
|
955
|
+
IBAN: 'DE03500105177564668331',
|
956
|
+
BIC: 'AACSDE33',
|
957
|
+
Scheme: 'SEPA_INSTANT_CREDIT_TRANSFER',
|
958
|
+
BankName: 'de-demobank-open-banking-embedded-templates',
|
959
|
+
Culture: 'EN',
|
960
|
+
PaymentFlow: 'WEB'
|
961
|
+
)
|
962
|
+
end
|
963
|
+
|
758
964
|
end
|
759
965
|
|
760
966
|
###############################################
|
@@ -952,7 +1158,7 @@ shared_context 'instant_conversion' do
|
|
952
1158
|
MangoPay::Conversion.create_quote(
|
953
1159
|
CreditedFunds: { Currency: 'GBP' },
|
954
1160
|
DebitedFunds: { Currency: 'EUR', Amount: 50 },
|
955
|
-
Duration:
|
1161
|
+
Duration: 300,
|
956
1162
|
Tag: 'Created using the Mangopay Ruby SDK'
|
957
1163
|
)
|
958
1164
|
end
|
@@ -982,4 +1188,56 @@ shared_context 'payment_method_metadata' do
|
|
982
1188
|
Bin: pay_in['CardInfo']['BIN']
|
983
1189
|
)
|
984
1190
|
end
|
1191
|
+
end
|
1192
|
+
|
1193
|
+
###############################################
|
1194
|
+
shared_context 'virtual_account' do
|
1195
|
+
###############################################
|
1196
|
+
include_context 'users'
|
1197
|
+
include_context 'wallets'
|
1198
|
+
|
1199
|
+
def new_virtual_account(wallet_id)
|
1200
|
+
create_virtual_account = {
|
1201
|
+
Country: 'FR',
|
1202
|
+
VirtualAccountPurpose: 'Collection',
|
1203
|
+
Tag: 'create virtual account tag'
|
1204
|
+
}
|
1205
|
+
|
1206
|
+
MangoPay::VirtualAccount.create(wallet_id, create_virtual_account)
|
1207
|
+
end
|
1208
|
+
end
|
1209
|
+
|
1210
|
+
shared_context 'recipient' do
|
1211
|
+
include_context 'users'
|
1212
|
+
|
1213
|
+
let(:new_recipient) { create_new_recipient(create_new_natural_user_sca_owner['Id']) }
|
1214
|
+
|
1215
|
+
def create_new_recipient(user_id)
|
1216
|
+
MangoPay::Recipient.create(define_new_recipient, user_id)
|
1217
|
+
end
|
1218
|
+
|
1219
|
+
def define_new_recipient
|
1220
|
+
{
|
1221
|
+
"DisplayName": "Alex Smith GBP account",
|
1222
|
+
"PayoutMethodType": "LocalBankTransfer",
|
1223
|
+
"RecipientType": "Individual",
|
1224
|
+
"Currency": "GBP",
|
1225
|
+
"IndividualRecipient": {
|
1226
|
+
"FirstName": "Alex",
|
1227
|
+
"LastName": "Smith",
|
1228
|
+
"Address": {
|
1229
|
+
"AddressLine1": "10 Kingsway",
|
1230
|
+
"City": "London",
|
1231
|
+
"PostalCode": "WC2B 6LH",
|
1232
|
+
"Country": "GB"
|
1233
|
+
}
|
1234
|
+
},
|
1235
|
+
"LocalBankTransfer": {
|
1236
|
+
"GBP": {
|
1237
|
+
"SortCode": "200000",
|
1238
|
+
"AccountNumber": "55779911"
|
1239
|
+
}
|
1240
|
+
}
|
1241
|
+
}
|
1242
|
+
end
|
985
1243
|
end
|
data/spec/mangopay/user_spec.rb
CHANGED
@@ -19,6 +19,38 @@ describe MangoPay::User do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
describe 'CREATE SCA' do
|
23
|
+
it 'creates a new SCA natural user payer' do
|
24
|
+
user = new_natural_user_sca_payer
|
25
|
+
expect(user["FirstName"]).to eq('Alex')
|
26
|
+
expect(user["UserCategory"]).to eq('PAYER')
|
27
|
+
expect(user["UserStatus"]).to eq('ACTIVE')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'creates a new SCA natural user owner' do
|
31
|
+
user = new_natural_user_sca_owner
|
32
|
+
expect(user["FirstName"]).to eq('Alex')
|
33
|
+
expect(user["UserCategory"]).to eq('OWNER')
|
34
|
+
expect(user["UserStatus"]).to eq('PENDING_USER_ACTION')
|
35
|
+
expect(user["PendingUserAction"]["RedirectUrl"]).not_to be_nil
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'creates a new SCA legal user payer' do
|
39
|
+
user = new_legal_user_sca_payer
|
40
|
+
expect(user["Name"]).to eq('Alex Smith')
|
41
|
+
expect(user["UserCategory"]).to eq('PAYER')
|
42
|
+
expect(user["UserStatus"]).to eq('ACTIVE')
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'creates a new SCA legal user owner' do
|
46
|
+
user = new_legal_user_sca_owner
|
47
|
+
expect(user["Name"]).to eq('Alex Smith')
|
48
|
+
expect(user["UserCategory"]).to eq('OWNER')
|
49
|
+
expect(user["UserStatus"]).to eq('PENDING_USER_ACTION')
|
50
|
+
expect(user["PendingUserAction"]["RedirectUrl"]).not_to be_nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
22
54
|
describe 'UPDATE' do
|
23
55
|
it 'updates a natural user' do
|
24
56
|
updated_user = MangoPay::NaturalUser.update(new_natural_user['Id'] ,{
|
@@ -49,6 +81,82 @@ describe MangoPay::User do
|
|
49
81
|
end
|
50
82
|
end
|
51
83
|
|
84
|
+
describe 'UPDATE SCA' do
|
85
|
+
it 'updates a SCA natural user' do
|
86
|
+
user = new_natural_user_sca_owner
|
87
|
+
updated_user = MangoPay::NaturalUserSca.update(user['Id'] ,{
|
88
|
+
FirstName: 'Jack'
|
89
|
+
})
|
90
|
+
fetched = MangoPay::NaturalUserSca.fetch(user['Id'])
|
91
|
+
expect(updated_user['FirstName']).to eq('Jack')
|
92
|
+
expect(updated_user['FirstName']).to eq(fetched['FirstName'])
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'updates a SCA legal user' do
|
96
|
+
user = new_legal_user_sca_owner
|
97
|
+
legal_representative = user['LegalRepresentative']
|
98
|
+
legal_representative['FirstName'] = 'Jack'
|
99
|
+
updated_user = MangoPay::LegalUserSca.update(user['Id'] ,{
|
100
|
+
LegalRepresentative: legal_representative
|
101
|
+
})
|
102
|
+
fetched = MangoPay::LegalUserSca.fetch(user['Id'])
|
103
|
+
expect(updated_user['LegalRepresentative']['FirstName']).to eq('Jack')
|
104
|
+
expect(updated_user['LegalRepresentative']['FirstName']).to eq(fetched['LegalRepresentative']['FirstName'])
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe 'CATEGORIZE SCA' do
|
109
|
+
it 'transitions SCA natural user Payer to Owner' do
|
110
|
+
user = new_natural_user_sca_payer
|
111
|
+
categorized = MangoPay::NaturalUserSca.categorize(user['Id'] ,{
|
112
|
+
"UserCategory": "OWNER",
|
113
|
+
"TermsAndConditionsAccepted": true,
|
114
|
+
"Birthday": 652117514,
|
115
|
+
"Nationality": "FR",
|
116
|
+
"CountryOfResidence": "FR"
|
117
|
+
})
|
118
|
+
fetched = MangoPay::NaturalUserSca.fetch(user['Id'])
|
119
|
+
expect(user['UserCategory']).to eq('PAYER')
|
120
|
+
expect(categorized['UserCategory']).to eq('OWNER')
|
121
|
+
expect(fetched['UserCategory']).to eq('OWNER')
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'transitions SCA legal user Payer to Owner' do
|
125
|
+
user = new_legal_user_sca_payer
|
126
|
+
categorized = MangoPay::LegalUserSca.categorize(user['Id'] ,{
|
127
|
+
"UserCategory": "OWNER",
|
128
|
+
"TermsAndConditionsAccepted": true,
|
129
|
+
"LegalRepresentative": {
|
130
|
+
"Birthday": 652117514,
|
131
|
+
"Nationality": "FR",
|
132
|
+
"CountryOfResidence": "FR",
|
133
|
+
"Email": "alex.smith@example.com"
|
134
|
+
},
|
135
|
+
"HeadquartersAddress": {
|
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
|
+
"CompanyNumber": "123456789"
|
144
|
+
})
|
145
|
+
fetched = MangoPay::LegalUserSca.fetch(user['Id'])
|
146
|
+
expect(user['UserCategory']).to eq('PAYER')
|
147
|
+
expect(categorized['UserCategory']).to eq('OWNER')
|
148
|
+
expect(fetched['UserCategory']).to eq('OWNER')
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe 'ENROLL SCA' do
|
153
|
+
it 'enrolls user' do
|
154
|
+
user = new_natural_user
|
155
|
+
enrollment_result = MangoPay::User.enroll_sca(user['Id'])
|
156
|
+
expect(enrollment_result["PendingUserAction"]["RedirectUrl"]).not_to be_nil
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
52
160
|
describe 'FETCH' do
|
53
161
|
it 'fetches all the users' do
|
54
162
|
users = MangoPay::User.fetch()
|
@@ -77,6 +185,32 @@ describe MangoPay::User do
|
|
77
185
|
end
|
78
186
|
end
|
79
187
|
|
188
|
+
describe 'FETCH SCA' do
|
189
|
+
it 'fetches a SCA legal user using the User module' do
|
190
|
+
user = new_legal_user_sca_owner
|
191
|
+
fetched = MangoPay::User.fetch_sca(new_legal_user_sca_owner['Id'])
|
192
|
+
expect(fetched['Id']).to eq(user['Id'])
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'fetches a SCA natural user using the User module' do
|
196
|
+
user = new_natural_user_sca_owner
|
197
|
+
fetched = MangoPay::User.fetch_sca(user['Id'])
|
198
|
+
expect(fetched['Id']).to eq(user['Id'])
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'fetches a SCA legal user' do
|
202
|
+
user = new_legal_user_sca_owner
|
203
|
+
fetched = MangoPay::LegalUserSca.fetch(user['Id'])
|
204
|
+
expect(fetched['Id']).to eq(user['Id'])
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'fetches a SCA natural user' do
|
208
|
+
user = new_natural_user_sca_owner
|
209
|
+
fetched = MangoPay::NaturalUserSca.fetch(user['Id'])
|
210
|
+
expect(fetched['Id']).to eq(user['Id'])
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
80
214
|
describe 'FETCH TRANSACTIONS' do
|
81
215
|
it 'fetches empty list of transactions if no transactions done' do
|
82
216
|
transactions = MangoPay::User.transactions(new_natural_user['Id'])
|
@@ -233,4 +367,20 @@ describe MangoPay::User do
|
|
233
367
|
end
|
234
368
|
end
|
235
369
|
=end
|
370
|
+
|
371
|
+
describe 'CLOSE' do
|
372
|
+
it 'closes a natural user' do
|
373
|
+
new_user = create_new_natural_user
|
374
|
+
MangoPay::NaturalUser.close(new_user['Id'])
|
375
|
+
closed = MangoPay::User.fetch(new_user['Id'])
|
376
|
+
expect(closed['UserStatus']).to eq('CLOSED')
|
377
|
+
end
|
378
|
+
|
379
|
+
it 'closes a legal user' do
|
380
|
+
new_user = new_legal_user
|
381
|
+
MangoPay::LegalUser.close(new_user['Id'])
|
382
|
+
closed = MangoPay::User.fetch(new_user['Id'])
|
383
|
+
expect(closed['UserStatus']).to eq('CLOSED')
|
384
|
+
end
|
385
|
+
end
|
236
386
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
describe MangoPay::VirtualAccount do
|
2
|
+
include_context 'virtual_account'
|
3
|
+
include_context 'wallets'
|
4
|
+
|
5
|
+
describe 'CREATE' do
|
6
|
+
it 'can create a Virtual Account' do
|
7
|
+
wallet = new_wallet
|
8
|
+
virtual_account = new_virtual_account(wallet['Id'])
|
9
|
+
expect(virtual_account).not_to be_nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'DEACTIVATE' do
|
14
|
+
it 'deactivates a Virtual Account' do
|
15
|
+
wallet = new_wallet
|
16
|
+
virtual_account = new_virtual_account(wallet['Id'])
|
17
|
+
deactivated = MangoPay::VirtualAccount.deactivate(wallet['Id'], virtual_account['Id'])
|
18
|
+
expect(deactivated).not_to be_nil
|
19
|
+
expect(deactivated['Status']).to eq 'CLOSED'
|
20
|
+
expect(deactivated['Id']).to eq(virtual_account['Id'])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'FETCH' do
|
25
|
+
it 'can get a Virtual Account' do
|
26
|
+
wallet = new_wallet
|
27
|
+
virtual_account = new_virtual_account(wallet['Id'])
|
28
|
+
fetched = MangoPay::VirtualAccount.fetch(wallet['Id'], virtual_account['Id'])
|
29
|
+
expect(fetched).not_to be_nil
|
30
|
+
expect(fetched['Id']).to eq(virtual_account['Id'])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'FETCH ALL' do
|
35
|
+
it 'can get all Virtual Accounts for a wallet' do
|
36
|
+
wallet = new_wallet
|
37
|
+
virtual_account = new_virtual_account(wallet['Id'])
|
38
|
+
fetched_list = MangoPay::VirtualAccount.fetch_all(wallet['Id'])
|
39
|
+
expect(fetched_list).not_to be_nil
|
40
|
+
expect(fetched_list[0]['Id']).to eq(virtual_account['Id'])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'FETCH AVAILABILITIES' do
|
45
|
+
it 'get availabilities' do
|
46
|
+
availabilities = MangoPay::VirtualAccount.fetch_availabilities
|
47
|
+
expect(availabilities).not_to be_nil
|
48
|
+
expect(availabilities['Collection']).not_to be_nil
|
49
|
+
expect(availabilities['UserOwned']).not_to be_nil
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mangopay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffroy Lorieux
|
8
8
|
- Sergiusz Woznicki
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-04-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -90,15 +90,19 @@ files:
|
|
90
90
|
- lib/mangopay/filter_parameters.rb
|
91
91
|
- lib/mangopay/hook.rb
|
92
92
|
- lib/mangopay/http_calls.rb
|
93
|
+
- lib/mangopay/identity_verification.rb
|
93
94
|
- lib/mangopay/json.rb
|
94
95
|
- lib/mangopay/kyc_document.rb
|
95
96
|
- lib/mangopay/legal_user.rb
|
97
|
+
- lib/mangopay/legal_user_sca.rb
|
96
98
|
- lib/mangopay/mandate.rb
|
97
99
|
- lib/mangopay/natural_user.rb
|
100
|
+
- lib/mangopay/natural_user_sca.rb
|
98
101
|
- lib/mangopay/pay_in.rb
|
99
102
|
- lib/mangopay/pay_out.rb
|
100
103
|
- lib/mangopay/payment_method_metadata.rb
|
101
104
|
- lib/mangopay/pre_authorization.rb
|
105
|
+
- lib/mangopay/recipient.rb
|
102
106
|
- lib/mangopay/refund.rb
|
103
107
|
- lib/mangopay/regulatory.rb
|
104
108
|
- lib/mangopay/report.rb
|
@@ -109,6 +113,7 @@ files:
|
|
109
113
|
- lib/mangopay/ubo_declaration.rb
|
110
114
|
- lib/mangopay/user.rb
|
111
115
|
- lib/mangopay/version.rb
|
116
|
+
- lib/mangopay/virtual_account.rb
|
112
117
|
- lib/mangopay/wallet.rb
|
113
118
|
- mangopay.gemspec
|
114
119
|
- spec/mangopay/authorization_token_spec.rb
|
@@ -126,11 +131,13 @@ files:
|
|
126
131
|
- spec/mangopay/fetch_filters_spec.rb
|
127
132
|
- spec/mangopay/hook_spec.rb
|
128
133
|
- spec/mangopay/idempotency_spec.rb
|
134
|
+
- spec/mangopay/identity_verification_spec.rb
|
129
135
|
- spec/mangopay/kyc_document_spec.png
|
130
136
|
- spec/mangopay/kyc_document_spec.rb
|
131
137
|
- spec/mangopay/log_requests_filter_spec.rb
|
132
138
|
- spec/mangopay/mandate_spec.rb
|
133
139
|
- spec/mangopay/payin_applepay_direct_spec.rb
|
140
|
+
- spec/mangopay/payin_bancontact_web_spec.rb
|
134
141
|
- spec/mangopay/payin_bankwire_direct_spec.rb
|
135
142
|
- spec/mangopay/payin_bankwire_external_instruction_spec.rb
|
136
143
|
- spec/mangopay/payin_blik_web_spec.rb
|
@@ -144,13 +151,17 @@ files:
|
|
144
151
|
- spec/mangopay/payin_klarna_web_spec.rb
|
145
152
|
- spec/mangopay/payin_mbway_web_spec.rb
|
146
153
|
- spec/mangopay/payin_multibanco_web_spec.rb
|
154
|
+
- spec/mangopay/payin_paybybank_web_spec.rb
|
147
155
|
- spec/mangopay/payin_payconiq_web_spec.rb
|
148
156
|
- spec/mangopay/payin_paypal_web_spec.rb
|
149
157
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
150
158
|
- spec/mangopay/payin_satispay_web_spec.rb
|
159
|
+
- spec/mangopay/payin_swish_web_spec.rb
|
160
|
+
- spec/mangopay/payin_twint_web_spec.rb
|
151
161
|
- spec/mangopay/payment_method_metadata_spec.rb
|
152
162
|
- spec/mangopay/payout_bankwire_spec.rb
|
153
163
|
- spec/mangopay/preauthorization_spec.rb
|
164
|
+
- spec/mangopay/recipient_spec.rb
|
154
165
|
- spec/mangopay/recurring_payin_spec.rb
|
155
166
|
- spec/mangopay/refund_spec.rb
|
156
167
|
- spec/mangopay/regulatory_spec.rb
|
@@ -162,6 +173,7 @@ files:
|
|
162
173
|
- spec/mangopay/ubo_declaration_spec.rb
|
163
174
|
- spec/mangopay/ubo_spec.rb
|
164
175
|
- spec/mangopay/user_spec.rb
|
176
|
+
- spec/mangopay/virtual_account_spec.rb
|
165
177
|
- spec/mangopay/wallet_spec.rb
|
166
178
|
- spec/spec_helper.rb
|
167
179
|
- spec/tmp/.keep
|
@@ -169,7 +181,7 @@ homepage: http://docs.mangopay.com/
|
|
169
181
|
licenses:
|
170
182
|
- MIT
|
171
183
|
metadata: {}
|
172
|
-
post_install_message:
|
184
|
+
post_install_message:
|
173
185
|
rdoc_options: []
|
174
186
|
require_paths:
|
175
187
|
- lib
|
@@ -185,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
197
|
version: '0'
|
186
198
|
requirements: []
|
187
199
|
rubygems_version: 3.0.3.1
|
188
|
-
signing_key:
|
200
|
+
signing_key:
|
189
201
|
specification_version: 4
|
190
202
|
summary: Ruby bindings for the version 2 of the MANGOPAY API
|
191
203
|
test_files:
|
@@ -204,11 +216,13 @@ test_files:
|
|
204
216
|
- spec/mangopay/fetch_filters_spec.rb
|
205
217
|
- spec/mangopay/hook_spec.rb
|
206
218
|
- spec/mangopay/idempotency_spec.rb
|
219
|
+
- spec/mangopay/identity_verification_spec.rb
|
207
220
|
- spec/mangopay/kyc_document_spec.png
|
208
221
|
- spec/mangopay/kyc_document_spec.rb
|
209
222
|
- spec/mangopay/log_requests_filter_spec.rb
|
210
223
|
- spec/mangopay/mandate_spec.rb
|
211
224
|
- spec/mangopay/payin_applepay_direct_spec.rb
|
225
|
+
- spec/mangopay/payin_bancontact_web_spec.rb
|
212
226
|
- spec/mangopay/payin_bankwire_direct_spec.rb
|
213
227
|
- spec/mangopay/payin_bankwire_external_instruction_spec.rb
|
214
228
|
- spec/mangopay/payin_blik_web_spec.rb
|
@@ -222,13 +236,17 @@ test_files:
|
|
222
236
|
- spec/mangopay/payin_klarna_web_spec.rb
|
223
237
|
- spec/mangopay/payin_mbway_web_spec.rb
|
224
238
|
- spec/mangopay/payin_multibanco_web_spec.rb
|
239
|
+
- spec/mangopay/payin_paybybank_web_spec.rb
|
225
240
|
- spec/mangopay/payin_payconiq_web_spec.rb
|
226
241
|
- spec/mangopay/payin_paypal_web_spec.rb
|
227
242
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
228
243
|
- spec/mangopay/payin_satispay_web_spec.rb
|
244
|
+
- spec/mangopay/payin_swish_web_spec.rb
|
245
|
+
- spec/mangopay/payin_twint_web_spec.rb
|
229
246
|
- spec/mangopay/payment_method_metadata_spec.rb
|
230
247
|
- spec/mangopay/payout_bankwire_spec.rb
|
231
248
|
- spec/mangopay/preauthorization_spec.rb
|
249
|
+
- spec/mangopay/recipient_spec.rb
|
232
250
|
- spec/mangopay/recurring_payin_spec.rb
|
233
251
|
- spec/mangopay/refund_spec.rb
|
234
252
|
- spec/mangopay/regulatory_spec.rb
|
@@ -240,6 +258,7 @@ test_files:
|
|
240
258
|
- spec/mangopay/ubo_declaration_spec.rb
|
241
259
|
- spec/mangopay/ubo_spec.rb
|
242
260
|
- spec/mangopay/user_spec.rb
|
261
|
+
- spec/mangopay/virtual_account_spec.rb
|
243
262
|
- spec/mangopay/wallet_spec.rb
|
244
263
|
- spec/spec_helper.rb
|
245
264
|
- spec/tmp/.keep
|