fidor_api 0.0.2 → 0.1.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 +1 -0
- data/.ruby-version +1 -1
- data/.travis.yml +5 -3
- data/CHANGELOG.md +114 -0
- data/Gemfile +3 -2
- data/README.md +12 -10
- data/lib/fidor_api/account.rb +7 -10
- data/lib/fidor_api/amount_attributes.rb +23 -20
- data/lib/fidor_api/approval_required.rb +9 -0
- data/lib/fidor_api/auth.rb +1 -1
- data/lib/fidor_api/beneficiary/ach.rb +39 -0
- data/lib/fidor_api/beneficiary/base.rb +118 -0
- data/lib/fidor_api/beneficiary/generic.rb +24 -0
- data/lib/fidor_api/beneficiary/p2p_account_number.rb +14 -0
- data/lib/fidor_api/beneficiary/p2p_phone.rb +14 -0
- data/lib/fidor_api/beneficiary/p2p_username.rb +14 -0
- data/lib/fidor_api/beneficiary/swift.rb +35 -0
- data/lib/fidor_api/beneficiary/unknown.rb +16 -0
- data/lib/fidor_api/beneficiary/utility.rb +35 -0
- data/lib/fidor_api/beneficiary.rb +27 -0
- data/lib/fidor_api/card.rb +31 -48
- data/lib/fidor_api/card_limit_attribute.rb +52 -0
- data/lib/fidor_api/card_limits.rb +6 -34
- data/lib/fidor_api/client.rb +8 -2
- data/lib/fidor_api/collection.rb +15 -6
- data/lib/fidor_api/confirmable_action.rb +45 -0
- data/lib/fidor_api/connectivity/connection.rb +113 -0
- data/lib/fidor_api/connectivity/endpoint.rb +82 -0
- data/lib/fidor_api/connectivity/resource.rb +76 -0
- data/lib/fidor_api/connectivity.rb +17 -0
- data/lib/fidor_api/constants.rb +3 -0
- data/lib/fidor_api/customer.rb +41 -23
- data/lib/fidor_api/customers/confirmations.rb +19 -0
- data/lib/fidor_api/errors.rb +14 -3
- data/lib/fidor_api/message.rb +17 -18
- data/lib/fidor_api/msisdn.rb +1 -1
- data/lib/fidor_api/password.rb +30 -0
- data/lib/fidor_api/preauth.rb +5 -12
- data/lib/fidor_api/session_token.rb +20 -0
- data/lib/fidor_api/transaction.rb +5 -12
- data/lib/fidor_api/transfer/ach.rb +46 -0
- data/lib/fidor_api/transfer/bank_internal.rb +37 -0
- data/lib/fidor_api/transfer/base.rb +36 -0
- data/lib/fidor_api/transfer/fps.rb +56 -0
- data/lib/fidor_api/transfer/generic.rb +134 -0
- data/lib/fidor_api/transfer/internal.rb +53 -0
- data/lib/fidor_api/transfer/p2p_account_number.rb +45 -0
- data/lib/fidor_api/transfer/p2p_phone.rb +45 -0
- data/lib/fidor_api/transfer/p2p_username.rb +45 -0
- data/lib/fidor_api/transfer/sepa.rb +56 -0
- data/lib/fidor_api/transfer/swift.rb +49 -0
- data/lib/fidor_api/transfer/utility.rb +50 -0
- data/lib/fidor_api/transfer.rb +13 -186
- data/lib/fidor_api/user.rb +12 -11
- data/lib/fidor_api/version.rb +1 -1
- data/lib/fidor_api.rb +39 -22
- metadata +37 -4
- data/lib/fidor_api/resource.rb +0 -84
@@ -0,0 +1,53 @@
|
|
1
|
+
module FidorApi
|
2
|
+
module Transfer
|
3
|
+
class Internal < Base
|
4
|
+
extend ModelAttribute
|
5
|
+
extend AmountAttributes
|
6
|
+
|
7
|
+
self.endpoint = Connectivity::Endpoint.new('/internal_transfers', :collection)
|
8
|
+
|
9
|
+
attribute :id, :integer
|
10
|
+
attribute :account_id, :string
|
11
|
+
attribute :user_id, :string
|
12
|
+
attribute :transaction_id, :string
|
13
|
+
attribute :receiver, :string
|
14
|
+
attribute :external_uid, :string
|
15
|
+
attribute :currency, :string
|
16
|
+
attribute :subject, :string
|
17
|
+
attribute :state, :string
|
18
|
+
attribute :created_at, :time
|
19
|
+
attribute :updated_at, :time
|
20
|
+
amount_attribute :amount
|
21
|
+
|
22
|
+
def self.required_attributes
|
23
|
+
[ :account_id, :receiver, :external_uid, :amount, :subject ]
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.writeable_attributes
|
27
|
+
required_attributes
|
28
|
+
end
|
29
|
+
|
30
|
+
validates *required_attributes, presence: true
|
31
|
+
|
32
|
+
def as_json
|
33
|
+
attributes.slice *self.class.writeable_attributes
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
module ClientSupport
|
39
|
+
def internal_transfers(options = {})
|
40
|
+
Transfer::Internal.all(options)
|
41
|
+
end
|
42
|
+
|
43
|
+
def internal_transfer(id)
|
44
|
+
Transfer::Internal.find(id)
|
45
|
+
end
|
46
|
+
|
47
|
+
def build_internal_transfer(attributes = {})
|
48
|
+
Transfer::Internal.new(attributes)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module FidorApi
|
2
|
+
module Transfer
|
3
|
+
class P2pAccountNumber < Base
|
4
|
+
include Generic
|
5
|
+
|
6
|
+
attribute :account_number, :string
|
7
|
+
|
8
|
+
validates :account_number, presence: true, unless: :beneficiary_reference_passed?
|
9
|
+
|
10
|
+
def set_attributes(attrs = {})
|
11
|
+
set_beneficiary_attributes(attrs)
|
12
|
+
self.account_number = attrs.fetch("beneficiary", {}).fetch("routing_info", {})["account_number"]
|
13
|
+
super(attrs.except("beneficiary"))
|
14
|
+
end
|
15
|
+
|
16
|
+
def as_json_routing_type
|
17
|
+
"FOS_P2P_ACCOUNT_NUMBER".freeze
|
18
|
+
end
|
19
|
+
|
20
|
+
def as_json_routing_info
|
21
|
+
{
|
22
|
+
account_number: account_number
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
module ClientSupport
|
27
|
+
def p2p_account_number_transfers(options = {})
|
28
|
+
Transfer::P2pAccountNumber.all(options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def p2p_account_number_transfer(id)
|
32
|
+
Transfer::P2pAccountNumber.find(id)
|
33
|
+
end
|
34
|
+
|
35
|
+
def build_p2p_account_number_transfer(attributes = {})
|
36
|
+
Transfer::P2pAccountNumber.new(attributes)
|
37
|
+
end
|
38
|
+
|
39
|
+
def update_p2p_account_number_transfer(id, attributes = {})
|
40
|
+
Transfer::P2pAccountNumber.new(attributes.merge(id: id))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module FidorApi
|
2
|
+
module Transfer
|
3
|
+
class P2pPhone < Base
|
4
|
+
include Generic
|
5
|
+
|
6
|
+
attribute :mobile_phone_number, :string
|
7
|
+
|
8
|
+
validates :mobile_phone_number, presence: true, unless: :beneficiary_reference_passed?
|
9
|
+
|
10
|
+
def set_attributes(attrs = {})
|
11
|
+
set_beneficiary_attributes(attrs)
|
12
|
+
self.mobile_phone_number = attrs.fetch("beneficiary", {}).fetch("routing_info", {})["mobile_phone_number"]
|
13
|
+
super(attrs.except("beneficiary"))
|
14
|
+
end
|
15
|
+
|
16
|
+
def as_json_routing_type
|
17
|
+
"FOS_P2P_PHONE"
|
18
|
+
end
|
19
|
+
|
20
|
+
def as_json_routing_info
|
21
|
+
{
|
22
|
+
mobile_phone_number: mobile_phone_number
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
module ClientSupport
|
27
|
+
def p2p_phone_transfers(options = {})
|
28
|
+
Transfer::P2pPhone.all(options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def p2p_phone_transfer(id)
|
32
|
+
Transfer::P2pPhone.find(id)
|
33
|
+
end
|
34
|
+
|
35
|
+
def build_p2p_phone_transfer(attributes = {})
|
36
|
+
Transfer::P2pPhone.new(attributes)
|
37
|
+
end
|
38
|
+
|
39
|
+
def update_p2p_phone_transfer(id, attributes = {})
|
40
|
+
Transfer::P2pPhone.new(attributes.merge(id: id))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module FidorApi
|
2
|
+
module Transfer
|
3
|
+
class P2pUsername < Base
|
4
|
+
include Generic
|
5
|
+
|
6
|
+
attribute :username, :string
|
7
|
+
|
8
|
+
validates :username, presence: true, unless: :beneficiary_reference_passed?
|
9
|
+
|
10
|
+
def set_attributes(attrs = {})
|
11
|
+
set_beneficiary_attributes(attrs)
|
12
|
+
self.username = attrs.fetch("beneficiary", {}).fetch("routing_info", {})["username"]
|
13
|
+
super(attrs.except("beneficiary"))
|
14
|
+
end
|
15
|
+
|
16
|
+
def as_json_routing_type
|
17
|
+
"FOS_P2P_USERNAME"
|
18
|
+
end
|
19
|
+
|
20
|
+
def as_json_routing_info
|
21
|
+
{
|
22
|
+
username: username
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
module ClientSupport
|
27
|
+
def p2p_username_transfers(options = {})
|
28
|
+
Transfer::P2pUsername.all(options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def p2p_username_transfer(id)
|
32
|
+
Transfer::P2pUsername.find(id)
|
33
|
+
end
|
34
|
+
|
35
|
+
def build_p2p_username_transfer(attributes = {})
|
36
|
+
Transfer::P2pUsername.new(attributes)
|
37
|
+
end
|
38
|
+
|
39
|
+
def update_p2p_username_transfer(id, attributes = {})
|
40
|
+
Transfer::P2pUsername.new(attributes.merge(id: id))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module FidorApi
|
2
|
+
module Transfer
|
3
|
+
class SEPA < Base
|
4
|
+
extend ModelAttribute
|
5
|
+
extend AmountAttributes
|
6
|
+
|
7
|
+
self.endpoint = Connectivity::Endpoint.new('/sepa_credit_transfers', :collection)
|
8
|
+
|
9
|
+
attribute :id, :integer
|
10
|
+
attribute :account_id, :string
|
11
|
+
attribute :user_id, :string
|
12
|
+
attribute :transaction_id, :string
|
13
|
+
attribute :remote_iban, :string
|
14
|
+
attribute :remote_bic, :string
|
15
|
+
attribute :remote_name, :string
|
16
|
+
attribute :external_uid, :string
|
17
|
+
attribute :subject, :string
|
18
|
+
attribute :currency, :string
|
19
|
+
attribute :subject, :string
|
20
|
+
attribute :state, :string
|
21
|
+
attribute :created_at, :time
|
22
|
+
attribute :updated_at, :time
|
23
|
+
amount_attribute :amount
|
24
|
+
|
25
|
+
def self.required_attributes
|
26
|
+
[ :account_id, :external_uid, :remote_iban, :remote_name, :amount, :subject ]
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.writeable_attributes
|
30
|
+
required_attributes + [:remote_bic]
|
31
|
+
end
|
32
|
+
|
33
|
+
validates *required_attributes, presence: true
|
34
|
+
|
35
|
+
def as_json
|
36
|
+
attributes.slice *self.class.writeable_attributes
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
module ClientSupport
|
42
|
+
def sepa_transfers(options = {})
|
43
|
+
Transfer::SEPA.all(options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def sepa_transfer(id)
|
47
|
+
Transfer::SEPA.find(id)
|
48
|
+
end
|
49
|
+
|
50
|
+
def build_sepa_transfer(attributes = {})
|
51
|
+
Transfer::SEPA.new(attributes)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module FidorApi
|
2
|
+
module Transfer
|
3
|
+
class Swift < Base
|
4
|
+
include Generic
|
5
|
+
|
6
|
+
validates :contact_name, presence: true, unless: :beneficiary_reference_passed?
|
7
|
+
|
8
|
+
attribute :account_number, :string
|
9
|
+
attribute :swift_code, :string
|
10
|
+
attribute :account_currency, :string
|
11
|
+
|
12
|
+
validates :account_number, presence: true, unless: :beneficiary_reference_passed?
|
13
|
+
validates :swift_code, presence: true, unless: :beneficiary_reference_passed?
|
14
|
+
validates :account_currency, presence: true, unless: :beneficiary_reference_passed?
|
15
|
+
|
16
|
+
def set_attributes(attrs = {})
|
17
|
+
set_beneficiary_attributes(attrs)
|
18
|
+
self.account_number = attrs.fetch("beneficiary", {}).fetch("routing_info", {})["account_number"]
|
19
|
+
self.swift_code = attrs.fetch("beneficiary", {}).fetch("routing_info", {})["swift_code"]
|
20
|
+
self.account_currency = attrs.fetch("beneficiary", {}).fetch("routing_info", {})["account_currency"]
|
21
|
+
super(attrs.except("beneficiary"))
|
22
|
+
end
|
23
|
+
|
24
|
+
def as_json_routing_type
|
25
|
+
"SWIFT"
|
26
|
+
end
|
27
|
+
|
28
|
+
def as_json_routing_info
|
29
|
+
{
|
30
|
+
account_number: account_number,
|
31
|
+
swift_code: swift_code,
|
32
|
+
account_currency: account_currency
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def remote_create
|
39
|
+
response = endpoint.for(self).post(payload: self.as_json)
|
40
|
+
|
41
|
+
if path = response.headers["X-Fidor-Confirmation-Path"]
|
42
|
+
self.confirmable_action = ConfirmableAction.new(id: path.split("/").last)
|
43
|
+
end
|
44
|
+
|
45
|
+
response
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module FidorApi
|
2
|
+
module Transfer
|
3
|
+
class Utility < Base
|
4
|
+
include Generic
|
5
|
+
|
6
|
+
attribute :utility_provider, :string
|
7
|
+
attribute :utility_service, :string
|
8
|
+
attribute :utility_service_number, :string
|
9
|
+
attribute :inquiry_ref_num, :string
|
10
|
+
|
11
|
+
validates :utility_provider, presence: true
|
12
|
+
validates :utility_service, presence: true
|
13
|
+
validates :utility_service_number, presence: true
|
14
|
+
validates :inquiry_ref_num, presence: true
|
15
|
+
|
16
|
+
def set_attributes(attrs = {})
|
17
|
+
self.utility_provider = attrs.fetch("beneficiary", {}).fetch("routing_info", {})["utility_provider"]
|
18
|
+
self.utility_service = attrs.fetch("beneficiary", {}).fetch("routing_info", {})["utility_service"]
|
19
|
+
self.utility_service_number = attrs.fetch("beneficiary", {}).fetch("routing_info", {})["utility_service_number"]
|
20
|
+
self.inquiry_ref_num = attrs.fetch("routing_info", {})["inquiry_ref_num"]
|
21
|
+
super(attrs.except("routing_type", "routing_info"))
|
22
|
+
end
|
23
|
+
|
24
|
+
def as_json_routing_type
|
25
|
+
"UTILITY"
|
26
|
+
end
|
27
|
+
|
28
|
+
def as_json_routing_info
|
29
|
+
{
|
30
|
+
utility_provider: utility_provider,
|
31
|
+
utility_service: utility_service,
|
32
|
+
utility_service_number: utility_service_number,
|
33
|
+
inquiry_ref_num: inquiry_ref_num
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def remote_create
|
40
|
+
response = endpoint.for(self).post(payload: self.as_json)
|
41
|
+
|
42
|
+
if path = response.headers["X-Fidor-Confirmation-Path"]
|
43
|
+
self.confirmable_action = ConfirmableAction.new(id: path.split("/").last)
|
44
|
+
end
|
45
|
+
|
46
|
+
response
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/fidor_api/transfer.rb
CHANGED
@@ -1,190 +1,17 @@
|
|
1
1
|
module FidorApi
|
2
|
-
|
3
2
|
module Transfer
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.find(access_token, id)
|
20
|
-
new(request(access_token: access_token, endpoint: "/#{resource}/#{id}").body)
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
class Internal < Base
|
26
|
-
extend ModelAttribute
|
27
|
-
extend AmountAttributes
|
28
|
-
|
29
|
-
attribute :id, :integer
|
30
|
-
attribute :account_id, :string
|
31
|
-
attribute :user_id, :string
|
32
|
-
attribute :transaction_id, :string
|
33
|
-
attribute :receiver, :string
|
34
|
-
attribute :external_uid, :string
|
35
|
-
attribute :currency, :string
|
36
|
-
attribute :subject, :string
|
37
|
-
attribute :state, :string
|
38
|
-
attribute :created_at, :time
|
39
|
-
attribute :updated_at, :time
|
40
|
-
amount_attribute :amount
|
41
|
-
|
42
|
-
def self.required_attributes
|
43
|
-
[ :account_id, :receiver, :external_uid, :amount, :subject ]
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.writeable_attributes
|
47
|
-
required_attributes
|
48
|
-
end
|
49
|
-
|
50
|
-
validates *required_attributes, presence: true
|
51
|
-
|
52
|
-
def as_json
|
53
|
-
attributes.slice *self.class.writeable_attributes
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
def self.resource
|
59
|
-
"internal_transfers"
|
60
|
-
end
|
61
|
-
|
62
|
-
module ClientSupport
|
63
|
-
def internal_transfers(options = {})
|
64
|
-
Transfer::Internal.all(token.access_token, options)
|
65
|
-
end
|
66
|
-
|
67
|
-
def internal_transfer(id)
|
68
|
-
Transfer::Internal.find(token.access_token, id)
|
69
|
-
end
|
70
|
-
|
71
|
-
def build_internal_transfer(attributes = {})
|
72
|
-
Transfer::Internal.new(attributes.merge(client: self))
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
class SEPA < Base
|
78
|
-
extend ModelAttribute
|
79
|
-
extend AmountAttributes
|
80
|
-
|
81
|
-
attribute :id, :integer
|
82
|
-
attribute :account_id, :string
|
83
|
-
attribute :user_id, :string
|
84
|
-
attribute :transaction_id, :string
|
85
|
-
attribute :remote_iban, :string
|
86
|
-
attribute :remote_bic, :string
|
87
|
-
attribute :remote_name, :string
|
88
|
-
attribute :external_uid, :string
|
89
|
-
attribute :subject, :string
|
90
|
-
attribute :currency, :string
|
91
|
-
attribute :subject, :string
|
92
|
-
attribute :state, :string
|
93
|
-
attribute :created_at, :time
|
94
|
-
attribute :updated_at, :time
|
95
|
-
amount_attribute :amount
|
96
|
-
|
97
|
-
def self.required_attributes
|
98
|
-
[ :account_id, :external_uid, :remote_iban, :remote_name, :amount, :subject ]
|
99
|
-
end
|
100
|
-
|
101
|
-
def self.writeable_attributes
|
102
|
-
required_attributes + [:remote_bic]
|
103
|
-
end
|
104
|
-
|
105
|
-
validates *required_attributes, presence: true
|
106
|
-
|
107
|
-
def as_json
|
108
|
-
attributes.slice *self.class.writeable_attributes
|
109
|
-
end
|
110
|
-
|
111
|
-
private
|
112
|
-
|
113
|
-
def self.resource
|
114
|
-
"sepa_credit_transfers"
|
115
|
-
end
|
116
|
-
|
117
|
-
module ClientSupport
|
118
|
-
def sepa_transfers(options = {})
|
119
|
-
Transfer::SEPA.all(token.access_token, options)
|
120
|
-
end
|
121
|
-
|
122
|
-
def sepa_transfer(id)
|
123
|
-
Transfer::SEPA.find(token.access_token, id)
|
124
|
-
end
|
125
|
-
|
126
|
-
def build_sepa_transfer(attributes = {})
|
127
|
-
Transfer::SEPA.new(attributes.merge(client: self))
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
class FPS < Base
|
133
|
-
extend ModelAttribute
|
134
|
-
extend AmountAttributes
|
135
|
-
|
136
|
-
attribute :id, :integer
|
137
|
-
attribute :account_id, :string
|
138
|
-
attribute :user_id, :string
|
139
|
-
attribute :transaction_id, :string
|
140
|
-
attribute :remote_account, :string
|
141
|
-
attribute :remote_sort_code, :string
|
142
|
-
attribute :remote_name, :string
|
143
|
-
attribute :external_uid, :string
|
144
|
-
attribute :subject, :string
|
145
|
-
attribute :currency, :string
|
146
|
-
attribute :subject, :string
|
147
|
-
attribute :state, :string
|
148
|
-
attribute :created_at, :time
|
149
|
-
attribute :updated_at, :time
|
150
|
-
amount_attribute :amount
|
151
|
-
|
152
|
-
def self.required_attributes
|
153
|
-
[ :account_id, :external_uid, :remote_account, :remote_sort_code, :remote_name, :amount, :subject ]
|
154
|
-
end
|
155
|
-
|
156
|
-
def self.writeable_attributes
|
157
|
-
required_attributes
|
158
|
-
end
|
159
|
-
|
160
|
-
validates *required_attributes, presence: true
|
161
|
-
|
162
|
-
def as_json
|
163
|
-
attributes.slice *self.class.writeable_attributes
|
164
|
-
end
|
165
|
-
|
166
|
-
private
|
167
|
-
|
168
|
-
def self.resource
|
169
|
-
"fps_transfers"
|
170
|
-
end
|
171
|
-
|
172
|
-
module ClientSupport
|
173
|
-
def fps_transfers(options = {})
|
174
|
-
Transfer::FPS.all(token.access_token, options)
|
175
|
-
end
|
176
|
-
|
177
|
-
def fps_transfer(id)
|
178
|
-
Transfer::FPS.find(token.access_token, id)
|
179
|
-
end
|
180
|
-
|
181
|
-
def build_fps_transfer(attributes = {})
|
182
|
-
Transfer::FPS.new(attributes.merge(client: self))
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
3
|
+
autoload :ACH, 'fidor_api/transfer/ach'
|
4
|
+
autoload :Base, 'fidor_api/transfer/base'
|
5
|
+
autoload :FPS, 'fidor_api/transfer/fps'
|
6
|
+
autoload :Generic, 'fidor_api/transfer/generic'
|
7
|
+
autoload :Internal, 'fidor_api/transfer/internal'
|
8
|
+
autoload :P2pAccountNumber, 'fidor_api/transfer/p2p_account_number'
|
9
|
+
autoload :P2pPhone, 'fidor_api/transfer/p2p_phone'
|
10
|
+
autoload :P2pUsername, 'fidor_api/transfer/p2p_username'
|
11
|
+
autoload :Pending, 'fidor_api/transfer/pending'
|
12
|
+
autoload :SEPA, 'fidor_api/transfer/sepa'
|
13
|
+
autoload :Swift, 'fidor_api/transfer/swift'
|
14
|
+
autoload :BankInternal, 'fidor_api/transfer/bank_internal'
|
15
|
+
autoload :Utility, 'fidor_api/transfer/utility'
|
187
16
|
end
|
188
|
-
|
189
17
|
end
|
190
|
-
|
data/lib/fidor_api/user.rb
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
module FidorApi
|
2
|
-
|
3
|
-
class User < Resource
|
2
|
+
class User < Connectivity::Resource
|
4
3
|
extend ModelAttribute
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
attribute :
|
9
|
-
attribute :
|
10
|
-
attribute :
|
5
|
+
self.endpoint = Connectivity::Endpoint.new('/users', :collection)
|
6
|
+
|
7
|
+
attribute :id, :integer
|
8
|
+
attribute :email, :string
|
9
|
+
attribute :msisdn_activated_at, :time
|
10
|
+
attribute :last_sign_in_at, :string
|
11
|
+
attribute :created_at, :time
|
12
|
+
attribute :updated_at, :time
|
11
13
|
|
12
|
-
def self.current
|
13
|
-
new(
|
14
|
+
def self.current
|
15
|
+
new endpoint.for(self).get(action: 'current').body
|
14
16
|
end
|
15
17
|
|
16
18
|
module ClientSupport
|
17
19
|
def current_user
|
18
|
-
User.current
|
20
|
+
User.current
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
22
|
-
|
23
24
|
end
|
data/lib/fidor_api/version.rb
CHANGED
data/lib/fidor_api.rb
CHANGED
@@ -10,36 +10,53 @@ module FidorApi
|
|
10
10
|
|
11
11
|
attr_accessor :configuration
|
12
12
|
|
13
|
+
autoload :Account, 'fidor_api/account'
|
14
|
+
autoload :AmountAttributes, 'fidor_api/amount_attributes'
|
15
|
+
autoload :ApprovalRequired, 'fidor_api/approval_required'
|
16
|
+
autoload :Auth, 'fidor_api/auth'
|
17
|
+
autoload :Beneficiary, 'fidor_api/beneficiary'
|
18
|
+
autoload :Card, 'fidor_api/card'
|
19
|
+
autoload :CardLimitAttribute, 'fidor_api/card_limit_attribute'
|
20
|
+
autoload :CardLimits, 'fidor_api/card_limits'
|
21
|
+
autoload :Client, 'fidor_api/client'
|
22
|
+
autoload :Collection, 'fidor_api/collection'
|
23
|
+
autoload :ConfirmableAction, 'fidor_api/confirmable_action'
|
24
|
+
autoload :Connectivity, 'fidor_api/connectivity'
|
25
|
+
autoload :Customer, 'fidor_api/customer'
|
26
|
+
autoload :Customers, 'fidor_api/customers/confirmations'
|
27
|
+
autoload :Message, 'fidor_api/message'
|
28
|
+
autoload :Msisdn, 'fidor_api/msisdn'
|
29
|
+
autoload :Password, 'fidor_api/password'
|
30
|
+
autoload :Preauth, 'fidor_api/preauth'
|
31
|
+
autoload :PreauthDetails, 'fidor_api/preauth_details'
|
32
|
+
autoload :SessionToken, 'fidor_api/session_token'
|
33
|
+
autoload :Token, 'fidor_api/token'
|
34
|
+
autoload :TransactionDetails, 'fidor_api/transaction_details'
|
35
|
+
autoload :Transaction, 'fidor_api/transaction'
|
36
|
+
autoload :Transfer, 'fidor_api/transfer'
|
37
|
+
autoload :User, 'fidor_api/user'
|
38
|
+
autoload :Version, 'fidor_api/version'
|
39
|
+
|
13
40
|
class Configuration
|
14
|
-
attr_accessor :callback_url, :oauth_url, :api_url, :client_id, :client_secret, :htauth_user, :htauth_password, :affiliate_uid, :os_type, :logging
|
41
|
+
attr_accessor :callback_url, :oauth_url, :api_url, :api_path, :client_id, :client_secret, :htauth_user, :htauth_password, :affiliate_uid, :os_type, :logging, :logger, :verify_ssl
|
15
42
|
end
|
16
43
|
|
17
44
|
def configure
|
18
45
|
self.configuration = Configuration.new.tap do |config|
|
19
|
-
config.logging
|
20
|
-
config.
|
46
|
+
config.logging = true
|
47
|
+
config.logger = Logger.new(STDOUT)
|
48
|
+
config.os_type = "iOS" # NOTE: As long as there is only iOS or Android we have to tell a fib ;)
|
49
|
+
config.verify_ssl = true
|
21
50
|
end
|
22
51
|
yield configuration
|
52
|
+
|
53
|
+
begin
|
54
|
+
require "faraday/detailed_logger"
|
55
|
+
rescue LoadError
|
56
|
+
configuration.logger.debug "NOTE: Install `faraday-detailed_logger` gem to get detailed log-output for debugging."
|
57
|
+
end
|
23
58
|
end
|
24
59
|
end
|
25
60
|
|
26
|
-
require "fidor_api/version"
|
27
61
|
require "fidor_api/errors"
|
28
|
-
require "fidor_api/
|
29
|
-
require "fidor_api/auth"
|
30
|
-
require "fidor_api/resource"
|
31
|
-
require "fidor_api/collection"
|
32
|
-
require "fidor_api/amount_attributes"
|
33
|
-
require "fidor_api/user"
|
34
|
-
require "fidor_api/account"
|
35
|
-
require "fidor_api/card"
|
36
|
-
require "fidor_api/card_limits"
|
37
|
-
require "fidor_api/customer"
|
38
|
-
require "fidor_api/message"
|
39
|
-
require "fidor_api/msisdn"
|
40
|
-
require "fidor_api/transaction_details"
|
41
|
-
require "fidor_api/transaction"
|
42
|
-
require "fidor_api/preauth_details"
|
43
|
-
require "fidor_api/preauth"
|
44
|
-
require "fidor_api/transfer"
|
45
|
-
require "fidor_api/client"
|
62
|
+
require "fidor_api/constants"
|