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.
-
#billing_address ⇒ Object
readonly
Returns the value of attribute billing_address.
-
#browser_info ⇒ Object
readonly
Returns the value of attribute browser_info.
-
#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.
-
#inline_action_configuration ⇒ Object
readonly
Returns the value of attribute inline_action_configuration.
-
#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.
-
#redirect_urls ⇒ Object
readonly
Returns the value of attribute redirect_urls.
-
#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.
39907 39908 39909 39910 39911 39912 39913 39914 39915 39916 39917 39918 39919 39920 39921 39922 39923 39924 39925 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39907 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::OrderCustomer) ? x : ::Io::Flow::V0::Models::OrderCustomer.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))) @billing_address = (x = opts.delete(:billing_address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingAddress) ? x : ::Io::Flow::V0::Models::BillingAddress.new(x))) @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)) @options = (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)) }) @redirect_urls = (x = opts.delete(:redirect_urls); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PostPaymentRedirectUrls) ? x : ::Io::Flow::V0::Models::PostPaymentRedirectUrls.new(x))) @browser_info = (x = opts.delete(:browser_info); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BrowserInfo) ? x : ::Io::Flow::V0::Models::BrowserInfo.new(x))) @inline_action_configuration = (x = opts.delete(:inline_action_configuration); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::InlineActionConfiguration) ? x : ::Io::Flow::V0::Models::InlineActionConfiguration.from_json(x))) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def amount @amount end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def attributes @attributes end |
#billing_address ⇒ Object (readonly)
Returns the value of attribute billing_address.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def billing_address @billing_address end |
#browser_info ⇒ Object (readonly)
Returns the value of attribute browser_info.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def browser_info @browser_info end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def currency @currency end |
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def customer @customer end |
#cvv ⇒ Object (readonly)
Returns the value of attribute cvv.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def cvv @cvv end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def destination @destination end |
#inline_action_configuration ⇒ Object (readonly)
Returns the value of attribute inline_action_configuration.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def inline_action_configuration @inline_action_configuration end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def ip @ip end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def key @key end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def @options end |
#redirect_urls ⇒ Object (readonly)
Returns the value of attribute redirect_urls.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def redirect_urls @redirect_urls end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
39905 39906 39907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39905 def token @token end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
39931 39932 39933 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39931 def copy(incoming={}) DirectAuthorizationForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
39935 39936 39937 39938 39939 39940 39941 39942 39943 39944 39945 39946 39947 39948 39949 39950 39951 39952 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39935 def subtype_to_hash { :token => token, :amount => amount.to_f.to_s, :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, :billing_address => billing_address.nil? ? nil : billing_address.to_hash, :ip => ip, :options => .nil? ? nil : .map { |o| o.value }, :redirect_urls => redirect_urls.nil? ? nil : redirect_urls.to_hash, :browser_info => browser_info.nil? ? nil : browser_info.to_hash, :inline_action_configuration => inline_action_configuration.nil? ? nil : inline_action_configuration.to_hash } end |
#to_json ⇒ Object
39927 39928 39929 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39927 def to_json JSON.dump(to_hash) end |