mangopay 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +24 -0
- data/.rspec +2 -0
- data/Gemfile +1 -2
- data/LICENSE +20 -0
- data/README.md +19 -90
- data/bin/mangopay +9 -0
- data/lib/generators/mangopay/install_generator.rb +60 -0
- data/lib/generators/templates/mangopay.rb +5 -0
- data/lib/mangopay.rb +94 -24
- data/lib/mangopay/bank_account.rb +21 -0
- data/lib/mangopay/client.rb +17 -0
- data/lib/mangopay/errors.rb +4 -0
- data/lib/mangopay/http_calls.rb +53 -0
- data/lib/mangopay/json.rb +21 -0
- data/lib/mangopay/legal_user.rb +14 -0
- data/lib/mangopay/natural_user.rb +14 -0
- data/lib/mangopay/payin.rb +17 -0
- data/lib/mangopay/payout.rb +15 -0
- data/lib/mangopay/resource.rb +22 -0
- data/lib/mangopay/transaction.rb +11 -0
- data/lib/mangopay/transfer.rb +4 -55
- data/lib/mangopay/user.rb +4 -145
- data/lib/mangopay/version.rb +3 -0
- data/lib/mangopay/wallet.rb +4 -90
- data/mangopay.gemspec +33 -0
- data/spec/lib/mangopay/bank_account_spec.rb +26 -0
- data/spec/lib/mangopay/client_spec.rb +27 -0
- data/spec/lib/mangopay/payin_spec.rb +31 -0
- data/spec/lib/mangopay/payout_spec.rb +24 -0
- data/spec/lib/mangopay/shared_resources.rb +183 -0
- data/spec/lib/mangopay/transaction_spec.rb +14 -0
- data/spec/lib/mangopay/transfer_spec.rb +25 -81
- data/spec/lib/mangopay/user_spec.rb +37 -103
- data/spec/lib/mangopay/wallet_spec.rb +24 -73
- data/spec/spec_helper.rb +9 -38
- metadata +60 -97
- data/CONTRIBUTING.md +0 -51
- data/Rakefile +0 -5
- data/lib/mangopay/beneficiary.rb +0 -72
- data/lib/mangopay/card.rb +0 -42
- data/lib/mangopay/contribution.rb +0 -61
- data/lib/mangopay/expense.rb +0 -17
- data/lib/mangopay/immediate_contribution.rb +0 -58
- data/lib/mangopay/operation.rb +0 -16
- data/lib/mangopay/recurrent_contribution.rb +0 -62
- data/lib/mangopay/ressource.rb +0 -96
- data/lib/mangopay/strong_authentication.rb +0 -28
- data/lib/mangopay/withdrawal.rb +0 -40
- data/lib/mangopay/withdrawal_contribution.rb +0 -32
- data/spec/lib/mangopay/beneficiary_spec.rb +0 -124
- data/spec/lib/mangopay/card_spec.rb +0 -52
- data/spec/lib/mangopay/contribution_spec.rb +0 -65
- data/spec/lib/mangopay/expense_spec.rb +0 -10
- data/spec/lib/mangopay/immediate_contribution_spec.rb +0 -73
- data/spec/lib/mangopay/operation_spec.rb +0 -8
- data/spec/lib/mangopay/recurrent_contribution_spec.rb +0 -55
- data/spec/lib/mangopay/ressource_spec.rb +0 -5
- data/spec/lib/mangopay/strong_authentication_spec.rb +0 -82
- data/spec/lib/mangopay/withdrawal_contribution_spec.rb +0 -44
- data/spec/lib/mangopay/withdrawal_spec.rb +0 -98
- data/spec/support-files/example.pem +0 -49
- data/spec/support-files/test_upload.gif +0 -0
- data/spec/support-files/test_upload.jpg +0 -0
- data/spec/support-files/test_upload.pdf +0 -0
- data/spec/support-files/test_upload.png +0 -0
@@ -1,82 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe MangoPay::StrongAuthentication do
|
4
|
-
|
5
|
-
let(:new_user) {
|
6
|
-
MangoPay::User.create({
|
7
|
-
'Tag' => 'test',
|
8
|
-
'Email' => 'my@email.com',
|
9
|
-
'FirstName' => 'John',
|
10
|
-
'LastName' => 'Doe',
|
11
|
-
'CanRegisterMeanOfPayment' => true
|
12
|
-
})
|
13
|
-
}
|
14
|
-
|
15
|
-
let(:new_beneficiary) {
|
16
|
-
MangoPay::Beneficiary.create({
|
17
|
-
'Tag' => 'test',
|
18
|
-
'UserID' => new_user['ID'],
|
19
|
-
'BankAccountOwnerName' => new_user['FirstName'],
|
20
|
-
'BankAccountOwnerAddress' => '1 bis cite paradis',
|
21
|
-
'BankAccountIBAN' => 'FR76 1790 6000 3200 0833 5232 973',
|
22
|
-
'BankAccountBIC' => 'AGRIFRPP879'
|
23
|
-
})
|
24
|
-
}
|
25
|
-
|
26
|
-
let(:new_strong_beneficiary_authentication) {
|
27
|
-
MangoPay::Beneficiary.create_strong_authentication(new_beneficiary['ID'], {
|
28
|
-
'Tag' => 'test_beneficiary_strong_authentication'
|
29
|
-
})
|
30
|
-
}
|
31
|
-
|
32
|
-
let(:new_strong_user_authentication) {
|
33
|
-
MangoPay::User.create_strong_authentication(new_user['ID'], {
|
34
|
-
'Tag' => 'test_user_strong_authentication'
|
35
|
-
})
|
36
|
-
}
|
37
|
-
|
38
|
-
describe "GET" do
|
39
|
-
it "get the pending strong authentication requests" do
|
40
|
-
strong_authentication = MangoPay::StrongAuthentication.get
|
41
|
-
expect(strong_authentication).to be_kind_of(Array)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "UPLOAD BENEFICIARY" do
|
46
|
-
it "uploads a PDF file to complete a beneficiary strong authentication request" do
|
47
|
-
document_upload = MangoPay::StrongAuthentication.upload(new_strong_beneficiary_authentication['UrlRequest'], 'spec/support-files/test_upload.pdf')
|
48
|
-
expect(document_upload).to be_true
|
49
|
-
end
|
50
|
-
it "uploads a JPG file to complete a beneficiary strong authentication request" do
|
51
|
-
document_upload = MangoPay::StrongAuthentication.upload(new_strong_beneficiary_authentication['UrlRequest'], 'spec/support-files/test_upload.jpg')
|
52
|
-
expect(document_upload).to be_true
|
53
|
-
end
|
54
|
-
it "uploads a PNG file to complete a beneficiary strong authentication request" do
|
55
|
-
document_upload = MangoPay::StrongAuthentication.upload(new_strong_beneficiary_authentication['UrlRequest'], 'spec/support-files/test_upload.png')
|
56
|
-
expect(document_upload).to be_true
|
57
|
-
end
|
58
|
-
it "uploads a GIF file to complete a beneficiary strong authentication request" do
|
59
|
-
document_upload = MangoPay::StrongAuthentication.upload(new_strong_beneficiary_authentication['UrlRequest'], 'spec/support-files/test_upload.gif')
|
60
|
-
expect(document_upload).to be_true
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "UPLOAD USER" do
|
65
|
-
it "uploads a PDF file to complete a user strong authentication request" do
|
66
|
-
document_upload = MangoPay::StrongAuthentication.upload(new_strong_user_authentication['UrlRequest'], 'spec/support-files/test_upload.pdf')
|
67
|
-
expect(document_upload).to be_true
|
68
|
-
end
|
69
|
-
it "uploads a JPG file to complete a user strong authentication request" do
|
70
|
-
document_upload = MangoPay::StrongAuthentication.upload(new_strong_user_authentication['UrlRequest'], 'spec/support-files/test_upload.jpg')
|
71
|
-
expect(document_upload).to be_true
|
72
|
-
end
|
73
|
-
it "uploads a PNG file to complete a user strong authentication request" do
|
74
|
-
document_upload = MangoPay::StrongAuthentication.upload(new_strong_user_authentication['UrlRequest'], 'spec/support-files/test_upload.png')
|
75
|
-
expect(document_upload).to be_true
|
76
|
-
end
|
77
|
-
it "uploads a GIF file to complete a user strong authentication request" do
|
78
|
-
document_upload = MangoPay::StrongAuthentication.upload(new_strong_user_authentication['UrlRequest'], 'spec/support-files/test_upload.gif')
|
79
|
-
expect(document_upload).to be_true
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe MangoPay::WithdrawalContribution do
|
4
|
-
|
5
|
-
let(:new_user) {
|
6
|
-
MangoPay::User.create({
|
7
|
-
'Tag' => 'test',
|
8
|
-
'Email' => 'my@email.com',
|
9
|
-
'FirstName' => 'John',
|
10
|
-
'LastName' => 'Doe',
|
11
|
-
'CanRegisterMeanOfPayment' => true
|
12
|
-
})
|
13
|
-
}
|
14
|
-
|
15
|
-
let(:new_wallet) {
|
16
|
-
MangoPay::Wallet.create({
|
17
|
-
'Name' => 'test',
|
18
|
-
'Owners' => [ new_user['ID'] ],
|
19
|
-
'RaisingGoalAmount' => 10000
|
20
|
-
})
|
21
|
-
}
|
22
|
-
|
23
|
-
let(:new_withdrawal_contribution) do
|
24
|
-
withdrawal_contribution = MangoPay::WithdrawalContribution.create({
|
25
|
-
'Tag' => 'test_withdrawal_contribution',
|
26
|
-
'UserID' => new_user['ID'],
|
27
|
-
'WalletID' => new_wallet['ID'],
|
28
|
-
'AmountDeclared' => 1000
|
29
|
-
})
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "CREATE" do
|
33
|
-
it "creates a withdrawal contribution to a shared wallet" do
|
34
|
-
expect(new_withdrawal_contribution['ID']).not_to be_nil
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "GET" do
|
39
|
-
it "fetches a withdrawal contribution" do
|
40
|
-
withdrawal_contribution = MangoPay::WithdrawalContribution.get(new_withdrawal_contribution['ID'])
|
41
|
-
expect(withdrawal_contribution['ID']).to eq(new_withdrawal_contribution['ID'])
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,98 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe MangoPay::Withdrawal, :type => :feature do
|
4
|
-
|
5
|
-
let(:new_user) {
|
6
|
-
user = MangoPay::User.create({
|
7
|
-
'Tag' => 'test',
|
8
|
-
'Email' => 'my@email.com',
|
9
|
-
'FirstName' => 'John',
|
10
|
-
'LastName' => 'Doe',
|
11
|
-
'CanRegisterMeanOfPayment' => true
|
12
|
-
})
|
13
|
-
contribution = MangoPay::Contribution.create({
|
14
|
-
'Tag' => 'test_contribution',
|
15
|
-
'UserID' => user['ID'],
|
16
|
-
'WalletID' => 0,
|
17
|
-
'Amount' => 10000,
|
18
|
-
'ReturnURL' => 'https://leetchi.com'
|
19
|
-
})
|
20
|
-
visit(contribution['PaymentURL'])
|
21
|
-
fill_in('number', :with => '4970100000000154')
|
22
|
-
fill_in('cvv', :with => '123')
|
23
|
-
click_button('paybutton')
|
24
|
-
contribution = MangoPay::Contribution.details(contribution['ID'])
|
25
|
-
while contribution["IsSucceeded"] == false do
|
26
|
-
contribution = MangoPay::Contribution.details(contribution['ID'])
|
27
|
-
end
|
28
|
-
user
|
29
|
-
}
|
30
|
-
|
31
|
-
let(:new_beneficiary) {
|
32
|
-
MangoPay::Beneficiary.create({
|
33
|
-
'Tag' => 'test',
|
34
|
-
'UserID' => new_user['ID'],
|
35
|
-
'BankAccountOwnerName' => new_user['FirstName'],
|
36
|
-
'BankAccountOwnerAddress' => '1 bis cite paradis',
|
37
|
-
'BankAccountIBAN' => 'FR76 1790 6000 3200 0833 5232 973',
|
38
|
-
'BankAccountBIC' => 'AGRIFRPP879'
|
39
|
-
})
|
40
|
-
}
|
41
|
-
|
42
|
-
let(:new_withdrawal) {
|
43
|
-
MangoPay::Withdrawal.create({
|
44
|
-
'Tag' => 'test_withdrawal',
|
45
|
-
'UserID' => new_user['ID'],
|
46
|
-
'WalletID' => 0,
|
47
|
-
'Amount' => 2500,
|
48
|
-
'BeneficiaryID' => new_beneficiary['ID']
|
49
|
-
})
|
50
|
-
}
|
51
|
-
|
52
|
-
describe "CREATE" do
|
53
|
-
it "create a withdrawal" do
|
54
|
-
expect(new_withdrawal['ID']).not_to be_nil
|
55
|
-
expect(new_withdrawal['UserID']).to eq(new_user['ID'])
|
56
|
-
expect(new_withdrawal['BeneficiaryID']).to eq(new_beneficiary['ID'])
|
57
|
-
end
|
58
|
-
it "fails and return a 2001 error code: Invalid withdrawal amount" do
|
59
|
-
fail_withdrawal = MangoPay::Withdrawal.create({
|
60
|
-
'Tag' => 'test_withdrawal',
|
61
|
-
'UserID' => new_user['ID'],
|
62
|
-
'WalletID' => 0,
|
63
|
-
'Amount' => -123,
|
64
|
-
'BeneficiaryID' => new_beneficiary['ID']
|
65
|
-
})
|
66
|
-
expect(fail_withdrawal['ErrorCode']).to eq(2001)
|
67
|
-
end
|
68
|
-
it "fails and return a 2002 error code: Both parameters are specified: Amount and AmountWithoutFees" do
|
69
|
-
fail_withdrawal = MangoPay::Withdrawal.create({
|
70
|
-
'Tag' => 'test_withdrawal',
|
71
|
-
'UserID' => new_user['ID'],
|
72
|
-
'WalletID' => 0,
|
73
|
-
'Amount' => 2500,
|
74
|
-
'AmountWithoutFees' => 2500,
|
75
|
-
'BeneficiaryID' => new_beneficiary['ID']
|
76
|
-
})
|
77
|
-
expect(fail_withdrawal['ErrorCode']).to eq(2002)
|
78
|
-
end
|
79
|
-
it "fails and return a 2003 error code: Invalid withdrawal ClientFeeAmount" do
|
80
|
-
fail_withdrawal = MangoPay::Withdrawal.create({
|
81
|
-
'Tag' => 'test_withdrawal',
|
82
|
-
'UserID' => new_user['ID'],
|
83
|
-
'WalletID' => 0,
|
84
|
-
'Amount' => 2500,
|
85
|
-
'BeneficiaryID' => new_beneficiary['ID'],
|
86
|
-
'ClientFeeAmount' => -3000
|
87
|
-
})
|
88
|
-
expect(fail_withdrawal['ErrorCode']).to eq(2003)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "GET" do
|
93
|
-
it "get the withdrawal" do
|
94
|
-
withdrawal = MangoPay::Withdrawal.details(new_withdrawal['ID'])
|
95
|
-
expect(withdrawal['ID']).to eq(new_withdrawal['ID'])
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
Bag Attributes
|
2
|
-
localKeyID: 01 00 00 00
|
3
|
-
friendlyName: CLR{A0664CB1-ACAF-4742-B1F2-AC2B846E1FF2}
|
4
|
-
Microsoft CSP Name: Microsoft Enhanced Cryptographic Provider v1.0
|
5
|
-
Key Attributes
|
6
|
-
X509v3 Key Usage: 10
|
7
|
-
-----BEGIN RSA PRIVATE KEY-----
|
8
|
-
MIIEowIBAAKCAQEAsytrYepzLO3rxkQFHgca2SduZPe7l8X3ZEEDOzX1wsAtblRA
|
9
|
-
IHSXhOJuKHXEh2qbEcSKBOsC9rCi0LIXXp9X1nBrxRtUnEsRZBNC8F+ruyIdVled
|
10
|
-
ZDuFmwA02PRVagR/kJAFNdbmviYVPUrs9JIM6CLKKSSqDQLmyNnTZadX55maBF8G
|
11
|
-
c6kY228cpglQigVQAchU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
-
6C2gWCaaAnlNZzLk6xLT8ryJZWiI0myG6UutmkK17mf/G0dnwQx1dt+U0DryP45r
|
27
|
-
rRwHxX75Ahj11iVgWx5kAQKBgFTUTURVClytRW1E3AVI53fXsjygRYA4buqFfzCs
|
28
|
-
rDQyd5u/q4Lr4VwEwYGd+JQaxVkdpZcaC5Cx2Aw/OpsiVytIHkhA6b5EtqhKJyrB
|
29
|
-
BgjKG0p4nQQJhiIigVzj+zspL8xNLvJkUzSciVdoOUMt8u28UHp8Ig5j0lOyKHpC
|
30
|
-
RiaBAoGBAKLaIPzksFRds3JJoOB+z6DnW+UDZ4JTZ+flNnbF8SAhyfhcWu7P4Bcy
|
31
|
-
MxB0im7LNx+Pc0MHBC3XxrMkZ/oJUjnAKrG26Dzgh4VP2RM6pvz2g/lGbLO+O0vH
|
32
|
-
eMWckkIf5QidHg3HTmfAIR8buEL08bxgD0i2dL5qBuAO/dogW95b
|
33
|
-
-----END RSA PRIVATE KEY-----
|
34
|
-
Bag Attributes
|
35
|
-
localKeyID: 01 00 00 00
|
36
|
-
subject=/CN=Opensslkey Unsigned Certificate
|
37
|
-
issuer=/CN=Opensslkey Unsigned Certificate
|
38
|
-
-----BEGIN CERTIFICATE-----
|
39
|
-
MIIB2zCCAcSgAwIBAgIQZNMnNOqe7pdLgtpEs4GvuTANBgkqhkiG9w0BAQUFADAq
|
40
|
-
MSgwJgYDVQQDEx9PcGVuc3Nsa2V5IFVuc2lnbmVkIENlcnRpZmljYXRlMB4XDTEx
|
41
|
-
MDcyMDEyNTkxMloXDTEyMDcxOTE4NTkxMlowKjEoMCYGA1UEAxMfT3BlbnNzbGtl
|
42
|
-
eSBVbnNpZ25lZCBDZXJ0aWZpY2F0ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
|
43
|
-
AQoCggEBALMra2Hqcyzt68ZEBR4HGtknbmT3u5fF92RBAzs19cLALW5UQCB0l4Ti
|
44
|
-
bih1xIdqmxHEigTrAvawotCyF16fV9Zwa8UbVJxLEWQTQvBfq7siHVZXnWQ7hZsA
|
45
|
-
NNj0VWoEf5CQBTXW5r4mFT1K7PSSDOgiyikkqg0C5sjZ02WnV+eZmgRfBnOpGNtv
|
46
|
-
HKYJUIoFUAHIVPOPxGHtgNA9wZ7jUC0mQ0QK9S8txPVexlyqkgY1shMw8frbh062
|
47
|
-
3edrOVyHXLfCyqLbm3jmpwVm4Eh+x/rr5va5I3ltFKiHpPje7dXKkvKo4tuQx4/O
|
48
|
-
bMe7dTrBTF9HfqEBIBUGrarcVRdjDYkCAwEAATANBgkqhkiG9w0BAQUFAAMCAMg=
|
49
|
-
-----END CERTIFICATE-----
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|