fidor_api 1.0.0 → 2.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -49
  3. data/Rakefile +6 -3
  4. data/lib/fidor_api/client/authentication.rb +63 -0
  5. data/lib/fidor_api/client/configuration.rb +32 -0
  6. data/lib/fidor_api/client/connection.rb +56 -0
  7. data/lib/fidor_api/client/dsl/confirmable_actions.rb +19 -0
  8. data/lib/fidor_api/client/dsl/core_data.rb +19 -0
  9. data/lib/fidor_api/client/dsl/messages.rb +31 -0
  10. data/lib/fidor_api/client/dsl/transactions.rb +15 -0
  11. data/lib/fidor_api/client/dsl/transfers/classic.rb +29 -0
  12. data/lib/fidor_api/client/dsl/transfers/generic.rb +34 -0
  13. data/lib/fidor_api/client/dsl/transfers.rb +22 -0
  14. data/lib/fidor_api/client/dsl.rb +59 -0
  15. data/lib/fidor_api/client.rb +17 -21
  16. data/lib/fidor_api/collection/kaminari_support.rb +17 -0
  17. data/lib/fidor_api/collection.rb +18 -34
  18. data/lib/fidor_api/environment/base.rb +21 -0
  19. data/lib/fidor_api/environment/fidor_de/production.rb +23 -0
  20. data/lib/fidor_api/environment/fidor_de/sandbox.rb +23 -0
  21. data/lib/fidor_api/environment/fidor_de.rb +8 -0
  22. data/lib/fidor_api/environment/future.rb +21 -0
  23. data/lib/fidor_api/environment.rb +7 -0
  24. data/lib/fidor_api/errors.rb +3 -26
  25. data/lib/fidor_api/model/account.rb +25 -0
  26. data/lib/fidor_api/model/base.rb +44 -0
  27. data/lib/fidor_api/model/confirmable_action.rb +9 -0
  28. data/lib/fidor_api/model/customer.rb +36 -0
  29. data/lib/fidor_api/model/helpers/action_view_support.rb +21 -0
  30. data/lib/fidor_api/model/helpers/attribute_decimal_methods.rb +32 -0
  31. data/lib/fidor_api/model/helpers.rb +8 -0
  32. data/lib/fidor_api/model/message.rb +23 -0
  33. data/lib/fidor_api/model/transaction.rb +21 -0
  34. data/lib/fidor_api/model/transfer/classic/base.rb +15 -0
  35. data/lib/fidor_api/model/transfer/classic/internal.rb +20 -0
  36. data/lib/fidor_api/model/transfer/classic/sepa.rb +11 -0
  37. data/lib/fidor_api/model/transfer/classic.rb +11 -0
  38. data/lib/fidor_api/model/transfer/generic.rb +71 -0
  39. data/lib/fidor_api/model/transfer.rb +8 -0
  40. data/lib/fidor_api/model/user.rb +10 -0
  41. data/lib/fidor_api/model.rb +13 -0
  42. data/lib/fidor_api/token.rb +13 -18
  43. data/lib/fidor_api/version.rb +1 -1
  44. data/lib/fidor_api.rb +14 -58
  45. metadata +152 -89
  46. data/.gitignore +0 -11
  47. data/.rspec +0 -2
  48. data/.ruby-gemset +0 -1
  49. data/.ruby-version +0 -1
  50. data/.travis.yml +0 -20
  51. data/CHANGELOG.md +0 -129
  52. data/Gemfile +0 -15
  53. data/LICENSE.txt +0 -21
  54. data/bin/console +0 -14
  55. data/bin/setup +0 -7
  56. data/fidor_api.gemspec +0 -24
  57. data/lib/fidor_api/account.rb +0 -45
  58. data/lib/fidor_api/amount_attributes.rb +0 -30
  59. data/lib/fidor_api/approval_required.rb +0 -9
  60. data/lib/fidor_api/auth.rb +0 -45
  61. data/lib/fidor_api/beneficiary/ach.rb +0 -39
  62. data/lib/fidor_api/beneficiary/base.rb +0 -118
  63. data/lib/fidor_api/beneficiary/generic.rb +0 -24
  64. data/lib/fidor_api/beneficiary/p2p_account_number.rb +0 -14
  65. data/lib/fidor_api/beneficiary/p2p_phone.rb +0 -14
  66. data/lib/fidor_api/beneficiary/p2p_username.rb +0 -14
  67. data/lib/fidor_api/beneficiary/swift.rb +0 -35
  68. data/lib/fidor_api/beneficiary/unknown.rb +0 -16
  69. data/lib/fidor_api/beneficiary/utility.rb +0 -35
  70. data/lib/fidor_api/beneficiary.rb +0 -27
  71. data/lib/fidor_api/card.rb +0 -77
  72. data/lib/fidor_api/card_limit_attribute.rb +0 -52
  73. data/lib/fidor_api/card_limits.rb +0 -14
  74. data/lib/fidor_api/confirmable_action.rb +0 -45
  75. data/lib/fidor_api/connectivity/connection.rb +0 -113
  76. data/lib/fidor_api/connectivity/endpoint.rb +0 -82
  77. data/lib/fidor_api/connectivity/resource.rb +0 -76
  78. data/lib/fidor_api/connectivity.rb +0 -17
  79. data/lib/fidor_api/constants.rb +0 -3
  80. data/lib/fidor_api/customer.rb +0 -140
  81. data/lib/fidor_api/customers/confirmations.rb +0 -19
  82. data/lib/fidor_api/message.rb +0 -52
  83. data/lib/fidor_api/msisdn.rb +0 -45
  84. data/lib/fidor_api/password.rb +0 -29
  85. data/lib/fidor_api/preauth.rb +0 -33
  86. data/lib/fidor_api/preauth_details.rb +0 -97
  87. data/lib/fidor_api/session_token.rb +0 -20
  88. data/lib/fidor_api/transaction.rb +0 -37
  89. data/lib/fidor_api/transaction_details.rb +0 -119
  90. data/lib/fidor_api/transfer/ach.rb +0 -46
  91. data/lib/fidor_api/transfer/bank_internal.rb +0 -37
  92. data/lib/fidor_api/transfer/base.rb +0 -36
  93. data/lib/fidor_api/transfer/fps.rb +0 -56
  94. data/lib/fidor_api/transfer/generic.rb +0 -134
  95. data/lib/fidor_api/transfer/internal.rb +0 -53
  96. data/lib/fidor_api/transfer/p2p_account_number.rb +0 -45
  97. data/lib/fidor_api/transfer/p2p_phone.rb +0 -45
  98. data/lib/fidor_api/transfer/p2p_username.rb +0 -45
  99. data/lib/fidor_api/transfer/sepa.rb +0 -56
  100. data/lib/fidor_api/transfer/swift.rb +0 -49
  101. data/lib/fidor_api/transfer/utility.rb +0 -50
  102. data/lib/fidor_api/transfer.rb +0 -17
  103. data/lib/fidor_api/user.rb +0 -24
