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.



46578
46579
46580
46581
46582
46583
46584
46585
46586
46587
46588
46589
46590
46591
46592
46593
46594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46578

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)))
  @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

#amountObject (readonly)

Returns the value of attribute amount.



46576
46577
46578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46576

def amount
  @amount
end

#attributesObject (readonly)

Returns the value of attribute attributes.



46576
46577
46578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46576

def attributes
  @attributes
end

#browser_infoObject (readonly)

Returns the value of attribute browser_info.



46576
46577
46578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46576

def browser_info
  @browser_info
end

#currencyObject (readonly)

Returns the value of attribute currency.



46576
46577
46578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46576

def currency
  @currency
end

#cvvObject (readonly)

Returns the value of attribute cvv.



46576
46577
46578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46576

def cvv
  @cvv
end

#inline_action_configurationObject (readonly)

Returns the value of attribute inline_action_configuration.



46576
46577
46578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46576

def inline_action_configuration
  @inline_action_configuration
end

#ipObject (readonly)

Returns the value of attribute ip.



46576
46577
46578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46576

def ip
  @ip
end

#keyObject (readonly)

Returns the value of attribute key.



46576
46577
46578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46576

def key
  @key
end

#optionsObject (readonly)

Returns the value of attribute options.



46576
46577
46578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46576

def options
  @options
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



46576
46577
46578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46576

def order_number
  @order_number
end

#redirect_urlsObject (readonly)

Returns the value of attribute redirect_urls.



46576
46577
46578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46576

def redirect_urls
  @redirect_urls
end

#tokenObject (readonly)

Returns the value of attribute token.



46576
46577
46578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46576

def token
  @token
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



46600
46601
46602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46600

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

#subtype_to_hashObject



46604
46605
46606
46607
46608
46609
46610
46611
46612
46613
46614
46615
46616
46617
46618
46619
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46604

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,
    :inline_action_configuration => inline_action_configuration.nil? ? nil : inline_action_configuration.to_hash
  }
end

#to_jsonObject



46596
46597
46598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46596

def to_json
  JSON.dump(to_hash)
end