Class: Io::Flow::V0::Models::DirectAuthorizationForm
- Inherits:
-
AuthorizationForm
- Object
- AuthorizationForm
- Io::Flow::V0::Models::DirectAuthorizationForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Creates an authorization for a transaction in which you remain the merchant of record. An authorization is used to check and reserve funds w/ a given payment method. No funds are actually transferred; once you have you an authorization, you can capture up to the amount of the authorization.
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#customer ⇒ Object
readonly
Returns the value of attribute customer.
-
#cvv ⇒ Object
readonly
Returns the value of attribute cvv.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Attributes inherited from AuthorizationForm
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DirectAuthorizationForm
constructor
A new instance of DirectAuthorizationForm.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from AuthorizationForm
Constructor Details
#initialize(incoming = {}) ⇒ DirectAuthorizationForm
Returns a new instance of DirectAuthorizationForm.
14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14768 def initialize(incoming={}) super(:discriminator => AuthorizationForm::Types::DIRECT_AUTHORIZATION_FORM) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:token, :amount, :currency], 'DirectAuthorizationForm') @token = HttpClient::Preconditions.assert_class('token', opts.delete(:token), String) @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @customer = (x = opts.delete(:customer); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x))) @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String)) @cvv = (x = opts.delete(:cvv); x.nil? ? nil : HttpClient::Preconditions.assert_class('cvv', x, String)) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }) @destination = (x = opts.delete(:destination); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))) @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)) = (x = opts.delete(:options); x.nil? ? nil : HttpClient::Preconditions.assert_class('options', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AuthorizationOption) ? x : ::Io::Flow::V0::Models::AuthorizationOption.apply(x)) }) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
14766 14767 14768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14766 def amount @amount end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
14766 14767 14768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14766 def attributes @attributes end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
14766 14767 14768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14766 def currency @currency end |
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
14766 14767 14768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14766 def customer @customer end |
#cvv ⇒ Object (readonly)
Returns the value of attribute cvv.
14766 14767 14768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14766 def cvv @cvv end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
14766 14767 14768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14766 def destination @destination end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
14766 14767 14768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14766 def ip @ip end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
14766 14767 14768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14766 def key @key end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
14766 14767 14768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14766 def end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
14766 14767 14768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14766 def token @token end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
14788 14789 14790 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14788 def copy(incoming={}) DirectAuthorizationForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14792 def subtype_to_hash { :token => token, :amount => amount, :currency => currency, :customer => customer.nil? ? nil : customer.to_hash, :key => key, :cvv => cvv, :attributes => attributes.nil? ? nil : attributes, :destination => destination.nil? ? nil : destination.to_hash, :ip => ip, :options => .nil? ? nil : .map { |o| o.value } } end |
#to_json ⇒ Object
14784 14785 14786 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14784 def to_json JSON.dump(to_hash) end |