leetchi-wallet-services 0.0.1
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.
- data/CONTRIBUTING.md +51 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +26 -0
- data/README.md +64 -0
- data/Rakefile +8 -0
- data/lib/leetchi-wallet-services.rb +21 -0
- data/lib/leetchi/beneficiary.rb +73 -0
- data/lib/leetchi/card.rb +42 -0
- data/lib/leetchi/contribution.rb +61 -0
- data/lib/leetchi/expense.rb +17 -0
- data/lib/leetchi/operation.rb +16 -0
- data/lib/leetchi/recurrent_contribution.rb +38 -0
- data/lib/leetchi/ressource.rb +75 -0
- data/lib/leetchi/strong_authentication.rb +15 -0
- data/lib/leetchi/transfer.rb +58 -0
- data/lib/leetchi/user.rb +148 -0
- data/lib/leetchi/wallet.rb +93 -0
- data/lib/leetchi/withdrawal.rb +41 -0
- data/spec/fixtures/leetchi_cassettes/beneficiary.yml +26926 -0
- data/spec/fixtures/leetchi_cassettes/card.yml +10524 -0
- data/spec/fixtures/leetchi_cassettes/contribution.yml +8175 -0
- data/spec/fixtures/leetchi_cassettes/expense-site.yml +45 -0
- data/spec/fixtures/leetchi_cassettes/expense.yml +126 -0
- data/spec/fixtures/leetchi_cassettes/operation.yml +126 -0
- data/spec/fixtures/leetchi_cassettes/recurrent_contribution.yml +564 -0
- data/spec/fixtures/leetchi_cassettes/strong_authentication.yml +208 -0
- data/spec/fixtures/leetchi_cassettes/transfer.yml +5679 -0
- data/spec/fixtures/leetchi_cassettes/user.yml +31848 -0
- data/spec/fixtures/leetchi_cassettes/wallet.yml +27719 -0
- data/spec/fixtures/leetchi_cassettes/withdrawal.yml +12001 -0
- data/spec/lib/leetchi/beneficiary_spec.rb +129 -0
- data/spec/lib/leetchi/card_spec.rb +50 -0
- data/spec/lib/leetchi/contribution_spec.rb +64 -0
- data/spec/lib/leetchi/expense_spec.rb +17 -0
- data/spec/lib/leetchi/operation_spec.rb +14 -0
- data/spec/lib/leetchi/recurrent_contribution_spec.rb +48 -0
- data/spec/lib/leetchi/ressource_spec.rb +7 -0
- data/spec/lib/leetchi/strong_authentication_spec.rb +17 -0
- data/spec/lib/leetchi/transfer_spec.rb +71 -0
- data/spec/lib/leetchi/user_spec.rb +130 -0
- data/spec/lib/leetchi/wallet_spec.rb +87 -0
- data/spec/lib/leetchi/withdrawal_spec.rb +89 -0
- data/spec/spec_helper.rb +19 -0
- metadata +119 -0
@@ -0,0 +1,129 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe Leetchi::Beneficiary do
|
4
|
+
|
5
|
+
let(:new_user) {
|
6
|
+
Leetchi::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
|
+
Leetchi::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_authentication) {
|
27
|
+
Leetchi::Beneficiary.create_strong_authentication(new_beneficiary['ID'], {
|
28
|
+
'Tag' => 'test_beneficiary_strong_authentication'
|
29
|
+
})
|
30
|
+
}
|
31
|
+
|
32
|
+
before do
|
33
|
+
VCR.insert_cassette 'beneficiary', :record => :new_episodes
|
34
|
+
end
|
35
|
+
after do
|
36
|
+
VCR.eject_cassette
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "CREATE" do
|
40
|
+
it "create a beneficiary" do
|
41
|
+
new_beneficiary['ID'].wont_be_nil
|
42
|
+
new_beneficiary['UserID'].must_equal new_user['ID']
|
43
|
+
end
|
44
|
+
|
45
|
+
it "fails and returns a 2004 error code" do
|
46
|
+
fail_beneficiary = Leetchi::Beneficiary.create({
|
47
|
+
'Tag' => 'test',
|
48
|
+
'UserID' => new_user['ID'],
|
49
|
+
'BankAccountOwnerAddress' => '1 bis cite paradis',
|
50
|
+
'BankAccountIBAN' => 'FR76 1790 6000 3200 0833 5232 973',
|
51
|
+
'BankAccountBIC' => 'AGRIFRPP879'
|
52
|
+
})
|
53
|
+
fail_beneficiary["ErrorCode"].must_equal 2004
|
54
|
+
end
|
55
|
+
|
56
|
+
it "fails and returns a 2005 error code" do
|
57
|
+
fail_beneficiary = Leetchi::Beneficiary.create({
|
58
|
+
'Tag' => 'test',
|
59
|
+
'UserID' => new_user['ID'],
|
60
|
+
'BankAccountOwnerName' => new_user['FirstName'],
|
61
|
+
'BankAccountIBAN' => 'FR76 1790 6000 3200 0833 5232 973',
|
62
|
+
'BankAccountBIC' => 'AGRIFRPP879'
|
63
|
+
})
|
64
|
+
fail_beneficiary["ErrorCode"].must_equal 2005
|
65
|
+
end
|
66
|
+
|
67
|
+
it "fail and returns a 2006 error code" do
|
68
|
+
fail_beneficiary = Leetchi::Beneficiary.create({
|
69
|
+
'Tag' => 'test',
|
70
|
+
'UserID' => new_user['ID'],
|
71
|
+
'BankAccountOwnerName' => new_user['FirstName'],
|
72
|
+
'BankAccountOwnerAddress' => '1 bis cite paradis',
|
73
|
+
'BankAccountIBAN' => 'FR76 1790 6000 3200 0833 5232 973',
|
74
|
+
'BankAccountBIC' => 'RPPdsakdnsajkdna79'
|
75
|
+
})
|
76
|
+
fail_beneficiary["ErrorCode"].must_equal 2006
|
77
|
+
end
|
78
|
+
|
79
|
+
it "fail and returns a 2007 error code" do
|
80
|
+
fail_beneficiary = Leetchi::Beneficiary.create({
|
81
|
+
'Tag' => 'test',
|
82
|
+
'UserID' => new_user['ID'],
|
83
|
+
'BankAccountOwnerName' => new_user['FirstName'],
|
84
|
+
'BankAccountOwnerAddress' => '1 bis cite paradis',
|
85
|
+
'BankAccountIBAN' => 'OIJDSAOIJDSAOIDJSAOIJDSA',
|
86
|
+
'BankAccountBIC' => 'AGRIFRPP879'
|
87
|
+
})
|
88
|
+
fail_beneficiary["ErrorCode"].must_equal 2007
|
89
|
+
end
|
90
|
+
|
91
|
+
it "fail and returns a 2008 error code" do
|
92
|
+
fail_beneficiary = Leetchi::Beneficiary.create({
|
93
|
+
'Tag' => 'test',
|
94
|
+
'UserID' => new_user['ID'],
|
95
|
+
'BankAccountOwnerName' => new_user['FirstName'],
|
96
|
+
'BankAccountOwnerAddress' => '1 bis cite paradis',
|
97
|
+
'BankAccountIBAN' => 'GB87 BARC 2065 8244 9716 55',
|
98
|
+
'BankAccountBIC' => 'CRLYFRPP'
|
99
|
+
})
|
100
|
+
fail_beneficiary["ErrorCode"].must_equal 2008
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "GET" do
|
105
|
+
it "it gets a beneficiary" do
|
106
|
+
beneficiary = Leetchi::Beneficiary.details(new_beneficiary["ID"])
|
107
|
+
beneficiary["ID"].must_equal new_beneficiary['ID']
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe "StrongAuthentication" do
|
112
|
+
it "creates the beneficiary strong authentication request" do
|
113
|
+
new_strong_authentication.wont_be_nil
|
114
|
+
end
|
115
|
+
it "gets the beneficiary strong authentication request" do
|
116
|
+
strong_authentication = Leetchi::Beneficiary.get_strong_authentication(new_strong_authentication['ID'])
|
117
|
+
strong_authentication['ID'].must_equal new_strong_authentication['ID']
|
118
|
+
end
|
119
|
+
it "updated the beneficiary strong authentication request" do
|
120
|
+
strong_authentication = Leetchi::Beneficiary.update_strong_authentication(new_beneficiary['ID'], {
|
121
|
+
'Tag' => 'test_beneficiary_strong_authentication2',
|
122
|
+
'IsDocumentsTransmitted' => true
|
123
|
+
})
|
124
|
+
strong_authentication['ID'].must_equal new_strong_authentication['ID']
|
125
|
+
strong_authentication['Tag'].must_equal 'test_beneficiary_strong_authentication2'
|
126
|
+
strong_authentication['IsDocumentsTransmitted'].must_equal true
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe Leetchi::Card do
|
4
|
+
|
5
|
+
let(:new_user) {
|
6
|
+
Leetchi::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_card) {
|
16
|
+
Leetchi::Card.create({
|
17
|
+
'Tag' => 'test-card',
|
18
|
+
'OwnerID' => new_user['ID'],
|
19
|
+
'ReturnURL' => 'http://leetchi.com'
|
20
|
+
})
|
21
|
+
}
|
22
|
+
|
23
|
+
before do
|
24
|
+
VCR.insert_cassette 'card', :record => :new_episodes
|
25
|
+
end
|
26
|
+
after do
|
27
|
+
VCR.eject_cassette
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "CREATE" do
|
31
|
+
it "create a new card and return a redirect url" do
|
32
|
+
new_card['RedirectURL'].wont_be_empty
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "GET" do
|
37
|
+
it "get the users card" do
|
38
|
+
card = Leetchi::Card.details(new_card["ID"])
|
39
|
+
card["ID"].must_equal new_card["ID"]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "DELETE" do
|
44
|
+
it "delete the card" do
|
45
|
+
deleted_card = Leetchi::Card.delete(new_card["ID"])
|
46
|
+
deleted_card.must_equal 'OK'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe Leetchi::Contribution do
|
4
|
+
|
5
|
+
before do
|
6
|
+
VCR.insert_cassette 'contribution', :record => :new_episodes
|
7
|
+
end
|
8
|
+
after do
|
9
|
+
VCR.eject_cassette
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:new_user) {
|
13
|
+
Leetchi::User.create({
|
14
|
+
'Tag' => 'test',
|
15
|
+
'Email' => 'my@email.com',
|
16
|
+
'FirstName' => 'John',
|
17
|
+
'LastName' => 'Doe',
|
18
|
+
'CanRegisterMeanOfPayment' => true
|
19
|
+
})
|
20
|
+
}
|
21
|
+
|
22
|
+
let(:new_contribution) {
|
23
|
+
Leetchi::Contribution.create({
|
24
|
+
'Tag' => 'test_contribution',
|
25
|
+
'UserID' => new_user['ID'],
|
26
|
+
'WalletID' => 0,
|
27
|
+
'Amount' => 10000,
|
28
|
+
'ReturnURL' => 'https://leetchi.com',
|
29
|
+
'BankAccountBIC' => 'AGRIFRPP879'
|
30
|
+
})
|
31
|
+
}
|
32
|
+
|
33
|
+
let(:new_contribution_refund) {
|
34
|
+
Leetchi::Contribution.refund({
|
35
|
+
'ContributionID' => new_contribution['ID'],
|
36
|
+
'UserID' => new_user['ID'],
|
37
|
+
'Tag' => 'test_contribution_refund'
|
38
|
+
})
|
39
|
+
}
|
40
|
+
|
41
|
+
describe "CREATE" do
|
42
|
+
it "creates a contribution" do
|
43
|
+
new_contribution['ID'].wont_be_nil
|
44
|
+
new_contribution['PaymentURL'].wont_be_nil
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "GET" do
|
49
|
+
it "get the contribution" do
|
50
|
+
contribution = Leetchi::Contribution.details(new_contribution['ID'])
|
51
|
+
contribution['ID'].must_equal new_contribution['ID']
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "REFUND" do
|
56
|
+
it "creates a refund request for the contribution" do
|
57
|
+
new_contribution_refund['ID'].wont_be_nil
|
58
|
+
end
|
59
|
+
it "gets the refund request" do
|
60
|
+
contribution_refund = Leetchi::Contribution.get_refund(new_contribution_refund['ID'])
|
61
|
+
contribution_refund['ID'].must_equal new_contribution_refund['ID']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe Leetchi::Expense do
|
4
|
+
|
5
|
+
before do
|
6
|
+
VCR.insert_cassette 'expense', :record => :new_episodes
|
7
|
+
end
|
8
|
+
after do
|
9
|
+
VCR.eject_cassette
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "GET" do
|
13
|
+
it "get the expense" do
|
14
|
+
card = Leetchi::Expense.get(1)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe Leetchi::Operation do
|
4
|
+
before do
|
5
|
+
VCR.insert_cassette 'operation', :record => :new_episodes
|
6
|
+
end
|
7
|
+
after do
|
8
|
+
VCR.eject_cassette
|
9
|
+
end
|
10
|
+
|
11
|
+
it "gets the operation" do
|
12
|
+
operation = Leetchi::Operation.get(1)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe Leetchi::RecurrentContribution do
|
4
|
+
|
5
|
+
let(:new_user) {
|
6
|
+
Leetchi::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_recurrent_contribution) {
|
16
|
+
Leetchi::RecurrentContribution.create({
|
17
|
+
'Tag' => 'test-recurrent-contribution',
|
18
|
+
'UserID' => new_user['ID'],
|
19
|
+
'WalletID' => 0,
|
20
|
+
'Amount' => 4200,
|
21
|
+
'StartDate' => '1388534400',
|
22
|
+
'FrequencyCode' => 'TwiceMonthly',
|
23
|
+
'NumberOfExecutions' => 10,
|
24
|
+
'ReturnURL' => 'http://leetchi.com'
|
25
|
+
})
|
26
|
+
}
|
27
|
+
|
28
|
+
before do
|
29
|
+
VCR.insert_cassette 'recurrent_contribution', :record => :new_episodes
|
30
|
+
end
|
31
|
+
after do
|
32
|
+
VCR.eject_cassette
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "CREATE" do
|
36
|
+
it "create a new recurrent contribution and return a PaymentURL" do
|
37
|
+
new_recurrent_contribution['PaymentURL'].wont_be_empty
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "GET" do
|
42
|
+
it "get a recurrent contribution" do
|
43
|
+
recurrent_contribution = Leetchi::RecurrentContribution.get(new_recurrent_contribution["ID"])
|
44
|
+
recurrent_contribution["ID"].must_equal new_recurrent_contribution["ID"]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe Leetchi::StrongAuthentication do
|
4
|
+
before do
|
5
|
+
VCR.insert_cassette 'strong_authentication', :record => :new_episodes
|
6
|
+
end
|
7
|
+
after do
|
8
|
+
VCR.eject_cassette
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "GET" do
|
12
|
+
it "get the pending strong authentication requests" do
|
13
|
+
strong_authentication = Leetchi::StrongAuthentication.get
|
14
|
+
strong_authentication.must_be_kind_of Array
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe Leetchi::Transfer do
|
4
|
+
before do
|
5
|
+
VCR.insert_cassette 'transfer', :record => :new_episodes
|
6
|
+
end
|
7
|
+
after do
|
8
|
+
VCR.eject_cassette
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:new_payer) {
|
12
|
+
Leetchi::User.create({
|
13
|
+
'Tag' => 'test',
|
14
|
+
'Email' => 'my@email.com',
|
15
|
+
'FirstName' => 'John',
|
16
|
+
'LastName' => 'Doe',
|
17
|
+
'CanRegisterMeanOfPayment' => true
|
18
|
+
})
|
19
|
+
}
|
20
|
+
|
21
|
+
let(:new_beneficiary) {
|
22
|
+
Leetchi::User.create({
|
23
|
+
'Tag' => 'test',
|
24
|
+
'Email' => 'my@email.com',
|
25
|
+
'FirstName' => 'John',
|
26
|
+
'LastName' => 'Doe',
|
27
|
+
'CanRegisterMeanOfPayment' => true
|
28
|
+
})
|
29
|
+
}
|
30
|
+
|
31
|
+
let(:new_transfert) {
|
32
|
+
Leetchi::Transfer.create({
|
33
|
+
'Tag' => 'test transfer',
|
34
|
+
'PayerID' => new_payer['ID'],
|
35
|
+
'BeneficiaryID' => new_beneficiary['ID'],
|
36
|
+
'Amount' => 1000,
|
37
|
+
'PayerWalletID' => 0,
|
38
|
+
'BeneficiaryWalletID' => 0
|
39
|
+
})
|
40
|
+
}
|
41
|
+
|
42
|
+
let(:new_transfer_refund) {
|
43
|
+
Leetchi::Transfer.refund({
|
44
|
+
'TransferID' => new_transfert['ID'],
|
45
|
+
'UserID' => new_payer['ID']
|
46
|
+
})
|
47
|
+
}
|
48
|
+
|
49
|
+
describe "CREATE" do
|
50
|
+
it "create a transfer" do
|
51
|
+
new_transfert['ID'].wont_be_nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "GET" do
|
56
|
+
it "gets the transfer" do
|
57
|
+
transfert = Leetchi::Transfer.details(new_transfert['ID'])
|
58
|
+
transfert['ID'].must_equal new_transfert['ID']
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "REFUND" do
|
63
|
+
it "create a refund for the transfer" do
|
64
|
+
new_transfer_refund['ID'].wont_be_nil
|
65
|
+
end
|
66
|
+
it "gets a the transfer refund" do
|
67
|
+
transfer_refund = Leetchi::Transfer.get_refund(new_transfer_refund['ID'])
|
68
|
+
transfer_refund['ID'].must_equal new_transfer_refund['ID']
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe Leetchi::User do
|
4
|
+
|
5
|
+
let(:new_user) {
|
6
|
+
Leetchi::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
|
+
Leetchi::Wallet.create({
|
17
|
+
'Name' => 'test',
|
18
|
+
'Owners' => [ new_user['ID'] ],
|
19
|
+
'RaisingGoalAmount' => 12000
|
20
|
+
})
|
21
|
+
}
|
22
|
+
|
23
|
+
let(:new_strong_authentication) {
|
24
|
+
Leetchi::User.create_strong_authentication(new_user['ID'], {
|
25
|
+
'Tag' => 'test_strong_auth'
|
26
|
+
})
|
27
|
+
}
|
28
|
+
|
29
|
+
before do
|
30
|
+
VCR.insert_cassette 'user', :record => :new_episodes
|
31
|
+
end
|
32
|
+
after do
|
33
|
+
VCR.eject_cassette
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "CREATE" do
|
37
|
+
it "create a user" do
|
38
|
+
new_user["FirstName"].must_equal 'John'
|
39
|
+
new_user["LastName"].must_equal 'Doe'
|
40
|
+
new_user["Email"].must_equal 'my@email.com'
|
41
|
+
new_user["CanRegisterMeanOfPayment"].must_equal true
|
42
|
+
new_user["ID"].wont_be_nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "GET" do
|
47
|
+
it "gets the user infos" do
|
48
|
+
user = Leetchi::User.details(new_user["ID"])
|
49
|
+
|
50
|
+
user["FirstName"].must_equal new_user["FirstName"]
|
51
|
+
user["LastName"].must_equal new_user["LastName"]
|
52
|
+
user["Email"].must_equal new_user["Email"]
|
53
|
+
user["ID"].must_equal new_user["ID"]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "UPDATE" do
|
58
|
+
it "update the user infos" do
|
59
|
+
user = Leetchi::User.update(new_user["ID"], {
|
60
|
+
'Tag' => 'test-update',
|
61
|
+
'Email' => 'mynew@email.com',
|
62
|
+
'FirstName' => 'Jack',
|
63
|
+
'LastName' => 'Black',
|
64
|
+
'CanRegisterMeanOfPayment' => false
|
65
|
+
})
|
66
|
+
user["FirstName"].must_equal 'Jack'
|
67
|
+
user["LastName"].must_equal 'Black'
|
68
|
+
user["Email"].must_equal 'mynew@email.com'
|
69
|
+
user["CanRegisterMeanOfPayment"].must_equal false
|
70
|
+
user["ID"].must_equal new_user["ID"]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "GET_WALLETS" do
|
75
|
+
it "get an empty list of wallets" do
|
76
|
+
wallets = Leetchi::User.get_wallets(new_user["ID"])
|
77
|
+
wallets.must_be_empty
|
78
|
+
end
|
79
|
+
it "gets a new wallet for the user" do
|
80
|
+
new_wallet
|
81
|
+
wallets = Leetchi::User.get_wallets(new_user['ID'])
|
82
|
+
wallets.wont_be_empty
|
83
|
+
wallets[0]["Owners"][0].must_equal new_user['ID']
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "CARDS" do
|
88
|
+
it "gets the user cards" do
|
89
|
+
cards = Leetchi::User.cards(new_user["ID"])
|
90
|
+
cards.must_be_empty
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe "OPERATIONS" do
|
95
|
+
it "gets all the users operations" do
|
96
|
+
operations = Leetchi::User.operations(new_user['ID'])
|
97
|
+
operations.must_be_empty
|
98
|
+
end
|
99
|
+
it "gets all the users personal operation" do
|
100
|
+
personal_operations = Leetchi::User.personal_operations(new_user['ID'])
|
101
|
+
personal_operations.must_be_empty
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe "STRONG_AUTHENTICATION" do
|
106
|
+
it "creates a new strong authentication request" do
|
107
|
+
new_strong_authentication['ID'].wont_be_nil
|
108
|
+
end
|
109
|
+
it "gets the user strong authentication request" do
|
110
|
+
strong_authentication = Leetchi::User.get_strong_authentication(new_user['ID'])
|
111
|
+
strong_authentication['ID'].must_equal new_strong_authentication['ID']
|
112
|
+
end
|
113
|
+
it "updates the user strong authentication request" do
|
114
|
+
strong_authentication = Leetchi::User.update_strong_authentication(new_user['ID'], {
|
115
|
+
'Tag' => 'test_strong_authentication2',
|
116
|
+
'IsDocumentsTransmitted' => true
|
117
|
+
})
|
118
|
+
strong_authentication['ID'].must_equal new_strong_authentication['ID']
|
119
|
+
strong_authentication['Tag'].must_equal 'test_strong_authentication2'
|
120
|
+
strong_authentication['IsDocumentsTransmitted'].must_equal true
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe "EXPENSE_SITES" do
|
125
|
+
it "get the expense sites for the given user" do
|
126
|
+
expense_sites = Leetchi::User.expense_sites(new_user['ID'], new_wallet['ID'])
|
127
|
+
expense_sites.must_be_kind_of Array
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|