mangopay 3.0.25 → 3.0.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +30 -28
- data/.rspec +2 -2
- data/.travis.yml +13 -4
- data/Gemfile +2 -2
- data/LICENSE +20 -20
- data/README.md +126 -126
- data/bin/mangopay +9 -9
- data/lib/generators/mangopay/install_generator.rb +60 -60
- data/lib/generators/templates/mangopay.rb.erb +5 -5
- data/lib/mangopay.rb +228 -225
- data/lib/mangopay/authorization_token.rb +88 -88
- data/lib/mangopay/bank_account.rb +38 -38
- data/lib/mangopay/bankingaliases.rb +29 -0
- data/lib/mangopay/bankingaliases_iban.rb +16 -0
- data/lib/mangopay/card.rb +8 -8
- data/lib/mangopay/card_registration.rb +9 -9
- data/lib/mangopay/client.rb +74 -74
- data/lib/mangopay/dispute.rb +130 -130
- data/lib/mangopay/errors.rb +61 -61
- data/lib/mangopay/event.rb +18 -18
- data/lib/mangopay/filter_parameters.rb +46 -46
- data/lib/mangopay/hook.rb +9 -9
- data/lib/mangopay/http_calls.rb +85 -85
- data/lib/mangopay/json.rb +14 -14
- data/lib/mangopay/kyc_document.rb +70 -70
- data/lib/mangopay/legal_user.rb +15 -15
- data/lib/mangopay/mandate.rb +32 -32
- data/lib/mangopay/natural_user.rb +14 -14
- data/lib/mangopay/pay_in.rb +96 -85
- data/lib/mangopay/pay_out.rb +14 -14
- data/lib/mangopay/pre_authorization.rb +13 -13
- data/lib/mangopay/refund.rb +7 -7
- data/lib/mangopay/report.rb +17 -17
- data/lib/mangopay/resource.rb +21 -21
- data/lib/mangopay/transaction.rb +24 -24
- data/lib/mangopay/transfer.rb +9 -9
- data/lib/mangopay/user.rb +43 -43
- data/lib/mangopay/version.rb +3 -3
- data/lib/mangopay/wallet.rb +17 -17
- data/mangopay.gemspec +30 -30
- data/spec/mangopay/authorization_token_spec.rb +70 -70
- data/spec/mangopay/bank_account_spec.rb +97 -97
- data/spec/mangopay/bankingaliases_spec.rb +29 -0
- data/spec/mangopay/card_registration_spec.rb +73 -73
- data/spec/mangopay/client_spec.rb +110 -110
- data/spec/mangopay/configuration_spec.rb +95 -95
- data/spec/mangopay/dispute_spec.rb +262 -262
- data/spec/mangopay/event_spec.rb +31 -31
- data/spec/mangopay/fetch_filters_spec.rb +63 -63
- data/spec/mangopay/hook_spec.rb +37 -37
- data/spec/mangopay/idempotency_spec.rb +41 -41
- data/spec/mangopay/kyc_document_spec.rb +103 -103
- data/spec/mangopay/log_requests_filter_spec.rb +25 -25
- data/spec/mangopay/mandate_spec.rb +92 -92
- data/spec/mangopay/payin_bankwire_direct_spec.rb +74 -74
- data/spec/mangopay/payin_card_direct_spec.rb +68 -68
- data/spec/mangopay/payin_card_web_spec.rb +47 -38
- data/spec/mangopay/payin_directdebit_direct_spec.rb +37 -37
- data/spec/mangopay/payin_directdebit_web_spec.rb +38 -38
- data/spec/mangopay/payin_paypal_web_spec.rb +38 -38
- data/spec/mangopay/payin_preauthorized_direct_spec.rb +68 -68
- data/spec/mangopay/payout_bankwire_spec.rb +54 -54
- data/spec/mangopay/preauthorization_spec.rb +42 -42
- data/spec/mangopay/refund_spec.rb +21 -21
- data/spec/mangopay/report_spec.rb +39 -39
- data/spec/mangopay/shared_resources.rb +397 -381
- data/spec/mangopay/transaction_spec.rb +54 -54
- data/spec/mangopay/transfer_spec.rb +69 -69
- data/spec/mangopay/user_spec.rb +137 -137
- data/spec/mangopay/wallet_spec.rb +80 -80
- data/spec/spec_helper.rb +31 -31
- metadata +7 -6
- data/lib/mangopay/temp.rb +0 -74
- data/spec/mangopay/temp_paymentcard_spec.rb +0 -31
@@ -1,14 +1,14 @@
|
|
1
|
-
module MangoPay
|
2
|
-
|
3
|
-
# See http://docs.mangopay.com/api-references/users/natural-users/
|
4
|
-
class NaturalUser < User
|
5
|
-
|
6
|
-
def self.url(id = nil)
|
7
|
-
if id
|
8
|
-
"#{MangoPay.api_path}/users/natural/#{CGI.escape(id.to_s)}"
|
9
|
-
else
|
10
|
-
"#{MangoPay.api_path}/users/natural"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/users/natural-users/
|
4
|
+
class NaturalUser < User
|
5
|
+
|
6
|
+
def self.url(id = nil)
|
7
|
+
if id
|
8
|
+
"#{MangoPay.api_path}/users/natural/#{CGI.escape(id.to_s)}"
|
9
|
+
else
|
10
|
+
"#{MangoPay.api_path}/users/natural"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/mangopay/pay_in.rb
CHANGED
@@ -1,85 +1,96 @@
|
|
1
|
-
module MangoPay
|
2
|
-
|
3
|
-
# See http://docs.mangopay.com/api-references/payins/
|
4
|
-
class PayIn < Resource
|
5
|
-
include HTTPCalls::Fetch
|
6
|
-
include HTTPCalls::Refund
|
7
|
-
|
8
|
-
module Card
|
9
|
-
|
10
|
-
# See http://docs.mangopay.com/api-references/payins/payins-card-web/
|
11
|
-
class Web < Resource
|
12
|
-
include HTTPCalls::Create
|
13
|
-
def self.url(*)
|
14
|
-
"#{MangoPay.api_path}/payins/card/#{CGI.escape(class_name.downcase)}"
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/payins/
|
4
|
+
class PayIn < Resource
|
5
|
+
include HTTPCalls::Fetch
|
6
|
+
include HTTPCalls::Refund
|
7
|
+
|
8
|
+
module Card
|
9
|
+
|
10
|
+
# See http://docs.mangopay.com/api-references/payins/payins-card-web/
|
11
|
+
class Web < Resource
|
12
|
+
include HTTPCalls::Create
|
13
|
+
def self.url(*)
|
14
|
+
"#{MangoPay.api_path}/payins/card/#{CGI.escape(class_name.downcase)}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.extended(pay_in_id)
|
18
|
+
MangoPay.request(:get, extended_url(pay_in_id), {}, {})
|
19
|
+
end
|
20
|
+
|
21
|
+
# See https://docs.mangopay.com/endpoints/v2.01/payins#e847_view-card-details-for-a-payin-web
|
22
|
+
# example: data = MangoPay::PayIn::Card::Web.extended(12639078)
|
23
|
+
def self.extended_url(pay_in_id)
|
24
|
+
escaped_pay_in_id = CGI.escape(pay_in_id.to_s)
|
25
|
+
"#{MangoPay.api_path}/payins/card/web/#{escaped_pay_in_id}/extended"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# See http://docs.mangopay.com/api-references/payins/payindirectcard/
|
30
|
+
class Direct < Resource
|
31
|
+
include HTTPCalls::Create
|
32
|
+
def self.url(*)
|
33
|
+
"#{MangoPay.api_path}/payins/card/#{CGI.escape(class_name.downcase)}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
module PreAuthorized
|
40
|
+
|
41
|
+
# See http://docs.mangopay.com/api-references/payins/preauthorized-payin/
|
42
|
+
class Direct < Resource
|
43
|
+
include HTTPCalls::Create
|
44
|
+
def self.url(*)
|
45
|
+
"#{MangoPay.api_path}/payins/preauthorized/direct"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
module BankWire
|
52
|
+
|
53
|
+
# See http://docs.mangopay.com/api-references/payins/payinbankwire/
|
54
|
+
class Direct < Resource
|
55
|
+
include HTTPCalls::Create
|
56
|
+
def self.url(*)
|
57
|
+
"#{MangoPay.api_path}/payins/bankwire/direct"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
module DirectDebit
|
64
|
+
|
65
|
+
# See http://docs.mangopay.com/api-references/payins/direct-debit-pay-in-web/
|
66
|
+
class Web < Resource
|
67
|
+
include HTTPCalls::Create
|
68
|
+
def self.url(*)
|
69
|
+
"#{MangoPay.api_path}/payins/directdebit/#{CGI.escape(class_name.downcase)}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# See https://docs.mangopay.com/api-references/payins/direct-debit-pay-in-direct/
|
74
|
+
class Direct < Resource
|
75
|
+
include HTTPCalls::Create
|
76
|
+
def self.url(*)
|
77
|
+
"#{MangoPay.api_path}/payins/directdebit/#{CGI.escape(class_name.downcase)}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
module PayPal
|
84
|
+
|
85
|
+
# See https://docs.mangopay.com/api-references/payins/paypal-payin/
|
86
|
+
class Web < Resource
|
87
|
+
include HTTPCalls::Create
|
88
|
+
def self.url(*)
|
89
|
+
"#{MangoPay.api_path}/payins/paypal/#{CGI.escape(class_name.downcase)}"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
data/lib/mangopay/pay_out.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
module MangoPay
|
2
|
-
class PayOut < Resource
|
3
|
-
include HTTPCalls::Fetch
|
4
|
-
|
5
|
-
# See http://docs.mangopay.com/api-references/pay-out-bank-wire/
|
6
|
-
class BankWire < Resource
|
7
|
-
include HTTPCalls::Create
|
8
|
-
|
9
|
-
def self.url(*)
|
10
|
-
"#{MangoPay.api_path}/payouts/bankwire"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
1
|
+
module MangoPay
|
2
|
+
class PayOut < Resource
|
3
|
+
include HTTPCalls::Fetch
|
4
|
+
|
5
|
+
# See http://docs.mangopay.com/api-references/pay-out-bank-wire/
|
6
|
+
class BankWire < Resource
|
7
|
+
include HTTPCalls::Create
|
8
|
+
|
9
|
+
def self.url(*)
|
10
|
+
"#{MangoPay.api_path}/payouts/bankwire"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
module MangoPay
|
2
|
-
|
3
|
-
# See http://docs.mangopay.com/api-references/payins/preauthorized-payin/
|
4
|
-
class PreAuthorization < Resource
|
5
|
-
include HTTPCalls::Update
|
6
|
-
include HTTPCalls::Fetch
|
7
|
-
|
8
|
-
def self.create(params, idempotency_key = nil)
|
9
|
-
MangoPay.request(:post, "#{url}/card/direct", params, {}, idempotency_key)
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
13
|
-
end
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/payins/preauthorized-payin/
|
4
|
+
class PreAuthorization < Resource
|
5
|
+
include HTTPCalls::Update
|
6
|
+
include HTTPCalls::Fetch
|
7
|
+
|
8
|
+
def self.create(params, idempotency_key = nil)
|
9
|
+
MangoPay.request(:post, "#{url}/card/direct", params, {}, idempotency_key)
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
data/lib/mangopay/refund.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
module MangoPay
|
2
|
-
|
3
|
-
# See http://docs.mangopay.com/api-references/refund/
|
4
|
-
class Refund < Resource
|
5
|
-
include HTTPCalls::Fetch
|
6
|
-
end
|
7
|
-
end
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/refund/
|
4
|
+
class Refund < Resource
|
5
|
+
include HTTPCalls::Fetch
|
6
|
+
end
|
7
|
+
end
|
data/lib/mangopay/report.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
module MangoPay
|
2
|
-
|
3
|
-
# See https://docs.mangopay.com/endpoints/v2.01/reporting
|
4
|
-
class Report < Resource
|
5
|
-
include HTTPCalls::Fetch
|
6
|
-
|
7
|
-
class << self
|
8
|
-
|
9
|
-
# +params+: hash; see https://docs.mangopay.com/endpoints/v2.01/reporting#e825_create-a-transaction-report
|
10
|
-
def create(params, idempotency_key = nil)
|
11
|
-
url = url() + '/transactions/'
|
12
|
-
MangoPay.request(:post, url, params, {}, idempotency_key)
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
# See https://docs.mangopay.com/endpoints/v2.01/reporting
|
4
|
+
class Report < Resource
|
5
|
+
include HTTPCalls::Fetch
|
6
|
+
|
7
|
+
class << self
|
8
|
+
|
9
|
+
# +params+: hash; see https://docs.mangopay.com/endpoints/v2.01/reporting#e825_create-a-transaction-report
|
10
|
+
def create(params, idempotency_key = nil)
|
11
|
+
url = url() + '/transactions/'
|
12
|
+
MangoPay.request(:post, url, params, {}, idempotency_key)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/mangopay/resource.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
module MangoPay
|
2
|
-
# @abstract
|
3
|
-
class Resource
|
4
|
-
class << self
|
5
|
-
def class_name
|
6
|
-
name.split('::').last
|
7
|
-
end
|
8
|
-
|
9
|
-
def url(id = nil)
|
10
|
-
if self == Resource
|
11
|
-
raise NotImplementedError.new('Resource is an abstract class. Do not use it directly.')
|
12
|
-
end
|
13
|
-
if id
|
14
|
-
"#{MangoPay.api_path}/#{CGI.escape(class_name.downcase)}s/#{CGI.escape(id.to_s)}"
|
15
|
-
else
|
16
|
-
"#{MangoPay.api_path}/#{CGI.escape(class_name.downcase)}s"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
1
|
+
module MangoPay
|
2
|
+
# @abstract
|
3
|
+
class Resource
|
4
|
+
class << self
|
5
|
+
def class_name
|
6
|
+
name.split('::').last
|
7
|
+
end
|
8
|
+
|
9
|
+
def url(id = nil)
|
10
|
+
if self == Resource
|
11
|
+
raise NotImplementedError.new('Resource is an abstract class. Do not use it directly.')
|
12
|
+
end
|
13
|
+
if id
|
14
|
+
"#{MangoPay.api_path}/#{CGI.escape(class_name.downcase)}s/#{CGI.escape(id.to_s)}"
|
15
|
+
else
|
16
|
+
"#{MangoPay.api_path}/#{CGI.escape(class_name.downcase)}s"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/mangopay/transaction.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
module MangoPay
|
2
|
-
class Transaction < Resource
|
3
|
-
class << self
|
4
|
-
# Fetches list of transactions belonging to the given +wallet_id+.
|
5
|
-
# See also transactions for user: MangoPay::User#transactions
|
6
|
-
#
|
7
|
-
# Optional +filters+ is a hash accepting following keys:
|
8
|
-
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
9
|
-
# - +Status+: TransactionStatus {CREATED, SUCCEEDED, FAILED}
|
10
|
-
# - +Type+: TransactionType {PAYIN, PAYOUT, TRANSFER}
|
11
|
-
# - +Nature+: TransactionNature {NORMAL, REFUND, REPUDIATION}
|
12
|
-
# - +BeforeDate+ (timestamp): filters transactions with CreationDate _before_ this date
|
13
|
-
# - +AfterDate+ (timestamp): filters transactions with CreationDate _after_ this date
|
14
|
-
# See https://docs.mangopay.com/api-references/sort-lists/
|
15
|
-
def fetch(wallet_id, filters={})
|
16
|
-
MangoPay.request(:get, url(wallet_id), {}, filters)
|
17
|
-
end
|
18
|
-
|
19
|
-
def url(wallet_id)
|
20
|
-
"#{MangoPay.api_path}/wallets/#{CGI.escape(wallet_id.to_s)}/transactions"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
1
|
+
module MangoPay
|
2
|
+
class Transaction < Resource
|
3
|
+
class << self
|
4
|
+
# Fetches list of transactions belonging to the given +wallet_id+.
|
5
|
+
# See also transactions for user: MangoPay::User#transactions
|
6
|
+
#
|
7
|
+
# Optional +filters+ is a hash accepting following keys:
|
8
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
9
|
+
# - +Status+: TransactionStatus {CREATED, SUCCEEDED, FAILED}
|
10
|
+
# - +Type+: TransactionType {PAYIN, PAYOUT, TRANSFER}
|
11
|
+
# - +Nature+: TransactionNature {NORMAL, REFUND, REPUDIATION}
|
12
|
+
# - +BeforeDate+ (timestamp): filters transactions with CreationDate _before_ this date
|
13
|
+
# - +AfterDate+ (timestamp): filters transactions with CreationDate _after_ this date
|
14
|
+
# See https://docs.mangopay.com/api-references/sort-lists/
|
15
|
+
def fetch(wallet_id, filters={})
|
16
|
+
MangoPay.request(:get, url(wallet_id), {}, filters)
|
17
|
+
end
|
18
|
+
|
19
|
+
def url(wallet_id)
|
20
|
+
"#{MangoPay.api_path}/wallets/#{CGI.escape(wallet_id.to_s)}/transactions"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/mangopay/transfer.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
module MangoPay
|
2
|
-
|
3
|
-
# See http://docs.mangopay.com/api-references/transfers/
|
4
|
-
class Transfer < Resource
|
5
|
-
include HTTPCalls::Create
|
6
|
-
include HTTPCalls::Fetch
|
7
|
-
include HTTPCalls::Refund
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/transfers/
|
4
|
+
class Transfer < Resource
|
5
|
+
include HTTPCalls::Create
|
6
|
+
include HTTPCalls::Fetch
|
7
|
+
include HTTPCalls::Refund
|
8
|
+
end
|
9
|
+
end
|
data/lib/mangopay/user.rb
CHANGED
@@ -1,43 +1,43 @@
|
|
1
|
-
module MangoPay
|
2
|
-
|
3
|
-
# See http://docs.mangopay.com/api-references/users/
|
4
|
-
# See also children classes:
|
5
|
-
# - MangoPay::NaturalUser
|
6
|
-
# - MangoPay::LegalUser
|
7
|
-
class User < Resource
|
8
|
-
include HTTPCalls::Create
|
9
|
-
include HTTPCalls::Update
|
10
|
-
include HTTPCalls::Fetch
|
11
|
-
class << self
|
12
|
-
# Fetches list of wallets belonging to the given +user_id+.
|
13
|
-
# Optional +filters+ is a hash accepting following keys:
|
14
|
-
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
15
|
-
def wallets(user_id, filters={})
|
16
|
-
MangoPay.request(:get, url(user_id) + '/wallets', {}, filters)
|
17
|
-
end
|
18
|
-
|
19
|
-
# Fetches list of bank accounts belonging to the given +user_id+.
|
20
|
-
# Optional +filters+ is a hash accepting following keys:
|
21
|
-
# - +page+, +per_page+, +sort+: pagination and sorting params
|
22
|
-
# (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
23
|
-
def bank_accounts(user_id, filters={})
|
24
|
-
MangoPay.request(:get, url(user_id) + '/bankaccounts', {}, filters)
|
25
|
-
end
|
26
|
-
|
27
|
-
# Fetches list of cards belonging to the given +user_id+.
|
28
|
-
# Optional +filters+ is a hash accepting following keys:
|
29
|
-
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
30
|
-
def cards(user_id, filters={})
|
31
|
-
MangoPay.request(:get, url(user_id) + '/cards', {}, filters)
|
32
|
-
end
|
33
|
-
|
34
|
-
# Fetches list of transactions belonging to the given +user_id+.
|
35
|
-
# Optional +filters+ is a hash accepting following keys:
|
36
|
-
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
37
|
-
# - other keys specific for transactions filtering (see MangoPay::Transaction#fetch)
|
38
|
-
def transactions(user_id, filters={})
|
39
|
-
MangoPay.request(:get, url(user_id) + '/transactions', {}, filters)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/users/
|
4
|
+
# See also children classes:
|
5
|
+
# - MangoPay::NaturalUser
|
6
|
+
# - MangoPay::LegalUser
|
7
|
+
class User < Resource
|
8
|
+
include HTTPCalls::Create
|
9
|
+
include HTTPCalls::Update
|
10
|
+
include HTTPCalls::Fetch
|
11
|
+
class << self
|
12
|
+
# Fetches list of wallets belonging to the given +user_id+.
|
13
|
+
# Optional +filters+ is a hash accepting following keys:
|
14
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
15
|
+
def wallets(user_id, filters={})
|
16
|
+
MangoPay.request(:get, url(user_id) + '/wallets', {}, filters)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Fetches list of bank accounts belonging to the given +user_id+.
|
20
|
+
# Optional +filters+ is a hash accepting following keys:
|
21
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params
|
22
|
+
# (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
23
|
+
def bank_accounts(user_id, filters={})
|
24
|
+
MangoPay.request(:get, url(user_id) + '/bankaccounts', {}, filters)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Fetches list of cards belonging to the given +user_id+.
|
28
|
+
# Optional +filters+ is a hash accepting following keys:
|
29
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
30
|
+
def cards(user_id, filters={})
|
31
|
+
MangoPay.request(:get, url(user_id) + '/cards', {}, filters)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Fetches list of transactions belonging to the given +user_id+.
|
35
|
+
# Optional +filters+ is a hash accepting following keys:
|
36
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
37
|
+
# - other keys specific for transactions filtering (see MangoPay::Transaction#fetch)
|
38
|
+
def transactions(user_id, filters={})
|
39
|
+
MangoPay.request(:get, url(user_id) + '/transactions', {}, filters)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|