@@ -1,113 +0,0 @@
1
- module FidorApi
2
- module Connectivity
3
- module Connection
4
- extend self
5
-
6
- Response = Struct.new(:status, :headers, :raw_body) do
7
- def body
8
- if headers["content-type"] =~ /json/
9
- JSON.parse(raw_body)
10
- else
11
- raw_body
12
- end
13
- end
14
- end
15
-
16
- def get(path, options={})
17
- request(:get, path, options)
18
- end
19
-
20
- def post(path, options={})
21
- request(:post, path, options)
22
- end
23
-
24
- def put(path, options={})
25
- request(:put, path, options)
26
- end
27
-
28
- def delete(path, options={})
29
- request(:delete, path, options)
30
- end
31
-
32
- def with_token(token)
33
- self.access_token = token
34
- yield
35
- end
36
-
37
- private
38
-
39
- def request(method, path, options={})
40
- options.reverse_merge! version: 1, access_token: Connectivity.access_token
41
- response = faraday.public_send(method, [FidorApi.configuration.api_path, path].compact.join) do |request|
42
- request.params = options[:query_params] if options[:query_params]
43
- request.headers = {}
44
- if options[:access_token]
45
- request.headers["Authorization"] = "Bearer #{options[:access_token]}"
46
- else
47
- request.headers["Authorization"] = tokenless_http_basic_header
48
- end
49
- request.headers["Accept"] = "application/vnd.fidor.de; version=#{options[:version]},text/json"
50
- request.headers["Content-Type"] = "application/json"
51
- if options[:body]
52
- if options[:body].is_a?(String)
53
- request.body = options[:body]
54
- elsif options[:body].respond_to?(:to_json)
55
- request.body = options[:body].to_json
56
- else
57
- fail ArgumentError, "unhandled body type #{options[:body].inspect}"
58
- end
59
- end
60
- end
61
- if response.status == 303 && URI.parse(response.headers["Location"]).path =~ /^(\/fidor_api)?\/confirmable\//
62
- confirmable_action = ConfirmableAction.new(id: URI.parse(response.headers["Location"]).path.split("/").last)
63
- raise ApprovalRequired.new(confirmable_action)
64
- end
65
- Response.new(response.status, response.headers, response.body)
66
- rescue Faraday::Error::ClientError => e
67
- log :info, "Error (#{e.class.name}): #{e.to_s}\nStatus: #{e.response[:status]}"
68
- log :debug, "Header: #{e.response[:header]}\nBody: #{e.response[:body]}" if e.response[:status] != 500
69
- case e.response[:status]
70
- when 401
71
- raise UnauthorizedTokenError
72
- when 403
73
- body = JSON.parse(e.response[:body])
74
- raise ForbiddenError.new(body["message"], body["code"], body["key"])
75
- when 422
76
- body = JSON.parse(e.response[:body])
77
- raise ValidationError.new(body["message"], body["errors"], body["key"])
78
- else
79
- raise ClientError.new(e.response[:body])
80
- end
81
- end
82
-
83
- def log(level, message)
84
- return unless FidorApi.configuration.logging
85
- FidorApi.configuration.logger.public_send(level, message)
86
- end
87
-
88
- def logger_type
89
- if defined?(Faraday::DetailedLogger)
90
- :detailed_logger
91
- else
92
- :logger
93
- end
94
- end
95
-
96
- def tokenless_http_basic_header
97
- @tokenless_http_basic_header ||= begin
98
- base64 = Base64.strict_encode64("#{FidorApi.configuration.htauth_user}:#{FidorApi.configuration.htauth_password}")
99
- "Basic #{base64}"
100
- end
101
- end
102
-
103
- def faraday
104
- @faraday ||= Faraday.new(url: FidorApi.configuration.api_url, ssl: { verify: FidorApi.configuration.verify_ssl }) do |config|
105
- config.request :url_encoded
106
- config.response logger_type, FidorApi.configuration.logger if FidorApi.configuration.logging
107
- config.response :raise_error
108
- config.adapter Faraday.default_adapter
109
- end
110
- end
111
- end
112
- end
113
- end
@@ -1,82 +0,0 @@
1
- module FidorApi
2
- module Connectivity
3
- class Endpoint
4
- attr_reader :collection, :resource, :version, :tokenless
5
-
6
- def initialize(path, mode, version: '1', tokenless: false)
7
- @path = path
8
- @version = version
9
- @tokenless = tokenless
10
-
11
- case mode
12
- when :collection
13
- @collection = path
14
- @resource = "#{path}/:id"
15
- when :resource
16
- @resource = path
17
- else
18
- fail ArgumentError, "mode #{mode.inspect} must be resource or collection"
19
- end
20
- end
21
-
22
- class Context
23
- def initialize(endpoint, object)
24
- @endpoint = endpoint
25
- @object = object
26
- end
27
-
28
- def get(target: :resource, action: nil, query_params: nil, tokenless: nil)
29
- request :get, target, action, query_params: query_params, tokenless: tokenless
30
- end
31
-
32
- def post(target: :collection, action: nil, payload: nil, tokenless: nil)
33
- request :post, target, action, body: payload, tokenless: tokenless
34
- end
35
-
36
- def put(target: :resource, action: nil, payload: nil, tokenless: nil)
37
- request :put, target, action, body: payload, tokenless: tokenless
38
- end
39
-
40
- def delete(target: :resource, action: nil, tokenless: nil)
41
- request :delete, target, action, tokenless: tokenless
42
- end
43
-
44
- private
45
-
46
- def request(method, target, action, options = {})
47
- options.reverse_merge! version: @endpoint.version
48
- options[:access_token] = nil if options[:tokenless] || @endpoint.tokenless
49
- Connection.public_send(method, send("#{target}_path", action), options)
50
- end
51
-
52
- def resource_path(action = nil)
53
- interpolate(@endpoint.resource, action)
54
- end
55
-
56
- def collection_path(action = nil)
57
- interpolate(@endpoint.collection, action)
58
- end
59
-
60
- def interpolate(path, suffix = nil)
61
- [path, suffix].compact.join('/').gsub(/:(\w+)/) do |m|
62
- fetch_option $1
63
- end
64
- end
65
-
66
- def fetch_option(name)
67
- if @object.kind_of? Hash
68
- @object[name]
69
- elsif @object.class.name.in?(INTEGER_CLASSES) || @object.kind_of?(String)
70
- @object
71
- elsif @object.respond_to? name
72
- @object.public_send name
73
- end
74
- end
75
- end
76
-
77
- def for(object)
78
- Context.new(self, object)
79
- end
80
- end
81
- end
82
- end
@@ -1,76 +0,0 @@
1
- module FidorApi
2
- module Connectivity
3
- class Resource
4
- include ActiveModel::Model
5
- extend ModelAttribute
6
-
7
- class_attribute :endpoint
8
-
9
- attr_accessor :error_keys
10
-
11
- class << self
12
- def find(id)
13
- new endpoint.for(id).get.body.reverse_merge(id: id)
14
- end
15
-
16
- def all(options = {})
17
- FidorApi::Collection.build self, endpoint.for(self).get(target: :collection, query_params: options).body
18
- end
19
-
20
- def model_name
21
- ActiveModel::Name.new(self, nil, self.name.sub("FidorApi::", ""))
22
- end
23
- end
24
-
25
- def initialize(attributes = {})
26
- set_attributes attributes
27
- end
28
-
29
- def reload
30
- set_attributes endpoint.for(self).get.body
31
- end
32
-
33
- def persisted?
34
- id.present?
35
- end
36
-
37
- def save
38
- if valid?
39
- set_attributes(persisted? ? remote_update.body : remote_create.body)
40
- true
41
- else
42
- false
43
- end
44
- rescue ValidationError => e
45
- self.error_keys = e.error_keys
46
- map_errors(e.fields)
47
- false
48
- end
49
-
50
- def update_attributes(attributes={})
51
- set_attributes attributes
52
- valid? and remote_update attributes.keys
53
- end
54
-
55
- private
56
-
57
- def remote_create
58
- endpoint.for(self).post(payload: self.as_json)
59
- end
60
-
61
- def remote_update(*attributes)
62
- payload = self.as_json.with_indifferent_access
63
- payload.slice!(*attributes.flatten) if attributes.present?
64
- endpoint.for(self).put(payload: payload)
65
- end
66
-
67
- def map_errors(fields)
68
- fields.each do |hash|
69
- hash.symbolize_keys!
70
- field = hash[:field].to_sym
71
- errors.add(field, hash[:message], hash) if respond_to?(field) || field == :base
72
- end
73
- end
74
- end
75
- end
76
- end
@@ -1,17 +0,0 @@
1
- module FidorApi
2
- module Connectivity
3
- extend self
4
-
5
- autoload :Connection, 'fidor_api/connectivity/connection'
6
- autoload :Resource, 'fidor_api/connectivity/resource'
7
- autoload :Endpoint, 'fidor_api/connectivity/endpoint'
8
-
9
- def access_token=(val)
10
- Thread.current[:fidor_api_access_token] = val
11
- end
12
-
13
- def access_token
14
- Thread.current[:fidor_api_access_token]
15
- end
16
- end
17
- end
@@ -1,3 +0,0 @@
1
- module FidorApi
2
- INTEGER_CLASSES = %w(Integer Fixnum Bignum)
3
- end
@@ -1,140 +0,0 @@
1
- module FidorApi
2
- class Customer < Connectivity::Resource
3
- extend ModelAttribute
4
-
5
- self.endpoint = Connectivity::Endpoint.new('/customers', :collection)
6
-
7
- module Gender
8
- extend self
9
-
10
- class Base
11
- include Singleton
12
- end
13
-
14
- class Male < Base; end
15
- class Female < Base; end
16
- class Unknown < Base; end
17
-
18
- MAPPING = {
19
- Male => "m",
20
- Female => "f"
21
- }
22
-
23
- def for_api_value(api_value)
24
- MAPPING.key(api_value) || Unknown
25
- end
26
-
27
- def object_to_string(object)
28
- MAPPING[object]
29
- end
30
- end
31
-
32
- attribute :id, :integer
33
- attribute :email, :string
34
- attribute :first_name, :string
35
- attribute :last_name, :string
36
- attribute :gender, :string
37
- attribute :title, :string
38
- attribute :nick, :string
39
- attribute :maiden_name, :string
40
- attribute :adr_street, :string
41
- attribute :adr_street_number, :string
42
- attribute :adr_post_code, :string
43
- attribute :adr_city, :string
44
- attribute :adr_country, :string
45
- attribute :adr_phone, :string
46
- attribute :adr_mobile, :string
47
- attribute :adr_fax, :string
48
- attribute :adr_businessphone, :string
49
- attribute :birthday, :time
50
- attribute :is_verified, :boolean
51
- attribute :nationality, :string
52
- attribute :marital_status, :integer
53
- attribute :religion, :integer
54
- attribute :id_card_registration_city, :string
55
- attribute :id_card_number, :string
56
- attribute :id_card_valid_until, :time
57
- attribute :created_at, :time
58
- attribute :updated_at, :time
59
- attribute :creditor_identifier, :string
60
- attribute :affiliate_uid, :string
61
- attribute :verification_token, :string
62
- attribute :password, :string
63
- attribute :tos, :boolean
64
- attribute :privacy_policy, :boolean
65
- attribute :own_interest, :boolean
66
- attribute :us_citizen, :boolean
67
- attribute :us_tax_payer, :boolean
68
- attribute :preferred_language, :string
69
- attribute :community_user_picture, :string
70
- attribute :country_of_birth, :string
71
- attribute :additional_first_name, :string
72
-
73
- def self.first
74
- all(page: 1, per_page: 1).first
75
- end
76
-
77
- def initialize(*args)
78
- super
79
- self.affiliate_uid = FidorApi.configuration.affiliate_uid
80
- end
81
-
82
- def request_update(attributes)
83
- self.endpoint = Connectivity::Endpoint.new('/customers', :collection, version: '2')
84
- endpoint.for(self).put(action: 'request_update', payload: attributes.as_json)
85
- true
86
- rescue ValidationError => e
87
- map_errors(e.fields)
88
- false
89
- end
90
-
91
- def confirm_update(attributes)
92
- self.endpoint = Connectivity::Endpoint.new('/customers', :collection, version: '2')
93
- endpoint.for(self).put(action: 'confirm_update', payload: {token: attributes['token']})
94
- end
95
-
96
- def gender
97
- Gender.for_api_value(@gender)
98
- end
99
-
100
- def gender=(value)
101
- @gender = if value.class == Class && value.instance.is_a?(FidorApi::Customer::Gender::Base)
102
- Gender.object_to_string(value)
103
- else
104
- value
105
- end
106
- end
107
-
108
- def as_json(options = nil)
109
- attributes.tap { |a| a[:birthday] = a[:birthday].try(:to_date) }
110
- end
111
-
112
- private
113
-
114
- def remote_create
115
- endpoint.for(self).post(payload: self.as_json, tokenless: true)
116
- end
117
-
118
- module ClientSupport
119
- def customers(options = {})
120
- Customer.all(options)
121
- end
122
-
123
- def first_customer
124
- Customer.first
125
- end
126
-
127
- def update_customer(id, attributes)
128
- Customer.endpoint.for(id).put(payload: attributes)
129
- end
130
-
131
- def request_customer_update(id, attributes)
132
- Customer.new(id: id).request_update(attributes)
133
- end
134
-
135
- def confirm_customer_update(id, attributes)
136
- Customer.new(id: id).confirm_update(attributes)
137
- end
138
- end
139
- end
140
- end
@@ -1,19 +0,0 @@
1
- module FidorApi
2
- module Customers
3
- class Confirmations < Connectivity::Resource
4
- extend ModelAttribute
5
-
6
- self.endpoint = Connectivity::Endpoint.new('/customers/confirmation', :collection)
7
-
8
- def self.create(*attributes)
9
- new(*attributes).save
10
- end
11
-
12
- private
13
-
14
- def persisted?
15
- false
16
- end
17
- end
18
- end
19
- end
@@ -1,52 +0,0 @@
1
- module FidorApi
2
- class Message < Connectivity::Resource
3
- extend ModelAttribute
4
- extend AmountAttributes
5
-
6
- self.endpoint = Connectivity::Endpoint.new('/messages', :collection)
7
-
8
- attribute :id, :integer
9
- attribute :subject, :string
10
- attribute :type, :string
11
- attribute :opened_at, :time
12
- attribute :created_at, :time
13
- attribute :updated_at, :time
14
- attribute :category, :string
15
-
16
- class Attachment
17
- include ActiveModel::Model
18
- attr_accessor :type, :filename, :content
19
- end
20
-
21
- def attachment
22
- response = endpoint.for(self).get(action: 'attachment')
23
- Attachment.new(
24
- type: response.headers["content-type"],
25
- filename: response.headers["content-disposition"][/filename="([^"]+)"/, 1],
26
- content: response.body,
27
- )
28
- end
29
-
30
- def content
31
- endpoint.for(self).get(action: 'content').body
32
- end
33
-
34
- module ClientSupport
35
- def messages(options = {})
36
- Message.all(options)
37
- end
38
-
39
- def message(id)
40
- Message.find(id)
41
- end
42
-
43
- def message_attachment(id)
44
- Message.new(id: id).attachment
45
- end
46
-
47
- def message_content(id)
48
- Message.new(id: id).content
49
- end
50
- end
51
- end
52
- end
@@ -1,45 +0,0 @@
1
- module FidorApi
2
-
3
- module Msisdn
4
- extend self
5
-
6
- def check(msisdn)
7
- post "/msisdn/check", {
8
- msisdn: msisdn,
9
- os_type: FidorApi.configuration.os_type,
10
- affiliate_uid: FidorApi.configuration.affiliate_uid
11
- }
12
- end
13
-
14
- def verify(msisdn, code)
15
- post "/msisdn/verify", {
16
- msisdn: msisdn,
17
- code: code
18
- }
19
- end
20
-
21
- private
22
-
23
- def connection
24
- Faraday.new(url: FidorApi.configuration.oauth_url, ssl: { verify: FidorApi.configuration.verify_ssl }) do |config|
25
- config.use Faraday::Request::BasicAuthentication, FidorApi.configuration.htauth_user, FidorApi.configuration.htauth_password
26
- config.request :url_encoded
27
- config.response :logger if FidorApi.configuration.logging
28
- config.response :raise_error
29
- config.adapter Faraday.default_adapter
30
- end
31
- end
32
-
33
- def post(endpoint, body)
34
- response = connection.post endpoint do |request|
35
- request.headers = {
36
- "Accept" => "application/vnd.fidor.de; version=1,text/json",
37
- "Content-Type" => "application/json"
38
- }
39
- request.body = body.to_json
40
- end
41
- response.body
42
- end
43
- end
44
-
45
- end
@@ -1,29 +0,0 @@
1
- module FidorApi
2
- class Password < Connectivity::Resource
3
- extend ModelAttribute
4
-
5
- def self.request_new(email)
6
- endpoint = Connectivity::Endpoint.new("/password_resets/new_token", :resource, version: "2", tokenless: true)
7
- response = endpoint.for(self).put(payload: { email: email, type: "reset_token" })
8
- response.body["success"]
9
- end
10
-
11
- def self.update(attributes)
12
- endpoint = Connectivity::Endpoint.new("/password_resets", :collection, version: "2", tokenless: true)
13
- response = endpoint.for(self).post(payload: attributes)
14
- response.body["success"]
15
- end
16
-
17
- private
18
-
19
- module ClientSupport
20
- def request_new_password(email)
21
- Password.request_new(email)
22
- end
23
-
24
- def update_password(attributes)
25
- Password.update(attributes)
26
- end
27
- end
28
- end
29
- end
@@ -1,33 +0,0 @@
1
- module FidorApi
2
- class Preauth < Connectivity::Resource
3
- extend ModelAttribute
4
- extend AmountAttributes
5
-
6
- self.endpoint = Connectivity::Endpoint.new('/preauths', :collection)
7
-
8
- attribute :id, :integer
9
- attribute :account_id, :string
10
- attribute :preauth_type, :string
11
- attribute :preauth_type_details, :json
12
- attribute :expires_at, :time
13
- attribute :created_at, :time
14
- attribute :updated_at, :time
15
- attribute :currency, :string
16
- amount_attribute :amount
17
-
18
- def preauth_type_details
19
- @_preauth_type_details ||= PreauthDetails.build(@preauth_type, @preauth_type_details)
20
- end
21
-
22
- module ClientSupport
23
- def preauths(options = {})
24
- Preauth.all(options)
25
- end
26
-
27
- def preauth(id)
28
- Preauth.find(id)
29
- end
30
- end
31
- end
32
-
33
- end