mangopay 2.0.0 → 3.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/.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,28 +0,0 @@
|
|
1
|
-
module MangoPay
|
2
|
-
# Get all the strongAuthentication created who need to be validated.
|
3
|
-
# It's important to understand that MangoPay can create himself the request of strongAuthentication, if a user reaches some limits.
|
4
|
-
class StrongAuthentication < MangoPay::Ressource
|
5
|
-
|
6
|
-
# Get all the strongAuthentication created who need to be validated
|
7
|
-
#
|
8
|
-
# * *Returns* :
|
9
|
-
# - A array of strongAuthentication objects
|
10
|
-
#
|
11
|
-
def self.get
|
12
|
-
get_request(File.join('strongAuthentication'))
|
13
|
-
end
|
14
|
-
|
15
|
-
# Upload your Strong Authentication required files using the MangoPay API
|
16
|
-
#
|
17
|
-
# * *Args* :
|
18
|
-
# - +upload_url+ -> The url to where the StrongAuthentication documents need to be uploaded
|
19
|
-
# - +file_path+ -> Local path to the file
|
20
|
-
# * *Returns* :
|
21
|
-
# - true if the request is done
|
22
|
-
# - false if the request failed
|
23
|
-
#
|
24
|
-
def self.upload(upload_url, file_path)
|
25
|
-
form_request(upload_url, "StrongValidationDto.Picture", file_path)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/lib/mangopay/withdrawal.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
module MangoPay
|
2
|
-
# A withdrawal is a request to get the money from a wallet or a personal account to a bank account.
|
3
|
-
class Withdrawal < MangoPay::Ressource
|
4
|
-
|
5
|
-
# Create a withdrawal
|
6
|
-
# Only one amount can be present in the withdrawal request: either AmountWithoutFees or Amount (that is amount with fees).
|
7
|
-
# Amount = AmountWithoutFees + ClientFeeAmount
|
8
|
-
#
|
9
|
-
# * *Args* :
|
10
|
-
# - +data+ -> A JSON with the following attributes (Square brackets for optionals):
|
11
|
-
# * [Tag]
|
12
|
-
# * UserID
|
13
|
-
# * WalletID
|
14
|
-
# * AmountWithoutFees
|
15
|
-
# * Amount
|
16
|
-
# * BeneficiaryID
|
17
|
-
# * [ClientFeeAmount]
|
18
|
-
# * *Returns* :
|
19
|
-
# - A withdrawal object
|
20
|
-
# * *Raises* :
|
21
|
-
# - +2001+ -> Invalid withdrawal amount
|
22
|
-
# - +2002+ -> Both parameters are specified: Amount and AmountWithoutFees
|
23
|
-
# - +2003+ -> Invalid withdrawal ClientFeeAmount
|
24
|
-
#
|
25
|
-
def self.create(data)
|
26
|
-
post_request('withdrawals', data)
|
27
|
-
end
|
28
|
-
|
29
|
-
# Get a withdrawal
|
30
|
-
#
|
31
|
-
# * *Args* :
|
32
|
-
# - +withdrawal_id+ -> The id of the withdrawal you want to retrieve
|
33
|
-
# * *Returns* :
|
34
|
-
# - A withdrawal object
|
35
|
-
#
|
36
|
-
def self.details(withdrawal_id)
|
37
|
-
get_request(File.join('withdrawals', withdrawal_id.to_s))
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module MangoPay
|
2
|
-
|
3
|
-
class WithdrawalContribution < MangoPay::Ressource
|
4
|
-
|
5
|
-
# Create a withdrawal contribution
|
6
|
-
#
|
7
|
-
# * *Args* :
|
8
|
-
# - +data+ -> A JSON with the following attributes (Square brackets for optionals):
|
9
|
-
# * [Tag]
|
10
|
-
# * UserID
|
11
|
-
# * WalletID
|
12
|
-
# * AmountDeclared
|
13
|
-
# * *Returns* :
|
14
|
-
# - A withdrawal contribution object
|
15
|
-
#
|
16
|
-
def self.create(data)
|
17
|
-
post_request('contributions-by-withdrawal', data)
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
# Get a withdrawal contribution
|
22
|
-
#
|
23
|
-
# * *Args* :
|
24
|
-
# - +withdrawal_contribution_id+ -> The id of the withdrawal contribution you want to retrieve
|
25
|
-
# * *Returns* :
|
26
|
-
# - A withdrawal contribution object
|
27
|
-
#
|
28
|
-
def self.get(withdrawal_contribution_id)
|
29
|
-
get_request(File.join('contributions-by-withdrawal', withdrawal_contribution_id.to_s))
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,124 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe MangoPay::Beneficiary 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_authentication) {
|
27
|
-
MangoPay::Beneficiary.create_strong_authentication(new_beneficiary['ID'], {
|
28
|
-
'Tag' => 'test_beneficiary_strong_authentication'
|
29
|
-
})
|
30
|
-
}
|
31
|
-
|
32
|
-
describe "CREATE" do
|
33
|
-
|
34
|
-
it "create a beneficiary" do
|
35
|
-
expect(new_beneficiary['ID']).not_to be_nil
|
36
|
-
expect(new_beneficiary['UserID']).to eq(new_user['ID'])
|
37
|
-
end
|
38
|
-
|
39
|
-
it "fails and returns a 2004 error code" do
|
40
|
-
fail_beneficiary = MangoPay::Beneficiary.create({
|
41
|
-
'Tag' => 'test',
|
42
|
-
'UserID' => new_user['ID'],
|
43
|
-
'BankAccountOwnerAddress' => '1 bis cite paradis',
|
44
|
-
'BankAccountIBAN' => 'FR76 1790 6000 3200 0833 5232 973',
|
45
|
-
'BankAccountBIC' => 'AGRIFRPP879'
|
46
|
-
})
|
47
|
-
expect(fail_beneficiary["ErrorCode"]).to eq(2004)
|
48
|
-
end
|
49
|
-
|
50
|
-
it "fails and returns a 2005 error code" do
|
51
|
-
fail_beneficiary = MangoPay::Beneficiary.create({
|
52
|
-
'Tag' => 'test',
|
53
|
-
'UserID' => new_user['ID'],
|
54
|
-
'BankAccountOwnerName' => new_user['FirstName'],
|
55
|
-
'BankAccountIBAN' => 'FR76 1790 6000 3200 0833 5232 973',
|
56
|
-
'BankAccountBIC' => 'AGRIFRPP879'
|
57
|
-
})
|
58
|
-
expect(fail_beneficiary["ErrorCode"]).to eq(2005)
|
59
|
-
end
|
60
|
-
|
61
|
-
it "fail and returns a 2006 error code" do
|
62
|
-
fail_beneficiary = MangoPay::Beneficiary.create({
|
63
|
-
'Tag' => 'test',
|
64
|
-
'UserID' => new_user['ID'],
|
65
|
-
'BankAccountOwnerName' => new_user['FirstName'],
|
66
|
-
'BankAccountOwnerAddress' => '1 bis cite paradis',
|
67
|
-
'BankAccountIBAN' => 'FR76 1790 6000 3200 0833 5232 973',
|
68
|
-
'BankAccountBIC' => 'RPPdsakdnsajkdna79'
|
69
|
-
})
|
70
|
-
expect(fail_beneficiary["ErrorCode"]).to eq(2006)
|
71
|
-
end
|
72
|
-
|
73
|
-
it "fail and returns a 2007 error code" do
|
74
|
-
fail_beneficiary = MangoPay::Beneficiary.create({
|
75
|
-
'Tag' => 'test',
|
76
|
-
'UserID' => new_user['ID'],
|
77
|
-
'BankAccountOwnerName' => new_user['FirstName'],
|
78
|
-
'BankAccountOwnerAddress' => '1 bis cite paradis',
|
79
|
-
'BankAccountIBAN' => 'OIJDSAOIJDSAOIDJSAOIJDSA',
|
80
|
-
'BankAccountBIC' => 'AGRIFRPP879'
|
81
|
-
})
|
82
|
-
expect(fail_beneficiary["ErrorCode"]).to eq(2007)
|
83
|
-
end
|
84
|
-
|
85
|
-
it "fail and returns a 2008 error code" do
|
86
|
-
fail_beneficiary = MangoPay::Beneficiary.create({
|
87
|
-
'Tag' => 'test',
|
88
|
-
'UserID' => new_user['ID'],
|
89
|
-
'BankAccountOwnerName' => new_user['FirstName'],
|
90
|
-
'BankAccountOwnerAddress' => '1 bis cite paradis',
|
91
|
-
'BankAccountIBAN' => 'GB87 BARC 2065 8244 9716 55',
|
92
|
-
'BankAccountBIC' => 'CRLYFRPP'
|
93
|
-
})
|
94
|
-
expect(fail_beneficiary["ErrorCode"]).to eq(2008)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe "GET" do
|
99
|
-
it "it gets a beneficiary" do
|
100
|
-
beneficiary = MangoPay::Beneficiary.details(new_beneficiary["ID"])
|
101
|
-
expect(beneficiary["ID"]).to eq(new_beneficiary['ID'])
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
describe "StrongAuthentication" do
|
106
|
-
it "creates the beneficiary strong authentication request" do
|
107
|
-
expect(new_strong_authentication).not_to be_nil
|
108
|
-
expect(new_strong_authentication['BeneficiaryID']).to eq(new_beneficiary['ID'])
|
109
|
-
end
|
110
|
-
it "gets the beneficiary strong authentication request" do
|
111
|
-
strong_authentication = MangoPay::Beneficiary.get_strong_authentication(new_strong_authentication['BeneficiaryID'])
|
112
|
-
expect(strong_authentication['ID']).to eq(new_strong_authentication['ID'])
|
113
|
-
end
|
114
|
-
it "updated the beneficiary strong authentication request" do
|
115
|
-
strong_authentication = MangoPay::Beneficiary.update_strong_authentication(new_strong_authentication['BeneficiaryID'], {
|
116
|
-
'Tag' => 'test_beneficiary_strong_authentication2',
|
117
|
-
'IsDocumentsTransmitted' => true
|
118
|
-
})
|
119
|
-
expect(strong_authentication['ID']).to eq(new_strong_authentication['ID'])
|
120
|
-
expect(strong_authentication['Tag']).to eq('test_beneficiary_strong_authentication2')
|
121
|
-
expect(strong_authentication['IsDocumentsTransmitted']).to be_true
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe MangoPay::Card, :type => :feature 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_card) do
|
16
|
-
card = MangoPay::Card.create({
|
17
|
-
'Tag' => 'test-card',
|
18
|
-
'OwnerID' => new_user['ID'],
|
19
|
-
'ReturnURL' => 'http://leetchi.com'
|
20
|
-
})
|
21
|
-
visit(card['RedirectURL'])
|
22
|
-
fill_in('number', :with => '4970100000000154')
|
23
|
-
fill_in('cvv', :with => '123')
|
24
|
-
click_button('paybutton')
|
25
|
-
card = MangoPay::Card.details(card['ID'])
|
26
|
-
while (card["CardNumber"] || []).length != 16 do
|
27
|
-
card = MangoPay::Card.details(card['ID'])
|
28
|
-
end
|
29
|
-
card
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "CREATE" do
|
33
|
-
it "create a new card and return a redirect url" do
|
34
|
-
expect(new_card['RedirectURL']).not_to be_empty
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "GET" do
|
39
|
-
it "get the users card" do
|
40
|
-
card = MangoPay::Card.details(new_card["ID"])
|
41
|
-
expect(card["ID"]).to eq(new_card["ID"])
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "DELETE" do
|
46
|
-
it "delete the card" do
|
47
|
-
deleted_card = MangoPay::Card.delete(new_card["ID"])
|
48
|
-
expect(deleted_card).to eq("\"OK\"")
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe MangoPay::Contribution, :type => :feature 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_contribution) do
|
16
|
-
contribution = MangoPay::Contribution.create({
|
17
|
-
'Tag' => 'test_contribution',
|
18
|
-
'UserID' => new_user['ID'],
|
19
|
-
'WalletID' => 0,
|
20
|
-
'Amount' => 10000,
|
21
|
-
'ReturnURL' => 'https://leetchi.com'
|
22
|
-
})
|
23
|
-
visit(contribution['PaymentURL'])
|
24
|
-
fill_in('number', :with => '4970100000000154')
|
25
|
-
fill_in('cvv', :with => '123')
|
26
|
-
click_button('paybutton')
|
27
|
-
contribution = MangoPay::Contribution.details(contribution['ID'])
|
28
|
-
while contribution["IsSucceeded"] == false do
|
29
|
-
contribution = MangoPay::Contribution.details(contribution['ID'])
|
30
|
-
end
|
31
|
-
contribution
|
32
|
-
end
|
33
|
-
|
34
|
-
let(:new_contribution_refund) {
|
35
|
-
MangoPay::Contribution.refund({
|
36
|
-
'ContributionID' => new_contribution['ID'],
|
37
|
-
'UserID' => new_user['ID'],
|
38
|
-
'Tag' => 'test_contribution_refund'
|
39
|
-
})
|
40
|
-
}
|
41
|
-
|
42
|
-
describe "CREATE" do
|
43
|
-
it "creates a contribution" do
|
44
|
-
expect(new_contribution['ID']).not_to be_nil
|
45
|
-
expect(new_contribution['PaymentURL']).not_to be_nil
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe "GET" do
|
50
|
-
it "get the contribution" do
|
51
|
-
contribution = MangoPay::Contribution.details(new_contribution['ID'])
|
52
|
-
expect(contribution['ID']).to eq(new_contribution['ID'])
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "REFUND" do
|
57
|
-
it "creates a refund request for the contribution" do
|
58
|
-
expect(new_contribution_refund['ID']).not_to be_nil
|
59
|
-
end
|
60
|
-
it "gets the refund request" do
|
61
|
-
contribution_refund = MangoPay::Contribution.get_refund(new_contribution_refund['ID'])
|
62
|
-
expect(contribution_refund['ID']).to eq(new_contribution_refund['ID'])
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe MangoPay::ImmediateContribution, :type => :feature 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_card) do
|
16
|
-
card = MangoPay::Card.create({
|
17
|
-
'Tag' => 'test-card',
|
18
|
-
'OwnerID' => new_user['ID'],
|
19
|
-
'ReturnURL' => 'http://leetchi.com'
|
20
|
-
})
|
21
|
-
visit(card['RedirectURL'])
|
22
|
-
fill_in('number', :with => '4970100000000154')
|
23
|
-
fill_in('cvv', :with => '123')
|
24
|
-
click_button('paybutton')
|
25
|
-
card = MangoPay::Card.details(card['ID'])
|
26
|
-
while (card["CardNumber"] || []).length != 16 do
|
27
|
-
card = MangoPay::Card.details(card['ID'])
|
28
|
-
end
|
29
|
-
card
|
30
|
-
end
|
31
|
-
|
32
|
-
let(:new_immediate_contribution) do
|
33
|
-
c = MangoPay::ImmediateContribution.create({
|
34
|
-
'Tag' => 'test_contribution',
|
35
|
-
'UserID' => new_user['ID'],
|
36
|
-
'PaymentCardID' => new_card['ID'],
|
37
|
-
'WalletID' => 0,
|
38
|
-
'Amount' => 33300
|
39
|
-
})
|
40
|
-
end
|
41
|
-
|
42
|
-
let(:new_immediate_contribution_refund) {
|
43
|
-
MangoPay::ImmediateContribution.refund({
|
44
|
-
'ContributionID' => new_immediate_contribution['ID'],
|
45
|
-
'UserID' => new_user['ID'],
|
46
|
-
'Tag' => 'test_immediate_contribution_refund'
|
47
|
-
})
|
48
|
-
}
|
49
|
-
|
50
|
-
describe "CREATE" do
|
51
|
-
it "creates an immediate contribution" do
|
52
|
-
expect(new_immediate_contribution['ID']).not_to be_nil
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "GET" do
|
57
|
-
it "get the immediate contribution" do
|
58
|
-
immediate_contribution = MangoPay::ImmediateContribution.details(new_immediate_contribution['ID'])
|
59
|
-
expect(immediate_contribution['ID']).to eq(new_immediate_contribution['ID'])
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe "REFUND" do
|
64
|
-
it "creates a refund request for the immediate contribution" do
|
65
|
-
expect(new_immediate_contribution_refund['ID']).not_to be_nil
|
66
|
-
end
|
67
|
-
it "gets the refund request" do
|
68
|
-
immediate_contribution_refund = MangoPay::ImmediateContribution.get_refund(new_immediate_contribution_refund['ID'])
|
69
|
-
expect(immediate_contribution_refund['ID']).to eq(new_immediate_contribution_refund['ID'])
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe MangoPay::RecurrentContribution 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_recurrent_contribution) {
|
16
|
-
MangoPay::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
|
-
describe "CREATE" do
|
29
|
-
it "create a new recurrent contribution and return a PaymentURL" do
|
30
|
-
expect(new_recurrent_contribution['PaymentURL']).not_to be_empty
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "GET" do
|
35
|
-
it "get a recurrent contribution" do
|
36
|
-
recurrent_contribution = MangoPay::RecurrentContribution.get(new_recurrent_contribution["ID"])
|
37
|
-
expect(recurrent_contribution["ID"]).to eq(new_recurrent_contribution["ID"])
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "UPDATE" do
|
42
|
-
it "updates a recurrent contribution" do
|
43
|
-
recurrent_contribution = MangoPay::RecurrentContribution.update(new_recurrent_contribution["ID"], { :IsEnabled => false })
|
44
|
-
expect(recurrent_contribution["IsEnabled"]).to be_false
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "GET_EXECUTIONS" do
|
49
|
-
it "get a list of the recurrent contribution executions" do
|
50
|
-
recurrent_contribution_executions = MangoPay::RecurrentContribution.get_executions(new_recurrent_contribution["ID"])
|
51
|
-
expect(recurrent_contribution_executions).to be_a_kind_of(Array)
|
52
|
-
expect(recurrent_contribution_executions).to be_empty
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|