Class: Io::Flow::V0::Models::MerchantOfRecordAuthorizationForm

Inherits:
AuthorizationForm show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Creates an authorization for a transaction for which Flow is the merchant of record. In this case, you must provide your order number for a valid Flow order. 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

Attributes inherited from AuthorizationForm

#discriminator

Instance Method Summary collapse

Methods inherited from AuthorizationForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ MerchantOfRecordAuthorizationForm

Returns a new instance of MerchantOfRecordAuthorizationForm.



38947
38948
38949
38950
38951
38952
38953
38954
38955
38956
38957
38958
38959
38960
38961
38962
38963
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38947

def initialize(incoming={})
  super(:discriminator => AuthorizationForm::Types::MERCHANT_OF_RECORD_AUTHORIZATION_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:token, :order_number], 'MerchantOfRecordAuthorizationForm')
  @token = HttpClient::Preconditions.assert_class('token', opts.delete(:token), String)
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
  @amount = (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
  @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 })
  @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)))
  @action_configuration = (x = opts.delete(:action_configuration); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ActionConfiguration) ? x : ::Io::Flow::V0::Models::ActionConfiguration.from_json(x)))
end

Instance Attribute Details

#action_configurationObject (readonly)

Returns the value of attribute action_configuration.



38945
38946
38947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38945

def action_configuration
  @action_configuration
end

#amountObject (readonly)

Returns the value of attribute amount.



38945
38946
38947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38945

def amount
  @amount
end

#attributesObject (readonly)

Returns the value of attribute attributes.



38945
38946
38947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38945

def attributes
  @attributes
end

#browser_infoObject (readonly)

Returns the value of attribute browser_info.



38945
38946
38947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38945

def browser_info
  @browser_info
end

#currencyObject (readonly)

Returns the value of attribute currency.



38945
38946
38947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38945

def currency
  @currency
end

#cvvObject (readonly)

Returns the value of attribute cvv.



38945
38946
38947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38945

def cvv
  @cvv
end

#ipObject (readonly)

Returns the value of attribute ip.



38945
38946
38947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38945

def ip
  @ip
end

#keyObject (readonly)

Returns the value of attribute key.



38945
38946
38947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38945

def key
  @key
end

#optionsObject (readonly)

Returns the value of attribute options.



38945
38946
38947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38945

def options
  @options
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



38945
38946
38947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38945

def order_number
  @order_number
end

#redirect_urlsObject (readonly)

Returns the value of attribute redirect_urls.



38945
38946
38947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38945

def redirect_urls
  @redirect_urls
end

#tokenObject (readonly)

Returns the value of attribute token.



38945
38946
38947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38945

def token
  @token
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



38969
38970
38971
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38969

def copy(incoming={})
  MerchantOfRecordAuthorizationForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



38973
38974
38975
38976
38977
38978
38979
38980
38981
38982
38983
38984
38985
38986
38987
38988
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38973

def subtype_to_hash
  {
    :token => token,
    :order_number => order_number,
    :amount => amount.to_f.to_s,
    :currency => currency,
    :key => key,
    :cvv => cvv,
    :attributes => attributes.nil? ? nil : attributes,
    :ip => ip,
    :options => options.nil? ? nil : options.map { |o| o.value },
    :redirect_urls => redirect_urls.nil? ? nil : redirect_urls.to_hash,
    :browser_info => browser_info.nil? ? nil : browser_info.to_hash,
    :action_configuration => action_configuration.nil? ? nil : action_configuration.to_hash
  }
end

#to_jsonObject



38965
38966
38967
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38965

def to_json
  JSON.dump(to_hash)
end